@capagents/forgeqe 2.8.1 → 2.8.3

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 (49) hide show
  1. package/dist/forgeqe.js +1533 -1532
  2. package/dist/web/assets/{Agent-C79V2lzx.js → Agent-soXhY9g_.js} +1 -1
  3. package/dist/web/assets/{ApiTests-CS4zVVYu.js → ApiTests-BcC3NDc-.js} +1 -1
  4. package/dist/web/assets/{Chat-Xj5qngpm.js → Chat-DDo__FJs.js} +1 -1
  5. package/dist/web/assets/{CommandPalette-BIQBYhRU.js → CommandPalette-BhfezPoz.js} +1 -1
  6. package/dist/web/assets/{Cost-rVA7nqHn.js → Cost-Cc_L26oj.js} +1 -1
  7. package/dist/web/assets/{Data-DEVQ3Ah7.js → Data-guLRqAf5.js} +1 -1
  8. package/dist/web/assets/{Evidence-D4dxe22a.js → Evidence-BXMNm-K9.js} +1 -1
  9. package/dist/web/assets/{Explore-CHy55eiu.js → Explore-sox3fD4D.js} +1 -1
  10. package/dist/web/assets/{Features-CDHLD4lX.js → Features-B6J6SNuK.js} +1 -1
  11. package/dist/web/assets/{Flags-ClVEB7XK.js → Flags-DEwb0FYm.js} +1 -1
  12. package/dist/web/assets/{Flaky-DH1wEWoT.js → Flaky-BgxKLCzC.js} +1 -1
  13. package/dist/web/assets/{ForceGraph-LS1p4FN7.js → ForceGraph-2aiOo87M.js} +1 -1
  14. package/dist/web/assets/{Impact-BW0Evigt.js → Impact-Bs0qSabB.js} +1 -1
  15. package/dist/web/assets/{Jobs-ChuJTxCx.js → Jobs-B6azw_sf.js} +1 -1
  16. package/dist/web/assets/{KindPage-PUuhBSTu.js → KindPage-C3dRZIbc.js} +1 -1
  17. package/dist/web/assets/{Migration-DtWKdiUG.js → Migration-Cag9T0yR.js} +1 -1
  18. package/dist/web/assets/{Product-C9n4W4L9.js → Product-WaYVsMcG.js} +1 -1
  19. package/dist/web/assets/{Production-BoeOK-VW.js → Production-C9Lx2TVR.js} +1 -1
  20. package/dist/web/assets/{Quality-DnZz9jQa.js → Quality-B98dlQzR.js} +1 -1
  21. package/dist/web/assets/{Readiness-jh_T1BAB.js → Readiness-C1N9Zp2l.js} +1 -1
  22. package/dist/web/assets/{Record-Kale1Him.js → Record-ChP3_Hcg.js} +1 -1
  23. package/dist/web/assets/{Regression-BigK1A4M.js → Regression-UxRIR6bf.js} +1 -1
  24. package/dist/web/assets/{Reports-BAPY8SbD.js → Reports-CgOedv6o.js} +1 -1
  25. package/dist/web/assets/{Response-CSf-Alvf.js → Response-DGb8gRCU.js} +1 -1
  26. package/dist/web/assets/{RunDiff-45Gqgmi_.js → RunDiff-BbBgHbMC.js} +1 -1
  27. package/dist/web/assets/{Runs-C3TBvkMF.js → Runs-ukSjEJSA.js} +1 -1
  28. package/dist/web/assets/{TestCases-F4dRMoJ4.js → TestCases-Q82IxEjr.js} +1 -1
  29. package/dist/web/assets/{TestData-B4rcRR4A.js → TestData-BHCcKNhO.js} +1 -1
  30. package/dist/web/assets/{TestDebt-CYrE481Z.js → TestDebt-DK4tT8Yz.js} +1 -1
  31. package/dist/web/assets/Tosca-BVHomdto.js +2 -0
  32. package/dist/web/assets/{WhatsNew-tvRHzxqZ.js → WhatsNew-BsvxN0Yt.js} +1 -1
  33. package/dist/web/assets/{dataParts-DmFAGLeZ.js → dataParts-ETs85ZuU.js} +1 -1
  34. package/dist/web/assets/{families-D_YnXNTR.js → families-Ch_yMomw.js} +1 -1
  35. package/dist/web/assets/frame-I2oY7L19.js +4 -0
  36. package/dist/web/assets/{index-DhR7aomZ.js → index-BOLnH0rJ.js} +4 -4
  37. package/dist/web/assets/index-D_Rdwtap.css +2 -0
  38. package/dist/web/assets/{logos-DgqBK3qe.js → logos-BfGnwAtP.js} +1 -1
  39. package/dist/web/assets/{parts-DJxun6mX.js → parts-CpuOW4Wd.js} +1 -1
  40. package/dist/web/assets/{productParts-_qbTBR4z.js → productParts-DdgyljLs.js} +1 -1
  41. package/dist/web/assets/{qualityParts-4he1MuhN.js → qualityParts-H50uxgIc.js} +1 -1
  42. package/dist/web/assets/{segmented-D009ouN6.js → segmented-DVt7_NPz.js} +1 -1
  43. package/dist/web/assets/{thread-N69k7QNW.js → thread-CvTcakQw.js} +1 -1
  44. package/dist/web/assets/{usePageChat-Df0JW9Sh.js → usePageChat-CiEt74za.js} +1 -1
  45. package/dist/web/index.html +3 -3
  46. package/package.json +1 -1
  47. package/dist/web/assets/Tosca-DVAT9uFj.js +0 -2
  48. package/dist/web/assets/frame-LE6IccxB.js +0 -4
  49. package/dist/web/assets/index-Cs7yh8J8.css +0 -2
