@capagents/forgeqe 2.4.5 → 2.4.7

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 (52) hide show
  1. package/HOW_TO_USE.md +21 -1
  2. package/dist/docs-site/docs/index.html +24 -3
  3. package/dist/docs-site/docs/search.js +1 -1
  4. package/dist/docs-site/docs/web-app/index.html +19 -3
  5. package/dist/forgeqe.js +1006 -1044
  6. package/dist/template.html +4 -4
  7. package/dist/web/assets/ApiTests-D5YLst-t.js +2 -0
  8. package/dist/web/assets/Chat-DUZawyA0.js +3 -0
  9. package/dist/web/assets/{Data-M-G4Y2k9.js → Data-BOu8BrmB.js} +4 -4
  10. package/dist/web/assets/Features-BCBzUoB7.js +1 -0
  11. package/dist/web/assets/Jobs-C-Tqj504.js +3 -0
  12. package/dist/web/assets/Quality-CzCArgrj.js +1 -0
  13. package/dist/web/assets/Record-CcHMCfs6.js +1 -0
  14. package/dist/web/assets/Regression-CgiNh2hj.js +2 -0
  15. package/dist/web/assets/Reports-CXRY0udx.js +2 -0
  16. package/dist/web/assets/Response-VUbDhVeF.js +8 -0
  17. package/dist/web/assets/Runs-kghxBY8X.js +2 -0
  18. package/dist/web/assets/capgemini-BO8ajcbd.svg +21 -0
  19. package/dist/web/assets/{circle-dashed-ODPnEo8f.js → circle-dashed-CQKCycSk.js} +1 -1
  20. package/dist/web/assets/{external-link-S8aL0KIN.js → external-link-B45wnQ3R.js} +1 -1
  21. package/dist/web/assets/{file-chart-column-increasing-D6q2iZ64.js → file-chart-column-increasing-9rCBQxTk.js} +1 -1
  22. package/dist/web/assets/frame-CHQgOaj6.js +3 -0
  23. package/dist/web/assets/index-CwX6YH3i.css +2 -0
  24. package/dist/web/assets/index-Hd8gmpz5.js +26 -0
  25. package/dist/web/assets/{markdown-4IJa7wkI.js → markdown-BPBR6Fva.js} +7 -7
  26. package/dist/web/assets/{sticky-note-i4oBl2S1.js → sticky-note-D_lJfPYH.js} +1 -1
  27. package/dist/web/assets/{terminal-Cb_EtWVl.js → terminal-BZSHVR9y.js} +1 -1
  28. package/dist/web/assets/{trending-up-Cxt0Wl0_.js → trending-up-Bypj2D7Z.js} +1 -1
  29. package/dist/web/index.html +3 -3
  30. package/docs/WEB_APP.md +20 -3
  31. package/docs/user-guide.html +24 -3
  32. package/docs/walkthrough/hotfix-narration.md +606 -0
  33. package/docs/walkthrough/index.html +238 -39
  34. package/forgeqe.example.yaml +13 -0
  35. package/package.json +1 -1
  36. package/prompts/brain.md +1 -0
  37. package/py/forgeqe_mobile/hyperexecute.py +1 -0
  38. package/dist/web/assets/ApiTests-BKeFkLyV.js +0 -2
  39. package/dist/web/assets/Chat-dwxejH0o.js +0 -3
  40. package/dist/web/assets/Features-EJv_T9B8.js +0 -1
  41. package/dist/web/assets/Jobs-5A8NDMou.js +0 -3
  42. package/dist/web/assets/Quality-DIhsU907.js +0 -1
  43. package/dist/web/assets/Record-D7BkDgkZ.js +0 -1
  44. package/dist/web/assets/Regression-CbnOqFND.js +0 -2
  45. package/dist/web/assets/Reports-Duxt7oC1.js +0 -2
  46. package/dist/web/assets/Response-B2lhSJ1u.js +0 -8
  47. package/dist/web/assets/Runs-6M-obw2F.js +0 -2
  48. package/dist/web/assets/frame-pVqMQRrR.js +0 -3
  49. package/dist/web/assets/index-BAI8SJTX.css +0 -2
  50. package/dist/web/assets/index-Cu314_Zs.js +0 -26
  51. package/dist/web/assets/rotate-ccw-BgnQpY8R.js +0 -1
  52. package/dist/web/assets/trash-zYYpxA_X.js +0 -1
