@capagents/forgeqe 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/docs-site/docs/index.html +29 -7
  2. package/dist/docs-site/docs/mobile/index.html +29 -7
  3. package/dist/docs-site/docs/search.js +1 -1
  4. package/dist/forgeqe.js +969 -959
  5. package/dist/web/assets/{Agent-Q7njo1Nn.js → Agent-BMqCDZeZ.js} +1 -1
  6. package/dist/web/assets/ApiTests-CkxIx6sI.js +2 -0
  7. package/dist/web/assets/{Chat-QFcqaBtK.js → Chat-BT6yGqKW.js} +3 -3
  8. package/dist/web/assets/{Data-CYWRWMA2.js → Data-BPtl_mUy.js} +4 -4
  9. package/dist/web/assets/{Features-CuixPXUj.js → Features-DwHyOoJu.js} +1 -1
  10. package/dist/web/assets/{Jobs-B88qIb_r.js → Jobs-DW2uXMkv.js} +3 -3
  11. package/dist/web/assets/{Quality-BIUiBg1X.js → Quality-BeuhtzZi.js} +1 -1
  12. package/dist/web/assets/Record-EHgUTspl.js +1 -0
  13. package/dist/web/assets/{Regression-BH1i_yvJ.js → Regression-BDq3BUP_.js} +2 -2
  14. package/dist/web/assets/{Reports-DnidGC7G.js → Reports-Bapldq1A.js} +2 -2
  15. package/dist/web/assets/{Response-o9QqBpwk.js → Response-Dh_kxnCt.js} +3 -3
  16. package/dist/web/assets/Runs-BOi2fP0o.js +2 -0
  17. package/dist/web/assets/{circle-dashed-CO-RmzsR.js → circle-dashed-C84s5T0C.js} +1 -1
  18. package/dist/web/assets/{frame-C0RAa-Ev.js → frame-z3iL_6aL.js} +2 -2
  19. package/dist/web/assets/index-BVw2ygO2.js +26 -0
  20. package/dist/web/assets/index-CBa29-yG.css +2 -0
  21. package/dist/web/assets/{markdown-9nLYjAqd.js → markdown-BtqKvAEi.js} +1 -1
  22. package/dist/web/assets/{sticky-note-BffcGVvl.js → sticky-note-C_NJNONZ.js} +1 -1
  23. package/dist/web/assets/{trending-up-BbHX2F6j.js → trending-up-DK1wDqic.js} +1 -1
  24. package/dist/web/index.html +3 -3
  25. package/docs/MOBILE.md +29 -7
  26. package/docs/user-guide.html +29 -7
  27. package/forgeqe.example.yaml +7 -0
  28. package/package.json +1 -1
  29. package/py/forgeqe_mobile/cli.py +9 -2
  30. package/py/forgeqe_mobile/hyperexecute.py +133 -19
  31. package/py/forgeqe_mobile/maestro.py +45 -3
  32. package/py/forgeqe_mobile/service.py +51 -14
  33. package/dist/web/assets/ApiTests-C0ZAAuTl.js +0 -2
  34. package/dist/web/assets/Record-DnT3bDoJ.js +0 -1
  35. package/dist/web/assets/Runs-hOT-2g1a.js +0 -2
  36. package/dist/web/assets/index-BdhUnF_q.css +0 -2
  37. package/dist/web/assets/index-DBQd0Qgk.js +0 -26