@@ -1 +1 @@
1
- import{$a as e,$i as t,An as n,Di as r,In as i,Nt as a,Qi as o,Vr as s,Zi as c,_t as l,ct as u,en as d,ft as f,ga as p,ho as m,ma as h,nr as g,po as _,tt as v,vo as y,wn as b}from"./frame-LE6IccxB.js";import{d as x,r as S,s as C}from"./index-DhR7aomZ.js";var w=y(m(),1),T=_(),E=[`critical`,`serious`,`moderate`,`minor`],D={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},O=[{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`}],k={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},A=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),j=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),M=(e,t)=>`${e} ${t}${e===1?``:`s`}`,N=e=>e.replace(/(data:[\w/+.-]+;base64,)[A-Za-z0-9+/=]{24,}/g,`$1…`),P=e=>{try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.length>44?`${t.pathname.slice(0,20)}…${t.pathname.slice(-20)}`:t.pathname;return`${t.host}${n}${t.search?`?…`:``}`}catch{return e.length>70?`${e.slice(0,68)}…`:e}},F=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed);function I({run:e,standard:t,disclaimer:n}){let r=e.report,[i,a]=(0,w.useState)(new Set),[o,s]=(0,w.useState)(`all`),[c,u]=(0,w.useState)(!1);if(!r?.accessibility.pages)return(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let d=r.accessibility,f=r.breaches.filter(e=>e.kind===`accessibility`),m=d.failed.filter(e=>o===`all`||e.impact===o).sort((e,t)=>E.indexOf(e.impact)-E.indexOf(t.impact)||t.count-e.count),h=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),a(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,r.engine||`axe`,` on `,M(d.pages,`page`),`: `,(0,T.jsxs)(`span`,{className:`text-pass`,children:[M(d.passed.length,`rule`),` passed`]}),`, `,(0,T.jsxs)(`span`,{className:d.failed.length?`text-fail`:``,children:[d.failed.length,` failed`]}),`.`,` `,r.budgets.accessibility?f.length?`${M(f.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),f.map((e,t)=>(0,T.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,P(e.page),`: `,e.text]},t)),d.failed.length>0&&(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,T.jsx)(`div`,{role:`group`,"aria-label":`Impact`,className:`flex flex-wrap gap-1`,children:[`all`,...E].map(e=>{let t=e===`all`?d.failed.length:d.failed.filter(t=>t.impact===e).length;return e!==`all`&&!t?null:(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>s(e),className:p(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px] capitalize`,o===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[e,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:t})]},e)})})}),d.failed.length?(0,T.jsx)(v,{label:`Failed rules`,placeholder:`Find a rule, WCAG criterion, page or element`,resetKey:o,empty:`Nothing matches.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pl-3 font-medium`,children:`Impact`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Rule`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`WCAG`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Elements`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Pages`})]}),children:m.map(t=>{let n=i.has(t.rule),r=e.examples[t.rule]??[];return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>h(t.rule),"aria-expanded":n,className:p(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pl-3`,children:(0,T.jsx)(l,{tone:D[t.impact],className:`min-h-5 px-2 text-[11px] capitalize`,children:t.impact})}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(b,{size:13,"aria-hidden":`true`,className:p(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.help}),(0,T.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:t.rule})]})]})}),(0,T.jsx)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-ink-2 @2xl:table-cell`,children:t.wcag?`${t.wcag}${t.level?` · ${t.level}`:``}`:`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.count}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.pages})]}),n&&(0,T.jsxs)(`tr`,{className:`bg-surface-muted`,children:[(0,T.jsx)(`td`,{}),(0,T.jsx)(`td`,{colSpan:4,className:`pr-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-[17px]`,children:[r.length?r.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[8px] border border-line-soft bg-bg px-2.5 py-1.5`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 gap-1.5 text-[12px] text-muted`,children:[(0,T.jsx)(`span`,{className:`flex-none`,"data-tip":e.page,children:P(e.page)}),e.target&&(0,T.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[11.5px]`,"data-tip":e.target,children:[`· `,e.target]})]}),e.html&&(0,T.jsx)(`code`,{className:`line-clamp-3 font-mono text-[12px] break-all text-ink-2`,children:N(e.html)})]},t)):(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No elements were kept for this rule.`}),t.helpUrl&&x(t.helpUrl)===`web`&&(0,T.jsxs)(`a`,{href:t.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[12.5px]`,children:[`How to fix it `,(0,T.jsx)(g,{size:12,"aria-hidden":`true`})]})]})})]})]},t.rule)})}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:`No rule failed on the pages this run visited.`}),d.passed.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`button`,{type:`button`,"aria-expanded":c,onClick:()=>u(!c),className:`flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-ink`,children:[(0,T.jsx)(b,{size:13,"aria-hidden":`true`,className:p(`text-muted transition-transform`,!c&&`-rotate-90`)}),`Rules that passed `,(0,T.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:d.passed.length})]}),c&&(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:d.passed.map(e=>(0,T.jsx)(`li`,{className:`rounded-[6px] bg-pass-soft px-2 py-0.5 font-mono text-[11.5px] text-pass`,children:e},e))})]}),(0,T.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n})]})}function L({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,T.jsx)(`p`,{className:`m-0 text-[13px] 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`},i=t.breaches.filter(e=>e.kind===`performance`);return(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals of each page, from one visit in the browser the agent drove, against Google's thresholds: `,(0,T.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,T.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,T.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,t.budgets.performance?`Pages over quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings.`]}),i.map((e,t)=>(0,T.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,P(e.page),`: `,e.text]},t)),(0,T.jsx)(v,{label:`Timings`,minWidth:720,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),O.map(e=>(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,"data-tip":e.label,children:e.label},e.key)),(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,children:`Requests`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-2 text-right font-medium`,children:`Size`})]}),children:t.performance.pages.map((e,t)=>(0,T.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,T.jsxs)(`td`,{className:`py-1.5 pr-3 pl-3`,children:[(0,T.jsx)(`span`,{className:`block max-w-[340px] truncate font-mono text-[12px]`,"data-tip":e.url,children:P(e.url)}),e.over.length>0&&(0,T.jsxs)(`span`,{className:`text-[11.5px] text-fail`,children:[`over: `,e.over.join(`, `)]})]}),O.map(t=>{let i=e[t.key];return(0,T.jsxs)(`td`,{className:p(`px-2 py-1.5 text-right whitespace-nowrap 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`?j(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,T.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,T.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap text-muted tabular-nums`,children:e.requests??`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 pl-2 text-right whitespace-nowrap text-muted tabular-nums`,children:e.kb===void 0?`–`:`${e.kb} KB`})]},t))}),(0,T.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[O.filter(e=>e.good!==1/0).map(e=>`${e.label}: good up to ${j(e.good,e.unit)}, poor over ${j(e.poor,e.unit)}`).join(` · `),`. Lab values from one visit, not data from real users.`]})]})}function R({run:t,index:n,which:r,label:i}){let[a,o]=(0,w.useState)(``),[c,l]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{let i=!1;return o(``),l(!1),e.image(t,n,r).then(e=>!i&&o(e),()=>!i&&l(!0)),()=>{i=!0}},[t,n,r]),(0,T.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,T.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:i}),a?(0,T.jsx)(`img`,{src:a,alt:`${i} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,T.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:c?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(d,{icon:s,size:14}),` Not available`]}):`Loading…`})]})}function z({run:t,budget:i,onChange:a}){let[o,s]=(0,w.useState)(null),[c,u]=(0,w.useState)(``),[d,m]=(0,w.useState)(!1),[g,_]=(0,w.useState)(``),[y,x]=(0,w.useState)(new Set),[S,C]=(0,w.useState)(`all`),E=t.visual?.pages??[],D=E.find(e=>e.status===`changed`)?.index;(0,w.useEffect)(()=>x(D===void 0?new Set:new Set([D])),[t.id,D]);let O=async e=>{m(!0),_(``);try{a(await e()),s(null),u(``)}catch(e){_(e.message)}finally{m(!1)}};if(!t.visual)return t.captured?(0,T.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`This run captured `,M(t.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,T.jsxs)(h,{size:`sm`,variant:`primary`,disabled:d,onClick:()=>O(()=>e.compare(t.id)),children:[(0,T.jsx)(r,{"aria-hidden":`true`}),`Compare with the baselines`]}),g&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:g})]}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let A=E.filter(e=>e.status===`changed`),j=(S===`changed`?A:E).slice().sort((e,t)=>Number(t.status===`changed`)-Number(e.status===`changed`)||(t.diffPercent??0)-(e.diffPercent??0)),N=e=>{let t=new Set(y);t.has(e)?t.delete(e):t.add(e),x(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,i?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run.`]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex gap-1`,children:[[`all`,`All pages`,E.length],[`changed`,`Changed`,A.length]].map(([e,t,n])=>(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,onClick:()=>C(e),className:p(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px]`,S===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[t,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:n})]},e))}),(0,T.jsx)(`span`,{className:`flex-1`}),A.length>1&&(0,T.jsxs)(h,{size:`sm`,disabled:d,onClick:()=>s(A.map(e=>e.url)),children:[`Approve all `,A.length,` changes`]})]}),o&&(0,T.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,T.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,o.length===1?P(o[0]):M(o.length,`page`),`?`]}),(0,T.jsx)(`span`,{className:`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,T.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[`Why it changed (kept with the baseline)`,(0,T.jsx)(f,{size:`sm`,value:c,maxLength:300,placeholder:`New checkout banner`,onChange:e=>u(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsxs)(h,{size:`sm`,variant:`primary`,disabled:d,onClick:()=>O(()=>e.approve(t.id,o,c.trim()||void 0)),children:[(0,T.jsx)(n,{"aria-hidden":`true`}),`Approve`]}),(0,T.jsx)(h,{size:`sm`,onClick:()=>s(null),children:`Cancel`})]})]}),g&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:g}),(0,T.jsx)(v,{label:`Pages against their baselines`,fixed:!0,resetKey:S,empty:`No page changed.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),(0,T.jsx)(`th`,{className:`hidden w-[110px] py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Size`}),(0,T.jsx)(`th`,{className:`w-[90px] py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`w-[120px] py-1.5 pr-3 font-medium`,children:`Result`}),(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pr-3`,children:(0,T.jsx)(`span`,{className:`sr-only`,children:`Approve`})})]}),children:j.map(e=>{let n=y.has(e.index);return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>N(e.index),"aria-expanded":n,className:p(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(b,{size:13,"aria-hidden":`true`,className:p(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`truncate`,"data-tip":e.title||e.url,children:e.title||P(e.url)}),(0,T.jsx)(`span`,{className:`truncate font-mono text-[11.5px] text-muted`,"data-tip":e.url,children:P(e.url)})]})]})}),(0,T.jsxs)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-muted @2xl:table-cell`,children:[e.size||`–`,e.resized?` · resized ${e.resized}`:``]}),(0,T.jsx)(`td`,{className:p(`py-1.5 pr-3 text-right whitespace-nowrap tabular-nums`,e.over?`text-fail`:e.status===`changed`?`text-warn`:`text-muted`),children:e.status===`changed`?`${e.diffPercent}%${e.limit===void 0?``:` / ${e.limit}%`}`:`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsx)(l,{tone:e.over?`fail`:k[e.status].tone,className:`min-h-5 px-2 text-[11px]`,children:e.over?`Over budget`:k[e.status].label})}),(0,T.jsx)(`td`,{className:`py-1 pr-3 text-right`,onClick:e=>e.stopPropagation(),children:e.status===`changed`&&(0,T.jsx)(h,{size:`sm`,variant:`ghost`,disabled:d,onClick:()=>s([e.url]),className:`min-h-7`,children:`Approve`})})]}),n&&(0,T.jsx)(`tr`,{className:`bg-surface-muted`,children:(0,T.jsx)(`td`,{colSpan:5,className:`px-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3`,children:[e.images.baseline&&(0,T.jsx)(R,{run:t.id,index:e.index,which:`baseline`,label:`Baseline`}),e.images.current&&(0,T.jsx)(R,{run:t.id,index:e.index,which:`current`,label:`This run`}),e.images.diff&&(0,T.jsx)(R,{run:t.id,index:e.index,which:`diff`,label:`Difference (in red)`})]})})})]},e.index)})})]})}function B({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,T.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,T.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function V({icon:e,className:t,lines:n}){return n.length?(0,T.jsxs)(`span`,{className:p(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,T.jsx)(d,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function H({trends:e}){return e.length?(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?E.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,T.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] truncate font-mono text-[13px]`,"data-tip":e.page,children:/^https?:/.test(e.page)?P(e.page):e.page}),(0,T.jsx)(B,{values:e.a11y.trail}),(0,T.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[M(e.runs,`run`),t===void 0?``:` · ${M(t,`violation`)} now`]})]}),(0,T.jsx)(V,{icon:o,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,T.jsx)(V,{icon:c,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,T.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.`})}var U={accessibility:e=>!!e.a11y?.pages,performance:e=>e.perf.pages>0,visual:e=>!!e.visual||e.captured>0},W={accessibility:e=>!!e.a11y?.failed,performance:e=>e.perf.over>0,visual:e=>!!(e.visual?.changed||e.visual?.over)},G=(e,t)=>t.filter(U[e]);function K({kind:e,runs:r}){let[o,s]=(0,w.useState)(`all`),c=G(e,r),l=o===`attention`?c.filter(W[e]):c,d=t=>location.hash=a(e,encodeURIComponent(t)),f=`py-2 pr-3 text-right tabular-nums`;return(0,T.jsx)(v,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:o,empty:`Nothing matches.`,tools:(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,T.jsx)(u,{items:[{id:`all`,label:`All`,n:c.length},{id:`attention`,label:`Needs a look`,n:c.filter(W[e]).length,alert:!0}],value:o,onChange:s})}),head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),e===`accessibility`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Moderate · minor`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages`})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Over budget`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages timed`})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`New`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Same`})]}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:l.map(r=>{let o=W[e](r),s=(r.over?.[e]??0)>0;return(0,T.jsxs)(`tr`,{onClick:()=>d(r.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,T.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(s?i:o?t:n,{size:15,"aria-label":s?`Over a budget`:o?`Needs a look`:`Within budgets`,className:p(`flex-none`,s?`text-fail`:o?`text-warn`:`text-pass`)}),(0,T.jsx)(`a`,{href:a(e,encodeURIComponent(r.id)),onClick:e=>e.stopPropagation(),"data-tip":r.goal,className:`truncate text-ink no-underline hover:underline`,children:r.goal})]})}),e===`accessibility`&&r.a11y&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:p(f,r.a11y.failed?`text-fail`:`text-muted`),children:r.a11y.failed}),(0,T.jsx)(`td`,{className:p(f,`hidden @2xl:table-cell`,r.a11y.critical+r.a11y.serious?`text-fail`:`text-muted`),children:`${r.a11y.critical} · ${r.a11y.serious}`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @3xl:table-cell`),children:`${r.a11y.moderate} · ${r.a11y.minor}`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @xl:table-cell`),children:r.a11y.pages})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:p(f,r.perf.over?`text-fail`:`text-muted`),children:r.perf.over}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @xl:table-cell`),children:r.perf.pages})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:p(f,r.visual?.changed?`text-warn`:`text-muted`),children:r.visual?r.visual.changed:`not compared`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @2xl:table-cell`),children:r.visual?r.visual.new+r.visual.no_baseline:`–`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @xl:table-cell`),children:r.visual?r.visual.same:`–`})]}),(0,T.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":A(r.at),children:S(r.at)})]},r.id)})})}function q({kind:t,id:n,view:r,onChanged:i}){let[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(``);(0,w.useEffect)(()=>{let t=!1;return s(null),e.run(n).then(e=>{t||(s(e),l(``))},e=>!t&&l(e.message)),()=>{t=!0}},[n]);let u=(0,T.jsxs)(`a`,{href:a(t),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,T.jsx)(b,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});return c||!o?(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,c?(0,T.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:c}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]}):(0,T.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[u,(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,T.jsx)(`h2`,{id:`run-h`,"data-tip":o.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:o.goal}),(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[A(o.at),` · `,(0,T.jsx)(C,{path:o.dir}),` · `,(0,T.jsx)(`a`,{href:a(`quality`,encodeURIComponent(o.id)),children:`Everything it measured`})]})]}),t===`accessibility`&&(0,T.jsx)(I,{run:o,standard:r.standard,disclaimer:r.disclaimer}),t===`performance`&&(0,T.jsx)(L,{run:o}),t===`visual`&&(0,T.jsx)(z,{run:o,budget:r.budgets.visual,onChange:e=>{s(e),i()}})]})}function J({r:e,to:t,line:n}){return(0,T.jsxs)(`div`,{className:`ml-12 flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[14px] card border px-4 py-3`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,T.jsx)(`span`,{className:`text-[14.5px] font-medium [overflow-wrap:anywhere]`,children:e.goal}),(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:n})]}),(0,T.jsx)(h,{size:`sm`,variant:`primary`,onClick:()=>location.hash=t,children:`Open the run`})]})}function Y({label:e,value:t,sub:n,tone:r}){return(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`text-[11.5px] text-muted`,children:e}),(0,T.jsx)(`span`,{className:p(`text-[16px] leading-tight font-semibold tabular-nums`,r),children:t}),n&&(0,T.jsx)(`span`,{className:`truncate text-[11.5px] text-muted`,children:n})]})}export{A as _,K as a,J as c,z as d,j as f,P as g,G as h,q as i,H as l,M as m,E as n,Y as o,F as p,D as r,L as s,I as t,O as u};
1
+ import{$a as e,$i as t,An as n,Di as r,In as i,Nt as a,Qi as o,Vr as s,Zi as c,_t as l,ct as u,en as d,ft as f,ga as p,ho as m,ma as h,nr as g,po as _,tt as v,vo as y,wn as b}from"./frame-I2oY7L19.js";import{d as x,r as S,s as C}from"./index-BOLnH0rJ.js";var w=y(m(),1),T=_(),E=[`critical`,`serious`,`moderate`,`minor`],D={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},O=[{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`}],k={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},A=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),j=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),M=(e,t)=>`${e} ${t}${e===1?``:`s`}`,N=e=>e.replace(/(data:[\w/+.-]+;base64,)[A-Za-z0-9+/=]{24,}/g,`$1…`),P=e=>{try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.length>44?`${t.pathname.slice(0,20)}…${t.pathname.slice(-20)}`:t.pathname;return`${t.host}${n}${t.search?`?…`:``}`}catch{return e.length>70?`${e.slice(0,68)}…`:e}},F=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed);function I({run:e,standard:t,disclaimer:n}){let r=e.report,[i,a]=(0,w.useState)(new Set),[o,s]=(0,w.useState)(`all`),[c,u]=(0,w.useState)(!1);if(!r?.accessibility.pages)return(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let d=r.accessibility,f=r.breaches.filter(e=>e.kind===`accessibility`),m=d.failed.filter(e=>o===`all`||e.impact===o).sort((e,t)=>E.indexOf(e.impact)-E.indexOf(t.impact)||t.count-e.count),h=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),a(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,r.engine||`axe`,` on `,M(d.pages,`page`),`: `,(0,T.jsxs)(`span`,{className:`text-pass`,children:[M(d.passed.length,`rule`),` passed`]}),`, `,(0,T.jsxs)(`span`,{className:d.failed.length?`text-fail`:``,children:[d.failed.length,` failed`]}),`.`,` `,r.budgets.accessibility?f.length?`${M(f.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),f.map((e,t)=>(0,T.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,P(e.page),`: `,e.text]},t)),d.failed.length>0&&(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,T.jsx)(`div`,{role:`group`,"aria-label":`Impact`,className:`flex flex-wrap gap-1`,children:[`all`,...E].map(e=>{let t=e===`all`?d.failed.length:d.failed.filter(t=>t.impact===e).length;return e!==`all`&&!t?null:(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>s(e),className:p(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px] capitalize`,o===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[e,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:t})]},e)})})}),d.failed.length?(0,T.jsx)(v,{label:`Failed rules`,placeholder:`Find a rule, WCAG criterion, page or element`,resetKey:o,empty:`Nothing matches.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pl-3 font-medium`,children:`Impact`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Rule`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`WCAG`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Elements`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Pages`})]}),children:m.map(t=>{let n=i.has(t.rule),r=e.examples[t.rule]??[];return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>h(t.rule),"aria-expanded":n,className:p(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pl-3`,children:(0,T.jsx)(l,{tone:D[t.impact],className:`min-h-5 px-2 text-[11px] capitalize`,children:t.impact})}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(b,{size:13,"aria-hidden":`true`,className:p(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.help}),(0,T.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:t.rule})]})]})}),(0,T.jsx)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-ink-2 @2xl:table-cell`,children:t.wcag?`${t.wcag}${t.level?` · ${t.level}`:``}`:`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.count}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.pages})]}),n&&(0,T.jsxs)(`tr`,{className:`bg-surface-muted`,children:[(0,T.jsx)(`td`,{}),(0,T.jsx)(`td`,{colSpan:4,className:`pr-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-[17px]`,children:[r.length?r.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[8px] border border-line-soft bg-bg px-2.5 py-1.5`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 gap-1.5 text-[12px] text-muted`,children:[(0,T.jsx)(`span`,{className:`flex-none`,"data-tip":e.page,children:P(e.page)}),e.target&&(0,T.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[11.5px]`,"data-tip":e.target,children:[`· `,e.target]})]}),e.html&&(0,T.jsx)(`code`,{className:`line-clamp-3 font-mono text-[12px] break-all text-ink-2`,children:N(e.html)})]},t)):(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No elements were kept for this rule.`}),t.helpUrl&&x(t.helpUrl)===`web`&&(0,T.jsxs)(`a`,{href:t.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[12.5px]`,children:[`How to fix it `,(0,T.jsx)(g,{size:12,"aria-hidden":`true`})]})]})})]})]},t.rule)})}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:`No rule failed on the pages this run visited.`}),d.passed.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`button`,{type:`button`,"aria-expanded":c,onClick:()=>u(!c),className:`flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-ink`,children:[(0,T.jsx)(b,{size:13,"aria-hidden":`true`,className:p(`text-muted transition-transform`,!c&&`-rotate-90`)}),`Rules that passed `,(0,T.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:d.passed.length})]}),c&&(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:d.passed.map(e=>(0,T.jsx)(`li`,{className:`rounded-[6px] bg-pass-soft px-2 py-0.5 font-mono text-[11.5px] text-pass`,children:e},e))})]}),(0,T.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n})]})}function L({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,T.jsx)(`p`,{className:`m-0 text-[13px] 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`},i=t.breaches.filter(e=>e.kind===`performance`);return(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals of each page, from one visit in the browser the agent drove, against Google's thresholds: `,(0,T.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,T.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,T.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,t.budgets.performance?`Pages over quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings.`]}),i.map((e,t)=>(0,T.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,P(e.page),`: `,e.text]},t)),(0,T.jsx)(v,{label:`Timings`,minWidth:720,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),O.map(e=>(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,"data-tip":e.label,children:e.label},e.key)),(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,children:`Requests`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-2 text-right font-medium`,children:`Size`})]}),children:t.performance.pages.map((e,t)=>(0,T.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,T.jsxs)(`td`,{className:`py-1.5 pr-3 pl-3`,children:[(0,T.jsx)(`span`,{className:`block max-w-[340px] truncate font-mono text-[12px]`,"data-tip":e.url,children:P(e.url)}),e.over.length>0&&(0,T.jsxs)(`span`,{className:`text-[11.5px] text-fail`,children:[`over: `,e.over.join(`, `)]})]}),O.map(t=>{let i=e[t.key];return(0,T.jsxs)(`td`,{className:p(`px-2 py-1.5 text-right whitespace-nowrap 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`?j(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,T.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,T.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap text-muted tabular-nums`,children:e.requests??`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 pl-2 text-right whitespace-nowrap text-muted tabular-nums`,children:e.kb===void 0?`–`:`${e.kb} KB`})]},t))}),(0,T.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[O.filter(e=>e.good!==1/0).map(e=>`${e.label}: good up to ${j(e.good,e.unit)}, poor over ${j(e.poor,e.unit)}`).join(` · `),`. Lab values from one visit, not data from real users.`]})]})}function R({run:t,index:n,which:r,label:i}){let[a,o]=(0,w.useState)(``),[c,l]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{let i=!1;return o(``),l(!1),e.image(t,n,r).then(e=>!i&&o(e),()=>!i&&l(!0)),()=>{i=!0}},[t,n,r]),(0,T.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,T.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:i}),a?(0,T.jsx)(`img`,{src:a,alt:`${i} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,T.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:c?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(d,{icon:s,size:14}),` Not available`]}):`Loading…`})]})}function z({run:t,budget:i,onChange:a}){let[o,s]=(0,w.useState)(null),[c,u]=(0,w.useState)(``),[d,m]=(0,w.useState)(!1),[g,_]=(0,w.useState)(``),[y,x]=(0,w.useState)(new Set),[S,C]=(0,w.useState)(`all`),E=t.visual?.pages??[],D=E.find(e=>e.status===`changed`)?.index;(0,w.useEffect)(()=>x(D===void 0?new Set:new Set([D])),[t.id,D]);let O=async e=>{m(!0),_(``);try{a(await e()),s(null),u(``)}catch(e){_(e.message)}finally{m(!1)}};if(!t.visual)return t.captured?(0,T.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`This run captured `,M(t.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,T.jsxs)(h,{size:`sm`,variant:`primary`,disabled:d,onClick:()=>O(()=>e.compare(t.id)),children:[(0,T.jsx)(r,{"aria-hidden":`true`}),`Compare with the baselines`]}),g&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:g})]}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let A=E.filter(e=>e.status===`changed`),j=(S===`changed`?A:E).slice().sort((e,t)=>Number(t.status===`changed`)-Number(e.status===`changed`)||(t.diffPercent??0)-(e.diffPercent??0)),N=e=>{let t=new Set(y);t.has(e)?t.delete(e):t.add(e),x(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,i?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run.`]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex gap-1`,children:[[`all`,`All pages`,E.length],[`changed`,`Changed`,A.length]].map(([e,t,n])=>(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,onClick:()=>C(e),className:p(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px]`,S===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[t,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:n})]},e))}),(0,T.jsx)(`span`,{className:`flex-1`}),A.length>1&&(0,T.jsxs)(h,{size:`sm`,disabled:d,onClick:()=>s(A.map(e=>e.url)),children:[`Approve all `,A.length,` changes`]})]}),o&&(0,T.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,T.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,o.length===1?P(o[0]):M(o.length,`page`),`?`]}),(0,T.jsx)(`span`,{className:`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,T.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[`Why it changed (kept with the baseline)`,(0,T.jsx)(f,{size:`sm`,value:c,maxLength:300,placeholder:`New checkout banner`,onChange:e=>u(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsxs)(h,{size:`sm`,variant:`primary`,disabled:d,onClick:()=>O(()=>e.approve(t.id,o,c.trim()||void 0)),children:[(0,T.jsx)(n,{"aria-hidden":`true`}),`Approve`]}),(0,T.jsx)(h,{size:`sm`,onClick:()=>s(null),children:`Cancel`})]})]}),g&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:g}),(0,T.jsx)(v,{label:`Pages against their baselines`,fixed:!0,resetKey:S,empty:`No page changed.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),(0,T.jsx)(`th`,{className:`hidden w-[110px] py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Size`}),(0,T.jsx)(`th`,{className:`w-[90px] py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`w-[120px] py-1.5 pr-3 font-medium`,children:`Result`}),(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pr-3`,children:(0,T.jsx)(`span`,{className:`sr-only`,children:`Approve`})})]}),children:j.map(e=>{let n=y.has(e.index);return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>N(e.index),"aria-expanded":n,className:p(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(b,{size:13,"aria-hidden":`true`,className:p(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`truncate`,"data-tip":e.title||e.url,children:e.title||P(e.url)}),(0,T.jsx)(`span`,{className:`truncate font-mono text-[11.5px] text-muted`,"data-tip":e.url,children:P(e.url)})]})]})}),(0,T.jsxs)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-muted @2xl:table-cell`,children:[e.size||`–`,e.resized?` · resized ${e.resized}`:``]}),(0,T.jsx)(`td`,{className:p(`py-1.5 pr-3 text-right whitespace-nowrap tabular-nums`,e.over?`text-fail`:e.status===`changed`?`text-warn`:`text-muted`),children:e.status===`changed`?`${e.diffPercent}%${e.limit===void 0?``:` / ${e.limit}%`}`:`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsx)(l,{tone:e.over?`fail`:k[e.status].tone,className:`min-h-5 px-2 text-[11px]`,children:e.over?`Over budget`:k[e.status].label})}),(0,T.jsx)(`td`,{className:`py-1 pr-3 text-right`,onClick:e=>e.stopPropagation(),children:e.status===`changed`&&(0,T.jsx)(h,{size:`sm`,variant:`ghost`,disabled:d,onClick:()=>s([e.url]),className:`min-h-7`,children:`Approve`})})]}),n&&(0,T.jsx)(`tr`,{className:`bg-surface-muted`,children:(0,T.jsx)(`td`,{colSpan:5,className:`px-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3`,children:[e.images.baseline&&(0,T.jsx)(R,{run:t.id,index:e.index,which:`baseline`,label:`Baseline`}),e.images.current&&(0,T.jsx)(R,{run:t.id,index:e.index,which:`current`,label:`This run`}),e.images.diff&&(0,T.jsx)(R,{run:t.id,index:e.index,which:`diff`,label:`Difference (in red)`})]})})})]},e.index)})})]})}function B({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,T.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,T.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function V({icon:e,className:t,lines:n}){return n.length?(0,T.jsxs)(`span`,{className:p(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,T.jsx)(d,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function H({trends:e}){return e.length?(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?E.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,T.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] truncate font-mono text-[13px]`,"data-tip":e.page,children:/^https?:/.test(e.page)?P(e.page):e.page}),(0,T.jsx)(B,{values:e.a11y.trail}),(0,T.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[M(e.runs,`run`),t===void 0?``:` · ${M(t,`violation`)} now`]})]}),(0,T.jsx)(V,{icon:o,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,T.jsx)(V,{icon:c,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,T.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.`})}var U={accessibility:e=>!!e.a11y?.pages,performance:e=>e.perf.pages>0,visual:e=>!!e.visual||e.captured>0},W={accessibility:e=>!!e.a11y?.failed,performance:e=>e.perf.over>0,visual:e=>!!(e.visual?.changed||e.visual?.over)},G=(e,t)=>t.filter(U[e]);function K({kind:e,runs:r}){let[o,s]=(0,w.useState)(`all`),c=G(e,r),l=o===`attention`?c.filter(W[e]):c,d=t=>location.hash=a(e,encodeURIComponent(t)),f=`py-2 pr-3 text-right tabular-nums`;return(0,T.jsx)(v,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:o,empty:`Nothing matches.`,tools:(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,T.jsx)(u,{items:[{id:`all`,label:`All`,n:c.length},{id:`attention`,label:`Needs a look`,n:c.filter(W[e]).length,alert:!0}],value:o,onChange:s})}),head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),e===`accessibility`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Moderate · minor`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages`})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Over budget`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages timed`})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`New`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Same`})]}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:l.map(r=>{let o=W[e](r),s=(r.over?.[e]??0)>0;return(0,T.jsxs)(`tr`,{onClick:()=>d(r.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,T.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(s?i:o?t:n,{size:15,"aria-label":s?`Over a budget`:o?`Needs a look`:`Within budgets`,className:p(`flex-none`,s?`text-fail`:o?`text-warn`:`text-pass`)}),(0,T.jsx)(`a`,{href:a(e,encodeURIComponent(r.id)),onClick:e=>e.stopPropagation(),"data-tip":r.goal,className:`truncate text-ink no-underline hover:underline`,children:r.goal})]})}),e===`accessibility`&&r.a11y&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:p(f,r.a11y.failed?`text-fail`:`text-muted`),children:r.a11y.failed}),(0,T.jsx)(`td`,{className:p(f,`hidden @2xl:table-cell`,r.a11y.critical+r.a11y.serious?`text-fail`:`text-muted`),children:`${r.a11y.critical} · ${r.a11y.serious}`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @3xl:table-cell`),children:`${r.a11y.moderate} · ${r.a11y.minor}`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @xl:table-cell`),children:r.a11y.pages})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:p(f,r.perf.over?`text-fail`:`text-muted`),children:r.perf.over}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @xl:table-cell`),children:r.perf.pages})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:p(f,r.visual?.changed?`text-warn`:`text-muted`),children:r.visual?r.visual.changed:`not compared`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @2xl:table-cell`),children:r.visual?r.visual.new+r.visual.no_baseline:`–`}),(0,T.jsx)(`td`,{className:p(f,`hidden text-muted @xl:table-cell`),children:r.visual?r.visual.same:`–`})]}),(0,T.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":A(r.at),children:S(r.at)})]},r.id)})})}function q({kind:t,id:n,view:r,onChanged:i}){let[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(``);(0,w.useEffect)(()=>{let t=!1;return s(null),e.run(n).then(e=>{t||(s(e),l(``))},e=>!t&&l(e.message)),()=>{t=!0}},[n]);let u=(0,T.jsxs)(`a`,{href:a(t),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,T.jsx)(b,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});return c||!o?(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,c?(0,T.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:c}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]}):(0,T.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[u,(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,T.jsx)(`h2`,{id:`run-h`,"data-tip":o.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:o.goal}),(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[A(o.at),` · `,(0,T.jsx)(C,{path:o.dir}),` · `,(0,T.jsx)(`a`,{href:a(`quality`,encodeURIComponent(o.id)),children:`Everything it measured`})]})]}),t===`accessibility`&&(0,T.jsx)(I,{run:o,standard:r.standard,disclaimer:r.disclaimer}),t===`performance`&&(0,T.jsx)(L,{run:o}),t===`visual`&&(0,T.jsx)(z,{run:o,budget:r.budgets.visual,onChange:e=>{s(e),i()}})]})}function J({r:e,to:t,line:n}){return(0,T.jsxs)(`div`,{className:`ml-12 flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[14px] card border px-4 py-3`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,T.jsx)(`span`,{className:`text-[14.5px] font-medium [overflow-wrap:anywhere]`,children:e.goal}),(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:n})]}),(0,T.jsx)(h,{size:`sm`,variant:`primary`,onClick:()=>location.hash=t,children:`Open the run`})]})}function Y({label:e,value:t,sub:n,tone:r}){return(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`text-[11.5px] text-muted`,children:e}),(0,T.jsx)(`span`,{className:p(`text-[16px] leading-tight font-semibold tabular-nums`,r),children:t}),n&&(0,T.jsx)(`span`,{className:`truncate text-[11.5px] text-muted`,children:n})]})}export{A as _,K as a,J as c,z as d,j as f,P as g,G as h,q as i,H as l,M as m,E as n,Y as o,F as p,D as r,L as s,I as t,O as u};
@@ -1 +1 @@
1
- import{ga as e,po as t}from"./frame-LE6IccxB.js";var n=t(),r=`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,i=t=>e(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium whitespace-nowrap`,t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`);function a({tabs:t,current:a,onPick:o,label:s,className:c}){return(0,n.jsx)(`div`,{role:`tablist`,"aria-label":s,className:e(`mb-5`,r,c),children:t.map((e,r)=>(0,n.jsxs)(`button`,{id:`tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":a===e.id,"aria-controls":`panel-${e.id}`,tabIndex:a===e.id?0:-1,onClick:()=>o(e.id),onKeyDown:e=>{let n=e.key===`ArrowRight`?t[(r+1)%t.length]:e.key===`ArrowLeft`?t[(r-1+t.length)%t.length]:void 0;n&&(o(n.id),document.getElementById(`tab-${n.id}`)?.focus())},className:i(a===e.id),children:[e.label,e.n!==void 0&&(0,n.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))})}function o({links:t,current:a,label:o,className:s}){return(0,n.jsx)(`nav`,{"aria-label":o,className:e(r,s),children:t.map(t=>(0,n.jsx)(`a`,{href:t.href,"aria-current":a===t.id?`page`:void 0,className:e(i(a===t.id),`no-underline hover:no-underline`,a===t.id&&`hover:text-ink`),children:t.label},t.id))})}export{i,a as n,r,o as t};
1
+ import{ga as e,po as t}from"./frame-I2oY7L19.js";var n=t(),r=`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,i=t=>e(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium whitespace-nowrap`,t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`);function a({tabs:t,current:a,onPick:o,label:s,className:c}){return(0,n.jsx)(`div`,{role:`tablist`,"aria-label":s,className:e(`mb-5`,r,c),children:t.map((e,r)=>(0,n.jsxs)(`button`,{id:`tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":a===e.id,"aria-controls":`panel-${e.id}`,tabIndex:a===e.id?0:-1,onClick:()=>o(e.id),onKeyDown:e=>{let n=e.key===`ArrowRight`?t[(r+1)%t.length]:e.key===`ArrowLeft`?t[(r-1+t.length)%t.length]:void 0;n&&(o(n.id),document.getElementById(`tab-${n.id}`)?.focus())},className:i(a===e.id),children:[e.label,e.n!==void 0&&(0,n.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))})}function o({links:t,current:a,label:o,className:s}){return(0,n.jsx)(`nav`,{"aria-label":o,className:e(r,s),children:t.map(t=>(0,n.jsx)(`a`,{href:t.href,"aria-current":a===t.id?`page`:void 0,className:e(i(a===t.id),`no-underline hover:no-underline`,a===t.id&&`hover:text-ink`),children:t.label},t.id))})}export{i,a as n,r,o as t};
@@ -1,4 +1,4 @@
1
- import{Gt as e,Xt as t}from"./frame-LE6IccxB.js";var n=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},r=e=>typeof e==`string`?e:e==null?``:String(e),i=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,a=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function o(e,t=400){return i(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function s(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function c(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${o(e||t,120)}](${t})`:o(e)}var l=e=>[s(r(n(e).id)),o(r(n(e).title),200)].filter(Boolean).join(` `);function u(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function d(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var f=(e,t)=>({tone:e,kind:`item`,md:t}),p=(e,t)=>({tone:e,kind:`sub`,md:t});function m(e,t=``){let i=t||(e.agent&&e.agent!==`forgeqe`?`**${o(r(e.agent))}:** `:``);switch(e.kind){case`info`:return f(`info`,`${i}${o(r(e.text))}`);case`start`:return f(`dim`,`${i}→ ${s(r(e.tool))}${e.text&&e.text!==e.tool?` ${o(r(e.text),200)}`:``}`);case`tool`:{let t=n(e.file);return f(e.ok===!1?`warn`:`dim`,`${i}${e.ok===!1?`⚠`:`✓`} ${o(r(e.text)||r(e.tool),240)}${t.path?` (${o(r(t.action))} ${s(r(t.path))})`:``}`)}case`say`:{let t=u(r(e.text));return t?f(`say`,`${i}*${o(t)}*`):null}case`test`:return Number(e.attempt)>0?f(e.ok?`ok`:`fail`,`${i}${e.ok?`✓`:`✗`} **Test, attempt ${o(r(e.attempt))}:** ${o(r(e.text),240)}`):f(e.ok?`ok`:`fail`,`${i}${e.ok?`✓`:`✗`} ${o(r(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(n):[],a=t.find(e=>e.status===`in_progress`);return f(`info`,`${i}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${a?`; now: ${o(r(a.text))}`:``}`)}case`review`:return f(e.approved?`ok`:`warn`,`${i}**Review, attempt ${o(r(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${o(r(e.summary),240)}`);case`attempt`:return f(`warn`,`${i}**Attempt ${o(r(e.attempt))} of ${o(r(e.max))}:** ${o(r(e.why),240)}`);case`answer`:return f(`dim`,`${i}Attempt ${o(r(e.attempt))}: ${o(r(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(r).join(`, `)}`,240)}`);case`context`:return e.compacted?f(`info`,`${i}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function h(e,t=``){switch(e.type){case`log`:return f(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${o(r(e.text))}`);case`step`:return f(`dim`,`${t}**Step ${o(r(e.step))}** · ${e.source===`memory`?`from memory`:o(r(e.category))} · ${c(r(e.title)||`untitled`,r(e.url))}`);case`memory`:return f(`info`,`${t}↻ ${o(r(e.text))}`);case`thought`:return p(`think`,`*${o(r(e.text))}*`);case`outcome`:return p(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${o(r(e.text),300)}`);case`done`:{let i=n(e.result);return f(i.status===`complete`?`ok`:`fail`,`${t}**${o(r(i.status))}:** ${o(r(i.summary))}`)}case`code`:return m(e,t);default:return null}}function g(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${o(r(e.goal),200)}${e.url?` · ${c(r(e.url).replace(/^https?:\/\//,``),r(e.url))}`:``}`};case`run-event`:return h(n(e.event));case`run-done`:{let t=n(e.result),i=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return f(i?`ok`:`fail`,`${i?`✓`:`✗`} **Run ${i?`passed`:`failed`}**${a(e.ms)}: ${o(r(e.error)||r(t.summary))}${e.runDir?` · ${s(r(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${o(r(e.parallel))} at once`};case`suite-event`:{let t=n(e.event);if(t.type===`case-start`)return f(`info`,`**Case ${Number(t.index)+1} of ${o(r(t.total))}:** ${l(t.case)}`);if(t.type===`case-event`)return h(n(t.event),`${s(r(n(t.case).id))} `);if(t.type===`case-done`){let e=n(t.result);return f(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${l(e.case)}: **${o(r(e.status))}**${a(e.ms)}${e.summary?`. ${o(r(e.summary),240)}`:``}`)}return t.type===`code-start`?f(`info`,`${s(r(n(t.case).id))} writing its test`):t.type===`writeback`?f(`dim`,`Posted the result back: ${o(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(n(e.suite).results)?n(e.suite).results:[]).map(n),r=t.filter(e=>e.status===`passed`).length;return f(r===t.length?`ok`:`fail`,`**Suite: ${r} of ${t.length} passed**${a(n(e.suite).ms)}`)}case`info`:return f(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,o(r(e.text)));case`agent`:return m(n(n(e.event)),`**Coding agent:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${o(r(e.goal),200)}`};case`code-done`:return f(e.error?`fail`:`ok`,`${e.error?`✗`:`✓`} **Test ${e.error?`not written`:`written`}**${a(e.ms)}${e.error?`: ${o(r(e.error),240)}`:``}`);case`card`:{let t=n(e.card),i=(Array.isArray(t.body)?t.body:[]).map(r).filter(Boolean);return f(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${o(r(t.title))}**${t.stats?` · ${o(r(t.stats))}`:``}${i.length?`: ${o(i.join(`; `),300)}`:``}`)}case`report`:return f(`ok`,`✓ Report saved: ${o(r(e.title))}`);case`call-start`:return f(`dim`,`→ ${o(r(e.text),240)}`);case`call`:return f(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${o(r(e.text),240)}`);default:return null}}function _(e){let t=r(e.at)||r(e.t),i=null;switch(e.type){case`user`:i=f(`you`,`**You:** ${o(r(e.text),240)}`);break;case`agent`:i=m(n(e.event));break;case`tool`:i=g(n(e.event));break;case`ask`:i=f(`you`,`**Asked:** ${o(r(n(e.question).title))}`);break;case`wait`:i=f(`you`,`**Waiting for you:** ${o(r(e.prompt))}`);break;case`answered`:i=f(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:o(r(e.label))}`);break;case`turn_done`:i=f(e.outcome===`done`?`ok`:e.outcome===`stopped`?`warn`:`fail`,`**${e.outcome===`done`?`Done`:e.outcome===`stopped`?`Stopped`:e.outcome===`needs_input`?`Needs your input`:`Failed`}**${e.error?`: ${o(r(e.error),300)}`:``}`);break;case`settings`:i=f(`you`,`**Settings:** browser ${e.headed?`shown`:`headless`}, ${e.writeTests?`passed runs become tests`:`no tests written`}`);break;case`model`:i=f(`you`,`**Model:** ${o(r(n(e.profile).name),80)}`);break;case`settings_applied`:i=f(`you`,`**Settings:** carried on with the settings as they are on disk now`);break;case`stderr`:i={tone:`dim`,kind:`out`,md:r(e.text)};break;case`error`:i=f(`warn`,`⚠ ${o(r(e.message))}`);break;case`fatal`:i=f(`fail`,`✗ **ForgeQE cannot go on:** ${o(r(e.message))}`);break;case`exit`:i=f(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${o(r(e.code))})`:``}${e.message?`: ${o(r(e.message))}`:``}`)}return i?{at:t,...i,plain:i.kind===`out`?i.md:d(i.md)}:null}function v(e,t){if(!e||!t)return``;let n=Math.max(0,Math.round((Date.parse(t)-Date.parse(e))/1e3));return Number.isFinite(n)?`+${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:``}function y(e,t,n){let r=n?[`## ${o(n,200)}`,``]:[],i=[],a=()=>{if(!i.length)return;let e=Math.max(2,...i.map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),t="`".repeat(e+1);r.push(``,`${t}text`,...i,t,``),i=[]};for(let n of e){let e=v(t,n.at),o=e?`\`${e}\``:``;n.kind===`out`?i.push(e?`${e} ${n.md}`:n.md):(a(),n.kind===`head`?r.push(``,`#### ${n.md}${o?` ${o}`:``}`,``):n.kind===`sub`?r.push(` - ${n.md}`):r.push(`- ${o?`${o} `:``}${n.md}`))}return a(),r.join(`
1
+ import{Gt as e,Xt as t}from"./frame-I2oY7L19.js";var n=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},r=e=>typeof e==`string`?e:e==null?``:String(e),i=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,a=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function o(e,t=400){return i(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function s(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function c(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${o(e||t,120)}](${t})`:o(e)}var l=e=>[s(r(n(e).id)),o(r(n(e).title),200)].filter(Boolean).join(` `);function u(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function d(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var f=(e,t)=>({tone:e,kind:`item`,md:t}),p=(e,t)=>({tone:e,kind:`sub`,md:t});function m(e,t=``){let i=t||(e.agent&&e.agent!==`forgeqe`?`**${o(r(e.agent))}:** `:``);switch(e.kind){case`info`:return f(`info`,`${i}${o(r(e.text))}`);case`start`:return f(`dim`,`${i}→ ${s(r(e.tool))}${e.text&&e.text!==e.tool?` ${o(r(e.text),200)}`:``}`);case`tool`:{let t=n(e.file);return f(e.ok===!1?`warn`:`dim`,`${i}${e.ok===!1?`⚠`:`✓`} ${o(r(e.text)||r(e.tool),240)}${t.path?` (${o(r(t.action))} ${s(r(t.path))})`:``}`)}case`say`:{let t=u(r(e.text));return t?f(`say`,`${i}*${o(t)}*`):null}case`test`:return Number(e.attempt)>0?f(e.ok?`ok`:`fail`,`${i}${e.ok?`✓`:`✗`} **Test, attempt ${o(r(e.attempt))}:** ${o(r(e.text),240)}`):f(e.ok?`ok`:`fail`,`${i}${e.ok?`✓`:`✗`} ${o(r(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(n):[],a=t.find(e=>e.status===`in_progress`);return f(`info`,`${i}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${a?`; now: ${o(r(a.text))}`:``}`)}case`review`:return f(e.approved?`ok`:`warn`,`${i}**Review, attempt ${o(r(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${o(r(e.summary),240)}`);case`attempt`:return f(`warn`,`${i}**Attempt ${o(r(e.attempt))} of ${o(r(e.max))}:** ${o(r(e.why),240)}`);case`answer`:return f(`dim`,`${i}Attempt ${o(r(e.attempt))}: ${o(r(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(r).join(`, `)}`,240)}`);case`context`:return e.compacted?f(`info`,`${i}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function h(e,t=``){switch(e.type){case`log`:return f(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${o(r(e.text))}`);case`step`:return f(`dim`,`${t}**Step ${o(r(e.step))}** · ${e.source===`memory`?`from memory`:o(r(e.category))} · ${c(r(e.title)||`untitled`,r(e.url))}`);case`memory`:return f(`info`,`${t}↻ ${o(r(e.text))}`);case`thought`:return p(`think`,`*${o(r(e.text))}*`);case`outcome`:return p(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${o(r(e.text),300)}`);case`done`:{let i=n(e.result);return f(i.status===`complete`?`ok`:`fail`,`${t}**${o(r(i.status))}:** ${o(r(i.summary))}`)}case`code`:return m(e,t);default:return null}}function g(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${o(r(e.goal),200)}${e.url?` · ${c(r(e.url).replace(/^https?:\/\//,``),r(e.url))}`:``}`};case`run-event`:return h(n(e.event));case`run-done`:{let t=n(e.result),i=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return f(i?`ok`:`fail`,`${i?`✓`:`✗`} **Run ${i?`passed`:`failed`}**${a(e.ms)}: ${o(r(e.error)||r(t.summary))}${e.runDir?` · ${s(r(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${o(r(e.parallel))} at once`};case`suite-event`:{let t=n(e.event);if(t.type===`case-start`)return f(`info`,`**Case ${Number(t.index)+1} of ${o(r(t.total))}:** ${l(t.case)}`);if(t.type===`case-event`)return h(n(t.event),`${s(r(n(t.case).id))} `);if(t.type===`case-done`){let e=n(t.result);return f(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${l(e.case)}: **${o(r(e.status))}**${a(e.ms)}${e.summary?`. ${o(r(e.summary),240)}`:``}`)}return t.type===`code-start`?f(`info`,`${s(r(n(t.case).id))} writing its test`):t.type===`writeback`?f(`dim`,`Posted the result back: ${o(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(n(e.suite).results)?n(e.suite).results:[]).map(n),r=t.filter(e=>e.status===`passed`).length;return f(r===t.length?`ok`:`fail`,`**Suite: ${r} of ${t.length} passed**${a(n(e.suite).ms)}`)}case`info`:return f(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,o(r(e.text)));case`agent`:return m(n(n(e.event)),`**Coding agent:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${o(r(e.goal),200)}`};case`code-done`:return f(e.error?`fail`:`ok`,`${e.error?`✗`:`✓`} **Test ${e.error?`not written`:`written`}**${a(e.ms)}${e.error?`: ${o(r(e.error),240)}`:``}`);case`card`:{let t=n(e.card),i=(Array.isArray(t.body)?t.body:[]).map(r).filter(Boolean);return f(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${o(r(t.title))}**${t.stats?` · ${o(r(t.stats))}`:``}${i.length?`: ${o(i.join(`; `),300)}`:``}`)}case`report`:return f(`ok`,`✓ Report saved: ${o(r(e.title))}`);case`call-start`:return f(`dim`,`→ ${o(r(e.text),240)}`);case`call`:return f(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${o(r(e.text),240)}`);default:return null}}function _(e){let t=r(e.at)||r(e.t),i=null;switch(e.type){case`user`:i=f(`you`,`**You:** ${o(r(e.text),240)}`);break;case`agent`:i=m(n(e.event));break;case`tool`:i=g(n(e.event));break;case`ask`:i=f(`you`,`**Asked:** ${o(r(n(e.question).title))}`);break;case`wait`:i=f(`you`,`**Waiting for you:** ${o(r(e.prompt))}`);break;case`answered`:i=f(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:o(r(e.label))}`);break;case`turn_done`:i=f(e.outcome===`done`?`ok`:e.outcome===`stopped`?`warn`:`fail`,`**${e.outcome===`done`?`Done`:e.outcome===`stopped`?`Stopped`:e.outcome===`needs_input`?`Needs your input`:`Failed`}**${e.error?`: ${o(r(e.error),300)}`:``}`);break;case`settings`:i=f(`you`,`**Settings:** browser ${e.headed?`shown`:`headless`}, ${e.writeTests?`passed runs become tests`:`no tests written`}`);break;case`model`:i=f(`you`,`**Model:** ${o(r(n(e.profile).name),80)}`);break;case`settings_applied`:i=f(`you`,`**Settings:** carried on with the settings as they are on disk now`);break;case`stderr`:i={tone:`dim`,kind:`out`,md:r(e.text)};break;case`error`:i=f(`warn`,`⚠ ${o(r(e.message))}`);break;case`fatal`:i=f(`fail`,`✗ **ForgeQE cannot go on:** ${o(r(e.message))}`);break;case`exit`:i=f(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${o(r(e.code))})`:``}${e.message?`: ${o(r(e.message))}`:``}`)}return i?{at:t,...i,plain:i.kind===`out`?i.md:d(i.md)}:null}function v(e,t){if(!e||!t)return``;let n=Math.max(0,Math.round((Date.parse(t)-Date.parse(e))/1e3));return Number.isFinite(n)?`+${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:``}function y(e,t,n){let r=n?[`## ${o(n,200)}`,``]:[],i=[],a=()=>{if(!i.length)return;let e=Math.max(2,...i.map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),t="`".repeat(e+1);r.push(``,`${t}text`,...i,t,``),i=[]};for(let n of e){let e=v(t,n.at),o=e?`\`${e}\``:``;n.kind===`out`?i.push(e?`${e} ${n.md}`:n.md):(a(),n.kind===`head`?r.push(``,`#### ${n.md}${o?` ${o}`:``}`,``):n.kind===`sub`?r.push(` - ${n.md}`):r.push(`- ${o?`${o} `:``}${n.md}`))}return a(),r.join(`
2
2
  `).replace(/\n{3,}/g,`
3
3
 
4
4
  `).trim()+`
@@ -1 +1 @@
1
- import{ho as e,ka as t,vo as n}from"./frame-LE6IccxB.js";import{n as r}from"./thread-N69k7QNW.js";var i=n(e(),1),a=e=>e&&/^No model in llms\.json/.test(e)?`No model is set up for the agent yet: add one in Settings, Models (or sign in to GitHub Copilot there), then send this again.`:e;function o(e){let n=()=>{try{return localStorage.getItem(e)}catch{return null}},a=t=>{try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}},[o,s]=(0,i.useState)(n),[c,l]=(0,i.useState)([]),[u,d]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!o){l([]),d(null);return}let e=!1,n=0;return l([]),(async()=>{for(;!e;)try{let r=await t.events(o,n,n>0);if(e||(d(r.state),r.events.length&&(n=r.events.at(-1).n,l(e=>[...e,...r.events])),(r.state===`closed`||r.state===`failed`)&&!r.events.length))return}catch(t){if(e)return;if(t.status===404){a(null),s(null);return}await new Promise(e=>setTimeout(e,2e3))}})(),()=>{e=!0}},[o]);let f=(0,i.useMemo)(()=>r(c),[c]),p=f.turns.at(-1),m=u===`closed`||u===`failed`;return{chat:o,thread:f,last:p,busy:u===`busy`||u===`starting`||!!p&&!p.outcome&&!m,ended:m,send:async(e,n,r={})=>{if(o&&!m)await t.send(o,e);else{let{id:i}=await t.start(`${n}\n${e}`,r);a(i),s(i)}},reset:()=>{a(null),s(null)}}}export{o as n,a as t};
1
+ import{ho as e,ka as t,vo as n}from"./frame-I2oY7L19.js";import{n as r}from"./thread-CvTcakQw.js";var i=n(e(),1),a=e=>e&&/^No model in llms\.json/.test(e)?`No model is set up for the agent yet: add one in Settings, Models (or sign in to GitHub Copilot there), then send this again.`:e;function o(e){let n=()=>{try{return localStorage.getItem(e)}catch{return null}},a=t=>{try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}},[o,s]=(0,i.useState)(n),[c,l]=(0,i.useState)([]),[u,d]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!o){l([]),d(null);return}let e=!1,n=0;return l([]),(async()=>{for(;!e;)try{let r=await t.events(o,n,n>0);if(e||(d(r.state),r.events.length&&(n=r.events.at(-1).n,l(e=>[...e,...r.events])),(r.state===`closed`||r.state===`failed`)&&!r.events.length))return}catch(t){if(e)return;if(t.status===404){a(null),s(null);return}await new Promise(e=>setTimeout(e,2e3))}})(),()=>{e=!0}},[o]);let f=(0,i.useMemo)(()=>r(c),[c]),p=f.turns.at(-1),m=u===`closed`||u===`failed`;return{chat:o,thread:f,last:p,busy:u===`busy`||u===`starting`||!!p&&!p.outcome&&!m,ended:m,send:async(e,n,r={})=>{if(o&&!m)await t.send(o,e);else{let{id:i}=await t.start(`${n}\n${e}`,r);a(i),s(i)}},reset:()=>{a(null),s(null)}}}export{o as n,a as t};
@@ -5,9 +5,9 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="referrer" content="no-referrer" />
7
7
  <title>ForgeQE</title>
8
- <script type="module" crossorigin src="/assets/index-DhR7aomZ.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/frame-LE6IccxB.js">
10
- <link rel="stylesheet" crossorigin href="/assets/index-Cs7yh8J8.css">
8
+ <script type="module" crossorigin src="/assets/index-BOLnH0rJ.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/frame-I2oY7L19.js">
10
+ <link rel="stylesheet" crossorigin href="/assets/index-D_Rdwtap.css">
11
11
  </head>
12
12
  <body>
13
13
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capagents/forgeqe",
3
- "version": "2.8.1",
3
+ "version": "2.8.3",
4
4
  "description": "ForgeQE: a browser agent CLI that runs goals and test cases in local Chrome or Chromium, or BrowserStack and TestMu AI/LambdaTest when configured, and turns passing runs into tests in your repo",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- import{$i as e,At as t,Gr as n,Mt as r,Nt as i,Sn as a,Xi as o,Xr as s,Zr as c,_t as l,an as u,bi as d,cr as f,da as p,do as m,dt as h,en as g,fa as _,ft as v,ga as y,hi as b,ho as x,kt as S,ma as C,mr as w,mt as T,nt as E,on as D,ot as O,po as k,r as A,st as j,t as M,tt as N,vi as ee,vo as P,vt as F,wn as I,yt as L,zi as R}from"./frame-LE6IccxB.js";import{c as te,o as ne,r as z,u as re}from"./index-DhR7aomZ.js";import{t as ie}from"./segmented-D009ouN6.js";import{n as ae}from"./families-D_YnXNTR.js";import{r as oe,s as B,t as se}from"./logos-DgqBK3qe.js";import{d as V,o as ce,p as le,r as H,s as ue,t as de}from"./parts-DJxun6mX.js";var U=P(x(),1),W=k(),G=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,fe={ok:{label:`Ready to start`,tone:`pass`},limits:{label:`Ready, with limits`,tone:`warn`},blocked:{label:`Not possible`,tone:`fail`}},pe={converted:{label:`Converted`,tone:`pass`},partial:{label:`Needs review`,tone:`warn`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},running:{label:`Running`,tone:`running`}},me={converted:{label:`Converted`,tone:`pass`},written:{label:`Written`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`},blocked:{label:`Not possible`,tone:`warn`},skipped:{label:`Skipped`,tone:`neutral`}},he={setup:`Set-up`,page:`Page`,test:`Test`},ge={matched:{label:`In the test`,dot:`bg-pass`},missing:{label:`Missing from the test`,dot:`bg-fail`},elided:{label:`Not needed: this branch never runs`,dot:`bg-line-strong`},marked:{label:`Left for a person to finish`,dot:`bg-warn`}},K={web:`Web`,api:`API`,desktop:`Desktop`,mobile:`Mobile`,data:`Data`,mixed:`Mixed`,unsupported:`Not supported`},q={prepare:`Prepare`,setup:`Set up`,pages:`Pages`,tests:`Tests`,validate:`Validate`,review:`Review`},J=[`prepare`,`setup`,`pages`,`tests`,`validate`,`review`];function _e(e,t){if(!t)return 0;if(t.status===`converted`||t.stages?.review.status===`done`)return 100;let n=t.stages?.validate.status===`done`?8:0,r=Math.min(t.units.length,e.units.length);return Math.min(99,Math.round(r/Math.max(1,e.units.length)*90+n))}function ve(e){let t=e?.status||`pending`,n=e?.startedAt&&e?.endedAt?V(Date.parse(e.endedAt)-Date.parse(e.startedAt)):``;return t===`running`?e?.startedAt?`Running · ${V(Date.now()-Date.parse(e.startedAt))}`:`Running`:t===`done`?e?.note||(n?`Done · ${n}`:`Done`):t===`failed`?e?.note||`Did not finish`:t===`skipped`?e?.note||`Skipped`:`Waiting`}function ye({states:e}){return(0,W.jsx)(`ol`,{"aria-label":`Stages`,className:`m-0 flex w-full min-w-0 list-none items-center gap-1 p-0 @xl:gap-2`,children:J.map((t,n)=>{let r=e?.[t],i=r?.status||`pending`,o=i===`done`||i===`skipped`,s=i===`running`||i===`failed`,l=ve(r);return(0,W.jsxs)(`li`,{"data-tip":`${q[t]}: ${l}`,className:y(`relative flex items-center gap-1 @xl:gap-2`,n<J.length-1&&`flex-1`),"aria-current":i===`running`?`step`:void 0,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:y(`inline-flex size-5 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums @xl:size-6`,o?`bg-pass text-white`:i===`running`?`border-2 border-accent bg-accent-soft text-accent-fg`:i===`failed`?`bg-fail text-white`:`border border-line bg-bg text-muted`),children:o?(0,W.jsx)(a,{size:12,strokeWidth:3}):i===`failed`?(0,W.jsx)(_,{size:12,strokeWidth:3}):i===`running`?(0,W.jsx)(c,{size:12,strokeWidth:2.5,className:`animate-spin`}):n+1}),(0,W.jsxs)(`span`,{className:y(`flex-none text-[13px] whitespace-nowrap`,s?`inline`:`hidden @xl:inline`,i===`running`?`font-medium text-accent-fg`:i===`failed`?`font-medium text-fail`:i===`pending`?`text-muted`:`text-ink`),children:[q[t],s&&(0,W.jsx)(`span`,{className:`ml-1.5 hidden font-normal text-muted @3xl:inline`,children:l})]}),(0,W.jsxs)(`span`,{className:`sr-only`,children:[q[t],`: `,l]}),n<J.length-1&&(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,W.jsx)(`span`,{className:y(`block h-full rounded-full bg-pass transition-[width] duration-500`,o?`w-full`:`w-0`)})})]},t)})})}function Y(e){return e?`literal`in e?JSON.stringify(e.literal):`env`in e?`env ${String(e.env)}${e.secret?` (secret)`:``}`:`var`in e?`variable ${String(e.var)}`:`param`in e?`parameter ${String(e.param)}`:`data`in e?`test data ${String(e.data)}`:`expr`in e?`expression ${String(e.expr)}`:`concat`in e&&Array.isArray(e.concat)?e.concat.map(Y).join(` + `):``:``}function be(e){let t=e.target?e.target.slice(e.target.indexOf(`.`)+1).replace(/_/g,` `):``;if(e.kind===`action`){let n=e.op===`navigate`?`Open ${Y(e.value)}`:e.op===`close`?`Close the browser`:e.op===`fill`?`Fill ${t} with ${Y(e.value)}`:e.op===`press`?`Press ${e.key} on ${t}`:e.op===`select`?`Select in ${t}`:`${e.op[0].toUpperCase()}${e.op.slice(1)} ${t}`;return e.optional?`${n} (if it is there)`:n}return e.kind===`assert`?`Check ${t} ${e.op===`text`||e.op===`value`?`${e.match===`contains`?`contains`:`is`} ${Y(e.expected)}`:`is ${e.op}`}${e.wait?`, waiting`:``}`:e.kind===`store`?`Read ${t} into ${e.var}`:e.kind===`set_var`?`Set ${e.var} to ${Y(e.value)}`:e.kind===`wait`?`Wait ${e.ms} ms`:e.kind===`unsupported`?e.reason||`Cannot be converted`:e.name||e.kind}var xe={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function Se({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,W.jsx)(`ul`,{className:y(`m-0 flex list-none flex-col p-0`,i>0&&`ml-3 border-l border-line-soft pl-3`),children:e.map((e,a)=>{if(e.kind===`group`)return(0,W.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,W.jsxs)(`span`,{className:`text-[12px] font-medium text-muted`,children:[xe[e.role||`folder`]||`Folder`,`: `,(0,W.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,W.jsx)(Se,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${a}`);if(e.kind===`if`||e.kind===`loop`){let o=e.condition;return(0,W.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,W.jsxs)(`span`,{className:`text-[12px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,W.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2`,children:o?.tosca}),o?.constant!==void 0&&(0,W.jsxs)(`span`,{children:[` · always `,o.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsx)(`span`,{className:`ml-3 text-[12px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,W.jsx)(Se,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${a}`)}let o=e.id?t.get(e.id):void 0,s=o?ge[o]:void 0;return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:y(`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-1.5 text-left text-[13px]`,n===e.id?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,W.jsx)(`span`,{role:`img`,"aria-label":s?.label||`Not converted yet`,"data-tip":s?.label||`Not converted yet`,className:y(`mt-1.5 size-2 flex-none rounded-full`,s?.dot||`bg-line`)}),(0,W.jsx)(`span`,{className:`w-9 flex-none font-mono text-[12px] text-muted`,children:e.id}),(0,W.jsxs)(`span`,{className:y(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[be(e),e.tosca?.step&&(0,W.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||a)})})}function Ce(e,t){for(let n of e){if(n.id===t)return n;for(let e of[`body`,`then`,`else`,`loop`]){let r=n[e]&&Ce(n[e],t);if(r)return r}}}function we({view:e,pick:t}){let n=e.target,r=n?.text||``,i=r.split(`
2
- `),a=(0,U.useMemo)(()=>r?re(r,n?.lang||`plaintext`):null,[r,n?.lang]),o=(0,U.useMemo)(()=>{if(!t)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(i.flatMap((t,n)=>e.test(t)?[n]:[]))},[t,r]),s=(0,U.useRef)(null);(0,U.useEffect)(()=>{s.current?.scrollIntoView({block:`center`,behavior:`smooth`})},[t,o.size]);let c=Math.min(...o);return(0,W.jsxs)(`figure`,{className:`m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,W.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-3`,children:[(0,W.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Converted test`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-ink-2`,"data-tip":n?.path,children:n?.path||``}),r&&(0,W.jsx)(ne,{text:r,label:`Copy ${n?.path||`the test`}`})]}),r?(0,W.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[12.5px] leading-[1.6]`,children:[(0,W.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft py-3 text-right text-muted select-none`,children:i.map((e,t)=>(0,W.jsx)(`span`,{ref:t===c?s:void 0,className:y(`block px-3`,o.has(t)&&`bg-accent-soft font-semibold text-accent-fg`),children:t+1},t))}),(0,W.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-3 py-3`,children:(0,W.jsx)(`code`,{className:`hljs`,children:a})})]}):(0,W.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:n?`Not written yet.`:`This test case is left out of the plan.`}),t&&r&&(0,W.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft px-3 py-2 text-[12.5px] text-muted`,children:o.size?`${t} is done on line ${[...o].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`})]})}function Te({view:e,node:t}){if(!t?.target)return null;let[n,r]=t.target.split(`.`),i=e.pages.find(e=>e.id===n),a=i?.elements.find(e=>e.id===r);return a?(0,W.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-3 text-[13px]`,children:[(0,W.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,W.jsxs)(`span`,{className:`font-normal text-muted`,children:[`on `,i?.name,a.scope?.length?`, inside ${a.scope.join(` › `)}`:``,a.nth===void 0?``:`, number ${a.nth+1}`]})]}),a.locators.length?(0,W.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,W.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`w-14 flex-none text-[12px] text-muted`,children:e.strategy}),(0,W.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.strategy===`role`?`${e.role} "${e.name}"`:e.attr?`[${e.attr}="${e.value}"]`:e.value}),e.fragile&&(0,W.jsx)(l,{tone:`warn`,children:`Fragile`})]},t))}):(0,W.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function Ee({id:e,plan:t,result:n,initial:r}){let i=t.cases.filter(e=>e.included),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(r||i[0]?.id||``),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(``),[p,g]=(0,U.useState)(``);(0,U.useEffect)(()=>{s&&(g(``),m.case(e,s).then(u,e=>g(e.message)))},[e,s,n?.units.length,n?.status]),(0,U.useEffect)(()=>{f(``)},[s]);let _=new Map((l?.fidelity||[]).map(e=>[e.id,e.status])),v=i.filter(e=>!a||e.name.toLowerCase().includes(a.toLowerCase())),b=e=>n?.units.find(t=>t.kind===`test`&&t.case===e);return i.length?(0,W.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-4 @5xl:h-[calc(var(--screen)-320px)] @5xl:min-h-[540px] @5xl:grid-cols-[220px_minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,W.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[320px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-3 @5xl:max-h-none`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-1`,children:[(0,W.jsx)(`span`,{className:`text-sm font-semibold`,children:`Test cases`}),(0,W.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[i.filter(e=>b(e.id)?.status===`converted`).length,` converted · `,i.filter(e=>[`failed`,`blocked`].includes(b(e.id)?.status||``)).length,` failed · `,G(i.length,`test case`)]})]}),(0,W.jsx)(h,{id:`find-a-case`,label:`Find a test case`,value:a,onChange:o,className:`max-w-none flex-none`}),(0,W.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-0.5 overflow-y-auto p-0`,children:[v.map(e=>{let t=b(e.id);return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":s===e.id,onClick:()=>c(e.id),className:y(`flex w-full cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-1.5 text-left text-[13px]`,s===e.id?`bg-accent-soft text-ink`:`bg-transparent text-ink-2 hover:bg-surface-muted`),children:[(0,W.jsx)(`span`,{role:`img`,"aria-label":t?me[t.status].label:`Waiting`,className:y(`mt-1.5 size-2 flex-none rounded-full`,t?.status===`converted`?`bg-pass`:t?.status===`failed`?`bg-fail`:t?.status===`blocked`?`bg-warn`:`bg-line`)}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.name,(0,W.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[G(e.steps,`step`),` · `,G(e.asserts,`check`),t?.fidelity?` · ${t.fidelity.matched}/${t.fidelity.required} in the test`:``]})]})]})},e.id)}),!v.length&&(0,W.jsx)(`li`,{className:`px-2 py-3 text-[13px] text-muted`,children:`No test case matches.`})]})]}),(0,W.jsxs)(`section`,{"aria-label":`Tosca steps`,className:`flex min-h-[360px] min-w-0 flex-col gap-3 overflow-hidden`,children:[p&&(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:p}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 flex-wrap items-center gap-2 border-b border-line-soft px-3 py-1.5`,children:[(0,W.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Tosca steps`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:l?.name}),l&&t.cases.find(e=>e.id===s)&&(0,W.jsx)(`span`,{className:`text-[12px] text-muted`,children:K[t.cases.find(e=>e.id===s).route]||``})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:l?(0,W.jsx)(Se,{nodes:l.body,status:_,pick:d,onPick:e=>f(e.id||``)}):p?(0,W.jsx)(`p`,{className:`m-0 px-2 text-sm text-muted`,children:`Nothing to show.`}):(0,W.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:`Loading…`})}),l&&(l.env.length>0||l.warnings.length>0)&&(0,W.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-3 py-2 text-[12.5px] text-ink-2`,children:[l.env.length>0&&(0,W.jsxs)(`span`,{children:[`Environment variables: `,l.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),l.warnings.slice(0,3).map(e=>(0,W.jsx)(`span`,{className:`text-warn`,children:e},e))]})]}),l&&(0,W.jsx)(Te,{view:l,node:Ce(l.body,d)})]}),l?(0,W.jsx)(we,{view:l,pick:d}):(0,W.jsx)(`p`,{className:`m-0 flex min-h-[260px] items-center justify-center rounded-[12px] card border px-4 text-center text-sm text-muted`,children:p?`Nothing to show.`:`Loading…`})]}):(0,W.jsx)(F,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`})}function De(e){if(e.job?.running)return{label:e.job.kind===`fix`?`Fixing`:e.job.kind===`verify`?`Running tests`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:`Running`,tone:`running`}:t?pe[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:fe[e.plan.feasibility.verdict]}var X=e=>e.slice(e.lastIndexOf(`/`)+1);function Oe({id:e,title:t,targetDir:n,onClose:a}){let[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),p=async()=>{u(!0),f(``);try{await m.delete(e,s),location.hash=i(`tosca`)}catch(e){f(e.message),u(!1)}};return(0,W.jsx)(r,{open:!0,onClose:a,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C,{variant:`ghost`,onClick:a,children:`Keep it`}),(0,W.jsxs)(C,{variant:`danger`,disabled:l||s!==e,onClick:()=>void p(),children:[(0,W.jsx)(o,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,W.jsxs)(`span`,{children:[`Type `,(0,W.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,W.jsx)(v,{value:s,onChange:e=>c(e.target.value),autoComplete:`off`,spellCheck:!1})]}),d?(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:d}):null]})})}function ke({d:e,unit:t,onClose:n,onSend:i}){let[a,o]=(0,U.useState)(``),s=e.plan.units.find(e=>e.id===t),c=e.result?.units.find(e=>e.id===t);return(0,W.jsx)(r,{open:!0,onClose:n,title:`Fix ${s?X(s.target):t}`,description:`The Tosca agent works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,W.jsxs)(C,{variant:`primary`,onClick:()=>i(a.trim()),children:[(0,W.jsx)(p,{"aria-hidden":`true`}),`Send to the agent`]})]}),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,W.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c.problems[0]}):null,(0,W.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,W.jsx)(T,{value:a,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function Ae({d:e,unit:t,onClose:n}){let i=e.result?.units.find(e=>e.id===t),a=e.plan.units.find(e=>e.id===t);return(0,W.jsx)(r,{open:!0,onClose:n,wide:!0,title:`Output of ${a?X(a.target):t}`,description:i?.checkedAt?`Run again ${le(i.checkedAt)}`:`From the conversion's own run`,footer:(0,W.jsx)(C,{onClick:n,children:`Close`}),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[i?.problems?.length?(0,W.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i.problems.join(` `)}):i?.status===`converted`?(0,W.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,i?.command&&(0,W.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted`,children:[`$ `,i.command]}),(0,W.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto rounded-[12px] bg-surface-muted px-3 py-2 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:i?.output||`No output.`})]})})}function je(e){let t=Object.fromEntries(J.map(e=>[e,{status:e===`prepare`?`running`:`pending`,...e===`prepare`?{startedAt:new Date().toISOString()}:{}}]));return{status:`running`,plan:e.plan.id,target:e.plan.target,units:[],reverted:[],model:``,startedAt:e.job?.last?.startedAt||new Date().toISOString(),ms:0,stage:`prepare`,stages:t,notes:``}}function Me({d:e,planView:t,busy:n,onFix:r,onSteps:i,onOutput:a,onRun:o}){let c=e.result||(e.job?.running?je(e):null);if(!c)return(0,W.jsx)(W.Fragment,{children:t});let u=new Map(c.units.map(e=>[e.id,e])),d=e.plan.units.filter(e=>e.kind===`test`),f=c.units.filter(e=>e.kind===`test`&&e.status===`converted`).length,m=c.units.reduce((e,t)=>t.fidelity?{m:e.m+t.fidelity.matched,n:e.n+t.fidelity.required}:e,{m:0,n:0}),h=c.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,[g,..._]=e.plan.target.id.split(`-`);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,W.jsxs)(ce,{children:[(0,W.jsx)(H,{label:`Tests passing`,value:`${f} / ${d.length}`,tone:f===d.length&&d.length?`text-pass`:void 0}),(0,W.jsx)(H,{label:`Tosca steps in the tests`,value:m.n?`${m.m} / ${m.n}`:`–`,tone:m.n&&m.m===m.n?`text-pass`:void 0}),(0,W.jsx)(H,{label:`Need attention`,value:h,tone:h?`text-fail`:void 0}),(0,W.jsx)(H,{label:c.status===`running`?`Running for`:`Took`,value:V(c.status===`running`?Date.now()-Date.parse(c.startedAt):c.ms)})]}),c.notes&&(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c.notes}),(0,W.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-5 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,W.jsx)(N,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`th`,{className:`py-2 pr-3 pl-3 font-medium`,children:`File`}),(0,W.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Status`}),(0,W.jsx)(`th`,{className:`hidden py-2 pr-3 font-medium @2xl:table-cell`,children:`Tosca steps`}),(0,W.jsx)(`th`,{className:`hidden py-2 pr-3 font-medium @3xl:table-cell`,children:`Note`}),(0,W.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:(0,W.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let o=u.get(t.id),c=o?me[o.status]:null,d=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,W.jsxs)(`tr`,{className:O,children:[(0,W.jsxs)(`td`,{className:E,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:X(t.target)}),(0,W.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[d?d.name:`${he[t.kind]} · ${t.target}`,d?.suites?.length?` · ${d.suites.join(`, `)}`:``]})]}),(0,W.jsxs)(`td`,{className:y(E,`whitespace-nowrap`),children:[c?(0,W.jsx)(l,{tone:c.tone,children:c.label}):(0,W.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`}),o?.checkedAt&&(0,W.jsxs)(`span`,{className:`block pt-1 text-[12px] text-muted`,children:[`Run again `,z(o.checkedAt)]})]}),(0,W.jsx)(`td`,{className:y(E,`hidden text-[13px] whitespace-nowrap @2xl:table-cell`),children:o?.fidelity?(0,W.jsxs)(`span`,{className:o.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[o.fidelity.matched,` of `,o.fidelity.required]}):(0,W.jsx)(`span`,{className:`text-muted`,children:`–`})}),(0,W.jsx)(`td`,{className:y(E,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,W.jsx)(`span`,{className:`line-clamp-2`,children:o?.problems?.[0]||o?.reason||``})}),(0,W.jsx)(`td`,{className:y(E,`whitespace-nowrap text-right`),children:(0,W.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(o?.output||o?.problems?.length)&&(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,"aria-label":`Output of ${X(t.target)}`,onClick:()=>a(t.id),children:[(0,W.jsx)(w,{"aria-hidden":`true`}),`Output`]}),t.case&&(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,"aria-label":`Steps of ${X(t.target)}`,onClick:()=>i(t.case),children:[(0,W.jsx)(s,{"aria-hidden":`true`}),`Steps`]}),o&&(o.status===`failed`||o.status===`blocked`)&&t.kind!==`setup`&&(0,W.jsxs)(C,{size:`sm`,disabled:n,"aria-label":`Fix ${X(t.target)}`,onClick:()=>r(t.id),children:[(0,W.jsx)(p,{"aria-hidden":`true`}),`Fix`]})]})})]},t.id)})}),(0,W.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-5 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`From`}),(0,W.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?` · ${e.plan.source.project}`:``]}),(0,W.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`To`}),(0,W.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,W.jsx)(B,{framework:g,language:_.join(`-`)}),e.plan.target.title]}),(0,W.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(e.plan.suites||[]).length>0&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Suites`}),(0,W.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:e.plan.suites.map(e=>{let t=new Set(e.cases),r=c.units.filter(e=>e.kind===`test`&&e.case&&t.has(e.case)&&e.status===`converted`).length;return(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:e.name}),(0,W.jsxs)(`span`,{className:y(`text-[12px]`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,G(e.cases.length,`test`),` pass · @`,e.tag]})]}),(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,disabled:n,"aria-label":`Run the ${e.name} suite`,onClick:()=>o(e.name),children:[(0,W.jsx)(b,{"aria-hidden":`true`}),`Run`]})]},e.name)})})]}),e.plan.env.length>0&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Environment variables`}),(0,W.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,W.jsxs)(`li`,{className:`flex flex-col`,children:[(0,W.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[e.name,e.secret?(0,W.jsx)(`span`,{className:`font-sans text-muted`,children:` · secret`}):null]}),(0,W.jsx)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,W.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 border-t border-line-soft pt-4`,children:[(0,W.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,W.jsx)(`dd`,{className:`m-0 text-right`,children:le(c.startedAt)}),c.model&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,W.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":c.model,children:c.model})]}),c.reverted.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,W.jsxs)(`dd`,{className:`m-0 text-right`,children:[c.reverted.length,` edits outside the target`]})]})]})]})]})]})}var Ne={ok:{mark:`✓`,cls:`text-pass`},fail:{mark:`✗`,cls:`text-fail`},info:{mark:`•`,cls:`text-muted`},agent:{mark:`•`,cls:`text-accent-fg`},tool:{mark:`·`,cls:`text-muted`}};function Pe({events:e,running:t}){let n=(0,U.useRef)(null);(0,U.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,t]);let r=e.filter(e=>e.kind!==`tool`);return(0,W.jsxs)(`ol`,{ref:n,"aria-live":t?`polite`:void 0,"aria-label":`Activity`,className:`m-0 flex max-h-[60vh] list-none flex-col overflow-y-auto rounded-[12px] card border p-0`,children:[r.map((e,t)=>(0,W.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft px-4 py-2 text-[13px] last:border-b-0`,children:[(0,W.jsx)(`span`,{className:`w-[64px] flex-none text-[12px] text-muted tabular-nums`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:y(`w-3 flex-none text-center`,Ne[e.kind].cls),children:Ne[e.kind].mark}),(0,W.jsx)(`span`,{className:y(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:`text-ink-2`),children:e.text})]},t)),!r.length&&(0,W.jsx)(`li`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`Nothing yet.`})]})}function Fe({id:e,plan:t}){let[n,a]=(0,U.useState)(null),[s,c]=(0,U.useState)(``),[f,p]=(0,U.useState)(`overview`),[h,g]=(0,U.useState)(),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)([]),[w,T]=(0,U.useState)(null),[E,O]=(0,U.useState)(!1),[k,A]=(0,U.useState)(!1),j=(0,U.useRef)(0),M=(0,U.useCallback)(()=>{m.detail(e).then(e=>{a(e),c(``)},e=>c(e.message)),m.events(e,j.current).then(e=>{e.next<j.current?(j.current=0,S([])):(j.current=e.next,e.events.length&&S(t=>[...t,...e.events].slice(-2e3)))},()=>{})},[e]);(0,U.useEffect)(M,[M]);let N=!!(n?.job?.running||n?.result?.status===`running`);(0,U.useEffect)(()=>{if(!N)return;let e=setInterval(M,1500);return()=>clearInterval(e)},[N,M]);let ee=(0,U.useCallback)(e=>{a(e),c(``),p(`overview`),setTimeout(M,800)},[M]),P=async e=>{O(!0),c(``);try{a(await e()),setTimeout(M,800)}catch(e){c(e.message)}finally{O(!1)}};if(!n)return s?(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}):(0,W.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let F=De(n),I=_e(n.plan,n.result),L=n.result,ne=(L?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,z=n.plan.cases.filter(e=>e.included).length,re=[{id:`overview`,label:`Overview`},{id:`steps`,label:`Steps`,n:z?String(z):void 0,tone:ne?`text-fail`:void 0},{id:`activity`,label:`Activity`}];return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`a`,{href:i(`tosca`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,W.jsx)(u,{size:16,"aria-hidden":`true`}),`Tosca`]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 @3xl:flex-row @3xl:items-start`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,W.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,W.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:X(n.plan.source.file)}),(0,W.jsx)(D,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,W.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,W.jsx)(B,{framework:n.plan.target.id.split(`-`)[0],language:n.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),n.plan.target.title]})]}),(0,W.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-1.5 text-sm text-muted`,children:[(0,W.jsxs)(`span`,{children:[`Tricentis Tosca`,n.plan.source.project?` · ${n.plan.source.project}`:``]}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsxs)(`span`,{children:[`into `,(0,W.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:n.plan.target.dir})]})]})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(l,{tone:F.tone,children:F.label}),N?(0,W.jsxs)(C,{variant:`danger`,disabled:E,onClick:()=>void P(()=>m.stop(e)),children:[(0,W.jsx)(R,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,W.jsxs)(W.Fragment,{children:[L?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C,{variant:`ghost`,onClick:()=>m.report(e).then(e=>T(e.text),()=>T(``)),children:`Report`}),(0,W.jsxs)(C,{disabled:E,onClick:()=>void P(()=>m.verify(e)),"data-tip":`Run every converted test again, no agent`,children:[(0,W.jsx)(d,{"aria-hidden":`true`}),`Run tests again`]})]}):null,(0,W.jsxs)(C,{variant:`ghost`,disabled:E,onClick:()=>A(!0),"data-tip":`Remove this plan from the list. Converted tests stay.`,children:[(0,W.jsx)(o,{"aria-hidden":`true`}),`Delete`]})]})]})]}),k&&(0,W.jsx)(Oe,{id:e,title:`${X(n.plan.source.file)} → ${n.plan.target.title}`,targetDir:n.plan.target.dir,onClose:()=>A(!1)}),L&&(0,W.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[12px] card border px-3 py-2.5 @xl:gap-4 @xl:px-4`,children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(ye,{states:L.stages})}),N&&(0,W.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(I)}% done`,children:[Math.round(I),`%`]})]}),s&&(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),(0,W.jsx)(ue,{tabs:re,tab:f,onTab:p,label:`Tosca conversion`}),(0,W.jsxs)(`div`,{role:`tabpanel`,id:`mpanel-${f}`,"aria-labelledby":`mtab-${f}`,className:`flex min-w-0 flex-col gap-4`,children:[f===`overview`&&(0,W.jsx)(Me,{d:n,planView:t(n,ee),busy:E||N,onFix:v,onSteps:e=>(g(e),p(`steps`)),onOutput:b,onRun:t=>void P(()=>m.verify(e,t))}),f===`steps`&&(0,W.jsx)(Ee,{id:e,plan:n.plan,result:L,initial:h}),f===`activity`&&(0,W.jsx)(Pe,{events:x,running:N})]}),y&&(0,W.jsx)(Ae,{d:n,unit:y,onClose:()=>b(null)}),_&&(0,W.jsx)(ke,{d:n,unit:_,onClose:()=>v(null),onSend:t=>{v(null),P(()=>m.fix(e,[_],t))}}),(0,W.jsx)(r,{open:w!==null,onClose:()=>T(null),wide:!0,title:`Report`,description:`tosca.md for ${n.plan.id}`,footer:(0,W.jsx)(C,{onClick:()=>T(null),children:`Close`}),children:w?(0,W.jsx)(te,{text:w}):(0,W.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report yet.`})})]})}var Ie=[`Export`,`Target`,`Instructions`,`Review`],Le=[`The Tosca export and its test cases`,`Framework and language`,`Your rules, optional`,`Check and start`],Re=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],ze={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function Be({at:e,reached:t,onGo:n}){return(0,W.jsx)(`nav`,{"aria-label":`Steps`,children:(0,W.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:Ie.map((r,i)=>{let o=i<=t,s=i===e,c=i<t&&!s;return(0,W.jsxs)(`li`,{className:y(`flex items-center gap-2`,i<Ie.length-1&&`flex-1`),children:[(0,W.jsxs)(`button`,{type:`button`,disabled:!o,"aria-current":s?`step`:void 0,onClick:()=>n(i),"aria-label":r,"data-tip":Le[i],className:y(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,o&&!s?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:y(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums`,c?`bg-pass text-white`:s?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:c?(0,W.jsx)(a,{size:13,strokeWidth:3}):i+1}),(0,W.jsx)(`span`,{className:y(s?`font-medium text-ink`:o?`text-ink-2`:`text-muted`,!s&&`hidden @xl:inline`),children:r})]}),i<Ie.length-1&&(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,W.jsx)(`span`,{className:y(`block h-full rounded-full bg-pass transition-[width] duration-500`,i<t?`w-full`:`w-0`)})})]},r)})})})}function Z({id:e,label:t,help:n,children:r}){return(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,W.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function Q({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,W.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-3 border-t border-line-soft bg-bg py-3`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,W.jsx)(C,{variant:`ghost`,disabled:e,onClick:t,children:`Back`}),(0,W.jsx)(C,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function Ve({on:e,onPick:t,logo:n,title:r,sub:i,label:a}){return(0,W.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-label":a,onClick:t,className:y(`flex min-h-[72px] min-w-0 cursor-pointer items-center gap-3 rounded-[12px] border px-3.5 py-3 text-left transition-colors`,e?`border-accent bg-accent-soft ring-1 ring-accent`:`border-line-soft bg-bg hover:border-line hover:bg-surface-muted`),children:[(0,W.jsx)(`span`,{className:`inline-flex size-9 flex-none items-center justify-center rounded-[10px] bg-surface-muted`,children:n}),(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,W.jsx)(`span`,{className:`truncate text-sm font-medium text-ink`,children:r}),i&&(0,W.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:i})]})]})}var He=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function Ue({s:e}){return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:e.project||e.file}),(0,W.jsxs)(`span`,{className:`text-ink-2`,children:[G(e.test_cases.length,`test case`),` · `,G(e.pages.length,`module`),` · `,G(e.totals.steps,`step`),` · `,G(e.totals.asserts,`check`)]}),e.suites.length>0&&(0,W.jsxs)(`span`,{className:`text-ink-2`,children:[`· `,G(e.suites.length,`execution list`)]}),e.totals.unsupported>0&&(0,W.jsxs)(`span`,{className:`text-warn`,children:[`· `,e.totals.unsupported===1?`1 step value cannot`:`${e.totals.unsupported} step values cannot`,` be converted`]})]})}function We({view:e,file:t,setFile:n,found:r,setFound:i,only:a,setOnly:o}){let[s,c]=(0,U.useState)(e.exports.some(e=>e.path===t)?``:t),[u,d]=(0,U.useState)(!1),[p,h]=(0,U.useState)(``),g=async e=>{if(n(e),i(null),h(``),e){d(!0);try{let t=await m.inspect(e);i(t),o(new Set(t.test_cases.filter(e=>e.route===`web`||(e.routes?.web??0)>0).map(e=>e.id)))}catch(e){h(e.message)}finally{d(!1)}}},_=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.exports.length>0?(0,W.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,W.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Tosca exports in this project`}),(0,W.jsx)(`div`,{role:`radiogroup`,"aria-label":`Tosca exports`,className:`grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2.5`,children:e.exports.map(e=>(0,W.jsx)(Ve,{on:t===e.path,onPick:()=>void g(e.path),logo:(0,W.jsx)(f,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:e.path.slice(e.path.lastIndexOf(`/`)+1),sub:`${e.path.includes(`/`)?e.path.slice(0,e.path.lastIndexOf(`/`)):`.`} · ${He(e.bytes)}`,label:e.path},e.path))})]}):(0,W.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`No Tosca export (.tsu) in this project yet. Export the test cases from Tosca Commander, put the file inside the project, for example `,(0,W.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:`tosca/checkout.tsu`}),`, and type its path below.`]}),(0,W.jsx)(Z,{id:`tsc-path`,label:e.exports.length?`Or type its path`:`Path of the export`,help:`Inside the project. Secrets in it stay encrypted: they become environment variables.`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(v,{id:`tsc-path`,value:s,spellCheck:!1,maxLength:300,placeholder:`tosca/checkout.tsu`,onChange:e=>c(e.target.value),className:`min-w-0 flex-[1_1_300px]`}),(0,W.jsx)(C,{disabled:u||!s.trim(),onClick:()=>void g(s.trim()),children:u?`Reading…`:`Read it`})]})}),p&&(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:p}),u&&!p&&(0,W.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Reading the export…`}),r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ue,{s:r}),(0,W.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,W.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Test cases to convert`}),(0,W.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:r.test_cases.map(e=>{let t=e.route===`web`||(e.routes?.web??0)>0;return(0,W.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,W.jsxs)(`label`,{className:y(`flex min-h-11 items-start gap-3 px-4 py-2.5`,t?`cursor-pointer`:``),children:[(0,W.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,disabled:!t,checked:t&&a.has(e.id),onChange:()=>_(e.id)}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),(0,W.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.folders.join(` / `)||`–`,` · `,G(e.steps,`step`),` · `,G(e.asserts,`check`),e.unsupported?` · ${e.unsupported} not convertible`:``,e.suites.length?` · in ${e.suites.join(`, `)}`:``]})]}),(0,W.jsx)(l,{tone:t?`neutral`:`warn`,children:e.route===`web`?K.web:t?`${K.web} + notes`:`${K[e.route]||e.route}: later`})]})},e.id)})})]}),r.env.length>0&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:`Environment variables`}),(0,W.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[r.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`. Their values are never in the export; you set them before the tests run.`]})]})]})]})}function Ge({view:e,to:t,setTo:n,into:r,setInto:i,attr:a,setAttr:o}){let s=e=>e.split(`-`)[0],c=e=>e.split(`-`).slice(1).join(`-`),l=[...new Map(e.targets.map(e=>[s(e.id),e.framework])).entries()],u=e.targets.filter(e=>s(e.id)===s(t));return(0,W.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,W.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,W.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Framework`}),(0,W.jsx)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:l.map(([r,i])=>{let a=se[r];return(0,W.jsx)(Ve,{on:s(t)===r,onPick:()=>n((e.targets.find(e=>s(e.id)===r&&c(e.id)===c(t))||e.targets.find(e=>s(e.id)===r)).id),logo:a?(0,W.jsx)(a,{width:22,height:22,"aria-hidden":`true`}):null,title:i,sub:ze[r],label:i},r)})})]}),(0,W.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,W.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Language`}),(0,W.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:u.map(e=>{let r=oe[c(e.id)];return(0,W.jsx)(Ve,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,W.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,label:e.language},e.id)})})]}),(0,W.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,W.jsx)(Z,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,W.jsx)(v,{id:`tsc-into`,value:r,spellCheck:!1,maxLength:300,placeholder:`tosca-${t}`,onChange:e=>i(e.target.value)})}),(0,W.jsx)(Z,{id:`tsc-attr`,label:`Test id attribute (optional)`,help:`When the app's is not data-test-id, data-testid, data-test, data-cy or data-qa.`,children:(0,W.jsx)(v,{id:`tsc-attr`,value:a,spellCheck:!1,maxLength:40,placeholder:`data-automation-id`,onChange:e=>o(e.target.value.replace(/[^A-Za-z0-9_-]/g,``))})})]})]})}function Ke({view:e,file:t,found:n,only:r,to:i,instructions:a}){let o=e.targets.find(e=>e.id===i),s=(e,t)=>(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-line-soft py-3.5 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:e}),(0,W.jsx)(`div`,{className:`text-sm`,children:t})]});return(0,W.jsxs)(`aside`,{"aria-label":`Summary`,className:`flex flex-col rounded-[14px] card border p-5`,children:[s(`Export`,t?(0,W.jsx)(`span`,{className:`font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:t}):(0,W.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`})),s(`Test cases`,n?(0,W.jsxs)(`span`,{children:[r.size,` of `,n.test_cases.length,` picked`]}):(0,W.jsx)(`span`,{className:`text-muted`,children:`–`})),s(`Target`,o?(0,W.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,W.jsx)(B,{framework:o.id.split(`-`)[0],language:o.id.split(`-`).slice(1).join(`-`)}),o.title]}):(0,W.jsx)(`span`,{className:`text-muted`,children:`–`})),s(`Instructions`,a.trim()?(0,W.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:a.trim()}):(0,W.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}function qe({view:e,review:t,onStart:n}){let[r,i]=(0,U.useState)(0),[a,o]=(0,U.useState)(0),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(new Set),[p,h]=(0,U.useState)(e.targets[0]?.id||``),[_,v]=(0,U.useState)(``),[y,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w,E]=(0,U.useState)(null),[D,O]=(0,U.useState)(!1),[k,A]=(0,U.useState)(!1),[j,M]=(0,U.useState)(``),N=[...d].sort().join(`,`);(0,U.useEffect)(()=>{E(null),O(!1),o(e=>Math.min(e,2))},[s,N,p,_,y,S]);let P=e=>{i(e),o(t=>Math.max(t,e)),M(``)},F=async()=>{A(!0),M(``);try{let e=!l||l.test_cases.filter(e=>e.route===`web`||(e.routes?.web??0)>0).every(e=>d.has(e.id)),t=await m.plan({file:s,to:p,..._.trim()?{into:_.trim()}:{},...e?{}:{only:[...d]},...S.trim()?{instructions:S.trim()}:{},...y?{testAttributes:[y]}:{}});E(t),P(3)}catch(e){M(e.message)}finally{A(!1)}},I=w?.plan,L=I?.feasibility.findings.some(e=>e.level===`limit`),R=I?.feasibility.verdict===`blocked`;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,W.jsx)(Be,{at:r,reached:a,onGo:e=>!k&&(e<3||w)&&i(e)}),(0,W.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,W.jsxs)(`section`,{"aria-labelledby":`tsc-step`,className:`flex min-w-0 flex-col gap-5`,children:[(0,W.jsx)(`h2`,{id:`tsc-step`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:[`Which Tosca export?`,`What should the tests become?`,`Anything the agent should know?`,`Review and start`][r]}),j&&(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:j}),r===0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(We,{view:e,file:s,setFile:c,found:l,setFound:u,only:d,setOnly:f}),(0,W.jsx)(Q,{busy:k,next:`Continue`,onNext:()=>P(1),disabled:!l||!d.size,aside:l&&!d.size?(0,W.jsx)(`span`,{className:`text-muted`,children:`Pick at least one web test case.`}):void 0})]}),r===1&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ge,{view:e,to:p,setTo:h,into:_,setInto:v,attr:y,setAttr:x}),(0,W.jsx)(Q,{busy:k,onBack:()=>i(0),next:`Continue`,onNext:()=>P(2),disabled:!p})]}),r===2&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Z,{id:`tsc-instructions`,label:`Instructions (optional)`,help:`Style and structure for the new code. Every Tosca step and check is kept either way.`,children:(0,W.jsx)(T,{id:`tsc-instructions`,value:S,rows:6,maxLength:4e3,placeholder:`Page objects go in pages/, one class per Tosca module.`,onChange:e=>C(e.target.value)})}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Re.map(e=>(0,W.jsxs)(`button`,{type:`button`,disabled:S.includes(e),onClick:()=>C(S.trim()?`${S.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[8px] border-0 bg-surface-strong px-2.5 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,W.jsx)(ee,{size:13,"aria-hidden":`true`}),e]},e))}),(0,W.jsx)(Q,{busy:k,onBack:()=>i(1),next:k?`Checking…`:`Check the plan`,onNext:()=>void F(),aside:(0,W.jsx)(`span`,{className:`text-muted`,children:`Nothing is changed yet.`})})]}),r===3&&I&&(0,W.jsxs)(W.Fragment,{children:[t(I,D,O),(0,W.jsx)(Q,{busy:k,onBack:()=>i(2),next:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(g,{icon:b,size:15}),`Start conversion`]}),disabled:R||L&&!D,onNext:()=>n(w,!!L&&D),aside:(0,W.jsx)(`span`,{className:`text-muted`,children:R?`Change what is not possible first.`:L&&!D?`Accept the limits to start.`:`Runs in the background.`})})]})]}),(0,W.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,W.jsx)(Ke,{view:e,file:s,found:l,only:d,to:p,instructions:S})})]})]})}function Je({children:e,wide:t}){return(0,W.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,W.jsx)(A,{}),(0,W.jsx)(`main`,{className:y(M,`@container flex-auto gap-5`,t?`max-w-[1480px]`:`max-w-[1180px]`),children:e})]})}function Ye({action:e}){return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(S,{pixel:L.tosca,size:`lg`}),(0,W.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Tosca`})]}),(0,W.jsx)(ie,{label:`Migration`,links:ae,current:`tosca`}),(0,W.jsx)(`span`,{className:`flex-1`}),e]})}function $({error:e}){return e?(0,W.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}function Xe({title:e,children:n}){let[r,i]=(0,U.useState)(!1),a=(0,U.useId)();return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,onClick:()=>i(!r),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,W.jsx)(I,{size:15,"aria-hidden":`true`,className:y(`transition-transform`,r&&`rotate-180`)}),e]}),(0,W.jsx)(t,{open:r,id:a,children:n})]})}function Ze({plan:t,accepted:n,onAccept:r}){let i=t.feasibility.findings.filter(e=>e.level===`blocker`),a=t.feasibility.findings.filter(e=>e.level===`limit`),o=t.cases.filter(e=>e.included),s=t.units.filter(e=>e.kind===`page`).length;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,W.jsxs)(`dl`,{className:`m-0 grid gap-x-6 gap-y-2.5 rounded-[14px] card border px-5 py-4 text-sm @xl:grid-cols-[auto_1fr]`,children:[(0,W.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,W.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[`Tricentis Tosca`,(0,W.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,(0,W.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:t.source.file}),t.source.project?` · ${t.source.project}`:``]})]}),(0,W.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,W.jsxs)(`dd`,{className:`m-0`,children:[t.target.title,(0,W.jsxs)(`span`,{className:`text-muted`,children:[` · `,t.target.dir]})]}),(0,W.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,W.jsxs)(`dd`,{className:`m-0`,children:[o.length,` test`,o.length===1?``:`s`,` of `,t.cases.length,` test case`,t.cases.length===1?``:`s`,`, `,s,` page object`,s===1?``:`s`]}),(t.suites||[]).length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`dt`,{className:`text-muted`,children:`Suites`}),(0,W.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[t.suites.map(e=>`${e.name} (${G(e.cases.length,`test`)})`).join(`, `),(0,W.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[`Tosca's execution lists, as tags on the tests: `,t.suites.map(e=>`@${e.tag}`).join(`, `),`.`]})]})]}),t.env.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`dt`,{className:`text-muted`,children:`Environment variables`}),(0,W.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[t.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),(0,W.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Never in the export: you set them before the tests run.`})]})]}),t.instructions&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,W.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:t.instructions})]})]}),i.length>0&&(0,W.jsxs)(`section`,{"aria-labelledby":`tsc-blockers`,className:`flex flex-col gap-2 rounded-[14px] bg-fail-soft px-5 py-4`,children:[(0,W.jsxs)(`h3`,{id:`tsc-blockers`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-fail`,children:[(0,W.jsx)(e,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,W.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-5 text-sm text-ink`,children:i.map(e=>(0,W.jsx)(`li`,{children:e.text},e.code))})]}),a.length>0&&(0,W.jsxs)(`section`,{"aria-labelledby":`tsc-limits`,className:`flex flex-col gap-3 rounded-[14px] bg-warn-soft px-5 py-4`,children:[(0,W.jsxs)(`h3`,{id:`tsc-limits`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-warn`,children:[(0,W.jsx)(e,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,W.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1.5 pl-5 text-sm text-ink`,children:a.map(e=>(0,W.jsx)(`li`,{children:e.text},e.code))}),r&&!i.length&&(0,W.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm font-medium`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!n,onChange:e=>r(e.target.checked)}),`I understand`]})]}),(0,W.jsx)(Xe,{title:`Test cases (${t.cases.length})`,children:(0,W.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:t.cases.map(e=>(0,W.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-3 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,W.jsx)(`span`,{className:y(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,W.jsx)(`span`,{className:`text-muted`,children:e.included?`${G(e.steps,`step`)} · ${G(e.asserts,`check`)}`:e.why}),(0,W.jsx)(`span`,{className:`w-16 flex-none text-right text-muted`,children:K[e.route]||e.route})]},e.id))})}),(0,W.jsx)(Xe,{title:`Files, in order (${t.units.length})`,children:(0,W.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:t.units.map(e=>(0,W.jsxs)(`li`,{className:`flex flex-wrap gap-x-3 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,W.jsx)(`span`,{className:`w-16 flex-none text-muted`,children:he[e.kind]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:e.target})]},e.id))})})]})}function Qe({plan:e,acceptLimits:t,onClose:n,onStarted:i}){let[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(``),d=async()=>{c(!0),u(``);try{i((await m.start(e.id,a,t)).detail)}catch(e){u(e.message),c(!1)}};return(0,W.jsx)(r,{open:!0,onClose:n,title:`Start the conversion`,description:`The Tosca test cases are written as ${e.target.title} tests in ${e.target.dir}, and ForgeQE runs each one. It runs in the background; the Tosca export is not changed.`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,W.jsx)(C,{variant:`primary`,disabled:s||a!==e.id,onClick:()=>void d(),children:`Start conversion`})]}),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,W.jsxs)(`span`,{children:[`Type `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,W.jsx)(v,{value:a,onChange:e=>o(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,W.jsx)($,{error:l})]})})}function $e({d:e,onStarted:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(!1),o=e.plan.feasibility.findings.some(e=>e.level===`limit`),s=e.plan.feasibility.verdict===`blocked`,c=!!e.job?.running;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.job?.last&&!c&&(0,W.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,W.jsx)(Ze,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!s&&!c&&(0,W.jsx)(`div`,{children:(0,W.jsxs)(C,{variant:`primary`,disabled:!e.confirmed&&o&&!n,onClick:()=>a(!0),children:[(0,W.jsx)(b,{"aria-hidden":`true`}),`Start conversion`]})}),i&&(0,W.jsx)(Qe,{plan:e.plan,acceptLimits:o&&(e.confirmed||n),onClose:()=>a(!1),onStarted:e=>{a(!1),t(e)}})]})}function et(e){return e.result?.status===`running`?`running`:e.result?.status===`converted`?`done`:e.result?`review`:`planned`}function tt(e){return e.result?pe[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:fe[e.verdict]}var nt=e=>e.slice(e.lastIndexOf(`/`)+1);function rt({view:e}){let[t,n]=(0,U.useState)(`all`),r=t=>t===`all`?e.plans.length:e.plans.filter(e=>et(e)===t).length,a=e.plans.filter(e=>t===`all`||et(e)===t),o=e=>location.hash=i(`tosca`,e);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(ce,{children:[(0,W.jsx)(H,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,W.jsx)(H,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,W.jsx)(H,{label:`Converted`,value:r(`done`),tone:r(`done`)?`text-pass`:void 0,onClick:()=>n(`done`),on:t===`done`}),(0,W.jsx)(H,{label:`Needs review`,value:r(`review`),tone:r(`review`)?`text-warn`:void 0,onClick:()=>n(`review`),on:t===`review`})]}),(0,W.jsx)(N,{label:`Conversions`,placeholder:`Find a conversion`,empty:t===`all`?`No conversions.`:`None here.`,resetKey:t,head:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Conversion`}),(0,W.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Tests`}),(0,W.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Status`}),(0,W.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Updated`})]}),children:a.map(e=>{let t=tt(e),n=e.result?e.result.status===`converted`||e.result.endedAt?100:Math.min(99,Math.round(e.result.done/Math.max(1,e.units||e.tests+1)*95)):0;return(0,W.jsxs)(`tr`,{onClick:()=>o(e.id),className:j,children:[(0,W.jsx)(`td`,{className:E,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`span`,{className:`hidden flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:(0,W.jsx)(B,{framework:e.targetId.split(`-`)[0],language:e.targetId.split(`-`).slice(1).join(`-`),size:18})}),(0,W.jsxs)(`span`,{className:`min-w-0`,children:[(0,W.jsxs)(`a`,{href:i(`tosca`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:[nt(e.file),` to `,e.target]}),(0,W.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.project?`${e.project} · `:``,e.into]})]})]})}),(0,W.jsx)(`td`,{className:y(E,`w-[180px] text-[13px]`),children:e.result?.status===`running`?(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(de,{value:n,label:`${nt(e.file)} to ${e.target}: progress`}),(0,W.jsxs)(`span`,{className:`w-9 flex-none text-right text-[12px] text-muted tabular-nums`,children:[n,`%`]})]}):e.result?(0,W.jsxs)(`span`,{className:e.result.converted===e.tests?`text-pass`:`text-ink-2`,children:[e.result.converted,` of `,e.tests,` pass`]}):(0,W.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,W.jsx)(`td`,{className:y(E,`whitespace-nowrap`),children:(0,W.jsx)(l,{tone:t.tone,children:t.label})}),(0,W.jsx)(`td`,{className:y(E,`hidden text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`),children:z(e.result?.endedAt||e.result?.at||e.createdAt)})]},e.id)})})]})}function it({sub:e}){let[t,r]=(0,U.useState)(null),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(null),l=(0,U.useCallback)(()=>{m.list().then(e=>{r(e),o(``)},e=>o(e.message))},[]);(0,U.useEffect)(l,[l,e]);let u=t?.plans.some(e=>e.result?.status===`running`);(0,U.useEffect)(()=>{if(!u||e)return;let t=setInterval(l,3e3);return()=>clearInterval(t)},[u,e,l]);let d=e&&/^tsc-\d{8}-\d{6}-[0-9a-f]{4}$/.test(e)?e:``,f=()=>location.hash=i(`tosca`,`new`),p=!t&&!a&&(0,W.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});return e===`new`?(0,W.jsxs)(Je,{children:[(0,W.jsx)(Ye,{}),(0,W.jsx)($,{error:a}),p,t&&(0,W.jsx)(qe,{view:t,review:(e,t,n)=>(0,W.jsx)(Ze,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>c({d:e,accept:t})}),s&&(0,W.jsx)(Qe,{plan:s.d.plan,acceptLimits:s.accept,onClose:()=>c(null),onStarted:e=>{c(null),location.hash=i(`tosca`,e.plan.id)}})]}):d?(0,W.jsxs)(Je,{wide:!0,children:[(0,W.jsx)(Ye,{}),(0,W.jsx)($,{error:a}),p,t&&(0,W.jsx)(Fe,{id:d,plan:(e,t)=>(0,W.jsx)($e,{d:e,onStarted:t})},d)]}):(0,W.jsxs)(Je,{children:[(0,W.jsx)(Ye,{action:t&&!t.plans.length?void 0:(0,W.jsx)(C,{variant:`primary`,disabled:!t,onClick:f,children:`New conversion`})}),(0,W.jsx)($,{error:a}),p,t&&(t.plans.length?(0,W.jsx)(rt,{view:t}):(0,W.jsx)(F,{icon:n,title:`No Tosca conversions yet`,action:(0,W.jsx)(C,{size:`sm`,onClick:f,children:`New conversion`}),children:`Pick a Tosca export (.tsu) in this project and the framework its test cases become. Every Tosca step and check is kept, and nothing starts until you confirm.`}))]})}export{it as Tosca};