@@ -17,9 +17,9 @@ Error generating stack: `+e.message+`
17
17
  `)[0]}`:e.kind===`slow`?`Slow request (${V(e.ms||0)}): ${e.url||e.text}`:e.text}function Da(e){return e.timeline.map(e=>e.actions.map(e=>e.text).join(`; `)||e.goal||e.url)}function Oa(e){let t=e.history.find(e=>e.current),n=t?[...e.history].reverse().find(e=>!e.current&&e.at<t.at):void 0;if(!t||!n)return;let r=new Map(n.cases.map(e=>[e.id,e])),i=new Map(t.cases.map(e=>[e.id,e])),a=t.cases.map(e=>({...e,before:r.get(e.id)})),o=e=>e!==void 0&&e!==`stopped`,s=a.filter(e=>o(e.status)&&o(e.before?.status)&&e.before.ms>0),c=e=>e.ms-e.before.ms,l=e=>Math.abs(c(e))>=5e3&&Math.abs(c(e))/e.before.ms>=.25;return{prev:n,cur:t,newFailures:a.filter(e=>aa(e.status)&&e.before?.status===`passed`),fixed:a.filter(e=>e.status===`passed`&&aa(e.before?.status)),stillFailing:a.filter(e=>aa(e.status)&&aa(e.before?.status)),added:a.filter(e=>!e.before),removed:n.cases.filter(e=>!i.has(e.id)),slower:s.filter(e=>c(e)>0&&l(e)).sort((e,t)=>c(t)-c(e)),faster:s.filter(e=>c(e)<0&&l(e)).sort((e,t)=>c(e)-c(t)),tokens:t.tokens-n.tokens,ms:t.ms-n.ms}}function ka(e){let t=0,n=0,r=0;for(let i of e.timeline){let e=i.ms||0;i.source===`memory`?r+=e:(t+=Math.min(e,i.model_ms||0),n+=Math.max(0,e-(i.model_ms||0)))}return{model:t,browser:n,memory:r,total:t+n+r}}function Aa(e){let t=e.filter(e=>e.memory?.replayed&&e.memory.baseline).map(e=>({c:e,tokens:Math.max(0,e.memory.baseline.tokens-e.tokens),ms:Math.max(0,e.memory.baseline.ms-e.ms)}));return{rows:t,tokens:t.reduce((e,t)=>e+t.tokens,0),ms:t.reduce((e,t)=>e+t.ms,0),replayed:e.reduce((e,t)=>e+(t.memory?.replayed||0),0),withMemory:e.filter(e=>e.memory).length,heals:e.reduce((e,t)=>e+(t.memory?.heals?.length||0),0),repaired:e.filter(e=>e.memory?.repaired).length}}var ja=e=>ga(e,e=>[e.group||`${Xi(e.source)} (no group)`]),Ma=[`critical`,`serious`,`moderate`,`minor`];function Na(e){let t=new Map;for(let n of e)for(let e of n.accessibility||[]){let r=e.url.split(`#`)[0],i=t.get(r);i?i.cases.includes(n.id)||i.cases.push(n.id):t.set(r,{url:e.url,title:e.title,engine:e.engine,issues:e.issues,cases:[n.id]})}return[...t.values()].sort((e,t)=>t.issues.reduce((e,t)=>e+t.count,0)-e.issues.reduce((e,t)=>e+t.count,0))}function Pa(e){return{agent:e.agent,job:e.job,task:e.task||``,purpose:e.purpose,model:e.model,user:e.user,machine:e.machine,caseId:e.caseId||``,calls:1,input:e.input,cached:e.cached||0,cacheWrite:e.cacheWrite||0,output:e.output,amount:e.amount||0,priced:e.amount===void 0?0:1,estimate:!!e.estimate,errors:+(e.outcome===`error`),ms:e.ms||0,currency:e.currency}}function Fa(e){return{agent:e.agent,job:e.job,task:``,purpose:e.purpose,model:e.model,user:e.user,machine:e.machine,caseId:``,calls:e.calls,input:e.input,cached:e.cached,cacheWrite:e.cacheWrite,output:e.output,amount:e.amount,priced:e.calls-e.unpriced,estimate:!1,errors:e.errors,ms:0,currency:e.currency}}function Ia(e){let t=Math.min(e.cached||0,e.input),n=Math.min(e.cacheWrite||0,e.input-t);return{fresh:e.input-t-n,cached:t,write:n,output:e.output}}function La(e){let t=e.reduce((e,t)=>({...e,calls:e.calls+t.calls,input:e.input+t.input,cached:e.cached+t.cached,cacheWrite:e.cacheWrite+t.cacheWrite,output:e.output+t.output,amount:e.amount+t.amount,priced:e.priced+t.priced,estimate:e.estimate||t.estimate,errors:e.errors+t.errors,ms:e.ms+t.ms,currency:e.currency||t.currency}),{agent:``,job:``,task:``,purpose:``,model:``,user:``,machine:``,caseId:``,calls:0,input:0,cached:0,cacheWrite:0,output:0,amount:0,priced:0,estimate:!1,errors:0,ms:0});return{...t,tokens:t.input+t.output}}function Ra(e,t){let n=new Map;for(let r of e){let e=r[t]||``,i=n.get(e);i?i.push(r):n.set(e,[r])}return[...n.entries()].map(([e,t])=>({name:e,rows:t,...La(t)})).sort((e,t)=>t.amount-e.amount||t.tokens-e.tokens)}function za(e){if(e.priced&&e.currency)return{amount:e.amount,currency:e.currency,...e.estimate?{estimate:!0,note:`part of it is the agent runtime's own price, or cached input at a derived rate`}:{}}}function Ba(e){return J(e.cached,e.input)}function Va(e,t){if(!e.length)return 0;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]}function Ha(e){return Ra(e.map(Pa),`model`).map(t=>{let n=e.filter(e=>e.model===t.name),r=n.map(e=>e.ms||0).filter(Boolean);return{...t,provider:n.find(e=>e.provider)?.provider,p50:Va(r,.5),p95:Va(r,.95),timed:r.length,perMillion:t.priced&&t.tokens?t.amount/t.tokens*1e6:void 0}})}var Ua=864e5;function Wa(e,t,n){let r=Date.parse(`${n.slice(0,10)}T00:00:00Z`),i=[...new Set(e.map(e=>e.agent))];return{days:Array.from({length:t},(n,a)=>{let o=new Date(r-(t-1-a)*Ua).toISOString().slice(0,10),s=e.filter(e=>e.day===o),c={day:o,label:new Date(`${o}T00:00:00Z`).toLocaleDateString(void 0,{day:`2-digit`,month:`short`,timeZone:`UTC`}),amount:s.reduce((e,t)=>e+t.amount,0),tokens:s.reduce((e,t)=>e+t.input+t.output,0),calls:s.reduce((e,t)=>e+t.calls,0)};for(let e of i)c[e]=s.filter(t=>t.agent===e).reduce((e,t)=>e+t.amount,0);return c}),agents:i}}function Ga(e,t){let n=t.slice(0,10),r=n.slice(0,7),i=new Date(`${n}T00:00:00Z`),a=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+1,0)).getUTCDate(),o=a-i.getUTCDate(),s=e.filter(e=>e.day.startsWith(r)&&e.day<=n).reduce((e,t)=>e+t.amount,0),c=e.filter(e=>e.day<=n).slice(-14).map(e=>e.amount),l=c.length?c.reduce((e,t)=>e+t,0)/c.length:0,u=c.length>1?Math.sqrt(c.reduce((e,t)=>e+(t-l)**2,0)/(c.length-1)):0,d=e.filter(e=>u>0&&e.amount>l+2*u).map(e=>e.day);return{month:r,spent:s,left:o,daysInMonth:a,perDay:l,sd:u,projected:s+l*o,low:s+Math.max(0,l-u)*o,high:s+(l+u)*o,basedOn:c.length,unusual:d}}function Ka(e,t){return(e.fresh*t.input+e.cached*(t.cachedInput??t.input)+e.write*t.input+e.output*t.output)/1e6}function qa(e,t){let n=Math.max(1,t);return Ra(e.map(Pa),`agent`).map(e=>{let t=Ia(e);return{agent:e.name,model:Ra(e.rows,`model`)[0]?.name||``,calls:e.calls/n,kinds:{fresh:t.fresh/n,cached:t.cached/n,write:t.write/n,output:t.output/n},amount:e.priced?e.amount/n:void 0,estimate:e.estimate,currency:e.currency}})}function Ja(e,t,n){let r=t.env?.profiles?.find(t=>t.model===e)?.price||(t.env?.price&&t.env.model.includes(`/${e})`)?t.env.price:void 0);return r&&(!n||r.currency===n)?r:void 0}var Ya=[`judge`,`refiner`,`reviewer`,`root-cause analyst`];function Xa(e){let t=e.usage?.calls||[];if(!t.length)return[];let n=t.map(Pa),r=La(n).currency,i=[],a=e.usage?.history||[],o=(e,t,n)=>{let r=a.filter(t=>t.agent===e).reduce((e,t)=>e+t.amount,0);return n>0&&r>0?t/n*r:void 0};for(let t of Ra(n,`agent`)){let n=Ra(t.rows,`model`)[0]?.name||``,a=Ja(n,e,r),s=Ia(t),c=Ba(t);if(t.input>=5e4&&c<50){let e=s.fresh+s.cached,n=Math.max(0,e*.7-s.cached),l=a&&a.cachedInput!==void 0?n*(a.input-a.cachedInput)/1e6:void 0;i.push({id:`cache-${t.name}`,title:c<1?`${t.name}: none of the prompt came from the cache`:`${t.name}: only ${c}% of the prompt came from the cache`,tone:`warn`,...l?{saving:l,monthly:o(t.name,l,t.amount),currency:r}:{},area:t.name,evidence:[`${H(Math.round(t.input))} prompt tokens over ${t.calls} calls, ${H(Math.round(s.cached))} of them read from the cache.`,...l?[`At 70% from the cache, ${H(Math.round(n))} more tokens would have cost the cached rate instead of the input rate.`]:[`No cached price is known for this model, so the saving cannot be priced: set price.cached_input in llms.json.`]],how:[`Providers cache the start of a prompt that repeats, and only prompts of 1,024 tokens or more.`,`Keep what changes from call to call (page text, results, dates) at the end of the prompt, after the parts that stay the same.`,`A team copy of a ForgeQE prompt (.forgeqe/prompts) that adds changing text near its start breaks the cache for every call.`]})}if(Ya.includes(t.name)&&t.priced&&a){let a=(e.env?.profiles||[]).filter(e=>e.model!==n&&e.price.currency===r).map(e=>({p:e,cost:Ka(s,e.price)})).sort((e,t)=>e.cost-t.cost)[0];if(a&&a.cost<t.amount*.7){let e=t.amount-a.cost;i.push({id:`model-${t.name}`,title:`${t.name}: ${a.p.model} would cost ${Math.round(100*a.cost/t.amount)}% of ${n}`,tone:`brand`,saving:e,monthly:o(t.name,e,t.amount),currency:r,area:t.name,evidence:[`${t.calls} calls on ${n} cost ${W(t.amount,r)}; the same tokens on ${a.p.name} (${a.p.model}) cost ${W(a.cost,r)}.`,`The ${t.name}'s work is checking and summing up, which a smaller model often does as well; try it on a few runs before switching.`],how:t.name===`reviewer`?[`Set code.review_profile: ${a.p.name} in forgeqe.yaml.`]:[`The Calculator page prices the ${t.name} on ${a.p.name}.`,`Only the reviewer has its own model setting today (code.review_profile); llm.active changes the model of every agent.`]})}}}let s=n.filter(e=>e.errors);if(s.length){let e=La(s);i.push({id:`failed`,title:`${U(s.length,`call`)} failed after spending ${H(Math.round(e.tokens))} tokens`,tone:`fail`,...e.priced?{saving:e.amount,currency:r}:{},area:[...new Set(s.map(e=>e.agent))].join(`, `),evidence:[...new Set(s.map(e=>`${e.agent}, ${e.job}`))].slice(0,4),how:[`The Model calls page lists them: open one for its run and test case.`,`A browser run that fails on the model (a timeout, a refused key) is in its run folder's trace.md.`]})}let c=new Map;for(let e of t)e.session&&e.agent===`ForgeQE's agent`&&c.set(e.session,[...c.get(e.session)||[],e]);let l=[...c.values()].filter(e=>e.length>=4&&e[e.length-1].input>=2*e[0].input);if(l.length){let t=l.flatMap(e=>e.map(t=>({c:t,over:Math.max(0,t.input-e[0].input)}))),n=Ja(l[0][0].model,e,r),a=n?t.reduce((e,{c:t,over:r})=>e+(r*((t.cached||0)/Math.max(1,t.input))*(n.cachedInput??n.input)+r*(1-(t.cached||0)/Math.max(1,t.input))*n.input)/1e6,0):void 0,o=l.sort((e,t)=>t.length-e.length)[0];i.push({id:`context`,title:`ForgeQE's agent: the conversation grew to ${H(Math.round(o[o.length-1].input))} tokens a call`,tone:`warn`,...a?{saving:a,upTo:!0,currency:r}:{},area:`ForgeQE's agent`,evidence:[`In ${U(l.length,`conversation`)}, the prompt at least doubled from the first call to the last; the longest went from ${H(Math.round(o[0].input))} to ${H(Math.round(o[o.length-1].input))} tokens over ${o.length} calls.`,`Each call sends the whole conversation again; the saving is what the growth cost, the most a fresh start could save.`],how:[`Start a new shell session (quit and run forgeqe again) for an unrelated task: /clear clears the screen but keeps the conversation.`,`Ask for one thing at a time; a long run of results read into the chat stays in every later call.`]})}let u=e.cases.filter(e=>e.memory?.mode===`verify`&&e.memory.replayTotal>0&&e.memory.replayed===e.memory.replayTotal);if(u.length){let e=new Set(u.map(e=>e.id)),t=La(n.filter(t=>t.agent===`browser agent`&&e.has(t.caseId)));t.priced&&i.push({id:`replay`,title:`${U(u.length,`test`)} replayed every step from page memory and still called the model to check`,tone:`brand`,saving:t.amount,upTo:!0,monthly:o(`browser agent`,t.amount,La(n.filter(e=>e.agent===`browser agent`)).amount),currency:r,area:`browser agent`,evidence:[`With memory.replay: verify, each replayed test asks the model to confirm the result; these calls cost ${W(t.amount,r)}.`],how:[`memory.replay: trust in forgeqe.yaml skips the check for a test whose every step replayed; a change in the app is then caught only by the test's own checks.`,`Keep verify for tests that check what the model sees (wording, layout) and trust for the rest.`]})}let d=e.cases.filter(e=>e.status!==`stopped`);if(d.length>5&&!d.some(e=>e.memory)){let t=La(n.filter(t=>t.agent===`browser agent`&&e.cases.some(e=>e.id===t.caseId&&e.status===`passed`)));i.push({id:`memory`,title:`Page memory is off`,tone:`warn`,...t.priced?{saving:t.amount,upTo:!0,currency:r}:{},area:`browser agent`,evidence:[`None of the ${d.length} tests replayed from page memory; the tests that passed cost ${W(t.amount,r)} in browser agent calls.`],how:[`memory.enabled: true in forgeqe.yaml replays the steps of a test that passed before without the model; the saving is the most it could be, on a rerun where nothing changed.`]})}let f=t.filter(e=>e.amount===void 0);return f.length&&i.push({id:`price`,title:`${U(f.length,`call`)} ${f.length===1?`has`:`have`} no price`,tone:`warn`,area:[...new Set(f.map(e=>e.model))].join(`, `),evidence:[`${H(Math.round(La(f.map(Pa)).tokens))} tokens are counted but not in any cost on these pages.`],how:[`Add price (input, output and cached_input, per million) to the profile of each model in llms.json.`]}),i.sort((e,t)=>(t.saving||0)-(e.saving||0))}function Za(e){return e.diagnostics?e.diagnostics.consoleErrors+e.diagnostics.failedRequests:Ta(e).filter(e=>e.level===`error`).length}function Qa(e){return e.accessibility?.length?e.accessibility.reduce((e,t)=>e+t.issues.reduce((e,t)=>e+t.count,0),0):void 0}function $a({data:e,page:t,onNavigate:n,collapsed:r=!1,onToggle:i}){let a=e.cases.filter(e=>aa(e.status)).length,o=ma(e.history).length,s=(e.defects||[]).filter(e=>e.cases.length>1).length,c=Oa(e),l=e.cases.some(e=>e.diagnostics?.pagesChecked||e.accessibility?.length),u=e.cases.some(e=>e.quality?.performance.length),d=e.cases.filter(e=>e.quality?.breaches.some(e=>e.kind===`performance`)).length,f=e.cases.some(e=>e.quality?.visual?.length),p=e.cases.reduce((e,t)=>e+(t.quality?.visual||[]).filter(e=>e.status===`changed`).length,0),m=(e.flows?.results||[]).filter(e=>e.error||!e.ok).length,h=e.kind===`flows`?e.flows?.traces||[]:e.cases.flatMap(e=>e.trace?[e.trace]:[]),g=h.filter(e=>!e.ok).length,_=e.kind===`flows`?[{name:`Data flows`,items:[...e.flows?.results.length||!e.flows?.traces.length?[{id:`overview`,label:`Flow map`,icon:Ai,badge:m||void 0,tone:`fail`}]:[],...e.flows?.traces.length?[{id:`traces`,label:`Records followed`,icon:Pr,badge:g||void 0,tone:`fail`}]:[]]}]:e.kind===`data`?[{name:`Report`,items:[{id:`overview`,label:`Overview`,icon:An},{id:`results`,label:e.report?.datasets.length===1?e.report.datasets[0].name:`Rows`,icon:oi,badge:e.report?.datasets.reduce((e,t)=>e+t.rows.length,0)||void 0},{id:`sources`,label:`Sources`,icon:Ht,badge:e.report?.sources.length||void 0}]}]:[{name:`This run`,items:[{id:`overview`,label:`Overview`,icon:An},{id:`results`,label:`Test results`,icon:ut},{id:`failures`,label:`Failures`,icon:ct,badge:a||void 0,tone:`fail`},...e.kind===`suite`?[{id:`defects`,label:`Defects`,icon:vt,badge:s||void 0,tone:`fail`}]:[],...e.kind===`suite`?[{id:`changes`,label:`Since last run`,icon:on,badge:c?.newFailures.length||void 0,tone:`fail`}]:[],...h.length?[{id:`traces`,label:`Records followed`,icon:Pr,badge:g||void 0,tone:`fail`}]:[]]},{name:`Analysis`,items:[{id:`trends`,label:`Trends`,icon:Re},{id:`flaky`,label:`Flaky tests`,icon:qt,badge:o||void 0,tone:`warn`},{id:`timing`,label:`Time and cost`,icon:$t},{id:`coverage`,label:`Coverage`,icon:On},...l?[{id:`accessibility`,label:`Accessibility`,icon:te}]:[],...f?[{id:`visual`,label:`Visual`,icon:vn,badge:p||void 0,tone:`warn`}]:[],...u?[{id:`performance`,label:`Performance`,icon:mi,badge:d||void 0,tone:`fail`}]:[]]},...e.usage?[{name:`Tokenomics`,items:[{id:`usage`,label:`Usage`,icon:gt},{id:`breakdown`,label:`Breakdown`,icon:He},{id:`calls`,label:`Model calls`,icon:Kn,badge:e.usage.calls.filter(e=>e.outcome===`error`).length||void 0,tone:`fail`},{id:`models`,label:`Models`,icon:St},{id:`forecast`,label:`Trends and forecast`,icon:vi},{id:`calculator`,label:`Calculator`,icon:Oe},{id:`optimise`,label:`Optimise`,icon:Mn,badge:Xa(e).filter(e=>e.saving!==void 0).length||void 0,tone:`warn`}]}]:[],...e.env?[]:[{name:`Setup`,items:[{id:`environment`,label:`Environment`,icon:we}]}]],y=sa(e),b=oa(e),x=(0,v.useRef)(null);return(0,v.useEffect)(()=>{x.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView({block:`nearest`})},[t,r]),(0,B.jsxs)(`aside`,{className:`sidebar${r?` collapsed`:``}`,children:[(0,B.jsxs)(`div`,{className:`brand-row`,children:[r?(0,B.jsx)(`img`,{className:`brand-icon`,src:Vi,width:30,height:30,alt:`ForgeQE`}):(0,B.jsx)(Hi,{height:40}),i?(0,B.jsx)(`button`,{type:`button`,className:`nav-collapse`,onClick:i,"aria-label":r?`Expand the menu`:`Collapse the menu`,title:r?`Expand the menu`:`Collapse the menu`,children:r?(0,B.jsx)(fr,{size:16}):(0,B.jsx)(ur,{size:16})}):null]}),e.kind!==`data`&&b.total?(0,B.jsxs)(`button`,{type:`button`,className:`nav-run ${y===`Passed`?`pass`:y===`Failed`?`fail`:`warn`}`,onClick:()=>n(`overview`),title:`${e.title}: ${y.toLowerCase()}, ${b.passed} of ${b.total} passed`,children:[(0,B.jsx)(ta,{status:y===`Passed`?`passed`:y===`Failed`?`failed`:`stopped`,size:16}),(0,B.jsxs)(`span`,{className:`nav-run-text`,children:[(0,B.jsx)(`strong`,{children:y}),(0,B.jsxs)(`span`,{children:[b.passed.toLocaleString(),` of `,b.total.toLocaleString(),` passed · `,b.passRate,`%`]})]})]}):null,(0,B.jsx)(`nav`,{className:`nav-list`,"aria-label":`Report pages`,ref:x,children:_.map(e=>(0,B.jsxs)(`div`,{className:`nav-group`,children:[(0,B.jsx)(`span`,{className:`nav-group-name`,children:e.name}),e.items.map(({id:e,label:i,icon:a,badge:o,tone:s})=>(0,B.jsxs)(`button`,{type:`button`,className:`nav-item${t===e?` active`:``}`,"aria-current":t===e?`page`:void 0,"aria-label":r?`${i}${o?`, ${o}`:``}`:void 0,title:r?`${i}${o?` (${o})`:``}`:void 0,onClick:()=>n(e),children:[(0,B.jsx)(a,{size:16,strokeWidth:1.7}),(0,B.jsx)(`span`,{className:`nav-label`,children:i}),o?(0,B.jsx)(`span`,{className:`badge-count ${s||``}`,children:o.toLocaleString()}):null]},e))]},e.name))}),e.env?(0,B.jsxs)(`button`,{type:`button`,className:`sidebar-foot${t===`environment`?` active`:``}`,"aria-current":t===`environment`?`page`:void 0,onClick:()=>n(`environment`),title:e.framework?`Test framework and environment: ${e.framework}`:`Model and environment: ${e.env.model}`,children:[(0,B.jsx)(`span`,{className:`foot-avatar`,children:(0,B.jsx)(Qr,{size:15})}),(0,B.jsxs)(`span`,{className:`foot-text`,children:[(0,B.jsx)(`strong`,{children:e.framework||e.env.model.split(` `)[0]}),(0,B.jsx)(`span`,{children:e.framework?`ran the tests`:e.env.model.replace(/^\S+\s*/,``).replace(/^\((.*)\)$/,`$1`)||`browser agent`})]}),(0,B.jsx)(Xe,{size:15,className:`foot-chevron`})]}):null]})}var eo={USD:et,CAD:et,AUD:et,NZD:et,SGD:et,HKD:et,EUR:le,GBP:me,JPY:R,CNY:R,INR:de,CHF:ve,RUB:ge};function to(e){return eo[(e||``).toUpperCase()]||be}function no({title:e,subtitle:t,actions:n}){return(0,B.jsxs)(`div`,{className:`page-head`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{children:e}),t?(0,B.jsx)(`p`,{children:t}):null]}),n?(0,B.jsx)(`div`,{className:`page-actions`,children:n}):null]})}function ro({items:e,value:t,onChange:n}){return(0,B.jsx)(`div`,{className:`tabbar`,children:e.map(e=>{let r=e.icon;return(0,B.jsxs)(`button`,{type:`button`,className:`tab${t===e.id?` active`:``}`,onClick:()=>n(e.id),children:[r?(0,B.jsx)(r,{size:14}):null,e.label,e.count==null?null:(0,B.jsx)(`span`,{className:`tab-count`,children:e.count.toLocaleString()})]},e.id)})})}function Y({icon:e,tone:t,title:n,note:r,action:i}){return(0,B.jsxs)(`header`,{className:`panel-head`,children:[(0,B.jsx)(`span`,{className:`ph-icon ${t}`,children:(0,B.jsx)(e,{size:15})}),(0,B.jsx)(`h2`,{children:n}),r?(0,B.jsx)(`span`,{className:`panel-note`,children:r}):null,i?(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:i.onClick,children:i.label}):null]})}function io({lead:e,findings:t,figures:n}){return(0,B.jsxs)(`section`,{className:`panel summary`,"aria-label":`Summary`,children:[(0,B.jsx)(Y,{icon:Mn,tone:`brand`,title:`Summary`}),(0,B.jsx)(`p`,{className:`summary-lead`,children:e}),t.length?(0,B.jsx)(`ul`,{className:`findings`,children:t.map((e,t)=>(0,B.jsx)(`li`,{className:e.tone?`tone-${e.tone}`:void 0,children:e.text},t))}):null,n.length?(0,B.jsx)(`dl`,{className:`figure-row`,children:n.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.label}),(0,B.jsxs)(`dd`,{className:e.tone?`tone-${e.tone}`:void 0,children:[e.value,e.note?(0,B.jsx)(`small`,{children:e.note}):null]})]},e.label))}):null]})}function ao({items:e,value:t,onChange:n}){return(0,B.jsx)(`div`,{className:`chips`,role:`tablist`,children:e.filter(e=>e.count||e.id===t).map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===t,className:`chip-btn${e.id===t?` active`:``}`,onClick:()=>n(e.id),children:[e.label,(0,B.jsx)(`span`,{className:`chip-count`,children:e.count})]},e.id))})}function oo(e,t){let[n,r]=(0,v.useState)(0),i=Math.max(1,Math.ceil(e.length/t)),a=Math.min(n,i-1);return{shown:e.slice(a*t,(a+1)*t),at:a,pages:i,setPage:r,size:t,total:e.length}}function so({at:e,pages:t,setPage:n,size:r,total:i,label:a}){return t<=1?null:(0,B.jsxs)(`nav`,{className:`pager`,"aria-label":a,children:[(0,B.jsxs)(`span`,{className:`pager-info`,children:[(e*r+1).toLocaleString(),`–`,Math.min(i,(e+1)*r).toLocaleString(),` of `,i.toLocaleString()]}),(0,B.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e===0,onClick:()=>n(e-1),"aria-label":`Previous page`,children:(0,B.jsx)(Je,{size:15})}),Array.from({length:t},(e,t)=>t).filter(n=>t<=7||n===0||n===t-1||Math.abs(n-e)<=1).map((t,r,i)=>(0,B.jsxs)(`span`,{className:`pager-slot`,children:[r>0&&t-i[r-1]>1?(0,B.jsx)(`span`,{className:`pager-gap`,children:`…`}):null,(0,B.jsx)(`button`,{type:`button`,className:`pager-btn${t===e?` active`:``}`,"aria-current":t===e?`page`:void 0,onClick:()=>n(t),children:(t+1).toLocaleString()})]},t)),(0,B.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e>=t-1,onClick:()=>n(e+1),"aria-label":`Next page`,children:(0,B.jsx)(Xe,{size:15})})]})}function co(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function lo(e,t=4){return e.length>t?`${e.slice(0,t).join(`, `)} and ${e.length-t} more`:co(e)}function uo({label:e,value:t,sub:n,icon:r,color:i}){return(0,B.jsx)(`div`,{className:`card metric`,children:(0,B.jsxs)(`div`,{className:`metric-top`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`metric-label`,children:e}),(0,B.jsx)(`div`,{className:`metric-value`,children:t}),n?(0,B.jsx)(`div`,{className:`metric-trend flat`,children:n}):null]}),(0,B.jsx)(`div`,{className:`metric-icon ${i}`,children:(0,B.jsx)(r,{size:18})})]})})}var fo=10;function po({posted:e,errors:t,onOpenCase:n}){let[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(`all`),l=r.trim().toLowerCase(),u=new Map;for(let t of e)u.set(t.source,(u.get(t.source)||0)+1);let d=[...u.entries()].sort((e,t)=>t[1]-e[1]||Xi(e[0]).localeCompare(Xi(t[0]))),f=a?e.filter(e=>e.source===a):e,p={all:f.length,posted:f.filter(e=>!e.error).length,failed:f.filter(e=>e.error).length},m=f.filter(e=>s===`all`||s===`failed`==!!e.error).filter(e=>!l||[Xi(e.source),e.text,e.caseId,e.caseTitle,e.error,e.error?`not posted`:`posted`].join(` `).toLowerCase().includes(l)),h=oo(m,fo),{shown:g,at:_,setPage:y}=h,b=!!(l||a||s!==`all`),x=e=>{e(),y(0)};return(0,B.jsxs)(`section`,{className:`panel posted-panel`,id:`ov-posted`,children:[(0,B.jsx)(Y,{icon:Br,tone:`brand`,title:`Results posted`,note:t?`${t.toLocaleString()} could not be posted`:`to the source systems`}),(0,B.jsxs)(`div`,{className:`ov-posted-filters`,children:[d.length>1?(0,B.jsxs)(`div`,{className:`tr-chips`,role:`group`,"aria-label":`Filter by system`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":!a,className:`chip-btn${a?``:` active`}`,onClick:()=>x(()=>o(``)),children:[`All systems`,(0,B.jsx)(`span`,{className:`chip-count`,children:e.length.toLocaleString()})]}),d.map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":a===e,className:`chip-btn${a===e?` active`:``}`,onClick:()=>x(()=>o(e)),children:[Xi(e),(0,B.jsx)(`span`,{className:`chip-count`,children:t.toLocaleString()})]},e))]}):null,(0,B.jsx)(`div`,{className:`tr-chips`,role:`group`,"aria-label":`Filter by status`,children:[[`all`,`Any status`],[`posted`,`Posted`],[`failed`,`Not posted`]].filter(([e])=>e===`all`||p[e]||s===e).map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":s===e,className:`chip-btn${s===e?` active`:``}`,onClick:()=>x(()=>c(e)),children:[t,(0,B.jsx)(`span`,{className:`chip-count`,children:p[e].toLocaleString()})]},e))})]}),(0,B.jsxs)(`div`,{className:`table-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:r,placeholder:`Search system, result, or case`,"aria-label":`Search results posted`,onChange:e=>x(()=>i(e.target.value))})]}),(0,B.jsx)(`span`,{className:`table-count`,children:b?`${m.length.toLocaleString()} of ${e.length.toLocaleString()}`:X(e.length,`result`)})]}),(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data posted-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`col-src`,children:`System`}),(0,B.jsx)(`th`,{children:`Result`}),(0,B.jsx)(`th`,{className:`col-case`,children:`Case`}),(0,B.jsx)(`th`,{className:`col-state`,children:`Status`})]})}),(0,B.jsxs)(`tbody`,{children:[g.map((e,t)=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{className:`posted-source`,children:Xi(e.source)}),(0,B.jsx)(`td`,{children:e.url?(0,B.jsx)(`a`,{href:q(e.url),children:e.text}):e.text}),(0,B.jsx)(`td`,{children:e.caseId?(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>n(e.caseId),children:e.caseId}):(0,B.jsx)(`span`,{className:`dim`,children:`Whole run`})}),(0,B.jsx)(`td`,{children:e.error?(0,B.jsx)(`span`,{className:`status-pill fail`,title:e.error,children:`Not posted`}):(0,B.jsx)(`span`,{className:`status-pill pass`,children:`Posted`})})]},`${_}-${t}`)),g.length?null:(0,B.jsx)(`tr`,{children:(0,B.jsx)(`td`,{colSpan:4,className:`table-empty`,children:l?`Nothing posted matches “${r.trim()}” with these filters.`:`Nothing posted matches these filters.`})})]})]})}),(0,B.jsx)(so,{...h,label:`Results posted pages`})]})}function mo(e){let t=`forgeqe-${e.id||`report`}`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>window.print(),children:[(0,B.jsx)(Sr,{size:14}),`Print`]}),(0,B.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>xa(`${t}.md`,ba(e),`text/markdown`),children:[(0,B.jsx)(z,{size:14}),`Export MD`]}),(0,B.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>xa(`${t}.json`,JSON.stringify(e,null,2),`application/json`),children:[(0,B.jsx)(Rt,{size:14}),`Export JSON`]})]})}function ho({items:e}){return(0,B.jsx)(`section`,{className:`kpi-ribbon`,"aria-label":`Run numbers`,children:e.map(({label:e,value:t,sub:n,icon:r,tone:i,title:a})=>(0,B.jsxs)(`div`,{className:`kpi`,title:a||(typeof n==`string`?`${e}: ${n}`:void 0),children:[(0,B.jsxs)(`span`,{className:`kpi-top`,children:[(0,B.jsx)(`span`,{className:`kpi-label`,children:e}),(0,B.jsx)(`span`,{className:`ph-icon brand`,children:(0,B.jsx)(r,{size:14})})]}),(0,B.jsx)(`span`,{className:`kpi-value${i?` tone-${i}`:``}`,children:t}),(0,B.jsx)(`span`,{className:`kpi-sub`,children:n})]},e))})}function go(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`})}function _o(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function vo(e){let t=Math.round(e/1e3);return t>=3600?`${Math.floor(t/3600)}h${String(Math.floor(t%3600/60)).padStart(2,`0`)}`:`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}var yo=[10,15,30,60,120,300,600,900,1800,3600,7200,10800,21600,43200].map(e=>e*1e3);function X(e,t,n){return U(e,t,n).replace(/^\d+/,e.toLocaleString())}function bo(e){let t=[...new Set(e)].sort((e,t)=>e-t);return`${t.length===1?`Step`:`Steps`} ${lo(t.map(String),4)}`}function xo(e){return e.split(`
18
18
  `)[0].replace(/\?[^\s)]*/g,``).replace(/\b[0-9a-f]{6,}\b/gi,`#`).replace(/\d+/g,`#`).slice(0,300)}var So=40,Co=8;function wo(e,t,n){let r=[],i=0;if(e.length<=So){for(let n of e)r.push({...n,left:100*i/t,width:100*n.ms/t,failed:+(n.tone===`fail`),items:1}),i+=n.ms;return r}let a=t/So,o=[],s=()=>{if(!o.length)return;let e=o.reduce((e,t)=>e+t.ms,0),a=o.filter(e=>e.tone===`fail`).length,s=o.reduce((e,t)=>e+t.errors,0),c=o.reduce((e,t)=>e+t.a11y,0),l=o[0].n,u=o[o.length-1].n,d=l===u?`${n[0].toUpperCase()}${n.slice(1)} ${l}`:`${n[0].toUpperCase()}${n.slice(1)}s ${l}–${u}`;r.push({key:`${o[0].key}-${o.length}`,n:l,label:d,ms:e,tone:r.length%2?`b`:`a`,errors:s,a11y:c,title:[`${d}: ${V(e)}`,a?`${a} ${n===`step`?`with a failed action`:`did not pass`}`:``,s?X(s,`browser error`):``,c?X(c,`accessibility issue`):``].filter(Boolean).join(`, `),left:100*i/t,width:100*e/t,failed:a,items:o.length}),i+=e,o=[]},c=0;for(let t of e)o.push(t),c+=t.ms,c>=a*(r.length+1)&&s();return s(),r}function To({segments:e,perCase:t,total:n}){let r=t?`case`:`step`,i=wo(e,n,r),a=i.length<e.length,o=i.filter(e=>e.errors||e.a11y),s=o.length<=Co&&!a,c=yo.find(e=>n/e<=6)||yo[yo.length-1],l=[];for(let e=c;e<n-c*.6;e+=c)l.push(e);let u=i.reduce((e,t)=>e+t.errors,0),d=i.reduce((e,t)=>e+t.a11y,0),f=`${X(e.length,r)} over ${V(n)}${a?`, in ${i.length} blocks of about ${V(Math.round(n/i.length))}`:``}.${u?` ${X(u,`browser error`)}.`:``}${d?` ${X(d,`accessibility issue`)}.`:``}${o.length?``:` No problems marked.`}`,p=e=>e.left+e.width/2<10?` start`:e.left+e.width/2>90?` end`:``,m=e=>{let t=i.filter(t=>t[e]);return t.length?(0,B.jsxs)(`div`,{className:`rt-lane ${e===`errors`?`fail`:`warn`}`,"aria-hidden":`true`,children:[(0,B.jsxs)(`span`,{className:`rt-lane-name`,children:[e===`errors`?(0,B.jsx)(`i`,{className:`glyph-err`}):(0,B.jsx)(`i`,{className:`glyph-a11y`}),e===`errors`?`Errors`:`A11y`]}),(0,B.jsx)(`span`,{className:`rt-lane-track`,children:t.map(t=>(0,B.jsxs)(`span`,{className:`rt-count`,style:{left:`${t.left}%`,width:`${t.width}%`},title:t.title,children:[t.width>=2.2?(0,B.jsx)(`b`,{children:t[e]>999?`${Math.round(t[e]/100)/10}k`:t[e]}):null,e===`errors`?(0,B.jsx)(`i`,{className:`glyph-err`}):(0,B.jsx)(`i`,{className:`glyph-a11y`})]},t.key))})]}):null};return(0,B.jsxs)(`div`,{className:`rt${s&&o.length?` with-labels`:``}${s?``:` with-lanes`}`,children:[s&&o.length?(0,B.jsx)(`div`,{className:`rt-marks`,"aria-hidden":`true`,children:o.map(e=>(0,B.jsxs)(`span`,{className:`rt-mark${p(e)}`,style:{left:`${e.left+e.width/2}%`},title:e.title,children:[(0,B.jsxs)(`span`,{className:`rt-mark-label ${e.errors?`fail`:`warn`}`,children:[e.label,` · `,e.errors?X(e.errors,`error`):`${e.a11y.toLocaleString()} a11y`]}),e.errors?(0,B.jsx)(`i`,{className:`glyph-err`}):(0,B.jsx)(`i`,{className:`glyph-a11y`})]},e.key))}):null,s?null:(0,B.jsxs)(B.Fragment,{children:[m(`errors`),m(`a11y`)]}),(0,B.jsxs)(`div`,{className:`rt-body`,children:[(0,B.jsx)(`div`,{className:`rt-track`,role:`img`,"aria-label":`Timeline: ${f}`,children:i.map(e=>{let t=(0,B.jsxs)(B.Fragment,{children:[e.items>1&&e.failed?(0,B.jsx)(`i`,{className:`rt-failed`,style:{height:`${Math.max(12,100*e.failed/e.items)}%`}}):null,(0,B.jsx)(`span`,{className:`rt-name`,children:e.label}),(0,B.jsx)(`span`,{className:`rt-time`,children:V(e.ms)})]}),n={left:`${e.left}%`,width:`${e.width}%`},r=e.items>1?e.tone:e.failed?`fail`:e.tone;return e.onClick&&e.items===1?(0,B.jsx)(`button`,{type:`button`,className:`rt-seg ${r}${e.width<5?` narrow`:``}`,style:n,title:e.title,onClick:e.onClick,tabIndex:-1,children:t},e.key):(0,B.jsx)(`span`,{className:`rt-seg ${r}${e.width<5?` narrow`:``}`,style:n,title:e.title,children:t},e.key)})}),(0,B.jsxs)(`div`,{className:`rt-axis`,"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{style:{left:0},children:`0:00`}),l.map(e=>(0,B.jsx)(`span`,{className:`rt-tick`,style:{left:`${100*e/n}%`},children:vo(e)},e)),(0,B.jsx)(`span`,{className:`end`,children:vo(n)})]})]}),a?(0,B.jsxs)(`p`,{className:`ov-caption rt-note`,children:[X(e.length,r),` grouped into `,i.length,` blocks of about `,V(Math.round(n/i.length)),`; hover a block for its `,r,`s and problems.`]}):null]})}function Eo({kind:e}){let[t,n]=e===`pass`?[(0,B.jsx)(ta,{status:`passed`,size:14}),`Good`]:e===`bad`?[(0,B.jsx)(ta,{status:`error`,size:14}),`Problem`]:e===`warn`?[(0,B.jsx)(ia,{size:14}),`Warning`]:[(0,B.jsx)(ta,{status:`stopped`,size:14}),`Not covered`];return(0,B.jsx)(`span`,{className:`dimension-icon`,role:`img`,"aria-label":n,children:t})}var Do=52;function Oo({data:e,onNavigate:t,onOpenCase:n}){let r=oa(e),i=sa(e),a=Oa(e),o=[...e.posted,...e.cases.flatMap(e=>e.posted.map(t=>({...t,caseTitle:e.title})))],s=e.cases.filter(e=>e.status!==`stopped`),c=e.cases.length===1?e.cases[0]:void 0,l=e.cases.filter(e=>e.status!==`passed`),u=new Set([`results`,`failures`,`trends`,`flaky`,`timing`,`coverage`]);e.cases.some(e=>e.diagnostics?.pagesChecked||e.accessibility?.length)&&u.add(`accessibility`),e.cases.some(e=>e.quality?.visual?.length)&&u.add(`visual`),e.cases.some(e=>e.quality?.performance.length)&&u.add(`performance`),e.usage&&[`breakdown`,`optimise`].forEach(e=>u.add(e));let d=(e,n)=>u.has(n)?{label:e,onClick:()=>t(n)}:void 0,f=e.cases.some(e=>e.diagnostics),p=new Map,m=new Map;for(let t of e.cases)for(let e of Ta(t)){if(e.level!==`error`)continue;let n=Ea(e),r=xo(n),i=p.get(r)||{text:n,count:0,steps:[],cases:new Set};i.count+=e.count||1,i.steps.push(e.step),i.cases.add(t.id),p.set(r,i),m.set(`${t.id}#${e.step}`,(m.get(`${t.id}#${e.step}`)||0)+(e.count||1))}let h=[...p.values()].sort((e,t)=>t.count-e.count),g=Na(e.cases),_=new Map;for(let e of g)for(let t of e.issues){let n=_.get(t.rule)||{issue:t,count:0,pages:[]};n.count+=t.count,n.pages.push(e.title||Ji(e.url)||e.url),_.set(t.rule,n)}let v=[..._.values()].sort((e,t)=>Ma.indexOf(e.issue.impact)-Ma.indexOf(t.issue.impact)||t.count-e.count),y=v[0]?.issue.impact,b=new Map(g.filter(e=>e.issues.length).map(e=>[e.url.split(`#`)[0],e.issues.reduce((e,t)=>e+t.count,0)])),x=fa(e.history).slice(-10),S=x.filter(e=>!e.current),C=S.length?S.reduce((e,t)=>e+t.ms,0)/S.length:0,w=C&&x.some(e=>e.current)?e.ms-C:void 0,T=w===void 0?void 0:Math.abs(w)<1e3?`same as average`:`${V(Math.abs(Math.round(w)))} ${w<0?`faster`:`slower`}`,E=x.reduce((e,t)=>e+t.passed,0),D=x.reduce((e,t)=>e+t.total,0),O=Math.max(1,...x.map(e=>e.ms)),k=ma(e.history),A=e.usage?.calls||[],j=A.map(Pa),M=La(j),N=A.length?Ia(M):{fresh:e.cases.reduce((e,t)=>e+(t.usage?.input||0),0),cached:0,write:0,output:e.cases.reduce((e,t)=>e+(t.usage?.output||0),0)},P=N.fresh+N.cached+N.write+N.output,F=A.length?Ra(j,`agent`):[],ee=Math.max(1e-9,...F.map(e=>e.amount||e.tokens)),I=e.usage?Xa(e).filter(e=>e.saving!==void 0):[],ne=c?c.timeline.filter(e=>e.ms):[],re=new Map;if(c){let e=new Set;for(let t of c.timeline){let n=(t.url||``).split(`#`)[0];b.has(n)&&!e.has(n)&&(e.add(n),re.set(t.n,b.get(n)||0))}}let L=ne.length?ne.map((e,t)=>{let n=m.get(`${c.id}#${e.n}`)||0,r=e.actions.some(e=>!e.ok);return{key:`s${e.n}`,n:e.n,label:`Step ${e.n}`,ms:e.ms||0,tone:r?`fail`:t%2?`b`:`a`,errors:n,a11y:re.get(e.n)||0,title:`Step ${e.n}${e.goal?`: ${e.goal}`:``} (${V(e.ms)})${n?`, ${X(n,`browser error`)}`:``}${e.source===`memory`?`, replayed from page memory`:``}`}}):[...s].sort((e,t)=>e.startedAt.localeCompare(t.startedAt)).filter(e=>e.ms).map((e,t)=>{let r=e.diagnostics?e.diagnostics.consoleErrors+e.diagnostics.failedRequests:0,i=(e.accessibility||[]).reduce((e,t)=>e+t.issues.reduce((e,t)=>e+t.count,0),0);return{key:e.id,n:t+1,label:e.id,ms:e.ms,tone:aa(e.status)?`fail`:t%2?`b`:`a`,errors:r,a11y:i,title:`${e.id} ${e.title}: ${Zi[e.status]||e.status} in ${V(e.ms)}${r?`, ${X(r,`browser error`)}`:``}${i?`, ${X(i,`accessibility issue`)}`:``}`,onClick:()=>n(e.id)}}),ie=L.reduce((e,t)=>e+t.ms,0),ae=!ne.length,oe=ya(e.cases,c?1:5),se=Math.max(1,...oe.map(e=>e.ms)),ce=oe[0],le=ce?[...ce.timeline].filter(e=>e.ms).sort((e,t)=>(t.ms||0)-(e.ms||0)).slice(0,5):[],ue=Math.max(1,...le.map(e=>e.ms||0)),de=[[r.failed,`failed`],[r.error,`could not run`],[r.stopped,`stopped before start`]].filter(([e])=>e),fe=r.browserSteps||r.tokens?[`${X(r.browserSteps,`browser step`)}`,...r.tokens?[`${H(r.tokens)} tokens`]:[]].join(`, using `):``,R=`${c?`The test case ${c.status===`passed`?`passed`:(Zi[c.status]||c.status).toLowerCase()}`:`${r.passed.toLocaleString()} of ${X(r.total,`test case`)} passed`} in ${V(e.ms)}${fe?` across ${fe}`:``}${r.cost?` at ${r.cost.estimate||r.cost.cachedAtFullRate?`an estimated `:``}${W(r.cost.amount,r.cost.currency)}`:``}.`,pe=c?.summary.split(`
19
19
  `)[0].trim(),me=[...r.browserErrors?[`the site logged ${X(r.browserErrors,`browser error`)}${h.length>1?` of ${h.length} kinds`:``}`]:[],...r.a11yIssues?[`${X(r.a11yIssues,`accessibility issue`)} ${r.a11yIssues===1?`was`:`were`} found${y?`, the worst ${y}`:``}`]:[],...k.length?[`${X(k.length,`test`)} changed result between runs`]:[]],he=le[0],ge=e.env?.ci?e.env.ci.name:e.env?.machine?`Local, ${e.env.machine.split(` · `)[0]}`:void 0,_e=Date.parse(e.startedAt),ve=[{label:`Pass rate`,value:`${r.passRate.toLocaleString()}%`,sub:`${r.passed.toLocaleString()} of ${X(r.total,`case`)}`,icon:Qe,tone:r.total&&r.passed===r.total?`pass`:r.failed+r.error?`fail`:void 0},{label:`Failed`,value:(r.failed+r.error).toLocaleString(),sub:r.error?`${r.error.toLocaleString()} could not run`:r.stopped?`${r.stopped.toLocaleString()} not run`:`0 could not run`,icon:ct,tone:r.failed+r.error?`fail`:void 0},{label:`Duration`,value:V(e.ms),sub:T?T===`same as average`?T:`${T} than avg`:s.length>1?`${V(Math.round(s.reduce((e,t)=>e+t.ms,0)/s.length))} per case`:`${X(r.browserSteps,`step`)}`,icon:ft},...f?[{label:`Browser errors`,value:r.browserErrors.toLocaleString(),sub:r.browserErrors?m.size?`in ${X(m.size,`step`)}`:`in ${X(e.cases.filter(e=>e.diagnostics&&e.diagnostics.consoleErrors+e.diagnostics.failedRequests).length,`case`)}`:`none logged`,icon:er,tone:r.browserErrors?`fail`:void 0}]:[],...r.a11yIssues===void 0?[]:[{label:`Accessibility`,value:r.a11yIssues.toLocaleString(),sub:r.a11yIssues?`${y||`open`} ${r.a11yIssues===1?`issue`:`at worst`}`:`no issues`,icon:te,tone:r.a11yIssues?`warn`:void 0}],...r.tokens?[{label:`Tokens`,value:H(r.tokens),sub:P?`${Math.round(J(N.fresh+N.cached+N.write,P)).toLocaleString()}% input`:`browser and code`,icon:wt}]:[],...r.cost?[{label:`Cost`,value:G(r.cost),sub:r.cost.cachedAtFullRate?`upper bound`:r.cost.estimate?`estimate`:`model spend`,icon:to(r.cost.currency),title:K(r.cost)}]:[],{label:`Bugs filed`,value:r.bugs.toLocaleString(),sub:r.bugs?`in the tracker`:`nothing filed`,icon:Ee},{label:`Results posted`,value:(o.length-r.postedErrors).toLocaleString(),sub:r.postedErrors?`${r.postedErrors.toLocaleString()} not posted`:o.length?`to the source systems`:`nothing sent`,icon:Br,tone:r.postedErrors?`fail`:void 0}],ye=e.cases.flatMap(e=>e.quality?.visual||[]),be=e.cases.flatMap(e=>e.quality?.performance||[]),xe=e.cases.flatMap(e=>e.quality?.breaches.filter(e=>e.kind===`performance`)||[]).length,Se=e.cases.filter(e=>e.requirements?.length).length,Ce=x.filter(e=>e.total&&e.passed===e.total).length,we=[{label:`Functional`,note:r.failed+r.error?`${X(r.failed+r.error,`case`)} failed`:r.total?`Every expected result held`:`No cases ran`,value:`${r.passed.toLocaleString()}/${r.total.toLocaleString()}`,kind:r.total?r.failed+r.error?`bad`:`pass`:`none`,action:r.failed+r.error?{label:`Failures`,page:`failures`}:{label:`Test results`,page:`results`}},f?{label:`Browser health`,note:r.browserErrors?h.length?`${X(h.length,`kind`)} of error`:`Console errors and failed requests`:`No console errors or failed requests`,value:r.browserErrors?X(r.browserErrors,`error`):`Clean`,kind:r.browserErrors?`bad`:`pass`,action:{label:`Test results`,page:`results`}}:{label:`Browser health`,note:`Console and network not recorded`,value:`Off`,kind:`none`},r.a11yIssues===void 0?{label:`Accessibility`,note:`Pages were not checked`,value:`Off`,kind:`none`}:{label:`Accessibility`,note:v[0]?v[0].issue.help:`No issues on ${X(g.length,`page`)}`,value:r.a11yIssues?`${r.a11yIssues.toLocaleString()} ${y||``}`.trim():`No issues`,kind:r.a11yIssues?y===`critical`?`bad`:`warn`:`pass`,action:{label:`Accessibility`,page:`accessibility`}},ye.length?(()=>{let e=ye.filter(e=>e.status===`changed`).length,t=ye.filter(e=>e.status===`no_baseline`||e.status===`new`).length;return e?{label:`Visual`,note:`${X(e,`page`)} differ from the baseline`,value:`${e.toLocaleString()} changed`,kind:`warn`,action:{label:`Visual`,page:`visual`}}:t===ye.length?{label:`Visual`,note:`${X(ye.length,`screenshot`)}, no baseline yet`,value:`No baseline`,kind:`none`,action:{label:`Visual`,page:`visual`}}:{label:`Visual`,note:`${X(ye.length-t,`page`)} match the baseline`,value:`Same`,kind:`pass`,action:{label:`Visual`,page:`visual`}}})():{label:`Visual`,note:`No screenshots compared`,value:`Off`,kind:`none`},be.length?{label:`Performance`,note:xe?`${X(xe,`budget`)} exceeded`:`${X(be.length,`page`)} timed`,value:xe?`${xe.toLocaleString()} over`:`In budget`,kind:xe?`bad`:`pass`,action:{label:`Performance`,page:`performance`}}:{label:`Performance`,note:`Page timings not recorded`,value:`Off`,kind:`none`},x.length>1?{label:`Stability`,note:k.length?`${X(k.length,`test`)} changed result between runs`:`${X(x.length-Ce,`failing run`)} in the last ${x.length}`,value:`${Ce}/${x.length}`,kind:k.length?`warn`:`pass`,action:{label:`Flaky tests`,page:`flaky`}}:{label:`Stability`,note:`Needs more than one run`,value:`One run`,kind:`none`},{label:`Coverage`,note:Se?`${Se.toLocaleString()} of ${X(r.total,`case`)} linked to a requirement`:`${r.total===1?`Case`:`Cases`} not linked to a requirement`,value:Se?`${Se.toLocaleString()}/${r.total.toLocaleString()}`:`Unmapped`,kind:Se?Se===r.total?`pass`:`warn`:`none`,action:{label:`Coverage`,page:`coverage`}},{label:`Reporting`,note:r.bugs||o.length?`${X(r.bugs,`bug`)} filed, ${X(o.length-r.postedErrors,`result`)} posted`:`No bugs filed, no results posted`,value:r.postedErrors?`${r.postedErrors.toLocaleString()} failed`:r.bugs||o.length?`Sent`:`Not sent`,kind:r.postedErrors?`bad`:r.bugs||o.length?`pass`:`none`,action:o.length?{label:`Results posted`,page:`overview`}:void 0}],Te=we.filter(e=>e.kind!==`none`).length,De=[...l.map(e=>{let t=da(e);return{key:`case-${e.id}`,count:(0,B.jsx)(na,{status:e.status,size:18}),tone:Qi(e.status),msg:`${e.id} ${e.title}`,where:[Zi[e.status]||e.status,t.failedStep?`step ${t.failedStep.n} failed`:``,e.summary.split(`
20
- `)[0]].filter(Boolean).join(` · `),caseId:e.id,mono:!1}})],Oe=[...h.map(e=>({key:`err-${e.text}`,count:`${e.count.toLocaleString()}×`,tone:`fail`,msg:e.text,where:`${bo(e.steps)}${e.cases.size>1||!c?` · ${X(e.cases.size,`case`)}`:``}`,mono:!0})),...v.map(e=>({key:`a11y-${e.issue.rule}`,count:`${e.count.toLocaleString()}×`,tone:`warn`,msg:`${e.issue.rule}: ${e.issue.help}`,where:`${e.issue.impact} · ${lo([...new Set(e.pages)],2)}`,mono:!0}))],ke=Oe.length?Math.max(6-Oe.length,3):6,Ae=[...De.slice(0,ke),...Oe,...De.slice(ke)],je=[...l.length?[`${X(l.length,`case`)} did not pass`]:[],...r.browserErrors?[`${X(r.browserErrors,`browser error`)}${h.length?` in ${X(h.length,`kind`)}`:``}`]:[],...r.a11yIssues?[X(r.a11yIssues,`accessibility issue`)]:[]];return(0,B.jsxs)(`div`,{className:`overview`,children:[(0,B.jsx)(no,{title:(0,B.jsxs)(B.Fragment,{children:[e.title,` `,(0,B.jsx)(ra,{verdict:i})]}),subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsx)(`span`,{title:qi(e.startedAt),children:qi(e.startedAt)}),(0,B.jsxs)(`span`,{children:[`Run `,(0,B.jsx)(`code`,{children:e.id})]}),e.env?.ci?(0,B.jsxs)(`span`,{children:[`Build `,e.env.ci.url?(0,B.jsx)(`a`,{href:q(e.env.ci.url),children:e.env.ci.name}):e.env.ci.name]}):(0,B.jsx)(`span`,{children:e.kind===`run`?`Single run`:`Suite run`}),e.env?.branch?(0,B.jsxs)(`span`,{children:[`Branch `,(0,B.jsx)(`code`,{children:e.env.branch})]}):null]}),actions:mo(e)}),(0,B.jsx)(ho,{items:ve}),(0,B.jsxs)(`div`,{className:`ov-grid`,children:[(0,B.jsxs)(`section`,{className:`panel ov-s7 ov-wide ov-summary`,children:[(0,B.jsx)(Y,{icon:z,tone:`brand`,title:`Execution summary`,action:a?{label:a.newFailures.length?`${X(a.newFailures.length,`new failure`)} since last run`:`Since last run`,onClick:()=>t(`changes`)}:void 0}),pe?(0,B.jsx)(`p`,{className:`ov-lead`,children:pe}):null,(0,B.jsxs)(`p`,{className:pe?`ov-text`:`ov-lead`,children:[R,!c&&de.length?` ${de.map(([e,t])=>`${e.toLocaleString()} ${t}`).join(`, `)}.`:``]}),me.length||he?(0,B.jsxs)(`p`,{className:`ov-text`,children:[me.length?`Worth a look before you trust the ${i===`Passed`?`green `:``}result: ${co(me)}. `:``,he?`The slowest step was ${he.goal?`“${he.goal}”`:`step ${he.n}`}${ce&&!c?` in ${ce.id}`:``} at ${V(he.ms)}.`:``]}):null,(0,B.jsxs)(`dl`,{className:`ov-facts`,children:[Number.isFinite(_e)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Started`}),(0,B.jsx)(`dd`,{children:_o(_e)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Finished`}),(0,B.jsx)(`dd`,{children:_o(_e+e.ms)})]})]}):null,e.env?.browser?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Browser`}),(0,B.jsx)(`dd`,{children:e.env.browser})]}):null,e.env?.testEnvironment?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Environment`}),(0,B.jsx)(`dd`,{children:e.env.testEnvironment})]}):null,ge?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Triggered by`}),(0,B.jsx)(`dd`,{children:ge})]}):null]})]}),(0,B.jsxs)(`section`,{className:`panel ov-s5 ov-wide`,children:[(0,B.jsx)(Y,{icon:Ie,tone:`brand`,title:`Results over runs`,action:d(`Open Trends`,`trends`)}),x.length>1?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`dl`,{className:`ov-stats`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[`Pass rate, last `,x.length]}),(0,B.jsxs)(`dd`,{children:[J(E,D).toLocaleString(),`%`]})]}),C?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Average time`}),(0,B.jsx)(`dd`,{children:V(Math.round(C))})]}):null,T?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`This run vs average`}),(0,B.jsx)(`dd`,{className:w<-1e3?`tone-pass`:w>1e3?`tone-warn`:void 0,children:T})]}):null]}),(0,B.jsx)(`p`,{className:`ov-caption`,children:`Time per run, with its result underneath`}),(0,B.jsx)(`div`,{className:`run-bars`,role:`img`,"aria-label":`Duration of the last ${x.length} runs. ${x.filter(e=>e.bad).length?`${X(x.filter(e=>e.bad).length,`run`)} had failures.`:`Every run passed.`} This run took ${V(e.ms)}.`,children:x.map(e=>(0,B.jsxs)(`span`,{className:`run-bar${e.current?` current`:``}`,title:`${e.current?`This run`:qi(e.at)}: ${e.passed} of ${e.total} passed in ${V(e.ms)}`,children:[(0,B.jsx)(`span`,{className:`rb-time`,children:vo(e.ms)}),(0,B.jsx)(`i`,{style:{height:`${Math.max(6,100*e.ms/O)}%`}})]},e.id))}),(0,B.jsx)(`div`,{className:`run-results`,children:x.map(e=>(0,B.jsxs)(`span`,{className:e.current?`current`:void 0,children:[(0,B.jsx)(na,{status:e.bad?`failed`:e.total&&e.passed===e.total?`passed`:`stopped`,size:13}),(0,B.jsx)(`span`,{children:e.current?`This run`:go(e.at)})]},e.id))})]}):(0,B.jsx)(`p`,{className:`hint-text`,children:`Trends appear once this folder has more than one suite run.`})]}),L.length?(0,B.jsxs)(`section`,{className:`panel ov-s12`,children:[(0,B.jsx)(Y,{icon:mi,tone:`brand`,title:`Run timeline`,note:ae?`Each case's time, in the order they started${e.cases.length>L.length?`; ${e.cases.length-L.length} not timed`:``}`:`Where the ${V(ie)} went, and when problems happened`}),(0,B.jsx)(To,{segments:L,perCase:ae,total:Math.max(1,ie)}),(0,B.jsxs)(`div`,{className:`rt-legend`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`glyph-err`}),`Browser error, with the `,ae?`case`:`step`,` it happened in`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`glyph-a11y`}),`Accessibility issue`]}),L.some(e=>e.tone===`fail`)?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`rt-key fail`}),ae?`Case that did not pass`:`Step with a failed action`]}):null]})]}):null,(0,B.jsxs)(`section`,{className:`panel ov-s12 ov-flush`,children:[(0,B.jsx)(Y,{icon:Jr,tone:`brand`,title:`Quality by dimension`,note:`${Te} checked this run · ${we.length-Te} not covered yet`}),(0,B.jsx)(`ul`,{className:`dimensions`,children:we.map(e=>(0,B.jsxs)(`li`,{className:`dimension`,children:[(0,B.jsx)(Eo,{kind:e.kind}),(0,B.jsx)(`span`,{className:`dimension-label`,children:e.label}),(0,B.jsx)(`span`,{className:`dimension-value ${e.kind}`,children:e.value}),(0,B.jsx)(`span`,{className:`dimension-note`,title:e.note.length>Do?e.note:void 0,children:e.note.length>Do?`${e.note.slice(0,51).trimEnd()}…`:e.note}),e.action&&e.action.page===`overview`?(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>document.getElementById(`ov-posted`)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:e.action.label}):e.action&&u.has(e.action.page)?(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(e.action.page),children:e.action.label}):null]},e.label))})]}),(0,B.jsxs)(`section`,{className:`panel ov-s5 ov-flush`,children:[(0,B.jsx)(Y,{icon:bi,tone:Ae.length?`warn`:`pass`,title:Ae.length?`Problems seen during the run`:`No problems seen`,action:d(l.length?`Open Failures`:`Test results`,l.length?`failures`:`results`)}),(0,B.jsx)(`p`,{className:`ov-caption`,children:Ae.length?`${co(je)}.${l.length?``:` None failed the test.`}`:`${X(r.total,`case`)} passed with no browser errors${r.a11yIssues===0?` and no accessibility issues`:``}.`}),Ae.length?(0,B.jsx)(`ul`,{className:`prob-list`,children:Ae.slice(0,6).map(e=>{let t=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`prob-count tone-${e.tone}`,children:e.count}),(0,B.jsx)(`span`,{className:`prob-msg${e.mono?` mono`:``}`,children:e.msg}),(0,B.jsx)(`span`,{className:`prob-where`,children:e.where})]});return(0,B.jsx)(`li`,{children:e.caseId?(0,B.jsx)(`button`,{type:`button`,className:`prob-row`,onClick:()=>n(e.caseId),children:t}):(0,B.jsx)(`div`,{className:`prob-row`,children:t})},e.key)})}):null,Ae.length>6?(0,B.jsxs)(`p`,{className:`ov-caption more`,children:[`and `,Ae.length-6,` more`]}):null]}),(0,B.jsxs)(`section`,{className:`panel ov-slow ${P?`ov-s3`:`ov-s7`}`,children:[(0,B.jsx)(Y,{icon:$t,tone:`brand`,title:`Slowest cases`,action:d(`View all`,`timing`)}),oe.length?oe.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`ov-slow-case`,onClick:()=>n(e.id),title:`${e.id} ${e.title}`,children:[(0,B.jsxs)(`span`,{className:`ov-slow-head`,children:[(0,B.jsx)(`span`,{className:`ov-slow-name`,children:e.title||e.id}),(0,B.jsx)(`span`,{className:`ov-slow-value`,children:V(e.ms)})]}),(0,B.jsx)(`i`,{className:`ov-slow-bar${aa(e.status)?` fail`:``}`,style:{width:`${Math.max(2,100*e.ms/se)}%`}}),(0,B.jsx)(`span`,{className:`ov-slow-note`,children:c?`The only case in this run`:`${e.id} · ${Zi[e.status]||e.status}`})]},e.id)):(0,B.jsx)(`div`,{className:`empty`,children:`No cases ran`}),le.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`ov-slow-sub`,title:c?void 0:`${ce.id} ${ce.title}`,children:c?`Slowest steps inside it`:`Slowest steps in ${ce.id}`}),le.map(e=>(0,B.jsxs)(`div`,{className:`ov-slow-step`,title:e.goal||e.url,children:[(0,B.jsxs)(`span`,{className:`ov-slow-head`,children:[(0,B.jsxs)(`span`,{className:`ov-slow-name`,children:[e.n,`. `,e.goal||e.actions[0]?.text||e.url]}),(0,B.jsx)(`span`,{className:`ov-slow-value`,children:V(e.ms)})]}),(0,B.jsx)(`i`,{className:`ov-slow-bar`,style:{width:`${Math.max(2,100*(e.ms||0)/ue)}%`}})]},e.n))]}):null]}),P?(0,B.jsxs)(`section`,{className:`panel ov-s4 ov-flush`,children:[(0,B.jsx)(Y,{icon:wt,tone:`brand`,title:`Where the tokens went`,action:d(`Breakdown`,`breakdown`)}),(0,B.jsxs)(`div`,{className:`ov-tokens`,children:[(0,B.jsxs)(`span`,{className:`ov-split`,role:`img`,"aria-label":`Token split: input ${H(N.fresh)}, output ${H(N.output)}${N.cached?`, cached ${H(N.cached)}`:``}${N.write?`, written to cache ${H(N.write)}`:``}`,children:[N.fresh?(0,B.jsx)(`i`,{className:`in`,style:{flexGrow:N.fresh}}):null,N.output?(0,B.jsx)(`i`,{className:`out`,style:{flexGrow:N.output}}):null,N.cached?(0,B.jsx)(`i`,{className:`cache`,style:{flexGrow:N.cached}}):null,N.write?(0,B.jsx)(`i`,{className:`write`,style:{flexGrow:N.write}}):null]}),(0,B.jsxs)(`span`,{className:`ov-legend`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`in`}),`Input `,H(N.fresh)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`out`}),`Output `,H(N.output)]}),N.cached?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`cache`}),`Cached `,H(N.cached)]}):null,N.write?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`write`}),`Cache write `,H(N.write)]}):null]})]}),F.length?(0,B.jsxs)(`table`,{className:`ov-cost`,children:[(0,B.jsx)(`caption`,{children:F.some(e=>e.priced)?`Cost by agent`:`Tokens by agent`}),(0,B.jsx)(`tbody`,{children:F.slice(0,5).map(e=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`row`,title:e.name,children:e.name}),(0,B.jsx)(`td`,{className:`oc-bar`,children:(0,B.jsx)(`i`,{style:{width:`${Math.max(2,100*(e.amount||e.tokens)/ee)}%`}})}),(0,B.jsx)(`td`,{className:`oc-value`,children:e.priced?G(za(e)):H(e.tokens)})]},e.name))})]}):null,I.length?(0,B.jsxs)(`div`,{className:`ov-tip`,children:[(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(Mn,{size:14}),X(I.length,`way`),` to cut cost`]}),(0,B.jsxs)(`span`,{className:`ov-tip-text`,children:[I[0].title,I[0].saving?`. ${I[0].upTo?`Up to`:`About`} ${W(I[0].saving,I[0].currency)} less on this run.`:``]}),u.has(`optimise`)?(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(`optimise`),children:`Open Optimise`}):null]}):null]}):null]}),o.length?(0,B.jsx)(po,{posted:o,errors:r.postedErrors,onOpenCase:n}):null,(0,B.jsxs)(`p`,{className:`foot-note`,children:[`Written `,Gi(e.generatedAt),` by ForgeQE `,e.env?.version||``,`.`,` `,Sa(e)?`One file with every screenshot embedded, so it opens anywhere without a server.`:`It opens without a server; some screenshots load from the run folders next to this file.`]})]})}function ko({icon:e,title:t,aside:n,children:r}){return(0,B.jsxs)(`section`,{className:`sp-section`,children:[(0,B.jsxs)(`h3`,{className:`sp-h`,children:[e?(0,B.jsx)(e,{size:14}):null,t,n?(0,B.jsx)(`span`,{className:`sp-h-aside`,children:n}):null]}),r]})}function Ao({items:e}){let t=e.filter(([,e])=>e!=null&&e!==!1&&e!==``);return t.length?(0,B.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]},e))}):null}function jo({tone:e,title:t,badge:n,children:r}){return(0,B.jsxs)(`div`,{className:`callout ${e}`,children:[(0,B.jsxs)(`div`,{className:`callout-head`,children:[(0,B.jsx)(`span`,{children:t}),n]}),(0,B.jsx)(`div`,{className:`callout-body`,children:r})]})}function Mo({label:e,text:t}){let[n,r]=(0,v.useState)(!1);return(0,B.jsxs)(`div`,{className:`code-block`,children:[(0,B.jsxs)(`div`,{className:`code-block-head`,children:[(0,B.jsx)(`span`,{children:e}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>navigator.clipboard?.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>void 0),children:[n?(0,B.jsx)(We,{size:13}):(0,B.jsx)(bt,{size:13}),` `,n?`Copied`:`Copy`]})]}),(0,B.jsx)(`pre`,{children:t})]})}function No({items:e}){return e.length?(0,B.jsx)(`ul`,{className:`sp-bullets`,children:e.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))}):null}function Po({src:e,alt:t,boxes:n,className:r,onClick:i}){return(0,B.jsx)(`span`,{className:`shot-wrap ${r||``}`,onClick:i,children:(0,B.jsxs)(`span`,{className:`shot-inner`,children:[(0,B.jsx)(`img`,{src:e,alt:t,loading:`lazy`}),(n||[]).map((e,t)=>(0,B.jsx)(`i`,{className:`shot-box`,title:`Where the agent acted`,style:{left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.w*100}%`,height:`${e.h*100}%`}},t))]})})}function Fo({shots:e,index:t,onIndex:n,onClose:r}){let i=e[t];return(0,v.useEffect)(()=>{let i=i=>{i.key===`Escape`&&r(),i.key===`ArrowRight`&&t<e.length-1&&n(t+1),i.key===`ArrowLeft`&&t>0&&n(t-1)};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[t,e.length,n,r]),i?(0,B.jsxs)(`div`,{className:`lightbox`,onClick:r,role:`dialog`,"aria-label":`Screenshot`,children:[(0,B.jsxs)(`div`,{className:`lightbox-bar`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`span`,{className:`lightbox-label`,title:i.label,children:[t+1,` / `,e.length,` · `,i.label]}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:t===0,onClick:()=>n(t-1),"aria-label":`Previous`,children:(0,B.jsx)(Je,{size:14})}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:t>=e.length-1,onClick:()=>n(t+1),"aria-label":`Next`,children:(0,B.jsx)(Xe,{size:14})}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:r,"aria-label":`Close`,children:(0,B.jsx)(Pi,{size:14})})]}),(0,B.jsx)(Po,{className:`lightbox-shot`,src:i.src,alt:i.label,boxes:i.boxes,onClick:e=>e.stopPropagation()})]}):null}var Io={functional_defect:`Product bug`,test_case_issue:`Test needs update`,environment:`Environment`,automation:`Automation`},Lo={functional_defect:`fail`,test_case_issue:`warn`,environment:`brand`,automation:`brand`},Ro=50,zo=20;function Bo({runs:e,size:t=`sm`}){let n=`Last ${U(e.length,`run`)}: ${e.map(e=>`${e.current?`this run`:Gi(e.at)} ${(Zi[e.status||``]||e.status||``).toLowerCase()}`).join(`, `)}`;return(0,B.jsx)(`span`,{className:`tr-runs ${t}`,role:`img`,"aria-label":n,children:e.map((e,n)=>(0,B.jsx)(`i`,{className:`${e.status===`passed`?`pass`:aa(e.status)?`fail`:`warn`}${e.current?` current`:``}`,title:`${e.current?`This run`:qi(e.at)}: ${Zi[e.status||``]||e.status}`,children:t===`md`?(0,B.jsx)(Vo,{status:e.status}):null},n))})}function Vo({status:e}){let t=e===`passed`?`M4.6 8.4l2.3 2.3 4.5-4.8`:aa(e)?`M5.5 5.5l5 5M10.5 5.5l-5 5`:`M5 8h6`;return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:t,stroke:`#fff`,strokeWidth:`1.9`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Ho(e){let t=e.memory,n=[t.replayTotal?`replayed ${t.replayed} of ${U(t.replayTotal,`saved step`)} without the model`:`no saved flow yet`,t.agentSteps?`the agent took ${U(t.agentSteps,`step`)}`:``,t.flow?`flow ${t.flow}`:``],r=t.baseline;return r&&n.push(`saved ${H(Math.max(0,r.tokens-e.tokens))} tokens and ${V(Math.max(0,r.ms-e.ms))} against ${Gi(r.at)}`),n.filter(Boolean).join(`; `).replace(/^./,e=>e.toUpperCase())}function Uo(e){navigator.clipboard?.writeText(e).catch(()=>void 0)}function Wo({title:e,note:t,children:n}){return(0,B.jsxs)(`section`,{className:`cd-sub`,children:[(0,B.jsxs)(`h3`,{className:`cd-sub-head`,children:[e,t?(0,B.jsx)(`span`,{children:t}):null]}),n]})}function Go({c:e,failed:t}){let n=e.steps.some(e=>e.status);return(0,B.jsx)(`ol`,{className:`cd-steps`,children:e.steps.map(e=>(0,B.jsxs)(`li`,{className:`${e.n===t?`failed`:``}${e.status===`not_run`?` skipped`:``}`,id:e.n===t?`cd-failing-step`:void 0,children:[(0,B.jsx)(`span`,{className:`cd-n`,children:e.n}),n?(0,B.jsx)(na,{status:e.status===`not_run`?`stopped`:e.status,size:15}):(0,B.jsx)(`span`,{}),(0,B.jsxs)(`span`,{className:`cd-step-body`,children:[(0,B.jsx)(`span`,{className:`cd-step-name`,children:e.action}),e.data?(0,B.jsxs)(`span`,{className:`cd-step-note`,children:[`Data: `,e.data]}):null,e.expected?(0,B.jsxs)(`span`,{className:`cd-step-note`,children:[`Expected: `,e.expected]}):null,e.actual?(0,B.jsx)(`span`,{className:`cd-step-note${e.status===`failed`?` fail`:``}`,children:e.status===`not_run`?e.actual:`Saw: ${e.actual}`}):null]}),(0,B.jsx)(`span`,{className:`cd-step-dur`,children:n&&Zi[e.status||``]||``})]},e.n))})}function Ko({c:e,a11ySteps:t,onShot:n}){let[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(`all`),[s,c]=(0,v.useState)({}),l=r.trim().toLowerCase(),u=e.timeline.filter(e=>a===`failed`&&e.actions.every(e=>e.ok)||a===`errors`&&!(e.problems||[]).some(e=>e.level===`error`)||a===`memory`&&e.source!==`memory`?!1:!l||[e.goal,e.evaluation,e.memory,e.url,...e.actions.map(e=>`${e.text} ${e.error||``}`),...(e.problems||[]).map(Ea)].join(` `).toLowerCase().includes(l)),d=oo(u,Ro);if(!e.timeline.length)return e.agentSteps?.length?(0,B.jsx)(`ol`,{className:`cd-steps`,children:e.agentSteps.map((e,t)=>(0,B.jsxs)(`li`,{className:e.ok?``:`failed`,children:[(0,B.jsx)(`span`,{className:`cd-n`,children:t+1}),(0,B.jsx)(na,{status:e.ok?`passed`:`failed`,size:15}),(0,B.jsx)(`span`,{className:`cd-step-body`,children:(0,B.jsx)(`span`,{className:`cd-step-name`,children:e.text})}),(0,B.jsx)(`span`,{})]},t))}):(0,B.jsx)(`div`,{className:`empty`,children:`No browser steps were recorded for this case.`});let f=e.timeline.filter(e=>e.source===`memory`).length;return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`table-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:r,placeholder:`Search steps, pages, selectors or errors`,"aria-label":`Search browser steps`,onChange:e=>{i(e.target.value),d.setPage(0)}})]}),(0,B.jsxs)(`select`,{className:`field`,"aria-label":`Show steps`,value:a,onChange:e=>{o(e.target.value),d.setPage(0)},children:[(0,B.jsx)(`option`,{value:`all`,children:`All steps`}),(0,B.jsx)(`option`,{value:`failed`,children:`With a failed action`}),(0,B.jsx)(`option`,{value:`errors`,children:`With browser errors`}),f?(0,B.jsx)(`option`,{value:`memory`,children:`From page memory`}):null]}),(0,B.jsx)(`span`,{className:`table-count`,children:u.length===e.timeline.length?U(e.timeline.length,`step`):`${u.length} of ${U(e.timeline.length,`step`)}`})]}),(0,B.jsx)(`ol`,{className:`cd-steps`,children:d.shown.map(e=>(0,B.jsx)(qo,{t:e,a11y:t.get(e.n),open:!!s[e.n],onToggle:()=>c(t=>({...t,[e.n]:!t[e.n]})),onShot:n},e.n))}),u.length?null:(0,B.jsx)(`div`,{className:`empty`,children:`No steps match.`}),(0,B.jsx)(so,{...d,label:`Browser step pages`})]})}function qo({t:e,a11y:t,open:n,onToggle:r,onShot:i}){let a=e.actions.filter(e=>!e.ok),o=e.problems||[],s=o.filter(e=>e.level===`error`),c=a.length?`fail`:s.length?`err`:t?`a11y`:`ok`,l=e.goal||e.actions[0]?.text||e.url,u=e.goal?e.actions.map(e=>e.text).join(` · `):e.actions.slice(1).map(e=>e.text).join(` · `);return(0,B.jsxs)(`li`,{className:`${c===`fail`?`failed`:``}${n?` open`:``}`,children:[(0,B.jsx)(`span`,{className:`cd-n`,children:e.n}),(0,B.jsx)(`span`,{className:`cd-kind ${c}`,role:`img`,"aria-label":c===`fail`?`Failed`:c===`err`?`Done, with browser errors`:c===`a11y`?`Done, with accessibility issues`:`Done`,children:c===`ok`?(0,B.jsx)(ta,{status:`passed`,size:15}):c===`fail`?(0,B.jsx)(ta,{status:`failed`,size:15}):c===`err`?(0,B.jsx)(ta,{status:`error`,size:15}):(0,B.jsx)(ia,{size:15})}),(0,B.jsxs)(`button`,{type:`button`,className:`cd-step-body as-button`,"aria-expanded":n,onClick:r,children:[(0,B.jsxs)(`span`,{className:`cd-step-name`,children:[l,e.source===`memory`?(0,B.jsx)(`span`,{className:`cd-mem`,title:`Replayed from page memory, no model call`,children:`memory`}):null]}),u?(0,B.jsx)(`span`,{className:`cd-step-target`,children:u}):null,e.goal||u?(0,B.jsx)(`span`,{className:`cd-step-target url`,title:e.url,children:e.url}):null,a.map((e,t)=>(0,B.jsxs)(`span`,{className:`cd-step-note fail`,children:[e.text,e.error?`: ${e.error.split(`
21
- `)[0]}`:``]},t)),s.length?(0,B.jsxs)(`span`,{className:`cd-step-note fail`,children:[U(s.reduce((e,t)=>e+(t.count||1),0),`browser error`),`: `,Ea(s[0])]}):null,t?(0,B.jsxs)(`span`,{className:`cd-step-note warn`,children:[U(t,`accessibility issue`),` on this page`]}):null]}),(0,B.jsxs)(`span`,{className:`cd-step-dur`,children:[e.ms?V(e.ms):`—`,e.model_ms?(0,B.jsxs)(`small`,{title:`Waiting for the model`,children:[V(e.model_ms),` model`]}):null]}),n?(0,B.jsxs)(`div`,{className:`cd-step-detail`,children:[e.evaluation?(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:`Evaluation of the previous step`}),` `,e.evaluation]}):null,e.memory?(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:`Agent memory`}),` `,e.memory]}):null,e.title?(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:`Page title`}),` `,e.title]}):null,o.length?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:`In the browser during this step`}),(0,B.jsxs)(`ul`,{className:`problem-list`,children:[o.map((e,t)=>(0,B.jsxs)(`li`,{className:e.level,children:[(0,B.jsx)(`span`,{className:`problem-kind`,children:e.kind===`network`?`request`:e.kind===`slow`?`slow`:e.kind===`exception`?`exception`:`console ${e.level}`}),(0,B.jsxs)(`span`,{className:`problem-text`,title:e.url||e.text,children:[Ea(e),e.count&&e.count>1?(0,B.jsxs)(`em`,{children:[` ×`,e.count]}):null]})]},t)),e.more_problems?(0,B.jsxs)(`li`,{className:`dim`,children:[`and `,e.more_problems,` more`]}):null]})]}):null,!e.evaluation&&!e.memory&&!e.title&&!o.length?(0,B.jsx)(`p`,{className:`dim`,children:e.source===`memory`?`Replayed from page memory: no model call for this step.`:`No further detail recorded.`}):null,e.shot?(0,B.jsx)(Po,{className:`tl-big`,src:e.shot,alt:`Page at step ${e.n}`,boxes:Ca(e),onClick:()=>i(e.shot)}):null]}):null]})}function Jo({c:e}){let t=e.timeline.filter(e=>e.ms),n=oo(t,Ro);if(!t.length)return(0,B.jsx)(`div`,{className:`empty`,children:`No step timings were recorded for this case.`});let r=ka(e),i=t.reduce((e,t)=>(t.ms||0)>(e.ms||0)?t:e,t[0]),a=Math.max(1,i.ms||0);return(0,B.jsxs)(`div`,{className:`cd-timing`,children:[(0,B.jsxs)(`dl`,{className:`cd-figs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Total`}),(0,B.jsx)(`dd`,{children:V(e.ms)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`In the browser`}),(0,B.jsx)(`dd`,{children:V(r.total)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Slowest step`}),(0,B.jsxs)(`dd`,{children:[V(i.ms),` `,(0,B.jsxs)(`small`,{children:[`step `,i.n]})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Average step`}),(0,B.jsx)(`dd`,{children:V(Math.round(r.total/t.length))})]})]}),(0,B.jsxs)(Wo,{title:`Where the time went`,children:[(0,B.jsxs)(`span`,{className:`split-bar cd-split`,role:`img`,"aria-label":`Waiting for the model ${V(r.model)}, acting in the browser ${V(r.browser)}, replayed from page memory ${V(r.memory)}`,children:[r.model?(0,B.jsx)(`i`,{className:`model`,style:{flexGrow:r.model}}):null,r.browser?(0,B.jsx)(`i`,{className:`browser`,style:{flexGrow:r.browser}}):null,r.memory?(0,B.jsx)(`i`,{className:`memory`,style:{flexGrow:r.memory}}):null]}),(0,B.jsxs)(`span`,{className:`ov-legend`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`sw model`}),`Waiting for the model `,V(r.model)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`sw browser`}),`Acting in the browser `,V(r.browser)]}),r.memory?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`sw memory`}),`Replayed from page memory `,V(r.memory)]}):null]})]}),(0,B.jsxs)(Wo,{title:`Time per step`,note:t.length>Ro?`${t.length} steps, in order`:void 0,children:[(0,B.jsx)(`div`,{className:`cd-bars`,children:n.shown.map(e=>{let t=e.actions.some(e=>!e.ok);return(0,B.jsxs)(`div`,{className:`cd-bar`,title:`Step ${e.n}: ${V(e.ms)}${e.model_ms?`, ${V(e.model_ms)} waiting for the model`:``}`,children:[(0,B.jsxs)(`span`,{className:`cd-bar-name`,children:[e.n,`. `,e.goal||e.actions[0]?.text||e.url]}),(0,B.jsx)(`span`,{className:`bar-track`,children:(0,B.jsx)(`i`,{style:{width:`${100*(e.ms||0)/a}%`,background:t?`var(--fail)`:`var(--brand)`}})}),(0,B.jsx)(`span`,{className:`cd-bar-ms`,children:V(e.ms)})]},e.n)})}),(0,B.jsx)(so,{...n,label:`Step timing pages`})]})]})}function Yo({c:e}){let t=e.accessibility||[],n=t.flatMap(e=>e.issues.map(t=>({i:t,page:e.title||e.url,url:e.url}))).sort((e,t)=>Ma.indexOf(e.i.impact)-Ma.indexOf(t.i.impact)||t.i.count-e.i.count),r=oo(n,zo);if(!t.length)return(0,B.jsx)(`div`,{className:`empty`,children:`Not scanned: no page of this case was checked for accessibility.`});let i=n.reduce((e,t)=>e+t.i.count,0),a=t.filter(e=>!e.issues.length).length;return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`cd-lead`,children:[n.length?`${U(i,`issue`)} of ${U(n.length,`kind`)} found by the automated scan on ${U(t.length,`page`)} this case visited${a?`; ${a} had none`:``}.`:`No issues found by the automated scan on the ${U(t.length,`page`)} this case visited.`,` `,`It finds common problems: names and labels, image text, heading order, contrast, language and zoom, not all of them.`]}),(0,B.jsx)(`div`,{className:`cd-issues`,children:r.shown.map(({i:e,page:t,url:n},i)=>(0,B.jsx)(Xo,{i:e,page:t,url:n},`${r.at}-${i}-${n}-${e.rule}`))}),(0,B.jsx)(so,{...r,label:`Accessibility issue pages`})]})}function Xo({i:e,page:t,url:n}){let r=e.examples?.[0];return(0,B.jsxs)(`div`,{className:`cd-issue`,children:[(0,B.jsxs)(`div`,{className:`cd-issue-head`,children:[(0,B.jsx)(`span`,{className:`impact ${e.impact}`,children:e.impact}),(0,B.jsx)(`strong`,{children:e.help}),(0,B.jsx)(`code`,{children:e.rule})]}),(0,B.jsxs)(`div`,{className:`cd-issue-meta`,children:[(0,B.jsx)(`span`,{children:U(e.count,`element`)}),e.wcag?(0,B.jsxs)(`span`,{children:[`WCAG `,e.wcag,e.level?` (${e.level})`:``]}):null,(0,B.jsxs)(`span`,{title:n,children:[`On `,t]})]}),r?(0,B.jsx)(`code`,{className:`cd-issue-example`,children:r.html||r.text||r.role}):null,q(e.helpUrl)?(0,B.jsx)(`a`,{href:q(e.helpUrl),target:`_blank`,rel:`noreferrer`,children:`How to fix`}):null]})}function Zo({c:e,now:t,nowBoxes:n,onShot:r}){let i=e.lastGood;if(!i)return null;let a=Da(e);if(!i.shot&&!t&&!(i.steps.length&&a.length))return null;let o=a.findIndex((e,t)=>e!==i.steps[t]),s=o<0?Math.min(a.length,i.steps.length):o;return(0,B.jsxs)(Wo,{title:`Last good vs now`,note:`last passed ${Gi(i.at)}`,children:[i.href?(0,B.jsx)(`p`,{className:`cd-lead`,children:(0,B.jsx)(`a`,{href:q(i.href),children:`Open that run's report`})}):null,i.shot||t?(0,B.jsxs)(`div`,{className:`compare-grid`,children:[(0,B.jsxs)(`figure`,{children:[(0,B.jsxs)(`figcaption`,{children:[`Last passed`,i.step?` · step ${i.step}`:``]}),i.shot?(0,B.jsx)(Po,{src:i.shot,alt:`Last passing run`,onClick:()=>r(i.shot)}):(0,B.jsx)(`div`,{className:`empty`,children:`No screenshot kept`}),i.url?(0,B.jsx)(`div`,{className:`tl-url`,children:i.url}):null]}),(0,B.jsxs)(`figure`,{children:[(0,B.jsx)(`figcaption`,{children:`This run`}),t?(0,B.jsx)(Po,{src:t,alt:`This run`,boxes:n,onClick:()=>r(t)}):(0,B.jsx)(`div`,{className:`empty`,children:`No screenshot kept`}),e.finalUrl?(0,B.jsx)(`div`,{className:`tl-url`,children:e.finalUrl}):null]})]}):null,i.steps.length&&a.length?(0,B.jsxs)(`details`,{className:`step-diff`,children:[(0,B.jsxs)(`summary`,{children:[`Browser steps compared: `,s<Math.max(a.length,i.steps.length)?`the same up to step ${s}, then they differ`:`the same steps`]}),(0,B.jsx)(`div`,{className:`diff-cols`,children:[[`Last passed`,i.steps],[`This run`,a]].map(([e,t])=>(0,B.jsxs)(`ol`,{children:[(0,B.jsx)(`li`,{className:`diff-head`,children:e}),t.map((e,t)=>(0,B.jsxs)(`li`,{className:t>=s?`differs`:``,children:[(0,B.jsx)(`b`,{children:t+1}),` `,e]},t))]},e))})]}):null]})}var Qo=/\.(webm|mp4)$/i;function $o({c:e,shots:t,onShot:n}){let[r,i]=(0,v.useState)(null),a=da(e),o=aa(e.status),s=e.files.filter(e=>Qo.test(e.name)&&q(e.href)),c=e.files.find(e=>e.name===r);return!t.length&&!e.files.length&&!e.lastGood?(0,B.jsx)(`div`,{className:`empty`,children:e.status===`stopped`?`No artifacts: this case stopped before the browser opened.`:`No screenshots or files were kept for this case.`}):(0,B.jsxs)(`div`,{className:`cd-artifacts`,children:[o?e.lastGood?(0,B.jsx)(Zo,{c:e,now:a.shot,nowBoxes:a.shotBoxes,onShot:e=>n(Math.max(0,t.findIndex(t=>t.src===e)))}):a.shot?(0,B.jsx)(Wo,{title:`Where it stopped`,children:(0,B.jsx)(`div`,{className:`compare-grid single`,children:(0,B.jsxs)(`figure`,{children:[(0,B.jsx)(Po,{src:a.shot,alt:`Last screenshot`,boxes:a.shotBoxes,onClick:()=>n(Math.max(0,t.findIndex(e=>e.src===a.shot)))}),e.finalUrl?(0,B.jsx)(`div`,{className:`tl-url`,children:e.finalUrl}):null]})})}):null:null,s.length?(0,B.jsx)(Wo,{title:`Screen recording`,children:s.map(e=>(0,B.jsx)(`video`,{className:`cd-video`,controls:!0,preload:`metadata`,src:q(e.href),children:(0,B.jsx)(`a`,{href:q(e.href),children:e.name})},e.name))}):null,t.length?(0,B.jsx)(Wo,{title:`Screenshots`,note:U(t.length,`screenshot`),children:(0,B.jsx)(`div`,{className:`shot-grid`,children:t.map((e,t)=>(0,B.jsxs)(`figure`,{onClick:()=>n(t),children:[(0,B.jsx)(Po,{src:e.src,alt:e.label,boxes:e.boxes}),(0,B.jsx)(`figcaption`,{title:e.label,children:e.label})]},t))})}):null,e.files.length?(0,B.jsxs)(Wo,{title:`Files`,note:e.runDir?void 0:U(e.files.length,`file`),children:[(0,B.jsx)(`ul`,{className:`cd-files`,children:e.files.map(e=>(0,B.jsxs)(`li`,{className:r===e.name?`active`:void 0,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:Qo.test(e.name)?(0,B.jsx)(wi,{size:14}):e.text==null?(0,B.jsx)(z,{size:14}):(0,B.jsx)(Bt,{size:14})}),(0,B.jsxs)(`span`,{className:`cd-file-name`,children:[(0,B.jsx)(`code`,{children:e.name}),(0,B.jsx)(`span`,{title:e.href,children:e.href})]}),e.text==null?null:(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>i(r===e.name?null:e.name),children:r===e.name?`Hide`:`View`}),(0,B.jsxs)(`a`,{className:`text-btn`,href:q(e.href),target:`_blank`,rel:`noreferrer`,title:`Opens when the run folder is next to this report`,children:[(0,B.jsx)(Mt,{size:12}),` Open`]})]},e.name))}),c?.text==null?null:(0,B.jsxs)(`div`,{className:`code-view`,children:[(0,B.jsxs)(`div`,{className:`code-head`,children:[(0,B.jsx)(`span`,{children:c.name}),c.truncated?(0,B.jsx)(`em`,{children:`first part only`}):null,(0,B.jsxs)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>Uo(c.text),children:[(0,B.jsx)(bt,{size:12}),` Copy`]})]}),(0,B.jsx)(`pre`,{children:c.text})]}),e.runDir?(0,B.jsxs)(`p`,{className:`hint-text`,children:[(0,B.jsx)(Yt,{size:12}),` Run folder: `,(0,B.jsx)(`code`,{children:e.runDir})]}):null]}):null]})}function es({c:e}){let t=e.memory,n=(e.quality?.breaches||[]).filter(e=>e.kind!==`accessibility`);return(0,B.jsxs)(`div`,{className:`cd-about`,children:[(0,B.jsx)(Ao,{items:[[`Source`,e.url?(0,B.jsx)(`a`,{href:q(e.url),target:`_blank`,rel:`noreferrer`,children:Xi(e.source)}):Xi(e.source)],[`Area`,e.group],[`Description`,e.description?.trim()?(0,B.jsx)(`span`,{className:`pre-line`,children:e.description.trim()}):void 0],[`Preconditions`,e.preconditions?.length?e.preconditions.join(`; `):void 0],[`Requirements`,e.requirements?.length?(0,B.jsx)(`span`,{className:`code-list`,children:e.requirements.map(e=>(0,B.jsx)(`span`,{className:`tag-pill req`,children:e},e))}):void 0],[`Skills`,e.skills?.length?e.skills.join(`, `):void 0],[`Ran`,`${qi(e.startedAt)}, took ${V(e.ms)}`],[`Start page`,e.startUrl?(0,B.jsx)(`code`,{children:e.startUrl}):void 0],[`Last page`,e.finalUrl?(0,B.jsx)(`code`,{children:e.finalUrl}):void 0],[`Page memory`,t?Ho(e):void 0],[`Tokens and cost`,e.tokens?`${H(e.tokens)} tokens${e.cost?`, ${G(e.cost)}`:``}${e.codeCost?` (browser ${G(e.browserCost)}, coding ${G(e.codeCost)})`:``}`:void 0],[`Recorded in`,e.posted.length?(0,B.jsx)(`span`,{className:`posted-inline`,children:e.posted.map((e,t)=>(0,B.jsxs)(`span`,{className:e.error?`fail-text`:void 0,children:[Xi(e.source),`: `,e.url?(0,B.jsx)(`a`,{href:q(e.url),children:e.text}):e.text,e.error?` (not posted: ${e.error})`:``]},t))}):void 0],[`Test written`,e.code?(0,B.jsxs)(B.Fragment,{children:[e.code.status,` after `,U(e.code.attempts,`attempt`),e.code.testFile?(0,B.jsxs)(B.Fragment,{children:[` in `,(0,B.jsx)(`code`,{children:e.code.testFile})]}):null,e.code.command?(0,B.jsxs)(B.Fragment,{children:[` · run with `,(0,B.jsx)(`code`,{children:e.code.command})]}):null]}):void 0]]}),n.length?(0,B.jsx)(Wo,{title:`Over budget`,children:(0,B.jsx)(`ul`,{className:`qc-list`,children:n.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`status-pill fail`,children:e.kind===`performance`?`Performance`:`Visual`}),e.page,`: `,e.text]},t))})}):null,t?.repaired||t?.stopped||t?.heals?.length?(0,B.jsx)(Wo,{title:`Page memory`,note:`mode: ${t.mode}`,children:(0,B.jsxs)(`div`,{className:`memory-box`,children:[t.repaired?(0,B.jsxs)(`div`,{className:`memory-note`,children:[(0,B.jsx)(`b`,{children:`Flow repaired.`}),` Replay stopped at step `,t.repaired.step,` (`,t.repaired.reason,`); the agent finished the case in `,U(t.repaired.agentSteps,`step`),` and the flow was saved again.`]}):t.stopped?(0,B.jsxs)(`div`,{className:`memory-note`,children:[`Replay handed over to the agent: `,t.stopped]}):null,t.heals?.length?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`dim`,children:`Healed locators: the page changed, and page memory found the element another way`}),(0,B.jsx)(`ul`,{className:`heal-list`,children:t.heals.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`b`,{children:[`Step `,e.step]}),` `,e.label||e.line,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`stale`,children:e.stale.join(`, `)}),` no longer matched`,e.used?(0,B.jsxs)(B.Fragment,{children:[`; used `,(0,B.jsx)(`code`,{children:e.used})]}):null]})]},t))})]}):null]})}):null]})}function ts({c:e,runs:t,isNew:n,isFlaky:r,byFramework:i}){let[a,o]=(0,v.useState)(i?`artifacts`:`steps`),[s,c]=(0,v.useState)(null),l=(0,v.useMemo)(()=>{if(!e)return[];let t=e.lastGood?.shot?[{src:e.lastGood.shot,label:`Last passing run · ${Gi(e.lastGood.at)}${e.lastGood.url?` · ${e.lastGood.url}`:``}`}]:[];return[...la(e),...t]},[e]),u=(0,v.useMemo)(()=>{let t=new Map;if(!e?.accessibility?.length)return t;let n=new Map(e.accessibility.filter(e=>e.issues.length).map(e=>[e.url.split(`#`)[0],e.issues.reduce((e,t)=>e+t.count,0)]));for(let r of e.timeline){let e=(r.url||``).split(`#`)[0];n.has(e)&&(t.set(r.n,n.get(e)||0),n.delete(e))}return t},[e]);if(!e)return(0,B.jsx)(`section`,{className:`panel cd`,children:(0,B.jsx)(`div`,{className:`empty`,children:`Select a case from the list.`})});let d=da(e),f=aa(e.status),p=Za(e),m=Qa(e),h=e.steps.some(e=>e.status),g=e.timeline.some(e=>e.ms),_=(t||[]).filter(e=>e.status===`passed`).length,y=e.status===`stopped`?`Not run`:d.failedStep?`${Zi[e.status]} at step ${d.failedStep.n} of ${e.steps.length}: ${d.failedStep.action}`:e.status===`error`?`Could not run`:Zi[e.status],b=[...i?[]:[{id:`steps`,label:`Steps`,icon:In,count:String(e.steps.length||e.timeline.length||e.agentSteps?.length||`—`)}],...g?[{id:`timing`,label:`Timing`,icon:$t,count:V(e.ms)}]:[],...i?[]:[{id:`a11y`,label:`Accessibility`,icon:te,count:m===void 0?`—`:m.toLocaleString()}],{id:`artifacts`,label:`Artifacts`,icon:gn,count:String(l.length+e.files.length)},{id:`about`,label:`About`,icon:Sn}];return(0,B.jsxs)(`section`,{className:`panel cd`,"aria-labelledby":`cd-title`,children:[(0,B.jsxs)(`div`,{className:`cd-head`,children:[(0,B.jsxs)(`div`,{className:`cd-title-row`,children:[(0,B.jsx)(ea,{status:e.status}),(0,B.jsx)(`h2`,{id:`cd-title`,className:`cd-title`,children:e.title})]}),(0,B.jsxs)(`div`,{className:`cd-meta`,children:[(0,B.jsx)(`code`,{children:e.id}),(0,B.jsxs)(`span`,{children:[e.url?(0,B.jsx)(`a`,{href:q(e.url),target:`_blank`,rel:`noreferrer`,children:Xi(e.source)}):Xi(e.source),e.group?` · ${e.group}`:``]}),e.code?.testFile?(0,B.jsx)(`code`,{children:e.code.testFile}):null,(e.tags||[]).map(e=>(0,B.jsx)(`span`,{className:`tag-pill`,children:e},e)),e.failure?(0,B.jsx)(`span`,{className:`status-pill ${Lo[e.failure.type]||`brand`}`,children:Io[e.failure.type]||e.failure.label}):null,d.bug?(0,B.jsx)(`a`,{className:`status-pill brand`,href:q(d.bug.url),target:`_blank`,rel:`noreferrer`,children:d.bug.text.split(`:`)[0]}):null]}),t&&t.length>1?(0,B.jsxs)(`div`,{className:`cd-history`,children:[(0,B.jsxs)(`span`,{className:`cd-history-label`,children:[`Last `,t.length,` runs`]}),(0,B.jsx)(Bo,{runs:t,size:`md`}),(0,B.jsxs)(`span`,{children:[`Passed `,_,` of the last `,t.length,` runs`]}),n?(0,B.jsx)(`span`,{className:`tr-tag fail`,children:`New failure: passed in the previous run`}):null,r?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Flaky: passes and fails between runs`}):null]}):null,(0,B.jsxs)(`dl`,{className:`cd-figs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Duration`}),(0,B.jsx)(`dd`,{children:e.status===`stopped`?`Not run`:V(e.ms)})]}),i?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Steps`}),(0,B.jsx)(`dd`,{children:h?`${e.steps.filter(e=>e.status===`passed`).length} of ${e.steps.length}`:e.steps.length||e.timeline.length||`—`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Tokens`}),(0,B.jsx)(`dd`,{children:e.tokens?H(e.tokens):`0`})]}),(0,B.jsxs)(`div`,{title:K(e.cost),children:[(0,B.jsx)(`dt`,{children:`Cost`}),(0,B.jsx)(`dd`,{children:G(e.cost)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Browser errors`}),(0,B.jsx)(`dd`,{className:p?`tone-fail`:void 0,children:e.diagnostics||e.timeline.length?p.toLocaleString():`—`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Accessibility`}),(0,B.jsx)(`dd`,{className:m?`tone-warn`:void 0,children:m===void 0?`—`:m.toLocaleString()})]})]})]})]}),e.status===`passed`?null:(0,B.jsxs)(`div`,{className:`cd-failure ${f?`fail`:`warn`}`,children:[(0,B.jsxs)(`strong`,{children:[f?(0,B.jsx)(ta,{status:e.status,size:15}):(0,B.jsx)(ia,{size:15}),y]}),(0,B.jsx)(`p`,{className:`cd-failure-msg`,children:e.summary}),e.failure?(0,B.jsxs)(`p`,{className:`cd-failure-note`,children:[(0,B.jsxs)(`b`,{children:[Io[e.failure.type]||e.failure.label,`:`]}),` `,e.failure.reason,` Next: `,e.failure.action,`.`,e.retried?` The first run met an environment problem, so it ran once more.`:``]}):null,d.failedStep&&(d.failedStep.expected||d.failedStep.actual)?(0,B.jsxs)(`dl`,{className:`cd-expect`,children:[d.failedStep.expected?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Expected`}),(0,B.jsx)(`dd`,{children:d.failedStep.expected})]}):null,d.failedStep.actual?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Actual`}),(0,B.jsx)(`dd`,{className:`tone-fail`,children:d.failedStep.actual})]}):null]}):null,d.failedActions.length?(0,B.jsxs)(`ul`,{className:`cd-failed-actions`,children:[d.failedActions.slice(0,3).map((e,t)=>(0,B.jsxs)(`li`,{children:[`Browser step `,e.step,`: `,e.text,e.error?(0,B.jsx)(`code`,{children:e.error.split(`
22
- `)[0]}):null]},t)),d.failedActions.length>3?(0,B.jsxs)(`li`,{className:`dim`,children:[`and `,d.failedActions.length-3,` more failed actions`]}):null]}):null,e.code?.knownDefect?(0,B.jsxs)(`p`,{className:`cd-failure-note`,children:[`A test for the correct behaviour was written to `,e.code.testFile,` and marked as an expected failure until the defect is fixed.`]}):null,e.code?.attention?(0,B.jsxs)(`p`,{className:`cd-failure-note`,children:[`The generated test did not finish; it was moved to `,e.code.attention,`/ with a README on how to pick it up.`]}):null,(0,B.jsxs)(`div`,{className:`cd-failure-actions`,children:[d.failedStep?(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>{o(`steps`),requestAnimationFrame(()=>document.getElementById(`cd-failing-step`)?.scrollIntoView({block:`center`,behavior:`smooth`}))},children:`Show failing step`}):null,l.length||e.files.length?(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>o(`artifacts`),children:e.lastGood?`Compare with the last good run`:`See screenshots and files`}):null]})]}),(0,B.jsx)(`div`,{className:`cd-tabs`,role:`tablist`,"aria-label":`Case details`,children:b.map(e=>{let t=e.icon;return(0,B.jsxs)(`button`,{id:`cd-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":a===e.id,"aria-controls":`cd-panel`,className:`cd-tab${a===e.id?` active`:``}`,onClick:()=>o(e.id),children:[(0,B.jsx)(t,{size:14}),e.label,e.count?(0,B.jsx)(`span`,{className:`cd-tab-count`,children:e.count}):null]},e.id)})}),(0,B.jsxs)(`div`,{className:`cd-panel`,id:`cd-panel`,role:`tabpanel`,"aria-labelledby":`cd-tab-${a}`,children:[a===`steps`?(0,B.jsxs)(B.Fragment,{children:[e.steps.length?(0,B.jsx)(Wo,{title:`Test steps`,note:h?`${e.steps.filter(e=>e.status===`passed`).length} of ${e.steps.length} passed`:void 0,children:(0,B.jsx)(Go,{c:e,failed:d.failedStep?.n})}):null,(0,B.jsx)(Wo,{title:`Browser steps`,note:e.timeline.some(e=>e.source===`memory`)?`${e.timeline.filter(e=>e.source===`memory`).length} replayed from page memory`:void 0,children:(0,B.jsx)(Ko,{c:e,a11ySteps:u,onShot:e=>c(Math.max(0,l.findIndex(t=>t.src===e)))})})]}):null,a===`timing`?(0,B.jsx)(Jo,{c:e}):null,a===`a11y`?(0,B.jsx)(Yo,{c:e}):null,a===`artifacts`?(0,B.jsx)($o,{c:e,shots:l,onShot:c}):null,a===`about`?(0,B.jsx)(es,{c:e}):null]}),s==null?null:(0,B.jsx)(Fo,{shots:l,index:s,onIndex:c,onClose:()=>c(null)})]})}var ns=[10,25,50,100];function rs(e){let t=[...e.history].sort((e,t)=>e.at.localeCompare(t.at)).slice(-6),n=new Map;for(let r of e.cases){let e=t.map(e=>({at:e.at,current:!!e.current,status:e.cases.find(e=>e.id===r.id)?.status})),i=e.findIndex(e=>e.current);i<0?e.push({at:r.startedAt,current:!0,status:r.status}):e[i].status||(e[i]={...e[i],status:r.status}),n.set(r.id,e.filter(e=>e.status).slice(-6))}return n}function is({data:e,caseId:t,onSelect:n}){let r=e.cases,[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(`all`),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(`all`),[f,p]=(0,v.useState)(ns[0]),m=r.find(e=>e.id===t)||r.find(e=>e.status!==`passed`)||r[0],h=[...new Set(r.map(e=>e.source))],g=(0,v.useMemo)(()=>{let t=Oa(e),n=new Set((t?.newFailures||[]).map(e=>e.id)),i=new Set(ma(e.history).map(e=>e.id));return{newIds:n,flakyIds:i,slowIds:new Set([...r].filter(e=>e.status!==`stopped`).sort((e,t)=>t.ms-e.ms).slice(0,3).map(e=>e.id)),hay:new Map(r.map(e=>[e.id,[e.id,e.title,e.summary,Xi(e.source),e.group,e.code?.testFile,...e.tags||[],...e.steps.flatMap(e=>[e.action,e.expected,e.actual]),...e.timeline.flatMap(e=>[e.goal,e.url,...e.actions.map(e=>`${e.text} ${e.error||``}`),...(e.problems||[]).map(Ea)]),...(e.accessibility||[]).flatMap(e=>e.issues.map(e=>`${e.rule} ${e.help}`)),n.has(e.id)?`new failure`:``,i.has(e.id)?`flaky`:``].filter(Boolean).join(` `).toLowerCase()])),runs:rs(e)}},[e,r]),_={new:e=>g.newIds.has(e.id),flaky:e=>g.flakyIds.has(e.id),slow:e=>g.slowIds.has(e.id),errors:e=>Za(e)>0,a11y:e=>(Qa(e)||0)>0},y={all:r.length,passed:r.filter(e=>e.status===`passed`).length,failed:r.filter(e=>e.status===`failed`).length,error:r.filter(e=>e.status===`error`).length,stopped:r.filter(e=>e.status===`stopped`).length},b=i.trim().toLowerCase(),x=r.filter(e=>(o===`all`||e.status===o)&&(u===`all`||e.source===u)&&(!c||_[c](e))&&(!b||(g.hay.get(e.id)||``).includes(b)));c===`slow`&&(x=[...x].sort((e,t)=>t.ms-e.ms));let S=oo(x,f),C=x.length!==r.length,w=[[`all`,`All`],[`passed`,`Passed`],[`failed`,`Failed`],[`error`,`Could not run`],[`stopped`,`Not run`]],T=[[`new`,`New failures`,bi],[`flaky`,`Flaky`,Oi],[`slow`,`Slowest 3`,mi],[`errors`,`Browser errors`,er],[`a11y`,`Accessibility issues`,te]];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`panel tr-filters`,"aria-label":`Find test cases`,children:[(0,B.jsxs)(`div`,{className:`tr-filter-row`,children:[(0,B.jsxs)(`label`,{className:`table-search tr-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:i,placeholder:`Search cases, steps, selectors, errors or tags`,"aria-label":`Search test cases`,onChange:e=>{a(e.target.value),S.setPage(0)}})]}),(0,B.jsx)(`div`,{className:`tr-chips`,role:`group`,"aria-label":`Filter by result`,children:w.filter(([e])=>e===`all`||y[e]||o===e).map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":o===e,className:`chip-btn${o===e?` active`:``}`,onClick:()=>{s(e),S.setPage(0)},children:[t,(0,B.jsx)(`span`,{className:`chip-count`,children:y[e].toLocaleString()})]},e))}),h.length>1?(0,B.jsxs)(`select`,{className:`field tr-source`,"aria-label":`Filter by source`,value:u,onChange:e=>{d(e.target.value),S.setPage(0)},children:[(0,B.jsx)(`option`,{value:`all`,children:`All sources`}),h.map(e=>(0,B.jsx)(`option`,{value:e,children:Xi(e)},e))]}):null]}),(0,B.jsxs)(`div`,{className:`tr-focus`,role:`group`,"aria-label":`Focus on`,children:[(0,B.jsx)(`span`,{className:`tr-focus-label`,children:`Focus on`}),T.map(([e,t,n])=>{let i=r.filter(_[e]).length;return!i&&c!==e?null:(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":c===e,className:`tr-focus-btn${c===e?` active`:``}`,onClick:()=>{l(c===e?null:e),S.setPage(0)},children:[(0,B.jsx)(n,{size:14}),t,(0,B.jsx)(`span`,{className:`tr-focus-count`,children:i.toLocaleString()})]},e)})]})]}),(0,B.jsxs)(`div`,{className:`tr-layout`,children:[(0,B.jsxs)(`section`,{className:`panel tr-list`,"aria-label":`Test cases`,children:[(0,B.jsx)(`div`,{className:`tr-list-head`,children:C?`${x.length.toLocaleString()} of ${U(r.length,`case`).replace(/^\d+/,r.length.toLocaleString())} match`:U(r.length,`case`).replace(/^\d+/,r.length.toLocaleString())}),x.length?null:(0,B.jsxs)(`div`,{className:`tr-none`,children:[(0,B.jsx)(`strong`,{children:b?`No cases match “${i.trim()}”`:`No cases match these filters`}),(0,B.jsx)(`span`,{children:`Search looks in case names, steps, pages, selectors, error messages, accessibility rules and tags.`}),(0,B.jsx)(`button`,{type:`button`,className:`btn soft`,onClick:()=>{a(``),s(`all`),l(null),d(`all`),S.setPage(0)},children:`Clear search and filters`})]}),(0,B.jsx)(`ul`,{className:`tr-cases`,children:S.shown.map(e=>{let t=Za(e),r=Qa(e)||0,i=e.steps.length||e.timeline.length,a=m?.id===e.id;return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`tr-case${a?` active`:``}`,"aria-current":a?`true`:void 0,onClick:()=>n(e.id),title:`${e.id} ${e.title}`,children:[(0,B.jsx)(na,{status:e.status,size:15}),(0,B.jsx)(`span`,{className:`tr-case-name`,children:e.title}),(0,B.jsxs)(`span`,{className:`tr-case-meta`,children:[g.newIds.has(e.id)?(0,B.jsx)(`span`,{className:`tr-tag fail`,children:`New failure`}):null,g.flakyIds.has(e.id)?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Flaky`}):null,(0,B.jsx)(`span`,{className:`tr-case-id`,children:e.id}),(0,B.jsx)(`span`,{children:e.status===`stopped`?`Not run`:V(e.ms)}),i?(0,B.jsx)(`span`,{children:U(i,`step`)}):null,t?(0,B.jsx)(`span`,{className:`tone-fail`,children:U(t,`browser error`)}):null,r?(0,B.jsxs)(`span`,{className:`tone-warn`,children:[r.toLocaleString(),` accessibility`]}):null]}),(g.runs.get(e.id)?.length||0)>1?(0,B.jsx)(Bo,{runs:g.runs.get(e.id)||[]}):null]})},e.id)})}),(0,B.jsxs)(`div`,{className:`tr-list-foot`,children:[(0,B.jsx)(so,{...S,label:`Case list pages`}),x.length>ns[0]?(0,B.jsxs)(`label`,{className:`tr-per`,children:[`Per page`,(0,B.jsx)(`select`,{className:`field`,value:f,onChange:e=>{p(Number(e.target.value)),S.setPage(0)},children:ns.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}):null]})]}),(0,B.jsx)(ts,{c:m,runs:m?g.runs.get(m.id):void 0,isNew:!!m&&g.newIds.has(m.id),isFlaky:!!m&&g.flakyIds.has(m.id),byFramework:!!e.framework},m?.id||`none`)]})]})}var as=10,os=15;function ss({data:e}){let t=(0,v.useMemo)(()=>[...e.history].sort((e,t)=>t.at.localeCompare(e.at)||Number(!!t.current)-Number(!!e.current)),[e.history]),[n,r]=(0,v.useState)(``),i=n.trim().toLowerCase(),a=i?t.filter(e=>`${e.id} ${e.current?`this run`:``} ${Gi(e.at)} ${qi(e.at)} ${e.at}`.toLowerCase().includes(i)):t,o=oo(a,as);if(t.length<=1)return(0,B.jsxs)(`section`,{className:`panel trh`,"aria-label":`Run history`,children:[(0,B.jsx)(Y,{icon:Ar,tone:`brand`,title:`Run history`}),(0,B.jsxs)(`div`,{className:`trh-empty`,children:[(0,B.jsx)(`strong`,{children:`No earlier runs yet`}),(0,B.jsx)(`span`,{children:`Earlier suite runs in the same folder show up here, with their pass rates, so you can compare.`})]})]});let s=e=>J(e.passed,e.total),c=t[t.length-1],l=t[0],u=Math.round((s(l)-s(c))*10)/10,d=t.filter(e=>e.ms>0),f=d.reduce((e,t)=>t.ms>e.ms?t:e,d[0]||l),p=d.reduce((e,t)=>t.ms<e.ms?t:e,d[0]||l),m=e=>e.current?`this run`:e.id,h=t.some(e=>e.cost);return(0,B.jsxs)(`section`,{className:`panel trh`,"aria-label":`Run history`,children:[(0,B.jsx)(Y,{icon:Ar,tone:`brand`,title:`Run history`,note:`newest first`}),(0,B.jsxs)(`p`,{className:`trh-lead`,children:[t.length.toLocaleString(),` runs in this folder, `,Ki(c.at),` to `,Ki(l.at),`. Pass rate`,` `,u===0?(0,B.jsxs)(B.Fragment,{children:[`held at `,s(l),`%`]}):(0,B.jsxs)(B.Fragment,{children:[`went from `,s(c),`% to `,(0,B.jsxs)(`b`,{className:u>0?`tone-pass`:`tone-fail`,children:[s(l),`%`]}),` (`,u>0?`+`:`−`,Math.abs(u),` points)`]}),`.`,d.length>1?(0,B.jsxs)(B.Fragment,{children:[` `,`Slowest `,m(f),` at `,V(f.ms),` (`,Gi(f.at),`); fastest `,m(p),` at `,V(p.ms),` (`,Gi(p.at),`).`]}):null]}),t.length>as?(0,B.jsxs)(`div`,{className:`table-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:n,placeholder:`Search by run id or date`,"aria-label":`Search runs`,onChange:e=>{r(e.target.value),o.setPage(0)}})]}),(0,B.jsx)(`span`,{className:`table-count`,children:i?`${a.length.toLocaleString()} of ${t.length.toLocaleString()} runs`:`${t.length.toLocaleString()} runs`})]}):null,(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data trh-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Run`}),(0,B.jsx)(`th`,{children:`When`}),(0,B.jsx)(`th`,{className:`trh-results`,children:`Results`}),(0,B.jsx)(`th`,{className:`trh-rate`,children:`Pass rate`}),(0,B.jsx)(`th`,{className:`num`,children:`Duration`}),(0,B.jsx)(`th`,{className:`num`,children:`Tokens`}),h?(0,B.jsx)(`th`,{className:`num`,children:`Cost`}):null,(0,B.jsx)(`th`,{"aria-label":`Report`})]})}),(0,B.jsx)(`tbody`,{children:o.shown.map(e=>{let t=e.current?void 0:q(e.href),n=[[`passed`,e.passed,`passed`],[`failed`,e.failed,`failed`],[`error`,e.error,`could not run`],[`stopped`,e.stopped,`not run`]];return(0,B.jsxs)(`tr`,{className:e.current?`current`:void 0,children:[(0,B.jsxs)(`td`,{className:`trh-run`,children:[(0,B.jsx)(`code`,{title:e.id,children:e.id}),e.current?(0,B.jsx)(`span`,{className:`status-pill brand`,children:`This run`}):null]}),(0,B.jsx)(`td`,{className:`trh-when`,title:qi(e.at),children:Gi(e.at)}),(0,B.jsxs)(`td`,{className:`trh-results`,children:[(0,B.jsx)(`span`,{className:`trh-split`,role:`img`,"aria-label":n.filter(([,e])=>e).map(([,e,t])=>`${e.toLocaleString()} ${t}`).join(`, `)||`no cases`,children:n.map(([e,t])=>t?(0,B.jsx)(`i`,{className:e,style:{flexGrow:t}},e):null)}),(0,B.jsx)(`span`,{className:`trh-counts`,children:n.map(([e,t,n])=>t||e===`passed`||e===`failed`?(0,B.jsxs)(`span`,{title:`${t.toLocaleString()} ${n}`,children:[(0,B.jsx)(ta,{status:e,size:12}),t.toLocaleString()]},e):null)})]}),(0,B.jsxs)(`td`,{className:`trh-rate`,children:[(0,B.jsxs)(`span`,{className:`trh-rate-value`,children:[s(e),`%`]}),(0,B.jsx)(`span`,{className:`trh-rate-bar`,"aria-hidden":`true`,children:(0,B.jsx)(`i`,{style:{width:`${s(e)}%`}})})]}),(0,B.jsx)(`td`,{className:`num`,children:V(e.ms)}),(0,B.jsx)(`td`,{className:`num`,children:H(e.tokens)}),h?(0,B.jsx)(`td`,{className:`num`,children:e.cost?G(e.cost):`—`}):null,(0,B.jsx)(`td`,{className:`trh-link`,children:t?(0,B.jsxs)(`a`,{href:t,title:`Open that run's report`,children:[(0,B.jsx)(Mt,{size:12}),` Report`]}):null})]},`${e.id}-${e.at}`)})})]})}),a.length?null:(0,B.jsxs)(`div`,{className:`trh-empty`,children:[`No runs match “`,n.trim(),`”.`]}),(0,B.jsx)(so,{...o,label:`Run history pages`})]})}var cs=[[`shot`,`Screenshots`],[`text`,`Logs and text`],[`trace`,`Traces`],[`video`,`Recordings`],[`other`,`Other`]],ls={shot:gn,text:Bt,trace:It,video:wi,other:z};function us(e){let t=(e.toLowerCase().match(/\.([a-z0-9]+)$/)||[])[1]||``;return/^(png|jpe?g|gif|webp|bmp|svg|avif)$/.test(t)?`shot`:/^(webm|mp4|mov|mkv|avi)$/.test(t)?`video`:/^(zip|har|trace)$/.test(t)?`trace`:/^(txt|log|md|json|jsonl|csv|xml|html?|ya?ml|out|err|cs|ts|js|py|feature)$/.test(t)?`text`:`other`}function ds({data:e,onOpen:t}){let n=(0,v.useMemo)(()=>e.cases.flatMap(e=>e.files.map(t=>({c:e,f:t,kind:us(t.name)}))),[e.cases]),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(`all`),s=r.trim().toLowerCase(),c=new Map;for(let e of n)c.set(e.kind,(c.get(e.kind)||0)+1);let l=n.filter(e=>(a===`all`||e.kind===a)&&(!s||`${e.c.id} ${e.c.title} ${e.f.name} ${e.f.href}`.toLowerCase().includes(s))),u=oo(l,os),d=e=>{e(),u.setPage(0)};return(0,B.jsxs)(`section`,{className:`panel trf`,"aria-label":`All files`,children:[(0,B.jsx)(Y,{icon:Yt,tone:`brand`,title:`All files`,note:`${n.length.toLocaleString()} ${n.length===1?`file`:`files`} from ${U(new Set(n.map(e=>e.c.id)).size,`case`).replace(/^\d+/,e=>Number(e).toLocaleString())}`}),n.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`trf-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:r,placeholder:`Search case, title, file name or path`,"aria-label":`Search files`,onChange:e=>d(()=>i(e.target.value))})]}),(0,B.jsxs)(`div`,{className:`tr-chips`,role:`group`,"aria-label":`Filter by kind`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":a===`all`,className:`chip-btn${a===`all`?` active`:``}`,onClick:()=>d(()=>o(`all`)),children:[`All`,(0,B.jsx)(`span`,{className:`chip-count`,children:n.length.toLocaleString()})]}),cs.filter(([e])=>c.get(e)||a===e).map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":a===e,className:`chip-btn${a===e?` active`:``}`,onClick:()=>d(()=>o(e)),children:[t,(0,B.jsx)(`span`,{className:`chip-count`,children:(c.get(e)||0).toLocaleString()})]},e))]})]}),(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data trf-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Case`}),(0,B.jsx)(`th`,{children:`File`}),(0,B.jsx)(`th`,{className:`trf-kind`,children:`Kind`}),(0,B.jsx)(`th`,{className:`trf-path`,children:`Path`})]})}),(0,B.jsx)(`tbody`,{children:u.shown.map(({c:e,f:n,kind:r},i)=>{let a=q(n.href),o=ls[r];return(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{className:`trf-case`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>t(e.id),title:`${e.id} ${e.title}`,children:e.id}),(0,B.jsx)(`span`,{className:`trf-title`,title:e.title,children:e.title})]}),(0,B.jsxs)(`td`,{className:`trf-name`,children:[(0,B.jsx)(o,{size:14}),a?(0,B.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,title:n.name,children:n.name}):(0,B.jsx)(`span`,{title:n.name,children:n.name})]}),(0,B.jsx)(`td`,{className:`trf-kind`,children:cs.find(([e])=>e===r)?.[1]}),(0,B.jsx)(`td`,{className:`trf-path`,title:n.href,children:n.href})]},`${u.at}-${i}-${e.id}/${n.name}`)})})]})}),l.length?null:(0,B.jsxs)(`div`,{className:`trh-empty`,children:[`No files match`,s?` “${r.trim()}”`:` this kind`,`.`]}),(0,B.jsx)(so,{...u,label:`File pages`}),(0,B.jsx)(`p`,{className:`ov-caption trf-note`,children:`Links open files from the run folders next to this report. Text files are also embedded: view them in each case's Artifacts tab.`})]}):(0,B.jsx)(`div`,{className:`trh-empty`,children:`No files were recorded for this run.`})]})}function fs({data:e,caseId:t,onSelect:n,initialTab:r=`tests`}){let[i,a]=(0,v.useState)(r),o=oa(e);return(0,B.jsxs)(`div`,{className:`test-results`,children:[(0,B.jsx)(no,{title:(0,B.jsxs)(B.Fragment,{children:[`Test results `,(0,B.jsx)(ra,{verdict:sa(e)})]}),subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsxs)(`span`,{children:[U(o.ran,`case`).replace(/^\d+/,o.ran.toLocaleString()),` ran in `,V(e.ms)]}),(0,B.jsxs)(`span`,{children:[o.passed.toLocaleString(),` of `,o.total.toLocaleString(),` passed`]}),(0,B.jsxs)(`span`,{children:[`Run `,(0,B.jsx)(`code`,{children:e.id})]}),(0,B.jsx)(`span`,{title:qi(e.startedAt),children:e.title})]}),actions:mo(e)}),e.kind===`suite`||e.cases.some(e=>e.files.length)?(0,B.jsx)(ro,{value:i,onChange:a,items:[{id:`tests`,label:`Tests`,icon:ut,count:e.cases.length},...e.kind===`suite`?[{id:`history`,label:`Run history`,icon:Ar,count:e.history.length||void 0}]:[],{id:`files`,label:`All files`,icon:Yt,count:e.cases.reduce((e,t)=>e+t.files.length,0)||void 0}]}):null,i===`tests`?(0,B.jsx)(is,{data:e,caseId:t,onSelect:n}):null,i===`history`?(0,B.jsx)(ss,{data:e}):null,i===`files`?(0,B.jsx)(ds,{data:e,onOpen:e=>{n(e),a(`tests`)}}):null]})}var ps={functional_defect:{label:`Product bug`,one:`product bug`,many:`product bugs`,tone:`fail`,icon:Ee,desc:`Fix in the product: file a bug with the evidence`},test_case_issue:{label:`Test needs update`,one:`test that needs updating`,many:`tests that need updating`,tone:`warn`,icon:gr,desc:`The product works as designed; change the test`},environment:{label:`Environment`,one:`environment problem`,many:`environment problems`,tone:`brand`,icon:Hr,desc:`Fix the test setup or the site it runs against, not the code`},automation:{label:`Automation`,one:`automation problem`,many:`automation problems`,tone:`brand`,icon:Se,desc:`The browser agent or the test code could not do a step`}},ms={label:`Not classified`,icon:nt,desc:`ForgeQE did not say what kind of failure this was`},hs=10,gs=10,_s=12,vs=20,ys=/\.(webm|mp4)$/i,bs=/trace.*\.zip$/i,xs=e=>e.failure&&ps[e.failure.type]?e.failure.type:`none`;function Ss(e){let t=da(e),n=[];t.failedStep&&n.push(`Step ${t.failedStep.n} "${t.failedStep.action}" failed${t.failedStep.expected?`: expected ${t.failedStep.expected}`:``}${t.failedStep.actual?`; saw ${t.failedStep.actual}`:``}`),t.notRun&&n.push(`${U(t.notRun,`later step`)} not run`);for(let e of t.failedActions)n.push(`Browser step ${e.step}: ${e.text}${e.error?` → ${e.error}`:``}`);t.lastEval&&n.push(`Agent's last evaluation: ${t.lastEval}`);for(let e of t.errors.slice(0,5))n.push(`Browser, step ${e.step}: ${Ea(e)}${e.count&&e.count>1?` (×${e.count})`:``}`);return t.errors.length>5&&n.push(`and ${t.errors.length-5} more browser errors`),e.finalUrl&&n.push(`Last page: ${e.finalUrl}`),n}function Cs(e){let t=da(e);return[`${e.id} ${e.title}: ${Zi[e.status]}`,e.summary,``,...Ss(e).map(e=>`- ${e}`),t.bug?.url?`Bug: ${t.bug.url}`:``].filter(Boolean).join(`
20
+ `)[0]].filter(Boolean).join(` · `),caseId:e.id,mono:!1}})],Oe=[...h.map(e=>({key:`err-${e.text}`,count:`${e.count.toLocaleString()}×`,tone:`fail`,msg:e.text,where:`${bo(e.steps)}${e.cases.size>1||!c?` · ${X(e.cases.size,`case`)}`:``}`,mono:!0})),...v.map(e=>({key:`a11y-${e.issue.rule}`,count:`${e.count.toLocaleString()}×`,tone:`warn`,msg:`${e.issue.rule}: ${e.issue.help}`,where:`${e.issue.impact} · ${lo([...new Set(e.pages)],2)}`,mono:!0}))],ke=Oe.length?Math.max(6-Oe.length,3):6,Ae=[...De.slice(0,ke),...Oe,...De.slice(ke)],je=[...l.length?[`${X(l.length,`case`)} did not pass`]:[],...r.browserErrors?[`${X(r.browserErrors,`browser error`)}${h.length?` in ${X(h.length,`kind`)}`:``}`]:[],...r.a11yIssues?[X(r.a11yIssues,`accessibility issue`)]:[]];return(0,B.jsxs)(`div`,{className:`overview`,children:[(0,B.jsx)(no,{title:(0,B.jsxs)(B.Fragment,{children:[e.title,` `,(0,B.jsx)(ra,{verdict:i})]}),subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsx)(`span`,{title:qi(e.startedAt),children:qi(e.startedAt)}),(0,B.jsxs)(`span`,{children:[`Run `,(0,B.jsx)(`code`,{children:e.id})]}),e.env?.ci?(0,B.jsxs)(`span`,{children:[`Build `,e.env.ci.url?(0,B.jsx)(`a`,{href:q(e.env.ci.url),children:e.env.ci.name}):e.env.ci.name]}):(0,B.jsx)(`span`,{children:e.kind===`run`?`Single run`:`Suite run`}),e.env?.branch?(0,B.jsxs)(`span`,{children:[`Branch `,(0,B.jsx)(`code`,{children:e.env.branch})]}):null]}),actions:mo(e)}),(0,B.jsx)(ho,{items:ve}),(0,B.jsxs)(`div`,{className:`ov-grid`,children:[(0,B.jsxs)(`section`,{className:`panel ov-s7 ov-wide ov-summary`,children:[(0,B.jsx)(Y,{icon:z,tone:`brand`,title:`Execution summary`,action:a?{label:a.newFailures.length?`${X(a.newFailures.length,`new failure`)} since last run`:`Since last run`,onClick:()=>t(`changes`)}:void 0}),pe?(0,B.jsx)(`p`,{className:`ov-lead`,children:pe}):null,(0,B.jsxs)(`p`,{className:pe?`ov-text`:`ov-lead`,children:[R,!c&&de.length?` ${de.map(([e,t])=>`${e.toLocaleString()} ${t}`).join(`, `)}.`:``]}),me.length||he?(0,B.jsxs)(`p`,{className:`ov-text`,children:[me.length?`Worth a look before you trust the ${i===`Passed`?`green `:``}result: ${co(me)}. `:``,he?`The slowest step was ${he.goal?`“${he.goal}”`:`step ${he.n}`}${ce&&!c?` in ${ce.id}`:``} at ${V(he.ms)}.`:``]}):null,(0,B.jsxs)(`dl`,{className:`ov-facts`,children:[Number.isFinite(_e)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Started`}),(0,B.jsx)(`dd`,{children:_o(_e)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Finished`}),(0,B.jsx)(`dd`,{children:_o(_e+e.ms)})]})]}):null,e.env?.app||e.env?.browser?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.env.app?`App`:`Browser`}),(0,B.jsx)(`dd`,{children:e.env.app||e.env.browser})]}):null,e.env?.testEnvironment?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Environment`}),(0,B.jsx)(`dd`,{children:e.env.testEnvironment})]}):null,ge?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Triggered by`}),(0,B.jsx)(`dd`,{children:ge})]}):null]})]}),(0,B.jsxs)(`section`,{className:`panel ov-s5 ov-wide`,children:[(0,B.jsx)(Y,{icon:Ie,tone:`brand`,title:`Results over runs`,action:d(`Open Trends`,`trends`)}),x.length>1?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`dl`,{className:`ov-stats`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[`Pass rate, last `,x.length]}),(0,B.jsxs)(`dd`,{children:[J(E,D).toLocaleString(),`%`]})]}),C?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Average time`}),(0,B.jsx)(`dd`,{children:V(Math.round(C))})]}):null,T?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`This run vs average`}),(0,B.jsx)(`dd`,{className:w<-1e3?`tone-pass`:w>1e3?`tone-warn`:void 0,children:T})]}):null]}),(0,B.jsx)(`p`,{className:`ov-caption`,children:`Time per run, with its result underneath`}),(0,B.jsx)(`div`,{className:`run-bars`,role:`img`,"aria-label":`Duration of the last ${x.length} runs. ${x.filter(e=>e.bad).length?`${X(x.filter(e=>e.bad).length,`run`)} had failures.`:`Every run passed.`} This run took ${V(e.ms)}.`,children:x.map(e=>(0,B.jsxs)(`span`,{className:`run-bar${e.current?` current`:``}`,title:`${e.current?`This run`:qi(e.at)}: ${e.passed} of ${e.total} passed in ${V(e.ms)}`,children:[(0,B.jsx)(`span`,{className:`rb-time`,children:vo(e.ms)}),(0,B.jsx)(`i`,{style:{height:`${Math.max(6,100*e.ms/O)}%`}})]},e.id))}),(0,B.jsx)(`div`,{className:`run-results`,children:x.map(e=>(0,B.jsxs)(`span`,{className:e.current?`current`:void 0,children:[(0,B.jsx)(na,{status:e.bad?`failed`:e.total&&e.passed===e.total?`passed`:`stopped`,size:13}),(0,B.jsx)(`span`,{children:e.current?`This run`:go(e.at)})]},e.id))})]}):(0,B.jsx)(`p`,{className:`hint-text`,children:`Trends appear once this folder has more than one suite run.`})]}),L.length?(0,B.jsxs)(`section`,{className:`panel ov-s12`,children:[(0,B.jsx)(Y,{icon:mi,tone:`brand`,title:`Run timeline`,note:ae?`Each case's time, in the order they started${e.cases.length>L.length?`; ${e.cases.length-L.length} not timed`:``}`:`Where the ${V(ie)} went, and when problems happened`}),(0,B.jsx)(To,{segments:L,perCase:ae,total:Math.max(1,ie)}),(0,B.jsxs)(`div`,{className:`rt-legend`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`glyph-err`}),`Browser error, with the `,ae?`case`:`step`,` it happened in`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`glyph-a11y`}),`Accessibility issue`]}),L.some(e=>e.tone===`fail`)?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`rt-key fail`}),ae?`Case that did not pass`:`Step with a failed action`]}):null]})]}):null,(0,B.jsxs)(`section`,{className:`panel ov-s12 ov-flush`,children:[(0,B.jsx)(Y,{icon:Jr,tone:`brand`,title:`Quality by dimension`,note:`${Te} checked this run · ${we.length-Te} not covered yet`}),(0,B.jsx)(`ul`,{className:`dimensions`,children:we.map(e=>(0,B.jsxs)(`li`,{className:`dimension`,children:[(0,B.jsx)(Eo,{kind:e.kind}),(0,B.jsx)(`span`,{className:`dimension-label`,children:e.label}),(0,B.jsx)(`span`,{className:`dimension-value ${e.kind}`,children:e.value}),(0,B.jsx)(`span`,{className:`dimension-note`,title:e.note.length>Do?e.note:void 0,children:e.note.length>Do?`${e.note.slice(0,51).trimEnd()}…`:e.note}),e.action&&e.action.page===`overview`?(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>document.getElementById(`ov-posted`)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:e.action.label}):e.action&&u.has(e.action.page)?(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(e.action.page),children:e.action.label}):null]},e.label))})]}),(0,B.jsxs)(`section`,{className:`panel ov-s5 ov-flush`,children:[(0,B.jsx)(Y,{icon:bi,tone:Ae.length?`warn`:`pass`,title:Ae.length?`Problems seen during the run`:`No problems seen`,action:d(l.length?`Open Failures`:`Test results`,l.length?`failures`:`results`)}),(0,B.jsx)(`p`,{className:`ov-caption`,children:Ae.length?`${co(je)}.${l.length?``:` None failed the test.`}`:`${X(r.total,`case`)} passed with no browser errors${r.a11yIssues===0?` and no accessibility issues`:``}.`}),Ae.length?(0,B.jsx)(`ul`,{className:`prob-list`,children:Ae.slice(0,6).map(e=>{let t=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`prob-count tone-${e.tone}`,children:e.count}),(0,B.jsx)(`span`,{className:`prob-msg${e.mono?` mono`:``}`,children:e.msg}),(0,B.jsx)(`span`,{className:`prob-where`,children:e.where})]});return(0,B.jsx)(`li`,{children:e.caseId?(0,B.jsx)(`button`,{type:`button`,className:`prob-row`,onClick:()=>n(e.caseId),children:t}):(0,B.jsx)(`div`,{className:`prob-row`,children:t})},e.key)})}):null,Ae.length>6?(0,B.jsxs)(`p`,{className:`ov-caption more`,children:[`and `,Ae.length-6,` more`]}):null]}),(0,B.jsxs)(`section`,{className:`panel ov-slow ${P?`ov-s3`:`ov-s7`}`,children:[(0,B.jsx)(Y,{icon:$t,tone:`brand`,title:`Slowest cases`,action:d(`View all`,`timing`)}),oe.length?oe.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`ov-slow-case`,onClick:()=>n(e.id),title:`${e.id} ${e.title}`,children:[(0,B.jsxs)(`span`,{className:`ov-slow-head`,children:[(0,B.jsx)(`span`,{className:`ov-slow-name`,children:e.title||e.id}),(0,B.jsx)(`span`,{className:`ov-slow-value`,children:V(e.ms)})]}),(0,B.jsx)(`i`,{className:`ov-slow-bar${aa(e.status)?` fail`:``}`,style:{width:`${Math.max(2,100*e.ms/se)}%`}}),(0,B.jsx)(`span`,{className:`ov-slow-note`,children:c?`The only case in this run`:`${e.id} · ${Zi[e.status]||e.status}`})]},e.id)):(0,B.jsx)(`div`,{className:`empty`,children:`No cases ran`}),le.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`ov-slow-sub`,title:c?void 0:`${ce.id} ${ce.title}`,children:c?`Slowest steps inside it`:`Slowest steps in ${ce.id}`}),le.map(e=>(0,B.jsxs)(`div`,{className:`ov-slow-step`,title:e.goal||e.url,children:[(0,B.jsxs)(`span`,{className:`ov-slow-head`,children:[(0,B.jsxs)(`span`,{className:`ov-slow-name`,children:[e.n,`. `,e.goal||e.actions[0]?.text||e.url]}),(0,B.jsx)(`span`,{className:`ov-slow-value`,children:V(e.ms)})]}),(0,B.jsx)(`i`,{className:`ov-slow-bar`,style:{width:`${Math.max(2,100*(e.ms||0)/ue)}%`}})]},e.n))]}):null]}),P?(0,B.jsxs)(`section`,{className:`panel ov-s4 ov-flush`,children:[(0,B.jsx)(Y,{icon:wt,tone:`brand`,title:`Where the tokens went`,action:d(`Breakdown`,`breakdown`)}),(0,B.jsxs)(`div`,{className:`ov-tokens`,children:[(0,B.jsxs)(`span`,{className:`ov-split`,role:`img`,"aria-label":`Token split: input ${H(N.fresh)}, output ${H(N.output)}${N.cached?`, cached ${H(N.cached)}`:``}${N.write?`, written to cache ${H(N.write)}`:``}`,children:[N.fresh?(0,B.jsx)(`i`,{className:`in`,style:{flexGrow:N.fresh}}):null,N.output?(0,B.jsx)(`i`,{className:`out`,style:{flexGrow:N.output}}):null,N.cached?(0,B.jsx)(`i`,{className:`cache`,style:{flexGrow:N.cached}}):null,N.write?(0,B.jsx)(`i`,{className:`write`,style:{flexGrow:N.write}}):null]}),(0,B.jsxs)(`span`,{className:`ov-legend`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`in`}),`Input `,H(N.fresh)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`out`}),`Output `,H(N.output)]}),N.cached?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`cache`}),`Cached `,H(N.cached)]}):null,N.write?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`write`}),`Cache write `,H(N.write)]}):null]})]}),F.length?(0,B.jsxs)(`table`,{className:`ov-cost`,children:[(0,B.jsx)(`caption`,{children:F.some(e=>e.priced)?`Cost by agent`:`Tokens by agent`}),(0,B.jsx)(`tbody`,{children:F.slice(0,5).map(e=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`row`,title:e.name,children:e.name}),(0,B.jsx)(`td`,{className:`oc-bar`,children:(0,B.jsx)(`i`,{style:{width:`${Math.max(2,100*(e.amount||e.tokens)/ee)}%`}})}),(0,B.jsx)(`td`,{className:`oc-value`,children:e.priced?G(za(e)):H(e.tokens)})]},e.name))})]}):null,I.length?(0,B.jsxs)(`div`,{className:`ov-tip`,children:[(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(Mn,{size:14}),X(I.length,`way`),` to cut cost`]}),(0,B.jsxs)(`span`,{className:`ov-tip-text`,children:[I[0].title,I[0].saving?`. ${I[0].upTo?`Up to`:`About`} ${W(I[0].saving,I[0].currency)} less on this run.`:``]}),u.has(`optimise`)?(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>t(`optimise`),children:`Open Optimise`}):null]}):null]}):null]}),o.length?(0,B.jsx)(po,{posted:o,errors:r.postedErrors,onOpenCase:n}):null,(0,B.jsxs)(`p`,{className:`foot-note`,children:[`Written `,Gi(e.generatedAt),` by ForgeQE `,e.env?.version||``,`.`,` `,Sa(e)?`One file with every screenshot embedded, so it opens anywhere without a server.`:`It opens without a server; some screenshots load from the run folders next to this file.`]})]})}function ko({icon:e,title:t,aside:n,children:r}){return(0,B.jsxs)(`section`,{className:`sp-section`,children:[(0,B.jsxs)(`h3`,{className:`sp-h`,children:[e?(0,B.jsx)(e,{size:14}):null,t,n?(0,B.jsx)(`span`,{className:`sp-h-aside`,children:n}):null]}),r]})}function Ao({items:e}){let t=e.filter(([,e])=>e!=null&&e!==!1&&e!==``);return t.length?(0,B.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]},e))}):null}function jo({tone:e,title:t,badge:n,children:r}){return(0,B.jsxs)(`div`,{className:`callout ${e}`,children:[(0,B.jsxs)(`div`,{className:`callout-head`,children:[(0,B.jsx)(`span`,{children:t}),n]}),(0,B.jsx)(`div`,{className:`callout-body`,children:r})]})}function Mo({label:e,text:t}){let[n,r]=(0,v.useState)(!1);return(0,B.jsxs)(`div`,{className:`code-block`,children:[(0,B.jsxs)(`div`,{className:`code-block-head`,children:[(0,B.jsx)(`span`,{children:e}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>navigator.clipboard?.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>void 0),children:[n?(0,B.jsx)(We,{size:13}):(0,B.jsx)(bt,{size:13}),` `,n?`Copied`:`Copy`]})]}),(0,B.jsx)(`pre`,{children:t})]})}function No({items:e}){return e.length?(0,B.jsx)(`ul`,{className:`sp-bullets`,children:e.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))}):null}function Po({src:e,alt:t,boxes:n,className:r,onClick:i}){return(0,B.jsx)(`span`,{className:`shot-wrap ${r||``}`,onClick:i,children:(0,B.jsxs)(`span`,{className:`shot-inner`,children:[(0,B.jsx)(`img`,{src:e,alt:t,loading:`lazy`}),(n||[]).map((e,t)=>(0,B.jsx)(`i`,{className:`shot-box`,title:`Where the agent acted`,style:{left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.w*100}%`,height:`${e.h*100}%`}},t))]})})}function Fo({shots:e,index:t,onIndex:n,onClose:r}){let i=e[t];return(0,v.useEffect)(()=>{let i=i=>{i.key===`Escape`&&r(),i.key===`ArrowRight`&&t<e.length-1&&n(t+1),i.key===`ArrowLeft`&&t>0&&n(t-1)};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[t,e.length,n,r]),i?(0,B.jsxs)(`div`,{className:`lightbox`,onClick:r,role:`dialog`,"aria-label":`Screenshot`,children:[(0,B.jsxs)(`div`,{className:`lightbox-bar`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`span`,{className:`lightbox-label`,title:i.label,children:[t+1,` / `,e.length,` · `,i.label]}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:t===0,onClick:()=>n(t-1),"aria-label":`Previous`,children:(0,B.jsx)(Je,{size:14})}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:t>=e.length-1,onClick:()=>n(t+1),"aria-label":`Next`,children:(0,B.jsx)(Xe,{size:14})}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:r,"aria-label":`Close`,children:(0,B.jsx)(Pi,{size:14})})]}),(0,B.jsx)(Po,{className:`lightbox-shot`,src:i.src,alt:i.label,boxes:i.boxes,onClick:e=>e.stopPropagation()})]}):null}var Io={functional_defect:`Product bug`,test_case_issue:`Test needs update`,environment:`Environment`,automation:`Automation`},Lo={functional_defect:`fail`,test_case_issue:`warn`,environment:`brand`,automation:`brand`},Ro=50,zo=20;function Bo({runs:e,size:t=`sm`}){let n=`Last ${U(e.length,`run`)}: ${e.map(e=>`${e.current?`this run`:Gi(e.at)} ${(Zi[e.status||``]||e.status||``).toLowerCase()}`).join(`, `)}`;return(0,B.jsx)(`span`,{className:`tr-runs ${t}`,role:`img`,"aria-label":n,children:e.map((e,n)=>(0,B.jsx)(`i`,{className:`${e.status===`passed`?`pass`:aa(e.status)?`fail`:`warn`}${e.current?` current`:``}`,title:`${e.current?`This run`:qi(e.at)}: ${Zi[e.status||``]||e.status}`,children:t===`md`?(0,B.jsx)(Vo,{status:e.status}):null},n))})}function Vo({status:e}){let t=e===`passed`?`M4.6 8.4l2.3 2.3 4.5-4.8`:aa(e)?`M5.5 5.5l5 5M10.5 5.5l-5 5`:`M5 8h6`;return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:t,stroke:`#fff`,strokeWidth:`1.9`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Ho(e){let t=e.memory,n=[t.replayTotal?`replayed ${t.replayed} of ${U(t.replayTotal,`saved step`)} without the model`:`no saved flow yet`,t.agentSteps?`the agent took ${U(t.agentSteps,`step`)}`:``,t.flow?`flow ${t.flow}`:``],r=t.baseline;return r&&n.push(`saved ${H(Math.max(0,r.tokens-e.tokens))} tokens and ${V(Math.max(0,r.ms-e.ms))} against ${Gi(r.at)}`),n.filter(Boolean).join(`; `).replace(/^./,e=>e.toUpperCase())}function Uo(e){navigator.clipboard?.writeText(e).catch(()=>void 0)}function Wo({title:e,note:t,children:n}){return(0,B.jsxs)(`section`,{className:`cd-sub`,children:[(0,B.jsxs)(`h3`,{className:`cd-sub-head`,children:[e,t?(0,B.jsx)(`span`,{children:t}):null]}),n]})}function Go({c:e,failed:t}){let n=e.steps.some(e=>e.status);return(0,B.jsx)(`ol`,{className:`cd-steps`,children:e.steps.map(e=>(0,B.jsxs)(`li`,{className:`${e.n===t?`failed`:``}${e.status===`not_run`?` skipped`:``}`,id:e.n===t?`cd-failing-step`:void 0,children:[(0,B.jsx)(`span`,{className:`cd-n`,children:e.n}),n?(0,B.jsx)(na,{status:e.status===`not_run`?`stopped`:e.status,size:15}):(0,B.jsx)(`span`,{}),(0,B.jsxs)(`span`,{className:`cd-step-body`,children:[(0,B.jsx)(`span`,{className:`cd-step-name`,children:e.action}),e.data?(0,B.jsxs)(`span`,{className:`cd-step-note`,children:[`Data: `,e.data]}):null,e.expected?(0,B.jsxs)(`span`,{className:`cd-step-note`,children:[`Expected: `,e.expected]}):null,e.actual?(0,B.jsx)(`span`,{className:`cd-step-note${e.status===`failed`?` fail`:``}`,children:e.status===`not_run`?e.actual:`Saw: ${e.actual}`}):null]}),(0,B.jsx)(`span`,{className:`cd-step-dur`,children:n&&Zi[e.status||``]||``})]},e.n))})}function Ko({c:e,a11ySteps:t,onShot:n}){let[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(`all`),[s,c]=(0,v.useState)({}),l=r.trim().toLowerCase(),u=e.timeline.filter(e=>a===`failed`&&e.actions.every(e=>e.ok)||a===`errors`&&!(e.problems||[]).some(e=>e.level===`error`)||a===`memory`&&e.source!==`memory`?!1:!l||[e.goal,e.evaluation,e.memory,e.url,...e.actions.map(e=>`${e.text} ${e.error||``}`),...(e.problems||[]).map(Ea)].join(` `).toLowerCase().includes(l)),d=oo(u,Ro);if(!e.timeline.length)return e.agentSteps?.length?(0,B.jsx)(`ol`,{className:`cd-steps`,children:e.agentSteps.map((e,t)=>(0,B.jsxs)(`li`,{className:e.ok?``:`failed`,children:[(0,B.jsx)(`span`,{className:`cd-n`,children:t+1}),(0,B.jsx)(na,{status:e.ok?`passed`:`failed`,size:15}),(0,B.jsx)(`span`,{className:`cd-step-body`,children:(0,B.jsx)(`span`,{className:`cd-step-name`,children:e.text})}),(0,B.jsx)(`span`,{})]},t))}):(0,B.jsx)(`div`,{className:`empty`,children:`No browser steps were recorded for this case.`});let f=e.timeline.filter(e=>e.source===`memory`).length;return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`table-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:r,placeholder:`Search steps, pages, selectors or errors`,"aria-label":`Search browser steps`,onChange:e=>{i(e.target.value),d.setPage(0)}})]}),(0,B.jsxs)(`select`,{className:`field`,"aria-label":`Show steps`,value:a,onChange:e=>{o(e.target.value),d.setPage(0)},children:[(0,B.jsx)(`option`,{value:`all`,children:`All steps`}),(0,B.jsx)(`option`,{value:`failed`,children:`With a failed action`}),(0,B.jsx)(`option`,{value:`errors`,children:`With browser errors`}),f?(0,B.jsx)(`option`,{value:`memory`,children:`From page memory`}):null]}),(0,B.jsx)(`span`,{className:`table-count`,children:u.length===e.timeline.length?U(e.timeline.length,`step`):`${u.length} of ${U(e.timeline.length,`step`)}`})]}),(0,B.jsx)(`ol`,{className:`cd-steps`,children:d.shown.map(e=>(0,B.jsx)(qo,{t:e,a11y:t.get(e.n),open:!!s[e.n],onToggle:()=>c(t=>({...t,[e.n]:!t[e.n]})),onShot:n},e.n))}),u.length?null:(0,B.jsx)(`div`,{className:`empty`,children:`No steps match.`}),(0,B.jsx)(so,{...d,label:`Browser step pages`})]})}function qo({t:e,a11y:t,open:n,onToggle:r,onShot:i}){let a=e.actions.filter(e=>!e.ok),o=e.problems||[],s=o.filter(e=>e.level===`error`),c=a.length?`fail`:s.length?`err`:t?`a11y`:`ok`,l=e.goal||e.actions[0]?.text||e.url,u=e.goal?e.actions.map(e=>e.text).join(` · `):e.actions.slice(1).map(e=>e.text).join(` · `);return(0,B.jsxs)(`li`,{className:`${c===`fail`?`failed`:``}${n?` open`:``}`,children:[(0,B.jsx)(`span`,{className:`cd-n`,children:e.n}),(0,B.jsx)(`span`,{className:`cd-kind ${c}`,role:`img`,"aria-label":c===`fail`?`Failed`:c===`err`?`Done, with browser errors`:c===`a11y`?`Done, with accessibility issues`:`Done`,children:c===`ok`?(0,B.jsx)(ta,{status:`passed`,size:15}):c===`fail`?(0,B.jsx)(ta,{status:`failed`,size:15}):c===`err`?(0,B.jsx)(ta,{status:`error`,size:15}):(0,B.jsx)(ia,{size:15})}),(0,B.jsxs)(`button`,{type:`button`,className:`cd-step-body as-button`,"aria-expanded":n,onClick:r,children:[(0,B.jsxs)(`span`,{className:`cd-step-name`,children:[l,e.source===`memory`?(0,B.jsx)(`span`,{className:`cd-mem`,title:`Replayed from page memory, no model call`,children:`memory`}):null]}),u?(0,B.jsx)(`span`,{className:`cd-step-target`,children:u}):null,e.goal||u?(0,B.jsx)(`span`,{className:`cd-step-target url`,title:e.url,children:e.url}):null,a.map((e,t)=>(0,B.jsxs)(`span`,{className:`cd-step-note fail`,children:[e.text,e.error?`: ${e.error.split(`
21
+ `)[0]}`:``]},t)),s.length?(0,B.jsxs)(`span`,{className:`cd-step-note fail`,children:[U(s.reduce((e,t)=>e+(t.count||1),0),`browser error`),`: `,Ea(s[0])]}):null,t?(0,B.jsxs)(`span`,{className:`cd-step-note warn`,children:[U(t,`accessibility issue`),` on this page`]}):null]}),(0,B.jsxs)(`span`,{className:`cd-step-dur`,children:[e.ms?V(e.ms):`—`,e.model_ms?(0,B.jsxs)(`small`,{title:`Waiting for the model`,children:[V(e.model_ms),` model`]}):null]}),n?(0,B.jsxs)(`div`,{className:`cd-step-detail`,children:[e.evaluation?(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:`Evaluation of the previous step`}),` `,e.evaluation]}):null,e.memory?(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:`Agent memory`}),` `,e.memory]}):null,e.title?(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:`Page title`}),` `,e.title]}):null,o.length?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:`In the browser during this step`}),(0,B.jsxs)(`ul`,{className:`problem-list`,children:[o.map((e,t)=>(0,B.jsxs)(`li`,{className:e.level,children:[(0,B.jsx)(`span`,{className:`problem-kind`,children:e.kind===`network`?`request`:e.kind===`slow`?`slow`:e.kind===`exception`?`exception`:`console ${e.level}`}),(0,B.jsxs)(`span`,{className:`problem-text`,title:e.url||e.text,children:[Ea(e),e.count&&e.count>1?(0,B.jsxs)(`em`,{children:[` ×`,e.count]}):null]})]},t)),e.more_problems?(0,B.jsxs)(`li`,{className:`dim`,children:[`and `,e.more_problems,` more`]}):null]})]}):null,!e.evaluation&&!e.memory&&!e.title&&!o.length?(0,B.jsx)(`p`,{className:`dim`,children:e.source===`memory`?`Replayed from page memory: no model call for this step.`:`No further detail recorded.`}):null,e.shot?(0,B.jsx)(Po,{className:`tl-big`,src:e.shot,alt:`${e.url?`Page`:`Screen`} at step ${e.n}`,boxes:Ca(e),onClick:()=>i(e.shot)}):null]}):null]})}function Jo({c:e}){let t=e.timeline.filter(e=>e.ms),n=oo(t,Ro);if(!t.length)return(0,B.jsx)(`div`,{className:`empty`,children:`No step timings were recorded for this case.`});let r=ka(e),i=t.reduce((e,t)=>(t.ms||0)>(e.ms||0)?t:e,t[0]),a=Math.max(1,i.ms||0);return(0,B.jsxs)(`div`,{className:`cd-timing`,children:[(0,B.jsxs)(`dl`,{className:`cd-figs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Total`}),(0,B.jsx)(`dd`,{children:V(e.ms)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`In the browser`}),(0,B.jsx)(`dd`,{children:V(r.total)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Slowest step`}),(0,B.jsxs)(`dd`,{children:[V(i.ms),` `,(0,B.jsxs)(`small`,{children:[`step `,i.n]})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Average step`}),(0,B.jsx)(`dd`,{children:V(Math.round(r.total/t.length))})]})]}),(0,B.jsxs)(Wo,{title:`Where the time went`,children:[(0,B.jsxs)(`span`,{className:`split-bar cd-split`,role:`img`,"aria-label":`Waiting for the model ${V(r.model)}, acting in the browser ${V(r.browser)}, replayed from page memory ${V(r.memory)}`,children:[r.model?(0,B.jsx)(`i`,{className:`model`,style:{flexGrow:r.model}}):null,r.browser?(0,B.jsx)(`i`,{className:`browser`,style:{flexGrow:r.browser}}):null,r.memory?(0,B.jsx)(`i`,{className:`memory`,style:{flexGrow:r.memory}}):null]}),(0,B.jsxs)(`span`,{className:`ov-legend`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`sw model`}),`Waiting for the model `,V(r.model)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`sw browser`}),`Acting in the browser `,V(r.browser)]}),r.memory?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`sw memory`}),`Replayed from page memory `,V(r.memory)]}):null]})]}),(0,B.jsxs)(Wo,{title:`Time per step`,note:t.length>Ro?`${t.length} steps, in order`:void 0,children:[(0,B.jsx)(`div`,{className:`cd-bars`,children:n.shown.map(e=>{let t=e.actions.some(e=>!e.ok);return(0,B.jsxs)(`div`,{className:`cd-bar`,title:`Step ${e.n}: ${V(e.ms)}${e.model_ms?`, ${V(e.model_ms)} waiting for the model`:``}`,children:[(0,B.jsxs)(`span`,{className:`cd-bar-name`,children:[e.n,`. `,e.goal||e.actions[0]?.text||e.url]}),(0,B.jsx)(`span`,{className:`bar-track`,children:(0,B.jsx)(`i`,{style:{width:`${100*(e.ms||0)/a}%`,background:t?`var(--fail)`:`var(--brand)`}})}),(0,B.jsx)(`span`,{className:`cd-bar-ms`,children:V(e.ms)})]},e.n)})}),(0,B.jsx)(so,{...n,label:`Step timing pages`})]})]})}function Yo({c:e}){let t=e.accessibility||[],n=t.flatMap(e=>e.issues.map(t=>({i:t,page:e.title||e.url,url:e.url}))).sort((e,t)=>Ma.indexOf(e.i.impact)-Ma.indexOf(t.i.impact)||t.i.count-e.i.count),r=oo(n,zo);if(!t.length)return(0,B.jsx)(`div`,{className:`empty`,children:`Not scanned: no page of this case was checked for accessibility.`});let i=n.reduce((e,t)=>e+t.i.count,0),a=t.filter(e=>!e.issues.length).length;return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`cd-lead`,children:[n.length?`${U(i,`issue`)} of ${U(n.length,`kind`)} found by the automated scan on ${U(t.length,`page`)} this case visited${a?`; ${a} had none`:``}.`:`No issues found by the automated scan on the ${U(t.length,`page`)} this case visited.`,` `,`It finds common problems: names and labels, image text, heading order, contrast, language and zoom, not all of them.`]}),(0,B.jsx)(`div`,{className:`cd-issues`,children:r.shown.map(({i:e,page:t,url:n},i)=>(0,B.jsx)(Xo,{i:e,page:t,url:n},`${r.at}-${i}-${n}-${e.rule}`))}),(0,B.jsx)(so,{...r,label:`Accessibility issue pages`})]})}function Xo({i:e,page:t,url:n}){let r=e.examples?.[0];return(0,B.jsxs)(`div`,{className:`cd-issue`,children:[(0,B.jsxs)(`div`,{className:`cd-issue-head`,children:[(0,B.jsx)(`span`,{className:`impact ${e.impact}`,children:e.impact}),(0,B.jsx)(`strong`,{children:e.help}),(0,B.jsx)(`code`,{children:e.rule})]}),(0,B.jsxs)(`div`,{className:`cd-issue-meta`,children:[(0,B.jsx)(`span`,{children:U(e.count,`element`)}),e.wcag?(0,B.jsxs)(`span`,{children:[`WCAG `,e.wcag,e.level?` (${e.level})`:``]}):null,(0,B.jsxs)(`span`,{title:n,children:[`On `,t]})]}),r?(0,B.jsx)(`code`,{className:`cd-issue-example`,children:r.html||r.text||r.role}):null,q(e.helpUrl)?(0,B.jsx)(`a`,{href:q(e.helpUrl),target:`_blank`,rel:`noreferrer`,children:`How to fix`}):null]})}function Zo({c:e,now:t,nowBoxes:n,onShot:r}){let i=e.lastGood;if(!i)return null;let a=Da(e);if(!i.shot&&!t&&!(i.steps.length&&a.length))return null;let o=a.findIndex((e,t)=>e!==i.steps[t]),s=o<0?Math.min(a.length,i.steps.length):o;return(0,B.jsxs)(Wo,{title:`Last good vs now`,note:`last passed ${Gi(i.at)}`,children:[i.href?(0,B.jsx)(`p`,{className:`cd-lead`,children:(0,B.jsx)(`a`,{href:q(i.href),children:`Open that run's report`})}):null,i.shot||t?(0,B.jsxs)(`div`,{className:`compare-grid`,children:[(0,B.jsxs)(`figure`,{children:[(0,B.jsxs)(`figcaption`,{children:[`Last passed`,i.step?` · step ${i.step}`:``]}),i.shot?(0,B.jsx)(Po,{src:i.shot,alt:`Last passing run`,onClick:()=>r(i.shot)}):(0,B.jsx)(`div`,{className:`empty`,children:`No screenshot kept`}),i.url?(0,B.jsx)(`div`,{className:`tl-url`,children:i.url}):null]}),(0,B.jsxs)(`figure`,{children:[(0,B.jsx)(`figcaption`,{children:`This run`}),t?(0,B.jsx)(Po,{src:t,alt:`This run`,boxes:n,onClick:()=>r(t)}):(0,B.jsx)(`div`,{className:`empty`,children:`No screenshot kept`}),e.finalUrl?(0,B.jsx)(`div`,{className:`tl-url`,children:e.finalUrl}):null]})]}):null,i.steps.length&&a.length?(0,B.jsxs)(`details`,{className:`step-diff`,children:[(0,B.jsxs)(`summary`,{children:[`Browser steps compared: `,s<Math.max(a.length,i.steps.length)?`the same up to step ${s}, then they differ`:`the same steps`]}),(0,B.jsx)(`div`,{className:`diff-cols`,children:[[`Last passed`,i.steps],[`This run`,a]].map(([e,t])=>(0,B.jsxs)(`ol`,{children:[(0,B.jsx)(`li`,{className:`diff-head`,children:e}),t.map((e,t)=>(0,B.jsxs)(`li`,{className:t>=s?`differs`:``,children:[(0,B.jsx)(`b`,{children:t+1}),` `,e]},t))]},e))})]}):null]})}var Qo=/\.(webm|mp4)$/i;function $o({c:e,shots:t,onShot:n}){let[r,i]=(0,v.useState)(null),a=da(e),o=aa(e.status),s=e.files.filter(e=>Qo.test(e.name)&&q(e.href)),c=e.files.find(e=>e.name===r);return!t.length&&!e.files.length&&!e.lastGood?(0,B.jsx)(`div`,{className:`empty`,children:e.status===`stopped`?`No artifacts: this case stopped before the browser opened.`:`No screenshots or files were kept for this case.`}):(0,B.jsxs)(`div`,{className:`cd-artifacts`,children:[o?e.lastGood?(0,B.jsx)(Zo,{c:e,now:a.shot,nowBoxes:a.shotBoxes,onShot:e=>n(Math.max(0,t.findIndex(t=>t.src===e)))}):a.shot?(0,B.jsx)(Wo,{title:`Where it stopped`,children:(0,B.jsx)(`div`,{className:`compare-grid single`,children:(0,B.jsxs)(`figure`,{children:[(0,B.jsx)(Po,{src:a.shot,alt:`Last screenshot`,boxes:a.shotBoxes,onClick:()=>n(Math.max(0,t.findIndex(e=>e.src===a.shot)))}),e.finalUrl?(0,B.jsx)(`div`,{className:`tl-url`,children:e.finalUrl}):null]})})}):null:null,s.length?(0,B.jsx)(Wo,{title:`Screen recording`,children:s.map(e=>(0,B.jsx)(`video`,{className:`cd-video`,controls:!0,preload:`metadata`,src:q(e.href),children:(0,B.jsx)(`a`,{href:q(e.href),children:e.name})},e.name))}):null,t.length?(0,B.jsx)(Wo,{title:`Screenshots`,note:U(t.length,`screenshot`),children:(0,B.jsx)(`div`,{className:`shot-grid`,children:t.map((e,t)=>(0,B.jsxs)(`figure`,{onClick:()=>n(t),children:[(0,B.jsx)(Po,{src:e.src,alt:e.label,boxes:e.boxes}),(0,B.jsx)(`figcaption`,{title:e.label,children:e.label})]},t))})}):null,e.files.length?(0,B.jsxs)(Wo,{title:`Files`,note:e.runDir?void 0:U(e.files.length,`file`),children:[(0,B.jsx)(`ul`,{className:`cd-files`,children:e.files.map(e=>(0,B.jsxs)(`li`,{className:r===e.name?`active`:void 0,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:Qo.test(e.name)?(0,B.jsx)(wi,{size:14}):e.text==null?(0,B.jsx)(z,{size:14}):(0,B.jsx)(Bt,{size:14})}),(0,B.jsxs)(`span`,{className:`cd-file-name`,children:[(0,B.jsx)(`code`,{children:e.name}),(0,B.jsx)(`span`,{title:e.href,children:e.href})]}),e.text==null?null:(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>i(r===e.name?null:e.name),children:r===e.name?`Hide`:`View`}),(0,B.jsxs)(`a`,{className:`text-btn`,href:q(e.href),target:`_blank`,rel:`noreferrer`,title:`Opens when the run folder is next to this report`,children:[(0,B.jsx)(Mt,{size:12}),` Open`]})]},e.name))}),c?.text==null?null:(0,B.jsxs)(`div`,{className:`code-view`,children:[(0,B.jsxs)(`div`,{className:`code-head`,children:[(0,B.jsx)(`span`,{children:c.name}),c.truncated?(0,B.jsx)(`em`,{children:`first part only`}):null,(0,B.jsxs)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>Uo(c.text),children:[(0,B.jsx)(bt,{size:12}),` Copy`]})]}),(0,B.jsx)(`pre`,{children:c.text})]}),e.runDir?(0,B.jsxs)(`p`,{className:`hint-text`,children:[(0,B.jsx)(Yt,{size:12}),` Run folder: `,(0,B.jsx)(`code`,{children:e.runDir})]}):null]}):null]})}function es({c:e}){let t=e.memory,n=(e.quality?.breaches||[]).filter(e=>e.kind!==`accessibility`);return(0,B.jsxs)(`div`,{className:`cd-about`,children:[(0,B.jsx)(Ao,{items:[[`Source`,e.url?(0,B.jsx)(`a`,{href:q(e.url),target:`_blank`,rel:`noreferrer`,children:Xi(e.source)}):Xi(e.source)],[`Area`,e.group],[`Description`,e.description?.trim()?(0,B.jsx)(`span`,{className:`pre-line`,children:e.description.trim()}):void 0],[`Preconditions`,e.preconditions?.length?e.preconditions.join(`; `):void 0],[`Requirements`,e.requirements?.length?(0,B.jsx)(`span`,{className:`code-list`,children:e.requirements.map(e=>(0,B.jsx)(`span`,{className:`tag-pill req`,children:e},e))}):void 0],[`Skills`,e.skills?.length?e.skills.join(`, `):void 0],[`Ran`,`${qi(e.startedAt)}, took ${V(e.ms)}`],[`Start page`,e.startUrl?(0,B.jsx)(`code`,{children:e.startUrl}):void 0],[`Last page`,e.finalUrl?(0,B.jsx)(`code`,{children:e.finalUrl}):void 0],[`Page memory`,t?Ho(e):void 0],[`Tokens and cost`,e.tokens?`${H(e.tokens)} tokens${e.cost?`, ${G(e.cost)}`:``}${e.codeCost?` (browser ${G(e.browserCost)}, coding ${G(e.codeCost)})`:``}`:void 0],[`Recorded in`,e.posted.length?(0,B.jsx)(`span`,{className:`posted-inline`,children:e.posted.map((e,t)=>(0,B.jsxs)(`span`,{className:e.error?`fail-text`:void 0,children:[Xi(e.source),`: `,e.url?(0,B.jsx)(`a`,{href:q(e.url),children:e.text}):e.text,e.error?` (not posted: ${e.error})`:``]},t))}):void 0],[`Test written`,e.code?(0,B.jsxs)(B.Fragment,{children:[e.code.status,` after `,U(e.code.attempts,`attempt`),e.code.testFile?(0,B.jsxs)(B.Fragment,{children:[` in `,(0,B.jsx)(`code`,{children:e.code.testFile})]}):null,e.code.command?(0,B.jsxs)(B.Fragment,{children:[` · run with `,(0,B.jsx)(`code`,{children:e.code.command})]}):null]}):void 0]]}),n.length?(0,B.jsx)(Wo,{title:`Over budget`,children:(0,B.jsx)(`ul`,{className:`qc-list`,children:n.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`status-pill fail`,children:e.kind===`performance`?`Performance`:`Visual`}),e.page,`: `,e.text]},t))})}):null,t?.repaired||t?.stopped||t?.heals?.length?(0,B.jsx)(Wo,{title:`Page memory`,note:`mode: ${t.mode}`,children:(0,B.jsxs)(`div`,{className:`memory-box`,children:[t.repaired?(0,B.jsxs)(`div`,{className:`memory-note`,children:[(0,B.jsx)(`b`,{children:`Flow repaired.`}),` Replay stopped at step `,t.repaired.step,` (`,t.repaired.reason,`); the agent finished the case in `,U(t.repaired.agentSteps,`step`),` and the flow was saved again.`]}):t.stopped?(0,B.jsxs)(`div`,{className:`memory-note`,children:[`Replay handed over to the agent: `,t.stopped]}):null,t.heals?.length?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`dim`,children:`Healed locators: the page changed, and page memory found the element another way`}),(0,B.jsx)(`ul`,{className:`heal-list`,children:t.heals.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`b`,{children:[`Step `,e.step]}),` `,e.label||e.line,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`stale`,children:e.stale.join(`, `)}),` no longer matched`,e.used?(0,B.jsxs)(B.Fragment,{children:[`; used `,(0,B.jsx)(`code`,{children:e.used})]}):null]})]},t))})]}):null]})}):null]})}function ts({c:e,runs:t,isNew:n,isFlaky:r,byFramework:i}){let[a,o]=(0,v.useState)(i?`artifacts`:`steps`),[s,c]=(0,v.useState)(null),l=(0,v.useMemo)(()=>{if(!e)return[];let t=e.lastGood?.shot?[{src:e.lastGood.shot,label:`Last passing run · ${Gi(e.lastGood.at)}${e.lastGood.url?` · ${e.lastGood.url}`:``}`}]:[];return[...la(e),...t]},[e]),u=(0,v.useMemo)(()=>{let t=new Map;if(!e?.accessibility?.length)return t;let n=new Map(e.accessibility.filter(e=>e.issues.length).map(e=>[e.url.split(`#`)[0],e.issues.reduce((e,t)=>e+t.count,0)]));for(let r of e.timeline){let e=(r.url||``).split(`#`)[0];n.has(e)&&(t.set(r.n,n.get(e)||0),n.delete(e))}return t},[e]);if(!e)return(0,B.jsx)(`section`,{className:`panel cd`,children:(0,B.jsx)(`div`,{className:`empty`,children:`Select a case from the list.`})});let d=da(e),f=aa(e.status),p=Za(e),m=Qa(e),h=e.steps.some(e=>e.status),g=e.timeline.some(e=>e.ms),_=e.timeline.length>0&&e.timeline.every(e=>!e.url),y=(t||[]).filter(e=>e.status===`passed`).length,b=e.status===`stopped`?`Not run`:d.failedStep?`${Zi[e.status]} at step ${d.failedStep.n} of ${e.steps.length}: ${d.failedStep.action}`:e.status===`error`?`Could not run`:Zi[e.status],x=[...i?[]:[{id:`steps`,label:`Steps`,icon:In,count:String(e.steps.length||e.timeline.length||e.agentSteps?.length||`—`)}],...g?[{id:`timing`,label:`Timing`,icon:$t,count:V(e.ms)}]:[],...i?[]:[{id:`a11y`,label:`Accessibility`,icon:te,count:m===void 0?`—`:m.toLocaleString()}],{id:`artifacts`,label:`Artifacts`,icon:gn,count:String(l.length+e.files.length)},{id:`about`,label:`About`,icon:Sn}];return(0,B.jsxs)(`section`,{className:`panel cd`,"aria-labelledby":`cd-title`,children:[(0,B.jsxs)(`div`,{className:`cd-head`,children:[(0,B.jsxs)(`div`,{className:`cd-title-row`,children:[(0,B.jsx)(ea,{status:e.status}),(0,B.jsx)(`h2`,{id:`cd-title`,className:`cd-title`,children:e.title})]}),(0,B.jsxs)(`div`,{className:`cd-meta`,children:[(0,B.jsx)(`code`,{children:e.id}),(0,B.jsxs)(`span`,{children:[e.url?(0,B.jsx)(`a`,{href:q(e.url),target:`_blank`,rel:`noreferrer`,children:Xi(e.source)}):Xi(e.source),e.group?` · ${e.group}`:``]}),e.code?.testFile?(0,B.jsx)(`code`,{children:e.code.testFile}):null,(e.tags||[]).map(e=>(0,B.jsx)(`span`,{className:`tag-pill`,children:e},e)),e.failure?(0,B.jsx)(`span`,{className:`status-pill ${Lo[e.failure.type]||`brand`}`,children:Io[e.failure.type]||e.failure.label}):null,d.bug?(0,B.jsx)(`a`,{className:`status-pill brand`,href:q(d.bug.url),target:`_blank`,rel:`noreferrer`,children:d.bug.text.split(`:`)[0]}):null]}),t&&t.length>1?(0,B.jsxs)(`div`,{className:`cd-history`,children:[(0,B.jsxs)(`span`,{className:`cd-history-label`,children:[`Last `,t.length,` runs`]}),(0,B.jsx)(Bo,{runs:t,size:`md`}),(0,B.jsxs)(`span`,{children:[`Passed `,y,` of the last `,t.length,` runs`]}),n?(0,B.jsx)(`span`,{className:`tr-tag fail`,children:`New failure: passed in the previous run`}):null,r?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Flaky: passes and fails between runs`}):null]}):null,(0,B.jsxs)(`dl`,{className:`cd-figs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Duration`}),(0,B.jsx)(`dd`,{children:e.status===`stopped`?`Not run`:V(e.ms)})]}),i?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Steps`}),(0,B.jsx)(`dd`,{children:h?`${e.steps.filter(e=>e.status===`passed`).length} of ${e.steps.length}`:e.steps.length||e.timeline.length||`—`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Tokens`}),(0,B.jsx)(`dd`,{children:e.tokens?H(e.tokens):`0`})]}),(0,B.jsxs)(`div`,{title:K(e.cost),children:[(0,B.jsx)(`dt`,{children:`Cost`}),(0,B.jsx)(`dd`,{children:G(e.cost)})]}),_?null:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Browser errors`}),(0,B.jsx)(`dd`,{className:p?`tone-fail`:void 0,children:e.diagnostics||e.timeline.length?p.toLocaleString():`—`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Accessibility`}),(0,B.jsx)(`dd`,{className:m?`tone-warn`:void 0,children:m===void 0?`—`:m.toLocaleString()})]})]})]})]}),e.status===`passed`?null:(0,B.jsxs)(`div`,{className:`cd-failure ${f?`fail`:`warn`}`,children:[(0,B.jsxs)(`strong`,{children:[f?(0,B.jsx)(ta,{status:e.status,size:15}):(0,B.jsx)(ia,{size:15}),b]}),(0,B.jsx)(`p`,{className:`cd-failure-msg`,children:e.summary}),e.failure?(0,B.jsxs)(`p`,{className:`cd-failure-note`,children:[(0,B.jsxs)(`b`,{children:[Io[e.failure.type]||e.failure.label,`:`]}),` `,e.failure.reason,` Next: `,e.failure.action,`.`,e.retried?` The first run met an environment problem, so it ran once more.`:``]}):null,d.failedStep&&(d.failedStep.expected||d.failedStep.actual)?(0,B.jsxs)(`dl`,{className:`cd-expect`,children:[d.failedStep.expected?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Expected`}),(0,B.jsx)(`dd`,{children:d.failedStep.expected})]}):null,d.failedStep.actual?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Actual`}),(0,B.jsx)(`dd`,{className:`tone-fail`,children:d.failedStep.actual})]}):null]}):null,d.failedActions.length?(0,B.jsxs)(`ul`,{className:`cd-failed-actions`,children:[d.failedActions.slice(0,3).map((e,t)=>(0,B.jsxs)(`li`,{children:[_?`Step`:`Browser step`,` `,e.step,`: `,e.text,e.error?(0,B.jsx)(`code`,{children:e.error.split(`
22
+ `)[0]}):null]},t)),d.failedActions.length>3?(0,B.jsxs)(`li`,{className:`dim`,children:[`and `,d.failedActions.length-3,` more failed actions`]}):null]}):null,e.code?.knownDefect?(0,B.jsxs)(`p`,{className:`cd-failure-note`,children:[`A test for the correct behaviour was written to `,e.code.testFile,` and marked as an expected failure until the defect is fixed.`]}):null,e.code?.attention?(0,B.jsxs)(`p`,{className:`cd-failure-note`,children:[`The generated test did not finish; it was moved to `,e.code.attention,`/ with a README on how to pick it up.`]}):null,(0,B.jsxs)(`div`,{className:`cd-failure-actions`,children:[d.failedStep?(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>{o(`steps`),requestAnimationFrame(()=>document.getElementById(`cd-failing-step`)?.scrollIntoView({block:`center`,behavior:`smooth`}))},children:`Show failing step`}):null,l.length||e.files.length?(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>o(`artifacts`),children:e.lastGood?`Compare with the last good run`:`See screenshots and files`}):null]})]}),(0,B.jsx)(`div`,{className:`cd-tabs`,role:`tablist`,"aria-label":`Case details`,children:x.map(e=>{let t=e.icon;return(0,B.jsxs)(`button`,{id:`cd-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":a===e.id,"aria-controls":`cd-panel`,className:`cd-tab${a===e.id?` active`:``}`,onClick:()=>o(e.id),children:[(0,B.jsx)(t,{size:14}),e.label,e.count?(0,B.jsx)(`span`,{className:`cd-tab-count`,children:e.count}):null]},e.id)})}),(0,B.jsxs)(`div`,{className:`cd-panel`,id:`cd-panel`,role:`tabpanel`,"aria-labelledby":`cd-tab-${a}`,children:[a===`steps`?(0,B.jsxs)(B.Fragment,{children:[e.steps.length?(0,B.jsx)(Wo,{title:`Test steps`,note:h?`${e.steps.filter(e=>e.status===`passed`).length} of ${e.steps.length} passed`:void 0,children:(0,B.jsx)(Go,{c:e,failed:d.failedStep?.n})}):null,e.timeline.length||e.agentSteps?.length||!e.steps.length?(0,B.jsx)(Wo,{title:_?`Steps in the app`:`Browser steps`,note:e.timeline.some(e=>e.source===`memory`)?`${e.timeline.filter(e=>e.source===`memory`).length} replayed from page memory`:void 0,children:(0,B.jsx)(Ko,{c:e,a11ySteps:u,onShot:e=>c(Math.max(0,l.findIndex(t=>t.src===e)))})}):null]}):null,a===`timing`?(0,B.jsx)(Jo,{c:e}):null,a===`a11y`?(0,B.jsx)(Yo,{c:e}):null,a===`artifacts`?(0,B.jsx)($o,{c:e,shots:l,onShot:c}):null,a===`about`?(0,B.jsx)(es,{c:e}):null]}),s==null?null:(0,B.jsx)(Fo,{shots:l,index:s,onIndex:c,onClose:()=>c(null)})]})}var ns=[10,25,50,100];function rs(e){let t=[...e.history].sort((e,t)=>e.at.localeCompare(t.at)).slice(-6),n=new Map;for(let r of e.cases){let e=t.map(e=>({at:e.at,current:!!e.current,status:e.cases.find(e=>e.id===r.id)?.status})),i=e.findIndex(e=>e.current);i<0?e.push({at:r.startedAt,current:!0,status:r.status}):e[i].status||(e[i]={...e[i],status:r.status}),n.set(r.id,e.filter(e=>e.status).slice(-6))}return n}function is({data:e,caseId:t,onSelect:n}){let r=e.cases,[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(`all`),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(`all`),[f,p]=(0,v.useState)(ns[0]),m=r.find(e=>e.id===t)||r.find(e=>e.status!==`passed`)||r[0],h=[...new Set(r.map(e=>e.source))],g=(0,v.useMemo)(()=>{let t=Oa(e),n=new Set((t?.newFailures||[]).map(e=>e.id)),i=new Set(ma(e.history).map(e=>e.id));return{newIds:n,flakyIds:i,slowIds:new Set([...r].filter(e=>e.status!==`stopped`).sort((e,t)=>t.ms-e.ms).slice(0,3).map(e=>e.id)),hay:new Map(r.map(e=>[e.id,[e.id,e.title,e.summary,Xi(e.source),e.group,e.code?.testFile,...e.tags||[],...e.steps.flatMap(e=>[e.action,e.expected,e.actual]),...e.timeline.flatMap(e=>[e.goal,e.url,...e.actions.map(e=>`${e.text} ${e.error||``}`),...(e.problems||[]).map(Ea)]),...(e.accessibility||[]).flatMap(e=>e.issues.map(e=>`${e.rule} ${e.help}`)),n.has(e.id)?`new failure`:``,i.has(e.id)?`flaky`:``].filter(Boolean).join(` `).toLowerCase()])),runs:rs(e)}},[e,r]),_={new:e=>g.newIds.has(e.id),flaky:e=>g.flakyIds.has(e.id),slow:e=>g.slowIds.has(e.id),errors:e=>Za(e)>0,a11y:e=>(Qa(e)||0)>0},y={all:r.length,passed:r.filter(e=>e.status===`passed`).length,failed:r.filter(e=>e.status===`failed`).length,error:r.filter(e=>e.status===`error`).length,stopped:r.filter(e=>e.status===`stopped`).length},b=i.trim().toLowerCase(),x=r.filter(e=>(o===`all`||e.status===o)&&(u===`all`||e.source===u)&&(!c||_[c](e))&&(!b||(g.hay.get(e.id)||``).includes(b)));c===`slow`&&(x=[...x].sort((e,t)=>t.ms-e.ms));let S=oo(x,f),C=x.length!==r.length,w=[[`all`,`All`],[`passed`,`Passed`],[`failed`,`Failed`],[`error`,`Could not run`],[`stopped`,`Not run`]],T=[[`new`,`New failures`,bi],[`flaky`,`Flaky`,Oi],[`slow`,`Slowest 3`,mi],[`errors`,`Browser errors`,er],[`a11y`,`Accessibility issues`,te]];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`panel tr-filters`,"aria-label":`Find test cases`,children:[(0,B.jsxs)(`div`,{className:`tr-filter-row`,children:[(0,B.jsxs)(`label`,{className:`table-search tr-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:i,placeholder:`Search cases, steps, selectors, errors or tags`,"aria-label":`Search test cases`,onChange:e=>{a(e.target.value),S.setPage(0)}})]}),(0,B.jsx)(`div`,{className:`tr-chips`,role:`group`,"aria-label":`Filter by result`,children:w.filter(([e])=>e===`all`||y[e]||o===e).map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":o===e,className:`chip-btn${o===e?` active`:``}`,onClick:()=>{s(e),S.setPage(0)},children:[t,(0,B.jsx)(`span`,{className:`chip-count`,children:y[e].toLocaleString()})]},e))}),h.length>1?(0,B.jsxs)(`select`,{className:`field tr-source`,"aria-label":`Filter by source`,value:u,onChange:e=>{d(e.target.value),S.setPage(0)},children:[(0,B.jsx)(`option`,{value:`all`,children:`All sources`}),h.map(e=>(0,B.jsx)(`option`,{value:e,children:Xi(e)},e))]}):null]}),(0,B.jsxs)(`div`,{className:`tr-focus`,role:`group`,"aria-label":`Focus on`,children:[(0,B.jsx)(`span`,{className:`tr-focus-label`,children:`Focus on`}),T.map(([e,t,n])=>{let i=r.filter(_[e]).length;return!i&&c!==e?null:(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":c===e,className:`tr-focus-btn${c===e?` active`:``}`,onClick:()=>{l(c===e?null:e),S.setPage(0)},children:[(0,B.jsx)(n,{size:14}),t,(0,B.jsx)(`span`,{className:`tr-focus-count`,children:i.toLocaleString()})]},e)})]})]}),(0,B.jsxs)(`div`,{className:`tr-layout`,children:[(0,B.jsxs)(`section`,{className:`panel tr-list`,"aria-label":`Test cases`,children:[(0,B.jsx)(`div`,{className:`tr-list-head`,children:C?`${x.length.toLocaleString()} of ${U(r.length,`case`).replace(/^\d+/,r.length.toLocaleString())} match`:U(r.length,`case`).replace(/^\d+/,r.length.toLocaleString())}),x.length?null:(0,B.jsxs)(`div`,{className:`tr-none`,children:[(0,B.jsx)(`strong`,{children:b?`No cases match “${i.trim()}”`:`No cases match these filters`}),(0,B.jsx)(`span`,{children:`Search looks in case names, steps, pages, selectors, error messages, accessibility rules and tags.`}),(0,B.jsx)(`button`,{type:`button`,className:`btn soft`,onClick:()=>{a(``),s(`all`),l(null),d(`all`),S.setPage(0)},children:`Clear search and filters`})]}),(0,B.jsx)(`ul`,{className:`tr-cases`,children:S.shown.map(e=>{let t=Za(e),r=Qa(e)||0,i=e.steps.length||e.timeline.length,a=m?.id===e.id;return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`tr-case${a?` active`:``}`,"aria-current":a?`true`:void 0,onClick:()=>n(e.id),title:`${e.id} ${e.title}`,children:[(0,B.jsx)(na,{status:e.status,size:15}),(0,B.jsx)(`span`,{className:`tr-case-name`,children:e.title}),(0,B.jsxs)(`span`,{className:`tr-case-meta`,children:[g.newIds.has(e.id)?(0,B.jsx)(`span`,{className:`tr-tag fail`,children:`New failure`}):null,g.flakyIds.has(e.id)?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Flaky`}):null,(0,B.jsx)(`span`,{className:`tr-case-id`,children:e.id}),(0,B.jsx)(`span`,{children:e.status===`stopped`?`Not run`:V(e.ms)}),i?(0,B.jsx)(`span`,{children:U(i,`step`)}):null,t?(0,B.jsx)(`span`,{className:`tone-fail`,children:U(t,`browser error`)}):null,r?(0,B.jsxs)(`span`,{className:`tone-warn`,children:[r.toLocaleString(),` accessibility`]}):null]}),(g.runs.get(e.id)?.length||0)>1?(0,B.jsx)(Bo,{runs:g.runs.get(e.id)||[]}):null]})},e.id)})}),(0,B.jsxs)(`div`,{className:`tr-list-foot`,children:[(0,B.jsx)(so,{...S,label:`Case list pages`}),x.length>ns[0]?(0,B.jsxs)(`label`,{className:`tr-per`,children:[`Per page`,(0,B.jsx)(`select`,{className:`field`,value:f,onChange:e=>{p(Number(e.target.value)),S.setPage(0)},children:ns.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}):null]})]}),(0,B.jsx)(ts,{c:m,runs:m?g.runs.get(m.id):void 0,isNew:!!m&&g.newIds.has(m.id),isFlaky:!!m&&g.flakyIds.has(m.id),byFramework:!!e.framework},m?.id||`none`)]})]})}var as=10,os=15;function ss({data:e}){let t=(0,v.useMemo)(()=>[...e.history].sort((e,t)=>t.at.localeCompare(e.at)||Number(!!t.current)-Number(!!e.current)),[e.history]),[n,r]=(0,v.useState)(``),i=n.trim().toLowerCase(),a=i?t.filter(e=>`${e.id} ${e.current?`this run`:``} ${Gi(e.at)} ${qi(e.at)} ${e.at}`.toLowerCase().includes(i)):t,o=oo(a,as);if(t.length<=1)return(0,B.jsxs)(`section`,{className:`panel trh`,"aria-label":`Run history`,children:[(0,B.jsx)(Y,{icon:Ar,tone:`brand`,title:`Run history`}),(0,B.jsxs)(`div`,{className:`trh-empty`,children:[(0,B.jsx)(`strong`,{children:`No earlier runs yet`}),(0,B.jsx)(`span`,{children:`Earlier suite runs in the same folder show up here, with their pass rates, so you can compare.`})]})]});let s=e=>J(e.passed,e.total),c=t[t.length-1],l=t[0],u=Math.round((s(l)-s(c))*10)/10,d=t.filter(e=>e.ms>0),f=d.reduce((e,t)=>t.ms>e.ms?t:e,d[0]||l),p=d.reduce((e,t)=>t.ms<e.ms?t:e,d[0]||l),m=e=>e.current?`this run`:e.id,h=t.some(e=>e.cost);return(0,B.jsxs)(`section`,{className:`panel trh`,"aria-label":`Run history`,children:[(0,B.jsx)(Y,{icon:Ar,tone:`brand`,title:`Run history`,note:`newest first`}),(0,B.jsxs)(`p`,{className:`trh-lead`,children:[t.length.toLocaleString(),` runs in this folder, `,Ki(c.at),` to `,Ki(l.at),`. Pass rate`,` `,u===0?(0,B.jsxs)(B.Fragment,{children:[`held at `,s(l),`%`]}):(0,B.jsxs)(B.Fragment,{children:[`went from `,s(c),`% to `,(0,B.jsxs)(`b`,{className:u>0?`tone-pass`:`tone-fail`,children:[s(l),`%`]}),` (`,u>0?`+`:`−`,Math.abs(u),` points)`]}),`.`,d.length>1?(0,B.jsxs)(B.Fragment,{children:[` `,`Slowest `,m(f),` at `,V(f.ms),` (`,Gi(f.at),`); fastest `,m(p),` at `,V(p.ms),` (`,Gi(p.at),`).`]}):null]}),t.length>as?(0,B.jsxs)(`div`,{className:`table-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:n,placeholder:`Search by run id or date`,"aria-label":`Search runs`,onChange:e=>{r(e.target.value),o.setPage(0)}})]}),(0,B.jsx)(`span`,{className:`table-count`,children:i?`${a.length.toLocaleString()} of ${t.length.toLocaleString()} runs`:`${t.length.toLocaleString()} runs`})]}):null,(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data trh-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Run`}),(0,B.jsx)(`th`,{children:`When`}),(0,B.jsx)(`th`,{className:`trh-results`,children:`Results`}),(0,B.jsx)(`th`,{className:`trh-rate`,children:`Pass rate`}),(0,B.jsx)(`th`,{className:`num`,children:`Duration`}),(0,B.jsx)(`th`,{className:`num`,children:`Tokens`}),h?(0,B.jsx)(`th`,{className:`num`,children:`Cost`}):null,(0,B.jsx)(`th`,{"aria-label":`Report`})]})}),(0,B.jsx)(`tbody`,{children:o.shown.map(e=>{let t=e.current?void 0:q(e.href),n=[[`passed`,e.passed,`passed`],[`failed`,e.failed,`failed`],[`error`,e.error,`could not run`],[`stopped`,e.stopped,`not run`]];return(0,B.jsxs)(`tr`,{className:e.current?`current`:void 0,children:[(0,B.jsxs)(`td`,{className:`trh-run`,children:[(0,B.jsx)(`code`,{title:e.id,children:e.id}),e.current?(0,B.jsx)(`span`,{className:`status-pill brand`,children:`This run`}):null]}),(0,B.jsx)(`td`,{className:`trh-when`,title:qi(e.at),children:Gi(e.at)}),(0,B.jsxs)(`td`,{className:`trh-results`,children:[(0,B.jsx)(`span`,{className:`trh-split`,role:`img`,"aria-label":n.filter(([,e])=>e).map(([,e,t])=>`${e.toLocaleString()} ${t}`).join(`, `)||`no cases`,children:n.map(([e,t])=>t?(0,B.jsx)(`i`,{className:e,style:{flexGrow:t}},e):null)}),(0,B.jsx)(`span`,{className:`trh-counts`,children:n.map(([e,t,n])=>t||e===`passed`||e===`failed`?(0,B.jsxs)(`span`,{title:`${t.toLocaleString()} ${n}`,children:[(0,B.jsx)(ta,{status:e,size:12}),t.toLocaleString()]},e):null)})]}),(0,B.jsxs)(`td`,{className:`trh-rate`,children:[(0,B.jsxs)(`span`,{className:`trh-rate-value`,children:[s(e),`%`]}),(0,B.jsx)(`span`,{className:`trh-rate-bar`,"aria-hidden":`true`,children:(0,B.jsx)(`i`,{style:{width:`${s(e)}%`}})})]}),(0,B.jsx)(`td`,{className:`num`,children:V(e.ms)}),(0,B.jsx)(`td`,{className:`num`,children:H(e.tokens)}),h?(0,B.jsx)(`td`,{className:`num`,children:e.cost?G(e.cost):`—`}):null,(0,B.jsx)(`td`,{className:`trh-link`,children:t?(0,B.jsxs)(`a`,{href:t,title:`Open that run's report`,children:[(0,B.jsx)(Mt,{size:12}),` Report`]}):null})]},`${e.id}-${e.at}`)})})]})}),a.length?null:(0,B.jsxs)(`div`,{className:`trh-empty`,children:[`No runs match “`,n.trim(),`”.`]}),(0,B.jsx)(so,{...o,label:`Run history pages`})]})}var cs=[[`shot`,`Screenshots`],[`text`,`Logs and text`],[`trace`,`Traces`],[`video`,`Recordings`],[`other`,`Other`]],ls={shot:gn,text:Bt,trace:It,video:wi,other:z};function us(e){let t=(e.toLowerCase().match(/\.([a-z0-9]+)$/)||[])[1]||``;return/^(png|jpe?g|gif|webp|bmp|svg|avif)$/.test(t)?`shot`:/^(webm|mp4|mov|mkv|avi)$/.test(t)?`video`:/^(zip|har|trace)$/.test(t)?`trace`:/^(txt|log|md|json|jsonl|csv|xml|html?|ya?ml|out|err|cs|ts|js|py|feature)$/.test(t)?`text`:`other`}function ds({data:e,onOpen:t}){let n=(0,v.useMemo)(()=>e.cases.flatMap(e=>e.files.map(t=>({c:e,f:t,kind:us(t.name)}))),[e.cases]),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(`all`),s=r.trim().toLowerCase(),c=new Map;for(let e of n)c.set(e.kind,(c.get(e.kind)||0)+1);let l=n.filter(e=>(a===`all`||e.kind===a)&&(!s||`${e.c.id} ${e.c.title} ${e.f.name} ${e.f.href}`.toLowerCase().includes(s))),u=oo(l,os),d=e=>{e(),u.setPage(0)};return(0,B.jsxs)(`section`,{className:`panel trf`,"aria-label":`All files`,children:[(0,B.jsx)(Y,{icon:Yt,tone:`brand`,title:`All files`,note:`${n.length.toLocaleString()} ${n.length===1?`file`:`files`} from ${U(new Set(n.map(e=>e.c.id)).size,`case`).replace(/^\d+/,e=>Number(e).toLocaleString())}`}),n.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`trf-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:r,placeholder:`Search case, title, file name or path`,"aria-label":`Search files`,onChange:e=>d(()=>i(e.target.value))})]}),(0,B.jsxs)(`div`,{className:`tr-chips`,role:`group`,"aria-label":`Filter by kind`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":a===`all`,className:`chip-btn${a===`all`?` active`:``}`,onClick:()=>d(()=>o(`all`)),children:[`All`,(0,B.jsx)(`span`,{className:`chip-count`,children:n.length.toLocaleString()})]}),cs.filter(([e])=>c.get(e)||a===e).map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":a===e,className:`chip-btn${a===e?` active`:``}`,onClick:()=>d(()=>o(e)),children:[t,(0,B.jsx)(`span`,{className:`chip-count`,children:(c.get(e)||0).toLocaleString()})]},e))]})]}),(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data trf-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Case`}),(0,B.jsx)(`th`,{children:`File`}),(0,B.jsx)(`th`,{className:`trf-kind`,children:`Kind`}),(0,B.jsx)(`th`,{className:`trf-path`,children:`Path`})]})}),(0,B.jsx)(`tbody`,{children:u.shown.map(({c:e,f:n,kind:r},i)=>{let a=q(n.href),o=ls[r];return(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{className:`trf-case`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>t(e.id),title:`${e.id} ${e.title}`,children:e.id}),(0,B.jsx)(`span`,{className:`trf-title`,title:e.title,children:e.title})]}),(0,B.jsxs)(`td`,{className:`trf-name`,children:[(0,B.jsx)(o,{size:14}),a?(0,B.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,title:n.name,children:n.name}):(0,B.jsx)(`span`,{title:n.name,children:n.name})]}),(0,B.jsx)(`td`,{className:`trf-kind`,children:cs.find(([e])=>e===r)?.[1]}),(0,B.jsx)(`td`,{className:`trf-path`,title:n.href,children:n.href})]},`${u.at}-${i}-${e.id}/${n.name}`)})})]})}),l.length?null:(0,B.jsxs)(`div`,{className:`trh-empty`,children:[`No files match`,s?` “${r.trim()}”`:` this kind`,`.`]}),(0,B.jsx)(so,{...u,label:`File pages`}),(0,B.jsx)(`p`,{className:`ov-caption trf-note`,children:`Links open files from the run folders next to this report. Text files are also embedded: view them in each case's Artifacts tab.`})]}):(0,B.jsx)(`div`,{className:`trh-empty`,children:`No files were recorded for this run.`})]})}function fs({data:e,caseId:t,onSelect:n,initialTab:r=`tests`}){let[i,a]=(0,v.useState)(r),o=oa(e);return(0,B.jsxs)(`div`,{className:`test-results`,children:[(0,B.jsx)(no,{title:(0,B.jsxs)(B.Fragment,{children:[`Test results `,(0,B.jsx)(ra,{verdict:sa(e)})]}),subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsxs)(`span`,{children:[U(o.ran,`case`).replace(/^\d+/,o.ran.toLocaleString()),` ran in `,V(e.ms)]}),(0,B.jsxs)(`span`,{children:[o.passed.toLocaleString(),` of `,o.total.toLocaleString(),` passed`]}),(0,B.jsxs)(`span`,{children:[`Run `,(0,B.jsx)(`code`,{children:e.id})]}),(0,B.jsx)(`span`,{title:qi(e.startedAt),children:e.title})]}),actions:mo(e)}),e.kind===`suite`||e.cases.some(e=>e.files.length)?(0,B.jsx)(ro,{value:i,onChange:a,items:[{id:`tests`,label:`Tests`,icon:ut,count:e.cases.length},...e.kind===`suite`?[{id:`history`,label:`Run history`,icon:Ar,count:e.history.length||void 0}]:[],{id:`files`,label:`All files`,icon:Yt,count:e.cases.reduce((e,t)=>e+t.files.length,0)||void 0}]}):null,i===`tests`?(0,B.jsx)(is,{data:e,caseId:t,onSelect:n}):null,i===`history`?(0,B.jsx)(ss,{data:e}):null,i===`files`?(0,B.jsx)(ds,{data:e,onOpen:e=>{n(e),a(`tests`)}}):null]})}var ps={functional_defect:{label:`Product bug`,one:`product bug`,many:`product bugs`,tone:`fail`,icon:Ee,desc:`Fix in the product: file a bug with the evidence`},test_case_issue:{label:`Test needs update`,one:`test that needs updating`,many:`tests that need updating`,tone:`warn`,icon:gr,desc:`The product works as designed; change the test`},environment:{label:`Environment`,one:`environment problem`,many:`environment problems`,tone:`brand`,icon:Hr,desc:`Fix the test setup or the site it runs against, not the code`},automation:{label:`Automation`,one:`automation problem`,many:`automation problems`,tone:`brand`,icon:Se,desc:`The browser agent or the test code could not do a step`}},ms={label:`Not classified`,icon:nt,desc:`ForgeQE did not say what kind of failure this was`},hs=10,gs=10,_s=12,vs=20,ys=/\.(webm|mp4)$/i,bs=/trace.*\.zip$/i,xs=e=>e.failure&&ps[e.failure.type]?e.failure.type:`none`;function Ss(e){let t=da(e),n=[];t.failedStep&&n.push(`Step ${t.failedStep.n} "${t.failedStep.action}" failed${t.failedStep.expected?`: expected ${t.failedStep.expected}`:``}${t.failedStep.actual?`; saw ${t.failedStep.actual}`:``}`),t.notRun&&n.push(`${U(t.notRun,`later step`)} not run`);for(let e of t.failedActions)n.push(`Browser step ${e.step}: ${e.text}${e.error?` → ${e.error}`:``}`);t.lastEval&&n.push(`Agent's last evaluation: ${t.lastEval}`);for(let e of t.errors.slice(0,5))n.push(`Browser, step ${e.step}: ${Ea(e)}${e.count&&e.count>1?` (×${e.count})`:``}`);return t.errors.length>5&&n.push(`and ${t.errors.length-5} more browser errors`),e.finalUrl&&n.push(`Last page: ${e.finalUrl}`),n}function Cs(e){let t=da(e);return[`${e.id} ${e.title}: ${Zi[e.status]}`,e.summary,``,...Ss(e).map(e=>`- ${e}`),t.bug?.url?`Bug: ${t.bug.url}`:``].filter(Boolean).join(`
23
23
  `)}function ws(e){let t=e.steps.length?e.steps.map(e=>`${e.n}. ${e.action}${e.expected?` (expected: ${e.expected})`:``}${e.status===`failed`?` ← failed here`:``}`):e.timeline.map(e=>`${e.n}. ${e.goal||e.actions.map(e=>e.text).join(`; `)||e.url}`);return[`${e.id} ${e.title}`,e.startUrl?`Start at ${e.startUrl}`:``,...t].filter(Boolean).join(`
24
24
  `)}function Ts(e){navigator.clipboard?.writeText(e).catch(()=>void 0)}function Es(e,t=3){let n=new Map;for(let t of e)n.set(t,(n.get(t)||0)+1);return[...n.entries()].sort((e,t)=>t[1]-e[1]).slice(0,t)}function Ds(e){let t=[...e.history].sort((e,t)=>e.at.localeCompare(t.at)),n=new Map;for(let r of e.cases){let e=0;for(let n=t.length-1;n>=0;n--){let i=t[n].cases.find(e=>e.id===r.id)?.status;if(i&&i!==`stopped`){if(!aa(i))break;e++}}n.set(r.id,e)}return n}function Os({data:e,onOpenCase:t}){let[n,r]=(0,v.useState)(`all`),i=e.framework?`area`:`cause`,[a,o]=(0,v.useState)(i),[s,c]=(0,v.useState)(null),l=(0,v.useMemo)(()=>{let t=Oa(e),n=new Map;for(let t of e.defects||[])for(let e of t.cases)n.has(e.id)||n.set(e.id,t);return{isNew:new Set((t?.newFailures||[]).map(e=>e.id)),known:new Set((t?.stillFailing||[]).map(e=>e.id)),flaky:new Set(ma(e.history).map(e=>e.id)),streak:Ds(e),runs:rs(e),defect:n,compared:!!t,diagnosed:!e.framework}},[e]),u=(0,v.useMemo)(()=>Oa(e),[e]),d=e.cases.filter(e=>e.status!==`passed`),f=[...d].sort((e,t)=>Number(l.isNew.has(t.id))-Number(l.isNew.has(e.id))||Number(e.status===`stopped`)-Number(t.status===`stopped`)),p=e=>e.group||Xi(e.source),[m,h]=(0,v.useState)(()=>new Set(js(f,i,l,p)[0]?.cases.slice(0,1).map(e=>e.id)||[])),g=d.filter(e=>e.status===`failed`),_=d.filter(e=>e.status===`error`),y=d.filter(e=>e.status===`stopped`),b=d.filter(e=>e.status!==`stopped`),x=e=>!!da(e).bug,S=e=>e.status!==`stopped`&&(e.failure?e.failure.type===`functional_defect`:e.status===`failed`),C=b.filter(e=>S(e)&&!x(e)),w=b.filter(S).length,T=Is(e),E=T.reduce((e,t)=>e+t.count,0),D=e.cases.length,O=(0,B.jsx)(no,{title:`Failures`,subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsxs)(`span`,{children:[d.length.toLocaleString(),` of `,X(D,`case`),` did not pass`]}),E?(0,B.jsxs)(`span`,{children:[X(E,`browser error`),` in tests that passed`]}):null,u?(0,B.jsxs)(`span`,{children:[`Compared with the run of `,Gi(u.prev.at)]}):null]}),actions:d.length?(0,B.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>xa(`forgeqe-${e.id||`report`}-failures.md`,zs(e,f),`text/markdown`),children:[(0,B.jsx)(Et,{size:14}),`Export failures`]}):void 0});if(!d.length)return(0,B.jsxs)(`div`,{className:`failures`,children:[O,(0,B.jsxs)(`div`,{className:`panel empty-state`,children:[(0,B.jsx)(ta,{status:`passed`,size:26}),(0,B.jsx)(`h3`,{children:`No failures`}),(0,B.jsxs)(`p`,{children:[D===1?`The test`:`All ${X(D,`test`)}`,` passed and every expected result held.`]})]}),T.length?(0,B.jsx)(Rs,{groups:T,total:E}):null]});let k=Es(b.filter(e=>e.failure).map(e=>e.failure.type),4),A=[];A.push(`${b.length.toLocaleString()} of ${X(D,`test`)} did not pass: ${co([g.length?`${g.length.toLocaleString()} failed an expected result`:``,_.length?`${_.length.toLocaleString()} could not run`:``].filter(Boolean))||`none ran`}${y.length?`, and ${y.length.toLocaleString()} ${y.length===1?`was`:`were`} stopped before starting`:``}.`),k.length&&A.push(`By kind: ${co(k.map(([e,t])=>`${t.toLocaleString()} ${ps[e]?t===1?ps[e].one:ps[e].many:e}`))}.${k.some(([e])=>e!==`functional_defect`)?` Only product bugs need a fix in the application; the rest are fixed in the tests or the environment.`:``}`),u&&A.push(`${l.isNew.size?`${X(l.isNew.size,`failure`)} ${l.isNew.size===1?`is`:`are`} new`:`No failure is new`} since ${Gi(u.prev.at)}${l.known.size?`; ${l.known.size.toLocaleString()} ${l.known.size===1?`was`:`were`} already failing then`:``}.`);let j=Es(b.map(p));j.length&&b.length>2&&A.push(`Most are in ${co(j.map(([e,t])=>`${e} (${t.toLocaleString()})`))}${j[0][1]>=Math.max(2,b.length/3)?`: ${J(j[0][1],b.length)}% of failures are in ${j[0][0]}`:``}.`);let M=(e.defects||[]).filter(e=>e.cases.length>1);M.length&&A.push(`${M.reduce((e,t)=>e+t.cases.length,0).toLocaleString()} of these failures come from ${U(M.length,`defect`)} that break more than one test; see Defects.`);let N=[];E&&N.push(`Tests that passed also logged ${X(E,`browser error`)}${T.length>1?` of ${T.length.toLocaleString()} kinds`:``}. They did not fail a test, but can hide real defects; they are listed at the end of this page.`);let P=e=>lo(e.map(e=>e.id),3),F=e=>b.filter(t=>t.failure?.type===e),ee=b.filter(e=>l.flaky.has(e.id)),te=[],I=C.filter(e=>l.isNew.has(e.id));C.length?te.push({head:`File ${C.length===1?`a bug`:`bugs`}`,text:`for ${P(I.length?[...I,...C.filter(e=>!l.isNew.has(e.id))]:C)}: ${C.every(e=>e.failure?.type===`functional_defect`)?`${C.length===1?`a product bug`:`product bugs`} with no bug report yet`:`no bug report yet`}. Use “Copy for a bug report” on ${C.length===1?`its card`:`each card`}.`}):l.isNew.size&&te.push({head:`Start with the new failures`,text:`${P(b.filter(e=>l.isNew.has(e.id)))}: they point at the latest change.`}),ee.length&&te.push({head:`Re-run before filing`,text:`${P(ee)}: ${ee.length===1?`it`:`they`} passed and failed in recent runs.`}),F(`environment`).length&&te.push({head:`Fix the test environment`,text:`for ${P(F(`environment`))}, then run ${F(`environment`).length===1?`it`:`them`} again.`}),F(`test_case_issue`).length&&te.push({head:`Update the tests`,text:`${P(F(`test_case_issue`))}: the application works as designed.`}),F(`automation`).length&&te.push({head:`Fix the automation`,text:`for ${P(F(`automation`))}: a step could not be done in the browser.`}),y.length&&te.push({head:`Run the ${y.length===1?`test`:`${y.length.toLocaleString()} tests`} that did not start`,text:`${P(y)} stopped before the browser opened.`});let ne=[...l.compared?[{label:`New failures`,value:l.isNew.size.toLocaleString(),sub:`passed in the previous run`,icon:bi,tone:l.isNew.size?`fail`:void 0},{label:`Known failures`,value:l.known.size.toLocaleString(),sub:`failing before this run`,icon:Ar}]:[],{label:`Failed`,value:g.length.toLocaleString(),sub:`expected result not met`,icon:ct,tone:g.length?`fail`:void 0},{label:`Could not run`,value:_.length.toLocaleString(),sub:_.length?`the test could not finish`:`every test could start`,icon:or},...y.length?[{label:`Not run`,value:y.length.toLocaleString(),sub:`stopped before starting`,icon:it}]:[],{label:`Bugs filed`,value:w?`${(w-C.length).toLocaleString()}/${w.toLocaleString()}`:`0`,sub:w?C.length?`${C.length.toLocaleString()} without a report`:`every product bug`:`none needed`,icon:Ee,tone:C.length?`warn`:w?`pass`:void 0}],re=[{id:`all`,label:`All`,icon:Rn,count:d.length},...Object.keys(ps).map(e=>({id:e,label:ps[e].label,icon:ps[e].icon,count:d.filter(t=>xs(t)===e).length})),{id:`none`,label:ms.label,icon:ms.icon,count:d.filter(e=>xs(e)===`none`).length}].filter(e=>e.id===`all`||e.count||e.id===n),L=f.filter(e=>n===`all`||xs(e)===n),ie=js(L,a,l,p),ae=(e,t)=>c({list:e,at:t});return(0,B.jsxs)(`div`,{className:`failures`,children:[O,(0,B.jsxs)(`section`,{className:`panel fl-brief`,"aria-labelledby":`fl-brief-h`,children:[(0,B.jsxs)(`div`,{className:`fl-brief-text`,children:[(0,B.jsxs)(`header`,{className:`panel-head`,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:(0,B.jsx)(z,{size:15})}),(0,B.jsx)(`h2`,{id:`fl-brief-h`,children:`Failure summary`}),(0,B.jsx)(`span`,{className:`fl-note`,children:`written by ForgeQE from this run`})]}),A.map((e,t)=>(0,B.jsx)(`p`,{className:t?`fl-p`:`fl-p fl-lead`,children:e},t)),N.map((e,t)=>(0,B.jsx)(`p`,{className:`fl-p fl-dim`,children:e},t))]}),te.length?(0,B.jsxs)(`div`,{className:`fl-brief-next`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`Do these next, in this order`}),(0,B.jsx)(`ol`,{className:`fl-next`,children:te.slice(0,5).map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`fl-step-n`,children:t+1}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.head}),` `,e.text]})]},e.head))})]}):null]}),(0,B.jsxs)(`section`,{className:`panel fl-figs${ne.length>4?` wide`:``}`,"aria-label":`Failure figures and cause filter`,children:[(0,B.jsx)(`div`,{className:`fl-figs-kpis`,children:(0,B.jsx)(ho,{items:ne})}),(0,B.jsxs)(`div`,{className:`fl-causes`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`Likely cause, from ForgeQE’s diagnosis. Pick one to filter.`}),(0,B.jsx)(`div`,{className:`fl-cause-row`,role:`group`,"aria-label":`Filter by likely cause`,children:re.map(({id:e,label:t,icon:i,count:a})=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,className:`chip-btn${n===e?` active`:``}`,onClick:()=>{r(e)},children:[(0,B.jsx)(i,{size:14}),t,(0,B.jsx)(`span`,{className:`chip-count`,children:a.toLocaleString()})]},e))})]})]}),(0,B.jsxs)(`div`,{className:`fl-toolbar`,children:[(0,B.jsxs)(`div`,{className:`fl-groupby`,role:`group`,"aria-label":`Group failures by`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`Group by`}),(0,B.jsx)(`span`,{className:`fl-seg`,children:[[`cause`,`Likely cause`],[`status`,`Status`],[`error`,`Error type`],[`area`,`Feature area`],[`none`,`None`]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:void 0,onClick:()=>o(e),children:t},e))})]}),(0,B.jsxs)(`div`,{className:`fl-expand`,children:[(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>h(new Set(L.map(e=>e.id))),children:`Expand all`}),(0,B.jsx)(`button`,{type:`button`,className:`text-btn`,onClick:()=>h(new Set),children:`Collapse all`})]})]}),ie.map(e=>(0,B.jsx)(Ms,{title:e.title,desc:e.desc,cases:e.cases,header:a!==`none`,facts:l,open:m,onToggle:e=>h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onOpenCase:t,onShots:ae,area:p,wantsBug:S},`${a}-${n}-${e.key}`)),L.length?null:(0,B.jsxs)(`div`,{className:`panel fl-none`,children:[(0,B.jsx)(`span`,{children:`No failures have this likely cause.`}),(0,B.jsx)(`button`,{type:`button`,className:`btn soft`,onClick:()=>r(`all`),children:`Show all failures`})]}),T.length?(0,B.jsx)(Rs,{groups:T,total:E}):null,s?(0,B.jsx)(Fo,{shots:s.list,index:s.at,onIndex:e=>c({...s,at:e}),onClose:()=>c(null)}):null]})}function ks(e){if(e.status===`stopped`)return`stopped`;let t=da(e);return t.failedStep?`expected`:t.failedActions.length?`action`:e.status===`error`?`unreachable`:t.errors.length?`browser`:`other`}var As=[[`expected`,`Expected result not met`,`The page did something other than what the test expects`],[`action`,`Browser action failed`,`A click, input or wait in the browser did not work`],[`unreachable`,`Could not run`,`The test could not open the site or finish its steps`],[`browser`,`Browser error`,`No step failed, but the page logged errors`],[`other`,`Other`,`No failed step, action or browser error was recorded`],[`stopped`,`Not run`,`Stopped before the browser opened`]];function js(e,t,n,r){if(t===`none`)return e.length?[{key:`all`,title:``,desc:``,cases:e}]:[];let i=t===`cause`?[...Object.entries(ps).map(([e,t])=>[e,t.label,t.desc]),[`none`,ms.label,ms.desc]]:t===`status`?[[`new`,`New failures`,`Passed in the previous run`],[`known`,`Known failures`,`Already failing before this run`],[`failed`,`Failed`,n.compared?`Not in the previous run`:`No earlier run to compare with`],[`error`,`Could not run`,`The test could not open the site or finish its steps`],[`stopped`,`Not run`,`Stopped before the browser opened`]]:t===`error`?As:Es(e.map(r),2**53-1).map(([e])=>[e,e,``]),a=e=>t===`cause`?xs(e):t===`status`?e.status===`stopped`?`stopped`:n.isNew.has(e.id)?`new`:n.known.has(e.id)?`known`:e.status===`error`?`error`:`failed`:t===`error`?ks(e):r(e);return i.map(([t,n,r])=>({key:t,title:n,desc:r,cases:e.filter(e=>a(e)===t)})).filter(e=>e.cases.length)}function Ms({title:e,desc:t,cases:n,header:r,...i}){let a=oo(n,hs);return(0,B.jsxs)(`section`,{className:`fl-group`,"aria-label":e||`All failures`,children:[r?(0,B.jsxs)(`div`,{className:`fl-group-head`,children:[(0,B.jsx)(`h3`,{children:e}),(0,B.jsx)(`span`,{className:`fl-count`,children:X(n.length,`failure`)}),t?(0,B.jsx)(`span`,{className:`fl-note`,children:t}):null]}):null,a.shown.map(e=>(0,B.jsx)(Ns,{c:e,expanded:i.open.has(e.id),...i},e.id)),(0,B.jsx)(so,{...a,label:`${e||`Failures`} pages`})]})}function Ns({c:e,expanded:t,facts:n,onToggle:r,onOpenCase:i,onShots:a,area:o,wantsBug:s}){let c=(0,v.useId)(),l=da(e),u=e.failure?ps[e.failure.type]:void 0,d=u?.icon||ms.icon,f=n.streak.get(e.id)||0,p=e.steps.length||e.timeline.length,m=e.status===`stopped`?`Stopped before it started`:[l.failedStep?`Failed at step ${l.failedStep.n} of ${e.steps.length}`:e.status===`error`?`Could not run`:p?`${U(p,`step`)}`:`Failed`,V(e.ms)].join(` · `),h=e.summary.split(`
25
25
  `)[0]||(e.status===`stopped`?`Stopped before it started.`:``);return(0,B.jsxs)(`article`,{className:`fl-card${t?` open`:``}`,"aria-labelledby":`${c}-h`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`fl-toggle`,"aria-expanded":t,onClick:()=>r(e.id),children:[(0,B.jsx)(na,{status:e.status,size:16}),(0,B.jsxs)(`span`,{className:`fl-head`,children:[(0,B.jsxs)(`span`,{className:`fl-title-row`,children:[(0,B.jsx)(`span`,{id:`${c}-h`,className:`fl-title`,title:`${e.id} ${e.title}`,children:e.title}),(0,B.jsx)(`span`,{className:`fl-id`,children:e.id}),n.isNew.has(e.id)?(0,B.jsx)(`span`,{className:`tr-tag fail`,children:`New failure`}):n.known.has(e.id)?(0,B.jsx)(`span`,{className:`fl-tag`,children:f>1?`Failing for ${f} runs`:`Known failure`}):e.status===`error`?(0,B.jsx)(ea,{status:`error`,label:`Could not run`}):e.status===`stopped`?(0,B.jsx)(ea,{status:`not_run`,label:`Not run`}):null,n.flaky.has(e.id)?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Flaky`}):null,(0,B.jsxs)(`span`,{className:`fl-cause ${u?.tone||`none`}`,children:[(0,B.jsx)(d,{size:12}),u?.label||ms.label]})]}),(0,B.jsx)(`span`,{className:`fl-summary`,title:e.summary,children:h})]}),(0,B.jsxs)(`span`,{className:`fl-where`,children:[(0,B.jsx)(`span`,{children:m}),(0,B.jsx)(Ke,{size:16,className:`fl-chev`})]})]}),t?(0,B.jsx)(Ps,{c:e,facts:n,onOpenCase:i,onShots:a,area:o,wantsBug:s}):null]})}function Ps({c:e,facts:t,onOpenCase:n,onShots:r,area:i,wantsBug:a}){let o=da(e),s=e.failure?ps[e.failure.type]:void 0,c=t.defect.get(e.id),l=t.runs.get(e.id)||[],u=[...o.failedActions.map(e=>`Step ${e.step}: ${e.text}${e.error?` → ${e.error}`:``}`),...o.errors.map(e=>`Step ${e.step}: ${Ea(e)}${e.count&&e.count>1?` (×${e.count.toLocaleString()})`:``}`)],d=u.length>_s?[...u.slice(0,_s),`… and ${(u.length-_s).toLocaleString()} more`].join(`
@@ -32,7 +32,7 @@ Error generating stack: `+e.message+`
32
32
  `)}var xl=10,Sl=10,Cl=10,wl=10,Tl=5;function El(e){return e.passRate<60||e.flips>=4?{label:`Highly unstable`,tone:`fail`}:e.passRate<85||e.flips>=3?{label:`Unstable`,tone:`warn`}:{label:`Occasional`,tone:`brand`}}var Dl=e=>!!e&&e.status!==`passed`&&e.failure?.type===`functional_defect`;function Ol(e,t){return Dl(t)?{label:`Real bug now`,tone:`fail`,text:`It is flaky, but this run classified its failure as a product bug${t?.posted.find(e=>e.source===`bugs`&&e.url)?` and filed a bug`:``}. Treat today's failure as real; fix the flakiness after.`}:El(e).label===`Highly unstable`?{label:`Quarantine and fix`,tone:`fail`,text:`It fails too often to trust. Move it out of the gating suite until the cause is fixed, so it stops hiding real failures.`}:aa(e.last)?{label:`Re-run first`,tone:`warn`,text:`It is failing in this run, but it has passed and failed before. Re-run it before filing a bug.`}:{label:`Watch`,tone:`brand`,text:`It fails now and then. Keep an eye on it; quarantine it if it gets worse.`}}function kl(e,t,n){let r=e.map(e=>new Map(e.cases.filter(e=>aa(e.status)).map(e=>[e.id,e]))),i=new Map(e.map((e,t)=>[e.at,t]));return t.map(e=>{let t=e.runs.filter(e=>aa(e.status)),a=t.map(e=>i.get(e.at)).filter(e=>e!==void 0),o=a.map(t=>r[t].get(e.id)?.cost).filter(e=>typeof e==`number`),s=a.map(e=>r[e].size-1),c=0,l=0;for(let t of e.runs)t.status!==`stopped`&&(l=aa(t.status)?l+1:0,c=Math.max(c,l));return{r:e,c:n.get(e.id),failed:t.map(e=>e.at),cost:o.length?o.reduce((e,t)=>e+t,0):void 0,failMs:t.filter(e=>e.ms>0).map(e=>e.ms),passMs:e.runs.filter(e=>e.status===`passed`&&e.ms>0).map(e=>e.ms),alone:s.filter(e=>e===0).length,others:s.length?s.reduce((e,t)=>e+t,0)/s.length:0,longest:c}})}var Al=e=>e.length?{min:Math.min(...e),max:Math.max(...e)}:void 0,jl=e=>e.min===e.max?V(e.min):`${V(e.min)} to ${V(e.max)}`;function Ml(e){let t=Al([...e.failMs,...e.passMs]);return!!t&&t.min>0&&t.max/t.min>=2}function Nl(e){let t=[],n=Al(e.failMs),r=Al(e.passMs);if(n&&r&&n.min>r.max)t.push(`The failed runs took ${jl(n)}; the passing runs ${jl(r)}. Look for a wait that runs out.`);else if(n&&r&&n.max<r.min)t.push(`The failed runs ended sooner (${jl(n)}) than the passing runs (${jl(r)}): it stops at the step that fails.`);else if(Ml(e)){let n=Al([...e.failMs,...e.passMs]);t.push(`Run time swings from ${jl(n)} between runs, which points at timing: waits, animations, slow services.`)}let i=e.failed.length;return i&&(e.alone===i?t.push(`It was the only case failing in ${i===1?`the run`:`all ${i.toLocaleString()} runs`} it failed: the cause is in this test or the page it covers, not the whole environment.`):e.alone===0?t.push(`Other cases failed in every run it failed (${(Math.round(e.others*10)/10).toLocaleString()} on average): look at the environment of those runs first.`):t.push(`It was the only failure in ${e.alone.toLocaleString()} of its ${i.toLocaleString()} failed runs.`)),i>1&&e.longest===1?t.push(`It never failed twice in a row: each failure passed on the next run.`):e.longest>1&&t.push(`Its longest run of failures was ${e.longest.toLocaleString()} runs in a row.`),i&&t.push(`It failed on ${lo(e.failed.map(go),5)}.`),t}function Pl(e){if(!e||!aa(e.status))return[];let t=da(e),n=[];t.failedStep&&n.push({step:`${t.failedStep.n}. ${t.failedStep.action}`,msg:t.failedStep.actual||(t.failedStep.expected?`Expected ${t.failedStep.expected}`:void 0)});for(let e of t.failedActions.slice(0,3))n.push({step:`Browser step ${e.step}: ${e.text}`,msg:e.error});return t.failedActions.length>3&&n.push({step:`and ${(t.failedActions.length-3).toLocaleString()} more failed browser actions`}),n}function Fl(e){return e.filter(e=>e.status===`passed`).map(e=>({c:e,rerun:!!e.retried,steps:e.timeline.filter(e=>e.actions.some(e=>!e.ok)).map(e=>{let t=e.actions.find(e=>!e.ok);return{n:e.n,goal:e.goal,error:`${t.text}${t.error?` → ${t.error}`:``}`}})})).filter(e=>e.rerun||e.steps.length)}function Il(e){navigator.clipboard?.writeText(e).catch(()=>void 0)}var Ll=e=>`Failed ${e.ran-e.passed} of ${U(e.ran,`run`)} (${Math.round(100-e.passRate)}%)`;function Rl(e,t){let{r:n,c:r}=e,i=Ol(n,r);return[`${n.id} ${n.title}: flaky`,`${Ll(n)}, ${U(n.flips,`change`)} between passing and failing.`,`What to do: ${i.label}. ${i.text}`,...Pl(r).map(e=>`- This run: ${e.step}${e.msg?` → ${e.msg}`:``}`),...Nl(e).map(e=>`- ${e}`),t&&e.cost!==void 0?`Spent on failed runs: ${t(e.cost)}`:``].filter(Boolean).join(`
33
33
  `)}function zl(e,t,n,r,i){return[`# Flaky tests: ${e.title}`,``,`${U(t.length,`flaky case`)}, ${n.length} passing only after a retry, ${r.length} broken and not passing since.`,``,...t.flatMap(e=>[`## ${e.r.id} ${e.r.title}`,``,Rl(e,i),``]),...n.length?[`## Hidden by agent retries`,``,...n.map(e=>`- ${e.c.id} ${e.c.title}: ${e.rerun?`the whole case ran again`:`${U(e.steps.length,`step`)} retried; first: ${e.steps[0].error}`}`),``]:[],...r.length?[`## Started failing and not passed since`,``,...r.map(e=>`- ${e.id} ${e.title}`),``]:[]].join(`
34
34
  `)}function Bl({data:e,onOpenCase:t}){let n=(0,v.useMemo)(()=>[...e.history].sort((e,t)=>e.at.localeCompare(t.at)),[e]),r=(0,v.useMemo)(()=>{let t=new Map(e.cases.map(e=>[e.id,e])),r=ma(n);return{byId:t,flaky:r,list:kl(n,r,t),broke:ha(n),hidden:Fl(e.cases),runs:rs(e)}},[e,n]),i=n.length;if(i<2)return(0,B.jsxs)(`div`,{className:`fk`,children:[(0,B.jsx)(no,{title:`Flaky tests`,subtitle:`Tests whose result keeps changing between runs, and what to do about them`}),(0,B.jsxs)(`div`,{className:`panel empty-state`,children:[(0,B.jsx)(qt,{size:26}),(0,B.jsx)(`h3`,{children:`Needs more than one run`}),(0,B.jsx)(`p`,{children:`A test counts as flaky when its result changes more than once across runs, for example pass, fail, pass. Run the suite again into the same folder to compare.`})]})]});let{byId:a,flaky:o,list:s,broke:c,hidden:l}=r,u=new Set(o.map(e=>e.id)),d=new Set(n.flatMap(e=>e.cases.map(e=>e.id))).size,f=n.reduce((e,t)=>e+t.cases.filter(e=>e.status!==`stopped`).length,0),p=o.reduce((e,t)=>e+(t.ran-t.passed),0),m=n.filter(e=>{let t=e.cases.filter(e=>aa(e.status));return t.length>0&&t.every(e=>u.has(e.id))}),h=n.find(e=>e.cost)?.cost?.currency,g=s.some(e=>e.cost!==void 0)?e=>e===void 0?`—`:W(e,h):void 0,_=s.reduce((e,t)=>e+(t.cost||0),0),y=s.filter(e=>aa(e.r.last)),b=y.filter(e=>Dl(e.c)),x=y.filter(e=>!Dl(e.c)),S=s.filter(e=>El(e.r).label===`Highly unstable`),C=s.filter(Ml),w=e=>a.get(e)?.group||(a.get(e)?Xi(a.get(e).source):``),T=[];if(o.length){m.length&&T.push((0,B.jsxs)(`span`,{children:[`Flakiness alone turned `,(0,B.jsxs)(`strong`,{children:[m.length.toLocaleString(),` of `,X(i,`run`)]}),` red: in `,m.length===1?`that run`:`those runs`,` only flaky cases failed. `]},`red`)),T.push((0,B.jsxs)(`span`,{children:[X(o.length,`case`),` of `,d.toLocaleString(),` passed and failed in turn across the last `,X(i,`run`),`, `,X(p,`flaky failure`),` in `,f.toLocaleString(),` case runs.`,` `]},`n`));for(let e of s.slice(0,2))T.push((0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.r.title}),` failed `,(e.r.ran-e.r.passed).toLocaleString(),` of `,X(e.r.ran,`run`),aa(e.r.last)?`, this run included`:``,e.longest===1&&e.failed.length>1?`, never twice in a row`:``,`.`,` `]},e.r.id))}else T.push((0,B.jsxs)(`span`,{children:[`No case passed and failed in turn across the last `,X(i,`run`),`: no result changed more than once.`]},`none`));let E=[];b.length&&E.push((0,B.jsxs)(`span`,{children:[`This run classified `,lo(b.map(e=>e.r.title),2),` as `,b.length===1?`a product bug`:`product bugs`,`: flaky, but failing for a real reason today. `]},`real`)),C.length&&E.push((0,B.jsxs)(`span`,{children:[lo(C.map(e=>e.r.title),2),` `,C.length===1?`takes`:`take`,` more than twice as long in some runs as in others, which points at timing. `]},`timing`));let D=new Map;for(let e of o)w(e.id)&&D.set(w(e.id),(D.get(w(e.id))||0)+1);let O=[...D.entries()].sort((e,t)=>t[1]-e[1]).slice(0,3);O.length&&o.length>2&&E.push((0,B.jsxs)(`span`,{children:[`Most are in `,co(O.map(([e,t])=>`${e} (${t.toLocaleString()})`)),`. `]},`areas`));let k=n.map(e=>e.cases.filter(e=>u.has(e.id)&&aa(e.status)).length),A=Math.floor(i/2),j=k.slice(0,A).reduce((e,t)=>e+t,0)/Math.max(1,A),M=k.slice(A).reduce((e,t)=>e+t,0)/Math.max(1,i-A);o.length&&i>=4&&(M>j*1.3||M<j*.7)&&E.push((0,B.jsxs)(`span`,{children:[`Flaky failures are `,M>j?`rising`:`falling`,`, from `,j.toFixed(1),` to `,M.toFixed(1),` per run. `]},`trend`)),l.length&&E.push((0,B.jsxs)(`span`,{children:[X(l.length,`more case`),` passed in this run only after the agent tried a step again; a plain script would have failed there. `]},`hidden`)),c.length&&E.push((0,B.jsxs)(`span`,{children:[X(c.length,`case`),` broke and `,c.length===1?`has`:`have`,` not passed since: `,c.length===1?`a real failure`:`real failures`,`, not flakiness.`]},`broke`));let N=e=>lo(e.map(e=>e.title),2),P=[];b.length&&P.push({head:`Treat today’s failure as real`,text:`for ${N(b.map(e=>e.r))}: this run found a product bug.`}),x.length&&P.push({head:`Re-run before filing bugs`,text:`for ${N(x.map(e=>e.r))}: failing now, but passed and failed before.`});let F=S.filter(e=>!Dl(e.c));F.length&&P.push({head:`Quarantine and fix`,text:`for ${N(F.map(e=>e.r))}: too unstable to gate a release.`}),C.length&&P.push({head:`Look at the waits`,text:`in ${N(C.map(e=>e.r))}, whose run time swings between runs.`}),c.length&&P.push({head:`Investigate what broke`,text:`in ${N(c)}: passed before and not since.`}),l.length&&P.push({head:`Watch the retried steps`,text:`in ${N(l.map(e=>e.c))}: retries are an early warning.`});let ee=[{label:`Flaky cases`,value:`${o.length.toLocaleString()} of ${d.toLocaleString()}`,sub:l.length?`+${l.length.toLocaleString()} hidden by agent retries`:`passed and failed in turn`,icon:Oi,tone:o.length?`warn`:`pass`},{label:`Runs turned red`,value:`${m.length.toLocaleString()} of ${i.toLocaleString()}`,sub:m.length?lo(m.map(e=>go(e.at)),3):p?`always with other failures`:`none`,icon:ct,tone:m.length?`fail`:void 0},{label:`Flake rate`,value:`${J(p,f)}%`,sub:`${X(p,`flaky failure`)} in ${f.toLocaleString()} case runs`,icon:vr},...g?[{label:`Spent on flaky failures`,value:g(_),sub:`tokens that bought no result`,icon:to(h)}]:[],{label:`Started failing`,value:c.length.toLocaleString(),sub:c.length?`passed before, not since`:`nothing broke for good`,icon:bi,tone:c.length?`fail`:void 0}];return(0,B.jsxs)(`div`,{className:`fk`,children:[(0,B.jsx)(no,{title:`Flaky tests`,subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsxs)(`span`,{children:[X(o.length,`flaky case`),l.length?` and ${l.length.toLocaleString()} hiding it behind agent retries`:``]}),(0,B.jsxs)(`span`,{children:[`Last `,X(i,`run`),`, `,go(n[0].at),` to `,go(n[i-1].at)]})]}),actions:o.length||l.length||c.length?(0,B.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>xa(`forgeqe-${e.id||`report`}-flaky.md`,zl(e,s,l,c,g),`text/markdown`),children:[(0,B.jsx)(Et,{size:14}),`Export`]}):void 0}),(0,B.jsxs)(`section`,{className:`panel fl-brief`,"aria-labelledby":`fk-brief-h`,children:[(0,B.jsxs)(`div`,{className:`fl-brief-text`,children:[(0,B.jsxs)(`header`,{className:`panel-head`,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:(0,B.jsx)(z,{size:15})}),(0,B.jsx)(`h2`,{id:`fk-brief-h`,children:`Flakiness summary`}),(0,B.jsxs)(`span`,{className:`fl-note`,children:[`written by ForgeQE across the last `,X(i,`run`)]})]}),(0,B.jsx)(`p`,{className:`fl-p`,children:T}),E.length?(0,B.jsx)(`p`,{className:`fl-p fl-dim`,children:E}):null]}),P.length?(0,B.jsxs)(`div`,{className:`fl-brief-next`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`Do these next, in this order`}),(0,B.jsx)(`ol`,{className:`fl-next`,children:P.slice(0,Tl).map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`fl-step-n`,children:t+1}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.head}),` `,e.text]})]},e.head))})]}):null]}),(0,B.jsx)(ho,{items:ee}),s.length?(0,B.jsx)(Vl,{list:s,failingNow:y.length,worst:S.length,money:g,onOpenCase:t,area:w}):null,l.length?(0,B.jsx)(Gl,{hidden:l,flaky:u,runs:r.runs,onOpenCase:t}):null,c.length?(0,B.jsx)(Kl,{rows:c,byId:a,onOpenCase:t}):null]})}function Vl({list:e,failingNow:t,worst:n,money:r,onOpenCase:i,area:a}){let[o,s]=(0,v.useState)(`all`),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(()=>new Set(e.slice(0,1).map(e=>e.r.id))),f=c.trim().toLowerCase(),p=e.filter(e=>(o===`all`||(o===`now`?aa(e.r.last):El(e.r).label===`Highly unstable`))&&(!f||`${e.r.id} ${e.r.title} ${a(e.r.id)}`.toLowerCase().includes(f))),m=oo(p,xl),h=[[`all`,`All flaky`,e.length],[`now`,`Failing now`,t],[`worst`,`Highly unstable`,n]];return(0,B.jsxs)(`section`,{className:`fk-cases`,"aria-labelledby":`fk-cases-h`,children:[(0,B.jsxs)(`div`,{className:`fk-cases-head`,children:[(0,B.jsxs)(`h2`,{id:`fk-cases-h`,children:[`Flaky cases `,(0,B.jsx)(`span`,{className:`fl-count`,children:e.length.toLocaleString()})]}),(0,B.jsx)(`span`,{className:`fl-note`,children:`Passed and failed with no clear reason; most unstable first`})]}),(0,B.jsxs)(`div`,{className:`fk-tools`,children:[(0,B.jsx)(`div`,{className:`fk-chips`,role:`group`,"aria-label":`Show flaky cases`,children:h.filter(([e,,t])=>e===`all`||t||o===e).map(([e,t,n])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":o===e,className:`chip-btn${o===e?` active`:``}`,onClick:()=>{s(e),m.setPage(0)},children:[t,(0,B.jsx)(`span`,{className:`chip-count`,children:n.toLocaleString()})]},e))}),e.length>xl?(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:c,placeholder:`Search flaky cases`,"aria-label":`Search flaky cases`,onChange:e=>{l(e.target.value),m.setPage(0)}})]}):null]}),m.shown.map(e=>(0,B.jsx)(Ul,{s:e,expanded:u.has(e.r.id),money:r,area:a(e.r.id),onOpenCase:i,onToggle:()=>d(t=>{let n=new Set(t);return n.has(e.r.id)?n.delete(e.r.id):n.add(e.r.id),n})},e.r.id)),p.length?null:(0,B.jsx)(`div`,{className:`panel fl-none`,children:`No flaky case matches.`}),(0,B.jsx)(so,{...m,label:`Flaky cases pages`})]})}var Hl=e=>e.runs.map(e=>({at:e.at,current:!!e.current,status:e.status}));function Ul({s:e,expanded:t,money:n,area:r,onToggle:i,onOpenCase:a}){let o=(0,v.useId)(),{r:s,c}=e,l=El(s),u=`Passed ${s.passed.toLocaleString()} of ${X(s.ran,`run`)}, ${U(s.flips,`change`)} between passing and failing${s.lastFailedAt?`; last failed ${Gi(s.lastFailedAt)}`:``}.`;return(0,B.jsxs)(`article`,{className:`fl-card${t?` open`:``}`,"aria-labelledby":`${o}-h`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`fl-toggle`,"aria-expanded":t,onClick:i,children:[(0,B.jsx)(na,{status:s.last,size:16}),(0,B.jsxs)(`span`,{className:`fl-head`,children:[(0,B.jsxs)(`span`,{className:`fl-title-row`,children:[(0,B.jsx)(`span`,{id:`${o}-h`,className:`fl-title`,title:`${s.id} ${s.title}`,children:s.title}),(0,B.jsx)(`span`,{className:`fl-id`,children:s.id}),(0,B.jsx)(`span`,{className:`tr-tag warn`,children:Ll(s)}),l.label===`Highly unstable`?(0,B.jsx)(`span`,{className:`tr-tag fail`,children:l.label}):null,Dl(c)?(0,B.jsx)(`span`,{className:`tr-tag fail`,children:`Real bug now`}):aa(s.last)?(0,B.jsx)(`span`,{className:`fl-tag`,children:`Failing now`}):null]}),(0,B.jsx)(`span`,{className:`fl-summary`,children:u})]}),(0,B.jsxs)(`span`,{className:`fl-where`,children:[(0,B.jsx)(Bo,{runs:Hl(s).slice(-12),size:`md`}),(0,B.jsx)(Ke,{size:16,className:`fl-chev`})]})]}),t?(0,B.jsx)(Wl,{s:e,money:n,area:r,onOpenCase:a}):null]})}function Wl({s:e,money:t,area:n,onOpenCase:r}){let{r:i,c:a}=e,o=Ol(i,a),s=Pl(a),c=Nl(e),l=Al([...e.failMs,...e.passMs]),u=oo([...i.runs].reverse(),wl),d=q(a?.url),f=[[`Failed`,`${(i.ran-i.passed).toLocaleString()} of ${i.ran.toLocaleString()}`],[`Flips`,i.flips.toLocaleString()],[`First failed`,e.failed.length?go(e.failed[0]):`—`],...t&&e.cost!==void 0?[[`Spent on failed runs`,t(e.cost)]]:[],...l?[[`Run time`,jl(l)]]:[]];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`fl-body`,children:[(0,B.jsxs)(`div`,{className:`fl-main`,children:[(0,B.jsx)(`dl`,{className:`fk-figs`,children:f.map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]},e))}),s.length?(0,B.jsxs)(`div`,{className:`fl-block`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`Where it broke in this run`}),(0,B.jsx)(`ul`,{className:`fk-where`,children:s.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`fk-step`,title:e.step,children:e.step}),e.msg?(0,B.jsx)(`code`,{className:`fk-msg`,title:e.msg,children:e.msg}):null]},t))})]}):null,c.length?(0,B.jsxs)(`div`,{className:`fl-block`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`What the failed runs had in common`}),(0,B.jsx)(`ul`,{className:`fk-common`,children:c.map(e=>(0,B.jsx)(`li`,{children:e},e))})]}):null]}),(0,B.jsxs)(`div`,{className:`fl-side`,children:[(0,B.jsxs)(`div`,{className:`fl-diag`,children:[(0,B.jsxs)(`span`,{className:`fl-diag-head`,children:[(0,B.jsx)(Qr,{size:14}),`ForgeQE diagnosis`,(0,B.jsx)(`span`,{className:`tr-tag ${o.tone===`brand`?`warn`:o.tone}`,children:o.label})]}),(0,B.jsx)(`p`,{children:o.text}),a?.failure&&aa(a.status)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`This run`}),(0,B.jsxs)(`p`,{className:`fl-clamp`,title:a.failure.reason,children:[a.failure.label,`: `,a.failure.reason]})]}):null]}),(0,B.jsxs)(`div`,{className:`fl-block`,children:[(0,B.jsxs)(`span`,{className:`fl-label`,children:[`Run by run, newest first`,n?` · ${n}`:``]}),(0,B.jsx)(`ul`,{className:`run-list`,children:u.shown.map(e=>(0,B.jsxs)(`li`,{className:e.current?`current`:void 0,children:[(0,B.jsxs)(`span`,{className:`rl-when`,title:qi(e.at),children:[Gi(e.at),e.current?(0,B.jsx)(`span`,{className:`rl-now`,children:`this run`}):null]}),(0,B.jsx)(ea,{status:e.status}),(0,B.jsx)(`span`,{className:`rl-ms`,children:e.status===`stopped`?`—`:V(e.ms)})]},e.at))}),(0,B.jsx)(so,{...u,label:`${i.id} runs pages`})]})]})]}),(0,B.jsxs)(`div`,{className:`fl-actions`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>Il(Rl(e,t)),children:[(0,B.jsx)(bt,{size:14}),` Copy notes for a ticket`]}),d&&a?(0,B.jsxs)(`a`,{className:`btn`,href:d,target:`_blank`,rel:`noreferrer`,children:[(0,B.jsx)(Mt,{size:14}),` Open in `,Xi(a.source)]}):null,a?(0,B.jsxs)(`button`,{type:`button`,className:`text-btn fl-open`,onClick:()=>r(i.id),children:[(0,B.jsx)(mr,{size:14}),` Open in Test results`]}):null]})]})}function Gl({hidden:e,flaky:t,runs:n,onOpenCase:r}){let i=oo([...e].sort((e,n)=>Number(t.has(n.c.id))-Number(t.has(e.c.id))||n.steps.length-e.steps.length),Sl);return(0,B.jsxs)(`section`,{className:`panel ov-flush fk-hidden`,children:[(0,B.jsx)(Y,{icon:Mr,tone:`brand`,title:`Hidden by agent retries`,note:`Cases that passed in this run only on a second try. A plain script would have failed here.`}),(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data fk-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`Case and step`}),(0,B.jsx)(`th`,{scope:`col`,children:`Retried`}),(0,B.jsx)(`th`,{scope:`col`,children:`Last runs`}),(0,B.jsx)(`th`,{scope:`col`,children:`Why the first try failed`}),(0,B.jsx)(`th`,{scope:`col`,children:`Status`})]})}),(0,B.jsx)(`tbody`,{children:i.shown.map(e=>{let i=n.get(e.c.id)||[],a=i.some(e=>!e.current&&aa(e.status)),o=e.steps[0];return(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{children:[(0,B.jsx)(`button`,{type:`button`,className:`link-btn fk-case`,title:`${e.c.id} ${e.c.title}`,onClick:()=>r(e.c.id),children:e.c.title}),(0,B.jsx)(`span`,{className:`cell-sub`,children:o?`Step ${o.n}${o.goal?` · ${o.goal}`:``}${e.steps.length>1?` and ${(e.steps.length-1).toLocaleString()} more`:``}`:`The whole case ran again`})]}),(0,B.jsx)(`td`,{className:`fk-nowrap`,children:e.rerun?`Whole case, once`:X(e.steps.length,`step`)}),(0,B.jsx)(`td`,{children:i.length?(0,B.jsx)(Bo,{runs:i}):(0,B.jsx)(`span`,{className:`dim`,children:`—`})}),(0,B.jsx)(`td`,{children:e.rerun&&!o?(0,B.jsx)(`span`,{className:`fl-dim`,children:`The first run met an environment problem, so the case ran once more.`}):(0,B.jsx)(`code`,{className:`fk-msg`,title:e.steps.map(e=>`Step ${e.n}: ${e.error}`).join(`
35
- `),children:o.error})}),(0,B.jsx)(`td`,{children:t.has(e.c.id)?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Flaky too`}):a?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Failed in earlier runs`}):(0,B.jsx)(`span`,{className:`fl-tag`,children:`Watch`})})]},e.c.id)})})]})}),(0,B.jsx)(so,{...i,label:`Hidden by agent retries pages`})]})}function Kl({rows:e,byId:t,onOpenCase:n}){let r=oo(e,Cl);return(0,B.jsxs)(`section`,{className:`panel ov-flush fk-hidden`,children:[(0,B.jsx)(Y,{icon:Ar,tone:`fail`,title:`Started failing and not passed since`,note:`A real failure, not flakiness: these are on the Failures page`}),(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data fk-table fk-broke`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`Case`}),(0,B.jsx)(`th`,{scope:`col`,children:`Runs, oldest first`}),(0,B.jsx)(`th`,{scope:`col`,children:`Broke on`}),(0,B.jsx)(`th`,{scope:`col`,children:`Now`})]})}),(0,B.jsx)(`tbody`,{children:r.shown.map(e=>{let r=e.runs.map(e=>e.status).lastIndexOf(`passed`),i=e.runs.slice(r+1).find(e=>aa(e.status));return(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{children:[t.has(e.id)?(0,B.jsx)(`button`,{type:`button`,className:`link-btn fk-case`,title:`${e.id} ${e.title}`,onClick:()=>n(e.id),children:e.title}):(0,B.jsx)(`span`,{className:`fk-case`,title:`${e.id} ${e.title}`,children:e.title}),(0,B.jsx)(`span`,{className:`cell-sub`,children:e.id})]}),(0,B.jsx)(`td`,{children:(0,B.jsx)(Bo,{runs:Hl(e).slice(-12)})}),(0,B.jsx)(`td`,{className:`fk-nowrap`,title:i?qi(i.at):void 0,children:i?go(i.at):`—`}),(0,B.jsx)(`td`,{children:e.last?(0,B.jsx)(ea,{status:e.last}):(0,B.jsx)(`span`,{className:`dim`,children:`—`})})]},e.id)})})]})}),(0,B.jsx)(so,{...r,label:`Started failing pages`})]})}function ql({data:e}){let t=e.env,n=[...new Set(e.cases.flatMap(e=>[Ji(e.startUrl),Ji(e.finalUrl)]).filter(Boolean))],r=[...t?.testEnvironment?[{label:`Test environment`,value:t.testEnvironment,icon:On}]:[],{label:`Model`,value:t?.model,icon:Qr},{label:`Browser`,value:t?.browser,icon:Qn},{label:`Model price`,value:t?.price?`${W(t.price.input,t.price.currency)} in · ${t.price.cachedInput==null?`cached in at the full rate · `:`${W(t.price.cachedInput,t.price.currency)} cached in · `}${W(t.price.output,t.price.currency)} out per million tokens${t.price.note?` (${t.price.note})`:``}`:`not set (add price in llms.json for costs)`,icon:to(t?.price?.currency)},{label:`Start URL`,value:t?.startUrl,icon:At},{label:`ForgeQE`,value:t?.version,icon:cr},{label:`Machine`,value:t?.machine,icon:St},{label:`Build`,value:t?.ci?t.ci.url?(0,B.jsx)(`a`,{href:q(t.ci.url),children:t.ci.name}):t.ci.name:void 0,icon:Hr},{label:`Branch`,value:t?.branch,icon:tn},{label:`Commit`,value:t?.commit?.slice(0,12),icon:rn,title:t?.commit},{label:`Started`,value:qi(e.startedAt),icon:Ai}];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(no,{title:`Environment`,subtitle:`Where and how this run happened`}),(0,B.jsxs)(`div`,{className:`card`,children:[(0,B.jsx)(`h3`,{className:`card-cap`,children:`Run`}),(0,B.jsx)(`div`,{className:`env-grid`,children:r.map(e=>{let t=e.icon;return(0,B.jsxs)(`div`,{className:`env-item`,children:[(0,B.jsxs)(`span`,{className:`env-label`,children:[(0,B.jsx)(t,{size:12}),e.label]}),(0,B.jsx)(`strong`,{title:e.title,children:e.value||`—`})]},e.label)})}),n.length?(0,B.jsxs)(`div`,{className:`env-url-list`,children:[(0,B.jsxs)(`div`,{className:`section-label`,style:{marginTop:14},children:[(0,B.jsx)(At,{size:12}),` Sites visited`]}),(0,B.jsx)(`ul`,{children:n.map(e=>(0,B.jsx)(`li`,{children:e},e))})]}):null]})]})}var Jl=10,Yl=[{id:`newFailures`,title:`New failures`,note:`Passed last time, failing now`,icon:bi,tone:`fail`},{id:`notRun`,title:`Not run this time`,note:`Ran last time, stopped before starting now`,icon:it,tone:`warn`},{id:`stillFailing`,title:`Still failing`,note:`Failed both times`,icon:Ar,tone:`fail`},{id:`fixed`,title:`Fixed`,note:`Failed last time, passing now`,icon:Mi,tone:`pass`},{id:`slower`,title:`Slower`,note:`At least 5s and 25% slower`,icon:vi,tone:`warn`},{id:`faster`,title:`Faster`,note:`At least 5s and 25% faster`,icon:gi,tone:`pass`},{id:`added`,title:`New cases`,note:`Not in the previous run`,icon:Wn,tone:`brand`},{id:`removed`,title:`Dropped cases`,note:`In the previous run, not in this one`,icon:Bn,tone:`brand`}];function Xl(e,t){return`${e>0?`+`:e<0?`−`:``}${t(Math.abs(e))}`}function Zl(e){let t=[...e.history].sort((e,t)=>e.at.localeCompare(t.at)),n=t.map(e=>new Map(e.cases.map(e=>[e.id,e.status]))),r=new Map;for(let e of t[t.length-1]?.cases||[]){let t=0;for(let r=n.length-1;r>=0;r--){let i=n[r].get(e.id);if(i&&i!==`stopped`){if(!aa(i))break;t++}}r.set(e.id,t)}return r}function Ql({data:e,onOpenCase:t}){let n=(0,v.useMemo)(()=>Oa(e),[e]),r=(0,v.useMemo)(()=>Zl(e),[e]),i=(0,v.useMemo)(()=>new Map(e.cases.map(e=>[e.id,e.summary.split(`
35
+ `),children:o.error})}),(0,B.jsx)(`td`,{children:t.has(e.c.id)?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Flaky too`}):a?(0,B.jsx)(`span`,{className:`tr-tag warn`,children:`Failed in earlier runs`}):(0,B.jsx)(`span`,{className:`fl-tag`,children:`Watch`})})]},e.c.id)})})]})}),(0,B.jsx)(so,{...i,label:`Hidden by agent retries pages`})]})}function Kl({rows:e,byId:t,onOpenCase:n}){let r=oo(e,Cl);return(0,B.jsxs)(`section`,{className:`panel ov-flush fk-hidden`,children:[(0,B.jsx)(Y,{icon:Ar,tone:`fail`,title:`Started failing and not passed since`,note:`A real failure, not flakiness: these are on the Failures page`}),(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data fk-table fk-broke`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`Case`}),(0,B.jsx)(`th`,{scope:`col`,children:`Runs, oldest first`}),(0,B.jsx)(`th`,{scope:`col`,children:`Broke on`}),(0,B.jsx)(`th`,{scope:`col`,children:`Now`})]})}),(0,B.jsx)(`tbody`,{children:r.shown.map(e=>{let r=e.runs.map(e=>e.status).lastIndexOf(`passed`),i=e.runs.slice(r+1).find(e=>aa(e.status));return(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{children:[t.has(e.id)?(0,B.jsx)(`button`,{type:`button`,className:`link-btn fk-case`,title:`${e.id} ${e.title}`,onClick:()=>n(e.id),children:e.title}):(0,B.jsx)(`span`,{className:`fk-case`,title:`${e.id} ${e.title}`,children:e.title}),(0,B.jsx)(`span`,{className:`cell-sub`,children:e.id})]}),(0,B.jsx)(`td`,{children:(0,B.jsx)(Bo,{runs:Hl(e).slice(-12)})}),(0,B.jsx)(`td`,{className:`fk-nowrap`,title:i?qi(i.at):void 0,children:i?go(i.at):`—`}),(0,B.jsx)(`td`,{children:e.last?(0,B.jsx)(ea,{status:e.last}):(0,B.jsx)(`span`,{className:`dim`,children:`—`})})]},e.id)})})]})}),(0,B.jsx)(so,{...r,label:`Started failing pages`})]})}function ql({data:e}){let t=e.env,n=[...new Set(e.cases.flatMap(e=>[Ji(e.startUrl),Ji(e.finalUrl)]).filter(Boolean))],r=[...t?.testEnvironment?[{label:`Test environment`,value:t.testEnvironment,icon:On}]:[],{label:`Model`,value:t?.model,icon:Qr},...t?.app?[{label:`App`,value:t.app,icon:Qn}]:t?.browser||!t?[{label:`Browser`,value:t?.browser,icon:Qn}]:[],{label:`Model price`,value:t?.price?`${W(t.price.input,t.price.currency)} in · ${t.price.cachedInput==null?`cached in at the full rate · `:`${W(t.price.cachedInput,t.price.currency)} cached in · `}${W(t.price.output,t.price.currency)} out per million tokens${t.price.note?` (${t.price.note})`:``}`:`not set (add price in llms.json for costs)`,icon:to(t?.price?.currency)},{label:`Start URL`,value:t?.startUrl,icon:At},{label:`ForgeQE`,value:t?.version,icon:cr},{label:`Machine`,value:t?.machine,icon:St},{label:`Build`,value:t?.ci?t.ci.url?(0,B.jsx)(`a`,{href:q(t.ci.url),children:t.ci.name}):t.ci.name:void 0,icon:Hr},{label:`Branch`,value:t?.branch,icon:tn},{label:`Commit`,value:t?.commit?.slice(0,12),icon:rn,title:t?.commit},{label:`Started`,value:qi(e.startedAt),icon:Ai}];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(no,{title:`Environment`,subtitle:`Where and how this run happened`}),(0,B.jsxs)(`div`,{className:`card`,children:[(0,B.jsx)(`h3`,{className:`card-cap`,children:`Run`}),(0,B.jsx)(`div`,{className:`env-grid`,children:r.map(e=>{let t=e.icon;return(0,B.jsxs)(`div`,{className:`env-item`,children:[(0,B.jsxs)(`span`,{className:`env-label`,children:[(0,B.jsx)(t,{size:12}),e.label]}),(0,B.jsx)(`strong`,{title:e.title,children:e.value||`—`})]},e.label)})}),n.length?(0,B.jsxs)(`div`,{className:`env-url-list`,children:[(0,B.jsxs)(`div`,{className:`section-label`,style:{marginTop:14},children:[(0,B.jsx)(At,{size:12}),` Sites visited`]}),(0,B.jsx)(`ul`,{children:n.map(e=>(0,B.jsx)(`li`,{children:e},e))})]}):null]})]})}var Jl=10,Yl=[{id:`newFailures`,title:`New failures`,note:`Passed last time, failing now`,icon:bi,tone:`fail`},{id:`notRun`,title:`Not run this time`,note:`Ran last time, stopped before starting now`,icon:it,tone:`warn`},{id:`stillFailing`,title:`Still failing`,note:`Failed both times`,icon:Ar,tone:`fail`},{id:`fixed`,title:`Fixed`,note:`Failed last time, passing now`,icon:Mi,tone:`pass`},{id:`slower`,title:`Slower`,note:`At least 5s and 25% slower`,icon:vi,tone:`warn`},{id:`faster`,title:`Faster`,note:`At least 5s and 25% faster`,icon:gi,tone:`pass`},{id:`added`,title:`New cases`,note:`Not in the previous run`,icon:Wn,tone:`brand`},{id:`removed`,title:`Dropped cases`,note:`In the previous run, not in this one`,icon:Bn,tone:`brand`}];function Xl(e,t){return`${e>0?`+`:e<0?`−`:``}${t(Math.abs(e))}`}function Zl(e){let t=[...e.history].sort((e,t)=>e.at.localeCompare(t.at)),n=t.map(e=>new Map(e.cases.map(e=>[e.id,e.status]))),r=new Map;for(let e of t[t.length-1]?.cases||[]){let t=0;for(let r=n.length-1;r>=0;r--){let i=n[r].get(e.id);if(i&&i!==`stopped`){if(!aa(i))break;t++}}r.set(e.id,t)}return r}function Ql({data:e,onOpenCase:t}){let n=(0,v.useMemo)(()=>Oa(e),[e]),r=(0,v.useMemo)(()=>Zl(e),[e]),i=(0,v.useMemo)(()=>new Map(e.cases.map(e=>[e.id,e.summary.split(`
36
36
  `)[0]])),[e]);if(!n){let t=e.kind!==`run`&&e.history.length<=1;return(0,B.jsxs)(`div`,{className:`failures chg`,children:[(0,B.jsx)(no,{title:`Since last run`,subtitle:`What changed compared with the previous suite run in this folder`}),(0,B.jsxs)(`div`,{className:`panel empty-state`,children:[(0,B.jsx)(on,{size:26}),(0,B.jsx)(`h3`,{children:e.kind===`run`?`Comparisons are for suites`:t?`This is the first run in this folder`:`No earlier run to compare with`}),(0,B.jsx)(`p`,{children:e.kind===`run`?`Run test cases with forgeqe suite, into the same folder each time, and this page lists what changed between runs.`:`Run the suite again into the same folder and this page lists new failures, fixes, cases that got slower or faster, and cases added or dropped.`})]})]})}let a=new Map(n.prev.cases.map(e=>[e.id,e])),o=n.cur.cases.filter(e=>e.status===`stopped`&&a.get(e.id)&&a.get(e.id).status!==`stopped`).map(e=>({...e,before:a.get(e.id)})),s={newFailures:n.newFailures,notRun:o,stillFailing:n.stillFailing,fixed:n.fixed,slower:n.slower,faster:n.faster,added:n.added,removed:n.removed.map(e=>({id:e.id,title:e.title,status:e.status,ms:e.ms,tokens:e.tokens}))},c=J(n.prev.passed,n.prev.total),l=J(n.cur.passed,n.cur.total),u=n.newFailures.length>n.fixed.length||l<c,d=n.fixed.length>n.newFailures.length||l>c,f=u&&!d?`Worse than`:d&&!u?`Better than`:`About the same as`,p=n.prev.ms?Math.round(100*n.ms/n.prev.ms):0,m=n.prev.tokens?Math.round(100*n.tokens/n.prev.tokens):0,h=n.cur.cost?.currency||n.prev.cost?.currency,g=!!(n.cur.cost&&n.prev.cost&&n.cur.cost.currency===n.prev.cost.currency),_=g?n.cur.cost.amount-n.prev.cost.amount:0,y=(e,t=4)=>lo(e.map(e=>e.id),t),b=Gi(n.prev.at),x=[];x.push(`${f} the last run. Pass rate ${c===l?`held at ${l}%`:`went from ${c}% to ${l}%`}: ${n.prev.passed.toLocaleString()} of ${n.prev.total.toLocaleString()} passed on ${b}, ${n.cur.passed.toLocaleString()} of ${n.cur.total.toLocaleString()} now.`),n.newFailures.length?x.push(`${X(n.newFailures.length,`case`)} broke since then (${y(n.newFailures,3)}). ${n.newFailures.length===1?`It`:`They`} passed on ${b}, so the cause is in what changed since.`):x.push(`Nothing new broke: every case that passed last time still passes.`);let S=[];n.fixed.length&&S.push(`${X(n.fixed.length,`case`)} fixed`),n.stillFailing.length&&S.push(`${X(n.stillFailing.length,`case`)} still failing`),o.length&&S.push(`${X(o.length,`case`)} that ran last time did not run now`),S.length&&x.push(`${S.join(`, `).replace(/^./,e=>e.toUpperCase())}.`);let C=[];C.push(`The run took ${V(Math.abs(n.ms))} ${n.ms>=0?`longer`:`less`} (${p>=0?`+`:`−`}${Math.abs(p)}%) and used ${n.tokens?`${H(Math.abs(n.tokens))} ${n.tokens>0?`more`:`fewer`} tokens (${m>=0?`+`:`−`}${Math.abs(m)}%)`:`the same tokens`}${g&&Math.abs(_)>=.005?`, costing ${W(Math.abs(_),h)} ${_>0?`more`:`less`}`:``}.${n.slower.length||n.faster.length?` ${n.slower.length.toLocaleString()} ${n.slower.length===1?`case`:`cases`} got slower and ${n.faster.length.toLocaleString()} faster by 5s and 25% or more.`:``}`),(n.added.length||n.removed.length)&&C.push(`The suite changed: ${X(n.added.length,`case`)} added, ${n.removed.length.toLocaleString()} dropped.`);let w=[];n.newFailures.length&&w.push({n:n.newFailures.length,text:(0,B.jsxs)(B.Fragment,{children:[`broke: `,y(n.newFailures),`.`]})}),o.length&&w.push({n:o.length,text:(0,B.jsxs)(B.Fragment,{children:[`did not run: `,y(o),`.`]})}),n.fixed.length&&w.push({n:n.fixed.length,text:(0,B.jsxs)(B.Fragment,{children:[`fixed: `,y(n.fixed),`.`]})}),n.stillFailing.length&&w.push({n:n.stillFailing.length,text:(0,B.jsx)(B.Fragment,{children:`still failing, known problems rather than new ones.`})});let T=n.slower[0];n.slower.length&&w.push({n:n.slower.length,text:(0,B.jsxs)(B.Fragment,{children:[`slower`,T?.before?(0,B.jsxs)(B.Fragment,{children:[`; the most, `,T.id,`, went from `,V(T.before.ms),` to `,V(T.ms)]}):null,`.`]})}),n.faster.length&&w.push({n:n.faster.length,text:(0,B.jsx)(B.Fragment,{children:`faster.`})}),n.added.length&&w.push({n:n.added.length,text:(0,B.jsx)(B.Fragment,{children:`joined the suite.`})}),n.removed.length&&w.push({n:n.removed.length,text:(0,B.jsx)(B.Fragment,{children:`left the suite.`})});let E=[{label:`Pass rate`,value:`${l}%`,sub:`was ${c}%`,icon:Jr,tone:l<c?`fail`:l>c?`pass`:void 0},{label:`New failures`,value:n.newFailures.length.toLocaleString(),sub:`passed last time`,icon:bi,tone:n.newFailures.length?`fail`:void 0},{label:`Fixed`,value:n.fixed.length.toLocaleString(),sub:`failed last time`,icon:Mi,tone:n.fixed.length?`pass`:void 0},{label:`Still failing`,value:n.stillFailing.length.toLocaleString(),sub:`failed both times`,icon:Ar},{label:`Slower`,value:n.slower.length.toLocaleString(),sub:`${n.faster.length.toLocaleString()} faster`,icon:vi,tone:n.slower.length>n.faster.length?`warn`:void 0},{label:`Run time`,value:Xl(n.ms,V),sub:`${V(n.cur.ms)}, was ${V(n.prev.ms)}`,icon:mi,tone:p>=10?`warn`:p<=-10?`pass`:void 0},g?{label:`Cost`,value:`${_>0?`+`:_<0?`−`:``}${W(Math.abs(_),h)}`,sub:`${W(n.cur.cost.amount,h)}, was ${W(n.prev.cost.amount,h)}`,icon:gt}:{label:`Tokens`,value:Xl(n.tokens,H),sub:`${H(n.cur.tokens)}, was ${H(n.prev.tokens)}`,icon:gt}],D=Yl.filter(e=>s[e.id].length),O=Yl.filter(e=>!s[e.id].length&&e.id!==`notRun`),k=q(n.prev.href);return(0,B.jsxs)(`div`,{className:`failures chg`,children:[(0,B.jsx)(no,{title:`Since last run`,subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsxs)(`span`,{children:[`Compared with the run of `,qi(n.prev.at)]}),(0,B.jsxs)(`span`,{children:[X(n.cur.total,`case`),` now, `,n.prev.total.toLocaleString(),` then`]})]}),actions:k?(0,B.jsxs)(`a`,{className:`btn`,href:k,children:[(0,B.jsx)(Mt,{size:14}),`Open previous report`]}):void 0}),(0,B.jsxs)(`section`,{className:`panel tn-brief`,"aria-labelledby":`chg-sum-h`,children:[(0,B.jsxs)(`div`,{className:`tn-brief-text`,children:[(0,B.jsxs)(`header`,{className:`panel-head`,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:(0,B.jsx)(z,{size:15})}),(0,B.jsx)(`h2`,{id:`chg-sum-h`,children:`Change summary`}),(0,B.jsx)(`span`,{className:`fl-note`,children:`written by ForgeQE from this run and the one before`})]}),x.map((e,t)=>(0,B.jsx)(`p`,{className:t?`fl-p`:`fl-p fl-lead`,children:e},t)),C.map((e,t)=>(0,B.jsx)(`p`,{className:`fl-p fl-dim`,children:e},t))]}),w.length?(0,B.jsxs)(`div`,{className:`tn-brief-side`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`What changed, most important first`}),(0,B.jsx)(`ol`,{className:`tn-changes chg-changes`,children:w.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`tn-when`,children:e.n.toLocaleString()}),(0,B.jsxs)(`span`,{children:[e.n===1?`case`:`cases`,` `,e.text]})]},t))})]}):null]}),(0,B.jsx)(ho,{items:E}),D.length?(0,B.jsx)(`div`,{className:`ov-grid tn-grid-top chg-grid`,children:D.map(e=>(0,B.jsx)($l,{s:e,rows:s[e.id],onOpenCase:t,streak:r,summaries:i},e.id))}):(0,B.jsx)(`div`,{className:`panel fl-none`,children:(0,B.jsx)(`span`,{children:`Every case had the same result as last time, and none got much slower or faster.`})}),D.length&&O.length?(0,B.jsxs)(`p`,{className:`ov-caption chg-quiet`,children:[`No changes: `,O.map(e=>e.title.toLowerCase()).join(`, `),`.`]}):null]})}function $l({s:e,rows:t,onOpenCase:n,streak:r,summaries:i}){let a=oo(t,Jl),o=e.id===`slower`||e.id===`faster`,s=e.id===`removed`;return(0,B.jsxs)(`section`,{className:`panel ov-flush tn-panel-box chg-sec`,"aria-labelledby":`chg-${e.id}-h`,children:[(0,B.jsx)(Y,{icon:e.icon,tone:e.tone,title:(0,B.jsx)(`span`,{id:`chg-${e.id}-h`,children:e.title}),note:`${X(t.length,`case`)} · ${e.note}`}),(0,B.jsx)(`ul`,{className:`chg-rows`,children:a.shown.map(t=>{let a=e.id===`newFailures`||e.id===`stillFailing`?i.get(t.id):void 0,c=r.get(t.id)||0;return(0,B.jsxs)(`li`,{className:`chg-row`,children:[(0,B.jsx)(na,{status:t.status,size:15}),(0,B.jsxs)(`span`,{className:`chg-case`,children:[(0,B.jsxs)(`span`,{className:`chg-name`,children:[s?(0,B.jsx)(`span`,{className:`chg-id`,children:t.id}):(0,B.jsx)(`button`,{type:`button`,className:`link-btn chg-id`,title:`Open ${t.id} in Test results`,onClick:()=>n(t.id),children:t.id}),(0,B.jsx)(`span`,{className:`chg-title`,title:t.title,children:t.title})]}),a?(0,B.jsx)(`span`,{className:`chg-note`,title:a,children:a}):null]}),(0,B.jsx)(`span`,{className:`chg-right`,children:o&&t.before?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`chg-times`,children:[V(t.before.ms),` → `,V(t.ms)]}),(0,B.jsx)(`span`,{className:`tn-tag ${t.ms>t.before.ms?`warn`:`pass`}`,children:Xl(t.ms-t.before.ms,V)})]}):s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`chg-was`,children:`was`}),(0,B.jsx)(ea,{status:t.status})]}):(0,B.jsxs)(B.Fragment,{children:[t.before?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ea,{status:t.before.status}),(0,B.jsx)(`span`,{className:`chg-arrow`,"aria-label":`then`,children:`→`})]}):null,(0,B.jsx)(ea,{status:t.status}),(0,B.jsx)(`span`,{className:`chg-ms`,children:e.id===`stillFailing`&&c>1?`failing ${c} runs`:t.status===`stopped`?`—`:V(t.ms)})]})})]},t.id)})}),(0,B.jsx)(`div`,{className:`tn-pager`,children:(0,B.jsx)(so,{...a,label:`${e.title} pages`})})]})}var eu=10,tu=10,nu=20,ru=5,iu=4;function au(e,t){let n=Array(t).fill(0);return[...e].sort((e,t)=>t.end-t.start-(e.end-e.start)).map(e=>{let r=0;for(let e=1;e<t;e++)n[e]<n[r]&&(r=e);let i=n[r];return n[r]+=e.end-e.start,{c:e.c,start:i,end:n[r],lane:r}}).sort((e,t)=>e.start-t.start||e.lane-t.lane)}function ou(e){let t=e.filter(e=>e.status!==`stopped`).map(e=>{let t=Date.parse(e.startedAt),n=Date.parse(e.finishedAt);return{c:e,start:t,end:Number.isFinite(n)&&n>=t?n:t+Math.max(0,e.ms||0)}}).filter(e=>Number.isFinite(e.start)&&Number.isFinite(e.end)).sort((e,t)=>e.start-t.start),n=[],r=t.map(e=>{let t=n.findIndex(t=>t<=e.start);return t<0?t=n.push(e.end)-1:n[t]=e.end,{...e,lane:t}}),i=t.length?t[0].start:0,a=Math.max(i,...t.map(e=>e.end));return{slots:r.map(e=>({c:e.c,start:e.start-i,end:e.end-i,lane:e.lane})),lanes:n.length,span:Math.max(1,a-i)}}var su=e=>e.goal||e.actions.map(e=>e.text).join(`; `)||`Step ${e.n}`,cu=e=>e===`passed`?`passed`:e===`error`?`error`:`failed`;function lu(e,t,n){let r=(e,n)=>({left:100*e/t,width:100*(n-e)/t});if(e.length<=nu)return e.map(e=>({key:e.c.id,id:e.c.id,title:e.c.title,sub:n>1?`worker ${e.lane+1}`:``,...r(e.start,e.end),tone:cu(e.c.status),failShare:0,dur:V(e.end-e.start),tip:`${e.c.id} ${e.c.title}: ${vo(e.start)} to ${vo(e.end)}, ${(Zi[e.c.status]||e.c.status).toLowerCase()}`}));let i=Math.ceil(e.length/nu),a=[];for(let t=0;t<e.length;t+=i){let n=e.slice(t,t+i),o=Math.min(...n.map(e=>e.start)),s=Math.max(...n.map(e=>e.end)),c=n.filter(e=>e.c.status!==`passed`).length,l=n.reduce((e,t)=>e+t.end-t.start,0),u=`Cases ${(t+1).toLocaleString()}–${(t+n.length).toLocaleString()}`;a.push({key:`b${t}`,title:u,sub:c?`${c.toLocaleString()} did not pass`:`all passed`,...r(o,s),tone:`group`,failShare:100*c/n.length,dur:V(s-o),tip:`${u}: ${vo(o)} to ${vo(s)}, ${V(l)} of test time${c?`, ${c.toLocaleString()} did not pass`:``}`})}return a}function uu({slots:e,span:t,lanes:n,untimed:r,onOpenCase:i}){let[a,o]=(0,v.useState)(`ran`),s=n>1?n:Math.min(iu,e.length),c=au(e,s),l=Math.max(1,...c.map(e=>e.end)),u=Math.max(...e.map(e=>e.end-e.start)),d=e.length>1&&l<t*.95,f=d?a:`ran`,p=f===`ran`?e:c,m=Math.max(t,l),h=lu(p,m,f===`ran`?n:s),g=h.length<p.length,_=yo.find(e=>m/e<=6)||yo[yo.length-1],y=[];for(let e=_;e<m-_*.6;e+=_)y.push(e);let b=J(e.reduce((e,t)=>e+t.end-t.start,0),t*n),x=f===`ran`?n>1?`${X(n,`worker`)} ran the cases side by side and were busy ${b}% of the run; the last case finished ${V(t)} after the first started.`:`Cases ran one after another, so the run took the sum of their times: ${V(t)}.`:n>1?`Starting the slowest cases first on the same ${X(n,`worker`)} would end the run in about ${V(l)}, ${V(t-l)} sooner. Cost stays the same.`:`Spread across ${s} workers, slowest first, the run would end in about ${V(l)}${l<=u?`, when the longest case does`:``}, saving ${V(t-l)}. Cost stays the same.`,S=[[`ran`,n>1?`As it ran`:`As it ran: one at a time`],[`whatif`,n>1?`What if: slowest first`:`What if: ${s} at a time`]];return(0,B.jsxs)(`section`,{className:`panel ov-s12 tc-sched`,"aria-labelledby":`tc-sched-h`,children:[(0,B.jsxs)(`div`,{className:`tc-head`,children:[(0,B.jsxs)(`header`,{className:`panel-head`,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:(0,B.jsx)(Be,{size:15})}),(0,B.jsx)(`h2`,{id:`tc-sched-h`,children:`When each case ran`})]}),d?(0,B.jsx)(`span`,{className:`fl-seg`,role:`group`,"aria-label":`Schedule`,children:S.map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":f===e,className:f===e?`active`:void 0,onClick:()=>o(e),children:t},e))}):null]}),(0,B.jsxs)(`p`,{className:`tc-text`,children:[x,r?` ${X(r,`case`)} had no start time and ${r===1?`is`:`are`} not shown.`:``]}),(0,B.jsxs)(`div`,{className:`tc-gantt`,children:[h.map(e=>(0,B.jsxs)(`div`,{className:`tc-row`,children:[(0,B.jsxs)(`span`,{className:`tc-name`,title:e.id?`${e.id} ${e.title}`:e.tip,children:[e.id?(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>i(e.id),children:e.id}):null,(0,B.jsx)(`span`,{className:`tc-name-text`,children:e.title}),e.sub?(0,B.jsx)(`span`,{className:`tc-lane`,children:e.sub}):null]}),(0,B.jsx)(`span`,{className:`tc-track`,children:(0,B.jsx)(`span`,{className:`tc-bar ${e.tone}`,style:{left:`${e.left}%`,width:`${e.width}%`},title:e.tip,children:e.failShare?(0,B.jsx)(`i`,{style:{width:`${Math.max(4,e.failShare)}%`}}):null})}),(0,B.jsx)(`span`,{className:`tc-dur`,children:e.dur})]},e.key)),(0,B.jsxs)(`div`,{className:`tc-row tc-axis-row`,"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{className:`tc-pad`}),(0,B.jsxs)(`span`,{className:`tc-axis`,children:[(0,B.jsx)(`span`,{style:{left:0},children:`0:00`}),y.map(e=>(0,B.jsx)(`span`,{className:`tc-tick`,style:{left:`${100*e/m}%`},children:vo(e)},e)),(0,B.jsx)(`span`,{className:`end`,children:vo(m)})]}),(0,B.jsx)(`span`,{className:`tc-pad`})]})]}),(0,B.jsxs)(`div`,{className:`tc-legend`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`tc-key passed`}),`Passed`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`tc-key failed`}),`Failed`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`tc-key error`}),`Could not run`]}),g?(0,B.jsxs)(`span`,{className:`tc-legend-note`,children:[X(p.length,`case`),` in blocks of `,Math.ceil(p.length/nu),`, in the order they started; red is the share that did not pass. Hover a block for its times.`]}):null]})]})}function du({ran:e,priced:t,wide:n,onOpenCase:r}){let[i,a]=(0,v.useState)(`time`),[o,s]=(0,v.useState)(``),c=o.trim().toLowerCase(),l=e=>t?e.cost?.amount||0:e.tokens,u=e.filter(e=>!c||`${e.id} ${e.title}`.toLowerCase().includes(c)).sort(i===`time`?(e,t)=>t.ms-e.ms:(e,t)=>l(t)-l(e)||t.ms-e.ms),d=oo(u,eu),f=Math.max(1,...e.map(e=>e.ms)),p=Math.max(1e-9,...e.map(e=>e.cost?.amount||0));return(0,B.jsxs)(`section`,{className:`panel ${n?`ov-s12`:`ov-s7`} tc-cases`,"aria-labelledby":`tc-cases-h`,children:[(0,B.jsxs)(`div`,{className:`tc-head`,children:[(0,B.jsxs)(`header`,{className:`panel-head`,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:(0,B.jsx)(Ie,{size:15})}),(0,B.jsx)(`h2`,{id:`tc-cases-h`,children:`Time and cost by case`})]}),(0,B.jsx)(`span`,{className:`fl-seg`,role:`group`,"aria-label":`Sort by`,children:[[`time`,`Slowest first`],[`cost`,t?`Costliest first`:`Most tokens first`]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":i===e,className:i===e?`active`:void 0,onClick:()=>{a(e),d.setPage(0)},children:t},e))})]}),e.length>eu?(0,B.jsxs)(`div`,{className:`tc-tools`,children:[(0,B.jsxs)(`label`,{className:`table-search`,children:[(0,B.jsx)(Rr,{size:15}),(0,B.jsx)(`input`,{type:`search`,value:o,placeholder:`Search cases`,"aria-label":`Search cases`,onChange:e=>{s(e.target.value),d.setPage(0)}})]}),(0,B.jsx)(`span`,{className:`fl-note`,children:c?`${u.length.toLocaleString()} of ${X(e.length,`case`)}`:`${X(e.length,`case`)} that ran`})]}):null,(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data tc-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`Case`}),(0,B.jsx)(`th`,{scope:`col`,className:`tc-col-bar`,children:`Time`}),t?(0,B.jsx)(`th`,{scope:`col`,className:`tc-col-bar`,children:`Cost`}):null,(0,B.jsx)(`th`,{scope:`col`,className:`tc-num tc-col-tok`,children:`Tokens`})]})}),(0,B.jsx)(`tbody`,{children:d.shown.map(e=>{let n=ka(e);return(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsxs)(`span`,{className:`tc-case`,title:`${e.id} ${e.title}: ${Zi[e.status]||e.status}`,children:[(0,B.jsx)(na,{status:e.status,size:13}),(0,B.jsxs)(`span`,{className:`tc-case-name`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link-btn tc-case-link`,onClick:()=>r(e.id),children:(0,B.jsx)(`span`,{children:e.title})}),` `,(0,B.jsx)(`span`,{className:`tc-case-id`,children:e.id})]})]})}),(0,B.jsx)(`td`,{children:(0,B.jsxs)(`span`,{className:`tc-meter`,children:[(0,B.jsx)(`span`,{className:`tc-meter-track`,children:(0,B.jsx)(`span`,{className:`split-bar`,style:{width:`${Math.max(2,100*e.ms/f)}%`},title:n.total?`model ${V(n.model)}, browser ${V(n.browser)}, page memory ${V(n.memory)}`:void 0,children:n.total?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`i`,{className:`model`,style:{flexGrow:n.model}}),(0,B.jsx)(`i`,{className:`browser`,style:{flexGrow:n.browser}}),(0,B.jsx)(`i`,{className:`memory`,style:{flexGrow:n.memory}})]}):(0,B.jsx)(`i`,{className:`tc-plain`,style:{flexGrow:1}})})}),(0,B.jsx)(`b`,{children:V(e.ms)})]})}),t?(0,B.jsx)(`td`,{title:K(e.cost),children:(0,B.jsxs)(`span`,{className:`tc-meter`,children:[(0,B.jsx)(`span`,{className:`tc-meter-track`,children:(0,B.jsx)(`span`,{className:`tc-fill`,style:{width:`${Math.max(2,100*(e.cost?.amount||0)/p)}%`}})}),(0,B.jsx)(`b`,{children:G(e.cost)})]})}):null,(0,B.jsx)(`td`,{className:`tc-num tc-col-tok`,title:e.usage?`${H(e.usage.input)} in, ${H(e.usage.output)} out`:void 0,children:H(e.tokens)})]},e.id)})})]})}),u.length?null:(0,B.jsxs)(`p`,{className:`hint-text tc-pad-x`,children:[`No case matches “`,o,`”.`]}),(0,B.jsx)(`div`,{className:`tc-pad-x`,children:(0,B.jsx)(so,{...d,label:`Cases pages`})})]})}function fu({ran:e,single:t,wide:n,onOpenCase:r}){let i=e.map(e=>ka(e)),a=i.reduce((e,t)=>e+t.model,0),o=i.reduce((e,t)=>e+t.browser,0),s=i.reduce((e,t)=>e+t.memory,0),c=a+o+s,l=e.flatMap(e=>e.timeline.filter(e=>e.ms).map(t=>({c:e,t}))).sort((e,t)=>(t.t.ms||0)-(e.t.ms||0)).slice(0,ru);if(!c&&!l.length)return null;let u=Math.max(1,...l.map(e=>e.t.ms||0)),d=[[`model`,`Model deciding`,a],[`browser`,`Acting in the browser`,o],[`memory`,`Replayed from page memory`,s]];return(0,B.jsxs)(`section`,{className:`panel ${n?`ov-s12`:`ov-s5`} tc-where`,children:[(0,B.jsx)(Y,{icon:mi,tone:`brand`,title:`Where the time went`,note:c?`${V(c)} of browser steps`:void 0}),c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`split-bar tc-split`,role:`img`,"aria-label":co(d.filter(([,,e])=>e).map(([,e,t])=>`${e} ${V(t)}`)),children:d.map(([e,,t])=>t?(0,B.jsx)(`i`,{className:e,style:{flexGrow:t}},e):null)}),(0,B.jsx)(`div`,{className:`tc-parts`,children:d.filter(([,,e])=>e).map(([e,t,n])=>(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{className:`sw ${e}`}),(0,B.jsx)(`span`,{className:`tc-grow`,children:t}),(0,B.jsx)(`b`,{children:V(n)}),(0,B.jsxs)(`em`,{children:[J(n,c),`%`]})]},e))})]}):null,l.length?(0,B.jsxs)(`div`,{className:`tc-slow`,children:[(0,B.jsx)(`span`,{className:`fl-label`,children:`Slowest steps in the run`}),l.map(({c:e,t:n})=>{let i=n.actions.find(e=>!e.ok),a=i?`Failed: ${i.error||i.text}`:n.source===`memory`?`Replayed from page memory`:n.model_ms&&n.ms&&n.model_ms>n.ms/2?`${V(n.model_ms)} of it waiting for the model`:``;return(0,B.jsxs)(`div`,{className:`tc-slow-item`,children:[(0,B.jsxs)(`div`,{className:`tc-slow-top`,children:[(0,B.jsx)(`span`,{className:`tc-slow-name`,title:su(n),children:su(n)}),(0,B.jsx)(`b`,{children:V(n.ms)})]}),(0,B.jsx)(`span`,{className:`tc-slow-case`,children:t?`Step ${n.n}`:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>r(e.id),children:e.id}),`, step `,n.n]})}),(0,B.jsx)(`span`,{className:`tc-slow-bar${i?` fail`:``}`,style:{width:`${Math.max(2,100*(n.ms||0)/u)}%`}}),a?(0,B.jsx)(`span`,{className:`tc-slow-note${i?` fail`:``}`,title:a,children:a}):null]},`${e.id}#${n.n}`)})]}):null]})}function pu({cases:e,onOpenCase:t}){let n=Aa(e),r=e.filter(e=>e.memory),i=oo(r,tu);return(0,B.jsxs)(`section`,{className:`panel ov-s12 tc-memory`,children:[(0,B.jsx)(Y,{icon:Ii,tone:`brand`,title:`Page memory`,note:`${X(n.replayed,`step`)} replayed without the model in ${X(r.length,`case`)}${n.rows.length?`, saving ${H(n.tokens)} tokens and ${V(n.ms)}`:``}`}),(0,B.jsx)(`div`,{className:`table-wrap`,children:(0,B.jsxs)(`table`,{className:`data tc-table tc-mem`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`Case`}),(0,B.jsx)(`th`,{scope:`col`,className:`tc-num`,children:`Replayed`}),(0,B.jsx)(`th`,{scope:`col`,className:`tc-num`,children:`Agent steps`}),(0,B.jsx)(`th`,{scope:`col`,children:`Saved`}),(0,B.jsx)(`th`,{scope:`col`,children:`Notes`})]})}),(0,B.jsx)(`tbody`,{children:i.shown.map(e=>{let r=e.memory,i=n.rows.find(t=>t.c.id===e.id),a=r.repaired?`Repaired at step ${r.repaired.step}`:r.stopped?`Handed over: ${r.stopped}`:r.heals?.length?U(r.heals.length,`healed locator`):``;return(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsxs)(`span`,{className:`tc-case`,title:`${e.id} ${e.title}`,children:[(0,B.jsx)(na,{status:e.status,size:13}),(0,B.jsxs)(`span`,{className:`tc-case-name`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link-btn tc-case-link`,onClick:()=>t(e.id),children:(0,B.jsx)(`span`,{children:e.title})}),` `,(0,B.jsx)(`span`,{className:`tc-case-id`,children:e.id})]})]})}),(0,B.jsx)(`td`,{className:`tc-num`,children:r.replayTotal?`${r.replayed}/${r.replayTotal}`:`—`}),(0,B.jsx)(`td`,{className:`tc-num`,children:r.agentSteps}),(0,B.jsx)(`td`,{children:i?`${H(i.tokens)} tokens, ${V(i.ms)}`:(0,B.jsx)(`span`,{className:`dim`,children:`—`})}),(0,B.jsx)(`td`,{children:a?(0,B.jsx)(`span`,{className:`tc-clamp`,title:a,children:a}):(0,B.jsx)(`span`,{className:`dim`,children:`—`})})]},e.id)})})]})}),(0,B.jsx)(`div`,{className:`tc-pad-x`,children:(0,B.jsx)(so,{...i,label:`Page memory pages`})})]})}function mu({data:e,onOpenCase:t}){let n=e.cases.filter(e=>e.status!==`stopped`),r=e.cases.length-n.length,i=(0,B.jsx)(no,{title:`Time and cost`,subtitle:(0,B.jsxs)(`span`,{className:`ov-meta`,children:[(0,B.jsxs)(`span`,{children:[`This run, `,X(n.length,`case`),r?`, ${r.toLocaleString()} not run`:``]}),e.id?(0,B.jsxs)(`span`,{children:[`Run `,(0,B.jsx)(`code`,{children:e.id})]}):null,e.env?.model?(0,B.jsxs)(`span`,{children:[`Model `,(0,B.jsx)(`code`,{children:e.env.model})]}):null]})});if(!n.length)return(0,B.jsxs)(`div`,{className:`tc`,children:[i,(0,B.jsxs)(`div`,{className:`panel empty-state`,children:[(0,B.jsx)($t,{size:26}),(0,B.jsx)(`h3`,{children:`No tests ran`})]})]});let a=wa(n),o=!!a,s=n.reduce((e,t)=>e+t.ms,0),c=n.reduce((e,t)=>e+t.tokens,0),l=n.reduce((e,t)=>e+(t.usage?.input||0),0),u=n.reduce((e,t)=>e+(t.usage?.output||0),0),d=n.filter(e=>e.status===`passed`),f=n.filter(e=>aa(e.status)),p=f.reduce((e,t)=>e+t.ms,0),m=f.reduce((e,t)=>e+(t.cost?.amount||0),0),h=Aa(n),g=n.filter(e=>e.memory),{slots:_,lanes:y,span:b}=ou(e.cases),x=n.length-_.length,S=y>1?y:Math.min(iu,_.length),C=_.length>1?Math.max(...au(_,S).map(e=>e.end)):b,w=_.length>1&&C<b*.95,T=J(_.reduce((e,t)=>e+t.end-t.start,0),b*Math.max(1,y)),E=n.map(e=>ka(e)),D=E.reduce((e,t)=>e+t.model,0),O=E.reduce((e,t)=>e+t.browser,0),k=E.reduce((e,t)=>e+t.memory,0),A=D+O+k,j=n.flatMap(e=>e.timeline.filter(e=>e.ms)).sort((e,t)=>(t.ms||0)-(e.ms||0)).slice(0,ru),M=j.filter(e=>e.actions.some(e=>!e.ok)).length,N=[...n].sort((e,t)=>t.ms-e.ms),P=[...n].sort((e,t)=>(t.cost?.amount||0)-(e.cost?.amount||0)),F=(e,t,n)=>n?J(e.slice(0,10).reduce((e,n)=>e+t(n),0),n):0,ee=fa(e.history),te=ee.length>1?ee[ee.length-2]:void 0,I=e=>W(e,a?.currency),ne=[],re=[],L=(e,t)=>e.push((0,B.jsx)(v.Fragment,{children:t},e.length));if(L(ne,(0,B.jsxs)(B.Fragment,{children:[`The run took `,(0,B.jsx)(`strong`,{children:V(e.ms)}),y>1?` on ${X(y,`worker`)}`:``,` for `,X(n.length,`case`),n.length>1?` (${V(Math.round(s/n.length))} each on average)`:``,a?(0,B.jsxs)(B.Fragment,{children:[` `,`and cost `,(0,B.jsx)(`strong`,{children:G(a)})]}):null,c?` in ${H(c)} tokens`:``,`.`]})),w&&y<=1?L(ne,(0,B.jsxs)(B.Fragment,{children:[` `,`Cases ran one after another; running `,S,` at a time would finish in about `,(0,B.jsx)(`strong`,{children:V(C)}),C<=Math.max(...n.map(e=>e.ms))?`, set by the longest case`:``,`.`]})):w&&L(ne,(0,B.jsxs)(B.Fragment,{children:[` `,`The workers were busy `,T,`% of the run; starting the slowest cases first would finish in about `,(0,B.jsx)(`strong`,{children:V(C)}),`.`]})),A&&D){let e=J(D,A);L(ne,(0,B.jsxs)(B.Fragment,{children:[` `,e,`% of the browser steps' time was the model deciding what to do`,e>40?`, more than the browser itself: page memory or a faster model would help most`:``,`.`]}))}if(f.length&&L(re,(0,B.jsxs)(B.Fragment,{children:[`The `,f.length===1?`case that did not pass`:`${f.length.toLocaleString()} cases that did not pass`,` took `,V(p),o&&m?` and ${I(m)}`:``,`, `,J(p,s),`% of test time, and bought no pass.`,` `]})),M&&L(re,(0,B.jsxs)(B.Fragment,{children:[M===j.length?`All ${j.length}`:`${M} of the ${j.length}`,` slowest steps had an action that failed. `]})),n.length>10&&L(re,(0,B.jsxs)(B.Fragment,{children:[`The 10 slowest cases take `,F(N,e=>e.ms,s),`% of test time`,a?`, the 10 costliest ${F(P,e=>e.cost?.amount||0,a.amount)}% of the cost`:``,`.`,` `]})),h.replayed?L(re,(0,B.jsxs)(B.Fragment,{children:[`Page memory replayed `,X(h.replayed,`step`),` without the model`,h.rows.length?`, saving ${H(h.tokens)} tokens and ${V(h.ms)} against those cases' last full runs`:``,h.heals?`; ${U(h.heals,`locator`)} healed on the way`:``,`.`,` `]})):n.length>5&&L(re,(0,B.jsx)(B.Fragment,{children:`Page memory is off; turning it on replays steps that worked before without the model, which cuts time and tokens on repeat runs. `})),te){let t=e.ms-te.ms,n=q(te.href),r=`the run on ${Gi(te.at)}`;L(re,(0,B.jsxs)(B.Fragment,{children:[`Against `,n?(0,B.jsx)(`a`,{href:n,children:r}):r,`, this run was `,Math.abs(t)<1e3?`about as long`:t>0?`${V(t)} slower`:`${V(-t)} faster`,te.cost&&a?Math.abs(a.amount-te.cost.amount)<.01?` at about the same cost`:`, with cost ${a.amount>=te.cost.amount?`up`:`down`} ${W(Math.abs(a.amount-te.cost.amount),a.currency)}`:``,`.`]}))}let ie=[{label:`Run time`,value:V(e.ms),sub:w?y>1?`about ${V(C)} slowest first`:`about ${V(C)} with ${S} workers`:y>1?`${X(y,`worker`)}, ${V(s)} of tests`:n.length>1?`${V(Math.round(s/n.length))} per case`:X(n[0].timeline.length||n[0].agentSteps?.length||0,`browser step`),icon:ft},...a?[{label:`Cost`,value:G(a),sub:a.cachedAtFullRate?`upper bound`:a.estimate?`estimate`:a.note?`at list price`:`model spend`,icon:to(a.currency),title:K(a)}]:[],...c?[{label:`Tokens`,value:H(c),sub:l+u?`${Math.round(J(l,l+u))}% input`:`browser and code`,icon:wt}]:[],...a&&d.length?[{label:`Per passing case`,value:I(a.amount/d.length),sub:`${X(d.length,`case`)} passed`,icon:Qe}]:[],...f.length?[{label:o?`Spent on failures`:`Time on failures`,value:o?I(m):V(p),sub:o?`${V(p)} that bought no pass`:`${J(p,s)}% of test time`,icon:bi,tone:`fail`}]:[],...h.rows.length?[{label:`Memory saved`,value:V(h.ms),sub:`${H(h.tokens)} tokens`,icon:Ii,tone:`pass`}]:[]];return(0,B.jsxs)(`div`,{className:`tc`,children:[i,(0,B.jsxs)(`section`,{className:`panel tc-brief`,"aria-labelledby":`tc-brief-h`,children:[(0,B.jsxs)(`div`,{className:`tc-brief-text`,children:[(0,B.jsxs)(`header`,{className:`panel-head`,children:[(0,B.jsx)(`span`,{className:`ph-icon brand`,children:(0,B.jsx)(z,{size:15})}),(0,B.jsx)(`h2`,{id:`tc-brief-h`,children:`Time and cost summary`}),(0,B.jsx)(`span`,{className:`fl-note`,children:`written by ForgeQE from this run`})]}),(0,B.jsx)(`p`,{className:`fl-p`,children:ne}),re.length?(0,B.jsx)(`p`,{className:`fl-p fl-dim`,children:re}):null]}),(0,B.jsx)(ho,{items:ie})]}),(0,B.jsxs)(`div`,{className:`ov-grid tc-grid`,children:[_.length>1?(0,B.jsx)(uu,{slots:_,span:b,lanes:y,untimed:x,onOpenCase:t}):null,n.length>1?(0,B.jsx)(du,{ran:n,priced:o,wide:!A&&!j.length,onOpenCase:t}):null,(0,B.jsx)(fu,{ran:n,single:n.length===1,wide:n.length===1,onOpenCase:t}),g.length?(0,B.jsx)(pu,{cases:n,onOpenCase:t}):null]})]})}var hu={pass:{short:`Assured`,long:`Assured this run`,tone:`pass`},fail:{short:`Failing`,long:`Tested, failing`,tone:`fail`},partial:{short:`Not fully run`,long:`Tested, not fully run`,tone:`warn`}},gu={pass:`passed`,fail:`failed`,partial:`not_run`},_u=/^(smoke|critical|p0|p1|blocker|sanity)$/i,vu=6,yu=24,bu=8,xu=6,Su=12,Cu=e=>e.group||`${Xi(e.source)} (no group)`,wu=e=>e.length>3?`${e.slice(0,3).join(`, `)} or another`:e.length>1?`${e.slice(0,-1).join(`, `)} or ${e[e.length-1]}`:e.join(``),Tu=e=>e.split(`
37
37
  `)[0].replace(/^Step \d+ failed: /,``);function Eu(e){let t=new Map;for(let n of e)for(let e of new Set(n.requirements||[]))t.set(e,[...t.get(e)||[],n]);return[...t.entries()].map(([e,t])=>{let n=[...t].sort((e,t)=>Number(aa(t.status))-Number(aa(e.status))||Number(t.status!==`passed`)-Number(e.status!==`passed`)),r=n.filter(e=>e.status===`passed`).length,i=n.filter(e=>aa(e.status)).length,a=new Map;for(let e of n)a.set(Cu(e),(a.get(Cu(e))||0)+1);let o=[...a.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))[0][0],s=[...new Set(n.flatMap(e=>(e.tags||[]).filter(e=>_u.test(e))))].sort();return{name:e,area:o,members:n,passed:r,bad:i,stopped:n.length-r-i,total:n.length,state:i?`fail`:r===n.length?`pass`:`partial`,keyTags:s}}).sort((e,t)=>t.bad-e.bad||J(e.passed,e.total)-J(t.passed,t.total)||e.name.localeCompare(t.name,void 0,{numeric:!0}))}function Du(e){let t=e=>e.state===`fail`?0:e.state===`partial`?1:2;return e.filter(e=>e.state!==`pass`||e.total===1).sort((e,n)=>t(e)-t(n)||Number(!!n.keyTags.length)-Number(!!e.keyTags.length)||n.bad-e.bad||n.stopped-e.stopped||e.name.localeCompare(n.name,void 0,{numeric:!0}))}function Ou(e){return`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`).replace(/\r?\n/g,` `)}"`}function ku(e){let t=[[`Requirement`,`Area`,`Requirement state`,`Test`,`Title`,`Source`,`Result`]];for(let n of e)for(let e of n.members)t.push([n.name,n.area,hu[n.state].short,e.id,e.title,Xi(e.source),Zi[e.status]||e.status]);return t.map(e=>e.map(Ou).join(`,`)).join(`\r
38
38
  `)+`\r