@capagents/forgeqe 3.4.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +11 -2
- package/dist/forgeqe.js +1978 -1977
- package/dist/template.html +43 -43
- package/dist/web/assets/{3d-force-graph-B-g_aIro.js → 3d-force-graph-ChNz5Yhx.js} +1 -1
- package/dist/web/assets/{Agent-FGPuvhc5.js → Agent-CTRFDu9M.js} +10 -10
- package/dist/web/assets/{AgentWork-CFw0XcKd.js → AgentWork-D1c_w9rM.js} +1 -1
- package/dist/web/assets/ApiTests-CHKwMgxN.js +17 -0
- package/dist/web/assets/{Browse-DLECqaFU.js → Browse-CcKh43L5.js} +1 -1
- package/dist/web/assets/Chat-CooI13qi.js +3 -0
- package/dist/web/assets/CommandPalette-D8AtIocY.js +1 -0
- package/dist/web/assets/{Compare-BFDv-NmH.js → Compare-DPX2G5oF.js} +1 -1
- package/dist/web/assets/Cost-CBGk_xKN.js +1 -0
- package/dist/web/assets/{Data-BuIpjLOr.js → Data-CW95KX9u.js} +4 -4
- package/dist/web/assets/Desktop-C6-h0ExO.js +1 -0
- package/dist/web/assets/DesktopReview-C02n70Wx.js +2 -0
- package/dist/web/assets/DeviceScreen-DDERg3YQ.js +1 -0
- package/dist/web/assets/Evidence-DqTx1TS1.js +1 -0
- package/dist/web/assets/{Explore-AAssIdGu.js → Explore-DgaugrDO.js} +2 -2
- package/dist/web/assets/Features-DYr-izEt.js +1 -0
- package/dist/web/assets/{Flags-DRXJnHt4.js → Flags-DL-G7YWK.js} +2 -2
- package/dist/web/assets/Flaky-DOxneo4i.js +1 -0
- package/dist/web/assets/Impact-BuHHY2_3.js +3 -0
- package/dist/web/assets/{Jobs-BsP-lQnC.js → Jobs-DEc49gwq.js} +3 -3
- package/dist/web/assets/{KindPage-jQ0mJt7b.js → KindPage-DuLav-l5.js} +3 -3
- package/dist/web/assets/LiveDevice-PsN5gnXw.js +1 -0
- package/dist/web/assets/Migration-BcxL5Okw.js +8 -0
- package/dist/web/assets/Mobile-CBDmyoL5.js +1 -0
- package/dist/web/assets/Observability-Cqjko62E.js +1 -0
- package/dist/web/assets/{OwnItems-DRV4_VbL.js → OwnItems-DXS-CMiC.js} +3 -3
- package/dist/web/assets/PageAgent-BzDuRR-t.js +1 -0
- package/dist/web/assets/Product-BKIKhNp3.js +6 -0
- package/dist/web/assets/Production-DKKynWrp.js +1 -0
- package/dist/web/assets/Quality-Dsh07yXp.js +1 -0
- package/dist/web/assets/Readiness-BbjzvgVB.js +1 -0
- package/dist/web/assets/Record-BIa-SPuU.js +1 -0
- package/dist/web/assets/Regression-DeQnXoZ4.js +5 -0
- package/dist/web/assets/RelationGraph-C7M_Zcx-.js +1 -0
- package/dist/web/assets/Reports-DsWA9Q7H.js +2 -0
- package/dist/web/assets/{Requirements-CsfwSrgh.js → Requirements-B-8D5JFY.js} +2 -2
- package/dist/web/assets/Responsive-Dl4CLUoF.js +3 -0
- package/dist/web/assets/RunDiff-C2knd045.js +1 -0
- package/dist/web/assets/Settings-Cmac0LZa.js +21 -0
- package/dist/web/assets/SiteScan-D2WMUVcw.js +5 -0
- package/dist/web/assets/Steps-DeZhIdc1.js +2 -0
- package/dist/web/assets/{TestData-Jwowbnv2.js → TestData-CDOvUmVT.js} +2 -2
- package/dist/web/assets/TestManagement-9CTQonHe.js +4 -0
- package/dist/web/assets/WhatsNew-BotUU9UF.js +1 -0
- package/dist/web/assets/{agentSettingsSheet-DxBRwlvu.js → agentSettingsSheet-BEVtvrGk.js} +1 -1
- package/dist/web/assets/answer-BCM85AEe.js +99 -0
- package/dist/web/assets/api-DS8XP38R.js +1 -0
- package/dist/web/assets/{dataParts-DvgtfSmo.js → dataParts-C5w2uvJZ.js} +3 -3
- package/dist/web/assets/desktopAppPath-BN4vYVi4.js +1 -0
- package/dist/web/assets/{flowTheme-BcMJKyow.js → flowTheme-dXvSLQHO.js} +1 -1
- package/dist/web/assets/frame-BANehQdX.js +139 -0
- package/dist/web/assets/index-Db_tsLSf.js +47 -0
- package/dist/web/assets/index-iQkL5bWO.css +2 -0
- package/dist/web/assets/{nav-DRpijFeN.js → nav-f8SqayfG.js} +1 -1
- package/dist/web/assets/{pageBack-CINGjBHZ.js → pageBack-DU3mApVL.js} +7 -7
- package/dist/web/assets/palette-D8aKJo_q.js +1 -0
- package/dist/web/assets/{paletteCommands-Bx61jZay.js → paletteCommands-DdFd3e0-.js} +1 -1
- package/dist/web/assets/parts-B0PK7ewd.js +1 -0
- package/dist/web/assets/{productParts-tf1w_F1S.js → productParts-bcAIT4Ca.js} +1 -1
- package/dist/web/assets/qualityParts-C2Y38oFp.js +3 -0
- package/dist/web/assets/{recordTest-S5MOLSrL.js → recordTest-Cn4qoyRB.js} +1 -1
- package/dist/web/assets/sectionList-B6NF3ZMb.js +1 -0
- package/dist/web/assets/{stepper-B7sbuU1Q.js → stepper-CEFz82T4.js} +1 -1
- package/dist/web/assets/{preload-helper-BupTYkQW.js → surface-c1kG1KPS.js} +1 -1
- package/dist/web/assets/wizardParts-CGHmp8or.js +1 -0
- package/dist/web/index.html +9 -9
- package/docs/WEB_APP.md +12 -2
- package/forgeqe.example.yaml +4 -2
- package/package.json +1 -1
- package/dist/web/assets/ApiTests-D5rqD6gA.js +0 -17
- package/dist/web/assets/Chat-DS4jyAH3.js +0 -3
- package/dist/web/assets/CommandPalette-x_RA-vYW.js +0 -1
- package/dist/web/assets/Cost-_h1bxSj0.js +0 -1
- package/dist/web/assets/Desktop-F-PyYzC0.js +0 -1
- package/dist/web/assets/DesktopReview-CODdFSMN.js +0 -2
- package/dist/web/assets/DeviceScreen-BHmTd9Q-.js +0 -1
- package/dist/web/assets/Evidence-BXr78jgr.js +0 -1
- package/dist/web/assets/Features-Ce2hYdNS.js +0 -1
- package/dist/web/assets/Flaky-BGUyv4_b.js +0 -1
- package/dist/web/assets/Impact-B6F9nuZt.js +0 -3
- package/dist/web/assets/LiveDevice-C0OpjAg0.js +0 -1
- package/dist/web/assets/Migration-yiY2-7f3.js +0 -8
- package/dist/web/assets/Mobile-DcL2FOJg.js +0 -1
- package/dist/web/assets/Observability-BdpwjRNO.js +0 -1
- package/dist/web/assets/PageAgent-C_DrJ3kc.js +0 -1
- package/dist/web/assets/Product-BoLtQxi6.js +0 -6
- package/dist/web/assets/Production-DgMWWNd_.js +0 -1
- package/dist/web/assets/Quality-Dfh-gpB-.js +0 -1
- package/dist/web/assets/Readiness-BzlzH-RQ.js +0 -1
- package/dist/web/assets/Record-BpL7Br8t.js +0 -1
- package/dist/web/assets/Regression-VL1J4PQB.js +0 -5
- package/dist/web/assets/RelationGraph-CrEnF6ZB.js +0 -1
- package/dist/web/assets/Reports-CzJULGPA.js +0 -2
- package/dist/web/assets/Responsive-GfKHZLev.js +0 -3
- package/dist/web/assets/RunDiff-DZw8Jja0.js +0 -1
- package/dist/web/assets/Settings-CiMIX_QR.js +0 -21
- package/dist/web/assets/SiteScan-Cydt89Ja.js +0 -5
- package/dist/web/assets/Steps-BoyXqIqo.js +0 -2
- package/dist/web/assets/TestManagement-BPx01M_H.js +0 -4
- package/dist/web/assets/WhatsNew-DAtb7FTn.js +0 -1
- package/dist/web/assets/api-B8AQ8-Gb.js +0 -1
- package/dist/web/assets/desktopAppPath-Mg0cuo3X.js +0 -1
- package/dist/web/assets/frame-Z5TaJY7O.js +0 -23
- package/dist/web/assets/index-BEY6ZWQm.css +0 -2
- package/dist/web/assets/index-nbjwmmih.js +0 -47
- package/dist/web/assets/palette-DOQemIAv.js +0 -1
- package/dist/web/assets/parts-BNAiSyF0.js +0 -1
- package/dist/web/assets/qualityParts-O56nH8FQ.js +0 -3
- package/dist/web/assets/sectionList-BPBmSZXk.js +0 -1
- package/dist/web/assets/wizardParts-OhFd_xL2.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{I as a}from"./palette-D8aKJo_q.js";import{b as ee,v as o}from"./api-DS8XP38R.js";import{A as s,F as c,I as l,L as u,T as d,g as f,n as p,o as m}from"./pageBack-DU3mApVL.js";import{Er as h,F as g,Gr as _,N as v,P as y,Un as b,ct as te,o as ne,vn as x,z as S,zn as C}from"./line-icons-Cwj9OmCz.js";import{At as w,Z as T,rt as E,s as D,t as O}from"./frame-BANehQdX.js";import{B as k,V as A,z as j}from"./index-Db_tsLSf.js";import{d as re}from"./qualityParts-C2Y38oFp.js";var M=e(t(),1),N={view:(e=!1)=>o(`GET`,`/api/production${e?`?refresh=1`:``}`)},P=i(),F={sentry:`Sentry`,datadog:`Datadog`,appinsights:`App Insights`},I={fatal:{label:`Fatal`,tone:`text-fail`},error:{label:`Error`,tone:`text-fail`},warning:{label:`Warning`,tone:`text-warn`},info:{label:`Info`,tone:`text-muted`}};function L(e,t,n){return e.flatMap(e=>{let r=e.issues.filter(e=>(t===`all`||!e.coverage.covered)&&(n===`all`||e.provider===n));return r.length?[{...e,issues:r}]:[]})}var R=e=>e&&m(e)===`web`?e:void 0,z=e=>n(`record`,encodeURIComponent(e));function B({p:e}){let t=e.error||e.problem?S:e.configured?v:y,n=e.error||e.problem?`Not read`:e.configured?`Connected`:`Not set up`,i=e.error||e.problem?`text-fail`:e.configured?`text-pass`:`text-muted`;return(0,P.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-2 text-body-sm`,children:[(0,P.jsx)(t,{size:15,"aria-label":n,className:r(`mt-1 flex-none`,i)}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:e.label}),e.host&&(0,P.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.host]}),(0,P.jsxs)(`span`,{className:`text-ink-2`,children:[` — `,e.problem?e.problem:e.error?e.error:e.configured?`${e.issues} issue${e.issues===1?``:`s`}${e.fetchedAt?`, read ${T(e.fetchedAt)}`:``}`:e.missing.length?`set ${e.missing.join(` and `)}`:`not set up`]})]})]})}function V({i:e}){if(!e.coverage.covered)return(0,P.jsxs)(`span`,{className:`flex items-center gap-2 whitespace-nowrap text-warn`,children:[(0,P.jsx)(h,{size:14,"aria-label":`No test`,className:`flex-none`}),`No test`]});let t=[...e.coverage.runs.map(e=>e.goal?`${e.id} (${e.goal})`:e.id),...e.coverage.tests],n=e.coverage.runs[0]?.id??e.coverage.tests[0]??``;return(0,P.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,"data-tip":`Covered by ${e.coverage.how===`page`?`a run on this page`:`a test named for this page`}: ${t.join(`, `)}`,children:[(0,P.jsx)(v,{size:14,"aria-label":`Covered`,className:`flex-none text-pass`}),(0,P.jsxs)(`span`,{className:`truncate`,children:[n,t.length>1?` +${t.length-1}`:``]})]})}function H(){let[e,t]=(0,M.useState)(null),[i,o]=(0,M.useState)(``),[m,H]=(0,M.useState)(`uncovered`),[U,W]=(0,M.useState)(`all`),[G,K]=(0,M.useState)(!1),[q,J]=(0,M.useState)(``),[Y,X]=(0,M.useState)(null),Z=(0,M.useCallback)((e=!1)=>{K(e),N.view(e).then(e=>{t(e),o(``),K(!1)},e=>{o(e.message),K(!1)})},[]);(0,M.useEffect)(()=>Z(),[Z]);let ie=e=>{if(e.repro){if(e.repro.on===`production`)return X(e);location.hash=z(e.repro.url)}},ae=async e=>{K(!0);try{let{id:t}=await ee.start(e.ask,{});location.hash=n(`chats`,t)}catch(e){J(e.message),K(!1)}},Q=e?.providers.filter(e=>e.configured)??[],oe=e?L(e.pages,m,U):[],$=[`sentry`,`datadog`,`appinsights`].filter(t=>e?.pages.some(e=>e.issues.some(e=>e.provider===t)));return(0,P.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,P.jsx)(D,{}),(0,P.jsxs)(`main`,{className:r(O,`@container flex-auto gap-4`),children:[(0,P.jsx)(p,{}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,P.jsx)(w,{pixel:a.production,size:`lg`,head:!0}),(0,P.jsx)(`h1`,{className:`m-0 flex-1 text-headline-md`,children:`Production signals`}),Q.length>0&&(0,P.jsxs)(c,{size:`sm`,disabled:G,onClick:()=>Z(!0),"data-tip":`Read again`,children:[(0,P.jsx)(b,{"aria-hidden":`true`}),`Refresh`]})]}),(0,P.jsx)(A,{more:(0,P.jsxs)(P.Fragment,{children:[`The errors of the last 14 days come from Sentry, Datadog and Azure Application Insights, grouped by the page they happened on. Each one says which browser run or automated test already goes to that page, or that no test does. This page only reads: nothing is changed at the provider. Record a repro opens `,(0,P.jsx)(`a`,{href:n(`record`),children:`Record`}),` at the same page on `,e?.testEnvironment?(0,P.jsxs)(P.Fragment,{children:[`the `,e.testEnvironment,` environment`]}):`your test environment`,`. A tracker is set up with `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations.sentry`}),`, `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations.datadog`}),` or `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations.appinsights`}),` in forgeqe.yaml, its keys saved in Settings under the variable names the trackers list shows; Sentry uses the same settings as its MCP server.`]}),children:`See the errors real users hit, and which of them no test covers yet.`}),i&&(0,P.jsx)(`p`,{role:`alert`,className:r(u.fail,`m-0`),children:i}),!e&&!i&&(0,P.jsx)(f,{shape:`rows`,count:3}),e&&Q.length>0&&(0,P.jsx)(`ul`,{"aria-label":`Error trackers`,className:`m-0 flex list-none flex-col divide-y divide-line-soft border-y border-line-soft p-0`,children:e.providers.map(e=>(0,P.jsx)(B,{p:e},e.id))}),e&&!Q.length&&(0,P.jsxs)(s,{page:!0,icon:C,title:`No error tracker set up`,action:(0,P.jsxs)(`a`,{className:l({size:`sm`}),href:n(`settings`,`integrations`),"data-tip":`Open Integrations in Settings`,children:[(0,P.jsx)(ne,{"aria-hidden":`true`}),`Integrations`]}),children:[`Connect Sentry, Datadog or Azure Application Insights, and the errors real users hit show here, grouped by page. In forgeqe.yaml that is one of the `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations`}),`, with its keys saved in Settings.`,e.providers.some(e=>e.problem||e.error||e.missing.length)&&(0,P.jsx)(`ul`,{"aria-label":`Error trackers`,className:`m-0 mt-2 flex list-none flex-col p-0 text-left`,children:e.providers.map(e=>(0,P.jsx)(B,{p:e},e.id))})]}),e&&Q.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{label:`Errors in the last 14 days`,children:[(0,P.jsx)(k,{dot:`neutral`,value:e.counts.issues,label:`errors on ${e.pages.length} page${e.pages.length===1?``:`s`}`}),(0,P.jsx)(`span`,{className:`flex items-center`,"data-tip":`No run or test goes there`,children:(0,P.jsx)(k,{dot:e.counts.uncovered?`warn`:`pass`,value:e.counts.uncovered,label:`with no test`})}),(0,P.jsx)(k,{dot:`neutral`,value:e.counts.events.toLocaleString(),label:`events`}),(0,P.jsx)(`span`,{className:`flex items-center`,"data-tip":`Added up per error`,children:(0,P.jsx)(k,{dot:`neutral`,value:e.counts.users.toLocaleString(),label:`users affected`})})]}),Y?.repro&&(0,P.jsxs)(`div`,{role:`group`,"aria-label":`Record on production`,className:r(u.warn,`flex flex-wrap items-center gap-2`),children:[(0,P.jsx)(h,{size:15,"aria-label":`Warning`,className:`flex-none text-warn`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[`No test environment is active, so the recording would open the production page `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:Y.repro.url}),`. Real data is there: record only steps that read.`]}),(0,P.jsxs)(c,{size:`sm`,onClick:()=>{let e=Y.repro.url;X(null),location.hash=z(e)},"data-tip":`Record on production`,children:[(0,P.jsx)(g,{"aria-hidden":`true`}),`Record`]}),(0,P.jsxs)(c,{size:`sm`,variant:`outline`,onClick:()=>X(null),children:[(0,P.jsx)(_,{"aria-hidden":`true`}),`Cancel`]})]}),q&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:q}),$.length>1&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,P.jsx)(d,{items:[{id:`all`,label:`All trackers`},...$.map(t=>({id:t,label:F[t],n:e.pages.reduce((e,n)=>e+n.issues.filter(e=>e.provider===t).length,0)}))],value:U,onChange:W})}),e.counts.issues===0?(0,P.jsx)(s,{icon:v,title:`No errors in the last 14 days`,children:`The trackers that are set up report no unresolved errors.`}):(0,P.jsx)(E,{label:`Errors by page`,placeholder:`Find an error, page or test`,height:`max(320px, calc(var(--screen) - 288px))`,resetKey:`${m}-${U}`,empty:m===`uncovered`?`Every error here has a test.`:`Nothing matches.`,tools:(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,P.jsx)(d,{items:[{id:`uncovered`,label:`No test`,n:L(e.pages,`uncovered`,U).reduce((e,t)=>e+t.issues.length,0),alert:!0},{id:`all`,label:`All`,n:L(e.pages,`all`,U).reduce((e,t)=>e+t.issues.length,0)}],value:m,onChange:H})}),head:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[38%]`),children:`Error`}),(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Tracker`}),(0,P.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Events`}),(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Users`}),(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Last seen`}),(0,P.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Covered by`}),(0,P.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,P.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:oe.map(e=>(0,P.jsxs)(M.Fragment,{children:[(0,P.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted`,children:(0,P.jsx)(`td`,{colSpan:7,className:r(`px-4 py-2`,`max-w-0 text-body-sm`),children:(0,P.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate font-mono`,"data-tip":e.url||e.page||`The tracker names no page`,children:e.page||`No page named`}),(0,P.jsxs)(`span`,{className:`flex-none text-muted`,children:[e.issues.length,` error`,e.issues.length===1?``:`s`,e.uncovered?`, ${e.uncovered} with no test`:``]})]})})}),e.issues.map(e=>{let t=I[e.level],n=R(e.link);return(0,P.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0`),children:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.level===`info`?(0,P.jsx)(y,{size:15,"aria-label":t.label,className:r(`flex-none`,t.tone)}):e.level===`warning`?(0,P.jsx)(h,{size:15,"aria-label":t.label,className:r(`flex-none`,t.tone)}):(0,P.jsx)(S,{size:15,"aria-label":t.label,className:r(`flex-none`,t.tone)}),(0,P.jsx)(`span`,{className:`truncate`,"data-tip":[e.title,`${F[e.provider]} ${e.id}`,e.environment&&`environment ${e.environment}${e.production?` (production: read only)`:``}`,e.release&&`release ${e.release}`,e.service].filter(Boolean).join(` · `),children:e.title})]})}),(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`hidden whitespace-nowrap text-body-sm text-ink-2 @xl:table-cell`),children:F[e.provider]}),(0,P.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.count,children:e.count.toLocaleString()}),(0,P.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden text-muted @2xl:table-cell`),"data-sort":e.users,children:e.users.toLocaleString()}),(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`hidden whitespace-nowrap text-body-sm text-muted @2xl:table-cell`),"data-tip":e.lastSeen?re(e.lastSeen):void 0,children:e.lastSeen?T(e.lastSeen):`–`}),(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0 text-body-sm`),children:(0,P.jsx)(V,{i:e})}),(0,P.jsxs)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:[e.repro&&(0,P.jsx)(c,{variant:`icon`,size:`icon-sm`,disabled:G,onClick:()=>ie(e),"aria-label":e.repro.on===`test`?`Record a repro at ${e.repro.url}`:`Record a repro at the production page (asks first)`,"data-tip":e.repro.on===`test`?`Record a repro at ${e.repro.url}`:`Record a repro at the production page (asks first)`,children:(0,P.jsx)(g,{"aria-hidden":`true`})}),(0,P.jsx)(c,{variant:`icon`,size:`icon-sm`,disabled:G,onClick:()=>void ae(e),"aria-label":`Ask in a chat about ${F[e.provider]} ${e.id}`,"data-tip":`Ask in a chat about ${F[e.provider]} ${e.id}`,children:(0,P.jsx)(x,{"aria-hidden":`true`})}),n&&(0,P.jsx)(`a`,{className:l({variant:`icon`,size:`icon`}),href:n,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open in ${F[e.provider]}`,"data-tip":`Open in ${F[e.provider]}`,children:(0,P.jsx)(te,{"aria-hidden":`true`})})]})]},`${e.provider}-${e.id}`)})]},e.page||`-`))})]})]})]})}export{H as Production,L as shownPages};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,V as a,a as o,c as s}from"./surface-c1kG1KPS.js";import{t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{I as u}from"./palette-D8aKJo_q.js";import{L as d,Y as f,b as p,tt as m,v as h}from"./api-DS8XP38R.js";import{A as g,F as _,I as v,L as y,T as b,_ as x,g as S,i as C,k as w,n as T}from"./pageBack-DU3mApVL.js";import{C as E,E as D,Er as O,F as k,N as A,Nt as ee,Rn as te,Rt as j,Tr as M,Xn as N,Yt as ne,ft as re,ir as ie,it as ae,pn as P,t as F,vn as I,wr as oe,z as L}from"./line-icons-Cwj9OmCz.js";import{At as se,Dn as ce,G as le,K as ue,W as de,Y as fe,Z as R,ct as z,ft as B,it as V,lt as H,ot as U,rt as W,s as pe,t as me,ut as G}from"./frame-BANehQdX.js";import{B as K,V as q,Y as he,z as ge}from"./index-Db_tsLSf.js";import{a as _e,c as ve,d as J,l as Y,n as ye,s as be,t as xe,v as Se,x as Ce,y as we}from"./qualityParts-C2Y38oFp.js";import{a as Te,c as Ee,i as De,n as Oe,s as X}from"./SiteScan-D2WMUVcw.js";var Z=e(t(),1),ke={view:()=>h(`GET`,`/api/localization`),run:e=>h(`GET`,`/api/localization/${encodeURIComponent(e)}`),shot:(e,t,n)=>d(`/api/localization/${encodeURIComponent(e)}/shot/${t}/${n}`,`image/jpeg`)},Q=l(),Ae={high:`text-fail`,medium:`text-warn`,low:`text-muted`},je=[`key`,`untranslated`,`cut_off`,`overflow`,`expansion`,`rtl`];function Me({id:e,index:t,mode:n}){let[r,i]=(0,Z.useState)(``),[a,s]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let r=!1;return ke.shot(e,t,n).then(e=>!r&&i(e),()=>!r&&s(!0)),()=>{r=!0}},[e,t,n]);let l=n===`pseudo`?`Pseudo-localized`:`Right to left`;return(0,Q.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1`,children:[(0,Q.jsx)(`figcaption`,{className:`text-body-sm text-muted`,children:l}),a?(0,Q.jsx)(`p`,{className:c(o,`m-0 px-4 py-6 text-center text-body-sm text-muted`),children:`No capture`}):r?(0,Q.jsx)(`img`,{src:r,alt:`${l} capture`,className:c(o,`max-h-[420px] w-full object-contain object-top`)}):(0,Q.jsx)(`div`,{className:c(o,`min-h-24`)})]})}function Ne({id:e,page:t,index:n,text:r}){let[i,o]=(0,Z.useState)(!1),s=t.findings.some(e=>r[e.kind].severity===`high`)?`high`:t.findings.some(e=>r[e.kind].severity===`medium`)?`medium`:t.findings.length?`low`:void 0,l=s===`high`?L:s?O:A,u=t.findings.toSorted((e,t)=>je.indexOf(e.kind)-je.indexOf(t.kind));return(0,Q.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>o(!i),className:c(a,`items-start gap-2`),children:[(0,Q.jsx)(l,{size:15,"aria-label":s?`${s} findings`:`Nothing found`,className:c(`mt-1 flex-none`,s?Ae[s]:`text-pass`)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`truncate font-medium`,"data-tip":t.url,children:[t.title||Ce(t.url),s&&(0,Q.jsxs)(`span`,{className:c(`font-normal`,Ae[s]),children:[` · `,s===`high`?`High`:s===`medium`?`Medium`:`Low`]})]}),(0,Q.jsxs)(`span`,{className:`truncate text-body-sm text-muted`,children:[Ce(t.url),` · `,t.lang?`lang ${t.lang}`:`no lang`,u.length?` · ${u.map(e=>`${r[e.kind].label.charAt(0).toLowerCase()}${r[e.kind].label.slice(1)} ${e.count}`).join(`, `)}`:` · nothing found`]})]}),(0,Q.jsx)(D,{size:14,"aria-hidden":`true`,className:c(`mt-1 flex-none transition-transform`,i&&`rotate-180`)})]}),(0,Q.jsx)(ce,{open:i,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 pb-4 pl-8`,children:[u.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-body-sm`,children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[r[e.kind].label,` `,(0,Q.jsxs)(`span`,{className:c(`font-normal`,Ae[r[e.kind].severity]),children:[`· `,e.count]})]}),(0,Q.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:r[e.kind].fix}),e.examples.map((e,t)=>(0,Q.jsx)(`span`,{className:`truncate font-mono text-body-sm text-muted`,"data-tip":e,children:e},t))]},e.kind)),(t.shots.pseudo||t.shots.rtl)&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-4 @2xl:grid-cols-2`,children:[t.shots.pseudo&&(0,Q.jsx)(Me,{id:e,index:n,mode:`pseudo`}),t.shots.rtl&&(0,Q.jsx)(Me,{id:e,index:n,mode:`rtl`})]})]})})]})}function Pe({id:e,text:t}){let[n,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),[s,l]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let t=!1;return i(null),ke.run(e).then(e=>!t&&(i(e),o(``)),e=>!t&&o(e.message)),()=>{t=!0}},[e]);let u=(0,Q.jsxs)(`a`,{href:r(`quality`,`localization`),className:c(v({variant:`link`,size:`inline`}),`gap-1 self-start`),children:[(0,Q.jsx)(D,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(a||!n)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u,a?(0,Q.jsx)(`p`,{role:`alert`,className:c(y.fail,`m-0`),children:a}):(0,Q.jsx)(S,{shape:`detail`})]});let d=async()=>{try{let{id:e}=await p.start(`Explain the localization findings of the browser run ${n.id} in the reports folder (its localization.json and the captures in its localization folder), page by page, and what the developers should change.`,{});location.hash=r(`chats`,e)}catch(e){l(e.message)}},f=e=>n.counts[e]??0;return(0,Q.jsxs)(`section`,{"aria-labelledby":`l10n-run-h`,className:`flex min-w-0 flex-col gap-4`,children:[u,(0,Q.jsx)(he,{id:`l10n-run-h`,icon:j,title:(0,Q.jsx)(`span`,{"data-tip":n.goal,children:n.goal}),description:(0,Q.jsxs)(Q.Fragment,{children:[J(n.at),` · `,n.langs.length?n.langs.join(`, `):`no lang`,` · `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.id})]}),actions:(0,Q.jsxs)(_,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void d(),children:[(0,Q.jsx)(I,{"aria-hidden":`true`}),`Chat`]})}),s&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:s}),(0,Q.jsxs)(ge,{label:`What the run found`,children:[(0,Q.jsx)(K,{dot:`neutral`,value:n.pages,label:n.langs.length?`pages (${n.langs.join(`, `)})`:`pages, no lang set`}),(0,Q.jsx)(K,{dot:`fail`,value:f(`key`),label:`translation keys shown`}),(0,Q.jsx)(K,{dot:`warn`,value:f(`untranslated`),label:`English left on other languages`}),(0,Q.jsx)(K,{dot:`warn`,value:f(`cut_off`)+f(`overflow`),label:`cut off as the page was`}),(0,Q.jsx)(K,{dot:`warn`,value:f(`expansion`),label:`break with longer text`}),(0,Q.jsx)(K,{dot:`warn`,value:f(`rtl`),label:`break right to left`})]}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:n.list.map((e,r)=>(0,Q.jsx)(Ne,{id:n.id,page:e,index:r,text:t},e.url))})]})}function Fe({runs:e}){let t=e=>location.hash=r(`quality`,`localization`,encodeURIComponent(e)),n=(e,t)=>e.counts[t]??0;return(0,Q.jsx)(W,{label:`Runs`,placeholder:`Find a run by what it did`,empty:`Nothing matches.`,height:V,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(H,`w-[44%]`),children:`Run`}),(0,Q.jsx)(`th`,{scope:`col`,className:G,children:`Keys`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(G,`hidden @xl:table-cell`),children:`English left`}),(0,Q.jsx)(`th`,{scope:`col`,className:G,children:`Cut off`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(G,`hidden @2xl:table-cell`),children:`Longer · RTL`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(H,`hidden @xl:table-cell`),children:`When`})]}),children:e.map(e=>{let i=n(e,`key`),a=n(e,`untranslated`)+n(e,`cut_off`)+n(e,`overflow`)+n(e,`expansion`)+n(e,`rtl`),o=i?L:a?O:A;return(0,Q.jsxs)(`tr`,{onClick:()=>t(e.id),className:B,children:[(0,Q.jsx)(`td`,{className:c(U,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(o,{size:15,"aria-label":i?`Keys shown`:a?`Needs a look`:`Nothing found`,className:c(`flex-none`,i?`text-fail`:a?`text-warn`:`text-pass`)}),(0,Q.jsx)(`a`,{href:r(`quality`,`localization`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,Q.jsx)(`td`,{className:c(z,i?`text-fail`:`text-muted`),children:i}),(0,Q.jsx)(`td`,{className:c(z,`hidden @xl:table-cell`,n(e,`untranslated`)?`text-warn`:`text-muted`),children:n(e,`untranslated`)}),(0,Q.jsx)(`td`,{className:c(z,n(e,`cut_off`)+n(e,`overflow`)?`text-warn`:`text-muted`),children:n(e,`cut_off`)+n(e,`overflow`)}),(0,Q.jsxs)(`td`,{className:c(z,`hidden text-muted @2xl:table-cell`),"data-sort":n(e,`expansion`)+n(e,`rtl`),children:[n(e,`expansion`),` · `,n(e,`rtl`)]}),(0,Q.jsx)(`td`,{className:c(U,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":J(e.at),"data-sort":new Date(e.at).getTime()||0,children:R(e.at)})]},e.id)})})}function Ie({id:e}){let[t,n]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{ke.view().then(e=>(n(e),a(``)),e=>a(e.message))},[]),i?(0,Q.jsx)(`p`,{role:`alert`,className:c(y.fail,`m-0`),children:i}):t?e?(0,Q.jsx)(Pe,{id:e,text:t.text}):t.runs.length?(0,Q.jsx)(Fe,{runs:t.runs}):(0,Q.jsx)(g,{page:!0,icon:j,title:`No runs checked yet`,action:(0,Q.jsxs)(`a`,{className:v({size:`sm`}),href:r(`record`),"data-tip":`Record a flow`,children:[(0,Q.jsx)(k,{"aria-hidden":`true`}),`Record`]}),children:`Run a flow in each language your site has, and what it found shows here. Every browser run with accessibility checks on also checks each page's language.`}):(0,Q.jsx)(S,{shape:`rows`})}var Le=[{id:`7d`,label:`Last 7 days`},{id:`30d`,label:`Last 30 days`},{id:`90d`,label:`Last 90 days`},{id:`all`,label:`All time`}],Re=[{key:`a11y`,label:`Accessibility violations`,better:`down`,show:e=>String(e)},{key:`seo`,label:`SEO score`,better:`up`,show:e=>String(e)},{key:`lcp`,label:`Largest paint (LCP)`,better:`down`,show:e=>Se(e,`ms`)}];function ze(e,t,n,r){if(t===void 0||n===void 0||r<2)return;let i=n-t;if(!i)return;let a=i>0;return{text:`${a?`+`:`−`}${e.key===`lcp`?Se(Math.abs(i),`ms`):Math.abs(i)}`,dir:a?`up`:`down`,good:(a?`up`:`down`)===e.better,against:`since the first run of the range`}}function Be({s:e}){let t=t=>e.points.map(e=>e[t]).filter(e=>typeof e==`number`),n=Re.filter(e=>t(e.key).length),r=e=>e?J(e.at):``;return(0,Q.jsxs)(`section`,{"aria-label":e.site,className:c(s,`flex flex-col gap-4`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,Q.jsx)(j,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`h3`,{className:`m-0 min-w-0 truncate font-mono text-body-lg font-medium`,children:e.site}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[we(e.runs,`run`),` · `,we(e.pages,`page`),e.first&&e.latest&&e.runs>1?` · ${r(e.first)} to ${r(e.latest)}`:e.latest?` · ${r(e.latest)}`:``]})]}),n.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(le,{label:`${e.site} now`,className:`shadow-none`,children:n.map(t=>{let n=e.latest?.[t.key],r=ze(t,e.first?.[t.key],n,e.runs);return(0,Q.jsx)(de,{compact:!0,label:t.label,value:n===void 0?`–`:t.show(n),...r?{change:r}:{note:e.runs>1?`No change in this range`:`One run in this range`}},t.key)})}),e.points.length>1&&(0,Q.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,150px),1fr))] gap-x-px`,children:n.map(n=>{let r=t(n.key),i=ze(n,e.first?.[n.key],e.latest?.[n.key],e.runs);return r.length>1?(0,Q.jsx)(x,{series:[{values:r,tone:i?.good===!1?`fail`:`accent`}],label:`${n.label} over the last ${r.length} runs: ${r.map(n.show).join(`, `)}`,className:`h-12 px-4`},n.key):(0,Q.jsx)(`span`,{},n.key)})})]}),e.analytics.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`mr-1 text-muted`,children:`Analytics in the latest run:`}),e.analytics.map(e=>(0,Q.jsxs)(w,{tone:`neutral`,icon:!1,children:[e.tool,(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,we(e.pages,`page`)]})]},e.tool))]}),(0,Q.jsx)(ye,{icon:M,className:`text-fail`,lines:e.newRules.map(e=>`newly failing: ${e}`)}),(0,Q.jsx)(ye,{icon:oe,className:`text-pass`,lines:e.fixedRules.map(e=>`fixed: ${e}`)})]})}function Ve(){let[e,t]=(0,Z.useState)(`30d`),[n,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{let t=!1;return i(null),Ee.view(e).then(e=>!t&&(i(e.sites),o(``)),e=>!t&&o(e.message)),()=>{t=!0}},[e]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(q,{more:(0,Q.jsx)(Q.Fragment,{children:`Every browser run and site scan adds each page's accessibility and timings to the history; a scan also adds its SEO score and analytics tags. A site is its origin; each number is per run, summed over its pages (violations) or their average (SEO score, LCP). The change is against the first run in the range.`}),children:`How each site's accessibility, SEO, speed and analytics changed over time.`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(b,{items:Le,value:e,onChange:t})}),a&&(0,Q.jsx)(`p`,{role:`alert`,className:c(y.fail,`m-0`),children:a}),!n&&!a&&(0,Q.jsx)(S,{shape:`detail`}),n&&(n.length?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:n.map(e=>(0,Q.jsx)(Be,{s:e},e.site))}):(0,Q.jsx)(g,{page:!0,icon:E,title:e===`all`?`No history yet`:`Nothing in this range`,action:(0,Q.jsx)(`a`,{className:v({size:`sm`}),href:r(`quality`,`scans`),children:`Scan pages`}),children:`Scan a few pages, or run a flow in a browser: each page's results are kept, and every site shows here with how it changed.`}))]})}var He={view:()=>h(`GET`,`/api/security`),run:e=>h(`GET`,`/api/security/${encodeURIComponent(e)}`)},Ue={high:`text-fail`,medium:`text-warn`,low:`text-muted`},$={high:`High`,medium:`Medium`,low:`Low`};function We({id:e,fix:t}){let[n,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),[s,l]=(0,Z.useState)(`all`),[u,d]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let t=!1;return i(null),He.run(e).then(e=>!t&&(i(e),o(``)),e=>!t&&o(e.message)),()=>{t=!0}},[e]);let f=(0,Q.jsxs)(`a`,{href:r(`quality`,`security`),className:`inline-flex items-center gap-1 self-start text-body-sm no-underline`,children:[(0,Q.jsx)(D,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(a)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f,(0,Q.jsx)(`p`,{role:`alert`,className:c(y.fail,`m-0`),children:a})]});if(!n)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f,(0,Q.jsx)(S,{shape:`detail`})]});let m=async()=>{try{let{id:e}=await p.start(`Explain the passive security findings of the browser run ${n.id} in the reports folder (its network.json, security section), most serious first, and how the team should fix each.`,{});location.hash=r(`chats`,e)}catch(e){d(e.message)}},h=n.findings.filter(e=>s===`all`||e.severity===s);return(0,Q.jsxs)(`section`,{"aria-labelledby":`sec-run-h`,className:`flex min-w-0 flex-col gap-4`,children:[f,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,Q.jsx)(he,{id:`sec-run-h`,icon:ie,title:(0,Q.jsx)(`span`,{"data-tip":n.goal,className:`block truncate`,children:n.goal})}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-muted`,children:[J(n.at),` · `,n.env?`${n.env} · `:``,n.host??`no start page`,` · `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.id})]})]}),!n.production&&n.findings.length>0&&(0,Q.jsxs)(_,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void m(),children:[(0,Q.jsx)(I,{"aria-hidden":`true`}),`Chat`]})]}),u&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:u}),n.production?(0,Q.jsxs)(g,{icon:P,title:`Not checked`,children:[`This run was on `,n.env,`, an environment named like production. The security smoke checks are for test environments only.`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ge,{label:`Findings by severity`,children:[(0,Q.jsx)(K,{dot:`fail`,value:n.counts.high,label:`high: fix before release`}),(0,Q.jsx)(K,{dot:`warn`,value:n.counts.medium,label:`medium: worth fixing`}),(0,Q.jsx)(K,{dot:`neutral`,value:n.counts.low,label:`low: hardening`}),(0,Q.jsx)(K,{dot:`neutral`,value:n.pages,label:`pages checked`}),(0,Q.jsx)(K,{dot:`neutral`,value:n.calls,label:`calls checked`})]}),!n.pages&&!n.findings.length?(0,Q.jsx)(g,{icon:O,title:`No pages recorded`,children:`This run kept its API calls but not the pages' headers and cookies: it was made before ForgeQE recorded them. Run the flow again to check it.`}):n.findings.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(b,{items:[{id:`all`,label:`All`,n:n.findings.length},...[`high`,`medium`,`low`].filter(e=>n.counts[e]).map(e=>({id:e,label:$[e],n:n.counts[e],alert:e===`high`}))],value:s,onChange:l})}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:h.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 border-t border-line-soft py-2 text-body-sm`,children:[e.severity===`high`?(0,Q.jsx)(L,{size:15,"aria-label":`High`,className:`mt-1 flex-none text-fail`}):(0,Q.jsx)(O,{size:15,"aria-label":$[e.severity],className:c(`mt-1 flex-none`,Ue[e.severity])}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[e.title,` `,(0,Q.jsxs)(`span`,{className:c(`font-normal`,Ue[e.severity]),children:[`· `,$[e.severity]]})]}),(0,Q.jsxs)(`span`,{className:`truncate font-mono text-body-sm text-ink-2`,"data-tip":e.target,children:[e.target,e.detail?` · ${e.detail}`:``]}),(0,Q.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:t[e.kind]?.fix})]})]},`${e.kind}|${e.target}`))})]}):(0,Q.jsx)(g,{icon:A,title:`Nothing found`,children:`The pages this run loaded sent the security headers checked, their cookies had safe flags, and no answer held a key or token.`})]})]})}function Ge({runs:e}){let[t,n]=(0,Z.useState)(`all`),i=t===`high`?e.filter(e=>e.counts.high):e,a=e=>location.hash=r(`quality`,`security`,encodeURIComponent(e));return(0,Q.jsx)(W,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:t,empty:`Nothing matches.`,height:V,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(b,{items:[{id:`all`,label:`All`,n:e.length},{id:`high`,label:`High findings`,n:e.filter(e=>e.counts.high).length,alert:!0}],value:t,onChange:n})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(H,`w-[46%]`),children:`Run`}),(0,Q.jsx)(`th`,{scope:`col`,className:G,children:`High`}),(0,Q.jsx)(`th`,{scope:`col`,className:G,children:`Medium`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(G,`hidden @xl:table-cell`),children:`Low`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(H,`hidden @2xl:table-cell`),children:`Environment`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(H,`hidden @xl:table-cell`),children:`When`})]}),children:i.map(e=>{let t=e.production||!e.pages&&!e.counts.high&&!e.counts.medium&&!e.counts.low,n=t?P:e.counts.high?L:e.counts.medium?O:A,i=e.production?`Not checked: production`:t?`No pages recorded`:e.counts.high?`High findings`:e.counts.medium?`Medium findings`:`Nothing serious`;return(0,Q.jsxs)(`tr`,{onClick:()=>a(e.id),className:B,children:[(0,Q.jsx)(`td`,{className:c(U,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(n,{size:15,"aria-label":i,className:c(`flex-none`,t?`text-muted`:e.counts.high?`text-fail`:e.counts.medium?`text-warn`:`text-pass`)}),(0,Q.jsx)(`a`,{href:r(`quality`,`security`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,Q.jsx)(`td`,{"data-sort":t?-1:e.counts.high,className:c(z,e.counts.high?`text-fail`:`text-muted`),children:t?`–`:e.counts.high}),(0,Q.jsx)(`td`,{"data-sort":t?-1:e.counts.medium,className:c(z,e.counts.medium?`text-warn`:`text-muted`),children:t?`–`:e.counts.medium}),(0,Q.jsx)(`td`,{"data-sort":t?-1:e.counts.low,className:c(z,`hidden text-muted @xl:table-cell`),children:t?`–`:e.counts.low}),(0,Q.jsx)(`td`,{className:c(U,`hidden text-body-sm text-muted @2xl:table-cell`),children:e.production?`${e.env} · not checked`:t?`no pages recorded`:e.env??e.host??`–`}),(0,Q.jsx)(`td`,{className:c(U,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":J(e.at),"data-sort":new Date(e.at).getTime()||0,children:R(e.at)})]},e.id)})})}function Ke({id:e}){let[t,n]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{He.view().then(e=>(n(e),a(``)),e=>a(e.message))},[]),i?(0,Q.jsx)(`p`,{role:`alert`,className:c(y.fail,`m-0`),children:i}):t?e?(0,Q.jsx)(We,{id:e,fix:t.fix}):t.runs.length?(0,Q.jsx)(Ge,{runs:t.runs}):(0,Q.jsx)(g,{page:!0,icon:P,title:`No runs to check yet`,action:(0,Q.jsxs)(`a`,{className:v({size:`sm`}),href:r(`record`),"data-tip":`Record a flow`,children:[(0,Q.jsx)(k,{"aria-hidden":`true`}),`Record`]}),children:`Run a flow on a test environment, and what it found shows here. Every browser run keeps the pages' security headers, the cookies' flags and its API calls.`}):(0,Q.jsx)(S,{shape:`rows`})}function qe(){let[e,t]=(0,Z.useState)(``),[n,r]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let i=!1;return X.view(e,n).then(a=>{i||(o(a),l(``),e||t(a.coverage.standard),n||r(a.coverage.engine))},e=>!i&&l(e.message)),()=>{i=!0}},[e,n]);let f=async t=>{d(t),l(``);try{let r=await(t===`csv`?X.csv(e,n):t===`html`?X.html(e,n):X.pdf(e,n));m(r,`wcag-coverage-${e}-${n}.${t}`)}catch(e){l(e.message)}finally{d(``)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(q,{more:(0,Q.jsx)(Q.Fragment,{children:`Rules come from the engine's own map of its rules to the success criteria; a rule that runs never proves a criterion is met. The personas (Accessibility › Agent) exercise criteria by how they use a page: a keyboard-only person meets focus order, a person at 200% zoom meets reflow. What is left needs a person reviewing by hand.`}),children:`What ForgeQE's rules and accessibility personas can check of a WCAG standard, criterion by criterion.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_220px] flex-col gap-1 text-body-sm font-medium`,children:[`Standard`,(0,Q.jsx)(i,{size:`sm`,value:e,onChange:e=>t(e.target.value),disabled:!a,children:(a?.standards??[]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_200px] flex-col gap-1 text-body-sm font-medium`,children:[`Rule engine`,(0,Q.jsx)(i,{size:`sm`,value:n,onChange:e=>r(e.target.value),disabled:!a,children:(a?.engines??[]).map(e=>(0,Q.jsx)(`option`,{value:e,children:Te(e)},e))})]}),(0,Q.jsx)(`span`,{className:`flex-auto`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Q.jsxs)(_,{size:`sm`,variant:`ghost`,disabled:!a||!!u,onClick:()=>void f(`csv`),"data-tip":`Download the matrix as CSV`,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`}),`CSV`]}),(0,Q.jsxs)(_,{size:`sm`,variant:`ghost`,disabled:!a||!!u,onClick:()=>void f(`html`),"data-tip":`Download the matrix as an HTML page`,children:[(0,Q.jsx)(re,{"aria-hidden":`true`}),`HTML`]}),(0,Q.jsxs)(_,{size:`sm`,variant:`ghost`,disabled:!a||!!u,onClick:()=>void f(`pdf`),"data-tip":`Print the matrix to PDF and download it`,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`}),u===`pdf`?`Printing…`:`PDF`]})]})]}),s&&(0,Q.jsx)(`p`,{role:`alert`,className:c(y.fail,`m-0`),children:s}),!a&&!s&&(0,Q.jsx)(S,{shape:`rows`,count:8}),a&&(0,Q.jsx)(De,{c:a.coverage,engineLabel:Te(a.coverage.engine)},`${a.coverage.standard}-${a.coverage.engine}`)]})}function Je({id:e,asked:t,view:n,onChanged:i}){let[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(`accessibility`),m=t===`accessibility`||t===`performance`||t===`visual`?t:u,h=t=>location.hash=r(`quality`,encodeURIComponent(e),t),[g,b]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let t=!1;return o(null),f.run(e).then(e=>{if(t)return;o(e),l(``);let n=e.visual?.pages.some(e=>e.status===`changed`)||!e.visual&&e.captured;d(e.report?.accessibility.failed.length?`accessibility`:e.report?.breaches.some(e=>e.kind===`performance`)?`performance`:n?`visual`:e.report?.accessibility.pages?`accessibility`:e.report?.performance.pages.length?`performance`:`visual`)},e=>!t&&l(e.message)),()=>{t=!0}},[e]);let x=(0,Q.jsxs)(`a`,{href:r(`quality`),className:c(v({variant:`link`,size:`inline`}),`gap-1 self-start`),children:[(0,Q.jsx)(D,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(s)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[x,(0,Q.jsx)(`p`,{className:c(y.fail,`m-0`),children:s})]});if(!a)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[x,(0,Q.jsx)(S,{shape:`detail`})]});let w=async()=>{try{let{id:e}=await p.start(`Explain the accessibility, performance and visual results of the run in ${a.dir}: call quality_report and visual_compare with run_dir ${a.dir}. Say what matters most to fix first, and why.`,{});location.hash=r(`chats`,e)}catch(e){b(e.message)}},T=a.report,E=T?.accessibility,O=T?.performance.pages??[],k=O.filter(e=>e.over.length).length,A=O.map(e=>e.lcp).filter(e=>typeof e==`number`),j=A.length?Math.max(...A):void 0,M=a.visual?.pages.filter(e=>e.status===`changed`).length??0,N=T?.breaches.length??0,re=[{id:`accessibility`,label:`Accessibility`,icon:F,n:E?.pages?`${E.failed.length} failed`:`not measured`,tone:E?.failed.length?`text-fail`:void 0},{id:`performance`,label:`Performance`,icon:ee,n:O.length?k?`${k} over budget`:`${O.length} pages`:`not measured`,tone:k?`text-fail`:void 0},{id:`visual`,label:`Visual`,icon:ne,n:a.visual?`${M} changed`:a.captured?`not compared`:`not captured`,tone:M?`text-warn`:void 0}];return(0,Q.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-4`,children:[x,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,Q.jsx)(he,{id:`run-h`,icon:te,title:(0,Q.jsx)(`span`,{"data-tip":a.goal,className:`block truncate`,children:a.goal})}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-muted`,children:[J(a.at),` · `,n.standard,` · `,(0,Q.jsx)(C,{path:a.dir})]})]}),(0,Q.jsxs)(_,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void w(),children:[(0,Q.jsx)(I,{"aria-hidden":`true`}),`Chat`]})]}),g&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:g}),(0,Q.jsxs)(ge,{label:`What the run measured`,children:[(0,Q.jsx)(K,{dot:N?`fail`:`pass`,value:N,label:N?`budgets exceeded: fails the run`:`budgets exceeded`}),E?.pages?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{dot:`fail`,value:E.failed.length,label:`rules failed (${E.passed.length} passed)`}),(0,Q.jsx)(K,{dot:`fail`,value:`${E.byImpact.critical} · ${E.byImpact.serious}`,label:`critical · serious`}),(0,Q.jsx)(K,{dot:`warn`,value:`${E.byImpact.moderate} · ${E.byImpact.minor}`,label:`moderate · minor`})]}):null,O.length>0&&(0,Q.jsx)(K,{dot:k?`fail`:`neutral`,value:O.length,label:k?`pages timed, ${k} over budget`:`pages timed`}),j!==void 0&&(0,Q.jsx)(K,{dot:j>4e3?`fail`:j>2500?`warn`:`pass`,value:Se(j,`ms`),label:`slowest LCP (good up to 2.5s)`}),a.visual?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{dot:`neutral`,value:a.visual.pages.length,label:`pages compared`}),(0,Q.jsx)(K,{dot:`warn`,value:M,label:a.visual.pages.some(e=>e.over)?`pages changed, over budget`:`pages changed`})]}):a.captured?(0,Q.jsx)(K,{dot:`neutral`,value:a.captured,label:`pages captured, not compared`}):null]}),(0,Q.jsx)(fe,{label:`Results`,className:`mb-0`,current:m,onPick:h,tabs:re.map(e=>({id:e.id,label:e.label,n:e.n,...e.tone?{tone:e.tone}:{}}))}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-${m}`,"aria-labelledby":`tab-${m}`,className:`flex min-w-0 flex-col`,children:[m===`accessibility`&&(0,Q.jsx)(xe,{run:a,standard:n.standard,disclaimer:n.disclaimer},a.id),m===`performance`&&(0,Q.jsx)(_e,{run:a}),m===`visual`&&(0,Q.jsx)(ve,{run:a,budget:n.budgets.visual,onChange:e=>{o(e),i()}})]})]})}function Ye({runs:e}){let[t,n]=(0,Z.useState)(`all`),i=e,a=t===`attention`?i.filter(Y):i,o=e=>location.hash=r(`quality`,encodeURIComponent(e));return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,Q.jsx)(W,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:t,empty:`Nothing matches.`,height:V,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(b,{items:[{id:`all`,label:`All`,n:i.length},{id:`attention`,label:`Needs a look`,n:i.filter(Y).length,alert:!0}],value:t,onChange:n})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(H,`w-[46%]`),children:`Run`}),(0,Q.jsx)(`th`,{scope:`col`,className:G,children:`Rules failed`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(G,`hidden @2xl:table-cell`),children:`Critical · serious`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(G,`hidden @xl:table-cell`),children:`Slow pages`}),(0,Q.jsx)(`th`,{scope:`col`,className:G,children:`Visual`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(G,`hidden @3xl:table-cell`),children:`Budgets`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(H,`hidden @xl:table-cell`),children:`When`})]}),children:a.map(e=>{let t=e.breaches?L:Y(e)?O:A,n=e.a11y?e.a11y.critical+e.a11y.serious:void 0;return(0,Q.jsxs)(`tr`,{onClick:()=>o(e.id),className:B,children:[(0,Q.jsx)(`td`,{className:c(U,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(t,{size:15,"aria-label":e.breaches?`Over a budget`:Y(e)?`Needs a look`:`Within budgets`,className:c(`flex-none`,e.breaches?`text-fail`:Y(e)?`text-warn`:`text-pass`)}),(0,Q.jsx)(`a`,{href:r(`quality`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,Q.jsx)(`td`,{className:c(z,e.a11y?.failed?`text-fail`:`text-muted`),"data-sort":e.a11y?e.a11y.failed:-1,children:e.a11y?e.a11y.failed:`–`}),(0,Q.jsx)(`td`,{className:c(z,`hidden @2xl:table-cell`,n?`text-fail`:`text-muted`),"data-sort":e.a11y?e.a11y.critical*1e3+e.a11y.serious:-1,children:e.a11y?`${e.a11y.critical} · ${e.a11y.serious}`:`–`}),(0,Q.jsx)(`td`,{className:c(z,`hidden @xl:table-cell`,e.perf.over?`text-fail`:`text-muted`),"data-sort":e.perf.pages?e.perf.over:-1,children:e.perf.pages?`${e.perf.over} / ${e.perf.pages}`:`–`}),(0,Q.jsx)(`td`,{className:c(z,e.visual?.changed?`text-warn`:`text-muted`),"data-sort":e.visual?e.visual.changed:-1,children:e.visual?`${e.visual.changed} changed`:e.captured?`not compared`:`–`}),(0,Q.jsx)(`td`,{className:c(z,`hidden @3xl:table-cell`,e.breaches?`text-fail`:`text-muted`),"data-sort":e.breaches||0,children:e.breaches?`${e.breaches} over`:`ok`}),(0,Q.jsx)(`td`,{className:c(U,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":J(e.at),"data-sort":new Date(e.at).getTime()||0,children:R(e.at)})]},e.id)})})})}function Xe({sub:e}){let[t,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),s=(0,Z.useCallback)(()=>{f.view().then(e=>{i(e),o(``)},e=>o(e.message))},[]);(0,Z.useEffect)(s,[s]);let[l=``,d,p]=(e??``).split(`/`),m=l===`trends`,h=l===`security`,_=l===`localization`,b=l===`scans`,x=l===`dashboard`,C=l===`coverage`,w=b||x||C,D=(h||_)&&d?n(d):void 0,O=h?D:void 0,A=l&&!m&&!h&&!_&&!w?n(l):``;return(0,Q.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Q.jsx)(pe,{}),(0,Q.jsxs)(`main`,{className:c(me,`@container flex-auto gap-4`),children:[(0,Q.jsx)(T,{}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Q.jsx)(se,{pixel:u.quality,size:`lg`,head:!0}),(0,Q.jsx)(`h1`,{className:`m-0 text-headline-md`,children:`Quality`}),!A&&!(b&&d)&&(0,Q.jsx)(ue,{label:`Show`,current:m?`trends`:h?`security`:_?`localization`:b?`scans`:x?`dashboard`:C?`coverage`:`runs`,links:[{id:`runs`,label:`Runs`,icon:te,href:r(`quality`)},{id:`scans`,label:`Scan history`,icon:N,href:r(`quality`,`scans`)},{id:`dashboard`,label:`Dashboard`,icon:E,href:r(`quality`,`dashboard`)},{id:`trends`,label:`Trends`,icon:M,href:r(`quality`,`trends`)},{id:`coverage`,label:`WCAG coverage`,icon:F,href:r(`quality`,`coverage`)},{id:`security`,label:`Security`,icon:ie,href:r(`quality`,`security`)},{id:`localization`,label:`Localization`,icon:j,href:r(`quality`,`localization`)}]})]}),h&&!O&&(0,Q.jsx)(q,{more:(0,Q.jsx)(Q.Fragment,{children:`Passive smoke checks read from what each run recorded: the pages' security headers, the flags of the cookies they set, http requests from https pages, redirects to an address taken from the URL, and keys or tokens in API answers. Nothing is sent to the site, and runs on an environment named like production are not checked.`}),children:`Security problems each browser run's pages showed, found without touching the site.`}),_&&!D&&(0,Q.jsx)(q,{more:(0,Q.jsx)(Q.Fragment,{children:`Each page is checked for translation keys shown as text, English left on a page in another language, and text cut off or running past its box. Then, for a moment the run never sees, the page is shown with pseudo-localized text (accented and a third longer) and right to left, to find what breaks in German or Arabic before it is translated. Run a flow in each language your site has.`}),children:`Each page a browser run visited, checked for its language and for what breaks when it is translated.`}),!A&&!h&&!_&&!w&&(0,Q.jsx)(q,{more:(0,Q.jsxs)(Q.Fragment,{children:[`Each browser run measures accessibility (`,t?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run. Open a run for all its details, or one kind with its agent: `,(0,Q.jsx)(`a`,{href:r(`accessibility`,`agent`),children:`Accessibility`}),`, `,(0,Q.jsx)(`a`,{href:r(`performance`,`agent`),children:`Performance`}),` or `,(0,Q.jsx)(`a`,{href:r(`visual`,`agent`),children:`Visual`}),`.`]}),children:`How accessible, fast and visually unchanged the pages of each browser run were.`}),a&&(0,Q.jsx)(`p`,{role:`alert`,className:c(y.fail,`m-0`),children:a}),!t&&!a&&!w&&(0,Q.jsx)(S,{shape:`rows`}),h&&(0,Q.jsx)(Ke,{id:O}),b&&(0,Q.jsx)(Oe,{id:d,asked:p}),x&&(0,Q.jsx)(Ve,{}),C&&(0,Q.jsx)(qe,{}),_&&(0,Q.jsx)(Ie,{id:D}),t&&A&&(0,Q.jsx)(Je,{id:A,asked:d,view:t,onChanged:s},A),t&&!A&&m&&!w&&(0,Q.jsx)(`div`,{role:`tabpanel`,"aria-label":`Trends`,children:(0,Q.jsx)(be,{trends:t.trends})}),t&&!A&&!m&&!h&&!_&&!w&&(t.runs.length?(0,Q.jsx)(Ye,{runs:t.runs}):(0,Q.jsx)(g,{page:!0,icon:F,title:`No measurements yet`,action:(0,Q.jsxs)(`a`,{className:v({size:`sm`}),href:r(`record`),"data-tip":`Record a flow`,children:[(0,Q.jsx)(k,{"aria-hidden":`true`}),`Record`]}),children:`Run a flow from a chat or the Record page, and what it measured shows here. Every browser run checks accessibility, timings and visual changes of the pages it visits.`}))]})]})}export{Xe as Quality};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,P as i,i as a}from"./surface-c1kG1KPS.js";import{t as o}from"./utils-DJRAScIl.js";import{t as s}from"./jsx-runtime-LKYXHABd.js";import{I as c}from"./palette-D8aKJo_q.js";import{v as l}from"./api-DS8XP38R.js";import{F as u,L as d,g as f,n as p}from"./pageBack-DU3mApVL.js";import{Er as m,N as h,P as g,it as _,o as v,z as y}from"./line-icons-Cwj9OmCz.js";import{At as b,Z as x,s as S,t as C}from"./frame-BANehQdX.js";import{J as w,V as T}from"./index-Db_tsLSf.js";import{d as E}from"./qualityParts-C2Y38oFp.js";var D=e(t(),1),O={view:(e,t)=>l(`GET`,`/api/readiness?${new URLSearchParams({...e?{pack:e}:{},...t?{report:t}:{}})}`),signOff:e=>l(`POST`,`/api/readiness/signoff`,{...e,confirmed:!0})},k=s(),A={pass:{label:`Pass`,icon:h,tone:`text-pass`},risk:{label:`Risk`,icon:m,tone:`text-warn`},block:{label:`Blocker`,icon:y,tone:`text-fail`},unknown:{label:`No evidence`,icon:g,tone:`text-muted`}},j={GO:{word:`Go`,tone:`text-pass`,bg:`bg-pass-soft`,text:`Every criterion with evidence passed.`},"GO WITH RISKS":{word:`Go with risks`,tone:`text-warn`,bg:`bg-warn-soft`,text:`Nothing blocks the release, but some criteria are risks or have no evidence yet.`},"NO-GO":{word:`No go`,tone:`text-fail`,bg:`bg-fail-soft`,text:`At least one criterion blocks the release.`},"NO EVIDENCE":{word:`No evidence yet`,tone:`text-muted`,bg:`bg-surface-muted`,text:`Nothing has been measured for this release yet: build and run a regression pack.`}},M={GO:`go`,"GO WITH RISKS":`go-with-risks`,"NO-GO":`no-go`,"NO EVIDENCE":`no-go`};function N({view:e,onDone:t}){let[n,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(M[e.verdict]),[d,f]=(0,D.useState)(``),[p,m]=(0,D.useState)(!1),[g,_]=(0,D.useState)(``),v=async()=>{m(!0);try{let r=await O.signOff({by:n.trim(),decision:c,...d.trim()?{note:d.trim()}:{},...e.pack?{pack:e.pack}:{},...e.report?{report:e.report}:{}});t(r.view,r.file,r.markdown)}catch(e){_(e.message)}finally{m(!1)}};return(0,k.jsxs)(`form`,{"aria-label":`Sign off`,className:o(a,`flex flex-col gap-2 text-body-sm`),onSubmit:e=>{e.preventDefault(),n.trim()&&v()},children:[(0,k.jsxs)(`span`,{children:[`Sign off `,e.release||e.pack||`this release`,` as it is now. The record keeps your name, your decision, ForgeQE's verdict and every criterion with its evidence.`]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1 font-medium`,children:[`Your name`,(0,k.jsx)(i,{size:`sm`,value:n,maxLength:80,onChange:e=>s(e.target.value)})]}),(0,k.jsxs)(`label`,{className:`flex flex-[0_1_200px] flex-col gap-1 font-medium`,children:[`Decision`,(0,k.jsxs)(r,{size:`sm`,value:c,onChange:e=>l(e.target.value),children:[(0,k.jsx)(`option`,{value:`go`,children:`Go`}),(0,k.jsx)(`option`,{value:`go-with-risks`,children:`Go with risks`}),(0,k.jsx)(`option`,{value:`no-go`,children:`No go`})]})]}),(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-1 font-medium`,children:[`Note (optional)`,(0,k.jsx)(i,{size:`sm`,value:d,maxLength:500,onChange:e=>f(e.target.value),placeholder:`Accepted the coupon risk: covered by a manual check`})]}),(0,k.jsxs)(u,{size:`sm`,variant:`primary`,type:`submit`,disabled:p||!n.trim(),children:[(0,k.jsx)(h,{"aria-hidden":`true`}),`Sign off`]})]}),g&&(0,k.jsx)(`p`,{role:`alert`,className:`m-0 text-fail`,children:g})]})}function P(){let[e,t]=(0,D.useState)(null),[i,a]=(0,D.useState)(``),[s,l]=(0,D.useState)(),[m,g]=(0,D.useState)(),[y,M]=(0,D.useState)(!1),[P,F]=(0,D.useState)(null),I=(0,D.useCallback)(()=>{O.view(s,m).then(e=>(t(e),a(``)),e=>a(e.message))},[s,m]);(0,D.useEffect)(I,[I]);let L=e,R=L?{block:L.criteria.filter(e=>e.status===`block`).length,risk:L.criteria.filter(e=>e.status===`risk`).length,unknown:L.criteria.filter(e=>e.status===`unknown`).length}:void 0;return(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(S,{}),(0,k.jsxs)(`main`,{className:o(C,`@container flex-auto gap-4`),children:[(0,k.jsx)(p,{}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,k.jsx)(b,{pixel:c.readiness,size:`lg`,head:!0}),(0,k.jsx)(`h1`,{className:`m-0 text-headline-md`,children:`Release readiness`})]}),(0,k.jsx)(T,{more:(0,k.jsx)(k.Fragment,{children:`The verdict comes from what ForgeQE has measured: the regression pack's last run and the changes it does not cover, the latest readiness report of the test cases and bugs, flaky tests, Quality budgets and Security findings since the pack was built, the agents' Evidence verdicts and exploratory sessions. Any blocker makes it a no go. Each criterion opens the page with its evidence.`}),children:`Decide whether a release is ready to ship, and sign it off.`}),i&&(0,k.jsx)(`p`,{role:`alert`,className:o(d.fail,`m-0`),children:i}),!L&&!i&&(0,k.jsx)(f,{shape:`detail`}),L&&R&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1 text-body-sm font-medium`,children:[`Release (regression pack)`,(0,k.jsxs)(r,{size:`sm`,value:L.pack??``,onChange:e=>(l(e.target.value||void 0),F(null)),disabled:!L.packs.length,children:[!L.packs.length&&(0,k.jsx)(`option`,{value:``,children:`No packs yet`}),L.packs.map(e=>(0,k.jsx)(`option`,{value:e.name,children:e.release?`${e.release} · ${e.name}`:e.name},e.name))]})]}),(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1 text-body-sm font-medium`,children:[`Test cases and bugs (readiness report)`,(0,k.jsxs)(r,{size:`sm`,value:L.report??``,onChange:e=>(g(e.target.value||void 0),F(null)),disabled:!L.reports.length,children:[!L.reports.length&&(0,k.jsx)(`option`,{value:``,children:`No reports yet`}),L.reports.map(e=>(0,k.jsxs)(`option`,{value:e.id,children:[e.scope,` · `,e.verdict,` · `,e.id]},e.id))]})]})]}),(0,k.jsxs)(`section`,{"aria-label":`Verdict`,className:o(`flex flex-wrap items-center gap-x-6 gap-y-2 rounded-md px-4 py-4`,j[L.verdict].bg),children:[(0,k.jsxs)(`div`,{className:`flex flex-col`,children:[(0,k.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`ForgeQE's verdict`,L.release?` for ${L.release}`:``]}),(0,k.jsx)(`span`,{className:o(L.verdict===`NO EVIDENCE`?`text-body-md`:`text-headline-lg`,j[L.verdict].tone),children:j[L.verdict].word})]}),(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1 text-body-sm`,children:[(0,k.jsx)(`span`,{className:`text-ink-2`,children:j[L.verdict].text}),(0,k.jsxs)(`span`,{className:`text-muted`,children:[R.block,` blocker`,R.block===1?``:`s`,` · `,R.risk,` risk`,R.risk===1?``:`s`,` · `,R.unknown,` without evidence`,L.since?(0,k.jsxs)(`span`,{"data-tip":E(L.since),children:[` · measured since the pack was built, `,x(L.since)]}):null]})]}),!y&&(0,k.jsxs)(u,{size:`sm`,onClick:()=>(M(!0),F(null)),children:[(0,k.jsx)(h,{"aria-hidden":`true`}),`Sign off`]})]}),y&&(0,k.jsx)(N,{view:L,onDone:(e,n,r)=>{t(e),M(!1),F({file:n,markdown:r})}}),P&&(0,k.jsxs)(`p`,{role:`status`,className:`m-0 flex flex-wrap items-center gap-2 text-body-sm text-ink-2`,children:[`Signed off: saved as `,(0,k.jsx)(`code`,{className:`font-mono text-body-sm`,children:P.file}),(0,k.jsxs)(u,{size:`sm`,variant:`ghost`,"data-tip":`Download the record`,onClick:()=>{let e=URL.createObjectURL(new Blob([P.markdown],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=`signoff.md`,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},children:[(0,k.jsx)(_,{"aria-hidden":`true`}),`Download`]})]}),(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:L.criteria.map(e=>{let t=A[e.status];return(0,k.jsxs)(`li`,{className:`flex flex-wrap items-start gap-4 border-t border-line-soft py-4 text-body-sm`,children:[(0,k.jsx)(t.icon,{size:16,"aria-label":t.label,className:o(`mt-1 flex-none`,t.tone)}),(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,k.jsxs)(`span`,{className:`font-medium`,children:[e.label,` `,(0,k.jsxs)(`span`,{className:o(`font-normal`,t.tone),children:[`· `,t.label,`: `,e.value]})]}),e.detail.map((e,t)=>(0,k.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]}),e.link.length>0&&(0,k.jsxs)(`a`,{href:n(...e.link.map(encodeURIComponent)),className:`inline-flex items-center gap-1 self-center text-body-sm whitespace-nowrap`,children:[`Open`,(0,k.jsx)(v,{size:14,"aria-hidden":`true`})]})]},e.id)})}),L.signoffs.length>0&&(0,k.jsx)(w,{id:`signoffs`,icon:h,title:`Sign-offs`,children:(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-body-sm`,children:L.signoffs.map(e=>(0,k.jsxs)(`li`,{className:`flex flex-wrap gap-x-2 border-t border-line-soft py-2`,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:e.release}),(0,k.jsx)(`span`,{className:e.decision===`NO-GO`?`text-fail`:e.decision===`GO`?`text-pass`:`text-warn`,children:j[e.decision]?.word??e.decision}),(0,k.jsxs)(`span`,{className:`text-muted`,children:[`by `,e.by,`, `,e.at?E(e.at):e.id,` · ForgeQE said `,j[e.verdict]?.word??e.verdict]})]},e.id))})})]})]})]})}export{P as Readiness};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,L as i,P as a,a as o,c as s,s as c,z as l}from"./surface-c1kG1KPS.js";import{n as u,t as d}from"./utils-DJRAScIl.js";import{t as f}from"./jsx-runtime-LKYXHABd.js";import{G as p,K as m,W as h}from"./palette-D8aKJo_q.js";import{d as g}from"./sectionList-B6NF3ZMb.js";import{T as _,X as v,b as y}from"./api-DS8XP38R.js";import{A as b,F as x,L as S,M as C,O as w,P as T,T as E,g as D,i as O,j as k,k as A}from"./pageBack-DU3mApVL.js";import{$t as j,B as ee,Cn as M,Cr as N,D as te,E as ne,En as P,Er as F,F as I,Fn as L,Gr as R,Gt as z,Hr as B,I as re,In as ie,Kn as ae,L as oe,Lr as se,N as ce,O as le,Or as ue,Pr as de,Rn as fe,Rt as pe,Sn as me,Sr as he,Tn as ge,U as _e,Un as V,Vn as ve,Wr as ye,Wt as be,Zn as xe,Zt as Se,a as Ce,cn as we,cr as Te,f as Ee,fn as De,ft as Oe,gr as ke,hn as Ae,i as je,kr as Me,ln as Ne,lt as Pe,mt as Fe,o as Ie,or as Le,pr as Re,rt as ze,s as Be,tt as Ve,un as He,ur as Ue,vr as We,w as H,wn as Ge,yn as Ke,yt as qe,z as Je,zn as Ye}from"./line-icons-Cwj9OmCz.js";import{G as Xe,Ht as U,J as Ze,On as Qe,Vt as $e,W as et,Y as tt,Z as nt,Zt as rt,ct as it,dt as at,ft as ot,it as W,lt as st,ot as G,rt as ct,ut as lt,v as ut}from"./frame-BANehQdX.js";import{u as dt}from"./nav-f8SqayfG.js";import{J as ft,K,V as pt,Y as mt,l as ht,n as gt,t as _t}from"./index-Db_tsLSf.js";import{t as vt}from"./step-mark-Bu6fNKW8.js";import{n as yt,r as bt,t as xt}from"./recordTest-Cn4qoyRB.js";import{t as St}from"./DeviceScreen-DDERg3YQ.js";import{n as Ct,t as wt}from"./desktopAppPath-BN4vYVi4.js";import{a as Tt,i as Et,n as Dt,o as Ot,r as kt,t as q}from"./DesktopReview-C02n70Wx.js";import{t as At}from"./radio-BLI4Ubhk.js";import{t as jt}from"./AgentWork-D1c_w9rM.js";var J=e(t(),1),Mt=.85;function Nt(e){return!!e&&e.width>0&&e.height>0&&e.width>=e.height*.8}function Pt(e){if(!e||!(e.width>0)||!(e.height>0))return[];let t=e.width*e.height*Mt;return(e.elements||[]).map((e,t)=>({c:e,i:t})).filter(({c:e})=>e.usable&&e.box.length===4&&e.box[2]>0&&e.box[3]>0&&e.box[2]*e.box[3]<t).sort((e,t)=>t.c.box[2]*t.c.box[3]-e.c.box[2]*e.c.box[3])}function Ft(e){try{let t=decodeURIComponent(e??``).trim();return/^https?:\/\/\S+$/i.test(t)&&t.length<=2e3?t:``}catch{return``}}function It(e,t){return t===`mobile`&&/INVALID_APP_ID|app_id\b.*\binvalid|upload app API/i.test(e)?`The device cloud cannot install a build file from this computer. Upload it first (forgeqe mobile upload <file>), then set the app's build to the lt:// or bs:// id it gives, in Settings → Mobile.`:t===`mobile`&&/ECONNREFUSED|ECONNRESET|could not connect|not reachable|timed? ?out/i.test(e)?`Appium or the device cloud did not answer. Check that it is running (forgeqe mobile setup) or that the cloud's sign-in is saved, then try again.`:t===`mobile`&&/\b40[13]\b|unauthori[sz]ed|forbidden|access key/i.test(e)?`The device cloud refused the sign-in. Check its user name and key in Settings → Mobile.`:null}function Lt(e,t,n){if(!Number.isInteger(t)||!Number.isInteger(n)||t===n||t<1||n<1||t>=e.length||n>=e.length||e[t].fixed||e[t].block)return!1;let r=e.filter((e,n)=>n!==t);r.splice(n,0,e[t]);let i=r[n-1]?.block;return!(i&&i===r[n+1]?.block)}var Y=f(),Rt={test_id:`Its test id`,id:`Its id`,role:`What it is and its name`,role_pattern:`What it is and part of its name`,name:`Its name attribute`,label:`Its label`,placeholder:`Its placeholder`,alt:`Its alt text`,href:`Where it links to`,title:`Its title`,text:`Its text`,text_pattern:`Part of its text`,css:`Its tag and class`,within:`The card or row it sits in`,xpath:`Its place in the page`},zt={generated:{found:`a value the page's framework made, which is different on the next load`,alone:`It is a value the page's framework made, so it is different on the next load.`},live_data:{found:`data that changes between runs (a price, a date, an order number)`,alone:`It holds data that changes between runs (a price, a date, an order number).`},varies:{found:`a value the page gave this element only on that load`,alone:`The page gave this element another value when the recording loaded the same page again.`}},Bt=e=>`${Rt[e.type]||e.type}: ${e.value}`,Vt=[{id:`typed`,label:`As typed`,note:`The test types exactly this.`},{id:`data`,label:`Test data`,note:`A named value the test reads from its data, one per environment.`},{id:`unique`,label:`New on each run`,note:`A fresh value each time, like this one: for an email or a name that must not repeat.`},{id:`secret`,label:`Secret`,note:`Read from the environment when the test runs; what was typed is removed from the recording.`},{id:`date`,label:`A date from today`,note:`The same number of days ahead on each run, so a date that has passed is never used.`},{id:`any`,label:`Any free one`,note:`Each run takes the first free one (an open slot, or a list's first option that is not disabled); later checks compare with what it picked.`}],Ht=new Set([`data`,`date`,`any`]),Ut={label:`As clicked`,note:`The test clicks exactly this one.`},Wt=(e,t)=>e.op===`click`&&t===`typed`?Ut.label:Vt.find(e=>e.id===t)?.label,Gt=(e,t)=>e.op===`click`&&t===`typed`?Ut.note:Vt.find(e=>e.id===t)?.note,Kt=e=>{let t=e.value;return Vt.filter(n=>t.choices?t.choices.includes(n.id):e.op===`select`?n.id===`typed`||n.id===`data`:n.id!==`date`&&n.id!==`any`)},qt=[`steps`,`data`,`run`,`instructions`,`blocks`,`history`];function Jt({runDir:e,onClose:t,onRecordMore:n,notices:o,tab:s,onTab:c}){let[f,p]=(0,J.useState)(null),[m,g]=(0,J.useState)(``),[_,y]=(0,J.useState)(!1),[C,D]=(0,J.useState)(`steps`),O=c?qt.includes(s??``)?s:`steps`:C,k=e=>c?c(e):D(e),[j,ee]=(0,J.useState)(``),[M,te]=(0,J.useState)(!1),[P,L]=(0,J.useState)(null);(0,J.useEffect)(()=>L(null),[O,f]);let[z,B]=(0,J.useState)(null),[re,le]=(0,J.useState)(!1),[ue,de]=(0,J.useState)(null),[pe,he]=(0,J.useState)(null),[ge,_e]=(0,J.useState)(null),[V,xe]=(0,J.useState)(new Set),Se=e=>xe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[we,De]=(0,J.useState)({}),Oe=e=>we[e.n]??(!e.ok&&!e.skipped),[ke,Ae]=(0,J.useState)(null),[Me,Ie]=(0,J.useState)(``),[Le,ze]=(0,J.useState)(`all`),[He,We]=(0,J.useState)(null),[Ge,qe]=(0,J.useState)(!1),[Ye,Xe]=(0,J.useState)(``),[Ze,Qe]=(0,J.useState)(``),[et,it]=(0,J.useState)([]),[at,ot]=(0,J.useState)(void 0),[W,st]=(0,J.useState)({from:0,to:0,name:``,section:``}),[G,ct]=(0,J.useState)({block:``,after:0}),[lt,ut]=(0,J.useState)({values:{},secrets:{}}),[dt,ft]=(0,J.useState)([]),[K,pt]=(0,J.useState)(null),[ht,gt]=(0,J.useState)(null),[_t,vt]=(0,J.useState)(``),yt=et.filter(e=>(e.kind??`web`)===`web`),St=(e=>e?et.filter(t=>`${t.name} ${t.section??``} ${t.description??``}`.toLowerCase().includes(e)):et)(_t.trim().toLowerCase()),[Ct,wt]=(0,J.useState)(``),[q,At]=(0,J.useState)(null),[Mt,Nt]=(0,J.useState)(``),[Pt,Ft]=(0,J.useState)({}),It=(0,J.useRef)(null),[Rt,Bt]=(0,J.useState)(``),[Vt,Ut]=(0,J.useState)(``),[Jt,rn]=(0,J.useState)(null),[an,on]=(0,J.useState)(!1),[sn,cn]=(0,J.useState)(!1),[fn,mn]=(0,J.useState)(``),[gn,_n]=(0,J.useState)(!1),[vn,yn]=(0,J.useState)(!1),[bn,xn]=(0,J.useState)(null),[Sn,Cn]=(0,J.useState)(``);(0,J.useEffect)(()=>{let t=!1;return v.review(e).then(e=>{t||(p(e),ee(e.name),Qe(e.instructions))},e=>!t&&g(e.message)),()=>{t=!0}},[e]),(0,J.useEffect)(()=>{v.blocks().then(e=>{it(e.blocks),ot(e.shared),ft(e.secrets??[]),ut(Et(e.blocks.find(e=>(e.kind??`web`)===`web`),e.secrets??[]))},()=>it([]))},[]),(0,J.useEffect)(()=>{let t=!1;return v.tryView(e).then(e=>{if(t)return;let n=new Map((It.current??[]).map(e=>[e.name,e.value]));It.current=e.data,At(e),Ft(t=>Object.fromEntries(e.data.map(e=>[e.name,t[e.name]!==void 0&&t[e.name]!==n.get(e.name)?t[e.name]:e.value])))},()=>{}),()=>{t=!0}},[e,f]);let wn=()=>v.review(e).then(e=>p(t=>t&&{...t,test:e.test}),()=>{}),Tn=f?.test?.state===`writing`||f?.test?.state===`checking`;(0,J.useEffect)(()=>{if(!Tn)return;let e=U(()=>void wn(),2500);return()=>$e(e)},[Tn,e]);let X=q?.running===e,En=q?.result?`${q.result.ms??0}-${q.result.env??``}-${q.result.steps.length}-${q.result.ok}`:``;(0,J.useEffect)(()=>De({}),[En]),(0,J.useEffect)(()=>{if(!X)return;let t=U(()=>{v.tryView(e).then(At,()=>{})},1500);return()=>$e(t)},[X,e]);let Dn=()=>Object.fromEntries(Object.entries(Pt).filter(([e,t])=>t!==q?.data.find(t=>t.name===e)?.value)),On=()=>Rt.startsWith(`file:`)?{file:Rt.slice(5),...Vt.trim()&&/\.xls[xm]$/i.test(Rt)?{sheet:Vt.trim()}:{}}:Rt.startsWith(`request:`)?{request:Rt.slice(8)}:void 0,kn=async t=>{g(``),on(!0);try{let n=await v.write(e,{check:t,env:Mt,data:Dn(),each:On()});p(e=>e&&{...e,test:n.test}),At(n.try),t&&rn(f)}catch(e){g(e.message)}finally{on(!1)}},An=async()=>{g(``),Cn(``),xn(null),yn(!1);try{let t=await v.tryRun(e,Mt,Dn(),On());rn(f),At(t)}catch(e){g(e.message)}},jn=async()=>{g(``),Cn(``),xn(null),yn(!0);try{let t=await v.reheal(e,Mt,Dn(),On());rn(f),At(t)}catch(e){g(e.message),yn(!1)}},Mn=async t=>{y(!0),g(``),Cn(``);try{let n=await v.acceptReheals(e,t);At(n.try),xn(n.heals),n.written?Cn(`${u(n.written,`step`)} now ${n.written===1?`uses`:`use`} the locator the re-record found.${n.skipped.length?` ${u(n.skipped.length,`heal`)} left: ${n.skipped[0].why}.`:``}`):g(`Nothing was changed: ${n.skipped[0]?.why??`those steps have no heal.`}`)}catch(e){g(e.message)}finally{y(!1)}},Nn=async()=>{g(``);try{At(await v.tryStop(e)),wn()}catch(e){g(e.message)}},Pn=async()=>{g(``),_n(!0);try{let t=await v.stopWrite(e);p(e=>e&&{...e,test:t.test})}catch(e){g(e.message)}finally{_n(!1)}},Fn=async()=>{y(!0),g(``),wt(``);try{let t=await v.saveBlock(e,W.name.trim(),W.from,W.to,W.section.trim());it(t.blocks);let n=t.block.inputs.length?` It takes ${t.block.inputs.map(e=>e.label||e.name).join(`, `)} each time it is used.`:``;wt(`Kept as the block "${t.block.name}": put it into other recordings, or start one from it on the Record page.${n}`),st({...W,name:``})}catch(e){g(e.message)}finally{y(!1)}},In=async(t,n)=>{y(!0),g(``);try{let r=await v.updateBlock(t,n);it(r.blocks),pt(null),p(await v.review(e))}catch(e){g(e.message)}finally{y(!1)}},Ln=async e=>{y(!0),g(``);try{let t=await v.deleteBlock(e,ht?.id===e);it(t.blocks),gt(null),G.block!==e&&G.block||(ct({...G,block:``}),ut(Et(t.blocks.find(e=>(e.kind??`web`)===`web`),dt)))}catch(t){let n=t;n.status===409?gt({id:e,why:n.message}):g(n.message)}finally{y(!1)}},Z=async t=>{y(!0),g(``);try{let n=`restore`in t?await v.restoreReview(e,t.restore):`insert`in t?await v.insertBlock(e,t.insert.after,t.insert.block,t.insert.use&&Ot(t.insert.use)):`refreshBlock`in t?await v.refreshBlock(e,t.refreshBlock.block,t.refreshBlock.from):`useBlock`in t?await v.useBlock(e,t.useBlock.block,t.useBlock.from):await v.saveReview(e,t);p(n),ee(n.name),Qe(n.instructions)}catch(e){g(e.message)}finally{y(!1)}},Rn=async()=>{qe(!0),Xe(``);try{let t=await v.suggest(e);We(t.picks),Xe(t.error||(t.picks.length?``:`The model found nothing more to check.`))}catch(e){Xe(e.message)}finally{qe(!1)}},zn=e=>e.kind===`data`||e.kind===`unique`?{data:[{index:e.after,as:e.kind}]}:{checks:[{after:e.after,kind:e.kind,text:e.text}]},Bn=async e=>{for(let t of e)await Z(zn(t));We(t=>(t||[]).filter(t=>!e.includes(t)))};if(!f)return m?(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:m}):(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Reading the recording…`});let Vn=f.steps.filter(e=>e.value),Hn=f.steps.filter(e=>e.kept),Un=f.steps.filter(e=>e.op===`expect`).length,Q=X?void 0:q?.result,Wn=new Map((Q?.steps??[]).map(e=>[e.n-1,e])),Gn=Q?.steps.find(e=>!e.ok),Kn=Gn?Gn.n-1:-1,qn=Kn>=0?f.steps[Kn]:void 0,Jn=!!Q&&!!Jt&&Jt!==f,Yn=(Q?.steps??[]).filter(e=>!e.ok).length,Xn=Me.toLowerCase().split(/\s+/).filter(Boolean),Zn=f.steps.filter(e=>Xn.every(t=>`${e.index+1} ${e.line} ${e.note||``}`.toLowerCase().includes(t))&&(Le===`all`||(Le===`checks`?e.op===`expect`:Wn.get(e.index)?.ok===!1))),Qn=e=>{k(`steps`),ze(`all`),Ie(``);let t=n=>requestAnimationFrame(()=>{let r=document.getElementById(`step-${e}`);r?r.scrollIntoView({block:`center`,behavior:l()}):n>0&&t(n-1)});t(30)},$n=!!q?.running&&!X,$=bt(f.test),er=()=>void kn(!(Q?.ok&&Jt===f)),tr=X&&!!q?.stopping,nr=an||$.writing,rr=[{id:`steps`,label:`Steps`,icon:Ne,n:f.steps.length},{id:`data`,label:`Test data`,icon:Ve,n:Vn.length+Hn.length},{id:`run`,label:`Runs`,icon:fe,...q?.runs?.length?{n:q.runs.length}:{}},{id:`instructions`,label:`Instructions`,icon:Ke},{id:`blocks`,label:`Blocks`,icon:Ee},{id:`history`,label:`Versions`,icon:be,n:f.history.length}];return(0,Y.jsxs)(`section`,{"aria-labelledby":`review-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-1 flex flex-col gap-4 border-b border-line bg-canvas px-1 py-4`,children:[(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:t&&(0,Y.jsxs)(x,{size:`sm`,variant:`ghost`,onClick:t,className:`-ml-2 text-ink-2`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),`Recordings`]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[M?(0,Y.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),te(!1),j.trim()&&j.trim()!==f.name&&Z({name:j.trim()})},children:[(0,Y.jsx)(a,{"aria-label":`Name of the recording`,value:j,maxLength:200,autoFocus:!0,onChange:e=>ee(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>{ee(f.name),te(!1)},children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}):(0,Y.jsx)(mt,{id:`review-title`,icon:I,title:(0,Y.jsx)(`span`,{"data-tip":f.name,children:f.name}),actions:(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Rename the recording`,"data-tip":`Rename the recording`,onClick:()=>te(!0),className:`size-8 flex-none`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Y.jsxs)(`span`,{children:[u(f.steps.length,`step`),` · `,u(Un,`check`)]}),X?(0,Y.jsx)(A,{tone:`running`,children:tr?`Stopping…`:`Running the steps…`}):Q?.stopped?(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:`Last run stopped`}):Q?(0,Y.jsx)(A,{tone:Q.ok?`pass`:`fail`,children:Q.ok?`Last run passed${Q.env?` on ${Q.env}`:``}`:Gn?`Last run failed at step ${Gn.n}`:`Last run did not get through`}):(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:`Not run yet`}),Jn&&(0,Y.jsx)(`span`,{children:`· you changed it since`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-body-sm`,"aria-label":`The test written from this recording`,children:[(0,Y.jsx)(A,{tone:$.tone,icon:$.tone!==`neutral`,children:$.label}),f.test?.testFile&&$.hasTest&&(0,Y.jsxs)(x,{variant:`link`,size:`inline`,onClick:async()=>mn(await xt(f.test.testFile)),"data-tip":`Open ${f.test.testFile}${f.test.repo?` in ${f.test.repo}`:``}`,className:`min-w-0 gap-1 font-mono`,children:[(0,Y.jsx)(Fe,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:f.test.testFile})]}),f.test&&!$.writing&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,nt(f.test.at)]}),(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:$.detail}),fn&&(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-fail [overflow-wrap:anywhere]`,children:fn})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[X?(0,Y.jsxs)(x,{busy:tr,variant:`destructive`,disabled:tr,onClick:()=>void Nn(),"data-tip":`Stop the run and close its browser`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),tr?`Stopping…`:`Stop`]}):(0,Y.jsxs)(x,{disabled:$n||nr,onClick:()=>void An(),"data-tip":$n?`Another run is going`:`Play the steps in a new browser, as the test will`,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),`Re-run`]}),f.test?.state===`writing`?(0,Y.jsxs)(x,{busy:gn,variant:`destructive`,disabled:gn,onClick:()=>void Pn(),"data-tip":`Stop Quill: what it changed so far is kept, and Write carries on from there`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),gn?`Stopping…`:`Stop writing`]}):(0,Y.jsxs)(x,{busy:f.test?.state===`checking`,variant:$.hasTest&&!$.writing?`outline`:`primary`,disabled:_||X||$n||nr||$.writing,onClick:()=>$.hasTest?cn(!0):er(),"data-tip":$.writing?`A test is being written from this recording`:$.hasTest?`Update ${f.test?.testFile}: the steps are run first; when they work, Quill changes that test to match the recording`:`Write the test: the steps are run first; when they work, Quill writes the test in your repository's style`,children:[(0,Y.jsx)(Re,{"aria-hidden":`true`}),f.test?.state===`checking`?`Checking…`:an||$.writing?$.hasTest?`Updating…`:`Writing…`:$.hasTest?`Update the test`:`Write the test`]})]})]})]}),o,m&&(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:m}),Q&&!Q.ok&&(0,Y.jsxs)(`div`,{role:`alert`,className:d(S.fail,`flex flex-col gap-2`),children:[(0,Y.jsxs)(`p`,{className:`m-0 font-medium text-fail [overflow-wrap:anywhere]`,children:[Gn?`Step ${Gn.n} failed${Q.env?` on ${Q.env}`:``}`:`The run did not get through${Q.env?` on ${Q.env}`:``}`,Jn&&(0,Y.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),qn&&(0,Y.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:qn.line}),(0,Y.jsx)(`p`,{className:`m-0 line-clamp-3 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,"data-tip":(Gn?Gn.error:Q.error)||void 0,children:(Gn?Gn.error:Q.error)||(Gn?`It failed.`:`The last page was not the recorded one.`)}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[qn&&(0,Y.jsxs)(x,{size:`sm`,onClick:()=>Qn(Kn),"data-tip":`Show the failed step`,children:[(0,Y.jsx)(Pe,{"aria-hidden":`true`}),`Show`]}),qn&&n&&Kn>0&&(0,Y.jsxs)(x,{size:`sm`,onClick:()=>n(Kn,!0),"data-tip":`The browser does the steps before it; you do this step again, and what you record takes its place`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Record`]}),qn&&!qn.fixed&&(0,Y.jsxs)(x,{size:`sm`,variant:`danger`,disabled:_,onClick:()=>void Z({remove:[Kn]}),"data-tip":`Drop the failed step`,children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Remove`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`ghost`,disabled:nr,onClick:()=>void kn(!1),"data-tip":`Write the test anyway`,children:[(0,Y.jsx)(Re,{"aria-hidden":`true`}),`Write`]})]})]}),f.test?.chat&&(0,Y.jsx)(jt,{id:f.test.chat,onEnd:()=>void wn(),label:$.hasTest?`Quill updating the test`:`Quill writing the test`,done:$.hasTest?`The test is updated.`:`The test is written.`,failed:$.hasTest?`The test could not be updated.`:`The test could not be written.`},f.test.chat),sn&&f.test?.testFile&&(0,Y.jsx)(rt,{open:!0,onClose:()=>cn(!1),title:`Update the test?`,description:`A test was already written from this recording: ${f.test.testFile}. Quill updates that test so it matches the recording as it is now. No second test is added.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(x,{variant:`outline`,onClick:()=>cn(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(x,{variant:`primary`,onClick:()=>{cn(!1),er()},children:[(0,Y.jsx)(Re,{"aria-hidden":`true`}),`Update the test`]})]}),children:(0,Y.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-ink-2`,children:`The steps are played first; the test is changed only when they work.`})}),(e=>e.length>0&&(0,Y.jsxs)(`div`,{role:`status`,className:d(S.warn,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:F,size:16,className:`flex-none`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`The test reads `,e.length===1?`the secret`:`the secrets`,` `,e.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t>0&&`, `,(0,Y.jsx)(`code`,{children:e})]},e)),`, which `,e.length===1?`has`:`have`,` no value on this computer: save `,e.length===1?`it`:`them`,` in Settings › Secrets, or runs of this recording stop at that step.`]})]}))((f.secrets??[]).filter(e=>!e.set).map(e=>e.name)),f.blocksStale?.map(e=>(0,Y.jsxs)(`div`,{role:`status`,className:d(S.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:Ee,size:16,className:`flex-none`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are `,e.version?`version ${e.version}`:`an older version`,` of the block `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:e.name}),`; version `,e.latest,` is saved now.`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:_,onClick:()=>void Z({refreshBlock:{block:e.block,from:e.from}}),"data-tip":`Put the saved version in their place, with the same values`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Update`]})]},`stale-${e.block}-${e.from}`)),f.blocksFound?.map(e=>(0,Y.jsxs)(`div`,{role:`status`,className:d(S.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:Ee,size:16,className:`flex-none`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are the block `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:e.name}),`: the test can call its helper instead.`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:_,onClick:()=>void Z({useBlock:{block:e.block,from:e.from}}),"data-tip":`Use the block: the test calls its helper instead`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Use`]})]},`${e.block}-${e.from}`)),(0,Y.jsx)(tt,{prefix:`rev`,label:`This recording`,className:`mb-0`,current:O,onPick:k,tabs:rr.map(e=>({id:e.id,label:e.label,...e.id===`run`&&Q?{n:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e.n!==void 0&&e.n,Q.ok?(0,Y.jsx)(ce,{size:12,role:`img`,"aria-label":`passed`,className:`text-pass`}):(0,Y.jsx)(Je,{size:12,role:`img`,"aria-label":`failed`,className:`text-fail`})]})}:e.n===void 0?{}:{n:e.n}}))}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`rev-panel-${O}`,"aria-labelledby":`rev-${O}`,className:`flex min-w-0 flex-col gap-4`,children:[O===`steps`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(w,{id:`rev-step-search`,label:`Find a step`,value:Me,onChange:Ie}),(0,Y.jsx)(E,{items:[{id:`all`,label:`All`,n:f.steps.length},{id:`checks`,label:`Checks`,n:Un},...Yn?[{id:`failed`,label:`Failed`,n:Yn,alert:!0}]:[]],value:Le,onChange:ze}),(0,Y.jsx)(`span`,{className:`flex-1`}),(0,Y.jsxs)(x,{busy:Ge,size:`sm`,variant:`ghost`,disabled:Ge||_,onClick:()=>void Rn(),"data-tip":`Suggest checks: one model call reads the pages after each step and suggests checks and test data`,children:[(0,Y.jsx)(se,{"aria-hidden":`true`}),Ge?`Asking…`:`Suggest`]})]}),(f.videos?.includes(`recording`)||f.log)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f.videos?.includes(`recording`)&&(0,Y.jsx)(Xt,{runDir:e,kind:`recording`}),f.log&&(0,Y.jsx)(Zt,{runDir:e,which:`recording`,label:`Recording log`})]}),Ye&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:Ye}),He&&He.length>0&&(0,Y.jsxs)(`div`,{className:d(S.info,`flex flex-col gap-2`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-body-sm`,children:[(0,Y.jsx)(T,{icon:Te,size:14}),(0,Y.jsx)(`span`,{className:`flex-1 font-medium`,children:`The model suggests`}),(0,Y.jsxs)(x,{size:`sm`,disabled:_,onClick:()=>void Bn(He),"data-tip":`Add all the suggestions`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add all`]}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Dismiss the suggestions`,"data-tip":`Dismiss the suggestions`,onClick:()=>We(null),className:`size-8`,children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:He.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-body-sm`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[e.kind===`data`||e.kind===`unique`?e.label:`After step ${e.after+1}: ${e.label}`,e.why&&(0,Y.jsxs)(`span`,{className:`text-ink-2`,children:[` · `,e.why]})]}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Add: ${e.label}`,"data-tip":`Add: ${e.label}`,onClick:()=>void Bn([e]),className:`size-8`,children:(0,Y.jsx)(ve,{"aria-hidden":`true`})})]},`${e.after}-${e.kind}-${e.text}`))})]}),Zn.length===0?(0,Y.jsx)(`p`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 text-body-sm text-muted`),children:`No step matches.`}):(0,Y.jsx)(`ol`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col overflow-hidden p-0`),children:Zn.map((t,r)=>{let i=Wn.get(t.index),a=t.op===`expect`;return(0,Y.jsxs)(`li`,{id:`step-${t.index}`,className:d(`flex scroll-mt-48 flex-col`,r>0&&`border-t border-line-soft`,i&&!i.ok&&`bg-fail-soft`),children:[(0,Y.jsxs)(`div`,{className:`group flex min-h-11 items-start gap-4 px-4 py-2`,children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right font-mono text-body-sm text-muted tabular-nums`,children:t.index+1}),(0,Y.jsx)(`span`,{className:`flex w-4 flex-none justify-center pt-1`,children:i?i.skipped?(0,Y.jsx)(me,{size:14,"aria-label":`Not replayed`,className:`text-muted`}):i.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed on the last run`,className:`text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed on the last run`,className:`text-fail`}):a?(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1 size-1.5 rounded-full bg-line-strong`})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[a&&(0,Y.jsx)(A,{tone:`pass`,icon:!1,className:`min-h-5 px-2 text-body-sm`,children:`Check`}),(0,Y.jsx)(`span`,{className:`min-w-0 text-body-sm text-ink [overflow-wrap:anywhere]`,children:t.line}),t.block&&(0,Y.jsxs)(A,{tone:`neutral`,icon:!1,children:[(0,Y.jsx)(T,{icon:Ee,size:11}),et.find(e=>e.id===t.block)?.name||t.block]})]}),t.value&&(0,Y.jsx)(pn,{step:t,busy:_,open:ue===t.index,onOpen:e=>de(e?t.index:null),sources:Kt(t),onSave:e=>void Z(e)},dn(t)),t.note&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Note: `,t.note]}),(e=>{if(!e?.risk)return null;let n=(t.locators?.length??0)>1&&!!t.detail?.length,r=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{icon:F,size:12,className:`mt-px flex-none`}),(0,Y.jsxs)(`span`,{children:[`This step is found by `,zt[e.risk].found,`.`,n?` Pick another way to find it.`:``]})]});return n?(0,Y.jsx)(x,{variant:`link`,size:`inline`,"aria-expanded":V.has(t.index),onClick:()=>Se(t.index),className:`items-start gap-1 self-start whitespace-normal text-left text-warn hover:text-warn`,children:r}):(0,Y.jsx)(`span`,{className:`inline-flex items-start gap-1 self-start text-body-sm text-warn`,children:r})})(t.locators?.find(e=>e.chosen)),i&&!i.ok&&i.error&&(0,Y.jsx)(`span`,{className:`line-clamp-2 text-body-sm text-fail [overflow-wrap:anywhere]`,"data-tip":i.error,children:i.error}),t.suggest&&t.suggest.length>0&&(0,Y.jsxs)(x,{variant:`link`,size:`inline`,"aria-expanded":ke===t.index,onClick:()=>Ae(ke===t.index?null:t.index),className:`gap-1 self-start`,children:[(0,Y.jsx)(T,{icon:Te,size:12}),ke===t.index?`Hide the suggested checks`:`${u(t.suggest.length,`suggested check`)}`]})]}),(0,Y.jsxs)(`span`,{className:`relative flex flex-none items-center gap-1`,children:[t.start&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-expanded":re,"aria-label":`Change the start page`,"data-tip":`Change the start page`,onClick:()=>le(!re),className:`size-8`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-haspopup":`menu`,"aria-expanded":z===t.index,"aria-label":`Add a check, step, note${et.length?` or block`:``} after step ${t.index+1}`,"data-tip":`Add a check, step, note${et.length?` or block`:``} after step ${t.index+1}`,onClick:()=>B(z===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(ve,{"aria-hidden":`true`})}),(0,Y.jsx)(h,{open:z===t.index,onClose:()=>B(null),label:`Add after step ${t.index+1}`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsx)(un,{step:t,blocks:yt,secrets:dt,onAddBlock:(e,n)=>{B(null),Z({insert:{after:t.index,block:e,use:n}})},...n?{onRecordMore:()=>{B(null),n(t.index)}}:{},onAdd:e=>{B(null),Z(e)}})}),t.check&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-haspopup":`dialog`,"aria-expanded":ge===t.index,"aria-label":`Change how check ${t.index+1} compares`,"data-tip":`Change how check ${t.index+1} compares`,onClick:()=>_e(ge===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})}),(0,Y.jsx)(h,{open:ge===t.index,onClose:()=>_e(null),label:`How check ${t.index+1} compares`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsx)(ln,{check:t.check,onSave:e=>{_e(null),Z({matches:[{index:t.index,...e}]})}})})]}),t.detail&&t.detail.length>0&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`What was recorded for step ${t.index+1}`,"aria-expanded":V.has(t.index),"data-tip":`What was recorded for step ${t.index+1}`,onClick:()=>Se(t.index),className:`size-8`,children:(0,Y.jsx)(ne,{"aria-hidden":`true`,className:d(`transition-transform`,V.has(t.index)&&`rotate-180`)})}),t.shot&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${t.index+1}`,"aria-expanded":pe===t.index,"data-tip":`See the page after step ${t.index+1}`,onClick:()=>he(pe===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(Pe,{"aria-hidden":`true`})}),!t.fixed&&!t.block&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_||!Lt(f.steps,t.index,t.index-1),"aria-label":`Move step ${t.index+1} up`,"data-tip":`Move step ${t.index+1} up`,onClick:()=>void Z({move:{index:t.index,to:t.index-1}}),className:`size-8`,children:(0,Y.jsx)(Be,{"aria-hidden":`true`})}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_||!Lt(f.steps,t.index,t.index+1),"aria-label":`Move step ${t.index+1} down`,"data-tip":`Move step ${t.index+1} down`,onClick:()=>void Z({move:{index:t.index,to:t.index+1}}),className:`size-8`,children:(0,Y.jsx)(je,{"aria-hidden":`true`})})]}),!t.fixed&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Drop step ${t.index+1}`,"data-tip":`Drop step ${t.index+1}`,onClick:()=>void Z({remove:[t.index]}),className:`size-8`,children:(0,Y.jsx)(N,{"aria-hidden":`true`})})]})]}),re&&t.start&&(0,Y.jsx)(hn,{start:t.start,busy:_,onCancel:()=>le(!1),onSave:(e,t)=>{le(!1),Z({start:{url:e,site:t}})}},t.start),ke===t.index&&t.suggest&&t.suggest.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pr-4 pb-2 pl-4 sm:pl-20`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`Add a check that`}),t.suggest.map(e=>(0,Y.jsxs)(x,{size:`sm`,disabled:_,"data-tip":`Add this check after the step`,onClick:()=>void Z({checks:[{after:t.index,kind:e.kind,text:e.text,...e.frame===void 0?{}:{frame:e.frame}}]}),className:`h-7 min-h-7 max-w-full rounded-full px-2 text-body-sm`,children:[(0,Y.jsx)(oe,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.label})]},`${e.kind}-${e.text}`))]}),V.has(t.index)&&t.detail&&(0,Y.jsx)(tn,{rows:t.detail,n:t.index+1,locators:t.locators,busy:_,onPick:e=>void Z({locator:[{index:t.index,pick:e}]})}),pe===t.index&&t.shot&&t.snap&&(0,Y.jsx)(nn,{runDir:e,step:t,busy:_,onPick:(e,n,r)=>void Z({checks:[{after:t.index,kind:e,text:n,...r===void 0?{}:{frame:r}}]})})]},`${t.index}-${t.line}`)})})]}),O===`data`&&Hn.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Values read off the page while the test runs, kept under a name for the steps after them.`}),(0,Y.jsx)(`ul`,{"aria-label":`Values the test keeps`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:Hn.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.index+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Kept as `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:`{{${e.kept}}}`})]})]})]},e.index))})]}),O===`data`&&(Vn.length===0?Hn.length>0?null:(0,Y.jsx)(b,{className:`py-4`,children:`Nothing was typed, chosen or clicked as data in this recording, so it has no test data.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Where each value you typed, chose or clicked comes from when the test runs. A slot or a day that cannot be used twice can be any free one or a date from today.`}),(0,Y.jsx)(`ul`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:Vn.map((e,t)=>{let n=e.value,i=Kt(e);return(0,Y.jsxs)(`li`,{className:d(`flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.index+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:Gt(e,n.as)}),(0,Y.jsx)(pn,{step:e,busy:_,onSave:e=>void Z(e)},dn(e)),n.name&&Ht.has(n.as)&&P?.index!==e.index&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-body-sm text-ink-2`,children:[`Named `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:n.name}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Rename ${n.name}`,"data-tip":`Rename ${n.name}`,disabled:_,onClick:()=>L({index:e.index,name:n.name}),className:`size-8 flex-none`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})})]}),P?.index===e.index&&(0,Y.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault();let r=P.name.trim();L(null),r&&r!==n.name&&Z({data:[{index:e.index,as:n.as,name:r}]})},children:[(0,Y.jsx)(a,{"aria-label":`Name of the value of step ${e.index+1}`,value:P.name,maxLength:40,autoFocus:!0,placeholder:`lower_case_name`,onChange:e=>L({...P,name:e.target.value}),className:`min-w-0 flex-1 font-mono`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>L(null),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]})]}),(0,Y.jsx)(r,{"aria-label":`Where the value of step ${e.index+1} comes from`,value:n.as,disabled:_,onChange:t=>void Z({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:i.map(t=>(0,Y.jsx)(`option`,{value:t.id,children:Wt(e,t.id)},t.id))})]},e.index)})})]})),O===`run`&&q&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Re-run plays the steps in a new browser, as the test will, so you know they work before the test is written. Choose where it runs and the values it types. Re-record plays them the same way, but a control that moved is reached through another locator the recorder kept for that step, and you choose whether the recording takes it.`}),(0,Y.jsxs)(`form`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-end gap-4`),onSubmit:e=>{e.preventDefault(),An()},children:[q.environments.length>0&&(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Environment`,(0,Y.jsxs)(r,{value:Mt,onChange:e=>Nt(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`Where it was recorded`}),q.environments.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[e,e===q.environment?` (active)`:``]},e))]})]}),q.data.length>0&&!!(q.sources?.files.length||q.sources?.requests.length)&&(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Test data`,(0,Y.jsxs)(r,{value:Rt,onChange:e=>Bt(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The values typed here`}),!!q.sources?.files.length&&(0,Y.jsx)(`optgroup`,{label:`Each row of a data file`,children:q.sources.files.map(e=>(0,Y.jsx)(`option`,{value:`file:${e}`,children:e},e))}),!!q.sources?.requests.length&&(0,Y.jsx)(`optgroup`,{label:`Each row of a kept request`,children:q.sources.requests.map(e=>(0,Y.jsx)(`option`,{value:`request:${e}`,children:e},e))})]})]}),/\.xls[xm]$/i.test(Rt)&&(0,Y.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Sheet`,(0,Y.jsx)(a,{value:Vt,maxLength:100,placeholder:`The first sheet`,onChange:e=>Ut(e.target.value)})]}),!Rt&&q.data.map(e=>(0,Y.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[(0,Y.jsxs)(`span`,{children:[e.name,e.env&&(0,Y.jsx)(`span`,{className:`font-normal text-muted`,children:` · from the environment`})]}),(0,Y.jsx)(a,{value:Pt[e.name]??``,maxLength:300,onChange:t=>Ft({...Pt,[e.name]:t.target.value})})]},e.name)),(0,Y.jsxs)(x,{type:`submit`,disabled:X||$n||nr||_,"data-tip":$n?`Another run is going`:void 0,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),X&&!vn?`Running…`:`Re-run`]}),(0,Y.jsxs)(x,{disabled:X||$n||nr||_,onClick:()=>void jn(),"data-tip":$n?`Another run is going`:`Play the steps and reach a control that moved through another of its recorded locators`,children:[(0,Y.jsx)(ye,{"aria-hidden":`true`}),X&&vn?`Re-recording…`:`Re-record`]})]}),Rt&&(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`The steps play once for each row (up to 20), one after another. A column named like the test data (`,q.data.map(e=>e.name).join(`, `),`) gives its value; other columns are left out.`]}),X&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(A,{tone:`running`,children:tr?`Stopping: closing the browser…`:vn?`Playing the steps, healing a control that moved…`:`Playing the steps in a new browser…`}),(0,Y.jsxs)(x,{busy:tr,variant:`destructive`,disabled:tr,onClick:()=>void Nn(),"data-tip":`Stop the run and close its browser`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),tr?`Stopping…`:`Stop`]})]}),!X&&!Q&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Not run yet.`}),Q&&(0,Y.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:d(`m-0 text-body-sm font-medium [overflow-wrap:anywhere]`,Q.ok?`text-pass`:Q.stopped?`text-ink-2`:`text-fail`),children:Q.stopped?Q.rows?`Stopped after ${u(Q.rows.length,`row`)}${Q.env?` on ${Q.env}`:``}.`:`Stopped after ${u(Q.steps.filter(e=>!e.skipped).length,`step`)}${Q.env?` on ${Q.env}`:``}.`:Q.rows?Q.ok?`All ${Q.rows.length} rows passed${Q.env?` on ${Q.env}`:``}${Q.ms?` in ${Math.round(Q.ms/1e3)}s`:``}. The steps below are row ${Q.rows.at(-1)?.n}'s.`:Q.rows.some(e=>!e.ok)?`${Q.rows.filter(e=>!e.ok).length} of ${Q.rows.length} rows failed${Q.env?` on ${Q.env}`:``}. The steps below are row ${Q.rows.find(e=>!e.ok)?.n}'s.`:`It did not get through${Q.env?` on ${Q.env}`:``}: ${Q.error||`no row was played`}`:Q.ok?`All ${Q.steps.length} steps passed${Q.env?` on ${Q.env}`:``}${Q.ms?` in ${Math.round(Q.ms/1e3)}s`:``}.`:Gn?`Step ${Gn.n} failed${Q.env?` on ${Q.env}`:``}.`:`It did not get through${Q.env?` on ${Q.env}`:``}: ${Q.error||`the last page was not the recorded one`}`}),(()=>{let e=bn??Q.heals??[],t=e.filter(e=>!e.accepted);return e.length?(0,Y.jsxs)(Y.Fragment,{children:[t.length>0&&(0,Y.jsxs)(`div`,{className:d(S.info,`flex flex-wrap items-center gap-4`),children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`The re-record found `,u(t.length,`moved control`),` and reached `,t.length===1?`it`:`them`,` by another locator the recorder kept: use `,t.length===1?`it`:`them`,` in the recording?`]}),(0,Y.jsxs)(x,{busy:_,size:`sm`,disabled:_||X||nr,onClick:()=>void Mn(t.map(e=>e.index)),"data-tip":`Make each healed locator the one its step uses`,children:[(0,Y.jsx)(ye,{"aria-hidden":`true`}),_?`Accepting…`:`Accept`]})]}),(0,Y.jsx)(`ol`,{"aria-label":`Controls that moved`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:e.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex items-start gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.index}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.action}),(0,Y.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`was `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:e.from}),`, now `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:e.to})]}),e.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.accepted&&(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-pass`,children:[(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`}),`In the recording`]})]})]},e.index))})]}):null})(),Sn&&(0,Y.jsx)(`p`,{role:`status`,className:d(S.pass,`m-0`),children:Sn}),Q.rows&&(0,Y.jsx)(`ol`,{"aria-label":`Rows of ${Q.from||`the test data`}`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:Q.rows.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex items-start gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.label||`Row ${e.n}`}),!e.ok&&e.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))}),Q.steps.length>0&&(0,Y.jsx)(`ol`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:Q.steps.map((t,n)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-col`,n>0&&`border-t border-line-soft`,!t.ok&&`bg-fail-soft`),children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 px-4 py-2`,children:[t.skipped?(0,Y.jsx)(me,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):t.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:t.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[t.action,t.skipped?(0,Y.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!t.ok&&t.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]}),(0,Y.jsx)(`span`,{className:`flex-1`}),t.shot&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${t.n} of the run`,"aria-expanded":Oe(t),"data-tip":`See the page after step ${t.n} of the run`,onClick:()=>De({...we,[t.n]:!Oe(t)}),className:`size-8 flex-none`,children:(0,Y.jsx)(Pe,{"aria-hidden":`true`})})]}),t.shot&&Oe(t)&&(0,Y.jsx)(en,{runDir:e,n:t.n,failed:!t.ok},`${Q.ms??0}-${t.n}`)]},t.n))})]}),Q&&(Q.video||Q.trace||Q.network||q.runs?.[0]?.log)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Q.video&&(0,Y.jsx)(Xt,{runDir:e,kind:`try`}),q.runs?.[0]?.log&&(0,Y.jsx)(Zt,{runDir:e,which:q.runs[0].log,label:`Re-run log`}),Q.trace&&(0,Y.jsx)($t,{runDir:e}),Q.network&&(0,Y.jsx)(Qt,{runDir:e})]}),(q.runs?.length??0)>1&&(0,Y.jsx)(Yt,{runDir:e,runs:q.runs.slice(1)})]}),O===`instructions`&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm font-medium text-ink`,children:[`Instructions for Quill`,(0,Y.jsx)(`span`,{className:`text-body-sm font-normal text-ink-2`,children:`Anything else about the test, in your words: where it goes, the page objects to use, its tags, what to leave out. Saved when you leave the box.`}),(0,Y.jsx)(i,{value:Ze,maxLength:4e3,rows:5,placeholder:`e.g. Put it in tests/checkout, use the CheckoutPage page object, and tag it @smoke.`,onChange:e=>Qe(e.target.value),onBlur:()=>Ze.trim()!==f.instructions&&void Z({instructions:Ze.trim()}),className:`font-normal`})]}),O===`blocks`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Steps you do in many tests, like signing in, kept under a name: put them into other recordings, or start a new one from them. Quill writes each block once, as a helper every test calls.`}),at===!0&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`They are kept in .forgeqe/blocks/ and go into the repository with your next commit, so the team shares them.`}),at===!1&&(0,Y.jsxs)(`p`,{className:d(S.warn,`m-0`),children:[`Your .gitignore leaves .forgeqe/blocks/ out of the repository, so only you have these blocks. To share them with the team, ignore only `,(0,Y.jsx)(`code`,{children:`.forgeqe/reports/`}),` (the run reports) there, not all of `,(0,Y.jsx)(`code`,{children:`.forgeqe/`}),`.`]}),(0,Y.jsxs)(`div`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),W.name.trim()&&Fn()},children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Keep steps`,(0,Y.jsx)(r,{"aria-label":`The first step of the block`,value:W.from,onChange:e=>st({...W,from:Number(e.target.value),to:Math.max(W.to,Number(e.target.value))}),className:`w-[84px]`,children:f.steps.map(e=>(0,Y.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`to`,(0,Y.jsx)(r,{"aria-label":`The last step of the block`,value:W.to,onChange:e=>st({...W,to:Number(e.target.value)}),className:`w-[84px]`,children:f.steps.filter(e=>e.index>=W.from).map(e=>(0,Y.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`as the block`,(0,Y.jsx)(a,{value:W.name,maxLength:80,placeholder:`Sign in`,onChange:e=>st({...W,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[140px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`in the section`,(0,Y.jsx)(a,{value:W.section,maxLength:40,placeholder:`Account`,list:`rev-block-sections`,onChange:e=>st({...W,section:e.target.value})}),(0,Y.jsx)(`datalist`,{id:`rev-block-sections`,children:[...new Set(et.flatMap(e=>e.section?[e.section]:[]))].map(e=>(0,Y.jsx)(`option`,{value:e},e))})]}),(0,Y.jsxs)(x,{type:`submit`,disabled:_||!W.name.trim(),"data-tip":`Keep as a block`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Keep`]})]}),Ct&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-pass`,children:Ct}),yt.length>0&&(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 pt-4`,onSubmit:e=>{e.preventDefault();let t=G.block||yt[0].id,n=yt.find(e=>e.id===t);n&&Tt(n,lt)&&Z({insert:{after:G.after,block:n.id,use:lt}})},children:[(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Put in the block`,(0,Y.jsx)(r,{"aria-label":`The block to put in`,value:G.block||yt[0].id,onChange:e=>{ct({...G,block:e.target.value}),ut(Et(yt.find(t=>t.id===e.target.value),dt))},children:yt.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`after step`,(0,Y.jsx)(r,{"aria-label":`The step the block goes after`,value:G.after,onChange:e=>ct({...G,after:Number(e.target.value)}),className:`w-[84px]`,children:f.steps.map(e=>(0,Y.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,Y.jsxs)(x,{type:`submit`,disabled:_||!Tt(yt.find(e=>e.id===(G.block||yt[0].id)),lt),"data-tip":`Put the block in after the step`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]}),(e=>e&&e.inputs.length>0?(0,Y.jsxs)(`div`,{className:`flex basis-full flex-col gap-2`,children:[(0,Y.jsx)(kt,{block:e}),(0,Y.jsx)(Dt,{block:e,secrets:dt,use:lt,onChange:ut,disabled:_})]}):null)(yt.find(e=>e.id===(G.block||yt[0].id)))]})]}),et.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Y.jsx)(w,{id:`rev-block-search`,label:`Find a block`,value:_t,onChange:e=>{vt(e),gt(null)}})}),St.length===0&&(0,Y.jsx)(`p`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 text-body-sm text-muted`),children:`No block matches.`}),[...St.reduce((e,t)=>e.set(t.section??``,[...e.get(t.section??``)??[],t]),new Map)].map(([e,t])=>(0,Y.jsxs)(`section`,{"aria-label":e||`No section`,className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`h3`,{className:`m-0 text-body-sm font-medium text-ink-2`,children:e||`No section`}),(0,Y.jsx)(`ul`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:t.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-col gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[K?.id===e.id?(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:t=>{t.preventDefault(),In(e.id,{name:K.name,section:K.section,description:K.description})},children:[(0,Y.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Name`,(0,Y.jsx)(a,{value:K.name,maxLength:80,onChange:e=>pt({...K,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[120px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Section`,(0,Y.jsx)(a,{value:K.section,maxLength:40,list:`rev-block-sections`,onChange:e=>pt({...K,section:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[200px] flex-[2_1_200px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`What it does`,(0,Y.jsx)(a,{value:K.description,maxLength:300,onChange:e=>pt({...K,description:e.target.value})})]}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:_||!K.name.trim(),"data-tip":`Save the block as a new version`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>pt(null),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}):(0,Y.jsxs)(`div`,{className:`flex items-start gap-x-4`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:[e.name,` `,(0,Y.jsxs)(`span`,{className:`font-normal text-muted`,children:[`v`,e.version,` · `,u(e.steps,`step`),e.kind&&e.kind!==`web`?` · ${e.kind===`desktop`?`desktop app`:`mobile app`}${e.app?` ${e.app}`:``}`:``]})]}),e.description&&(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.description}),e.inputs.length>0&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Takes `,e.inputs.map(e=>`${e.label||e.name}${e.kind===`data`?``:` (secret)`}`).join(`, `)]})]}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Change the block ${e.name}`,"data-tip":`Change the block ${e.name}`,onClick:()=>pt({id:e.id,name:e.name,section:e.section??``,description:e.description??``}),className:`size-8`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":ht?.id===e.id?`Delete the block ${e.name} anyway`:`Delete the block ${e.name}`,"data-tip":ht?.id===e.id?`Delete it anyway`:`Delete the block ${e.name}`,onClick:()=>void Ln(e.id),className:`size-8`,children:(0,Y.jsx)(N,{"aria-hidden":`true`})})]})]}),ht?.id===e.id&&(0,Y.jsxs)(`p`,{className:d(S.warn,`m-0`),children:[ht.why,` Click delete again to delete it anyway.`]})]},e.id))})]},e||`-`))]})]}),O===`history`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(T,{icon:be,size:15}),`Each change you make to the steps here is a version: go back to any one, and you can come back from it too. The runs are under Runs.`]}),(0,Y.jsx)(`ol`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:[...f.history,{n:0,at:``,change:`The recording as recorded`,steps:0}].map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsxs)(`span`,{className:`w-8 flex-none font-mono text-body-sm text-muted tabular-nums`,children:[`v`,e.n]}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:e.change}),e.at&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[nt(e.at),` · `,u(e.steps,`step`)]})]}),t===0?(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:`Now`}):(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Go back to v${e.n}`,"data-tip":`Go back to v${e.n}`,onClick:()=>void Z({restore:e.n}),className:`size-8`,children:(0,Y.jsx)(ae,{"aria-hidden":`true`})})]},e.n))})]})]})]})}function Yt({runDir:e,runs:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(``),o=e=>{let t=e.steps.find(e=>!e.ok&&!e.skipped);return e.stopped?`Stopped before the end`:e.rows?e.ok?`All ${e.rows.length} rows passed`:`${e.rows.filter(e=>!e.ok).length} of ${e.rows.length} rows failed`:e.ok?`All ${e.steps.length} steps passed`:t?`Step ${t.n} failed: ${t.error||t.action}`:e.error||`It did not get through`};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(T,{icon:be,size:15}),`Earlier runs, newest first. Only the latest run keeps its pictures, video and trace; each keeps its log.`]}),i&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:i}),(0,Y.jsx)(`ol`,{"aria-label":`Earlier runs`,className:d(s,`m-0 flex list-none flex-col p-0`),children:t.map((t,i)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-col`,i>0&&`border-t border-line-soft`),children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,children:[t.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`flex-none text-pass`}):t.stopped?(0,Y.jsx)(me,{size:14,"aria-label":`Stopped`,className:`flex-none text-muted`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`flex-none text-fail`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,Y.jsx)(`span`,{className:d(`text-body-sm [overflow-wrap:anywhere]`,t.ok||t.stopped?`text-ink`:`text-fail`),children:o(t)}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[nt(t.at),t.env?` · on ${t.env}`:``,t.ms?` · ${Math.round(t.ms/1e3)}s`:``,t.why===`write`?` · before writing the test`:``]})]}),t.log&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Open the log of the run ${nt(t.at)} in a new tab`,"data-tip":`Open the log of the run ${nt(t.at)} in a new tab`,onClick:async()=>a(await k(t.log,()=>v.openLog(e,t.log))),className:`size-8 flex-none`,children:(0,Y.jsx)(xe,{"aria-hidden":`true`})}),t.steps.length>0&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`See the steps of the run ${nt(t.at)}`,"aria-expanded":n===t.at,"data-tip":`See the steps of the run ${nt(t.at)}`,onClick:()=>r(n===t.at?null:t.at),className:`size-8 flex-none`,children:(0,Y.jsx)(Pe,{"aria-hidden":`true`})})]}),n===t.at&&(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0 text-body-sm`,children:t.steps.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex items-start gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.skipped?(0,Y.jsx)(me,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):e.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[e.action,e.skipped?(0,Y.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!e.ok&&e.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))})]},t.at))})]})}function Xt({runDir:e,kind:t}){let[n,r]=(0,J.useState)(``);return(0,Y.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(x,{"data-tip":`Open the video of ${t===`try`?`the re-run`:`the recording`} in a new tab`,onClick:async()=>r(await k(t,()=>v.openVideo(e,t))),children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),t===`try`?`Re-run video`:`Recording video`]}),n&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:n})]})}function Zt({runDir:e,which:t,label:n}){let[r,i]=(0,J.useState)(``);return(0,Y.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(x,{"data-tip":`Open the ${n.toLowerCase()} in a new tab`,onClick:async()=>i(await k(t,()=>v.openLog(e,t))),children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),n]}),r&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:r})]})}function Qt({runDir:e}){let t=e.split(/[\\/]/).filter(Boolean).pop()||``;return t?(0,Y.jsxs)(x,{"data-tip":`Make API tests from the calls the app made in this re-run, with their payloads and answers`,onClick:()=>location.hash=n(`api-tests`,encodeURIComponent(`new:${t}/tries`)),children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`}),`API tests from its calls`]}):null}function $t({runDir:e}){let[t,n]=(0,J.useState)(``);return(0,Y.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(x,{"data-tip":`Download Playwright's trace of the re-run: open it at trace.playwright.dev to see each step's page, actions and network`,onClick:async()=>n(await k(`trace.zip`,()=>v.openTrace(e))),children:[(0,Y.jsx)(qe,{"aria-hidden":`true`}),`Trace`]}),t&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:t})]})}function en({runDir:e,n:t,failed:n}){let[r,i]=(0,J.useState)(``),[a,s]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let n=!1;return v.tryShot(e,t).then(e=>!n&&i(e),()=>!n&&s(!0)),()=>{n=!0}},[e,t]);let c=n?`The page when step ${t} of the run failed`:`The page after step ${t} of the run`;return(0,Y.jsx)(`div`,{className:`px-4 pb-4 sm:pl-14`,children:a?(0,Y.jsx)(`p`,{className:d(o,`m-0 px-4 py-6 text-center text-body-sm text-muted`),children:`No screenshot`}):r?(0,Y.jsx)(`img`,{src:r,alt:c,className:d(o,`max-h-[420px] w-full max-w-[720px] object-contain object-top`)}):(0,Y.jsx)(`div`,{className:d(o,`min-h-24 max-w-[720px]`)})})}function tn({rows:e,n:t,locators:n,busy:i,onPick:a}){let o=n?.find(e=>e.chosen);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[n&&n.length>1&&a&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`How step `,t,` finds its element`,(0,Y.jsx)(r,{value:String(o?.pick??n[0].pick),disabled:i,onChange:e=>a(Number(e.target.value)),"aria-describedby":o?.risk?`step-${t}-locator-risk`:void 0,className:`max-w-[560px]`,children:n.map(e=>(0,Y.jsxs)(`option`,{value:e.pick,children:[Bt(e),e.risk===`varies`?` — another value when the page loaded again`:e.risk?` — unique on this run only`:e.verified?` — unique on the page`:``,e.confidence===void 0?``:` (${e.confidence}%)`]},e.pick))})]}),o?.risk&&(0,Y.jsx)(`span`,{id:`step-${t}-locator-risk`,className:`text-body-sm text-warn`,children:zt[o.risk].alone})]}),(0,Y.jsx)(`dl`,{"aria-label":`What was recorded for step ${t}`,className:d(c,`m-0 grid grid-cols-1 gap-x-6 gap-y-1 text-body-sm sm:grid-cols-[170px_minmax(0,1fr)] sm:gap-y-2`),children:e.map((e,t)=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e.label}),(0,Y.jsx)(`dd`,{className:d(`m-0 text-ink [overflow-wrap:anywhere]`,e.code&&`font-mono text-body-sm`),children:e.value})]},`${t}-${e.label}`))})]})}function nn({runDir:e,step:t,busy:n,onPick:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(``);(0,J.useEffect)(()=>{let n=!1;return v.shot(e,t.shot).then(e=>!n&&a(e),e=>!n&&s(e.message)),()=>{n=!0}},[e,t.shot]);let c=t.snap,l=[...c.texts.map(e=>({...e,kind:`text`})),...c.fields.filter(e=>e.value).map(e=>({...e,kind:`value`}))].filter(e=>e.w>0&&e.h>0&&c.w>0&&c.h>0).sort((e,t)=>t.w*t.h-e.w*e.h),u=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Click a text on the page to check that it shows; a field, to check its value.`}),o&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:o}),!i&&!o&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Loading the picture…`}),i&&(0,Y.jsxs)(`div`,{className:d(`rounded-base bg-surface-muted object-cover`,`relative w-full max-w-[720px] overflow-hidden`),style:{aspectRatio:`${c.w} / ${c.h}`},children:[(0,Y.jsx)(`img`,{src:i,alt:`The page after step ${t.index+1}`,className:`absolute inset-0 size-full object-cover object-top`}),l.map((e,t)=>{let i=e.kind===`value`?`Check ${e.t} has the value "${e.value}"`:`Check the page shows "${e.t}"`;return(0,Y.jsx)(`button`,{type:`button`,disabled:n,"aria-label":i,"data-tip":i,onClick:()=>r(e.kind,e.t,e.f),className:`absolute rounded-sm border-0 bg-transparent p-0 outline-none hover:bg-accent/15 hover:ring-2 hover:ring-accent focus-visible:bg-accent/15 focus-visible:ring-2 focus-visible:ring-accent`,style:{left:u(e.x,c.w),top:u(e.y,c.h),width:u(e.w,c.w),height:u(e.h,c.h)}},`${t}-${e.t}`)})]})]})}var rn=[[`contains`,`Contains`],[`equals`,`Is exactly`],[`starts`,`Starts with`],[`ends`,`Ends with`],[`not_contains`,`Does not contain`],[`regex`,`Matches a pattern`],[`number`,`A number in it is`]],an=[[`eq`,`=`],[`gt`,`>`],[`gte`,`≥`],[`lt`,`<`],[`lte`,`≤`],[`between`,`between`]],on=[[`text`,`Its text`],[`value`,`Its value`],[`visible`,`It shows`],[`hidden`,`It is gone`],[`enabled`,`It is enabled`],[`disabled`,`It is disabled`],[`count`,`How many there are`],[`attribute`,`An attribute's value`]],sn=/^[A-Za-z_][\w:.-]{0,60}$/,cn=e=>{let t=e.replace(/\u00a0/g,` `).match(/-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?/);return t?t[0].replace(/,/g,``):``};function ln({check:e,onSave:t}){let n=e.match,i=e.was??e.kind,[o,s]=(0,J.useState)(e.kind),[c,l]=(0,J.useState)(e.attr??``),[u,d]=(0,J.useState)(n?.how??(e.kind===`count`?`number`:`contains`)),[f,p]=(0,J.useState)(n?.text??(e.kind===`attribute`?``:e.text)),[m,h]=(0,J.useState)(!!n?.ci),[g,_]=(0,J.useState)(n?.op??(e.kind===`count`?`gte`:`eq`)),[v,y]=(0,J.useState)(n?.min===void 0?e.kind===`count`?`1`:cn(e.text):String(n.min)),[b,S]=(0,J.useState)(n?.max===void 0?``:String(n.max)),C=e=>e.trim()!==``&&Number.isFinite(Number(e))?Number(e):void 0,w=(()=>{try{return new RegExp(f),!0}catch{return!1}})(),T=o===`count`?`number`:[`text`,`value`,`attribute`,`url`,`title`].includes(o)?`text`:`none`,E=T===`number`?`number`:u,D=o!==`attribute`||sn.test(c),O=E===`number`?C(v)===void 0||g===`between`&&(C(b)===void 0||C(b)<C(v))?void 0:{how:E,op:g,min:C(v),...g===`between`?{max:C(b)}:{}}:!f.trim()||E===`regex`&&(!w||f.length>200)?void 0:{how:E,text:f.trim(),...m?{ci:!0}:{}},k=D&&(T===`none`||O!==void 0&&(o!==`attribute`||O.how!==`number`)),A=e.element&&o!==e.kind,j=e.kind===`value`?`The field's value`:e.kind===`url`?`The page address`:e.kind===`title`?`The page title`:`The text`;return(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 p-2`,onSubmit:n=>{if(n.preventDefault(),!k)return;let r=T===`none`?null:O;if(!A&&o===i&&(o===`text`||o===`value`)&&r&&r.how===`contains`&&!r.ci&&r.text===e.text)return t({match:null});t(e.element?{match:r,kind:o,...o===`attribute`?{attr:c}:{}}:{match:r})},children:[e.element&&(0,Y.jsx)(r,{value:o,"aria-label":`What to check`,onChange:t=>{let r=t.target.value;if(s(r),r===`count`?(d(`number`),o!==`count`&&(_(`gte`),y(`1`))):u===`number`&&r===`attribute`&&d(`equals`),r===`attribute`&&o!==`attribute`&&p(e.kind===`attribute`?n?.text??``:``),(r===`text`||r===`value`)&&o!==r){let t=e.kind===`text`||e.kind===`value`?n:void 0;d(t?.how??`contains`),p(t?.text??e.text),h(!!t?.ci),_(t?.op??`eq`),y(t?.min===void 0?cn(e.text):String(t.min)),S(t?.max===void 0?``:String(t.max))}},children:on.filter(([e])=>e===`text`||e===`value`?e===i:!0).map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),o===`attribute`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(a,{value:c,maxLength:61,"aria-label":`The attribute`,placeholder:`e.g. aria-expanded or data-state`,onChange:e=>l(e.target.value)}),c!==``&&!D&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:`An attribute's name starts with a letter or _, then letters, digits and - _ : . only.`})]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:o===`attribute`?`The attribute's value, compared as text.`:T===`number`?`How many elements this check's locator finds on the page.`:T===`none`?o===`visible`?`The replay checks it shows.`:o===`hidden`?`The replay checks it is gone.`:`The replay checks it is ${o}.`:`${j} was “${e.text}” when you recorded.`}),T===`text`&&(0,Y.jsx)(r,{value:u,"aria-label":`How to compare`,onChange:e=>d(e.target.value),children:rn.filter(([e])=>o!==`attribute`||e!==`number`).map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),T===`none`?null:E===`number`?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(r,{value:g,"aria-label":`Compared with`,onChange:e=>_(e.target.value),className:`flex-none`,children:an.map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),(0,Y.jsx)(a,{value:v,inputMode:`decimal`,maxLength:20,"aria-label":g===`between`?`Lowest value`:`Value`,onChange:e=>y(e.target.value),className:`min-w-0 flex-1`}),g===`between`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`and`}),(0,Y.jsx)(a,{value:b,inputMode:`decimal`,maxLength:20,"aria-label":`Highest value`,onChange:e=>S(e.target.value),className:`min-w-0 flex-1`})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(a,{value:f,maxLength:u===`regex`?200:300,"aria-label":u===`regex`?`The pattern`:`The text`,placeholder:u===`regex`?`e.g. ^Order \\d+ placed$`:void 0,onChange:e=>p(e.target.value)}),u===`regex`&&!w&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:`That is not a valid pattern.`}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(K,{checked:m,onCheckedChange:h}),`Any case (capital or small letters)`]})]}),T===`text`&&(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:u===`number`?`The first number in it is read, with any thousands separators and currency sign.`:`Spaces and line breaks count as one space.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:!k,"data-tip":`Save this check`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),n&&(e.kind===`text`||e.kind===`value`||!e.element)&&(0,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({match:null}),"data-tip":`Compare by contains, as recorded`,children:[(0,Y.jsx)(ae,{"aria-hidden":`true`}),`Back to contains “`,e.text,`”`]})]})}function un({step:e,onAdd:t,onRecordMore:n,blocks:i=[],secrets:o=[],onAddBlock:s}){let[c,l]=(0,J.useState)(`check`),[u,d]=(0,J.useState)(i[0]?.id??``),f=i.find(e=>e.id===u)??i[0],[p,m]=(0,J.useState)(()=>Et(f,o)),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(!1),[S,C]=(0,J.useState)(`2`),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(e.note||``),O=e.index,k=[[`check`,`Check`,we],[`step`,`Step`,Ne],[`wait`,`Wait`,he],[`note`,`Note`,ke],...i.length&&s?[[`block`,`Block`,Ee]]:[]],A=Number(S),j=Number.isInteger(A)&&A>=1&&A<=60;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[(0,Y.jsx)(tt,{prefix:`add`,label:`What to add`,className:`mb-0`,current:c,onPick:l,tabs:k.map(([e,t])=>({id:e,label:t}))}),c===`block`&&f&&s&&(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),Tt(f,p)&&s(f.id,p)},children:[(0,Y.jsx)(r,{"aria-label":`The block to put in after this step`,value:f.id,onChange:e=>{d(e.target.value),m(Et(i.find(t=>t.id===e.target.value),o))},children:i.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))}),(0,Y.jsx)(kt,{block:f}),(0,Y.jsx)(Dt,{block:f,secrets:o,use:p,onChange:m}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`When the page here is not where the block starts, it opens its start page first, on this recording's site.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!Tt(f,p),"data-tip":`Put the block in after this step`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),c===`check`&&(0,Y.jsxs)(Y.Fragment,{children:[e.page&&(0,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({checks:[{after:O,kind:`url`}]}),children:[`The page is `,e.page]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),h.trim()&&t({checks:[{after:O,kind:`intent`,text:h.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`A check in your words`,value:h,maxLength:300,placeholder:`Or say what shows here, e.g. the order number`,onChange:e=>g(e.target.value)}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!h.trim(),"data-tip":`Add the check`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]})]}),c===`step`&&(0,Y.jsxs)(Y.Fragment,{children:[n&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-line-soft pb-2`,children:[(0,Y.jsxs)(x,{size:`sm`,onClick:n,"data-tip":`Record more from here`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Record`]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`The browser opens, does the steps up to here, and you record what comes next. A step that cannot be done, you redo by hand.`})]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),h.trim()&&t({steps:[{after:O,kind:`do`,text:h.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`A step in your words`,value:h,maxLength:300,placeholder:`In your words, e.g. choose the cheapest delivery`,onChange:e=>g(e.target.value)}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Quill finds the control on the page and does it here.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!h.trim(),"data-tip":`Add the step`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsxs)(`form`,{className:`flex gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),/^https?:\/\/\S+$/i.test(w.trim())&&t({steps:[{after:O,kind:`open`,url:w.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`A page to open`,value:w,type:`url`,maxLength:2e3,placeholder:`Open a page: https://…`,onChange:e=>T(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,disabled:!/^https?:\/\/\S+$/i.test(w.trim()),"data-tip":`Add a step that opens this page`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:O,kind:`back`}]}),"data-tip":`Add a step that goes back a page`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),`Go back`]})]}),c===`wait`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Each step already waits for the page to load, its calls to finish and its spinners to go. Add a wait for what the page does later or slowly.`}),(0,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:O,kind:`wait_load`}]}),"data-tip":`Wait until the page has loaded, its calls have finished and its spinners have gone`,children:[(0,Y.jsx)(z,{"aria-hidden":`true`}),`Until the page has loaded`]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),_.trim()&&t({steps:[{after:O,kind:`wait_text`,text:_.trim(),...y?{gone:!0}:{}}]})},children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(r,{value:y?`gone`:`shows`,"aria-label":`Wait until the text`,onChange:e=>b(e.target.value===`gone`),className:`flex-none`,children:[(0,Y.jsx)(`option`,{value:`shows`,children:`Until it shows`}),(0,Y.jsx)(`option`,{value:`gone`,children:`Until it is gone`})]}),(0,Y.jsx)(a,{value:_,maxLength:120,placeholder:y?`e.g. Loading`:`e.g. Order placed`,"aria-label":`The text to wait for`,onChange:e=>v(e.target.value),className:`min-w-0 flex-1`})]}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!_.trim(),"data-tip":`Add the wait`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsxs)(`form`,{className:`flex items-center gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),j&&t({steps:[{after:O,kind:`wait_seconds`,seconds:A}]})},children:[(0,Y.jsx)(a,{value:S,type:`number`,min:1,max:60,step:1,maxLength:2,"aria-label":`Seconds to wait`,onChange:e=>C(e.target.value),className:`w-20 flex-none`}),(0,Y.jsx)(`span`,{className:`flex-1 text-body-sm text-ink-2`,children:`seconds`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,disabled:!j,"data-tip":`Add a pause of this many seconds`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]})]}),c===`note`&&(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),t({notes:[{index:O,text:E.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`Note`,value:E,maxLength:300,placeholder:`e.g. this is the cart page object`,onChange:e=>D(e.target.value)}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`For whoever writes the test; it is not a step.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:E.trim()===(e.note||``),"data-tip":E.trim()||!e.note?`Save the note`:`Remove the note`,children:[E.trim()||!e.note?(0,Y.jsx)(H,{"aria-hidden":`true`}):(0,Y.jsx)(N,{"aria-hidden":`true`}),E.trim()||!e.note?`Save`:`Remove`]})]})]})}var dn=e=>`${e.index}-${e.value?.as}-${e.value?.text}-${e.value?.days??``}`,fn=e=>e===0?`today`:`${u(Math.abs(e),`day`)} ${e>0?`from`:`before`} today`;function pn({step:e,busy:t,onSave:n,open:i,onOpen:o,sources:s}){let c=e.value,[l,u]=(0,J.useState)(!1),d=o?!!i:l,f=o??u,[p,m]=(0,J.useState)(c.text),[h,g]=(0,J.useState)(String(c.days??0)),_=e.index+1,v=c.as===`secret`?(0,Y.jsxs)(Y.Fragment,{children:[`Read from `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:c.name})]}):c.as===`any`?(0,Y.jsxs)(Y.Fragment,{children:[`Picked on each run`,c.text?(0,Y.jsxs)(Y.Fragment,{children:[` (`,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:c.text}),` this time)`]}):null]}):c.edit===`days`?(0,Y.jsx)(`span`,{className:`text-ink`,children:fn(c.days??0)}):(0,Y.jsx)(`span`,{className:`font-mono text-ink [overflow-wrap:anywhere]`,children:c.text===``?`(empty)`:c.text}),y=/^-?\d{1,4}$/.test(h.trim())&&Math.abs(Number(h))<=3660,b=c.edit===`days`?y&&Number(h)!==c.days:p!==c.text&&(e.op===`input`||p.trim()!==``);return d?(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:t=>{t.preventDefault(),b&&(f(!1),n({values:[c.edit===`days`?{index:e.index,days:Number(h)}:{index:e.index,text:p}]}))},children:[s&&s.length>1&&(0,Y.jsx)(r,{"aria-label":`Where the value of step ${_} comes from`,value:c.as,disabled:t,onChange:t=>n({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:s.map(t=>(0,Y.jsx)(`option`,{value:t.id,children:Wt(e,t.id)},t.id))}),c.edit===`days`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(a,{value:h,type:`number`,min:-3660,max:3660,step:1,"aria-label":`Days from today for step ${_}`,autoFocus:!0,onChange:e=>g(e.target.value),className:`w-20 flex-none`}),(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`days from today`})]}):c.edit?(0,Y.jsx)(a,{value:p,maxLength:300,"aria-label":`Value of step ${_}`,autoFocus:!0,onChange:e=>m(e.target.value),className:`min-w-[160px] flex-1`}):(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:v}),c.edit&&(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:t||!b,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>f(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),c.edit?`Cancel`:`Close`]}),e.op===`click`&&c.as===`typed`&&c.edit&&(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-muted`,children:`Clicking another one makes it test data.`})]}):(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-body-sm text-ink-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[c.as===`data`&&c.name&&s?(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:c.name}):`Value`,`: `,v]}),(c.edit||s&&s.length>1)&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:t,"aria-label":`Change the value of step ${_}`,"data-tip":`Change the value of step ${_}`,onClick:()=>f(!0),className:`size-8 flex-none`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})})]})}var mn=e=>{try{let t=new URL(e.trim());return/^https?:$/.test(t.protocol)?t.origin:``}catch{return``}};function hn({start:e,busy:t,onSave:n,onCancel:r}){let[i,o]=(0,J.useState)(e),[s,c]=(0,J.useState)(!0),l=mn(e),u=mn(i),d=!!l&&!!u&&l!==u;return(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 px-4 pb-2 sm:pl-20`,onSubmit:t=>{t.preventDefault(),u&&i.trim()!==e&&n(i.trim(),d&&s)},children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(a,{value:i,type:`url`,maxLength:2e3,"aria-label":`The page the test starts on`,autoFocus:!0,onChange:e=>o(e.target.value),className:`min-w-0 flex-1 font-mono`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:t||!u||i.trim()===e,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:r,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}),i.trim()&&!u&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:`Start on a web page: an http or https address.`}),d&&(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(K,{checked:s,onCheckedChange:c}),`Move the other pages of `,l,` to `,u,` too`]})]})}var gn={navigate:pe,back:Ce,click:P,dblclick:P,input:j,press:j,select:we,upload:Me,expect:ce,wait_for:z,capture:de,note:ke,launch:fe,double_click:P,type:j,keys:j,tap:P,double_tap:P,long_press:P,swipe:Ie,scroll:je,hide_keyboard:j,wait:he,dismiss:Je},_n=e=>gn[e]||(e.startsWith(`expect`)?ce:ze),vn=new Set([`starting`,`recording`,`paused`,`stopping`]);function yn(e,t){let n=Math.max(0,Math.round(((t?Date.parse(t):Date.now())-Date.parse(e))/1e3));return n<3600?`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:`${Math.floor(n/3600)}h ${Math.floor(n%3600/60)}m`}async function bn(e){await v.write(e,{check:!0})}async function xn(e,t=`desktop`){let r=t===`mobile`?`mobile_replay`:`desktop_replay`,{id:i}=await y.start(`Replay the ${t} workflow ${e}: call ${r} with workflow ${e}, and tell me how each step went.`,{});location.hash=n(`chats`,i)}function Sn({list:e}){return(0,Y.jsx)(`ul`,{"aria-label":`Found on a replay by`,className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-10 flex-none text-muted`,children:t===0?`uses`:`then`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2`,children:[(0,Y.jsx)(`span`,{className:`text-muted`,children:e.kind}),(0,Y.jsx)(`code`,{className:`line-clamp-2 font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,...e.value.length>80?{"data-tip":e.value}:{},children:e.value})]})]},`${t}-${e.kind}`))})}function Cn({s:e,live:t,onDelete:n}){let r=_n(e.op);return(0,Y.jsxs)(`li`,{className:`group flex min-h-[44px] items-start gap-4 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right text-body-sm text-muted tabular-nums`,children:e.n||`–`}),(0,Y.jsx)(r,{size:16,"aria-hidden":`true`,className:d(`mt-1 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:e.text}),e.locators&&e.locators.length>0&&(0,Y.jsx)(Sn,{list:e.locators}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,Y.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-body-sm text-muted`,children:[e.case_step?(0,Y.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,Y.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,Y.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,Y.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,Y.jsx)(x,{variant:`icon`,size:`icon`,"aria-label":`Delete step ${e.n}`,"data-tip":`Delete step ${e.n}`,onClick:n,className:`size-8 flex-none opacity-60 group-hover:opacity-100`,children:(0,Y.jsx)(N,{"aria-hidden":`true`})})]})}var wn=[[`tap`,`Tap`],[`check`,`Check`],[`long_press`,`Hold`],[`wait_for`,`Wait for`],[`point`,`Point`]],Tn={tap:`Tap`,check:`Check`,long_press:`Long-press`,wait_for:`Wait for`,point:`Tap a point in`},X={check:`Click what shows the outcome: a check of what it shows is added.`,long_press:`Click the control to long-press.`,wait_for:`Click the control a replay waits for before it goes on.`,point:`Click where the app draws something with no control of its own (a canvas, a chart): the spot is tapped inside the nearest control that can be found.`},En=3e4;function Dn({s:e,send:t,busy:n,secrets:i,links:o=[],className:c,fit:l}){let u=e.screen,[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(`tap`),[g,_]=(0,J.useState)(!1),[y,b]=(0,J.useState)(o[0]??``),C=o.includes(y)?y:o[0]??``,[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(``),[O,k]=(0,J.useState)(``),[A,ee]=(0,J.useState)(null),M=u?.seq??0,N=u?.frame??M;(0,J.useEffect)(()=>{if(!N||!u?.image)return;let e=!1;return v.screen().then(t=>!e&&p(t),()=>{}),()=>{e=!0}},[N,u?.image]),(0,J.useEffect)(()=>{w&&w.seq!==M&&T(null)},[M,w]),(0,J.useEffect)(()=>{A&&(N!==A.frame||e.notice?.at!==A.notice||e.state!==`recording`)&&ee(null)},[N,e.notice?.at,e.state,A]),(0,J.useEffect)(()=>{if(!A)return;let e=setTimeout(()=>ee(null),En);return()=>clearTimeout(e)},[A]);let ne=n||!!A,P=!ne&&e.state===`recording`&&!!u,F=n=>{ee({frame:N,notice:e.notice?.at}),t(n)},I=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`,L=Pt(u),z=e=>e.label?`“${e.label}”`:`the ${e.kind||`control`}`,B=(e,t)=>{m!==`point`&&(m===`tap`&&t.field?(T({el:e,seq:M,c:t}),D(``),k(t.secure&&i.length?i[0]:``)):(F({cmd:m,seq:M,el:e}),m!==`tap`&&h(`tap`)))},re=u&&u.width>0&&u.height>0?`min(var(--phone-max, 100%), calc(max(420px, 100vh - 260px) * ${u.width/u.height}))`:`100%`;return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-screen`,className:d(d(s,`flex min-w-0 flex-col gap-4`),c),style:l?{width:`max(min(400px, var(--phone-max, 100%)), ${re===`100%`?`0px`:re})`}:void 0,children:[(0,Y.jsx)(mt,{id:`rec-screen`,icon:Le,title:`Screen`,actions:(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Qe,{checked:g,onChange:_,label:`Outline controls`}),(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Outline controls`})]})}),(0,Y.jsx)(Ze,{label:`What a click on the screen does`,value:m,onChange:h,options:wn.map(([e,t])=>({id:e,label:t})),className:`self-center`}),m!==`tap`&&(0,Y.jsxs)(`p`,{role:`status`,className:d(S.info,`m-0 flex flex-wrap items-center gap-x-2`),children:[(0,Y.jsx)(`span`,{className:`flex-1`,children:X[m]}),(0,Y.jsx)(x,{variant:`link`,size:`inline`,onClick:()=>h(`tap`),children:`Back to Tap`})]}),e.notice&&(0,Y.jsx)(`p`,{role:`status`,className:d(S.warn,`m-0`),children:e.notice.text}),u?(0,Y.jsxs)(St,{src:f,alt:`The screen of ${e.app} now`,width:u.width,height:u.height,size:re,busy:ne,children:[L.map(({c:e,i:t})=>{let n=m===`tap`&&e.field?`${e.picker?`Choose in`:`Type into`} ${z(e)}`:`${Tn[m]} ${z(e)}${e.prompt?` (a system prompt: kept to answer whenever a replay is asked)`:``}`;return(0,Y.jsx)(`button`,{type:`button`,disabled:!P||!!w,"aria-label":n,"data-tip":n,onClick:()=>B(t,e),className:d(`absolute cursor-pointer rounded-[3px] border-0 bg-transparent p-0 outline-none hover:bg-accent/15 hover:ring-2 hover:ring-accent focus-visible:bg-accent/15 focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-default disabled:hover:bg-transparent disabled:hover:ring-0`,g&&`ring-2 ring-inset ring-accent/30`),style:{left:I(e.box[0],u.width),top:I(e.box[1],u.height),width:I(e.box[2],u.width),height:I(e.box[3],u.height)}},`${M}-${t}`)}),m===`point`&&(0,Y.jsx)(`button`,{type:`button`,disabled:!P,"aria-label":`Tap this point of the screen`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();if(!t.width||!t.height)return;let n=Math.max(0,Math.min(u.width-1,Math.round((e.clientX-t.left)/t.width*u.width))),r=Math.max(0,Math.min(u.height-1,Math.round((e.clientY-t.top)/t.height*u.height)));F({cmd:`tap_at`,seq:M,x:n,y:r}),h(`tap`)},className:`absolute inset-0 z-[2] cursor-crosshair border-0 bg-transparent p-0 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent disabled:cursor-default`}),ne&&!w&&(0,Y.jsx)(`span`,{role:`status`,className:`absolute inset-0 flex items-center justify-center bg-bg/60`,children:(0,Y.jsxs)(`span`,{className:d(`rounded-md border border-overlay-line bg-overlay p-2 text-ink shadow-menu backdrop-blur-[16px]`,`flex items-center gap-2 text-body-sm text-ink-2`),children:[(0,Y.jsx)(De,{size:16,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),`Doing it on the device…`]})}),w&&(0,Y.jsxs)(`form`,{className:d(`rounded-md border border-overlay-line bg-overlay p-2 text-ink shadow-menu backdrop-blur-[16px]`,`absolute inset-x-0 bottom-0 z-10 flex flex-col gap-2`),onKeyDown:e=>{e.key===`Escape`&&T(null)},onSubmit:e=>{if(e.preventDefault(),O)F({cmd:`type`,seq:w.seq,el:w.el,secret:O});else if(E)F({cmd:`type`,seq:w.seq,el:w.el,text:E});else return;T(null)},children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-body-sm font-medium [overflow-wrap:anywhere]`,children:[(0,Y.jsxs)(`span`,{className:`flex-1`,children:[w.c.picker?`Choose in`:`Type into`,` `,z(w.c)]}),(0,Y.jsx)(x,{type:`button`,variant:`icon`,size:`icon`,"aria-label":`Cancel`,"data-tip":`Cancel (Esc)`,onClick:()=>T(null),children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),!w.c.picker&&(i.length>0||w.c.secure)&&(0,Y.jsxs)(r,{"aria-label":`What to type`,autoFocus:!!w.c.secure,value:O,onChange:e=>k(e.target.value),className:`min-w-0`,children:[!w.c.secure&&(0,Y.jsx)(`option`,{value:``,children:`Text I type`}),i.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[`Secret `,e]},e))]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[!O&&(0,Y.jsx)(a,{"aria-label":w.c.picker?`Value to choose`:`Text to type`,autoFocus:!0,value:E,maxLength:w.c.picker?200:2e3,spellCheck:!1,onChange:e=>D(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(x,{type:`submit`,variant:`primary`,disabled:!P||!O&&!E,className:d(!!O&&`flex-1`),children:[(0,Y.jsx)(j,{"aria-hidden":`true`}),w.c.picker?`Choose`:`Type`]})]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:w.c.picker?`A picker wheel: write the value as the wheel shows it; the step chooses it.`:w.c.secure?i.length?`A password field: only a saved secret goes in, by its name, never its value.`:`A password field takes a saved secret: add one to mobile.secrets in Settings first.`:`A secret is typed from the credential store; the test keeps only its name.`}),(0,Y.jsx)(x,{variant:`link`,size:`inline`,onClick:()=>(F({cmd:`tap`,seq:w.seq,el:w.el}),T(null)),className:`self-start`,children:`Only tap it, type nothing`})]})]}):(0,Y.jsxs)(`p`,{className:`m-0 flex items-center gap-2 py-2 text-body-sm text-muted`,children:[(0,Y.jsx)(De,{size:16,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),e.state===`starting`?`Starting ${e.app} on ${e.device||`the device`}: a device cloud can take a minute or two…`:`Waiting for the screen…`]}),(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,"aria-label":`Gestures and keys`,role:`group`,children:[(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-4 gap-y-2`,children:[[`Scroll`,[[`Scroll up`,Be,{cmd:`scroll`,direction:`up`}],[`Scroll down`,je,{cmd:`scroll`,direction:`down`}]]],[`Swipe`,[[`Swipe left`,te,{cmd:`swipe`,direction:`left`}],[`Swipe right`,le,{cmd:`swipe`,direction:`right`}]]]].map(([e,t])=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`pr-1 text-body-sm text-muted`,children:e}),t.map(([e,t,n])=>(0,Y.jsx)(x,{variant:`icon`,size:`icon`,"aria-label":e,"data-tip":e,disabled:!P,onClick:()=>F(n),children:(0,Y.jsx)(t,{"aria-hidden":`true`})},e))]},e))}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`back`}),"data-tip":`The device's Back`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),`Back`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`keys`,key:`enter`}),"data-tip":`Press Enter on the keyboard`,children:[(0,Y.jsx)(j,{"aria-hidden":`true`}),`Enter`]}),(0,Y.jsx)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`hide_keyboard`}),"data-tip":`Hide the keyboard`,children:`Hide keyboard`}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`wait`,seconds:2}),"data-tip":`Record a wait of 2 seconds`,children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),`Wait 2 s`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`refresh`}),"data-tip":`Read the screen again, when the app changed by itself`,children:[(0,Y.jsx)(V,{"aria-hidden":`true`}),`Read again`]})]}),o.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[o.length>1&&(0,Y.jsx)(r,{size:`sm`,"aria-label":`Whose mailbox`,value:C,onChange:e=>b(e.target.value),className:`w-auto min-w-0 max-w-[160px]`,children:o.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P||!o.includes(C),onClick:()=>F({cmd:`magic_link`,login:C}),"data-tip":`Open the newest link ${C}'s site sent to its mailbox, on the device`,children:[(0,Y.jsx)(Ae,{"aria-hidden":`true`}),`Open magic link`]})]})]})]})}function On({s:e,where:t}){let n=[[`Device`,e.device||`The default device`],[`Platform`,e.platform===`ios`?`iOS`:`Android`],[`App`,e.app||``],...t?[[`Runs on`,t]]:[],[`Steps`,String(e.steps.length)]];return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-device`,className:d(s,`flex flex-col gap-2`),children:[(0,Y.jsx)(mt,{id:`rec-device`,icon:Se,title:`Device`}),(0,Y.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 text-body-sm`,children:n.map(([e,t])=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:t})]},e))})]})}function kn({s:e,send:t,busy:n,secrets:i=[],devices:a=[],links:o=[],blocks:c=[],blockSecrets:l=[],unsetSecrets:u=[],onPlayBlock:f}){let[,p]=(0,J.useState)(0),[m,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(``),y=c.find(e=>e.id===_)??c[0],[b,w]=(0,J.useState)(()=>Et(c[0],l));(0,J.useEffect)(()=>{let e=U(()=>p(e=>e+1),1e3);return()=>$e(e)},[]);let T=(0,J.useRef)(null),E=(0,J.useRef)(null);(0,J.useEffect)(()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight)},[e.log.length]),(0,J.useEffect)(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[e.steps.length]);let D=e.kind===`desktop`,O=e.kind===`mobile`,k=e.kind===`web`,A=e.state===`paused`,j=e.log.at(-1)?.level===`warn`&&/press Stop again/i.test(e.log.at(-1).text),M=Math.max(0,...e.steps.map(e=>e.case_step||0)),N=Nt(e.screen),te=(a.find(t=>t.name===e.device&&t.platform===e.platform)??a.find(t=>t.name===e.device))?.where,ne=(0,Y.jsx)(On,{s:e,where:e.device?te:void 0}),P=(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:d(d(s,`flex min-w-0 flex-col gap-2`),!O&&`flex-[999_1_420px]`),children:[(0,Y.jsx)(mt,{id:`rec-steps`,icon:Ne,title:`Steps`,n:e.summary}),e.steps.length?(0,Y.jsx)(`div`,{ref:E,className:`max-h-[60vh] overflow-y-auto`,children:(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:e.steps.map(e=>(0,Y.jsx)(Cn,{s:e,live:!D,onDelete:()=>t({cmd:`delete`,n:e.n})},`${e.n}-${e.op}-${e.text}`))})}):(0,Y.jsx)(`p`,{className:`m-0 py-2 text-body-sm text-muted`,children:e.state===`starting`?D||O?`Starting ${e.app}…`:`Opening the browser…`:`Nothing yet: do the first step ${O?`on the screen`:`in ${D?e.app:`the browser`}`}.`})]}),F=e.case&&(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,Y.jsx)(mt,{id:`rec-case`,icon:ee,title:e.case.id,description:`${e.case.title}. Each step you record belongs to the case step you are on: pick one to record it.`}),(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.case.steps.map(r=>{let i=e.steps.some(e=>e.case_step===r.n);return(0,Y.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,Y.jsxs)(`button`,{type:`button`,disabled:n,"aria-current":r.n===M?`step`:void 0,onClick:()=>t({cmd:`case_step`,n:r.n}),className:d(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`items-start gap-2 px-2`),children:[i?(0,Y.jsx)(ce,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(`span`,{className:`mt-1 w-4 flex-none text-center text-body-sm text-muted`,children:r.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r.action}),r.expected&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,r.expected]})]})]})},r.n)})}),(0,Y.jsxs)(x,{disabled:n,onClick:()=>t({cmd:`case_next`}),className:`self-start`,"data-tip":`Next case step`,children:[(0,Y.jsx)(Ie,{"aria-hidden":`true`}),`Next`]})]}),I=(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:d(s,`flex flex-col gap-2`),children:[(0,Y.jsx)(mt,{id:`rec-log`,icon:xe,title:`What the recorder says`}),(0,Y.jsx)(`div`,{ref:T,className:`flex max-h-[280px] flex-col gap-1 overflow-auto text-body-sm`,"aria-live":`polite`,children:e.log.length?e.log.map((e,t)=>(0,Y.jsx)(`p`,{className:d(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,Y.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,O?`the device`:D?`the app`:`the browser`,`…`]})})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:d(s,`flex flex-wrap items-center gap-x-4 gap-y-4`),children:[A?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,Y.jsx)(C,{state:e.state===`starting`?`waiting`:e.state===`stopping`?`working`:`recording`,px:20}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,Y.jsxs)(`span`,{className:`truncate text-body-sm text-muted`,children:[e.state===`starting`?O?`Starting ${e.app} on ${e.device||`the device`}…`:D?`Starting ${e.app}…`:`Opening the browser…`:e.state===`stopping`?`Saving the workflow…`:A?`Paused: what you do now is not recorded`:`Recording`,` · `,yn(e.startedAt),` ·`,` `,O?`${e.app} on ${e.device||`the device`}`:D?`${e.app}, a desktop app`:e.url]}),e.block&&(0,Y.jsx)(`span`,{className:d(`text-body-sm [overflow-wrap:anywhere]`,e.block.state===`stopped`?`text-warn`:`text-muted`),children:e.block.kind===`recording`?e.block.state===`waiting`?`The recording's steps up to step ${e.block.total+1} play when the page is open.`:e.block.state===`playing`?`Doing the recording's steps up to step ${e.block.total+1}: wait for it.`:e.block.state===`done`?`At step ${e.block.total+1}: record what comes next, then Stop and save.`:`Step ${e.block.done+2} could not be done${e.block.note?` (${e.block.note})`:``}: do it and what follows by hand; it takes the place of steps ${e.block.done+2} to ${e.block.total+1}.`:e.block.state===`waiting`?`The block "${e.block.name}" plays when the page is open.`:e.block.state===`playing`?`Doing the block "${e.block.name}" (${e.block.total} steps): wait for it.`:e.block.state===`done`?`The block "${e.block.name}" is done: carry on.`:`The block "${e.block.name}" stopped after ${e.block.done} of ${e.block.total} steps${e.block.note?` (${e.block.note})`:``}: do the rest by hand.`})]}),k&&(0,Y.jsxs)(x,{disabled:n||e.state===`starting`,onClick:()=>t({cmd:`pause`}),children:[A?(0,Y.jsx)(fe,{"aria-hidden":`true`}):(0,Y.jsx)(L,{"aria-hidden":`true`}),A?`Resume`:`Pause`]}),!D&&(0,Y.jsxs)(x,{disabled:n||e.state===`starting`||!e.steps.length,onClick:()=>t({cmd:`undo`}),"data-tip":`Remove the last step`,children:[(0,Y.jsx)(ue,{"aria-hidden":`true`}),`Undo`]}),f&&y&&(0,Y.jsxs)(`span`,{className:`relative inline-block`,children:[(0,Y.jsxs)(x,{disabled:n||e.state!==`recording`||e.block?.state===`playing`||e.block?.state===`waiting`,"aria-haspopup":`dialog`,"aria-expanded":m,onClick:()=>{m||(v(c[0]?.id??``),w(Et(c[0],l))),g(!m)},"data-tip":`Do a saved block's steps here, then carry on`,children:[(0,Y.jsx)(Ee,{"aria-hidden":`true`}),`Play a block`]}),(0,Y.jsx)(h,{open:m,onClose:()=>g(!1),label:`Play a block`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 p-2`,onSubmit:e=>{e.preventDefault(),Tt(y,b)&&(g(!1),f(y.id,Ot(b)))},children:[(0,Y.jsx)(r,{"aria-label":`The block to play now`,value:y.id,onChange:e=>{v(e.target.value),w(Et(c.find(t=>t.id===e.target.value),l))},children:c.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))}),(0,Y.jsx)(kt,{block:y}),(0,Y.jsx)(Dt,{block:y,secrets:l,use:b,onChange:w,unset:u}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:O?`Its steps are done on the device now and go into the recording here; a step that cannot be done, you do by hand.`:D?`Its steps are done in the app now and go into the recording here: keep your hands off the mouse and keys until it is done.`:`The recorder pauses while it opens the block's start page and does its steps; they go into the recording here.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:!Tt(y,b),"data-tip":`Play the block now`,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),`Play`]})]})})]}),(0,Y.jsxs)(x,{variant:`destructive`,disabled:n||e.state===`stopping`,onClick:()=>t({cmd:`stop`,...j?{force:!0}:{}}),"data-tip":j?`Stop anyway`:`Stop and save`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),O?(0,Y.jsxs)(`p`,{className:d(S.info,`m-0 leading-relaxed`),children:[`Do the steps on the screen below: a click is done on the device and becomes a step, found again by the control's id or text. Pick `,(0,Y.jsx)(`strong`,{children:`Check`}),` and click what shows the outcome to add a check. A password field takes only a saved secret, by its name.`]}):D?(0,Y.jsxs)(`p`,{className:d(S.info,`m-0 leading-relaxed`),children:[e.app,` is open on this computer: do the steps in it. Only clicks and keys in its own windows are recorded; password fields are saved as secret names, never as what you type. In the app, `,(0,Y.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,Y.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,Y.jsxs)(`p`,{className:d(S.info,`m-0 leading-relaxed`),children:[`Do the steps in the browser on this computer: each click, entry and choice is recorded. When you stop, you choose the checks and the test data here. In the page, `,e.leader,` then `,(0,Y.jsx)(`strong`,{children:`P`}),` pauses, `,(0,Y.jsx)(`strong`,{children:`Z`}),` undoes the last step and `,(0,Y.jsx)(`strong`,{children:`S`}),` stops.`]}),O?(0,Y.jsx)(`div`,{className:`@container`,children:(0,Y.jsxs)(`div`,{className:d(`grid items-start gap-6`,N?`[--phone-max:100cqw] @2xl:grid-cols-2`:`[--phone-max:100cqw] @2xl:grid-cols-[auto_minmax(280px,1fr)] @2xl:[--phone-max:calc(100cqw-304px)] @5xl:grid-cols-[minmax(240px,1fr)_auto_minmax(240px,1fr)] @5xl:[--phone-max:calc(100cqw-528px)]`),children:[(0,Y.jsx)(Dn,{s:e,busy:n,secrets:i,links:o,send:t,fit:!N,className:N?`@2xl:col-span-2`:`@2xl:col-start-1 @2xl:row-span-2 @2xl:row-start-1 @5xl:col-start-2 @5xl:row-span-1`}),(0,Y.jsx)(`div`,{className:d(`flex min-w-0 flex-col`,!N&&`@2xl:col-start-2 @2xl:row-start-1 @5xl:col-start-1`),children:P}),(0,Y.jsxs)(`div`,{className:d(`flex min-w-0 flex-col gap-6`,!N&&`@2xl:col-start-2 @2xl:row-start-2 @5xl:col-start-3 @5xl:row-start-1`),children:[ne,F,I]})]})}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-6`,children:[P,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-6`,children:[F,I]})]})]})}function An({s:e}){let t=e.result,[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(!1);if(!t)return null;let o=e.kind!==`web`,c=!t.ok&&t.error?It(t.error,e.kind):null;return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:d(s,`flex max-w-[1024px] flex-col gap-2`,!t.ok&&`bg-fail-soft`),children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-4`,children:[t.ok?(0,Y.jsx)(ce,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(Je,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-fail`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`p`,{id:`rec-result`,className:`m-0 font-medium [overflow-wrap:anywhere]`,children:t.ok?`${e.name} is recorded`:`${e.name} was not recorded`}),(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[t.ok?t.summary||e.summary:c||`The recording stopped with an error before its first step.`,e.endedAt&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[` · stopped after `,yn(e.startedAt,e.endedAt)]})]})]}),t.ok&&(0,Y.jsx)(A,{tone:`pass`,children:`Recorded`})]}),t.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-body-sm`,children:[(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:u(e.steps.length,`step`)}),(0,Y.jsxs)(A,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,Y.jsxs)(A,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,Y.jsxs)(A,{tone:`neutral`,icon:!1,children:[`test data: `,t.testData.join(`, `)]})]}),!o&&t.secrets.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`code`,{className:`font-mono text-body-sm`,children:e})]},e)),` `,`from the environment: what you typed there was not saved. Set `,t.secrets.length===1?`it`:`them`,` before the test runs.`]}),t.caseGaps.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-body-sm text-warn`,children:t.caseGaps.map(e=>(0,Y.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:t.notes.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-body-sm text-muted`,children:t.skipped.map((e,t)=>(0,Y.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[o&&t.workflow&&(0,Y.jsxs)(x,{variant:`primary`,disabled:i,onClick:async()=>{a(!0);try{await xn(t.workflow,e.kind===`mobile`?`mobile`:`desktop`)}catch(e){r(e.message),a(!1)}},children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),`Replay`]}),o&&t.report&&(0,Y.jsxs)(x,{onClick:async()=>r(await k(t.report)),"data-tip":`Open the report`,children:[(0,Y.jsx)(Oe,{"aria-hidden":`true`}),`Report`]}),!o&&t.ok&&(0,Y.jsxs)(x,{onClick:async()=>r(await k(`${e.runDir}/trace.md`)),"data-tip":`Read the steps`,children:[(0,Y.jsx)(He,{"aria-hidden":`true`}),`Steps`]}),(0,Y.jsx)(`span`,{className:`flex min-w-0 max-w-full text-body-sm`,children:(0,Y.jsx)(O,{path:o&&t.workflow?t.workflow:e.runDir})}),n&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:n})]}),!t.ok&&t.error&&(0,Y.jsx)(ut,{title:`What the recorder said`,children:(0,Y.jsx)(`code`,{className:d(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`block max-h-[120px]`),children:t.error})})]})}function jn(e){try{let t=decodeURIComponent(e);return t&&t.length<=500&&!/[\0\r\n]/.test(t)?t:null}catch{return null}}var Mn={emulator:`this computer's emulators`,device:`phones plugged into this computer`,testmu:`TestMu AI`,browserstack:`BrowserStack`};function Nn({place:e,listing:t,loading:n,error:r}){let i=e===`testmu`||e===`browserstack`;return n?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-muted`,children:[(0,Y.jsx)(De,{size:14,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),i?`Connecting to ${Mn[e]}…`:`Looking for devices…`]}):r||t&&!t.ready?(0,Y.jsxs)(`span`,{className:`flex items-start gap-2 text-fail`,children:[(0,Y.jsx)(Je,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r||t?.problem})]}):t?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-ink-2`,children:[(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`,className:`flex-none text-pass`}),i?`Connected to ${Mn[e]} · ${u(t.devices.length,`device`)}`:`${u(t.devices.length,`device`)} on ${Mn[e]}`]}):null}function Pn({open:e,onClose:t,place:n,app:r,listing:i,loading:a,error:o,picked:s,onUse:c,onRefresh:l}){let[u,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(s);(0,J.useEffect)(()=>{e&&m(s)},[e,s]);let h=i?.devices??[],g=u.trim().toLowerCase(),_=g?h.filter(e=>e.label.toLowerCase().includes(g)):h,v=h.some(e=>e.id===p);return(0,Y.jsx)(rt,{open:e,onClose:t,title:`Choose a device`,description:`For ${r} on ${Mn[n]}: the devices there now.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:v?h.find(e=>e.id===p).label:`None chosen`}),(0,Y.jsxs)(x,{onClick:t,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(x,{variant:`primary`,disabled:!v,onClick:()=>(c(p),t()),children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Use`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 text-body-sm`,children:(0,Y.jsx)(Nn,{place:n,listing:i,loading:a,error:o})}),(0,Y.jsxs)(x,{size:`sm`,disabled:a,onClick:l,"data-tip":`Ask again`,children:[(0,Y.jsx)(V,{"aria-hidden":`true`}),`Refresh`]})]}),i&&!i.build.ok&&(0,Y.jsxs)(`p`,{role:`alert`,className:d(S.warn,`m-0 flex items-start gap-2`),children:[(0,Y.jsx)(F,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:i.build.note})]}),h.length>6&&(0,Y.jsx)(`div`,{className:`flex`,children:(0,Y.jsx)(w,{id:`rec-device-search`,label:`Find a device`,value:u,onChange:f,placeholder:`Galaxy, Pixel, 14…`,className:`max-w-none flex-1`})}),h.length>0&&(0,Y.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Devices`,className:`-mx-2 flex flex-col`,children:[_.map(e=>(0,Y.jsxs)(`label`,{className:d(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`px-2`,p===e.id&&`bg-tint-hover`),children:[(0,Y.jsx)(At,{name:`rec-device`,value:e.id,checked:p===e.id,onSelect:()=>m(e.id)}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[e.version?`${e.platform===`ios`?`iOS`:`Android`} ${e.version}`:``,e.type===`virtual`?e.running?`running`:`starts for the recording`:e.running?`connected`:``].filter(Boolean).join(` · `)})]})]},e.id)),!_.length&&(0,Y.jsxs)(`p`,{className:`m-0 px-2 py-2 text-body-sm text-muted`,children:[`No device matches “`,u.trim(),`”.`]})]})]})})}function Fn({view:e,busy:t,onStart:n,start:i}){let o=Ft(i),s=e.mobile.apps.length>0,[c,l]=(0,J.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:e.session?.kind===`mobile`&&s?`mobile`:`web`),[f,p]=(0,J.useState)(e.mobile.apps[0]?.name??``),m=e.mobile.devices[0]?.where,[h,g]=(0,J.useState)(m===`TestMu AI`?`testmu`:m===`BrowserStack`?`browserstack`:`emulator`),[y,b]=(0,J.useState)(null),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(!1),[D,O]=(0,J.useState)(``),[k,A]=(0,J.useState)(0),[j,ee]=(0,J.useState)(!1);(0,J.useEffect)(()=>{if(c!==`mobile`||!f)return;let e=!0;return E(!0),w(``),b(null),v.mobileDevices(h,f,k>0).then(t=>{e&&(b(t),O(e=>t.devices.some(t=>t.id===e)?e:t.devices.length===1?t.devices[0].id:``))},t=>e&&w(t.message)).finally(()=>e&&E(!1)),()=>{e=!1}},[c,h,f,k]);let[N,te]=(0,J.useState)(e.desktop.apps[0]??``),[ne,P]=(0,J.useState)(``),[L,z]=(0,J.useState)(``),[B,re]=(0,J.useState)(``),[ie,ae]=(0,J.useState)(!1),[oe,se]=(0,J.useState)(!1),[ce,le]=(0,J.useState)(``),[ue,de]=(0,J.useState)(o?``:e.apps[0]?.name??``),[fe,me]=(0,J.useState)(o),[he,ge]=(0,J.useState)(``),[V,ve]=(0,J.useState)(e.environment??``),[ye,be]=(0,J.useState)(!1),[xe,Ce]=(0,J.useState)(!1),[we,Te]=(0,J.useState)(``),[Ee,De]=(0,J.useState)(``),[Oe,ke]=(0,J.useState)([]);(0,J.useEffect)(()=>ke([]),[c,N,f]);let[Ae,je]=(0,J.useState)(``),Me=c===`web`?e.blocks.filter(e=>(e.kind??`web`)===`web`):e.blocks.filter(e=>e.kind===c&&e.app===(c===`mobile`?f:N)),Ne=c===`mobile`?e.mobile.secrets:c===`desktop`?e.desktop.secrets??[]:e.blockSecrets??[],Pe=Oe.flatMap(e=>(t=>t?[{block:t,use:e.use}]:[])(Me.find(t=>t.id===e.id))),Fe=c===`web`?Pe[0]?.block:void 0,Ie=Pe.every(e=>Tt(e.block,e.use)),Re=y?.devices.find(e=>e.id===D),ze=!!y&&y.build.ok&&!!Re,Be=c===`web`&&xe,Ve=Be?{asBlock:{name:we.trim(),...Ee.trim()?{section:Ee.trim()}:{}}}:{},He=Be&&!we.trim()?!1:c===`mobile`?s&&!!f&&ze&&Ie:c===`desktop`?e.desktop.available&&(!!N||!!ne.trim()&&!!L.trim())&&Ie:Fe?Ie:ue?!0:/^https?:\/\/\S+$/i.test(fe.trim()),Ue=Pe.length?{blocks:Pe.map(e=>({id:e.block.id,...Ot(e.use)}))}:{},H=Me.length>0&&(c!==`desktop`||!!N),Ke=e.environments.length>1&&(c!==`web`||!!ue),qe=c===`web`&&e.logins.length>0,Je=H||c===`web`||Ke||qe,Ye=c===`mobile`?`App and device`:c===`desktop`?`App`:`Start on`,Xe=c===`mobile`?(e=>e?`${f} starts on ${e.label}${h===`testmu`?` at TestMu AI`:h===`browserstack`?` at BrowserStack`:``}, and its screen is shown on this page: do the steps there. It is saved as a workflow that replays with no model.`:`Choose a device to record on.`)(y?.devices.find(e=>e.id===D)):c===`desktop`?`The app starts on this computer; do the steps in it. It is saved as a workflow that replays with no model.`:Be?`A browser opens on this computer: do the steps. When you stop, they are kept as the block${we.trim()?` "${we.trim()}"`:``} to start other recordings from, and the recording is kept too.`:`A browser opens on this computer: do the steps, then choose the checks and the test data here, and Quill writes the test.`,U=`flex min-w-0 flex-col gap-2 text-body-sm font-medium`,$e=`-mt-1 text-body-sm font-normal text-muted`;return(0,Y.jsx)(`div`,{className:`@container`,children:(0,Y.jsxs)(`form`,{"aria-label":`New recording`,className:`grid grid-cols-[minmax(0,1fr)] items-start gap-x-16 gap-y-6 @4xl:grid-cols-[minmax(0,640px)_320px]`,onSubmit:t=>{if(t.preventDefault(),He){if(c===`mobile`)return n({kind:`mobile`,app:f,target:{place:h,id:D},...V&&V!==e.environment?{env:V}:{},...Ue});if(c===`desktop`&&N)return n({kind:`desktop`,app:N,...V&&V!==e.environment?{env:V}:{},...Ue});if(c===`desktop`)se(!0),le(``),_.addApp({name:L.trim(),path:ne.trim(),...B.trim()?{args:B.trim()}:{},...V?{env:V}:{}}).then(t=>n({kind:`desktop`,app:t.name,...V&&V!==e.environment?{env:V}:{}}),e=>le(e.message)).finally(()=>se(!1));else{if(Fe)return n({...Ue,...Ae?{app:Ae}:{},...V&&V!==e.environment?{env:V}:{},signedIn:ye,...Ve});n({...ue?{app:ue}:{url:fe.trim()},...he.trim()?{case:he.trim()}:{},...V&&V!==e.environment?{env:V}:{},signedIn:ye,...Ve})}}},children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{id:`rec-kind`,className:`text-body-sm font-medium`,children:`What to record`}),(0,Y.jsx)(Ze,{labelledBy:`rec-kind`,value:c,onChange:l,className:`self-start`,options:[{id:`web`,label:`Web page`,icon:(0,Y.jsx)(pe,{size:14,"aria-hidden":`true`})},{id:`desktop`,label:`Desktop app`,icon:(0,Y.jsx)(M,{size:14,"aria-hidden":`true`}),...e.desktop.available?{}:{disabled:!0,tip:e.desktop.reason||`Windows only.`}},{id:`mobile`,label:`Mobile app`,icon:(0,Y.jsx)(Le,{size:14,"aria-hidden":`true`}),...s?{}:{disabled:!0,tip:`Add a mobile app in Settings → Mobile first.`}}]})]}),(0,Y.jsx)(`div`,{role:`group`,"aria-label":Ye,className:`grid gap-4 @2xl:grid-cols-2`,children:c===`mobile`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 @2xl:col-span-2`,children:[(0,Y.jsx)(`span`,{id:`rec-place`,className:`text-body-sm font-medium`,children:`Record on`}),(0,Y.jsx)(Ze,{labelledBy:`rec-place`,value:h,onChange:g,className:`self-start`,options:[{id:`emulator`,label:`Emulator`,icon:(0,Y.jsx)(Ge,{size:14,"aria-hidden":`true`})},{id:`device`,label:`Real device`,icon:(0,Y.jsx)(We,{size:14,"aria-hidden":`true`})},{id:`testmu`,label:`TestMu AI`,icon:(0,Y.jsx)(_e,{size:14,"aria-hidden":`true`})},{id:`browserstack`,label:`BrowserStack`,icon:(0,Y.jsx)(_e,{size:14,"aria-hidden":`true`})}]})]}),(0,Y.jsxs)(`label`,{className:U,children:[`App`,(0,Y.jsx)(r,{"aria-label":`App`,value:f,onChange:e=>p(e.target.value),children:e.mobile.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.platform===`ios`?`iOS`:`Android`]},e.name))})]}),(0,Y.jsxs)(`div`,{className:d(U,`@2xl:col-span-2`),children:[(0,Y.jsx)(`span`,{id:`rec-device`,children:`Device`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(a,{readOnly:!0,"aria-labelledby":`rec-device`,value:Re?Re.label:``,placeholder:`None chosen`,className:`min-w-0 flex-1 truncate font-normal`}),(0,Y.jsxs)(x,{type:`button`,disabled:!f,onClick:()=>ee(!0),"data-tip":`Choose a device on ${h===`testmu`?`TestMu AI`:h===`browserstack`?`BrowserStack`:`this computer`}`,children:[(0,Y.jsx)(Le,{"aria-hidden":`true`}),`Choose`]})]}),(0,Y.jsx)(`span`,{className:`text-body-sm font-normal`,children:(0,Y.jsx)(Nn,{place:h,listing:y,loading:T,error:C})})]}),y&&!y.build.ok&&(0,Y.jsxs)(`p`,{role:`alert`,className:d(S.warn,`m-0 flex items-start gap-2 @2xl:col-span-2`),children:[(0,Y.jsx)(F,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:y.build.note})]})]}):c===`desktop`?(0,Y.jsxs)(Y.Fragment,{children:[e.desktop.apps.length>0&&(0,Y.jsxs)(`label`,{className:U,children:[`App`,(0,Y.jsxs)(r,{"aria-label":`App`,value:N,onChange:e=>te(e.target.value),children:[e.desktop.apps.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e)),(0,Y.jsx)(`option`,{value:``,children:`Another app…`})]})]}),!N&&(0,Y.jsxs)(`div`,{className:U,children:[(0,Y.jsx)(`span`,{children:`Program`}),(0,Y.jsx)(wt,{value:ne,onChange:e=>{P(e),ie||z(e.trim()?Ct(e):``)},onPicked:(e,t)=>{ie||z(t)},onError:le,className:`flex-1`})]})]}):Fe?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 @2xl:col-span-2`,children:[(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm [overflow-wrap:anywhere]`,children:[`Opens `,(e=>e?`${new URL(Fe.startUrl).pathname} on ${e.url}`:Fe.startUrl)(e.apps.find(e=>e.name===Ae)),`, does `,Pe.length>1?`the blocks `:`the block `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:Pe.map(e=>e.block.name).join(`, then `)}),` (`,u(Pe.reduce((e,t)=>e+t.block.steps,0),`step`),`), then you carry on.`]}),e.apps.length>0&&(0,Y.jsxs)(r,{"aria-label":`Play the blocks on`,value:Ae,onChange:e=>je(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`On the site the block was recorded on`}),e.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[`On `,e.name,` (`,e.url,`)`]},e.name))]})]}):(0,Y.jsxs)(Y.Fragment,{children:[e.apps.length>0&&(0,Y.jsxs)(`label`,{className:U,children:[`Start on`,(0,Y.jsxs)(r,{"aria-label":`Start on`,value:ue,onChange:e=>de(e.target.value),children:[e.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,Y.jsx)(`option`,{value:``,children:`Another page…`})]})]}),!ue&&(0,Y.jsxs)(`label`,{className:U,children:[`Page address`,(0,Y.jsx)(a,{"aria-label":`Page address`,type:`url`,value:fe,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>me(e.target.value)})]})]})}),c===`desktop`&&!N&&(0,Y.jsxs)(`div`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`grid gap-4 @2xl:grid-cols-[minmax(0,220px)_minmax(0,1fr)]`),children:[(0,Y.jsxs)(`label`,{className:U,children:[`Save it as`,(0,Y.jsx)(a,{"aria-label":`The app's name`,value:L,maxLength:40,spellCheck:!1,placeholder:`billing`,onChange:e=>{ae(!0),z(e.target.value)}})]}),(0,Y.jsxs)(`label`,{className:U,children:[`Arguments `,(0,Y.jsx)(`span`,{className:$e,children:`Optional: what the app starts with. Quotes keep spaces together; no shell.`}),(0,Y.jsx)(a,{"aria-label":`The app's arguments`,value:B,maxLength:500,spellCheck:!1,placeholder:`--server qa-db01 --profile "Test User"`,onChange:e=>re(e.target.value),className:`font-mono text-body-sm`})]}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted @2xl:col-span-2`,children:[`Added to the apps of `,V||e.environment?`the ${V||e.environment} environment`:`forgeqe.yaml`,`, so you can replay it.`]})]}),Je&&(0,Y.jsxs)(`fieldset`,{className:`m-0 min-w-0 border-0 p-0 pt-6`,children:[(0,Y.jsxs)(`legend`,{className:`float-left mb-4 p-0 text-body-sm font-medium`,children:[`Options `,(0,Y.jsx)(`span`,{className:`font-normal text-muted`,children:`· optional`})]}),(0,Y.jsxs)(`div`,{className:`clear-left grid gap-x-6 gap-y-4 @2xl:grid-cols-2`,children:[H&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 text-body-sm font-medium`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[Oe.length?`Then the block`:`Start from a block`,` `,(0,Y.jsxs)(`span`,{className:`-mt-1 text-body-sm font-normal text-muted`,children:[c===`web`?`Its steps are done for you first, then you record the rest.`:`Its steps are done in ${c===`mobile`?`the app on the device`:`the app`} once it is open, then you record the rest.`,` Add more to do one after another.`]}),(0,Y.jsxs)(r,{value:``,disabled:Oe.length>=10,onChange:e=>{let t=Me.find(t=>t.id===e.target.value);t&&ke([...Oe,{id:t.id,use:Et(t,Ne)}])},children:[(0,Y.jsx)(`option`,{value:``,children:Oe.length?`Add another block`:`No block: start on the page`}),Me.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))]})]}),Pe.length>0&&(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:Pe.map((n,r)=>(0,Y.jsxs)(`li`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2 font-normal`),children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 text-body-sm text-ink [overflow-wrap:anywhere]`,children:[r+1,`. `,n.block.name]}),(0,Y.jsx)(x,{type:`button`,size:`icon`,variant:`icon`,disabled:t,"aria-label":`Leave out the block ${n.block.name}`,"data-tip":`Leave it out`,onClick:()=>ke(Oe.filter((e,t)=>t!==r)),className:`size-8`,children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),(0,Y.jsx)(kt,{block:n.block}),(0,Y.jsx)(Dt,{block:n.block,secrets:Ne,use:n.use,onChange:e=>ke(Oe.map((t,n)=>n===r?{...t,use:e}:t)),unset:e.unsetSecrets??[]})]},`${n.block.id}-${r}`))})]}),c===`web`&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm font-medium`,children:[`Test case `,(0,Y.jsx)(`span`,{className:`-mt-1 text-body-sm font-normal text-muted`,children:`Its steps are listed while you record; each one you do is tied to it.`}),(0,Y.jsx)(a,{value:he,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>ge(e.target.value)})]}),Ke&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm font-medium`,children:[`Environment `,(0,Y.jsx)(`span`,{className:`-mt-1 text-body-sm font-normal text-muted`,children:`Where the app's address and sign-ins come from.`}),(0,Y.jsx)(r,{value:V,onChange:e=>ve(e.target.value),children:e.environments.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})]}),qe&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-4 @2xl:col-span-2`,children:[(0,Y.jsx)(Qe,{checked:ye,onChange:be,label:`Start signed in`}),(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Start signed in`}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`With the saved sign-ins (`,e.logins.join(`, `),`). Off: the sign-in is recorded too, its password saved as a variable name, never as typed.`]})]})]}),c===`web`&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-4 @2xl:col-span-2`,children:[(0,Y.jsx)(Qe,{checked:xe,onChange:Ce,label:`Record a block`}),(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Record a block`}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Steps you do in many tests, like signing in: when you stop, they are kept under a name to start other recordings from or play in the middle of one.`})]})]}),Be&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{className:U,children:[`Block name`,(0,Y.jsx)(a,{"aria-label":`Block name`,value:we,maxLength:80,placeholder:`Sign in`,onChange:e=>Te(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:U,children:[`Section `,(0,Y.jsx)(`span`,{className:$e,children:`Optional: where it is listed with others, like Account.`}),(0,Y.jsx)(a,{"aria-label":`Section`,value:Ee,maxLength:40,placeholder:`Account`,list:`rec-block-sections`,onChange:e=>De(e.target.value)}),(0,Y.jsx)(`datalist`,{id:`rec-block-sections`,children:[...new Set(e.blocks.flatMap(e=>e.section?[e.section]:[]))].map(e=>(0,Y.jsx)(`option`,{value:e},e))})]})]})]})]}),ce&&(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:ce})]}),(0,Y.jsx)(Z,{kind:c}),c===`mobile`&&(0,Y.jsx)(Pn,{open:j,onClose:()=>ee(!1),place:h,app:f,listing:y,loading:T,error:C,picked:D,onUse:O,onRefresh:()=>A(e=>e+1)}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 pt-4 @4xl:col-span-2`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] items-start gap-2 text-body-sm text-muted`,children:[(0,Y.jsx)(Se,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:Xe})]}),(0,Y.jsxs)(x,{busy:oe,type:`submit`,variant:`primary`,disabled:t||oe||!He,"data-tip":`Start recording`,className:`min-h-11`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),oe?`Adding…`:t?c===`web`?`Opening…`:`Starting…`:`Record`]})]})]})})}function In(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function Ln({view:e}){let t=e.recordings,n=t.filter(e=>e.seconds!==void 0),r=n.reduce((e,t)=>e+(t.seconds??0),0),i=t.filter(e=>e.kind===`web`&&bt(e.test).hasTest).length,a=Math.round(r/60),o=Math.floor(a/60),s=a%60;return(0,Y.jsxs)(Xe,{label:`Recordings in numbers`,children:[(0,Y.jsx)(et,{compact:!0,icon:fe,label:`Recordings`,value:String(t.length),note:t.some(e=>e.kind!==`web`)?[[`web`,`web`],[`desktop`,`desktop`],[`mobile`,`mobile`]].map(([e,n])=>[t.filter(t=>t.kind===e).length,n]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}`).join(`, `):`web pages`}),(0,Y.jsx)(et,{compact:!0,icon:Fe,label:`Tests written`,value:String(i),note:`from these recordings`}),(0,Y.jsx)(et,{compact:!0,icon:Ee,label:`Reusable flows`,value:String(e.blocks.length),note:`blocks kept to use again`}),(0,Y.jsx)(et,{compact:!0,icon:he,label:`Total duration`,value:n.length?o?`${o}h ${s}m`:`${s}m`:`—`,note:n.length?`${u(n.length,`recording`)} timed`:`kept from now on`})]})}function Z({kind:e}){let t=[{icon:I,title:`Record your journey`,text:`Each tap, click, entry and choice in ${e===`web`?`the browser`:e===`mobile`?`the app on the device`:`the app`} is recorded in order.`},{icon:we,title:`Define checks`,text:`Choose what each step must show, and where typed values come from.`},e===`web`?{icon:Fe,title:`Generate the test`,text:`Write turns it into a test in your repository; Re-run plays it on any environment.`}:{icon:fe,title:`Replay it`,text:`It is saved as a workflow that replays with no model, on any environment.`}];return(0,Y.jsxs)(`aside`,{"aria-labelledby":`rec-how`,className:d(s,`flex flex-col gap-4`),children:[(0,Y.jsx)(mt,{id:`rec-how`,icon:re,title:`How it works`,level:3}),(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:t.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-4`,children:[(0,Y.jsx)(vt,{state:`pending`,n:t+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-body-sm font-medium`,children:[(0,Y.jsx)(T,{icon:e.icon,size:14,className:`flex-none text-icon`}),e.title]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.text})]})]},e.title))})]})}function Rn({anchor:e,open:t,onClose:n,label:r,align:i,children:a}){let o=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(!t)return;let n=setTimeout(()=>o.current?.querySelector(`[role^="menuitem"]`)?.focus(),0),r=o.current;return()=>{clearTimeout(n);let t=document.activeElement;setTimeout(()=>{let n=document.activeElement;(!n||n===document.body||n===t&&r?.contains(n))&&e?.querySelector(`button`)?.focus()},0)}},[t,e]),(0,Y.jsx)(`div`,{ref:o,className:`contents`,onKeyDown:e=>{let t=[...o.current?.querySelectorAll(`[role^="menuitem"]`)??[]],r=t.indexOf(document.activeElement);e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),t[(r+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()):e.key===`Tab`&&n()},children:(0,Y.jsx)(h,{open:t,onClose:n,label:r,anchor:e,align:i===`right`?`end`:`start`,className:`w-[230px] text-left`,children:a})})}function zn(){let[e,t]=(0,J.useState)(!1),n=(0,J.useRef)(0);return[e,(0,J.useCallback)(e=>{e||(n.current=Date.now()),t(e)},[]),(0,J.useCallback)(()=>{Date.now()-n.current<300||t(e=>!e)},[])]}function Bn({r:e,onReview:t,onWrite:r,onDelete:i,onNote:a}){let[o,s,c]=zn(),l=(0,J.useRef)(null),u=bt(e.test),d=e=>()=>{s(!1),e()};return(0,Y.jsxs)(`span`,{ref:l,className:`relative inline-block`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`More for ${e.name}`,"data-tip":`More for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":o,onClick:c,children:(0,Y.jsx)(ge,{"aria-hidden":`true`})}),(0,Y.jsxs)(Rn,{anchor:l.current,open:o,onClose:()=>s(!1),label:`More for ${e.name}`,align:`right`,children:[(e.kind===`web`&&e.ok||e.kind!==`web`&&e.workflow)&&(0,Y.jsx)(p,{onClick:d(t),children:`Open the recording`}),e.kind!==`web`&&e.workflow&&(0,Y.jsx)(p,{onClick:d(()=>xn(e.workflow,e.kind===`mobile`?`mobile`:`desktop`).catch(e=>a(e.message))),children:`Replay`}),e.kind===`web`&&e.ok&&u.hasTest&&e.test?.testFile&&(0,Y.jsx)(p,{onClick:d(()=>void xt(e.test.testFile).then(a)),children:`Open the test`}),e.kind===`web`&&e.ok&&!u.hasTest&&!u.writing&&(0,Y.jsx)(p,{onClick:d(r),children:`Write the test`}),e.test?.chat&&(0,Y.jsx)(p,{onClick:d(()=>location.hash=n(`chats`,e.test.chat)),children:`Open the chat`}),e.trace&&(0,Y.jsx)(p,{onClick:d(()=>void k(e.trace).then(a)),children:`Read the steps`}),e.report&&(0,Y.jsx)(p,{onClick:d(()=>void k(e.report).then(a)),children:`Open the report`}),(0,Y.jsx)(p,{onClick:d(i),children:(0,Y.jsx)(`span`,{className:`text-fail`,children:`Delete`})})]})]})}function Vn({r:e,onNote:t}){let n=bt(e.test);return(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,onClick:e=>e.stopPropagation(),children:[e.kind===`web`&&e.ok&&(0,Y.jsx)(`span`,{"data-tip":`${n.detail}${e.test?.testFile?` (${e.test.testFile})`:``}`,children:(0,Y.jsx)(A,{tone:n.tone,icon:n.tone!==`neutral`,className:`min-h-5 px-2 text-body-sm`,children:n.label})}),n.hasTest&&e.test?.testFile&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the test of ${e.name}`,"data-tip":`Open ${e.test.testFile}`,onClick:async()=>t(await xt(e.test.testFile)),children:(0,Y.jsx)(Fe,{"aria-hidden":`true`})}),(e.yaml||e.kind===`mobile`&&e.workflow)&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the workflow of ${e.name}`,"data-tip":`Open the YAML workflow`,onClick:async()=>t(await k(e.yaml||e.workflow)),children:(0,Y.jsx)(B,{"aria-hidden":`true`})}),e.trace&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Read the steps of ${e.name}`,"data-tip":`Read the steps`,onClick:async()=>t(await k(e.trace)),children:(0,Y.jsx)(He,{"aria-hidden":`true`})}),e.report&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.name}`,"data-tip":`Open the report`,onClick:async()=>t(await k(e.report)),children:(0,Y.jsx)(Oe,{"aria-hidden":`true`})})]})}function Hn({rows:e,onReview:t,onReviewDesktop:r,onDeleted:i,onChanged:a}){let[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)([]),[f,p]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,y,b]=zn(),S=(0,J.useRef)(null),[C,E]=(0,J.useState)(`any`),[D,O]=(0,J.useState)(``),[k,j]=(0,J.useState)(`all`);(0,J.useEffect)(()=>l(t=>t.filter(t=>e.some(e=>e.runDir===t))),[e]);let ee=async()=>{g(!0),s(``);try{let e=c.length;i(await v.deleteRecordings(c)),l([]),s(`Deleted ${u(e,`recording`)}.`)}catch(e){s(e.message)}finally{g(!1),p(!1)}},te=e=>e.kind===`web`&&bt(e.test).hasTest,P=k===`all`?e:e.filter(e=>e.kind===k),F=D.toLowerCase().split(/\s+/).filter(Boolean),L=F.length?P.filter(e=>F.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl} ${e.browser||``} ${e.test?.testFile||``} ${e.kind===`web`?bt(e.test).label:``}`.toLowerCase().includes(t))):P,z=C===`any`?L:L.filter(e=>e.kind===`web`&&C===`written`===te(e)),B=z,re=new Set(e.map(e=>e.kind)).size>1,ie=C!==`any`||k!==`all`,ae=e=>{l([e]),p(!0)},oe=e=>bn(e).then(()=>a(),e=>s(e.message)),se=(0,Y.jsxs)(`span`,{ref:S,className:`relative inline-block`,children:[(0,Y.jsxs)(x,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":_,onClick:b,"data-tip":`Show only some recordings`,children:[`Filter`,ie?` · on`:``,(0,Y.jsx)(ne,{"aria-hidden":`true`})]}),(0,Y.jsxs)(Rn,{anchor:S.current,open:_,onClose:()=>y(!1),label:`Show only`,align:`left`,children:[[[`any`,`Any test`],[`written`,`Test written (${e.filter(te).length})`],[`none`,`No test yet (${e.filter(e=>e.kind===`web`&&!te(e)).length})`]].map(([e,t])=>(0,Y.jsx)(m,{role:`menuitemradio`,checked:C===e,onSelect:()=>E(e),children:(0,Y.jsx)(`span`,{className:`flex-1`,children:t})},e)),re&&[[`all`,`Every kind`],[`web`,`Web pages`],[`desktop`,`Desktop apps`],[`mobile`,`Mobile apps`]].map(([e,t],n)=>(0,Y.jsx)(`span`,{className:d(`block`,n===0&&`mt-1 border-t border-line-soft pt-1`),children:(0,Y.jsx)(m,{role:`menuitemradio`,checked:k===e,onSelect:()=>j(e),children:(0,Y.jsx)(`span`,{className:`flex-1`,children:t})})},e))]})]});return(0,Y.jsxs)(ft,{id:`rec-all`,icon:I,title:`All recordings`,n:z.length,children:[o&&(0,Y.jsx)(`p`,{role:`status`,className:d(`m-0 text-body-sm`,o.startsWith(`Deleted`)?`text-muted`:`text-fail`),children:o}),(0,Y.jsx)(ct,{label:`Recordings`,resetKey:`${C}-${k}-${D}`,search:!1,size:25,height:W,selection:{count:c.length,onClear:()=>l([]),actions:(0,Y.jsxs)(x,{size:`sm`,variant:`danger`,disabled:!c.length||h,"data-tip":`Delete the selected recordings`,onClick:()=>p(!0),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Delete`]})},tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(w,{id:`rec-search`,label:`Search recordings`,placeholder:`Search recordings`,value:D,onChange:O}),se]}),empty:F.length||ie?`Nothing matches.`:`No recordings yet.`,head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`w-9`),children:(0,Y.jsx)(K,{"aria-label":`Select all ${u(B.length,`recording`)}`,"data-tip":`Select all ${u(B.length,`recording`)} the search and filter keep`,checked:B.length>0&&B.every(e=>c.includes(e.runDir)),onCheckedChange:e=>l(e?[...new Set([...c,...B.map(e=>e.runDir)])]:c.filter(e=>!B.some(t=>t.runDir===e)))})}),(0,Y.jsx)(`th`,{scope:`col`,className:st,children:`Recording`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @3xl:table-cell`),children:`Test case`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @4xl:table-cell`),children:`Browser`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(lt,`hidden @4xl:table-cell`),children:`Duration`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @xl:table-cell`),children:`Outputs`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @2xl:table-cell`),children:`Created`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`w-10`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`More`})})]}),children:B.map(e=>{let i=e.kind!==`web`&&!!e.workflow,a=e.kind===`web`&&e.ok||i,o=()=>i?r(e.workflow):t(e.runDir);return(0,Y.jsxs)(`tr`,{onClick:a?o:void 0,className:a?ot:at,"data-state":c.includes(e.runDir)?`selected`:void 0,children:[(0,Y.jsx)(`td`,{className:G,onClick:e=>e.stopPropagation(),children:(0,Y.jsx)(K,{"aria-label":`Select ${e.name}`,checked:c.includes(e.runDir),onCheckedChange:t=>l(t?[...c,e.runDir]:c.filter(t=>t!==e.runDir))})}),(0,Y.jsx)(`td`,{className:G,children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[e.ok?e.kind===`desktop`?(0,Y.jsx)(T,{icon:M,size:16,className:`mt-1 flex-none text-muted`,label:`Desktop app`}):e.kind===`mobile`?(0,Y.jsx)(T,{icon:Le,size:16,className:`mt-1 flex-none text-muted`,label:`Mobile app`}):(0,Y.jsx)(T,{icon:pe,size:16,className:`mt-1 flex-none text-muted`,label:`Web page`}):(0,Y.jsx)(Je,{size:16,"aria-label":`Not recorded`,className:`mt-1 flex-none text-fail`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[a?(0,Y.jsx)(`a`,{href:i?n(`record`):yt(e.runDir),onClick:e=>{e.stopPropagation(),(i||!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.button===0)&&(e.preventDefault(),o())},className:`truncate font-medium text-ink no-underline hover:underline`,"data-tip":e.name,children:e.name}):(0,Y.jsx)(`span`,{className:`truncate font-medium text-ink`,"data-tip":e.name,children:e.name}),(0,Y.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:e.kind===`web`?e.startUrl:e.app}),e.kind===`web`&&e.ok&&(0,Y.jsx)(`span`,{className:`mt-1 @xl:hidden`,"data-tip":bt(e.test).detail,children:(0,Y.jsx)(A,{tone:bt(e.test).tone,icon:bt(e.test).tone!==`neutral`,className:`min-h-5 px-2 text-body-sm`,children:bt(e.test).label})})]})]})}),(0,Y.jsx)(`td`,{className:d(G,`hidden @3xl:table-cell`),children:e.caseId?(0,Y.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:e.caseId}):(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:d(G,`hidden text-ink-2 @4xl:table-cell`),children:e.browser??(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:d(it,`hidden text-ink-2 @4xl:table-cell`),"data-sort":e.seconds??-1,children:e.seconds===void 0?(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`}):In(e.seconds)}),(0,Y.jsx)(`td`,{className:d(G,`hidden @xl:table-cell`),children:(0,Y.jsx)(Vn,{r:e,onNote:s})}),(0,Y.jsx)(`td`,{className:d(G,`hidden whitespace-nowrap text-ink-2 @2xl:table-cell`),"data-tip":new Date(e.startedAt).toLocaleString(),"data-sort":new Date(e.startedAt).getTime()||0,children:nt(e.startedAt)}),(0,Y.jsx)(`td`,{className:d(G,`text-right`),children:(0,Y.jsx)(Bn,{r:e,onReview:o,onWrite:()=>void oe(e.runDir),onDelete:()=>ae(e.runDir),onNote:s})})]},e.runDir)})}),f&&(0,Y.jsx)(rt,{open:!0,onClose:()=>p(!1),title:`Delete ${u(c.length,`recording`)}`,description:`Their steps, screenshots, tries and reports are removed from this computer. Tests already written from them stay.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(x,{variant:`outline`,disabled:h,onClick:()=>p(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(x,{busy:h,variant:`destructive`,disabled:h,onClick:()=>void ee(),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),h?`Deleting…`:`Delete`]})]}),children:(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 pt-4 text-body-sm text-ink-2`,children:e.filter(e=>c.includes(e.runDir)).map(e=>(0,Y.jsxs)(`li`,{className:`truncate`,children:[e.name,` `,(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,nt(e.startedAt)]})]},e.runDir))})})]})}function Un({s:e}){let t=e.result;return!t||!(t.secrets.length+t.caseGaps.length+(t.notes??[]).length+t.skipped.length+(t.block||t.blockError?1:0))?null:(0,Y.jsxs)(`div`,{role:`status`,className:d(s,`flex flex-col gap-2 text-body-sm text-ink`),children:[(0,Y.jsx)(`p`,{className:`m-0 font-medium`,children:`Just recorded: worth knowing`}),t.block&&(0,Y.jsxs)(`p`,{className:`m-0 text-pass [overflow-wrap:anywhere]`,children:[`Kept as the block “`,t.block.name,`”: start other recordings from it on the Record page, or put it into one on its Blocks tab.`]}),t.blockError&&(0,Y.jsxs)(`p`,{className:`m-0 text-fail [overflow-wrap:anywhere]`,children:[`Not kept as a block: `,t.blockError,` The recording is kept; keep its steps as a block on its Blocks tab.`]}),t.secrets.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`code`,{className:`font-mono text-body-sm`,children:e})]},e)),` `,`from the environment: what you typed there was not saved. Set `,t.secrets.length===1?`it`:`them`,` before the test runs.`]}),t.caseGaps.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.caseGaps.map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsxs)(`span`,{className:`font-medium text-warn`,children:[`No check for case step `,e.n]}),`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.notes.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.skipped.map((e,t)=>(0,Y.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))})]})}function Q({sub:e}={}){let[t,r]=(0,J.useState)(null),i=e?.startsWith(`recording/`)||e?.startsWith(`workflow/`)?e.split(`/`):[],a=i[1]?jn(i[1]):null,o=e=>!!e&&!!t&&(t.recordings.some(t=>t.runDir===e)||t.session?.runDir===e),s=e=>!!e&&!!t&&(t.recordings.some(t=>t.workflow===e)||t.session?.result?.workflow===e),c=i[0]===`recording`&&o(a)?a:null,f=i[0]===`workflow`&&s(a)?a:null,p=i[2],m=e=>location.hash=e?n(`record`,`recording`,encodeURIComponent(e)):n(`record`,`recordings`),h=e=>location.hash=e?n(`record`,`workflow`,encodeURIComponent(e)):n(`record`,`recordings`),_=g(`coding`),y=e=>e===`agent`?_t:e===`recordings`?`recordings`:`new`,[C,w]=(0,J.useState)(i.length?`recordings`:y(e));(0,J.useEffect)(()=>{w(i.length?`recordings`:y(e))},[e]);let[T,E]=(0,J.useState)(``),[O,k]=(0,J.useState)(!1),A=(0,J.useCallback)(()=>{v.get().then(e=>{r(e),E(``)},e=>E(e.message))},[]);(0,J.useEffect)(A,[A]);let j=!!t?.session&&vn.has(t.session.state);(0,J.useEffect)(()=>{if(!j)return;let e=U(A,800);return()=>$e(e)},[j,A]);let ee=!!t?.recordings.some(e=>e.test?.state===`writing`||e.test?.state===`checking`);(0,J.useEffect)(()=>{if(!ee||j)return;let e=U(A,4e3);return()=>$e(e)},[ee,j,A]);let M=(0,J.useRef)(!1),N=t?.session;(0,J.useEffect)(()=>{j?M.current=!0:M.current&&N&&(M.current=!1,N.result?.ok&&N.kind===`web`&&m(N.runDir),N.result?.ok&&N.kind!==`web`&&N.result.workflow&&h(N.result.workflow),w(e=>e===`agent`?`new`:e))},[j,N]);let te=async e=>{k(!0),E(``);try{r(await e())}catch(e){E(e.message)}finally{k(!1)}},ne=(e,t,r)=>{location.hash=n(`record`),window.scrollTo({top:0,behavior:l()}),te(()=>v.start({more:{run:e,after:t,...r?{redo:r}:{}}}))},P=e=>{m(e),window.scrollTo({top:0})},F=!!N?.result&&!N.result.ok,L=!!c||!!f,R=e=>{h(e),window.scrollTo({top:0})},z=e=>{w(e),location.hash=e===`new`?n(`record`):n(`record`,e)};return(0,Y.jsxs)(gt,{title:dt(`record`),page:_,label:`Record`,current:C,onPick:z,tabs:[{id:`new`,label:j?`Recording`:`New recording`,icon:oe},{id:`recordings`,label:`Recordings`,icon:I,...t?.recordings.length?{n:t.recordings.length}:{}}],below:(0,Y.jsx)(ht,{page:_}),children:[!L&&(0,Y.jsx)(pt,{more:(0,Y.jsx)(Y.Fragment,{children:`ForgeQE opens the browser or app; each click, entry and choice is recorded in order, and you choose the checks after.`}),children:`Record a test by doing its steps yourself in a browser, a Windows app or a mobile app.`}),T&&(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:T}),!t&&!T&&(0,Y.jsx)(D,{shape:`lines`}),t&&N&&j&&(0,Y.jsx)(kn,{s:N,busy:O,secrets:t.mobile.secrets,devices:t.mobile.devices,links:t.mobile.links,blocks:t.blocks.filter(e=>(e.kind??`web`)===N.kind&&(N.kind===`web`||e.app===N.app)),blockSecrets:N.kind===`mobile`?t.mobile.secrets:N.kind===`desktop`?t.desktop.secrets??[]:t.blockSecrets??[],unsetSecrets:t.unsetSecrets??[],onPlayBlock:(e,t)=>void te(()=>v.playBlock(e,t)),send:e=>void te(()=>v.command(e))}),t&&!j&&c&&(0,Y.jsx)(Jt,{runDir:c,notices:N&&N.runDir===c?(0,Y.jsx)(Un,{s:N}):void 0,onRecordMore:(e,t)=>ne(c,e,t),tab:p,onTab:e=>location.hash=e===`steps`?n(`record`,`recording`,encodeURIComponent(c)):n(`record`,`recording`,encodeURIComponent(c),e),onClose:()=>{m(null),w(`recordings`),A()}},c),t&&!j&&f&&(0,Y.jsx)(q,{workflow:f,backLabel:`Recordings`,notices:N&&N.kind===`desktop`&&N.result?.workflow===f?(0,Y.jsx)(Un,{s:N}):void 0,tab:p,onTab:e=>location.hash=e===`steps`?n(`record`,`workflow`,encodeURIComponent(f)):n(`record`,`workflow`,encodeURIComponent(f),e),onClose:()=>{h(null),w(`recordings`),A()}},f),t&&!j&&!L&&(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`rec-panel-${C}`,"aria-labelledby":`rec-${C}`,className:`flex min-w-0 flex-col gap-4`,children:[C===`new`&&(0,Y.jsxs)(Y.Fragment,{children:[F&&(0,Y.jsx)(An,{s:N}),N?.result?.ok&&(N.kind===`web`||!!N.result.workflow)&&(0,Y.jsxs)(`div`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-center gap-4 text-body-sm`),children:[(0,Y.jsx)(ce,{size:16,"aria-hidden":`true`,className:`flex-none text-pass`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[`Last recorded: `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:N.name}),(0,Y.jsxs)(`span`,{className:`text-muted`,children:[` · `,u(N.steps.length,`step`)]})]}),(0,Y.jsxs)(x,{size:`sm`,onClick:()=>N.kind===`desktop`?R(N.result.workflow):P(N.runDir),"data-tip":`Open the recording`,children:[(0,Y.jsx)(Pe,{"aria-hidden":`true`}),`Open`]})]}),(0,Y.jsx)(Fn,{view:t,busy:O,start:e===`agent`||e===`recordings`?void 0:e,onStart:e=>void te(()=>v.start(e))})]}),C===`recordings`&&(t.recordings.length?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ln,{view:t}),(0,Y.jsx)(Hn,{rows:t.recordings,onReview:P,onReviewDesktop:R,onDeleted:r,onChanged:A})]}):(0,Y.jsx)(b,{page:!0,icon:I,title:`No recordings yet`,action:(0,Y.jsxs)(x,{size:`sm`,onClick:()=>z(`new`),"data-tip":`New recording`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Record`]}),children:`Record a test's steps once, and it shows here to review, check and turn into a test.`}))]})]})}export{Q as Record};
|