@@ -1 +1 @@
1
- import{$t as e,Bt as t,E as n,Et as r,Fr as i,G as a,Mr as o,Nn as s,Sr as c,Wn as l,X as u,Z as d,_t as f,ar as p,bt as m,dt as h,fr as g,ir as _,ln as v,ot as y,r as b,st as x,t as S,vn as C,yt as w}from"./frame-C0RAa-Ev.js";import{t as T}from"./circle-dashed-CO-RmzsR.js";import{i as E,t as D}from"./markdown-9nLYjAqd.js";import{n as O,t as k}from"./trending-up-BbHX2F6j.js";import{T as A,i as j,n as M,r as N,t as P}from"./index-DBQd0Qgk.js";import{n as F,t as I}from"./when-CHnpLdYw.js";var L={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};L.node;var R=p(L),z=i(o(),1),B=w(),V=[`critical`,`serious`,`moderate`,`minor`],H={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},U=[{key:`lcp`,label:`LCP`,good:2500,poor:4e3,unit:`ms`},{key:`cls`,label:`CLS`,good:.1,poor:.25,unit:``},{key:`inp`,label:`INP`,good:200,poor:500,unit:`ms`},{key:`fcp`,label:`FCP`,good:1800,poor:3e3,unit:`ms`},{key:`ttfb`,label:`TTFB`,good:800,poor:1800,unit:`ms`},{key:`load`,label:`Load`,good:1/0,poor:1/0,unit:`ms`}],W={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},G=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),K=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),q=(e,t)=>`${e} ${t}${e===1?``:`s`}`,J=e=>{try{let t=new URL(e);return`${t.host}${t.pathname}${t.search}`}catch{return e}};function Y(e){let t=[];return e.a11y&&t.push(e.a11y.failed?`${q(e.a11y.failed,`rule`)} failed`:`WCAG clean`),e.perf.over&&t.push(`${q(e.perf.over,`page`)} slow`),e.visual?.changed&&t.push(`${e.visual.changed} changed`),e.captured&&t.push(`not compared`),t.join(` · `)||`measured`}var X=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed),Z=25;function ee({run:e,standard:t}){let n=e.report,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(`all`);if(!n?.accessibility.pages)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let s=n.accessibility,c=n.breaches.filter(e=>e.kind===`accessibility`),l=a===`all`?s.failed:s.failed.filter(e=>e.impact===a),u=[{id:`all`,label:`All`,n:s.failed.length},...V.filter(e=>s.failed.some(t=>t.impact===e)).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1),n:s.failed.filter(t=>t.impact===e).length,alert:e===`critical`||e===`serious`}))];return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,n.engine||`axe`,`: `,q(s.passed.length,`rule`),` passed, `,s.failed.length,` failed, on `,q(s.pages,`page`),`. `,n.budgets.accessibility?c.length?`${q(c.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),c.map((e,t)=>(0,B.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[J(e.page),`: `,e.text]},t)),s.failed.length?(0,B.jsxs)(B.Fragment,{children:[u.length>2&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,B.jsx)(P,{items:u,value:a,onChange:o})}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:l.map(t=>(0,B.jsx)(te,{f:t,examples:e.examples[t.rule]??[],open:r===t.rule,onToggle:()=>i(r===t.rule?null:t.rule)},t.rule))})]}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`No rule failed on the pages this run visited.`})]})}function te({f:e,examples:t,open:n,onToggle:r}){return(0,B.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-12 w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-1.5 text-left text-ink hover:bg-surface-muted`,children:[(0,B.jsx)(j,{tone:H[e.impact],className:`w-[88px] flex-none justify-center`,children:e.impact}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.help}),(0,B.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.rule,e.wcag?` · WCAG ${e.wcag}${e.level?` (${e.level})`:``}`:``,` · `,q(e.count,`element`),` on `,q(e.pages,`page`)]})]})]}),(0,B.jsx)(x,{open:n,children:(0,B.jsxs)(`div`,{className:`mb-3 ml-[104px] flex flex-col gap-2 text-sm max-sm:ml-2`,children:[t.length?t.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[10px] bg-surface-muted p-2.5`,children:[(0,B.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[J(e.page),e.target?` · ${e.target}`:``]}),e.html&&(0,B.jsx)(`code`,{className:`font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.html})]},t)):(0,B.jsx)(`span`,{className:`text-muted`,children:`No elements were kept for this rule.`}),e.helpUrl&&E(e.helpUrl)===`web`&&(0,B.jsxs)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[13px]`,children:[`How to fix it `,(0,B.jsx)(s,{size:13,"aria-hidden":`true`})]})]})})]})}function ne({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no timings: the run visited no page.`});let n=(e,t)=>e>t.poor?`poor`:e>t.good?`needs improvement`:`good`,r={poor:`text-fail`,"needs improvement":`text-warn`,good:`text-pass`};return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals per page against Google's thresholds: `,(0,B.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,B.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,B.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,t.budgets.performance?`Pages over the budget in quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings (quality.budgets.performance).`]}),(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full min-w-[640px] border-collapse text-sm`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-[12px] text-muted`,children:[(0,B.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Page`}),U.map(e=>(0,B.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:e.label},e.key)),(0,B.jsx)(`th`,{className:`py-2 pl-2 text-right font-medium`,children:`Requests`})]})}),(0,B.jsx)(`tbody`,{children:t.performance.pages.map((e,t)=>(0,B.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,B.jsxs)(`td`,{className:`py-2 pr-3`,children:[(0,B.jsx)(`span`,{className:`block font-mono text-[12px] [overflow-wrap:anywhere]`,children:J(e.url)}),e.over.length>0&&(0,B.jsx)(`span`,{className:`text-[12px] text-fail`,children:e.over.join(`, `)})]}),U.map(t=>{let i=e[t.key];return(0,B.jsxs)(`td`,{className:m(`px-2 py-2 text-right tabular-nums`,typeof i==`number`&&t.good!==1/0?r[n(i,t)]:typeof i==`number`?`text-ink-2`:`text-muted`),children:[typeof i==`number`?K(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,B.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,B.jsx)(`td`,{className:`py-2 pl-2 text-right text-muted tabular-nums`,children:e.requests?`${e.requests} · ${e.kb} KB`:`–`})]},t))})]})})]})}function Q({run:e,index:t,which:n,label:r}){let[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{let r=!1;return a(``),s(!1),c.image(e,t,n).then(e=>!r&&a(e),()=>!r&&s(!0)),()=>{r=!0}},[e,t,n]),(0,B.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,B.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:r}),i?(0,B.jsx)(`img`,{src:i,alt:`${r} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,B.jsx)(`span`,{className:`flex h-[120px] items-center justify-center gap-2 rounded-[10px] border border-line-soft bg-surface-muted text-[12px] text-muted`,children:o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(R,{size:14,"aria-hidden":`true`}),` Not available`]}):`Loading…`})]})}function re({run:e,budget:n,onChange:r}){let[i,o]=(0,z.useState)(null),[s,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),[p,g]=(0,z.useState)(``),[_,y]=(0,z.useState)(null),b=e.visual?.pages??[],S=b.find(e=>e.status===`changed`)?.index??null;(0,z.useEffect)(()=>y(S),[e.id,S]);let C=async e=>{d(!0),g(``);try{r(await e()),o(null),l(``)}catch(e){g(e.message)}finally{d(!1)}};if(!e.visual)return e.captured?(0,B.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`This run captured `,q(e.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,B.jsxs)(h,{variant:`primary`,disabled:u,onClick:()=>C(()=>c.compare(e.id)),children:[(0,B.jsx)(f,{icon:t,size:16}),`Compare with the baselines`]}),p&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p})]}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let w=b.filter(e=>e.status===`changed`);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`p`,{className:`m-0 flex-1 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,n?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run (quality.budgets.visual).`]}),w.length>1&&(0,B.jsxs)(h,{disabled:u,onClick:()=>o(w.map(e=>e.url)),children:[`Approve all `,w.length,` changes`]})]}),i&&(0,B.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-3 rounded-[12px] border border-accent-line bg-accent-soft p-4`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,i.length===1?J(i[0]):q(i.length,`page`),`?`]}),(0,B.jsx)(`span`,{className:`text-sm text-ink-2`,children:`Later runs are compared with it. Approve only a change that was intended; one that was not is a visual defect.`}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Why it changed (kept with the baseline)`,(0,B.jsx)(a,{value:s,maxLength:300,placeholder:`New checkout banner`,onChange:e=>l(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(h,{variant:`primary`,disabled:u,onClick:()=>C(()=>c.approve(e.id,i,s.trim()||void 0)),children:[(0,B.jsx)(A,{size:16,"aria-hidden":`true`}),`Approve`]}),(0,B.jsx)(h,{onClick:()=>o(null),children:`Cancel`})]})]}),p&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:b.map(t=>(0,B.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":_===t.index,onClick:()=>y(_===t.index?null:t.index),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,B.jsx)(f,{icon:v,size:16,className:`flex-none text-muted`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:t.title||J(t.url)}),(0,B.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[J(t.url),t.size?` · ${t.size}`:``,t.resized?` · resized ${t.resized}`:``]})]}),t.status===`changed`&&(0,B.jsxs)(`span`,{className:m(`text-sm tabular-nums`,t.over?`text-fail`:`text-warn`),children:[t.diffPercent,`%`,t.limit===void 0?``:` / ${t.limit}%`]}),(0,B.jsx)(j,{tone:t.over?`fail`:W[t.status].tone,children:t.over?`Over budget`:W[t.status].label})]}),(0,B.jsx)(x,{open:_===t.index,children:(0,B.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 px-1`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-3`,children:[t.images.baseline&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`baseline`,label:`Baseline`}),t.images.current&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`current`,label:`This run`}),t.images.diff&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`diff`,label:`Difference (in red)`})]}),t.status===`changed`&&(0,B.jsxs)(h,{className:`self-start`,disabled:u,onClick:()=>o([t.url]),children:[(0,B.jsx)(A,{size:16,"aria-hidden":`true`}),`Approve as the new baseline`]})]})})]},t.index))})]})}function ie({values:e}){if(e.length<2)return null;let t=Math.max(1,...e),n=e.map((n,r)=>`${r/(e.length-1)*96+2},${22-n/t*20}`).join(` `);return(0,B.jsx)(`svg`,{width:`100`,height:`24`,viewBox:`0 0 100 24`,"aria-label":`Violations over the last ${e.length} runs: ${e.join(`, `)}`,role:`img`,className:`flex-none text-muted`,children:(0,B.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function $({icon:e,className:t,lines:n}){return n.length?(0,B.jsxs)(`span`,{className:m(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,B.jsx)(f,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function ae({trends:e}){return e.length?(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?V.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,B.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.page}),(0,B.jsx)(ie,{values:e.a11y.trail}),(0,B.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[q(e.runs,`run`),t===void 0?``:` · ${q(t,`violation`)} now`]})]}),(0,B.jsx)($,{icon:k,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,B.jsx)($,{icon:O,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No history yet: every browser run adds each page's accessibility and timings to quality-history.json in the reports folder.`})}function oe({id:t,view:n,onChanged:i}){let[a,o]=(0,z.useState)(null),[s,u]=(0,z.useState)(``),[p,y]=(0,z.useState)(`accessibility`),[b,x]=(0,z.useState)(``);if((0,z.useEffect)(()=>{let e=!1;return o(null),c.run(t).then(t=>{if(e)return;o(t),u(``);let n=t.visual?.pages.some(e=>e.status===`changed`)||!t.visual&&t.captured;y(t.report?.breaches.some(e=>e.kind===`performance`)&&!t.report.accessibility.failed.length?`performance`:n&&!t.report?.accessibility.failed.length?`visual`:t.report?.accessibility.pages?`accessibility`:t.report?.performance.pages.length?`performance`:`visual`)},t=>!e&&u(t.message)),()=>{e=!0}},[t]),s)return(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:s});if(!a)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let S=async()=>{try{let{id:e}=await g.start(`Explain the accessibility, performance and visual results of the run in ${a.dir}: call quality_report and visual_compare with run_dir ${a.dir}. Say what matters most to fix first, and why.`,{});location.hash=d(`chats`,e)}catch(e){x(e.message)}},w=a.report,E=w?.accessibility.failed??[],O=V.find(e=>E.some(t=>t.impact===e)),k=w?.performance.pages.filter(e=>e.over.length).length??0,j=a.visual?.pages.filter(e=>e.status===`changed`).length??0,M=e=>!!w?.breaches.some(t=>t.kind===e),N=[{id:`accessibility`,label:`Accessibility`,icon:_,state:w?.accessibility.pages?M(`accessibility`)||O===`critical`?`fail`:E.length?`warn`:`pass`:`none`,headline:w?.accessibility.pages?E.length?`${q(E.length,`rule`)} failed`:`No rule failed`:`Not measured`,note:w?.accessibility.pages?V.filter(e=>w.accessibility.byImpact[e]).map(e=>`${w.accessibility.byImpact[e]} ${e}`).join(` · `)||`${q(w.accessibility.pages,`page`)} checked`:``},{id:`performance`,label:`Performance`,icon:C,state:w?.performance.pages.length?M(`performance`)?`fail`:k?`warn`:`pass`:`none`,headline:w?.performance.pages.length?k?`${q(k,`page`)} over budget`:`Within budget`:`Not measured`,note:w?.performance.pages.length?`${q(w.performance.pages.length,`page`)} timed`:``},{id:`visual`,label:`Visual`,icon:v,state:a.visual?M(`visual`)?`fail`:j?`warn`:`pass`:`none`,headline:a.visual?j?`${q(j,`page`)} changed`:`No change`:a.captured?`Not compared yet`:`Not captured`,note:a.visual?`${q(a.visual.pages.length,`page`)} against the baseline`:a.captured?`${q(a.captured,`page`)} captured`:``}],P={pass:A,warn:r,fail:l,none:T},F={pass:`text-pass`,warn:`text-warn`,fail:`text-fail`,none:`text-muted`};return(0,B.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,B.jsx)(`h2`,{id:`run-h`,title:a.goal,className:`m-0 line-clamp-2 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:a.goal}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[G(a.at),` · `,(0,B.jsx)(D,{path:a.dir})]})]}),(0,B.jsxs)(h,{size:`sm`,variant:`ghost`,onClick:()=>void S(),children:[(0,B.jsx)(f,{icon:e,size:15}),`Ask in a chat`]})]}),b&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:b}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`Results`,className:`grid gap-2 @xl:grid-cols-3`,children:N.map(e=>{let t=P[e.state];return(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":p===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>y(e.id),className:m(`flex min-w-0 cursor-pointer flex-col gap-1 rounded-[14px] border px-4 py-3 text-left`,p===e.id?`border-accent bg-accent-soft`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:[(0,B.jsx)(f,{icon:e.icon,size:14}),e.label]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[16px] font-semibold text-ink`,children:[(0,B.jsx)(t,{size:16,"aria-hidden":`true`,className:m(`flex-none`,F[e.state])}),e.headline]}),e.note&&(0,B.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.note})]},e.id)})}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`,className:`flex min-w-0 flex-col`,children:[p===`accessibility`&&(0,B.jsx)(ee,{run:a,standard:n.standard}),p===`performance`&&(0,B.jsx)(ne,{run:a}),p===`visual`&&(0,B.jsx)(re,{run:a,budget:n.budgets.visual,onChange:e=>{o(e),i()}})]}),p===`accessibility`&&a.report?.accessibility.pages?(0,B.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n.disclaimer}):null]})}function se({sub:e}){let[t,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(``),[s,p]=(0,z.useState)(e===`trends`?`trends`:`runs`),h=(0,z.useCallback)(()=>{c.view().then(e=>{i(e),o(``)},e=>o(e.message))},[]);(0,z.useEffect)(h,[h]);let g=e&&e!==`trends`?decodeURIComponent(e):``;(0,z.useEffect)(()=>{e===`trends`?p(`trends`):e&&p(`runs`)},[e]);let v=(0,z.useMemo)(()=>t?.runs.find(e=>e.id===g)||t?.runs[0],[t,g]),x=t?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0,[C,w]=(0,z.useState)(``),[T,E]=(0,z.useState)(`all`),[D,O]=(0,z.useState)(0);(0,z.useEffect)(()=>O(0),[C,T]);let k=C.toLowerCase().split(/\s+/).filter(Boolean),j=(t?.runs??[]).filter(e=>k.every(t=>e.goal.toLowerCase().includes(t))),L=T===`attention`?j.filter(X):j;return(0,B.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,B.jsx)(b,{}),(0,B.jsxs)(`main`,{className:m(S,`@container flex-auto gap-4`),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,B.jsx)(y,{pixel:u.quality,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`})]}),(0,B.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`What each browser run measured on the pages it visited: accessibility (`,t?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run.`]}),a&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),!t&&!a&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(n,{label:`Quality`,current:s,onPick:e=>{p(e),e===`trends`?location.hash=d(`quality`,`trends`):location.hash=v?d(`quality`,encodeURIComponent(v.id)):d(`quality`)},tabs:[{id:`runs`,label:`Runs (${t.runs.length})`},{id:`trends`,label:`Trends${x?` (${x} worse)`:``}`}]}),t&&s===`trends`&&(0,B.jsx)(`div`,{role:`tabpanel`,id:`panel-trends`,"aria-labelledby":`tab-trends`,children:(0,B.jsx)(ae,{trends:t.trends})}),t&&s===`runs`&&(t.runs.length?(0,B.jsxs)(`div`,{role:`tabpanel`,id:`panel-runs`,"aria-labelledby":`tab-runs`,className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,B.jsxs)(`nav`,{"aria-label":`Runs`,className:`flex min-w-0 flex-col gap-2 @2xl:sticky @2xl:top-6 @2xl:w-[290px] @2xl:flex-none`,children:[(0,B.jsx)(N,{id:`quality-search`,label:`Find a run`,value:C,onChange:w,className:`flex-none`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,B.jsx)(P,{items:[{id:`all`,label:`All`,n:j.length},{id:`attention`,label:`Needs a look`,n:j.filter(X).length,alert:!0}],value:T,onChange:E})}),(0,B.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[L.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-3 text-sm text-muted`,children:`Nothing matches.`}),L.slice(D*Z,D*Z+Z).map((e,t,n)=>{let i=F(e.at),a=e.breaches?l:X(e)?r:A;return(0,B.jsxs)(`li`,{className:`contents`,children:[(t===0||F(n[t-1].at)!==i)&&(0,B.jsx)(`span`,{className:`block px-3 pt-2 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,B.jsxs)(`a`,{href:d(`quality`,encodeURIComponent(e.id)),"aria-current":v?.id===e.id?`page`:void 0,className:m(`flex min-h-12 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,v?.id===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[(0,B.jsx)(a,{size:16,"aria-label":e.breaches?`Over a budget`:X(e)?`Needs a look`:`Within budgets`,className:m(`flex-none`,e.breaches?`text-fail`:X(e)?`text-warn`:`text-pass`)}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.goal,children:e.goal}),(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:Y(e)})]}),(0,B.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:I(e.at)})]})]},e.id)})]}),L.length>Z&&(0,B.jsx)(M,{page:D,size:Z,total:L.length,onPage:O,label:`Pages of runs`})]}),v&&(0,B.jsx)(oe,{id:v.id,view:t,onChanged:h})]}):(0,B.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,B.jsx)(f,{icon:_,size:24,className:`text-muted`}),(0,B.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No run has measured anything yet. Every browser run checks accessibility, timings and visual changes of the pages it visits; run a flow from a chat or the Record page, and its results show here.`})]}))]})]})}export{se as Quality};
1
+ import{$t as e,Bt as t,E as n,Et as r,Fr as i,G as a,Mr as o,Nn as s,Sr as c,Wn as l,X as u,Z as d,_t as f,ar as p,bt as m,dt as h,fr as g,ir as _,ln as v,ot as y,r as b,t as x,ut as S,vn as C,yt as w}from"./frame-z3iL_6aL.js";import{t as T}from"./circle-dashed-C84s5T0C.js";import{i as E,t as D}from"./markdown-BtqKvAEi.js";import{n as O,t as k}from"./trending-up-DK1wDqic.js";import{E as A,i as j,n as M,r as N,t as P}from"./index-BVw2ygO2.js";import{n as F,t as I}from"./when-CHnpLdYw.js";var L={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};L.node;var R=p(L),z=i(o(),1),B=w(),V=[`critical`,`serious`,`moderate`,`minor`],H={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},U=[{key:`lcp`,label:`LCP`,good:2500,poor:4e3,unit:`ms`},{key:`cls`,label:`CLS`,good:.1,poor:.25,unit:``},{key:`inp`,label:`INP`,good:200,poor:500,unit:`ms`},{key:`fcp`,label:`FCP`,good:1800,poor:3e3,unit:`ms`},{key:`ttfb`,label:`TTFB`,good:800,poor:1800,unit:`ms`},{key:`load`,label:`Load`,good:1/0,poor:1/0,unit:`ms`}],W={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},G=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),K=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),q=(e,t)=>`${e} ${t}${e===1?``:`s`}`,J=e=>{try{let t=new URL(e);return`${t.host}${t.pathname}${t.search}`}catch{return e}};function Y(e){let t=[];return e.a11y&&t.push(e.a11y.failed?`${q(e.a11y.failed,`rule`)} failed`:`WCAG clean`),e.perf.over&&t.push(`${q(e.perf.over,`page`)} slow`),e.visual?.changed&&t.push(`${e.visual.changed} changed`),e.captured&&t.push(`not compared`),t.join(` · `)||`measured`}var X=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed),Z=25;function ee({run:e,standard:t}){let n=e.report,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(`all`);if(!n?.accessibility.pages)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let s=n.accessibility,c=n.breaches.filter(e=>e.kind===`accessibility`),l=a===`all`?s.failed:s.failed.filter(e=>e.impact===a),u=[{id:`all`,label:`All`,n:s.failed.length},...V.filter(e=>s.failed.some(t=>t.impact===e)).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1),n:s.failed.filter(t=>t.impact===e).length,alert:e===`critical`||e===`serious`}))];return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,n.engine||`axe`,`: `,q(s.passed.length,`rule`),` passed, `,s.failed.length,` failed, on `,q(s.pages,`page`),`. `,n.budgets.accessibility?c.length?`${q(c.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),c.map((e,t)=>(0,B.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[J(e.page),`: `,e.text]},t)),s.failed.length?(0,B.jsxs)(B.Fragment,{children:[u.length>2&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,B.jsx)(P,{items:u,value:a,onChange:o})}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:l.map(t=>(0,B.jsx)(te,{f:t,examples:e.examples[t.rule]??[],open:r===t.rule,onToggle:()=>i(r===t.rule?null:t.rule)},t.rule))})]}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`No rule failed on the pages this run visited.`})]})}function te({f:e,examples:t,open:n,onToggle:r}){return(0,B.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-12 w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-1.5 text-left text-ink hover:bg-surface-muted`,children:[(0,B.jsx)(j,{tone:H[e.impact],className:`w-[88px] flex-none justify-center`,children:e.impact}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.help}),(0,B.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.rule,e.wcag?` · WCAG ${e.wcag}${e.level?` (${e.level})`:``}`:``,` · `,q(e.count,`element`),` on `,q(e.pages,`page`)]})]})]}),(0,B.jsx)(y,{open:n,children:(0,B.jsxs)(`div`,{className:`mb-3 ml-[104px] flex flex-col gap-2 text-sm max-sm:ml-2`,children:[t.length?t.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[10px] bg-surface-muted p-2.5`,children:[(0,B.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[J(e.page),e.target?` · ${e.target}`:``]}),e.html&&(0,B.jsx)(`code`,{className:`font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.html})]},t)):(0,B.jsx)(`span`,{className:`text-muted`,children:`No elements were kept for this rule.`}),e.helpUrl&&E(e.helpUrl)===`web`&&(0,B.jsxs)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[13px]`,children:[`How to fix it `,(0,B.jsx)(s,{size:13,"aria-hidden":`true`})]})]})})]})}function ne({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no timings: the run visited no page.`});let n=(e,t)=>e>t.poor?`poor`:e>t.good?`needs improvement`:`good`,r={poor:`text-fail`,"needs improvement":`text-warn`,good:`text-pass`};return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals per page against Google's thresholds: `,(0,B.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,B.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,B.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,t.budgets.performance?`Pages over the budget in quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings (quality.budgets.performance).`]}),(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full min-w-[640px] border-collapse text-sm`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-[12px] text-muted`,children:[(0,B.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Page`}),U.map(e=>(0,B.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:e.label},e.key)),(0,B.jsx)(`th`,{className:`py-2 pl-2 text-right font-medium`,children:`Requests`})]})}),(0,B.jsx)(`tbody`,{children:t.performance.pages.map((e,t)=>(0,B.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,B.jsxs)(`td`,{className:`py-2 pr-3`,children:[(0,B.jsx)(`span`,{className:`block font-mono text-[12px] [overflow-wrap:anywhere]`,children:J(e.url)}),e.over.length>0&&(0,B.jsx)(`span`,{className:`text-[12px] text-fail`,children:e.over.join(`, `)})]}),U.map(t=>{let i=e[t.key];return(0,B.jsxs)(`td`,{className:m(`px-2 py-2 text-right tabular-nums`,typeof i==`number`&&t.good!==1/0?r[n(i,t)]:typeof i==`number`?`text-ink-2`:`text-muted`),children:[typeof i==`number`?K(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,B.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,B.jsx)(`td`,{className:`py-2 pl-2 text-right text-muted tabular-nums`,children:e.requests?`${e.requests} · ${e.kb} KB`:`–`})]},t))})]})})]})}function Q({run:e,index:t,which:n,label:r}){let[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{let r=!1;return a(``),s(!1),c.image(e,t,n).then(e=>!r&&a(e),()=>!r&&s(!0)),()=>{r=!0}},[e,t,n]),(0,B.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,B.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:r}),i?(0,B.jsx)(`img`,{src:i,alt:`${r} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,B.jsx)(`span`,{className:`flex h-[120px] items-center justify-center gap-2 rounded-[10px] border border-line-soft bg-surface-muted text-[12px] text-muted`,children:o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(R,{size:14,"aria-hidden":`true`}),` Not available`]}):`Loading…`})]})}function re({run:e,budget:n,onChange:r}){let[i,o]=(0,z.useState)(null),[s,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),[p,g]=(0,z.useState)(``),[_,b]=(0,z.useState)(null),x=e.visual?.pages??[],S=x.find(e=>e.status===`changed`)?.index??null;(0,z.useEffect)(()=>b(S),[e.id,S]);let C=async e=>{d(!0),g(``);try{r(await e()),o(null),l(``)}catch(e){g(e.message)}finally{d(!1)}};if(!e.visual)return e.captured?(0,B.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`This run captured `,q(e.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,B.jsxs)(h,{variant:`primary`,disabled:u,onClick:()=>C(()=>c.compare(e.id)),children:[(0,B.jsx)(f,{icon:t,size:16}),`Compare with the baselines`]}),p&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p})]}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let w=x.filter(e=>e.status===`changed`);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`p`,{className:`m-0 flex-1 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,n?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run (quality.budgets.visual).`]}),w.length>1&&(0,B.jsxs)(h,{disabled:u,onClick:()=>o(w.map(e=>e.url)),children:[`Approve all `,w.length,` changes`]})]}),i&&(0,B.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-3 rounded-[12px] border border-accent-line bg-accent-soft p-4`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,i.length===1?J(i[0]):q(i.length,`page`),`?`]}),(0,B.jsx)(`span`,{className:`text-sm text-ink-2`,children:`Later runs are compared with it. Approve only a change that was intended; one that was not is a visual defect.`}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Why it changed (kept with the baseline)`,(0,B.jsx)(a,{value:s,maxLength:300,placeholder:`New checkout banner`,onChange:e=>l(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(h,{variant:`primary`,disabled:u,onClick:()=>C(()=>c.approve(e.id,i,s.trim()||void 0)),children:[(0,B.jsx)(A,{size:16,"aria-hidden":`true`}),`Approve`]}),(0,B.jsx)(h,{onClick:()=>o(null),children:`Cancel`})]})]}),p&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:x.map(t=>(0,B.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":_===t.index,onClick:()=>b(_===t.index?null:t.index),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,B.jsx)(f,{icon:v,size:16,className:`flex-none text-muted`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:t.title||J(t.url)}),(0,B.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[J(t.url),t.size?` · ${t.size}`:``,t.resized?` · resized ${t.resized}`:``]})]}),t.status===`changed`&&(0,B.jsxs)(`span`,{className:m(`text-sm tabular-nums`,t.over?`text-fail`:`text-warn`),children:[t.diffPercent,`%`,t.limit===void 0?``:` / ${t.limit}%`]}),(0,B.jsx)(j,{tone:t.over?`fail`:W[t.status].tone,children:t.over?`Over budget`:W[t.status].label})]}),(0,B.jsx)(y,{open:_===t.index,children:(0,B.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 px-1`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-3`,children:[t.images.baseline&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`baseline`,label:`Baseline`}),t.images.current&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`current`,label:`This run`}),t.images.diff&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`diff`,label:`Difference (in red)`})]}),t.status===`changed`&&(0,B.jsxs)(h,{className:`self-start`,disabled:u,onClick:()=>o([t.url]),children:[(0,B.jsx)(A,{size:16,"aria-hidden":`true`}),`Approve as the new baseline`]})]})})]},t.index))})]})}function ie({values:e}){if(e.length<2)return null;let t=Math.max(1,...e),n=e.map((n,r)=>`${r/(e.length-1)*96+2},${22-n/t*20}`).join(` `);return(0,B.jsx)(`svg`,{width:`100`,height:`24`,viewBox:`0 0 100 24`,"aria-label":`Violations over the last ${e.length} runs: ${e.join(`, `)}`,role:`img`,className:`flex-none text-muted`,children:(0,B.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function $({icon:e,className:t,lines:n}){return n.length?(0,B.jsxs)(`span`,{className:m(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,B.jsx)(f,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function ae({trends:e}){return e.length?(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?V.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,B.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.page}),(0,B.jsx)(ie,{values:e.a11y.trail}),(0,B.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[q(e.runs,`run`),t===void 0?``:` · ${q(t,`violation`)} now`]})]}),(0,B.jsx)($,{icon:k,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,B.jsx)($,{icon:O,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No history yet: every browser run adds each page's accessibility and timings to quality-history.json in the reports folder.`})}function oe({id:t,view:n,onChanged:i}){let[a,o]=(0,z.useState)(null),[s,u]=(0,z.useState)(``),[p,y]=(0,z.useState)(`accessibility`),[b,x]=(0,z.useState)(``);if((0,z.useEffect)(()=>{let e=!1;return o(null),c.run(t).then(t=>{if(e)return;o(t),u(``);let n=t.visual?.pages.some(e=>e.status===`changed`)||!t.visual&&t.captured;y(t.report?.breaches.some(e=>e.kind===`performance`)&&!t.report.accessibility.failed.length?`performance`:n&&!t.report?.accessibility.failed.length?`visual`:t.report?.accessibility.pages?`accessibility`:t.report?.performance.pages.length?`performance`:`visual`)},t=>!e&&u(t.message)),()=>{e=!0}},[t]),s)return(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:s});if(!a)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let S=async()=>{try{let{id:e}=await g.start(`Explain the accessibility, performance and visual results of the run in ${a.dir}: call quality_report and visual_compare with run_dir ${a.dir}. Say what matters most to fix first, and why.`,{});location.hash=d(`chats`,e)}catch(e){x(e.message)}},w=a.report,E=w?.accessibility.failed??[],O=V.find(e=>E.some(t=>t.impact===e)),k=w?.performance.pages.filter(e=>e.over.length).length??0,j=a.visual?.pages.filter(e=>e.status===`changed`).length??0,M=e=>!!w?.breaches.some(t=>t.kind===e),N=[{id:`accessibility`,label:`Accessibility`,icon:_,state:w?.accessibility.pages?M(`accessibility`)||O===`critical`?`fail`:E.length?`warn`:`pass`:`none`,headline:w?.accessibility.pages?E.length?`${q(E.length,`rule`)} failed`:`No rule failed`:`Not measured`,note:w?.accessibility.pages?V.filter(e=>w.accessibility.byImpact[e]).map(e=>`${w.accessibility.byImpact[e]} ${e}`).join(` · `)||`${q(w.accessibility.pages,`page`)} checked`:``},{id:`performance`,label:`Performance`,icon:C,state:w?.performance.pages.length?M(`performance`)?`fail`:k?`warn`:`pass`:`none`,headline:w?.performance.pages.length?k?`${q(k,`page`)} over budget`:`Within budget`:`Not measured`,note:w?.performance.pages.length?`${q(w.performance.pages.length,`page`)} timed`:``},{id:`visual`,label:`Visual`,icon:v,state:a.visual?M(`visual`)?`fail`:j?`warn`:`pass`:`none`,headline:a.visual?j?`${q(j,`page`)} changed`:`No change`:a.captured?`Not compared yet`:`Not captured`,note:a.visual?`${q(a.visual.pages.length,`page`)} against the baseline`:a.captured?`${q(a.captured,`page`)} captured`:``}],P={pass:A,warn:r,fail:l,none:T},F={pass:`text-pass`,warn:`text-warn`,fail:`text-fail`,none:`text-muted`};return(0,B.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,B.jsx)(`h2`,{id:`run-h`,title:a.goal,className:`m-0 line-clamp-2 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:a.goal}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[G(a.at),` · `,(0,B.jsx)(D,{path:a.dir})]})]}),(0,B.jsxs)(h,{size:`sm`,variant:`ghost`,onClick:()=>void S(),children:[(0,B.jsx)(f,{icon:e,size:15}),`Ask in a chat`]})]}),b&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:b}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`Results`,className:`grid gap-2 @xl:grid-cols-3`,children:N.map(e=>{let t=P[e.state];return(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":p===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>y(e.id),className:m(`flex min-w-0 cursor-pointer flex-col gap-1 rounded-[14px] border px-4 py-3 text-left`,p===e.id?`border-accent bg-accent-soft`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:[(0,B.jsx)(f,{icon:e.icon,size:14}),e.label]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[16px] font-semibold text-ink`,children:[(0,B.jsx)(t,{size:16,"aria-hidden":`true`,className:m(`flex-none`,F[e.state])}),e.headline]}),e.note&&(0,B.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.note})]},e.id)})}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`,className:`flex min-w-0 flex-col`,children:[p===`accessibility`&&(0,B.jsx)(ee,{run:a,standard:n.standard}),p===`performance`&&(0,B.jsx)(ne,{run:a}),p===`visual`&&(0,B.jsx)(re,{run:a,budget:n.budgets.visual,onChange:e=>{o(e),i()}})]}),p===`accessibility`&&a.report?.accessibility.pages?(0,B.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n.disclaimer}):null]})}function se({sub:e}){let[t,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(``),[s,p]=(0,z.useState)(e===`trends`?`trends`:`runs`),h=(0,z.useCallback)(()=>{c.view().then(e=>{i(e),o(``)},e=>o(e.message))},[]);(0,z.useEffect)(h,[h]);let g=e&&e!==`trends`?decodeURIComponent(e):``;(0,z.useEffect)(()=>{e===`trends`?p(`trends`):e&&p(`runs`)},[e]);let v=(0,z.useMemo)(()=>t?.runs.find(e=>e.id===g)||t?.runs[0],[t,g]),y=t?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0,[C,w]=(0,z.useState)(``),[T,E]=(0,z.useState)(`all`),[D,O]=(0,z.useState)(0);(0,z.useEffect)(()=>O(0),[C,T]);let k=C.toLowerCase().split(/\s+/).filter(Boolean),j=(t?.runs??[]).filter(e=>k.every(t=>e.goal.toLowerCase().includes(t))),L=T===`attention`?j.filter(X):j;return(0,B.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,B.jsx)(b,{}),(0,B.jsxs)(`main`,{className:m(x,`@container flex-auto gap-4`),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,B.jsx)(S,{pixel:u.quality,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`})]}),(0,B.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`What each browser run measured on the pages it visited: accessibility (`,t?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run.`]}),a&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),!t&&!a&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(n,{label:`Quality`,current:s,onPick:e=>{p(e),e===`trends`?location.hash=d(`quality`,`trends`):location.hash=v?d(`quality`,encodeURIComponent(v.id)):d(`quality`)},tabs:[{id:`runs`,label:`Runs (${t.runs.length})`},{id:`trends`,label:`Trends${y?` (${y} worse)`:``}`}]}),t&&s===`trends`&&(0,B.jsx)(`div`,{role:`tabpanel`,id:`panel-trends`,"aria-labelledby":`tab-trends`,children:(0,B.jsx)(ae,{trends:t.trends})}),t&&s===`runs`&&(t.runs.length?(0,B.jsxs)(`div`,{role:`tabpanel`,id:`panel-runs`,"aria-labelledby":`tab-runs`,className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,B.jsxs)(`nav`,{"aria-label":`Runs`,className:`flex min-w-0 flex-col gap-2 @2xl:sticky @2xl:top-6 @2xl:w-[290px] @2xl:flex-none`,children:[(0,B.jsx)(N,{id:`quality-search`,label:`Find a run`,value:C,onChange:w,className:`flex-none`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,B.jsx)(P,{items:[{id:`all`,label:`All`,n:j.length},{id:`attention`,label:`Needs a look`,n:j.filter(X).length,alert:!0}],value:T,onChange:E})}),(0,B.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[L.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-3 text-sm text-muted`,children:`Nothing matches.`}),L.slice(D*Z,D*Z+Z).map((e,t,n)=>{let i=F(e.at),a=e.breaches?l:X(e)?r:A;return(0,B.jsxs)(`li`,{className:`contents`,children:[(t===0||F(n[t-1].at)!==i)&&(0,B.jsx)(`span`,{className:`block px-3 pt-2 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,B.jsxs)(`a`,{href:d(`quality`,encodeURIComponent(e.id)),"aria-current":v?.id===e.id?`page`:void 0,className:m(`flex min-h-12 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,v?.id===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[(0,B.jsx)(a,{size:16,"aria-label":e.breaches?`Over a budget`:X(e)?`Needs a look`:`Within budgets`,className:m(`flex-none`,e.breaches?`text-fail`:X(e)?`text-warn`:`text-pass`)}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.goal,children:e.goal}),(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:Y(e)})]}),(0,B.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:I(e.at)})]})]},e.id)})]}),L.length>Z&&(0,B.jsx)(M,{page:D,size:Z,total:L.length,onPage:O,label:`Pages of runs`})]}),v&&(0,B.jsx)(oe,{id:v.id,view:t,onChanged:h})]}):(0,B.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,B.jsx)(f,{icon:_,size:24,className:`text-muted`}),(0,B.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No run has measured anything yet. Every browser run checks accessibility, timings and visual changes of the pages it visits; run a flow from a chat or the Record page, and its results show here.`})]}))]})]})}export{se as Quality};
@@ -0,0 +1 @@
1
+ import{An as e,At as t,Cr as n,Fn as r,Fr as i,G as a,K as o,Kn as s,Mr as c,Tt as l,Wn as u,X as d,Y as f,Z as p,Zt as m,_t as h,ar as g,at as _,bt as v,dt as y,fr as b,hn as x,in as S,ot as ee,qt as C,r as w,st as T,t as E,ut as D,wn as O,xt as k,yt as A}from"./frame-z3iL_6aL.js";import{t as j}from"./markdown-BtqKvAEi.js";import{t as M}from"./sticky-note-C_NJNONZ.js";import{E as N,g as te,h as ne,i as P,k as re,m as F,n as ie,r as ae,t as oe,x as I}from"./index-BVw2ygO2.js";import{n as L,t as se}from"./when-CHnpLdYw.js";var R={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};R.node;var ce=g(R),z={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};z.node;var le=g(z),B={name:`dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]};B.node;var ue=g(B),V={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};V.node;var H=g(V),U={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};U.node;var W=g(U),G={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};G.node;var K=g(G),q={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};q.node;var de=g(q),J={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};J.node;var fe=g(J),Y=i(c(),1),X=A(),pe={navigate:x,back:re,click:K,dblclick:K,input:W,press:W,select:S,upload:fe,expect:N,wait_for:H,capture:F,note:M,launch:C,double_click:K,type:W,keys:W},me=e=>pe[e]||(e.startsWith(`expect`)?N:ue),he=new Set([`starting`,`recording`,`paused`,`stopping`]);function Z(e,t){let n=Math.max(0,Math.round(((t?Date.parse(t):Date.now())-Date.parse(e))/1e3));return n<3600?`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:`${Math.floor(n/3600)}h ${Math.floor(n%3600/60)}m`}async function ge(e){let{id:t}=await b.start(`Turn the recording in ${e} into a test: call write_test with run_dir ${e}. Show me the plan before you write.`,{});location.hash=p(`chats`,t)}async function Q(e){let{id:t}=await b.start(`Replay the desktop workflow ${e}: call desktop_replay with workflow ${e}, and tell me how each step went.`,{});location.hash=p(`chats`,t)}function _e({s:e,live:t,onDelete:n}){let r=me(e.op);return(0,X.jsxs)(`li`,{className:`group flex min-h-[44px] items-start gap-3 border-t border-line-soft py-2 first:border-t-0`,children:[(0,X.jsx)(`span`,{className:`w-6 flex-none pt-0.5 text-right text-[13px] text-muted tabular-nums`,children:e.n}),(0,X.jsx)(r,{size:16,"aria-hidden":`true`,className:v(`mt-0.5 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.text}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[12px] text-muted`,children:[e.case_step?(0,X.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,X.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,X.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,X.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,X.jsx)(y,{variant:`icon`,size:`icon`,"aria-label":`Delete step ${e.n}`,onClick:n,className:`size-8 flex-none opacity-60 group-hover:opacity-100`,children:(0,X.jsx)(te,{size:15,"aria-hidden":`true`})})]})}function ve({s:e,send:n,busy:i}){let[o,s]=(0,Y.useState)(``),[,c]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[]);let u=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[e.log.length]);let d=e.kind===`desktop`,f=e.state===`paused`,p=e.log.at(-1)?.level===`warn`&&/press Stop again/i.test(e.log.at(-1).text),m=Math.max(0,...e.steps.map(e=>e.case_step||0)),g=(t,r,a,o)=>(0,X.jsxs)(y,{disabled:i||e.state===`starting`,onClick:()=>n({cmd:t}),title:o,children:[(0,X.jsx)(a,{size:16,"aria-hidden":`true`}),r]},t);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[14px] border border-line-soft px-4 py-3`,children:[f?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,X.jsx)(T,{state:e.state===`starting`?`waiting`:e.state===`stopping`?`working`:`recording`,px:20}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,X.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[e.state===`starting`?d?`Starting ${e.app}…`:`Opening the browser…`:e.state===`stopping`?`Saving the workflow…`:f?`Paused: what you do now is not recorded`:`Recording`,` · `,Z(e.startedAt),` ·`,` `,d?`${e.app}, a desktop app`:e.url]})]}),!d&&(0,X.jsxs)(y,{disabled:i||e.state===`starting`,onClick:()=>n({cmd:`pause`}),children:[f?(0,X.jsx)(h,{icon:C,size:16}):(0,X.jsx)(de,{size:16,"aria-hidden":`true`}),f?`Resume`:`Pause`]}),(0,X.jsxs)(y,{disabled:i||e.state===`stopping`,onClick:()=>n({cmd:`stop`,...p?{force:!0}:{}}),className:`border-fail bg-fail text-white hover:bg-fail hover:text-white hover:opacity-90`,children:[(0,X.jsx)(t,{size:14,fill:`currentColor`,"aria-hidden":`true`}),p?`Stop anyway`:`Stop and save`]})]}),d?(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-3 text-sm leading-relaxed text-ink-2`,children:[e.app,` is open on this computer: do the steps in it. Only clicks and keys in its own windows are recorded; password fields are saved as secret names, never as what you type. In the app, `,(0,X.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,X.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`details`,{className:`rounded-[12px] bg-accent-soft px-4 py-2.5 text-sm text-ink-2`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer`,children:`Do the steps in the browser on this computer. Keys in the page…`}),(0,X.jsxs)(`p`,{className:`m-0 mt-2 leading-relaxed`,children:[`The Recorder panel in the page does the same as these buttons; in the page, `,e.leader,` then a letter: `,(0,X.jsx)(`strong`,{children:`A`}),` check, `,(0,X.jsx)(`strong`,{children:`V`}),` keep a value, `,(0,X.jsx)(`strong`,{children:`W`}),` wait for, `,(0,X.jsx)(`strong`,{children:`D`}),` test data, `,(0,X.jsx)(`strong`,{children:`N`}),` note,`,` `,(0,X.jsx)(`strong`,{children:`P`}),` pause, `,(0,X.jsx)(`strong`,{children:`Z`}),` undo, `,(0,X.jsx)(`strong`,{children:`S`}),` stop.`]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`toolbar`,"aria-label":`Recorder`,children:[g(`assert`,`Check an element`,le,`Pick an element in the page to check`),g(`variable`,`Keep a value`,F,`Pick an element whose text later steps use`),g(`wait`,`Wait for`,H,`Pick an element the test waits for`),g(`data`,`Test data`,r,`The last value you typed becomes test data`),g(`note`,`Note`,M,`A note for the step, for whoever reads the test`),g(`undo`,`Undo`,ne,`Remove the last step`)]}),(0,X.jsxs)(`form`,{className:`flex flex-wrap gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&(n({cmd:`chat`,text:o.trim()}),s(``))},children:[(0,X.jsx)(`label`,{htmlFor:`rec-check`,className:`sr-only`,children:`Describe a check`}),(0,X.jsx)(a,{id:`rec-check`,value:o,maxLength:2e3,placeholder:`Describe a check: the total shows "$40.00", or note: …`,onChange:e=>s(e.target.value),className:`min-w-0 flex-[1_1_320px]`}),(0,X.jsxs)(y,{type:`submit`,variant:`primary`,disabled:i||!o.trim()||e.state===`starting`,children:[(0,X.jsx)(h,{icon:l,size:16}),`Add`]})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-5`,children:[(0,X.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:`flex min-w-0 flex-[999_1_420px] flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,X.jsxs)(`h2`,{id:`rec-steps`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,X.jsx)(h,{icon:S,size:18,className:`text-accent-fg`}),`Steps`,(0,X.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:e.summary})]}),e.steps.length?(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:e.steps.map(e=>(0,X.jsx)(_e,{s:e,live:!d,onDelete:()=>n({cmd:`delete`,n:e.n})},`${e.n}-${e.text}`))}):(0,X.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:e.state===`starting`?d?`Starting ${e.app}…`:`Opening the browser…`:`Nothing yet: do the first step in ${d?e.app:`the browser`}.`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-5`,children:[e.case&&(0,X.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,X.jsxs)(`h2`,{id:`rec-case`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,X.jsx)(h,{icon:S,size:18,className:`text-accent-fg`}),e.case.id]}),(0,X.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[e.case.title,`. Each step you record belongs to the case step you are on: pick one to record it.`]}),(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.case.steps.map(t=>{let r=e.steps.some(e=>e.case_step===t.n);return(0,X.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,X.jsxs)(`button`,{type:`button`,disabled:i,"aria-current":t.n===m?`step`:void 0,onClick:()=>n({cmd:`case_step`,n:t.n}),className:v(`flex w-full cursor-pointer items-start gap-2 rounded-[10px] border-0 bg-transparent px-2 py-2 text-left text-sm text-ink hover:bg-surface-muted`,t.n===m&&`bg-accent-soft`),children:[r?(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-pass`}):(0,X.jsx)(`span`,{className:`mt-0.5 w-4 flex-none text-center text-[12px] text-muted`,children:t.n}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.action}),t.expected&&(0,X.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,t.expected]})]})]})},t.n)})}),(0,X.jsx)(y,{disabled:i,onClick:()=>n({cmd:`case_next`}),className:`self-start`,children:`Next case step`})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,X.jsx)(`h2`,{id:`rec-log`,className:`m-0 text-base font-semibold`,children:`What the recorder says`}),(0,X.jsx)(`div`,{ref:u,className:`flex max-h-[280px] flex-col gap-1 overflow-auto text-[13px]`,"aria-live":`polite`,children:e.log.length?e.log.map((e,t)=>(0,X.jsx)(`p`,{className:v(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,X.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,d?`the app`:`the browser`,`…`]})})]})]})]})]})}function ye({s:t}){let n=t.result,[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(!1);if(!n)return null;let s=t.kind===`desktop`;return(0,X.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:`flex flex-col gap-3 rounded-[14px] border border-line-soft p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h2`,{id:`rec-result`,className:`m-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:t.name}),(0,X.jsx)(P,{tone:n.ok?`pass`:`fail`,children:n.ok?`Recorded`:`Not recorded`})]}),(0,X.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[n.ok?n.summary||t.summary:n.error||`Nothing was recorded.`,` `,t.endedAt&&(0,X.jsxs)(`span`,{className:`text-muted`,children:[`· `,Z(t.startedAt,t.endedAt)]})]}),n.ok&&(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,X.jsx)(P,{tone:`neutral`,icon:!1,children:k(t.steps.length,`step`)}),(0,X.jsxs)(P,{tone:n.checks?`pass`:`warn`,children:[n.checks,` check`,n.checks===1?``:`s`]}),n.variables.length>0&&(0,X.jsxs)(P,{tone:`neutral`,icon:!1,children:[`kept: `,n.variables.join(`, `)]}),n.testData.length>0&&(0,X.jsxs)(P,{tone:`neutral`,icon:!1,children:[`test data: `,n.testData.join(`, `)]})]}),!s&&n.secrets.length>0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`The test reads`,` `,n.secrets.map((e,t)=>(0,X.jsxs)(`span`,{children:[t?`, `:``,(0,X.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})]},e)),` `,`from the environment: what you typed there was not saved. Set `,n.secrets.length===1?`it`:`them`,` before the test runs.`]}),n.caseGaps.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-warn`,children:n.caseGaps.map(e=>(0,X.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(n.notes??[]).length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-ink-2`,children:n.notes.map((e,t)=>(0,X.jsx)(`li`,{children:e},t))}),n.skipped.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-muted`,children:n.skipped.map((e,t)=>(0,X.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s&&n.workflow&&(0,X.jsxs)(y,{variant:`primary`,disabled:a,onClick:async()=>{o(!0);try{await Q(n.workflow)}catch(e){i(e.message),o(!1)}},children:[(0,X.jsx)(I,{size:16,"aria-hidden":`true`}),`Replay it`]}),s&&n.report&&(0,X.jsxs)(y,{onClick:async()=>i(await f(n.report)),children:[(0,X.jsx)(h,{icon:e,size:16}),`Open the report`]}),!s&&n.ok&&(0,X.jsxs)(y,{variant:`primary`,disabled:a,onClick:async()=>{o(!0);try{await ge(t.runDir)}catch(e){i(e.message),o(!1)}},children:[(0,X.jsx)(h,{icon:l,size:16}),`Write a test from it`]}),!s&&n.ok&&(0,X.jsxs)(y,{onClick:async()=>i(await f(`${t.runDir}/trace.md`)),children:[(0,X.jsx)(h,{icon:O,size:16}),`Read the steps`]}),(0,X.jsx)(`span`,{className:`text-sm`,children:(0,X.jsx)(j,{path:s&&n.workflow?n.workflow:t.runDir})}),r&&(0,X.jsx)(`span`,{className:`text-[13px] text-fail`,children:r})]})]})}function be({view:e,busy:t,onStart:n}){let[r,i]=(0,Y.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:`web`),[c,l]=(0,Y.useState)(e.desktop.apps[0]??``),[u,d]=(0,Y.useState)(e.apps[0]?.name??``),[f,h]=(0,Y.useState)(``),[g,b]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(``),[w,T]=(0,Y.useState)(e.environment??``),[E,D]=(0,Y.useState)(!1),[O,k]=(0,Y.useState)(!1),A=r===`desktop`?e.desktop.available&&!!c:u?!0:/^https?:\/\/\S+$/i.test(f.trim()),j=r===`web`||e.environments.length>1;return(0,X.jsxs)(`form`,{"aria-labelledby":`rec-new`,className:`flex flex-col gap-3 rounded-[14px] border border-line-soft bg-bg p-4`,onSubmit:t=>{if(t.preventDefault(),A){if(r===`desktop`)return n({kind:`desktop`,app:c,...g.trim()?{name:g.trim()}:{},...w&&w!==e.environment?{env:w}:{}});n({...u?{app:u}:{url:f.trim()},...g.trim()?{name:g.trim()}:{},...S.trim()?{case:S.trim()}:{},...w&&w!==e.environment?{env:w}:{},signedIn:E})}},children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`h2`,{id:`rec-new`,className:`m-0 flex-1 text-base font-semibold`,children:`New recording`}),(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`What to record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`web`,`Web page`,x,!0],[`desktop`,`Desktop app`,m,e.desktop.available]].map(([t,n,a,o])=>(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r===t,disabled:!o,title:o?void 0:e.desktop.reason||`Windows only.`,onClick:()=>i(t),className:v(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50`,r===t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,X.jsx)(a,{size:14,"aria-hidden":`true`}),n]},t))})]}),(0,X.jsxs)(`div`,{className:`grid gap-2 @2xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_auto]`,children:[r===`desktop`?e.desktop.apps.length?(0,X.jsx)(o,{"aria-label":`App`,value:c,onChange:e=>l(e.target.value),children:e.desktop.apps.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))}):(0,X.jsxs)(`p`,{className:`m-0 self-center text-sm text-muted`,children:[`No desktop apps yet: add one in `,(0,X.jsx)(`a`,{href:p(`settings`,`environments`),children:`Settings, Environments`}),`.`]}):(0,X.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.apps.length>0&&(0,X.jsxs)(o,{"aria-label":`Start on`,value:u,onChange:e=>d(e.target.value),className:v(u?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.apps.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,X.jsx)(`option`,{value:``,children:`Another page…`})]}),!u&&(0,X.jsx)(a,{"aria-label":`Page address`,type:`url`,value:f,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>h(e.target.value),className:`min-w-0 flex-1`})]}),(0,X.jsx)(a,{"aria-label":`What the test does`,value:g,maxLength:200,placeholder:`What the test does`,onChange:e=>b(e.target.value)}),(0,X.jsxs)(y,{type:`submit`,variant:`primary`,disabled:t||!A,children:[(0,X.jsx)(ce,{size:16,"aria-hidden":`true`}),t?r===`desktop`?`Starting…`:`Opening…`:`Start recording`]})]}),j&&(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":O,onClick:()=>k(!O),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink`,children:[(0,X.jsx)(s,{size:14,"aria-hidden":`true`,className:v(`transition-transform`,O&&`rotate-180`)}),`More options`,!O&&(S||E||w&&w!==e.environment)?(0,X.jsx)(`span`,{className:`text-accent-fg`,children:`· set`}):null]}),(0,X.jsx)(ee,{open:O,children:(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-[12px] bg-surface-muted p-3 @2xl:grid-cols-2`,children:[r===`web`&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Test case `,(0,X.jsx)(`span`,{className:`-mt-1 text-[12.5px] font-normal text-muted`,children:`Its steps are listed while you record; each one you do is tied to it.`}),(0,X.jsx)(a,{value:S,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>C(e.target.value),className:`bg-bg`})]}),e.environments.length>1&&(r===`desktop`||!!u)&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Environment`,(0,X.jsx)(o,{value:w,onChange:e=>T(e.target.value),children:e.environments.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),r===`web`&&e.logins.length>0&&(0,X.jsxs)(`div`,{className:`flex items-center gap-3 @2xl:col-span-2`,children:[(0,X.jsx)(_,{checked:E,onChange:D,label:`Start signed in`}),(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`Start signed in`}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[`With the saved sign-ins (`,e.logins.join(`, `),`). Off: the sign-in is recorded too, its password saved as a variable name, never as typed.`]})]})]})]})}),(0,X.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:r===`desktop`?`The app starts on this computer; do the steps in it. It is saved as a workflow that replays with no model.`:`A browser opens on this computer with the Recorder panel in the page. A chat turns the recording into a test.`})]})}var $=20;function xe({rows:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(`all`),[c,d]=(0,Y.useState)(0);if((0,Y.useEffect)(()=>d(0),[i,o]),!t.length)return null;let p=i.toLowerCase().split(/\s+/).filter(Boolean),g=t.filter(e=>p.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl}`.toLowerCase().includes(t))),_=o===`all`?g:g.filter(e=>e.kind===o),v=_.slice(c*$,c*$+$),b=t.some(e=>e.kind===`desktop`)&&t.some(e=>e.kind===`web`);return(0,X.jsxs)(`section`,{"aria-labelledby":`rec-list`,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`h2`,{id:`rec-list`,className:`m-0 mr-2 text-base font-semibold`,children:[`Recordings `,(0,X.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:t.length})]}),(0,X.jsx)(ae,{id:`rec-search`,label:`Find a recording`,value:i,onChange:a}),b&&(0,X.jsx)(oe,{items:[{id:`all`,label:`All`,n:g.length},{id:`web`,label:`Web`,n:g.filter(e=>e.kind===`web`).length},{id:`desktop`,label:`Desktop`,n:g.filter(e=>e.kind===`desktop`).length}],value:o,onChange:s})]}),n&&(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:n}),(0,X.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,X.jsxs)(`ul`,{className:`m-0 list-none p-1.5`,children:[v.length===0&&(0,X.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),v.map((t,n)=>{let i=L(t.startedAt);return(0,X.jsxs)(`li`,{className:`contents`,children:[(n===0||L(v[n-1].startedAt)!==i)&&(0,X.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,X.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 hover:bg-surface-muted`,children:[t.ok?(0,X.jsx)(N,{size:16,"aria-label":`Recorded`,className:`text-pass`}):(0,X.jsx)(u,{size:16,"aria-label":`Not recorded`,className:`text-fail`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[t.kind===`desktop`?(0,X.jsx)(h,{icon:m,size:13,className:`flex-none text-muted`,label:`Desktop app`}):(0,X.jsx)(h,{icon:x,size:13,className:`flex-none text-muted`,label:`Web page`}),(0,X.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:t.name,children:t.name})]}),(0,X.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[k(t.steps,`step`),k(t.checks,`check`),t.caseId,t.app,se(t.startedAt)].filter(Boolean).join(` · `)})]}),(0,X.jsxs)(`span`,{className:`flex flex-none items-center gap-1`,children:[t.trace&&(0,X.jsx)(y,{size:`icon`,variant:`icon`,"aria-label":`Read the steps of ${t.name}`,title:`Read the steps`,onClick:async()=>r(await f(t.trace)),children:(0,X.jsx)(h,{icon:O,size:15})}),t.report&&(0,X.jsx)(y,{size:`icon`,variant:`icon`,"aria-label":`Open the report of ${t.name}`,title:`Open the report`,onClick:async()=>r(await f(t.report)),children:(0,X.jsx)(h,{icon:e,size:15})}),t.kind===`desktop`&&t.workflow&&(0,X.jsxs)(y,{size:`sm`,onClick:()=>Q(t.workflow).catch(e=>r(e.message)),children:[(0,X.jsx)(I,{size:14,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`hidden @md:inline`,children:`Replay`})]}),t.kind===`web`&&t.ok&&(0,X.jsxs)(y,{size:`sm`,onClick:()=>ge(t.runDir).catch(e=>r(e.message)),children:[(0,X.jsx)(h,{icon:l,size:14}),(0,X.jsx)(`span`,{className:`hidden @md:inline`,children:`Write a test`})]})]})]})]},t.runDir)})]}),(0,X.jsx)(ie,{page:c,size:$,total:_.length,onPage:d,label:`Pages of recordings`})]})]})}function Se(){let[e,t]=(0,Y.useState)(null),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(!1),s=(0,Y.useCallback)(()=>{n.get().then(e=>{t(e),i(``)},e=>i(e.message))},[]);(0,Y.useEffect)(s,[s]);let c=!!e?.session&&he.has(e.session.state);(0,Y.useEffect)(()=>{if(!c)return;let e=setInterval(s,800);return()=>clearInterval(e)},[c,s]);let l=async e=>{o(!0),i(``);try{t(await e())}catch(e){i(e.message)}finally{o(!1)}},u=e?.session;return(0,X.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,X.jsx)(w,{}),(0,X.jsxs)(`main`,{className:v(E,`@container flex-auto gap-4`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(D,{pixel:d.record,size:`lg`}),(0,X.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Record`})]}),(0,X.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and check you add is recorded in order.`}),r&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!e&&!r&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&u&&c&&(0,X.jsx)(ve,{s:u,busy:a,send:e=>void l(()=>n.command(e))}),e&&!c&&(0,X.jsxs)(X.Fragment,{children:[u?.result&&(0,X.jsx)(ye,{s:u}),(0,X.jsx)(be,{view:e,busy:a,onStart:e=>void l(()=>n.start(e))}),(0,X.jsx)(xe,{rows:e.recordings})]})]})]})}export{Se as Record};
@@ -1,2 +1,2 @@
1
- import{At as e,Cn as t,Dt as n,Fr as r,G as i,J as a,Mr as o,Nn as s,T as c,X as l,Yt as u,Z as d,_t as f,ar as p,at as m,bt as h,ct as g,dt as _,gn as v,ot as y,pn as b,qt as x,r as S,t as C,xr as w,xt as T,yt as E}from"./frame-C0RAa-Ev.js";import{t as D}from"./sticky-note-BffcGVvl.js";import{i as O}from"./index-DBQd0Qgk.js";var k={name:`bandage`,size:24,node:[[`path`,{d:`M10 10.01h.01`,key:`1e9xi7`}],[`path`,{d:`M10 14.01h.01`,key:`ac23bv`}],[`path`,{d:`M14 10.01h.01`,key:`2wfrvf`}],[`path`,{d:`M14 14.01h.01`,key:`8tw8yn`}],[`path`,{d:`M18 6v12`,key:`1bcixs`}],[`path`,{d:`M6 6v12`,key:`vkc79e`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`,key:`1wpnh2`}]]};k.node;var A=p(k),j={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};j.node;var M=p(j),N=r(o(),1),P=E(),F={linked:{label:`Linked test case`,tone:`pass`,help:`It automates a test case that tests a changed work item`},changed:{label:`Test code changed`,tone:`running`,help:`The change is in test code it uses`},covers:{label:`Matches a change`,tone:`neutral`,help:`The change's words name what it does`},risk:{label:`Risk area`,tone:`warn`,help:`The release touches an area with defects or failures before`},smoke:{label:`Smoke`,tone:`neutral`,help:`Tagged smoke: in every pack`}},I={heal:{label:`Heal`,tone:`warn`,does:`An element it uses is gone: the healing agent re-runs the flow and updates the test.`},check:{label:`AI re-run decides`,tone:`warn`,does:`The healing agent re-runs the flow: it heals the test when the flow works, and reports an app bug when it fails at the same step.`},flaky:{label:`Flaky`,tone:`neutral`,does:`Passed when run again: quarantine it, or fix the cause it flakes on. Not healed.`},environment:{label:`Environment`,tone:`neutral`,does:`Network, a server error, sign-in: run again once the environment works. No heal, no bug.`},test_code:{label:`Test code broken`,tone:`fail`,does:`A missing module, a compile error, a missing fixture: fix the test's code.`}},L={work_item:n,pr:v,commit:M,note:D},R=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),z=e=>e?e.status===`passed`?`pass`:e.status===`failed`?`fail`:`warn`:`neutral`,B=e=>e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`,V=e=>e&&/^https?:\/\//i.test(e)?e:void 0;function H({job:t,onStop:n}){let r=(0,N.useRef)(null),[,i]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(!t.running)return;let e=setInterval(()=>i(e=>e+1),1e3);return()=>clearInterval(e)},[t.running]),(0,N.useEffect)(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t.lines.length]);let a=t.running?t.kind===`build`?`Building the pack`:t.kind===`run`?`Running ${t.pack}`:`Healing ${t.pack}'s failures`:t.kind===`build`?`Built ${t.pack||`the pack`}`:t.kind===`run`?`Ran ${t.pack}`:`Healed ${t.pack}'s failures`,o=Math.round(((t.endedAt?Date.parse(t.endedAt):Date.now())-Date.parse(t.startedAt))/1e3);return(0,P.jsxs)(`section`,{"aria-label":a,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`flex-1 font-medium`,children:a}),(0,P.jsx)(O,{orb:t.kind===`build`?`handing`:t.kind===`heal`?`retrying`:`working`,tone:t.running?`running`:t.exitCode===0?`pass`:t.kind===`run`&&t.exitCode===1?`warn`:`fail`,children:t.running?`Working`:t.exitCode===0?`Done`:t.kind===`run`&&t.exitCode===1?`Tests failed`:`Did not finish`}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:B(o)}),t.running&&(0,P.jsxs)(_,{onClick:n,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,P.jsx)(e,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,P.jsx)(`code`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:t.command}),(0,P.jsxs)(`details`,{open:t.running,children:[(0,P.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,t.lines.length,` lines)`]}),(0,P.jsx)(`pre`,{ref:r,className:`mt-2 max-h-[300px] overflow-auto rounded-[10px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:t.lines.join(`
2
- `)||`Starting…`})]})]})}function U({title:e,aside:t,children:n}){return(0,P.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,P.jsx)(`h3`,{className:`m-0 flex-1 text-base font-semibold`,children:e}),t]}),n]})}function W(e){let[t,n]=e.slice(-2).length===2?e.slice(-2):[void 0,e.at(-1)];return!n||!t?{fresh:[],fixed:[]}:{fresh:n.failed.filter(e=>!t.failed.includes(e)),fixed:t.failed.filter(e=>!n.failed.includes(e))}}function G({name:e,busy:n,act:r,version:i}){let[a,o]=(0,N.useState)(null),[l,u]=(0,N.useState)(``),[d,p]=(0,N.useState)(`all`),[m,g]=(0,N.useState)(null),[v,y]=(0,N.useState)(new Set);if((0,N.useEffect)(()=>{let t=!1;return w.detail(e).then(e=>!t&&(o(e),u(``)),e=>!t&&u(e.message)),()=>{t=!0}},[e,i]),(0,N.useEffect)(()=>{p(`all`),g(null),y(new Set)},[e]),l)return(0,P.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:l});if(!a)return(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let b=a.runs.at(-1),{fresh:S,fixed:C}=W(a.runs),T=a.tests.filter(e=>d===`all`||e.reasons.some(e=>e.kind===d)),E=(a.triage?.items??[]).filter(e=>e.route===`heal`||e.route===`check`),k=Object.keys(I).filter(e=>a.triage?.items.some(t=>t.route===e)),j=Object.keys(F).filter(e=>a.tests.some(t=>t.reasons.some(t=>t.kind===e)));return(0,P.jsxs)(`section`,{"aria-labelledby":`pack-h`,className:`flex min-w-0 flex-1 flex-col gap-6`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,P.jsx)(`h2`,{id:`pack-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:a.name}),(0,P.jsxs)(`span`,{className:`text-sm text-muted`,children:[`Built `,R(a.createdAt)]}),a.scope.length>0&&(0,P.jsx)(`span`,{className:`flex flex-wrap gap-1.5 pt-1`,children:a.scope.map(e=>(0,P.jsx)(`span`,{className:`rounded-full bg-surface-strong px-2.5 py-0.5 text-[12px] text-ink-2`,children:e},e))})]}),m?(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-accent-soft px-3 py-2`,children:[(0,P.jsxs)(`span`,{className:`text-sm`,children:[`Run `,a.tests.length,` test`,a.tests.length===1?``:`s`,` `,m===`local`?`on this machine`:`on TestMu AI`,`?`]}),(0,P.jsx)(_,{variant:`primary`,disabled:n,onClick:()=>{g(null),r(()=>w.run(a.name,m))},children:`Run`}),(0,P.jsx)(_,{onClick:()=>g(null),children:`Don't run`})]}):(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(_,{variant:`primary`,disabled:n||!a.tests.length,onClick:()=>g(`local`),children:[(0,P.jsx)(f,{icon:x,size:16}),`Run here`]}),(0,P.jsx)(_,{disabled:n||!a.tests.length,onClick:()=>g(`testmu`),children:`Run on TestMu AI`})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsx)(c,{label:`Tests`,value:String(a.tests.length),note:j.map(e=>`${a.tests.filter(t=>t.reasons.some(t=>t.kind===e)).length} ${F[e].label.toLowerCase()}`).join(` · `)}),(0,P.jsx)(c,{label:`Not covered`,value:String(a.uncovered.length),note:`changes no test is in for`}),(0,P.jsx)(c,{label:`Risk areas`,value:String(a.risk.length)}),(0,P.jsx)(c,{label:`Last run`,value:b?b.status===`passed`?`Passed`:`${b.counts.failed} failed`:`–`,note:b?`${R(b.at)} · ${b.on===`testmu`?`TestMu AI`:b.on===`pipeline`?`pipeline`:`this machine`}`:`Not run yet`})]}),a.triage&&(0,P.jsxs)(U,{title:`Triage of the last run`,aside:(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[a.triage.items.length,` failed or flaky`]}),children:[a.triage.environmentDown&&(0,P.jsx)(`p`,{className:`m-0 rounded-[12px] bg-warn-soft px-3 py-2 text-sm text-warn`,children:`Most failures were the environment: run the pack again before healing anything.`}),k.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[12px] border border-line-soft px-4 py-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(O,{tone:I[e].tone,children:I[e].label}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:I[e].does})]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.triage.items.filter(t=>t.route===e).map(t=>(0,P.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(e===`heal`||e===`check`)&&(0,P.jsx)(`input`,{type:`checkbox`,"aria-label":`Heal ${t.name}`,checked:v.has(t.name),onChange:e=>{let n=new Set(v);e.target.checked?n.add(t.name):n.delete(t.name),y(n)},className:`mt-1 size-5 accent-accent`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,P.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.name}),(0,P.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[t.why,` · `,t.confidence,` confidence`,t.file?` · ${t.file}`:``,t.history?` · ${t.history}`:``]})]})]},t.name))})]},e)),E.length>0&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsxs)(_,{disabled:n||!v.size,onClick:()=>r(()=>w.heal(a.name,[...v])),children:[(0,P.jsx)(A,{size:16,"aria-hidden":`true`}),`Heal `,v.size||``,` selected`]}),(0,P.jsxs)(_,{variant:`ghost`,disabled:n,onClick:()=>y(new Set(E.map(e=>e.name))),children:[`Select all `,E.length]}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The healing agent re-runs each flow in the browser before it changes anything.`})]})]}),a.runs.length>0&&(0,P.jsxs)(U,{title:`Runs`,aside:S.length||C.length?(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[[S.length?`${S.length} newly failing`:``,C.length?`${C.length} fixed`:``].filter(Boolean).join(` · `),` since the run before`]}):void 0,children:[(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...a.runs].reverse().map((e,t)=>(0,P.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsx)(O,{tone:z(e),children:e.status===`passed`?`Passed`:e.status===`failed`?`Failed`:e.status}),(0,P.jsxs)(`span`,{className:`flex-1`,children:[R(e.at),` · `,e.on===`testmu`?`TestMu AI`:e.on===`pipeline`?`pipeline`:`this machine`]}),(0,P.jsxs)(`span`,{className:`text-muted tabular-nums`,children:[e.counts.passed,` passed · `,e.counts.failed,` failed`,e.counts.skipped?` · ${e.counts.skipped} skipped`:``,` · `,B(e.seconds)]}),V(e.url)&&(0,P.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1`,children:[`Pipeline `,(0,P.jsx)(s,{size:13,"aria-hidden":`true`})]})]},`${e.at}-${t}`))}),S.length>0&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-fail`,children:[`Newly failing: `,S.join(`, `)]}),C.length>0&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-pass`,children:[`Fixed: `,C.join(`, `)]})]}),(0,P.jsxs)(U,{title:`Tests (${a.tests.length})`,aside:(0,P.jsx)(`div`,{role:`group`,"aria-label":`Why in`,className:`flex flex-wrap gap-1`,children:[`all`,...j].map(e=>(0,P.jsx)(`button`,{type:`button`,"aria-pressed":d===e,title:F[e]?.help,onClick:()=>p(e),className:h(`min-h-8 cursor-pointer rounded-[8px] border px-3 text-[13px]`,d===e?`border-ink bg-ink text-bg`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:e===`all`?`All`:F[e].label},e))}),children:[(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:T.slice(0,300).map(e=>(0,P.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.test}),e.flaky&&(0,P.jsx)(O,{tone:`warn`,children:`Flaky`})]}),(0,P.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.file,e.line?`:${e.line}`:``]}),(0,P.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:e.reasons.map((e,t)=>(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[13px] text-ink-2`,children:[(0,P.jsx)(O,{tone:F[e.kind]?.tone??`neutral`,icon:!1,children:F[e.kind]?.label??e.kind}),e.text]},t))})]},`${e.file}:${e.test}`))}),T.length>300&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`The first 300 of `,T.length,`.`]})]}),a.uncovered.length>0&&(0,P.jsx)(U,{title:`Not covered (${a.uncovered.length})`,aside:(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Extend the closest test rather than write a new one`}),children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.uncovered.map(e=>(0,P.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[(0,P.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.item}),e.title]}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.why}),e.nearest&&(0,P.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Closest: `,e.nearest.test,` `,(0,P.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[`(`,e.nearest.file,`)`]}),e.nearest.lacks.length?`, lacks ${e.nearest.lacks.join(`, `)}`:``]})]},e.item))})}),a.risk.length>0&&(0,P.jsx)(U,{title:`Risk areas`,children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.risk.map(e=>(0,P.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsx)(t,{size:16,"aria-hidden":`true`,className:h(`mt-0.5 flex-none`,e.level===`high`?`text-fail`:`text-warn`)}),(0,P.jsxs)(`span`,{className:`flex flex-col`,children:[(0,P.jsxs)(`span`,{children:[e.area,` `,(0,P.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.level]})]}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.reasons.join(`; `)})]})]},e.area))})}),(0,P.jsx)(U,{title:`Changes (${a.items.length})`,children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.items.slice(0,200).map(e=>{let t=L[e.kind]||D;return(0,P.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsx)(f,{icon:t,size:16,className:`mt-0.5 flex-none text-muted`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[(0,P.jsxs)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:[e.type?`${e.type} `:``,e.id]}),e.title]}),V(e.url)&&(0,P.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open ${e.id}`,className:`flex-none`,children:(0,P.jsx)(s,{size:14,"aria-hidden":`true`})})]},`${e.kind}-${e.id}`)})})}),a.notes.length>0&&(0,P.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-[13px] text-muted`,children:a.notes.map((e,t)=>(0,P.jsx)(`li`,{children:e},t))})]})}function K({open:e,onClose:t,view:r,onBuild:o,busy:s}){let[c,l]=(0,N.useState)({rangeRepo:`product`,prRepo:`product`,risk:!0,smoke:!0});(0,N.useEffect)(()=>{e&&l({rangeRepo:r.productRepo?`product`:`tests`,prRepo:r.productRepo?`product`:`tests`,risk:!0,smoke:!0})},[e,r.productRepo]);let u=(e,t)=>l({...c,[e]:t}),p=(e,t,n,r)=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`label`,{htmlFor:`pk-${e}`,className:`text-sm font-medium`,children:t}),(0,P.jsx)(i,{id:`pk-${e}`,value:String(c[e]??``),spellCheck:!1,maxLength:200,placeholder:n,onChange:t=>u(e,t.target.value)}),r&&(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:r})]}),g=(e,t)=>(0,P.jsxs)(`fieldset`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-1 border-0 p-0`,children:[(0,P.jsx)(`legend`,{className:`mb-1 text-[13px] text-muted`,children:t}),(0,P.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,P.jsx)(`input`,{type:`radio`,name:e,checked:c[e]===`product`,disabled:!r.productRepo,onChange:()=>u(e,`product`),className:`size-4 accent-accent`}),`The product's `,r.productRepo?(0,P.jsx)(`code`,{className:`font-mono text-[12px]`,children:r.productRepo}):(0,P.jsx)(`span`,{className:`text-muted`,children:`(set defects.product_repo)`})]}),(0,P.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,P.jsx)(`input`,{type:`radio`,name:e,checked:c[e]===`tests`,onChange:()=>u(e,`tests`),className:`size-4 accent-accent`}),`The tests' `,r.repo===`.`?`(this project)`:(0,P.jsx)(`code`,{className:`font-mono text-[12px]`,children:r.repo})]})]}),v=`flex flex-col gap-3 rounded-[12px] border border-line-soft p-3`;return(0,P.jsx)(a,{open:e,onClose:t,wide:!0,title:`Build a regression pack`,description:`The tests a release's changes can break, from any mix of the changes below. Building runs nothing; it takes seconds.`,footer:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_,{onClick:t,children:`Cancel`}),(0,P.jsxs)(_,{variant:`primary`,disabled:s,onClick:()=>o(c),children:[(0,P.jsx)(f,{icon:b,size:16}),`Build the pack`]})]}),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 pt-3`,children:[p(`name`,`Name`,`release-1.5`,`Lower-case letters, digits, dots and dashes. Empty: release-<date>.`),(0,P.jsxs)(`div`,{className:v,children:[(0,P.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[(0,P.jsx)(M,{size:16,"aria-hidden":`true`,className:`text-accent-fg`}),`Code changes`]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[p(`from`,`Commits after`,`release/1.4, a tag or a commit`),p(`to`,`Up to`,`HEAD`)]}),g(`rangeRepo`,`In the repository`),(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[p(`prs`,`Pull requests`,`57, 58 or their links`),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`label`,{htmlFor:`pk-days`,className:`text-sm font-medium`,children:`Or merged in the last`}),(0,P.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,P.jsx)(i,{id:`pk-days`,type:`number`,min:1,max:365,value:c.mergedDays??``,onChange:e=>u(`mergedDays`,e.target.value?Number(e.target.value):void 0),className:`w-24`}),` days`]})]})]}),(c.prs||c.mergedDays)&&g(`prRepo`,`Pull requests of`)]}),(0,P.jsxs)(`div`,{className:h(v,!r.azureDevops&&`opacity-70`),children:[(0,P.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[(0,P.jsx)(f,{icon:n,size:16,className:`text-accent-fg`}),`Azure DevOps work items and their linked test cases`]}),!r.azureDevops&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Not set up: `,(0,P.jsx)(`a`,{href:d(`settings`,`integrations`),children:`Settings, Integrations`}),`.`]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[p(`sprint`,`Sprint`,`current, or Sprint 41`),p(`iteration`,`Iteration path`,`Shop\\Release 2026.09`),p(`area`,`Area path`,`Shop\\Checkout`),p(`parent`,`Epic or feature`,`1200`),p(`workItems`,`Work items`,`2211, 2212`)]}),(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Their stories and bugs, the test cases each is tested by, and the files their linked pull requests changed.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,P.jsx)(m,{checked:c.risk!==!1,onChange:e=>u(`risk`,e),label:`Add tests for risk areas`}),`Add tests for risk areas the release touches`]}),(0,P.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,P.jsx)(m,{checked:c.smoke!==!1,onChange:e=>u(`smoke`,e),label:`Add smoke tests`}),`Add smoke-tagged tests`]})]})]})})}function q({sub:e}){let[t,n]=(0,N.useState)(null),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(!1),p=(0,N.useCallback)(()=>{w.list().then(e=>{n(e),i(``)},e=>i(e.message))},[]);(0,N.useEffect)(p,[p]);let m=!!t?.job?.running;(0,N.useEffect)(()=>{if(!m)return;let e=setInterval(p,1500);return()=>clearInterval(e)},[m,p]);let v=async e=>{o(!0),i(``);try{await e(),p()}catch(e){i(e.message)}finally{o(!1)}},x=e?decodeURIComponent(e):``,E=t?.packs.find(e=>e.name===x)||t?.packs[0],D=(0,N.useMemo)(()=>`${t?.job?.endedAt??``}|${E?.runs??0}|${E?.createdAt??``}`,[t,E]);return(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsx)(S,{}),(0,P.jsxs)(`main`,{className:h(C,`@container flex-auto gap-4`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(y,{pixel:l.regression,size:`lg`}),(0,P.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Regression`}),(0,P.jsxs)(_,{variant:`primary`,disabled:!t||m,onClick:()=>c(!0),children:[(0,P.jsx)(f,{icon:b,size:16}),`Build a pack`]})]}),(0,P.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`A regression pack is the set of tests in `,t&&t.repo!==`.`?(0,P.jsx)(`code`,{className:`font-mono text-[13px]`,children:t.repo}):`this project`,` that a release's changes can break: from the commits and pull requests of the product or development repositories, and the Azure DevOps sprint, epic or work items with their linked test cases. Each test says why it is in; the changes no test covers are listed. Run it here or on TestMu AI, and each run is triaged into what to heal, re-run or fix.`]}),r&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t?.job&&(0,P.jsx)(H,{job:t.job,onStop:()=>v(()=>w.stop())}),t&&(t.packs.length?(0,P.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,P.jsxs)(`nav`,{"aria-label":`Packs`,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,P.jsxs)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:[`Packs (`,t.packs.length,`)`]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.packs.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`a`,{href:d(`regression`,encodeURIComponent(e.name)),"aria-current":E?.name===e.name?`page`:void 0,className:h(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,E?.name===e.name?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[t?.job?.running&&t.job.pack===e.name?(0,P.jsx)(g,{state:t.job.kind===`heal`?`retrying`:`working`,label:`Working on it`,px:16}):(0,P.jsx)(`span`,{className:h(`size-2.5 flex-none rounded-full`,e.lastRun?e.lastRun.status===`passed`?`bg-pass`:`bg-fail`:`bg-line`),"aria-label":e.lastRun?e.lastRun.status:`not run`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,P.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,P.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[T(e.tests,`test`),` · `,e.uncovered,` not covered · `,R(e.createdAt)]})]})]})},e.name))})]}),E&&(0,P.jsx)(G,{name:E.name,busy:a||m,act:v,version:D})]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,P.jsx)(f,{icon:u,size:24,className:`text-muted`}),(0,P.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No regression packs yet. Build one from a sprint, the commits since the last release, or the pull requests merged this week.`}),(0,P.jsx)(_,{onClick:()=>c(!0),children:`Build a pack`})]}))]}),t&&(0,P.jsx)(K,{open:s,onClose:()=>c(!1),view:t,busy:a||m,onBuild:e=>v(async()=>{await w.build(e),c(!1)})})]})}export{q as Regression};
1
+ import{At as e,Cn as t,Dt as n,Fr as r,G as i,J as a,Mr as o,Nn as s,T as c,X as l,Yt as u,Z as d,_t as f,ar as p,at as m,bt as h,dt as g,gn as _,pn as v,qt as y,r as b,st as x,t as S,ut as C,xr as w,xt as T,yt as E}from"./frame-z3iL_6aL.js";import{t as D}from"./sticky-note-C_NJNONZ.js";import{i as O}from"./index-BVw2ygO2.js";var k={name:`bandage`,size:24,node:[[`path`,{d:`M10 10.01h.01`,key:`1e9xi7`}],[`path`,{d:`M10 14.01h.01`,key:`ac23bv`}],[`path`,{d:`M14 10.01h.01`,key:`2wfrvf`}],[`path`,{d:`M14 14.01h.01`,key:`8tw8yn`}],[`path`,{d:`M18 6v12`,key:`1bcixs`}],[`path`,{d:`M6 6v12`,key:`vkc79e`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`,key:`1wpnh2`}]]};k.node;var A=p(k),j={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};j.node;var M=p(j),N=r(o(),1),P=E(),F={linked:{label:`Linked test case`,tone:`pass`,help:`It automates a test case that tests a changed work item`},changed:{label:`Test code changed`,tone:`running`,help:`The change is in test code it uses`},covers:{label:`Matches a change`,tone:`neutral`,help:`The change's words name what it does`},risk:{label:`Risk area`,tone:`warn`,help:`The release touches an area with defects or failures before`},smoke:{label:`Smoke`,tone:`neutral`,help:`Tagged smoke: in every pack`}},I={heal:{label:`Heal`,tone:`warn`,does:`An element it uses is gone: the healing agent re-runs the flow and updates the test.`},check:{label:`AI re-run decides`,tone:`warn`,does:`The healing agent re-runs the flow: it heals the test when the flow works, and reports an app bug when it fails at the same step.`},flaky:{label:`Flaky`,tone:`neutral`,does:`Passed when run again: quarantine it, or fix the cause it flakes on. Not healed.`},environment:{label:`Environment`,tone:`neutral`,does:`Network, a server error, sign-in: run again once the environment works. No heal, no bug.`},test_code:{label:`Test code broken`,tone:`fail`,does:`A missing module, a compile error, a missing fixture: fix the test's code.`}},L={work_item:n,pr:_,commit:M,note:D},R=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),z=e=>e?e.status===`passed`?`pass`:e.status===`failed`?`fail`:`warn`:`neutral`,B=e=>e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`,V=e=>e&&/^https?:\/\//i.test(e)?e:void 0;function H({job:t,onStop:n}){let r=(0,N.useRef)(null),[,i]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(!t.running)return;let e=setInterval(()=>i(e=>e+1),1e3);return()=>clearInterval(e)},[t.running]),(0,N.useEffect)(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t.lines.length]);let a=t.running?t.kind===`build`?`Building the pack`:t.kind===`run`?`Running ${t.pack}`:`Healing ${t.pack}'s failures`:t.kind===`build`?`Built ${t.pack||`the pack`}`:t.kind===`run`?`Ran ${t.pack}`:`Healed ${t.pack}'s failures`,o=Math.round(((t.endedAt?Date.parse(t.endedAt):Date.now())-Date.parse(t.startedAt))/1e3);return(0,P.jsxs)(`section`,{"aria-label":a,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`flex-1 font-medium`,children:a}),(0,P.jsx)(O,{orb:t.kind===`build`?`handing`:t.kind===`heal`?`retrying`:`working`,tone:t.running?`running`:t.exitCode===0?`pass`:t.kind===`run`&&t.exitCode===1?`warn`:`fail`,children:t.running?`Working`:t.exitCode===0?`Done`:t.kind===`run`&&t.exitCode===1?`Tests failed`:`Did not finish`}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:B(o)}),t.running&&(0,P.jsxs)(g,{onClick:n,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,P.jsx)(e,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,P.jsx)(`code`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:t.command}),(0,P.jsxs)(`details`,{open:t.running,children:[(0,P.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,t.lines.length,` lines)`]}),(0,P.jsx)(`pre`,{ref:r,className:`mt-2 max-h-[300px] overflow-auto rounded-[10px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:t.lines.join(`
2
+ `)||`Starting…`})]})]})}function U({title:e,aside:t,children:n}){return(0,P.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,P.jsx)(`h3`,{className:`m-0 flex-1 text-base font-semibold`,children:e}),t]}),n]})}function W(e){let[t,n]=e.slice(-2).length===2?e.slice(-2):[void 0,e.at(-1)];return!n||!t?{fresh:[],fixed:[]}:{fresh:n.failed.filter(e=>!t.failed.includes(e)),fixed:t.failed.filter(e=>!n.failed.includes(e))}}function G({name:e,busy:n,act:r,version:i}){let[a,o]=(0,N.useState)(null),[l,u]=(0,N.useState)(``),[d,p]=(0,N.useState)(`all`),[m,_]=(0,N.useState)(null),[v,b]=(0,N.useState)(new Set);if((0,N.useEffect)(()=>{let t=!1;return w.detail(e).then(e=>!t&&(o(e),u(``)),e=>!t&&u(e.message)),()=>{t=!0}},[e,i]),(0,N.useEffect)(()=>{p(`all`),_(null),b(new Set)},[e]),l)return(0,P.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:l});if(!a)return(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let x=a.runs.at(-1),{fresh:S,fixed:C}=W(a.runs),T=a.tests.filter(e=>d===`all`||e.reasons.some(e=>e.kind===d)),E=(a.triage?.items??[]).filter(e=>e.route===`heal`||e.route===`check`),k=Object.keys(I).filter(e=>a.triage?.items.some(t=>t.route===e)),j=Object.keys(F).filter(e=>a.tests.some(t=>t.reasons.some(t=>t.kind===e)));return(0,P.jsxs)(`section`,{"aria-labelledby":`pack-h`,className:`flex min-w-0 flex-1 flex-col gap-6`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,P.jsx)(`h2`,{id:`pack-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:a.name}),(0,P.jsxs)(`span`,{className:`text-sm text-muted`,children:[`Built `,R(a.createdAt)]}),a.scope.length>0&&(0,P.jsx)(`span`,{className:`flex flex-wrap gap-1.5 pt-1`,children:a.scope.map(e=>(0,P.jsx)(`span`,{className:`rounded-full bg-surface-strong px-2.5 py-0.5 text-[12px] text-ink-2`,children:e},e))})]}),m?(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-accent-soft px-3 py-2`,children:[(0,P.jsxs)(`span`,{className:`text-sm`,children:[`Run `,a.tests.length,` test`,a.tests.length===1?``:`s`,` `,m===`local`?`on this machine`:`on TestMu AI`,`?`]}),(0,P.jsx)(g,{variant:`primary`,disabled:n,onClick:()=>{_(null),r(()=>w.run(a.name,m))},children:`Run`}),(0,P.jsx)(g,{onClick:()=>_(null),children:`Don't run`})]}):(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(g,{variant:`primary`,disabled:n||!a.tests.length,onClick:()=>_(`local`),children:[(0,P.jsx)(f,{icon:y,size:16}),`Run here`]}),(0,P.jsx)(g,{disabled:n||!a.tests.length,onClick:()=>_(`testmu`),children:`Run on TestMu AI`})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsx)(c,{label:`Tests`,value:String(a.tests.length),note:j.map(e=>`${a.tests.filter(t=>t.reasons.some(t=>t.kind===e)).length} ${F[e].label.toLowerCase()}`).join(` · `)}),(0,P.jsx)(c,{label:`Not covered`,value:String(a.uncovered.length),note:`changes no test is in for`}),(0,P.jsx)(c,{label:`Risk areas`,value:String(a.risk.length)}),(0,P.jsx)(c,{label:`Last run`,value:x?x.status===`passed`?`Passed`:`${x.counts.failed} failed`:`–`,note:x?`${R(x.at)} · ${x.on===`testmu`?`TestMu AI`:x.on===`pipeline`?`pipeline`:`this machine`}`:`Not run yet`})]}),a.triage&&(0,P.jsxs)(U,{title:`Triage of the last run`,aside:(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[a.triage.items.length,` failed or flaky`]}),children:[a.triage.environmentDown&&(0,P.jsx)(`p`,{className:`m-0 rounded-[12px] bg-warn-soft px-3 py-2 text-sm text-warn`,children:`Most failures were the environment: run the pack again before healing anything.`}),k.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[12px] border border-line-soft px-4 py-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(O,{tone:I[e].tone,children:I[e].label}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:I[e].does})]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.triage.items.filter(t=>t.route===e).map(t=>(0,P.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(e===`heal`||e===`check`)&&(0,P.jsx)(`input`,{type:`checkbox`,"aria-label":`Heal ${t.name}`,checked:v.has(t.name),onChange:e=>{let n=new Set(v);e.target.checked?n.add(t.name):n.delete(t.name),b(n)},className:`mt-1 size-5 accent-accent`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,P.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.name}),(0,P.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[t.why,` · `,t.confidence,` confidence`,t.file?` · ${t.file}`:``,t.history?` · ${t.history}`:``]})]})]},t.name))})]},e)),E.length>0&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsxs)(g,{disabled:n||!v.size,onClick:()=>r(()=>w.heal(a.name,[...v])),children:[(0,P.jsx)(A,{size:16,"aria-hidden":`true`}),`Heal `,v.size||``,` selected`]}),(0,P.jsxs)(g,{variant:`ghost`,disabled:n,onClick:()=>b(new Set(E.map(e=>e.name))),children:[`Select all `,E.length]}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The healing agent re-runs each flow in the browser before it changes anything.`})]})]}),a.runs.length>0&&(0,P.jsxs)(U,{title:`Runs`,aside:S.length||C.length?(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[[S.length?`${S.length} newly failing`:``,C.length?`${C.length} fixed`:``].filter(Boolean).join(` · `),` since the run before`]}):void 0,children:[(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...a.runs].reverse().map((e,t)=>(0,P.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsx)(O,{tone:z(e),children:e.status===`passed`?`Passed`:e.status===`failed`?`Failed`:e.status}),(0,P.jsxs)(`span`,{className:`flex-1`,children:[R(e.at),` · `,e.on===`testmu`?`TestMu AI`:e.on===`pipeline`?`pipeline`:`this machine`]}),(0,P.jsxs)(`span`,{className:`text-muted tabular-nums`,children:[e.counts.passed,` passed · `,e.counts.failed,` failed`,e.counts.skipped?` · ${e.counts.skipped} skipped`:``,` · `,B(e.seconds)]}),V(e.url)&&(0,P.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1`,children:[`Pipeline `,(0,P.jsx)(s,{size:13,"aria-hidden":`true`})]})]},`${e.at}-${t}`))}),S.length>0&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-fail`,children:[`Newly failing: `,S.join(`, `)]}),C.length>0&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-pass`,children:[`Fixed: `,C.join(`, `)]})]}),(0,P.jsxs)(U,{title:`Tests (${a.tests.length})`,aside:(0,P.jsx)(`div`,{role:`group`,"aria-label":`Why in`,className:`flex flex-wrap gap-1`,children:[`all`,...j].map(e=>(0,P.jsx)(`button`,{type:`button`,"aria-pressed":d===e,title:F[e]?.help,onClick:()=>p(e),className:h(`min-h-8 cursor-pointer rounded-[8px] border px-3 text-[13px]`,d===e?`border-ink bg-ink text-bg`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:e===`all`?`All`:F[e].label},e))}),children:[(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:T.slice(0,300).map(e=>(0,P.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.test}),e.flaky&&(0,P.jsx)(O,{tone:`warn`,children:`Flaky`})]}),(0,P.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.file,e.line?`:${e.line}`:``]}),(0,P.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:e.reasons.map((e,t)=>(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[13px] text-ink-2`,children:[(0,P.jsx)(O,{tone:F[e.kind]?.tone??`neutral`,icon:!1,children:F[e.kind]?.label??e.kind}),e.text]},t))})]},`${e.file}:${e.test}`))}),T.length>300&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`The first 300 of `,T.length,`.`]})]}),a.uncovered.length>0&&(0,P.jsx)(U,{title:`Not covered (${a.uncovered.length})`,aside:(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Extend the closest test rather than write a new one`}),children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.uncovered.map(e=>(0,P.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[(0,P.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.item}),e.title]}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.why}),e.nearest&&(0,P.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Closest: `,e.nearest.test,` `,(0,P.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[`(`,e.nearest.file,`)`]}),e.nearest.lacks.length?`, lacks ${e.nearest.lacks.join(`, `)}`:``]})]},e.item))})}),a.risk.length>0&&(0,P.jsx)(U,{title:`Risk areas`,children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.risk.map(e=>(0,P.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsx)(t,{size:16,"aria-hidden":`true`,className:h(`mt-0.5 flex-none`,e.level===`high`?`text-fail`:`text-warn`)}),(0,P.jsxs)(`span`,{className:`flex flex-col`,children:[(0,P.jsxs)(`span`,{children:[e.area,` `,(0,P.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.level]})]}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.reasons.join(`; `)})]})]},e.area))})}),(0,P.jsx)(U,{title:`Changes (${a.items.length})`,children:(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.items.slice(0,200).map(e=>{let t=L[e.kind]||D;return(0,P.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,P.jsx)(f,{icon:t,size:16,className:`mt-0.5 flex-none text-muted`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[(0,P.jsxs)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:[e.type?`${e.type} `:``,e.id]}),e.title]}),V(e.url)&&(0,P.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open ${e.id}`,className:`flex-none`,children:(0,P.jsx)(s,{size:14,"aria-hidden":`true`})})]},`${e.kind}-${e.id}`)})})}),a.notes.length>0&&(0,P.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-[13px] text-muted`,children:a.notes.map((e,t)=>(0,P.jsx)(`li`,{children:e},t))})]})}function K({open:e,onClose:t,view:r,onBuild:o,busy:s}){let[c,l]=(0,N.useState)({rangeRepo:`product`,prRepo:`product`,risk:!0,smoke:!0});(0,N.useEffect)(()=>{e&&l({rangeRepo:r.productRepo?`product`:`tests`,prRepo:r.productRepo?`product`:`tests`,risk:!0,smoke:!0})},[e,r.productRepo]);let u=(e,t)=>l({...c,[e]:t}),p=(e,t,n,r)=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`label`,{htmlFor:`pk-${e}`,className:`text-sm font-medium`,children:t}),(0,P.jsx)(i,{id:`pk-${e}`,value:String(c[e]??``),spellCheck:!1,maxLength:200,placeholder:n,onChange:t=>u(e,t.target.value)}),r&&(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:r})]}),_=(e,t)=>(0,P.jsxs)(`fieldset`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-1 border-0 p-0`,children:[(0,P.jsx)(`legend`,{className:`mb-1 text-[13px] text-muted`,children:t}),(0,P.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,P.jsx)(`input`,{type:`radio`,name:e,checked:c[e]===`product`,disabled:!r.productRepo,onChange:()=>u(e,`product`),className:`size-4 accent-accent`}),`The product's `,r.productRepo?(0,P.jsx)(`code`,{className:`font-mono text-[12px]`,children:r.productRepo}):(0,P.jsx)(`span`,{className:`text-muted`,children:`(set defects.product_repo)`})]}),(0,P.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,P.jsx)(`input`,{type:`radio`,name:e,checked:c[e]===`tests`,onChange:()=>u(e,`tests`),className:`size-4 accent-accent`}),`The tests' `,r.repo===`.`?`(this project)`:(0,P.jsx)(`code`,{className:`font-mono text-[12px]`,children:r.repo})]})]}),y=`flex flex-col gap-3 rounded-[12px] border border-line-soft p-3`;return(0,P.jsx)(a,{open:e,onClose:t,wide:!0,title:`Build a regression pack`,description:`The tests a release's changes can break, from any mix of the changes below. Building runs nothing; it takes seconds.`,footer:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(g,{onClick:t,children:`Cancel`}),(0,P.jsxs)(g,{variant:`primary`,disabled:s,onClick:()=>o(c),children:[(0,P.jsx)(f,{icon:v,size:16}),`Build the pack`]})]}),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 pt-3`,children:[p(`name`,`Name`,`release-1.5`,`Lower-case letters, digits, dots and dashes. Empty: release-<date>.`),(0,P.jsxs)(`div`,{className:y,children:[(0,P.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[(0,P.jsx)(M,{size:16,"aria-hidden":`true`,className:`text-accent-fg`}),`Code changes`]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[p(`from`,`Commits after`,`release/1.4, a tag or a commit`),p(`to`,`Up to`,`HEAD`)]}),_(`rangeRepo`,`In the repository`),(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[p(`prs`,`Pull requests`,`57, 58 or their links`),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`label`,{htmlFor:`pk-days`,className:`text-sm font-medium`,children:`Or merged in the last`}),(0,P.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,P.jsx)(i,{id:`pk-days`,type:`number`,min:1,max:365,value:c.mergedDays??``,onChange:e=>u(`mergedDays`,e.target.value?Number(e.target.value):void 0),className:`w-24`}),` days`]})]})]}),(c.prs||c.mergedDays)&&_(`prRepo`,`Pull requests of`)]}),(0,P.jsxs)(`div`,{className:h(y,!r.azureDevops&&`opacity-70`),children:[(0,P.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[(0,P.jsx)(f,{icon:n,size:16,className:`text-accent-fg`}),`Azure DevOps work items and their linked test cases`]}),!r.azureDevops&&(0,P.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Not set up: `,(0,P.jsx)(`a`,{href:d(`settings`,`integrations`),children:`Settings, Integrations`}),`.`]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[p(`sprint`,`Sprint`,`current, or Sprint 41`),p(`iteration`,`Iteration path`,`Shop\\Release 2026.09`),p(`area`,`Area path`,`Shop\\Checkout`),p(`parent`,`Epic or feature`,`1200`),p(`workItems`,`Work items`,`2211, 2212`)]}),(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Their stories and bugs, the test cases each is tested by, and the files their linked pull requests changed.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,P.jsx)(m,{checked:c.risk!==!1,onChange:e=>u(`risk`,e),label:`Add tests for risk areas`}),`Add tests for risk areas the release touches`]}),(0,P.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,P.jsx)(m,{checked:c.smoke!==!1,onChange:e=>u(`smoke`,e),label:`Add smoke tests`}),`Add smoke-tagged tests`]})]})]})})}function q({sub:e}){let[t,n]=(0,N.useState)(null),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(!1),p=(0,N.useCallback)(()=>{w.list().then(e=>{n(e),i(``)},e=>i(e.message))},[]);(0,N.useEffect)(p,[p]);let m=!!t?.job?.running;(0,N.useEffect)(()=>{if(!m)return;let e=setInterval(p,1500);return()=>clearInterval(e)},[m,p]);let _=async e=>{o(!0),i(``);try{await e(),p()}catch(e){i(e.message)}finally{o(!1)}},y=e?decodeURIComponent(e):``,E=t?.packs.find(e=>e.name===y)||t?.packs[0],D=(0,N.useMemo)(()=>`${t?.job?.endedAt??``}|${E?.runs??0}|${E?.createdAt??``}`,[t,E]);return(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsx)(b,{}),(0,P.jsxs)(`main`,{className:h(S,`@container flex-auto gap-4`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(C,{pixel:l.regression,size:`lg`}),(0,P.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Regression`}),(0,P.jsxs)(g,{variant:`primary`,disabled:!t||m,onClick:()=>c(!0),children:[(0,P.jsx)(f,{icon:v,size:16}),`Build a pack`]})]}),(0,P.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`A regression pack is the set of tests in `,t&&t.repo!==`.`?(0,P.jsx)(`code`,{className:`font-mono text-[13px]`,children:t.repo}):`this project`,` that a release's changes can break: from the commits and pull requests of the product or development repositories, and the Azure DevOps sprint, epic or work items with their linked test cases. Each test says why it is in; the changes no test covers are listed. Run it here or on TestMu AI, and each run is triaged into what to heal, re-run or fix.`]}),r&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t?.job&&(0,P.jsx)(H,{job:t.job,onStop:()=>_(()=>w.stop())}),t&&(t.packs.length?(0,P.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,P.jsxs)(`nav`,{"aria-label":`Packs`,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,P.jsxs)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:[`Packs (`,t.packs.length,`)`]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.packs.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`a`,{href:d(`regression`,encodeURIComponent(e.name)),"aria-current":E?.name===e.name?`page`:void 0,className:h(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,E?.name===e.name?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[t?.job?.running&&t.job.pack===e.name?(0,P.jsx)(x,{state:t.job.kind===`heal`?`retrying`:`working`,label:`Working on it`,px:16}):(0,P.jsx)(`span`,{className:h(`size-2.5 flex-none rounded-full`,e.lastRun?e.lastRun.status===`passed`?`bg-pass`:`bg-fail`:`bg-line`),"aria-label":e.lastRun?e.lastRun.status:`not run`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,P.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,P.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[T(e.tests,`test`),` · `,e.uncovered,` not covered · `,R(e.createdAt)]})]})]})},e.name))})]}),E&&(0,P.jsx)(G,{name:E.name,busy:a||m,act:_,version:D})]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,P.jsx)(f,{icon:u,size:24,className:`text-muted`}),(0,P.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No regression packs yet. Build one from a sprint, the commits since the last release, or the pull requests merged this week.`}),(0,P.jsx)(g,{onClick:()=>c(!0),children:`Build a pack`})]}))]}),t&&(0,P.jsx)(K,{open:s,onClose:()=>c(!1),view:t,busy:a||m,onBuild:e=>_(async()=>{await w.build(e),c(!1)})})]})}export{q as Regression};
@@ -1,2 +1,2 @@
1
- import{Fr as e,G as t,K as n,Mr as r,Nn as i,Tr as a,Wn as o,X as s,Y as c,Z as l,bt as u,ct as d,dt as f,j as p,k as m,ot as h,r as g,t as _,wn as v,xt as y,yt as b}from"./frame-C0RAa-Ev.js";import{t as x}from"./circle-dashed-CO-RmzsR.js";import{t as S}from"./markdown-9nLYjAqd.js";import{n as C,t as w}from"./trending-up-BbHX2F6j.js";import{T,x as E,y as D}from"./index-DBQd0Qgk.js";import{n as O,t as k}from"./when-CHnpLdYw.js";var A=e(r(),1),j=b(),M={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`Mobile run`,page:`Report page`},N=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},P=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`};function F(e){return e.scope===`page`?{tone:`neutral`,label:`Report`}:e.counts.total?e.counts.failed?{tone:`fail`,label:`${e.counts.failed} failed`}:e.stopped||e.counts.other?{tone:`warn`,label:e.stopped?`Stopped`:`${e.counts.other} not run`}:{tone:`pass`,label:`Passed`}:{tone:`neutral`,label:`No results`}}var I=50;function L({r:e}){let t=F(e),n=e.scope===`page`?v:t.tone===`pass`?T:t.tone===`fail`?o:x;return(0,j.jsx)(n,{size:16,"aria-label":t.label,className:u(`flex-none`,t.tone===`pass`?`text-pass`:t.tone===`fail`?`text-fail`:t.tone===`warn`?`text-warn`:`text-muted`)})}var R=e=>{let t=new Date(`${e}T12:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString([],{day:`numeric`,month:`short`})},z=e=>{let t=e.reduce((e,t)=>e+t.cases,0);return t?Math.round(e.reduce((e,t)=>e+t.passed,0)/t*100):null};function B({title:e,note:t,children:n,className:r}){return(0,j.jsxs)(`section`,{className:u(`flex min-w-0 flex-col rounded-[14px] border border-line-soft bg-bg px-4 py-3.5`,r),children:[(0,j.jsx)(`h3`,{className:`m-0 text-[15px] font-semibold`,children:e}),t&&(0,j.jsx)(`p`,{className:`m-0 mt-0.5 text-[12.5px] text-muted`,children:t}),(0,j.jsx)(`div`,{className:`mt-3 flex min-w-0 flex-col`,children:n})]})}function V({part:e,whole:t,tone:n,label:r}){return(0,j.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-16 flex-none overflow-hidden rounded-full bg-surface-strong`,children:(0,j.jsx)(`span`,{className:u(`block h-full rounded-full transition-[width] duration-200 ease-out`,n===`pass`?`bg-pass`:n===`fail`?`bg-fail`:`bg-accent`),style:{width:`${t?Math.max(4,e/t*100):0}%`}})}),(0,j.jsx)(`span`,{className:`text-[12.5px] whitespace-nowrap text-ink-2 tabular-nums`,children:r})]})}function H({days:e}){let[t,n]=(0,A.useState)(null),r=e.slice(-30);if(!r.length)return(0,j.jsx)(`p`,{className:`m-0 py-6 text-sm text-muted`,children:`No runs with results yet.`});let i=Math.max(1,...r.map(e=>e.cases)),a=i<=4?1:Math.ceil(i/4/5)*5||1,o=Math.ceil(i/a)*a,s=[o,Math.round(o/2),0],c=Math.ceil(r.length/8),l=t===null?null:r[t];return(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{"aria-hidden":`true`,className:`flex gap-4 text-[12.5px] text-ink-2`,children:[(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,j.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,j.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-fail`}),` Failed`]})]}),(0,j.jsxs)(`div`,{className:`relative grid grid-cols-[32px_minmax(0,1fr)] gap-x-2`,children:[(0,j.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-[180px] flex-col justify-between text-right text-[11px] text-muted tabular-nums`,children:s.map(e=>(0,j.jsx)(`span`,{className:`-translate-y-1/2 first:translate-y-0 last:translate-y-0`,children:e},e))}),(0,j.jsxs)(`div`,{className:`relative h-[180px]`,onMouseLeave:()=>n(null),children:[s.map((e,t)=>(0,j.jsx)(`span`,{"aria-hidden":`true`,className:u(`absolute inset-x-0 border-t`,t===s.length-1?`border-line`:`border-line-soft`),style:{top:`${(1-e/o)*100}%`}},e)),(0,j.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-[3px]`,children:r.map((e,r)=>{let i=e.cases-e.passed;return(0,j.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 cursor-default flex-col justify-end`,onMouseEnter:()=>n(r),children:(0,j.jsxs)(`div`,{className:u(`flex w-full flex-col justify-end gap-[2px] transition-opacity`,t!==null&&t!==r&&`opacity-50`),style:{height:`${e.cases/o*100}%`},children:[i>0&&(0,j.jsx)(`span`,{className:`min-h-[2px] w-full rounded-t-[4px] bg-fail`,style:{flexGrow:i}}),e.passed>0&&(0,j.jsx)(`span`,{className:u(`min-h-[2px] w-full bg-pass`,!i&&`rounded-t-[4px]`),style:{flexGrow:e.passed}})]})},e.day)})}),l&&(0,j.jsxs)(`div`,{role:`status`,className:`pointer-events-none absolute z-[2] w-max max-w-[220px] -translate-x-1/2 -translate-y-[calc(100%+8px)] rounded-[10px] border border-line-soft bg-bg px-3 py-2 text-[12.5px] shadow-composer`,style:{left:`${Math.min(88,Math.max(12,(t+.5)/r.length*100))}%`,top:`${(1-l.cases/o)*100}%`},children:[(0,j.jsx)(`b`,{className:`block text-ink`,children:R(l.day)}),(0,j.jsxs)(`span`,{className:`block text-ink-2 tabular-nums`,children:[l.passed,` passed, `,l.cases-l.passed,` failed · `,z([l]),`%`]}),(0,j.jsx)(`span`,{className:`block text-muted`,children:y(l.runs,`run`)})]})]}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-[3px] text-[11px] text-muted`,children:r.map((e,t)=>(0,j.jsx)(`span`,{className:`min-w-0 flex-1 text-center whitespace-nowrap`,children:t%c===0&&(0,j.jsx)(`span`,{className:u(t/c%2==1&&`hidden @2xl:inline`),children:R(e.day)})},e.day))})]}),(0,j.jsxs)(`table`,{className:`sr-only`,children:[(0,j.jsx)(`caption`,{children:`Cases by day`}),(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`Day`}),(0,j.jsx)(`th`,{children:`Runs`}),(0,j.jsx)(`th`,{children:`Passed`}),(0,j.jsx)(`th`,{children:`Failed`})]})}),(0,j.jsx)(`tbody`,{children:r.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{children:e.day}),(0,j.jsx)(`td`,{children:e.runs}),(0,j.jsx)(`td`,{children:e.passed}),(0,j.jsx)(`td`,{children:e.cases-e.passed})]},e.day))})]})]})}function U({project:e,build:t,onBuilt:n}){let[r,s]=(0,A.useState)(t),[l,h]=(0,A.useState)(``),g=!!r?.running;(0,A.useEffect)(()=>{if(!g)return;let e=setInterval(async()=>{try{let e=await a.buildStatus();s(e),e&&!e.running&&n()}catch{}},1200);return()=>clearInterval(e)},[g,n]);let _=e.cases?Math.round(e.passed/e.cases*100):null,v=z(e.days.slice(-7)),b=z(e.days.slice(-14,-7)),x=v!==null&&b!==null?v-b:null,S=[{label:`Runs`,value:String(e.runs),sub:e.runs?`${R(String(e.from).slice(0,10))} – ${R(String(e.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(e.cases),sub:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`text-pass`,children:[e.passed,` passed`]}),` · `,(0,j.jsxs)(`span`,{className:u(e.failed&&`text-fail`),children:[e.failed,` failed`]})]})},{label:`Tokens`,value:p(e.tokens),sub:e.cost?m(e.cost.amount,e.cost.currency):void 0}];return(0,j.jsxs)(`section`,{"aria-labelledby":`project-h`,className:`flex min-w-0 flex-col gap-4`,children:[(0,j.jsx)(`h2`,{id:`project-h`,className:`sr-only`,children:`Project report`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] text-[13px] text-muted`,children:e.page?`The HTML report was built ${N(e.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),e.page&&(0,j.jsxs)(f,{size:`sm`,onClick:async()=>h(await c(e.page.file)),children:[(0,j.jsx)(i,{size:14,"aria-hidden":`true`}),`Open HTML report`]}),(0,j.jsx)(f,{size:`sm`,variant:`outline`,disabled:g,onClick:async()=>{h(``);try{s(await a.build())}catch(e){h(e.message)}},children:g?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d,{state:`working`,px:14}),`Building…`]}):e.page?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{size:14,"aria-hidden":`true`}),`Rebuild`]}):`Build HTML report`})]}),l&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:l}),r&&(r.running||r.ok===!1)&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!r.running&&(0,j.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`forgeqe bi build stopped with a problem; its output is below.`}),(0,j.jsx)(`pre`,{"aria-label":`forgeqe bi build output`,"aria-live":`polite`,className:`m-0 max-h-[200px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:r.lines.length?r.lines.join(`
2
- `):`Starting…`})]}),e.runs?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-[14px] border border-line-soft bg-line-soft @2xl:grid-cols-[1.4fr_1fr_1fr_1fr]`,children:[(0,j.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-1 bg-bg px-5 py-4 @2xl:col-span-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Pass rate`}),(0,j.jsx)(`span`,{className:u(`text-[34px] leading-none font-semibold tracking-[-0.02em] tabular-nums`,_!==null&&_<80?`text-fail`:`text-ink`),children:_===null?`–`:`${_}%`}),x!==null&&(0,j.jsxs)(`span`,{className:u(`inline-flex items-center gap-1 text-[12.5px]`,x>0?`text-pass`:x<0?`text-fail`:`text-muted`),children:[x>0?(0,j.jsx)(w,{size:14,"aria-hidden":`true`}):x<0?(0,j.jsx)(C,{size:14,"aria-hidden":`true`}):null,x===0?`Same as the week before`:`${x>0?`Up`:`Down`} ${Math.abs(x)} ${Math.abs(x)===1?`point`:`points`} on the week before`]})]}),S.map(e=>(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 bg-bg px-5 py-4 last:col-span-2 @2xl:last:col-span-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.label}),(0,j.jsx)(`span`,{className:`text-[22px] leading-tight font-semibold tabular-nums`,children:e.value}),e.sub&&(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:e.sub})]},e.label))]}),(0,j.jsx)(B,{title:`Cases by day`,note:`The last ${y(Math.min(30,e.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,j.jsx)(H,{days:e.days})}),(0,j.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,j.jsx)(B,{title:`Fails most`,note:`Cases that failed in the most runs.`,children:e.failing.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No case has failed.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.failing.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(o,{size:14,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,j.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[14px]`,title:e.title,children:[e.id&&(0,j.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,j.jsx)(`span`,{className:`flex-none text-[12px] text-muted`,children:k(e.lastFailed)})]}),(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3 pl-[22px]`,children:[(0,j.jsx)(V,{part:e.failed,whole:e.runs,tone:`fail`,label:`failed ${e.failed} of ${e.runs}`}),e.summary&&(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[12.5px] text-muted`,children:e.summary.replace(/[*_`#>[\]]/g,``)})]})]},e.id||e.title))})}),(0,j.jsx)(B,{title:`Defects`,note:`Failures grouped by their cause.`,children:e.defects.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None found.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.defects.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,title:e.title,children:e.title}),(0,j.jsxs)(`span`,{className:`text-[12.5px] whitespace-nowrap text-muted tabular-nums`,children:[y(e.cases,`case`),` · `,y(e.runs,`run`),e.lastSeen?` · ${k(e.lastSeen)}`:``]})]},e.title))})}),(0,j.jsx)(B,{title:`Flaky`,note:`Cases that both passed and failed.`,children:e.flaky.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.flaky.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 truncate text-[14px]`,title:e.title,children:[e.id&&(0,j.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,j.jsx)(V,{part:e.failed,whole:e.runs,tone:`fail`,label:`${e.failed}/${e.runs} failed`})]},e.id||e.title))})}),(0,j.jsx)(B,{title:`By kind`,note:`Each kind of run and how often its cases passed.`,children:e.kinds.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No runs with results yet.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.kinds.map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,children:M[e.scope]||e.scope}),(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:y(e.runs,`run`)}),(0,j.jsx)(V,{part:e.passed,whole:e.cases,tone:`pass`,label:e.cases?`${Math.round(e.passed/e.cases*100)}% passed`:`no cases`})]},e.scope))})})]})]}):(0,j.jsxs)(`div`,{className:`flex flex-col items-start gap-2 rounded-[14px] border border-dashed border-line px-5 py-6`,children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`No runs yet`}),(0,j.jsx)(`span`,{className:`max-w-[60ch] text-sm text-muted`,children:`Runs, suites and monitor rounds are taken together here once there are some: pass rate by day, the cases that fail most, flaky cases and defects.`})]})]})}function W({sub:e}){let[r,o]=(0,A.useState)(null),[d,p]=(0,A.useState)(``),[m,v]=(0,A.useState)(``),[y,b]=(0,A.useState)(``),[x,C]=(0,A.useState)(`all`),[w,T]=(0,A.useState)(I),[E,R]=(0,A.useState)(``),z=(0,A.useCallback)(()=>{a.list().then(o,e=>p(e.message))},[]);(0,A.useEffect)(z,[z]);let B=e===`project`?`project`:`execution`,V=r?.rows??null,H=y.toLowerCase().split(/\s+/).filter(Boolean),W=(0,A.useMemo)(()=>(V||[]).filter(e=>(!m||e.scope===m)&&H.every(t=>`${e.title} ${e.id} ${M[e.scope]}`.toLowerCase().includes(t))),[V,m,y]),G=W.filter(e=>F(e).tone===`fail`).length,K=x===`failed`?W.filter(e=>F(e).tone===`fail`):W;(0,A.useEffect)(()=>T(I),[m,y,x]);let q=[...new Set((V||[]).map(e=>e.scope))];return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsx)(g,{}),(0,j.jsxs)(`main`,{className:u(_,`@container flex-auto gap-4`),children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-2`,children:[(0,j.jsx)(h,{pixel:s.reports,size:`lg`}),(0,j.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Reports`}),(0,j.jsx)(`nav`,{"aria-label":`Reports`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`execution`,`Execution reports`,l(`reports`)],[`project`,`Project report`,l(`reports`,`project`)]].map(([e,t,n])=>(0,j.jsx)(`a`,{href:n,"aria-current":B===e?`page`:void 0,className:u(`inline-flex min-h-9 items-center rounded-[7px] px-4 text-sm font-medium no-underline`,B===e?`bg-bg text-ink shadow-composer hover:text-ink`:`text-ink-2 hover:text-ink`),children:t},e))})]}),d&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:d}),!r&&!d&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&B===`project`&&(0,j.jsx)(U,{project:r.project,build:r.build,onBuilt:z}),r&&B===`execution`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every report ForgeQE generated, newest first. Open one to see it in full in a new tab.`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_240px]`,children:[(0,j.jsx)(D,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,j.jsx)(`label`,{htmlFor:`report-search`,className:`sr-only`,children:`Find a report`}),(0,j.jsx)(t,{id:`report-search`,type:`search`,value:y,onChange:e=>b(e.target.value),placeholder:`Find a report`,className:`h-9 pl-9`})]}),[[`all`,`All`,W.length],[`failed`,`Failed`,G]].map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,"aria-pressed":x===e,onClick:()=>C(e),className:u(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,x===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,j.jsx)(`span`,{className:u(`tabular-nums`,e===`failed`&&n?`text-fail`:``),children:n})]},e)),q.length>1&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`label`,{htmlFor:`report-kind`,className:`sr-only`,children:`Kind`}),(0,j.jsxs)(n,{id:`report-kind`,value:m,onChange:e=>v(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,j.jsx)(`option`,{value:``,children:`Every kind`}),q.map(e=>(0,j.jsx)(`option`,{value:e,children:M[e]},e))]})]})]}),E&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:E}),(0,j.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,j.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_110px_150px_100px_128px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,j.jsx)(`span`,{children:`Report`}),(0,j.jsx)(`span`,{children:`Kind`}),(0,j.jsx)(`span`,{children:`Result`}),(0,j.jsx)(`span`,{className:`text-right`,children:`When`}),(0,j.jsx)(`span`,{})]}),(0,j.jsxs)(`ul`,{"aria-label":`Execution reports`,className:`m-0 list-none p-1.5`,children:[K.length===0&&(0,j.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:r.rows.length?`Nothing matches.`:`No reports yet. Runs, suites and monitor rounds show here once they have run.`}),K.slice(0,w).map((e,t,n)=>{let r=O(e.startedAt),a=F(e);return(0,j.jsxs)(`li`,{className:`contents`,children:[(t===0||O(n[t-1].startedAt)!==r)&&(0,j.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,j.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 hover:bg-surface-muted @3xl:grid-cols-[auto_minmax(0,1fr)_110px_150px_100px_128px] @3xl:gap-x-4`,children:[(0,j.jsx)(L,{r:e}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,j.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.title,children:e.title}),(0,j.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[M[e.scope],e.scope===`page`||!e.counts.total?``:`${e.counts.passed}/${e.counts.total} passed`,k(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,j.jsx)(`span`,{className:`hidden truncate text-[13px] text-muted @3xl:block`,children:M[e.scope]}),(0,j.jsxs)(`span`,{className:`hidden truncate text-[13px] text-muted tabular-nums @3xl:block`,children:[(0,j.jsx)(`span`,{className:u(a.tone===`fail`&&`text-fail`),children:e.scope===`page`?`Report`:e.counts.total?`${e.counts.passed}/${e.counts.total} passed`:a.label}),P(e.ms)?` · ${P(e.ms)}`:``]}),(0,j.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,title:N(e.startedAt),children:k(e.startedAt)}),(0,j.jsx)(`span`,{className:`flex min-w-0 justify-end`,children:e.report?(0,j.jsxs)(f,{size:`sm`,"aria-label":`Open the report of ${e.title} in a new tab`,onClick:async()=>R(await c(e.report)),children:[(0,j.jsx)(i,{size:14,"aria-hidden":`true`}),(0,j.jsx)(`span`,{className:`hidden @md:inline`,children:`Open report`})]}):(0,j.jsx)(S,{path:e.folder,children:`Folder`})})]})]},e.key)})]}),(K.length>w||r.total>r.rows.length)&&(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,j.jsxs)(`span`,{children:[`Showing `,Math.min(w,K.length),` of `,K.length,r.total>r.rows.length?` (the newest ${r.rows.length} of ${r.total})`:``]}),K.length>w&&(0,j.jsxs)(f,{size:`sm`,onClick:()=>T(w+I),children:[`Show `,Math.min(I,K.length-w),` more`]})]})]})]})]})]})}export{W as Reports};
1
+ import{Fr as e,G as t,K as n,Mr as r,Nn as i,Tr as a,Wn as o,X as s,Y as c,Z as l,bt as u,dt as d,j as f,k as p,r as m,st as h,t as g,ut as _,wn as v,xt as y,yt as b}from"./frame-z3iL_6aL.js";import{t as x}from"./circle-dashed-C84s5T0C.js";import{t as S}from"./markdown-BtqKvAEi.js";import{n as C,t as w}from"./trending-up-DK1wDqic.js";import{E as T,S as E,b as D}from"./index-BVw2ygO2.js";import{n as O,t as k}from"./when-CHnpLdYw.js";var A=e(r(),1),j=b(),M={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`Mobile run`,page:`Report page`},N=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},P=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`};function F(e){return e.scope===`page`?{tone:`neutral`,label:`Report`}:e.counts.total?e.counts.failed?{tone:`fail`,label:`${e.counts.failed} failed`}:e.stopped||e.counts.other?{tone:`warn`,label:e.stopped?`Stopped`:`${e.counts.other} not run`}:{tone:`pass`,label:`Passed`}:{tone:`neutral`,label:`No results`}}var I=50;function L({r:e}){let t=F(e),n=e.scope===`page`?v:t.tone===`pass`?T:t.tone===`fail`?o:x;return(0,j.jsx)(n,{size:16,"aria-label":t.label,className:u(`flex-none`,t.tone===`pass`?`text-pass`:t.tone===`fail`?`text-fail`:t.tone===`warn`?`text-warn`:`text-muted`)})}var R=e=>{let t=new Date(`${e}T12:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString([],{day:`numeric`,month:`short`})},z=e=>{let t=e.reduce((e,t)=>e+t.cases,0);return t?Math.round(e.reduce((e,t)=>e+t.passed,0)/t*100):null};function B({title:e,note:t,children:n,className:r}){return(0,j.jsxs)(`section`,{className:u(`flex min-w-0 flex-col rounded-[14px] border border-line-soft bg-bg px-4 py-3.5`,r),children:[(0,j.jsx)(`h3`,{className:`m-0 text-[15px] font-semibold`,children:e}),t&&(0,j.jsx)(`p`,{className:`m-0 mt-0.5 text-[12.5px] text-muted`,children:t}),(0,j.jsx)(`div`,{className:`mt-3 flex min-w-0 flex-col`,children:n})]})}function V({part:e,whole:t,tone:n,label:r}){return(0,j.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-16 flex-none overflow-hidden rounded-full bg-surface-strong`,children:(0,j.jsx)(`span`,{className:u(`block h-full rounded-full transition-[width] duration-200 ease-out`,n===`pass`?`bg-pass`:n===`fail`?`bg-fail`:`bg-accent`),style:{width:`${t?Math.max(4,e/t*100):0}%`}})}),(0,j.jsx)(`span`,{className:`text-[12.5px] whitespace-nowrap text-ink-2 tabular-nums`,children:r})]})}function H({days:e}){let[t,n]=(0,A.useState)(null),r=e.slice(-30);if(!r.length)return(0,j.jsx)(`p`,{className:`m-0 py-6 text-sm text-muted`,children:`No runs with results yet.`});let i=Math.max(1,...r.map(e=>e.cases)),a=i<=4?1:Math.ceil(i/4/5)*5||1,o=Math.ceil(i/a)*a,s=[o,Math.round(o/2),0],c=Math.ceil(r.length/8),l=t===null?null:r[t];return(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{"aria-hidden":`true`,className:`flex gap-4 text-[12.5px] text-ink-2`,children:[(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,j.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,j.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-fail`}),` Failed`]})]}),(0,j.jsxs)(`div`,{className:`relative grid grid-cols-[32px_minmax(0,1fr)] gap-x-2`,children:[(0,j.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-[180px] flex-col justify-between text-right text-[11px] text-muted tabular-nums`,children:s.map(e=>(0,j.jsx)(`span`,{className:`-translate-y-1/2 first:translate-y-0 last:translate-y-0`,children:e},e))}),(0,j.jsxs)(`div`,{className:`relative h-[180px]`,onMouseLeave:()=>n(null),children:[s.map((e,t)=>(0,j.jsx)(`span`,{"aria-hidden":`true`,className:u(`absolute inset-x-0 border-t`,t===s.length-1?`border-line`:`border-line-soft`),style:{top:`${(1-e/o)*100}%`}},e)),(0,j.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-[3px]`,children:r.map((e,r)=>{let i=e.cases-e.passed;return(0,j.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 cursor-default flex-col justify-end`,onMouseEnter:()=>n(r),children:(0,j.jsxs)(`div`,{className:u(`flex w-full flex-col justify-end gap-[2px] transition-opacity`,t!==null&&t!==r&&`opacity-50`),style:{height:`${e.cases/o*100}%`},children:[i>0&&(0,j.jsx)(`span`,{className:`min-h-[2px] w-full rounded-t-[4px] bg-fail`,style:{flexGrow:i}}),e.passed>0&&(0,j.jsx)(`span`,{className:u(`min-h-[2px] w-full bg-pass`,!i&&`rounded-t-[4px]`),style:{flexGrow:e.passed}})]})},e.day)})}),l&&(0,j.jsxs)(`div`,{role:`status`,className:`pointer-events-none absolute z-[2] w-max max-w-[220px] -translate-x-1/2 -translate-y-[calc(100%+8px)] rounded-[10px] border border-line-soft bg-bg px-3 py-2 text-[12.5px] shadow-composer`,style:{left:`${Math.min(88,Math.max(12,(t+.5)/r.length*100))}%`,top:`${(1-l.cases/o)*100}%`},children:[(0,j.jsx)(`b`,{className:`block text-ink`,children:R(l.day)}),(0,j.jsxs)(`span`,{className:`block text-ink-2 tabular-nums`,children:[l.passed,` passed, `,l.cases-l.passed,` failed · `,z([l]),`%`]}),(0,j.jsx)(`span`,{className:`block text-muted`,children:y(l.runs,`run`)})]})]}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-[3px] text-[11px] text-muted`,children:r.map((e,t)=>(0,j.jsx)(`span`,{className:`min-w-0 flex-1 text-center whitespace-nowrap`,children:t%c===0&&(0,j.jsx)(`span`,{className:u(t/c%2==1&&`hidden @2xl:inline`),children:R(e.day)})},e.day))})]}),(0,j.jsxs)(`table`,{className:`sr-only`,children:[(0,j.jsx)(`caption`,{children:`Cases by day`}),(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`Day`}),(0,j.jsx)(`th`,{children:`Runs`}),(0,j.jsx)(`th`,{children:`Passed`}),(0,j.jsx)(`th`,{children:`Failed`})]})}),(0,j.jsx)(`tbody`,{children:r.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{children:e.day}),(0,j.jsx)(`td`,{children:e.runs}),(0,j.jsx)(`td`,{children:e.passed}),(0,j.jsx)(`td`,{children:e.cases-e.passed})]},e.day))})]})]})}function U({project:e,build:t,onBuilt:n}){let[r,s]=(0,A.useState)(t),[l,m]=(0,A.useState)(``),g=!!r?.running;(0,A.useEffect)(()=>{if(!g)return;let e=setInterval(async()=>{try{let e=await a.buildStatus();s(e),e&&!e.running&&n()}catch{}},1200);return()=>clearInterval(e)},[g,n]);let _=e.cases?Math.round(e.passed/e.cases*100):null,v=z(e.days.slice(-7)),b=z(e.days.slice(-14,-7)),x=v!==null&&b!==null?v-b:null,S=[{label:`Runs`,value:String(e.runs),sub:e.runs?`${R(String(e.from).slice(0,10))} – ${R(String(e.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(e.cases),sub:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`text-pass`,children:[e.passed,` passed`]}),` · `,(0,j.jsxs)(`span`,{className:u(e.failed&&`text-fail`),children:[e.failed,` failed`]})]})},{label:`Tokens`,value:f(e.tokens),sub:e.cost?p(e.cost.amount,e.cost.currency):void 0}];return(0,j.jsxs)(`section`,{"aria-labelledby":`project-h`,className:`flex min-w-0 flex-col gap-4`,children:[(0,j.jsx)(`h2`,{id:`project-h`,className:`sr-only`,children:`Project report`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] text-[13px] text-muted`,children:e.page?`The HTML report was built ${N(e.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),e.page&&(0,j.jsxs)(d,{size:`sm`,onClick:async()=>m(await c(e.page.file)),children:[(0,j.jsx)(i,{size:14,"aria-hidden":`true`}),`Open HTML report`]}),(0,j.jsx)(d,{size:`sm`,variant:`outline`,disabled:g,onClick:async()=>{m(``);try{s(await a.build())}catch(e){m(e.message)}},children:g?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(h,{state:`working`,px:14}),`Building…`]}):e.page?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{size:14,"aria-hidden":`true`}),`Rebuild`]}):`Build HTML report`})]}),l&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:l}),r&&(r.running||r.ok===!1)&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!r.running&&(0,j.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`forgeqe bi build stopped with a problem; its output is below.`}),(0,j.jsx)(`pre`,{"aria-label":`forgeqe bi build output`,"aria-live":`polite`,className:`m-0 max-h-[200px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:r.lines.length?r.lines.join(`
2
+ `):`Starting…`})]}),e.runs?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-[14px] border border-line-soft bg-line-soft @2xl:grid-cols-[1.4fr_1fr_1fr_1fr]`,children:[(0,j.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-1 bg-bg px-5 py-4 @2xl:col-span-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Pass rate`}),(0,j.jsx)(`span`,{className:u(`text-[34px] leading-none font-semibold tracking-[-0.02em] tabular-nums`,_!==null&&_<80?`text-fail`:`text-ink`),children:_===null?`–`:`${_}%`}),x!==null&&(0,j.jsxs)(`span`,{className:u(`inline-flex items-center gap-1 text-[12.5px]`,x>0?`text-pass`:x<0?`text-fail`:`text-muted`),children:[x>0?(0,j.jsx)(w,{size:14,"aria-hidden":`true`}):x<0?(0,j.jsx)(C,{size:14,"aria-hidden":`true`}):null,x===0?`Same as the week before`:`${x>0?`Up`:`Down`} ${Math.abs(x)} ${Math.abs(x)===1?`point`:`points`} on the week before`]})]}),S.map(e=>(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 bg-bg px-5 py-4 last:col-span-2 @2xl:last:col-span-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.label}),(0,j.jsx)(`span`,{className:`text-[22px] leading-tight font-semibold tabular-nums`,children:e.value}),e.sub&&(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:e.sub})]},e.label))]}),(0,j.jsx)(B,{title:`Cases by day`,note:`The last ${y(Math.min(30,e.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,j.jsx)(H,{days:e.days})}),(0,j.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,j.jsx)(B,{title:`Fails most`,note:`Cases that failed in the most runs.`,children:e.failing.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No case has failed.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.failing.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(o,{size:14,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,j.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[14px]`,title:e.title,children:[e.id&&(0,j.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,j.jsx)(`span`,{className:`flex-none text-[12px] text-muted`,children:k(e.lastFailed)})]}),(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3 pl-[22px]`,children:[(0,j.jsx)(V,{part:e.failed,whole:e.runs,tone:`fail`,label:`failed ${e.failed} of ${e.runs}`}),e.summary&&(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[12.5px] text-muted`,children:e.summary.replace(/[*_`#>[\]]/g,``)})]})]},e.id||e.title))})}),(0,j.jsx)(B,{title:`Defects`,note:`Failures grouped by their cause.`,children:e.defects.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None found.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.defects.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,title:e.title,children:e.title}),(0,j.jsxs)(`span`,{className:`text-[12.5px] whitespace-nowrap text-muted tabular-nums`,children:[y(e.cases,`case`),` · `,y(e.runs,`run`),e.lastSeen?` · ${k(e.lastSeen)}`:``]})]},e.title))})}),(0,j.jsx)(B,{title:`Flaky`,note:`Cases that both passed and failed.`,children:e.flaky.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.flaky.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 truncate text-[14px]`,title:e.title,children:[e.id&&(0,j.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,j.jsx)(V,{part:e.failed,whole:e.runs,tone:`fail`,label:`${e.failed}/${e.runs} failed`})]},e.id||e.title))})}),(0,j.jsx)(B,{title:`By kind`,note:`Each kind of run and how often its cases passed.`,children:e.kinds.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No runs with results yet.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.kinds.map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,children:M[e.scope]||e.scope}),(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:y(e.runs,`run`)}),(0,j.jsx)(V,{part:e.passed,whole:e.cases,tone:`pass`,label:e.cases?`${Math.round(e.passed/e.cases*100)}% passed`:`no cases`})]},e.scope))})})]})]}):(0,j.jsxs)(`div`,{className:`flex flex-col items-start gap-2 rounded-[14px] border border-dashed border-line px-5 py-6`,children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`No runs yet`}),(0,j.jsx)(`span`,{className:`max-w-[60ch] text-sm text-muted`,children:`Runs, suites and monitor rounds are taken together here once there are some: pass rate by day, the cases that fail most, flaky cases and defects.`})]})]})}function W({sub:e}){let[r,o]=(0,A.useState)(null),[f,p]=(0,A.useState)(``),[h,v]=(0,A.useState)(``),[y,b]=(0,A.useState)(``),[x,C]=(0,A.useState)(`all`),[w,T]=(0,A.useState)(I),[E,R]=(0,A.useState)(``),z=(0,A.useCallback)(()=>{a.list().then(o,e=>p(e.message))},[]);(0,A.useEffect)(z,[z]);let B=e===`project`?`project`:`execution`,V=r?.rows??null,H=y.toLowerCase().split(/\s+/).filter(Boolean),W=(0,A.useMemo)(()=>(V||[]).filter(e=>(!h||e.scope===h)&&H.every(t=>`${e.title} ${e.id} ${M[e.scope]}`.toLowerCase().includes(t))),[V,h,y]),G=W.filter(e=>F(e).tone===`fail`).length,K=x===`failed`?W.filter(e=>F(e).tone===`fail`):W;(0,A.useEffect)(()=>T(I),[h,y,x]);let q=[...new Set((V||[]).map(e=>e.scope))];return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsx)(m,{}),(0,j.jsxs)(`main`,{className:u(g,`@container flex-auto gap-4`),children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-2`,children:[(0,j.jsx)(_,{pixel:s.reports,size:`lg`}),(0,j.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Reports`}),(0,j.jsx)(`nav`,{"aria-label":`Reports`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`execution`,`Execution reports`,l(`reports`)],[`project`,`Project report`,l(`reports`,`project`)]].map(([e,t,n])=>(0,j.jsx)(`a`,{href:n,"aria-current":B===e?`page`:void 0,className:u(`inline-flex min-h-9 items-center rounded-[7px] px-4 text-sm font-medium no-underline`,B===e?`bg-bg text-ink shadow-composer hover:text-ink`:`text-ink-2 hover:text-ink`),children:t},e))})]}),f&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:f}),!r&&!f&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&B===`project`&&(0,j.jsx)(U,{project:r.project,build:r.build,onBuilt:z}),r&&B===`execution`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every report ForgeQE generated, newest first. Open one to see it in full in a new tab.`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_240px]`,children:[(0,j.jsx)(D,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,j.jsx)(`label`,{htmlFor:`report-search`,className:`sr-only`,children:`Find a report`}),(0,j.jsx)(t,{id:`report-search`,type:`search`,value:y,onChange:e=>b(e.target.value),placeholder:`Find a report`,className:`h-9 pl-9`})]}),[[`all`,`All`,W.length],[`failed`,`Failed`,G]].map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,"aria-pressed":x===e,onClick:()=>C(e),className:u(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,x===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,j.jsx)(`span`,{className:u(`tabular-nums`,e===`failed`&&n?`text-fail`:``),children:n})]},e)),q.length>1&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`label`,{htmlFor:`report-kind`,className:`sr-only`,children:`Kind`}),(0,j.jsxs)(n,{id:`report-kind`,value:h,onChange:e=>v(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,j.jsx)(`option`,{value:``,children:`Every kind`}),q.map(e=>(0,j.jsx)(`option`,{value:e,children:M[e]},e))]})]})]}),E&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:E}),(0,j.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,j.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_110px_150px_100px_128px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,j.jsx)(`span`,{children:`Report`}),(0,j.jsx)(`span`,{children:`Kind`}),(0,j.jsx)(`span`,{children:`Result`}),(0,j.jsx)(`span`,{className:`text-right`,children:`When`}),(0,j.jsx)(`span`,{})]}),(0,j.jsxs)(`ul`,{"aria-label":`Execution reports`,className:`m-0 list-none p-1.5`,children:[K.length===0&&(0,j.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:r.rows.length?`Nothing matches.`:`No reports yet. Runs, suites and monitor rounds show here once they have run.`}),K.slice(0,w).map((e,t,n)=>{let r=O(e.startedAt),a=F(e);return(0,j.jsxs)(`li`,{className:`contents`,children:[(t===0||O(n[t-1].startedAt)!==r)&&(0,j.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,j.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 hover:bg-surface-muted @3xl:grid-cols-[auto_minmax(0,1fr)_110px_150px_100px_128px] @3xl:gap-x-4`,children:[(0,j.jsx)(L,{r:e}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,j.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.title,children:e.title}),(0,j.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[M[e.scope],e.scope===`page`||!e.counts.total?``:`${e.counts.passed}/${e.counts.total} passed`,k(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,j.jsx)(`span`,{className:`hidden truncate text-[13px] text-muted @3xl:block`,children:M[e.scope]}),(0,j.jsxs)(`span`,{className:`hidden truncate text-[13px] text-muted tabular-nums @3xl:block`,children:[(0,j.jsx)(`span`,{className:u(a.tone===`fail`&&`text-fail`),children:e.scope===`page`?`Report`:e.counts.total?`${e.counts.passed}/${e.counts.total} passed`:a.label}),P(e.ms)?` · ${P(e.ms)}`:``]}),(0,j.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,title:N(e.startedAt),children:k(e.startedAt)}),(0,j.jsx)(`span`,{className:`flex min-w-0 justify-end`,children:e.report?(0,j.jsxs)(d,{size:`sm`,"aria-label":`Open the report of ${e.title} in a new tab`,onClick:async()=>R(await c(e.report)),children:[(0,j.jsx)(i,{size:14,"aria-hidden":`true`}),(0,j.jsx)(`span`,{className:`hidden @md:inline`,children:`Open report`})]}):(0,j.jsx)(S,{path:e.folder,children:`Folder`})})]})]},e.key)})]}),(K.length>w||r.total>r.rows.length)&&(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,j.jsxs)(`span`,{children:[`Showing `,Math.min(w,K.length),` of `,K.length,r.total>r.rows.length?` (the newest ${r.rows.length} of ${r.total})`:``]}),K.length>w&&(0,j.jsxs)(d,{size:`sm`,onClick:()=>T(w+I),children:[`Show `,Math.min(I,K.length-w),` more`]})]})]})]})]})]})}export{W as Reports};