@capagents/forgeqe 3.2.2 → 3.2.4
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/HOW_TO_USE.md +9 -1
- package/dist/docs-site/docs/area-api/index.html +1 -1
- package/dist/docs-site/docs/get-started/index.html +7 -0
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1836 -1832
- package/dist/web/assets/{3d-force-graph-CTC0tr_c.js → 3d-force-graph-iP39yI0v.js} +1 -1
- package/dist/web/assets/{Agent-wRS-AWzy.js → Agent-COXI7WgW.js} +6 -6
- package/dist/web/assets/{AgentWork-GXWfoD_Z.js → AgentWork-LD5CQxet.js} +1 -1
- package/dist/web/assets/ApiTests-Dpwqmpr1.js +14 -0
- package/dist/web/assets/{Browse-B5RXYaB5.js → Browse-DIcTvI-C.js} +1 -1
- package/dist/web/assets/Chat-DNw_jYbD.js +3 -0
- package/dist/web/assets/{CommandPalette-BipNmH6a.js → CommandPalette-B6QRxOka.js} +1 -1
- package/dist/web/assets/{Compare-FHtKxtLJ.js → Compare-hz0ft2yP.js} +1 -1
- package/dist/web/assets/Cost-C231Bf_A.js +1 -0
- package/dist/web/assets/{Data-Ctg96el3.js → Data-DODs050c.js} +3 -3
- package/dist/web/assets/Desktop-CUV43rdi.js +1 -0
- package/dist/web/assets/DesktopReview-WEIFBq-L.js +2 -0
- package/dist/web/assets/{DeviceScreen-CoArZGyY.js → DeviceScreen-ClPTc5Ot.js} +1 -1
- package/dist/web/assets/{Evidence-D_90W10z.js → Evidence-DhN_bTZ-.js} +1 -1
- package/dist/web/assets/{Explore-CD7Mq4il.js → Explore-CjowiWJe.js} +2 -2
- package/dist/web/assets/{Features-CLHC2bGL.js → Features-BnagyBie.js} +1 -1
- package/dist/web/assets/Flags-DlkY7U4M.js +2 -0
- package/dist/web/assets/{Flaky-Bzt9VcYv.js → Flaky-BkD01mRw.js} +1 -1
- package/dist/web/assets/Impact-BM4_vIEv.js +3 -0
- package/dist/web/assets/Jobs-U9kJUVM9.js +5 -0
- package/dist/web/assets/{KindPage-CJcRnrTe.js → KindPage-BkK5AQw0.js} +3 -3
- package/dist/web/assets/{LiveDevice-BP47IrPa.js → LiveDevice-Bjc2r797.js} +1 -1
- package/dist/web/assets/{Migration-BaVfcEYa.js → Migration-BDDE_0TS.js} +5 -5
- package/dist/web/assets/{Mobile-CLoZlBuq.js → Mobile-D2qAF8X5.js} +1 -1
- package/dist/web/assets/{Observability-CaRIhlKg.js → Observability-CLFC0ze7.js} +1 -1
- package/dist/web/assets/PageAgent-Dz5CuEUe.js +1 -0
- package/dist/web/assets/{Product-BdY0j-z8.js → Product-DkEI-0vu.js} +4 -4
- package/dist/web/assets/Production-CgfLjbSa.js +1 -0
- package/dist/web/assets/Quality-8E667GJi.js +1 -0
- package/dist/web/assets/{Readiness-D4nY3Nr1.js → Readiness-Bbkq2lNV.js} +1 -1
- package/dist/web/assets/Record-JR4HeyTe.js +1 -0
- package/dist/web/assets/{Regression-DhNAgDgD.js → Regression-_9u6qDMk.js} +3 -3
- package/dist/web/assets/{RelationGraph-UXFyQOKO.js → RelationGraph-BnhbeI6t.js} +1 -1
- package/dist/web/assets/{Reports-D4-y2w-2.js → Reports-DxjHb0vA.js} +2 -2
- package/dist/web/assets/Response-BvQV20vS.js +9 -0
- package/dist/web/assets/{Responsive-DljiUZXJ.js → Responsive-DNC31nTr.js} +2 -2
- package/dist/web/assets/{RunDiff-DjUiMBsq.js → RunDiff-BXqh9adv.js} +1 -1
- package/dist/web/assets/Runs-PsPMVpQl.js +2 -0
- package/dist/web/assets/{Settings-CD1RbHXf.js → Settings-DEOCWX5o.js} +15 -15
- package/dist/web/assets/{Steps-DG1WYfYK.js → Steps-C18OGSAM.js} +3 -3
- package/dist/web/assets/{TestCases-BfZzshUI.js → TestCases-MIOqrvt0.js} +1 -1
- package/dist/web/assets/TestData-DtPsGVwq.js +2 -0
- package/dist/web/assets/TestDebt-C8zEVY4j.js +1 -0
- package/dist/web/assets/TestManagement-cXbBFksQ.js +4 -0
- package/dist/web/assets/{WhatsNew-ZorWOqDL.js → WhatsNew-vGPOJXT2.js} +1 -1
- package/dist/web/assets/{dataParts-CeMHTXLx.js → dataParts-D08j24QD.js} +2 -2
- package/dist/web/assets/{desktopAppPath-BVJxel_D.js → desktopAppPath-DyQr1aFk.js} +1 -1
- package/dist/web/assets/{diff-BXu8cULX.js → diff-CVufIkRR.js} +1 -1
- package/dist/web/assets/{highlight-Cd5aQvev.js → highlight-BpaRxd70.js} +1 -1
- package/dist/web/assets/index-FhirFP-O.css +2 -0
- package/dist/web/assets/{index-F95avSUY.js → index-q1r33z9g.js} +12 -12
- package/dist/web/assets/input-ChhA0xMm.js +1 -0
- package/dist/web/assets/{pageBack-BNLSF2VR.js → pageBack-Dhl5PHZE.js} +1 -1
- package/dist/web/assets/{palette-BS9ixqiJ.js → palette-CpGAHix6.js} +1 -1
- package/dist/web/assets/{paletteCommands-DferMQDH.js → paletteCommands-Der7qNEc.js} +1 -1
- package/dist/web/assets/{parts-69Ei7EPi.js → parts-eyvIPENF.js} +1 -1
- package/dist/web/assets/{productParts-PERPm-xD.js → productParts-2Y8IjOa0.js} +1 -1
- package/dist/web/assets/{qualityParts-BRZOCiQs.js → qualityParts-CdoLEG3a.js} +1 -1
- package/dist/web/assets/{recordTest-DVJCNI0y.js → recordTest-vps_1X_-.js} +1 -1
- package/dist/web/assets/{stepper-t0O_8eQo.js → stepper-Cb6rnj2p.js} +1 -1
- package/dist/web/index.html +5 -5
- package/docs/user-guide.html +8 -1
- package/package.json +1 -1
- package/prompts/brain.md +1 -1
- package/py/forgeqe_engine/copilot_gateway.py +81 -2
- package/py/forgeqe_engine/copilot_models.py +37 -1
- package/py/forgeqe_engine/llm.py +10 -1
- package/py/forgeqe_engine/recordsession.py +2 -2
- package/py/forgeqe_engine/webrecord.py +9 -3
- package/py/forgeqe_engine/webrecord_page.py +87 -10
- package/dist/web/assets/ApiTests-BH_mbOVX.js +0 -10
- package/dist/web/assets/Chat-CVF0hHdk.js +0 -3
- package/dist/web/assets/Cost-BDwt86M-.js +0 -1
- package/dist/web/assets/Desktop-B2k0qH7c.js +0 -1
- package/dist/web/assets/DesktopReview-CE65JglI.js +0 -2
- package/dist/web/assets/Flags-FpR9O_13.js +0 -2
- package/dist/web/assets/Impact-BC8w7uQ5.js +0 -3
- package/dist/web/assets/Jobs-DeBncFIN.js +0 -5
- package/dist/web/assets/PageAgent-C_oSStNT.js +0 -1
- package/dist/web/assets/Production-BhDff1v6.js +0 -1
- package/dist/web/assets/Quality-EATW3zGE.js +0 -1
- package/dist/web/assets/Record-CIf6M72U.js +0 -1
- package/dist/web/assets/Response-CpHrRtzJ.js +0 -9
- package/dist/web/assets/Runs-DC0tJWvX.js +0 -2
- package/dist/web/assets/TestData-BoyXYHtp.js +0 -2
- package/dist/web/assets/TestDebt-CX1XT-CA.js +0 -1
- package/dist/web/assets/TestManagement-BTdMN3Bl.js +0 -4
- package/dist/web/assets/index-CgpH1pj9.css +0 -2
- package/dist/web/assets/input-BmJ7dt1C.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$n as t,A as n,At as r,Bn as i,Cr as a,Er as o,Et as s,F as c,Fn as l,Fr as u,Gn as d,H as f,Hn as p,Hr as m,I as h,J as g,Kr as _,L as v,Ln as y,Lt as b,M as x,Nr as S,O as C,Pt as w,Rn as T,St as ee,U as te,Un as E,V as ne,Vr as D,Vt as O,Xn as k,Xt as A,_t as j,an as M,bt as N,cn as re,en as ie,ft as P,hr as F,ht as I,ir as ae,l as oe,ln as L,lr as se,lt as R,n as ce,nt as le,ot as z,p as ue,pr as de,r as B,sn as fe,sr as pe,tn as me,tr as V,u as he,un as ge,ut as _e,vn as ve,wn as ye,xr as be,xt as xe,y as Se,zr as Ce}from"./route-D8G-pTdk.js";import{l as we}from"./agents-DPabR9dS.js";import{t as Te}from"./jsx-runtime-LKYXHABd.js";import{A as H,Bt as U,Vt as Ee,W as De,a as Oe,n as ke,r as Ae,t as W,yt as G}from"./input-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$n as t,A as n,At as r,Bn as i,Cr as a,Er as o,Et as s,F as c,Fn as l,Fr as u,Gn as d,H as f,Hn as p,Hr as m,I as h,J as g,Kr as _,L as v,Ln as y,Lt as b,M as x,Nr as S,O as C,Pt as w,Rn as T,St as ee,U as te,Un as E,V as ne,Vr as D,Vt as O,Xn as k,Xt as A,_t as j,an as M,bt as N,cn as re,en as ie,ft as P,hr as F,ht as I,ir as ae,l as oe,ln as L,lr as se,lt as R,n as ce,nt as le,ot as z,p as ue,pr as de,r as B,sn as fe,sr as pe,tn as me,tr as V,u as he,un as ge,ut as _e,vn as ve,wn as ye,xr as be,xt as xe,y as Se,zr as Ce}from"./route-D8G-pTdk.js";import{l as we}from"./agents-DPabR9dS.js";import{t as Te}from"./jsx-runtime-LKYXHABd.js";import{A as H,Bt as U,Vt as Ee,W as De,a as Oe,n as ke,r as Ae,t as W,yt as G}from"./input-ChhA0xMm.js";import{C as je,E as K,a as Me,c as Ne,i as Pe,l as Fe,o as Ie,r as Le,s as Re,v as ze,w as Be}from"./pageBack-Dhl5PHZE.js";import{a as Ve,i as He,r as Ue}from"./palette-CpGAHix6.js";import{$t as We,At as Ge,Bn as Ke,Bt as qe,E as Je,Ft as Ye,In as Xe,It as Ze,Ln as Qe,Mt as $e,Nt as et,Ot as tt,Pt as nt,Rn as rt,Rt as it,S as at,Sn as ot,Un as st,Wn as ct,Xt as lt,b as ut,d as dt,dt as ft,f as pt,i as mt,jt as q,kt as J,pt as ht,r as gt,s as _t,xn as vt,zn as yt}from"./index-q1r33z9g.js";import{_ as bt,a as xt,b as St,c as Ct,d as wt,f as Tt,g as Et,h as Dt,i as Y,l as Ot,m as kt,n as At,o as jt,p as Mt,r as Nt,s as Pt,t as Ft,u as It,v as Lt,x as Rt,y as zt}from"./parts-eyvIPENF.js";import{_ as Bt,a as Vt,c as Ht,d as Ut,f as Wt,g as Gt,h as X,i as Kt,l as qt,m as Jt,o as Yt,p as Xt,r as Zt,s as Qt,t as $t,u as en,v as tn}from"./Steps-C18OGSAM.js";import"./stepper-Cb6rnj2p.js";var Z=e(_(),1),Q=Te(),nn={href:B(`migration`,`migrations`),label:`Migrations`};function rn({tab:e,wide:t,action:n,agentBody:r,back:i,children:a}){let o=we(`migration`);return(0,Q.jsx)(mt,{title:ze(`migration`),page:o,label:`Migration`,current:e,onPick:e=>location.hash=e===`agent`?B(`migration`):B(`migration`,`migrations`),tabs:[{id:`migrations`,label:`Migrations`,icon:ae}],below:(0,Q.jsx)(_t,{page:o}),...r===void 0?{}:{agentBody:r},...t?{wide:t}:{},...n?{end:n}:{},...i?{back:i}:{},children:a})}var an=500,on=10;function sn({plan:e,acceptLimits:t,next:n,again:r,onClose:i,onStarted:a}){let o=e.units.filter(e=>e.kind===`test`).length,[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!!n),[f,p]=(0,Z.useState)(String(n?.size||on)),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(``),b=Number(f),x=Number.isInteger(b)&&b>=1&&b<=an,S=async()=>{g(!0),v(``);try{a((await U.start(e.id,s,t,l?b:void 0)).detail)}catch(e){v(e.message),g(!1)}};return(0,Q.jsx)(st,{open:!0,onClose:i,title:n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,description:n?`${(b||n.size)>=n.left?`The last ${n.left===1?`test case`:`${n.left} test cases`} not tried yet ${n.left===1?`is`:`are`}`:`The next ${b||n.size} of the ${n.left} test cases not tried yet are`} written as ${e.target.title} tests in ${e.target.dir}. What is done is kept; a failed test stays for you to fix.`:r?`ForgeQE picks up where the conversion stopped: what is done and unchanged is kept, the rest is written as ${e.target.title} tests in ${e.target.dir}. It runs in the background.`:`The Tosca test cases are written as ${e.target.title} tests in ${e.target.dir}, and ForgeQE runs each one. It runs in the background; the Tosca export is not changed.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:i,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(K,{variant:`primary`,disabled:h||s!==e.id||l&&!x,onClick:()=>void S(),"data-tip":n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,children:[r?(0,Q.jsx)(d,{"aria-hidden":`true`}):(0,Q.jsx)(y,{"aria-hidden":`true`}),n?`Continue`:r?`Start again`:`Start`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&o>1&&(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Q.jsx)(dt,{className:`mt-1`,checked:l,onCheckedChange:u}),(0,Q.jsxs)(`span`,{children:[`Convert in batches`,(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`A few test cases at a time, stopping after each batch so you can check them before the next.`})]})]}),l&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{children:`Test cases per batch`}),(0,Q.jsx)(W,{type:`number`,min:1,max:an,step:1,inputMode:`numeric`,value:f,"aria-invalid":!x,"aria-describedby":x?void 0:`batch-size-error`,onChange:e=>p(e.target.value),className:`w-24`}),!x&&(0,Q.jsxs)(`p`,{id:`batch-size-error`,role:`alert`,className:`m-0 text-[13px] text-fail`,children:[`A whole number from 1 to `,an,`.`]})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Q.jsx)(W,{value:s,onChange:e=>c(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Q.jsx)(Yt,{error:_})]})})}var cn=/\u001b\[[0-9;]*[A-Za-z]/g,ln=/[\u0000-\u0008\u000b-\u001f\u007f]/g,un=240,dn=30,fn=e=>e.replace(cn,``).replace(ln,``),pn=e=>e.length>un?`${e.slice(0,239)}…`:e,mn=/^\s*(?:(?:[A-Z]\w*)?Error\b:?\s*|E\s{2,})(.*\S)/;function hn(e){return e.status===`failed`||e.status===`blocked`}function gn(e){let t=fn(e.output||``).split(`
|
|
2
2
|
`);for(let e of t){let t=e.match(mn);if(t?.[1])return pn(t[1].trim())}let n=[...e.problems||[],e.reason||``].map(e=>fn(e).split(`
|
|
3
3
|
`).find(e=>e.trim())||``).find(Boolean);return n?pn(n.trim()):`No reason was recorded: the run ended before it said why.`}function _n(e){let t=fn(e.output||``).split(`
|
|
4
4
|
`),n=t.findIndex(e=>mn.test(e));if(n<0)return``;let r=[];for(let e of t.slice(n))if(/^\s*(attachment #\d|\d+ (failed|passed)\b|Error Context:)/.test(e)||(r.push(pn(e)),r.length>=dn))break;for(;r.length&&!r[r.length-1].trim();)r.pop();let i=Math.min(...r.filter(e=>e.trim()).map(e=>e.match(/^\s*/)[0].length));return r.map(e=>e.slice(Number.isFinite(i)?i:0)).join(`
|
|
5
|
-
`)}function vn(e,t){return e.map((e,n)=>({u:e,i:n,at:Date.parse(t(e)||``)||0})).sort((e,t)=>t.at-e.at||t.i-e.i).map(e=>e.u)}function yn(e){if(e.job?.running)return{label:e.job.kind===`fix`?`Fixing`:e.job.kind===`verify`?`Running tests`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:`Running`,tone:`running`}:t?Qt[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Wt[e.plan.feasibility.verdict]}var bn=e=>e.slice(e.lastIndexOf(`/`)+1);function xn({d:e,onClose:t}){let n=(e.plan.sources||[]).some(e=>e.workspace),[r,i]=(0,Z.useState)(n),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),l=async()=>{o(!0),c(``);try{let t=await U.reimport(e.plan.id,n&&r);location.hash=B(`migration`,t.plan.id)}catch(e){c(e.message),o(!1)}};return(0,Q.jsx)(Je,{open:!0,onClose:t,title:`Read the exports again`,description:`A new plan from the same exports, into the same folder. Test cases unchanged in Tosca keep their tests; changed and new ones are converted; ones no longer there are listed. Nothing is written until you start it.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,Q.jsx)(K,{variant:`primary`,disabled:a,onClick:()=>void l(),children:a?`Reading…`:`Make the new plan`})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[n&&(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Q.jsx)(ct,{className:`mt-1`,checked:r,onCheckedChange:i}),(0,Q.jsxs)(`span`,{children:[`Get the newest commit of the cloned repositories`,(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Each is cloned again, as before; the old copy stays for this plan.`})]})]}),s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s})]})})}var Sn=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function Cn({id:e,onClose:t}){let[n,r]=(0,Z.useState)(`github`),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let t=!0;return a(null),p(!1),s(``),l(``),U.ci(e,n).then(e=>t&&a(e),e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let m=i?i.file.slice(i.file.lastIndexOf(`/`)+1):``,h=()=>{if(!i)return;let e=URL.createObjectURL(new Blob([i.text],{type:`text/yaml;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=m,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},g=async()=>{d(!0),s(``);try{let t=await U.writeCi(e,n);p(!0),l(`Added ${t.file}.${n===`github`?` GitHub runs a workflow only from ${t.path}: move it there.`:` Create a pipeline from it in Azure DevOps.`}`)}catch(e){s(e.message)}finally{d(!1)}};return(0,Q.jsxs)(Je,{open:!0,wide:!0,onClose:t,title:`CI pipeline`,description:`Runs the converted tests in your CI, one job per Tosca execution list. Review it before you commit it.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:t,children:`Close`}),(0,Q.jsxs)(K,{disabled:!i,onClick:h,children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),`Download`]}),!f&&(0,Q.jsx)(K,{variant:`primary`,disabled:!i||u,onClick:()=>void g(),"data-tip":`Into the target folder's ci/, so a pull request of the conversion carries it.`,children:u?`Adding…`:`Add to the target folder`})]}),children:[(0,Q.jsx)(yt,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:Sn}),(0,Q.jsxs)(`div`,{id:`panel-ci-${n}`,role:`tabpanel`,"aria-labelledby":`tab-ci-${n}`,className:`flex flex-col gap-4 text-sm`,children:[!i&&!o&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Making the pipeline…`}),o&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),c&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-ink [overflow-wrap:anywhere]`,children:c}),i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Jobs`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:[...i.tests?[i.suites.length?`One per Tosca execution list: ${i.suites.join(`, `)}`:`One for every test: the export has no execution lists`]:[],...i.workflows?[`One per kind of app (desktop, mobile), replaying ${X(i.workflows,`workflow`)}`]:[]].join(`; `)}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Goes in`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono text-[13px] [overflow-wrap:anywhere]`,children:i.path}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`To set`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[i.tests&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:`BASE_URL`}),` as a variable`]}),i.secrets.length?(0,Q.jsxs)(Q.Fragment,{children:[i.tests?`; as `:`As `,n===`github`?`secrets`:`secret variables`,`: `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px] [overflow-wrap:anywhere]`,children:i.secrets.join(`, `)})]}):null,!i.tests&&!i.secrets.length?`None`:null,i.skipped.length?(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Not passed, not a name the CI takes: `,i.skipped.join(`, `)]}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:m}),(0,Q.jsx)(ot,{text:i.text,label:`Copy ${m}`})]}),(0,Q.jsx)(`pre`,{"aria-label":m,tabIndex:0,className:`m-0 max-h-[420px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-ink-2`,children:i.text})]})]})]})]})}function wn({id:e,onClose:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(``),g=(t=``)=>U.pr(e,t).then(e=>{r(e),h(``),e.preview&&(a(e.preview),s(t=>t||e.preview.base),l(t=>t||e.preview.title))},e=>h(e.message));(0,Z.useEffect)(()=>{g()},[e]),(0,Z.useEffect)(()=>{if(n?.job?.state!==`running`)return;let e=setTimeout(()=>void g(o),1e3);return()=>clearTimeout(e)},[n]);let _=async()=>{p(!0),h(``);try{let t=await U.openPr(e,{base:o.trim(),title:c.trim(),draft:u});r(e=>e&&{...e,job:t.job})}catch(e){h(e.message)}finally{p(!1)}},v=i,y=n?.job,b=y?.state===`running`,x=y?.state===`done`?y.result:void 0,S=m||(y?.state===`failed`?y.error:``)||(n&&!n.preview?n.problem:``)||``,C=e=>/^https:\/\//.test(e)?e:void 0,w=(e,t)=>(0,Q.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 text-accent-fg`,children:[t,(0,Q.jsx)(R,{size:11,"aria-hidden":`true`})]});return(0,Q.jsx)(Je,{open:!0,wide:!0,onClose:t,title:`Open a pull request`,description:`The converted tests on a branch of their own, for your team to review. ForgeQE commits in a separate copy of the repository, so your own branch and edits stay as they are, and merges nothing.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:t,children:x?`Close`:`Cancel`}),!x&&(0,Q.jsx)(K,{variant:`primary`,disabled:!v||!n?.preview||f||b||!o.trim(),onClick:()=>void _(),children:f?`Starting…`:b?`Pushing…`:`Push and open the pull request`})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&!m&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Checking the repository…`}),S&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:S}),x&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-ink [overflow-wrap:anywhere]`,children:[x.existing?`Nothing new to push: this is the pull request.`:`Pushed ${X(x.files,`file`)} on ${x.branch}.`,` `,C(x.url)?w(C(x.url),`Open the pull request`):`It is open on ${x.branch}; the host gave no https address to link to.`]}),v&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Repository`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[v.platform===`github`?`GitHub`:`Azure DevOps`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:v.repository}),` (`,v.remote,`)`]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono text-[13px] [overflow-wrap:anywhere]`,children:v.branch}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[X(v.files.length,`file`),` of `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:v.folder})]})]}),v.last&&C(v.last.url)&&!x&&(0,Q.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Opened before: `,w(C(v.last.url),`the pull request`),`. Pushing again updates its branch.`]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Merge into`}),(0,Q.jsx)(W,{value:o,spellCheck:!1,maxLength:200,placeholder:`main`,"aria-invalid":!(!n||n.preview),onChange:e=>s(e.target.value),onBlur:()=>o.trim()&&o.trim()!==n?.preview?.base&&void g(o.trim()),disabled:b,className:`font-mono`})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Title`}),(0,Q.jsx)(W,{value:c,maxLength:200,onChange:e=>l(e.target.value),disabled:b})]}),(0,Q.jsxs)(`label`,{className:H(`flex items-start gap-2`,b?`cursor-default`:`cursor-pointer`),children:[(0,Q.jsx)(ct,{className:`mt-1`,checked:u,onCheckedChange:d,disabled:b}),(0,Q.jsxs)(`span`,{children:[`Open it as a draft`,(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Reviewers are not asked yet.`})]})]}),(0,Q.jsx)(lt,{title:`Files (${v.files.length})`,children:(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-[13px]`,children:[v.files.slice(0,200).map(e=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e)),v.files.length>200&&(0,Q.jsxs)(`li`,{className:`text-muted`,children:[`and `,v.files.length-200,` more`]})]})}),v.skipped.length>0&&(0,Q.jsx)(lt,{title:`Left out (${v.skipped.length})`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:v.skipped.slice(0,100).map(e=>(0,Q.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.path}),`: `,(0,Q.jsx)(`span`,{className:`text-muted`,children:e.why})]},e.path))})})]})]})})}function Tn({id:e,title:t,targetDir:n,onClose:r}){let[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),d=async()=>{c(!0),u(``);try{await U.delete(e,i),location.hash=B(`migration`,`migrations`)}catch(e){u(e.message),c(!1)}};return(0,Q.jsx)(Je,{open:!0,onClose:r,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),`Keep`]}),(0,Q.jsxs)(K,{variant:`danger`,disabled:s||i!==e,onClick:()=>void d(),children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Q.jsx)(W,{value:i,onChange:e=>o(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function En({d:e,unit:n,onClose:r,onSend:i}){let[a,o]=(0,Z.useState)(``),s=e.plan.units.find(e=>e.id===n),c=e.result?.units.find(e=>e.id===n);return(0,Q.jsx)(Je,{open:!0,onClose:r,title:`Fix ${s?bn(s.target):n}`,description:`Bridge works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:r,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(K,{variant:`primary`,onClick:()=>i(a.trim()),"data-tip":`Send to the agent`,children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),`Send`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c.problems[0]}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,Q.jsx)(Ae,{value:a,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function Dn({d:e,unit:t,onClose:n}){let r=e.result?.units.find(e=>e.id===t),i=e.plan.units.find(e=>e.id===t);return(0,Q.jsx)(Je,{open:!0,onClose:n,wide:!0,title:`Output of ${i?bn(i.target):t}`,description:r?.checkedAt?`Run again ${kt(r.checkedAt)}`:`From the conversion's own run`,footer:(0,Q.jsxs)(K,{onClick:n,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Close`]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r?.problems?.length?(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r.problems.join(` `)}):r?.status===`converted`?(0,Q.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,r?.command&&(0,Q.jsxs)(`code`,{className:`block font-mono text-[13px] text-muted`,children:[`$ `,r.command]}),(0,Q.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto rounded-[12px] bg-surface-muted px-4 py-2 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:(0,Q.jsx)(Le,{text:r?.output||`No output.`})})]})})}function On(e){let t=Object.fromEntries(qt.map(e=>[e,{status:e===`prepare`?`running`:`pending`,...e===`prepare`?{startedAt:new Date().toISOString()}:{}}]));return{status:`running`,plan:e.plan.id,target:e.plan.target,units:[],reverted:[],model:``,startedAt:e.job?.last?.startedAt||new Date().toISOString(),ms:0,stage:`prepare`,stages:t,notes:``}}function kn(e,t){let n=new Map(t.units.map(e=>[e.id,e])),r=e.plan.units.flatMap(t=>{let r=n.get(t.id);if(!r||!hn(r)||t.kind!==`test`)return[];let i=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return[{p:t,u:r,tc:i,title:i?.name||bn(t.target)}]}),i=new Map(t.units.map((e,t)=>[e.id,t]));return r.sort((e,t)=>i.get(e.p.id)-i.get(t.p.id)),vn(r,e=>e.u.checkedAt)}function An({d:e,busy:t,onFix:n,onSteps:r,onOutput:i}){let a=e.result?kn(e,e.result):[];return a.length?(0,Q.jsx)(`ol`,{"aria-label":`Errors, the latest first`,className:`m-0 flex list-none flex-col gap-8 p-0`,children:a.map(({p:e,u:a,tc:o,title:s})=>{let c=_n(a),l=a.problems?.length?a.problems:[];return(0,Q.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-4 border-b border-line pb-8 last:border-b-0 last:pb-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-[16px] font-semibold`,children:[(0,Q.jsx)(Ne,{tone:Ut[a.status].tone,children:Ut[a.status].label}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:s})]}),(0,Q.jsxs)(`p`,{className:`m-0 font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:[e.target,o?.suites?.length?(0,Q.jsxs)(`span`,{className:`font-sans`,children:[`, in `,o.suites.join(`, `)]}):null,(0,Q.jsxs)(`span`,{className:`font-sans`,children:[` `,`· `,X(a.attempts,`attempt`),a.checkedAt?`, run again ${at(a.checkedAt)}`:``]})]})]}),(0,Q.jsxs)(Kt,{icon:f,title:`What went wrong`,children:[(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 font-mono text-[13px] text-fail [overflow-wrap:anywhere]`,children:gn(a)}),l.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-sm text-ink-2`,children:l.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))})]}),c&&(0,Q.jsx)(Kt,{icon:k,title:`What the test printed`,children:(0,Q.jsx)(Zt,{label:`Error of ${s}`,files:[{name:bn(e.target),code:c,log:!0}]})}),a.reason&&(0,Q.jsx)(Kt,{icon:Se,title:`The agent's note`,children:(0,Q.jsx)(`p`,{className:`m-0 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:a.reason})}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[!e.engine&&(0,Q.jsxs)(K,{size:`sm`,variant:`primary`,disabled:t,onClick:()=>n(e.id),children:[(0,Q.jsx)(D,{"aria-hidden":`true`}),`Fix with the agent`]}),e.case&&(0,Q.jsxs)(K,{size:`sm`,onClick:()=>r(e.case),children:[(0,Q.jsx)(L,{"aria-hidden":`true`}),`Steps beside the code`]}),(a.output||l.length>0)&&(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>i(e.id),children:[(0,Q.jsx)(k,{"aria-hidden":`true`}),`Full output`]})]})]},e.id)})}):(0,Q.jsx)(Fe,{icon:h,title:`No errors`,children:`Every converted test that ran passes.`})}function jn({d:e,planView:t,busy:n,onFix:r,onSteps:i,onOutput:a,onRun:o,onNext:s,onErrors:c}){let l=e.result||(e.job?.running?On(e):null);if(!l)return(0,Q.jsx)(Q.Fragment,{children:t});let u=new Map(l.units.map(e=>[e.id,e])),d=e.plan.units.filter(e=>e.kind===`test`&&!e.engine),p=e.plan.units.filter(e=>e.kind===`test`&&e.engine),m=new Set(d.map(e=>e.id)),h=new Set(p.map(e=>e.id)),g=l.units.filter(e=>m.has(e.id)&&e.status===`converted`).length,_=l.units.filter(e=>h.has(e.id)&&e.status===`written`).length,v=l.units.reduce((e,t)=>t.fidelity?{m:e.m+t.fidelity.matched,n:e.n+t.fidelity.required}:e,{m:0,n:0}),b=l.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,[x,...S]=e.plan.target.id.split(`-`),C=kn(e,l),w=C[0];return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:d.length?`Passing`:`Workflows written`,value:d.length?`${g} of ${d.length}`:`${_} of ${p.length}`,tone:d.length&&g===d.length?`text-pass`:void 0}),(0,Q.jsx)(Y,{label:`Need attention`,value:b,tone:b?`text-fail`:void 0}),(0,Q.jsx)(Y,{label:`Tosca steps kept`,value:v.n?`${v.m} of ${v.n}`:`None yet`,tone:v.n&&v.m===v.n?`text-pass`:void 0}),(0,Q.jsx)(Y,{label:l.status===`running`?`Running for`:`Took`,value:Tt(l.status===`running`?Date.now()-Date.parse(l.startedAt):l.ms)})]}),w&&(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-attn-h`,className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 rounded-[12px] bg-fail-soft py-2 pr-2 pl-4 @2xl:grid-cols-[auto_minmax(0,1fr)_auto]`,children:[(0,Q.jsx)(`h3`,{id:`tsc-attn-h`,className:`sr-only`,children:`Needs your attention`}),(0,Q.jsx)(f,{size:18,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,Q.jsxs)(`p`,{className:`m-0 min-w-0 truncate text-sm text-ink`,"data-tip":`${w.title}: ${gn(w.u)}`,children:[(0,Q.jsx)(`span`,{className:`hidden font-medium @2xl:inline`,children:w.title}),(0,Q.jsx)(`span`,{className:`hidden text-ink-2 @2xl:inline`,children:`: `}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:gn(w.u)})]}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,className:`col-start-2 -ml-4 justify-self-start text-fail hover:text-fail @2xl:col-start-auto @2xl:ml-0`,onClick:c,children:[C.length===1?`See the error`:`See all ${C.length} errors`,(0,Q.jsx)(he,{"aria-hidden":`true`})]})]}),l.notes&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l.notes}),l.batch&&l.batch.left>0&&l.status!==`running`&&(0,Q.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-sm text-ink`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Batch `,l.batch.runs,` is done. Check its tests, then continue: `,X(l.batch.left,`test case`),` not tried yet.`]}),(0,Q.jsxs)(K,{size:`sm`,disabled:n,onClick:s,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Continue with the next batch`]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Q.jsx)(`div`,{className:`@container min-w-0`,children:(0,Q.jsx)(We,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @3xl:table-cell`),children:`Note`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let o=u.get(t.id),s=o?Ut[o.status]:null,c=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,Q.jsxs)(`tr`,{className:Qe,children:[(0,Q.jsxs)(`td`,{className:J,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:bn(t.target)}),(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[c?t.engine?`${Gt(t)}: ${c.name}`:c.name:`${Gt(t)}, ${t.target}`,c?.suites?.length?`, in ${c.suites.join(`, `)}`:``]})]}),(0,Q.jsxs)(`td`,{className:H(J,`whitespace-nowrap`),children:[s?(0,Q.jsx)(Ne,{tone:s.tone,children:s.label}):(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`}),o?.checkedAt&&(0,Q.jsxs)(`span`,{className:`block pt-1 text-[13px] text-muted`,children:[`Run again `,at(o.checkedAt)]})]}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] whitespace-nowrap @2xl:table-cell`),children:o?.fidelity?(0,Q.jsxs)(`span`,{className:o.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[o.fidelity.matched,` of `,o.fidelity.required]}):t.kind===`test`?(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not checked yet`}):null}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:o?.problems?.[0]||o?.reason||``})}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap text-right`),children:(0,Q.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(o?.output||o?.problems?.length)&&(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,"aria-label":`Output of ${bn(t.target)}`,"data-tip":`Output of ${bn(t.target)}`,onClick:()=>a(t.id),children:(0,Q.jsx)(k,{"aria-hidden":`true`})}),t.case&&(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,"aria-label":`Steps of ${bn(t.target)}`,"data-tip":`Steps of ${bn(t.target)}`,onClick:()=>i(t.case),children:(0,Q.jsx)(L,{"aria-hidden":`true`})}),o&&(o.status===`failed`||o.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Fix ${bn(t.target)}`,"data-tip":`Fix ${bn(t.target)}`,onClick:()=>r(t.id),children:(0,Q.jsx)(D,{"aria-hidden":`true`})})]})})]},t.id)})})}),(0,Q.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] panel p-6 text-sm @5xl:sticky @5xl:top-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`From`}),(0,Q.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?`, ${e.plan.source.project}`:``]}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`To`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Q.jsx)(St,{framework:x,language:S.join(`-`)}),e.plan.target.title]}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,"data-tip":e.targetPath,children:e.plan.target.dir})]}),(e.plan.suites||[]).length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`Suites`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.plan.suites.map(e=>{let t=new Set(e.cases),r=l.units.filter(e=>e.kind===`test`&&e.case&&t.has(e.case)&&e.status===`converted`).length;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Q.jsxs)(`span`,{className:H(`text-[13px]`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,X(e.cases.length,`test`),` pass, tagged @`,e.tag]})]}),(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Run the ${e.name} suite`,"data-tip":`Run the ${e.name} suite`,onClick:()=>o(e.name),children:(0,Q.jsx)(y,{"aria-hidden":`true`})})]},e.name)})})]}),e.plan.env.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`Environment variables`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[e.name,e.secret?(0,Q.jsx)(`span`,{className:`font-sans text-muted`,children:` (secret)`}):null]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Q.jsx)(`dd`,{className:`m-0 text-right`,children:kt(l.startedAt)}),l.model&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Q.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":l.model,children:l.model})]}),l.reverted.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-right`,children:[l.reverted.length,` edits outside the target`]})]})]})]})]})]})}var Mn={fail:{icon:f,cls:`text-fail`,label:`Failed`},ok:{icon:h,cls:`text-pass`,label:`Done`},info:{icon:A,cls:`text-muted`,label:`Info`},agent:{icon:Se,cls:`text-accent-fg`,label:`Agent`},tool:{icon:D,cls:`text-muted`,label:`Tool`}};function Nn(e,t){let n=new Map;for(let r of e){let e=r.unit?`u:${r.unit}`:`s:${r.stage}`,i=n.get(e);if(!i){let a=r.unit?t.plan.units.find(e=>e.id===r.unit):void 0,o=a?.case?t.plan.cases.find(e=>e.id===a.case):void 0;i=a?{key:e,title:a.kind===`test`?o?.name||a.case||a.id:a.kind===`page`?`Page object ${a.page||``}`.trim():`Set-up`,sub:`${Gt(a)}, ${a.target} (${a.id})`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:en[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var Pn=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function Fn({d:e,events:t,running:r}){let i=(0,Z.useRef)(null),a=(0,Z.useRef)(!0),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(`all`),[u,d]=(0,Z.useState)({}),f=Nn(t,e),p=o.trim().toLowerCase(),m=e=>(c===`all`||e.kind===c)&&(!p||e.text.toLowerCase().includes(p)),h=c!==`all`||!!p,g=f.map(e=>({...e,lines:e.events.filter(m),matchTitle:!!p&&`${e.title} ${e.sub}`.toLowerCase().includes(p)})).map(e=>({...e,lines:e.matchTitle?e.events.filter(e=>c===`all`||e.kind===c):e.lines})).filter(e=>e.lines.length),_=e=>t.filter(t=>t.kind===e).length,v=f[f.length-1]?.key;return(0,Z.useEffect)(()=>{r&&!h&&a.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[t.length,r,h]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Re,{id:`tosca-activity-search`,label:`Find a line`,value:o,onChange:s,placeholder:`Find a line, test case or file`}),(0,Q.jsx)(Pe,{items:[{id:`all`,label:`All`,n:t.length},{id:`fail`,label:`Failed`,n:_(`fail`),alert:!0},{id:`ok`,label:`Done`,n:_(`ok`)},{id:`info`,label:`Info`,n:_(`info`)},{id:`agent`,label:`Agent`,n:_(`agent`)},{id:`tool`,label:`Tools`,n:_(`tool`)}],value:c,onChange:l})]}),(0,Q.jsxs)(`div`,{ref:i,role:`log`,"aria-live":r?`polite`:void 0,"aria-label":`Activity`,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:`flex max-h-[60vh] flex-col overflow-y-auto border-y border-line-soft`,children:[g.map(e=>{let t=e.events.filter(e=>e.kind===`fail`).length,i=u[e.key]??(h||t>0||r&&e.key===v),a=`act-${e.key.replace(/[^A-Za-z0-9_-]/g,`-`)}`,o=e.status?Ut[e.status]:void 0;return(0,Q.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":a,onClick:()=>d(t=>({...t,[e.key]:!i})),className:`flex w-full min-w-0 cursor-pointer items-center gap-4 border-0 bg-transparent px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,Q.jsx)(n,{size:15,"aria-hidden":`true`,className:H(`flex-none text-muted transition-transform`,i&&`rotate-180`)}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-muted`,children:e.sub})]}),(0,Q.jsxs)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:[h&&e.lines.length!==e.events.length?`${e.lines.length} of ${X(e.events.length,`line`)}`:X(e.events.length,`line`),t>0&&(0,Q.jsxs)(`span`,{className:`text-fail`,children:[`, `,t,` failed`]})]}),o&&(0,Q.jsx)(Ne,{tone:o.tone,children:o.label})]}),(0,Q.jsx)(Ke,{open:i,id:a,children:(0,Q.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:e.lines.map((e,t)=>{let n=Mn[e.kind];return(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft py-2 pr-4 pl-12 text-[13px] last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:`w-[76px] flex-none text-[13px] whitespace-nowrap text-muted tabular-nums`,children:Pn(e.ts)}),(0,Q.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:H(`mt-1 flex-none`,n.cls)}),(0,Q.jsx)(`span`,{className:H(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:e.kind===`tool`?`font-mono text-[13px] text-muted`:`text-ink-2`),children:e.text})]},t)})})})]},e.key)}),!g.length&&(0,Q.jsx)(`p`,{className:`m-0 px-4 py-8 text-center text-sm text-muted`,children:t.length?`No line matches.`:`Nothing yet.`})]})]})}function In({id:e,plan:t,tab:n=`overview`}){let[r,i]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(n),u=t=>{l(t),history.replaceState(null,``,B(`migration`,...t===`overview`?[e]:[e,t]))},[m,h]=(0,Z.useState)(),[g,_]=(0,Z.useState)(null),[v,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)([]),[w,T]=(0,Z.useState)(!1),[ee,te]=(0,Z.useState)(!1),[E,ne]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(!1),[ie,F]=(0,Z.useState)(!1),[I,ae]=(0,Z.useState)(!1),oe=(0,Z.useRef)(0),L=(0,Z.useCallback)(()=>{U.detail(e).then(e=>{i(e),s(``)},e=>s(e.message));let t=oe.current;U.events(e,t).then(e=>{if(e.next<oe.current){oe.current=0,C([]);return}let t=oe.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));oe.current=e.next,n.length&&C(e=>[...e,...n].slice(-2e3))},()=>{})},[e]);(0,Z.useEffect)(L,[L]);let R=!!(r?.job?.running||r?.result?.status===`running`);(0,Z.useEffect)(()=>{if(!R)return;let e=Xe(L,1500);return()=>Ye(e)},[R,L]);let[ce,le]=(0,Z.useState)(``),z=(0,Z.useRef)(R);(0,Z.useEffect)(()=>{if(z.current&&!R&&r){let e=r.plan.units.filter(e=>e.kind===`test`).length,t=(r.result?.units||[]).filter(e=>e.kind===`test`&&e.status===`converted`).length;le(`The conversion ${r.result?.status===`stopped`?`stopped`:r.result?.status===`failed`?`failed`:`finished`}: ${t} of ${e} test${e===1?``:`s`} pass.`)}R&&le(``),z.current=R},[R,r]);let ue=(0,Z.useCallback)(e=>{i(e),s(``),u(`overview`),setTimeout(L,800)},[L]),de=async e=>{T(!0),s(``);try{i(await e()),setTimeout(L,800)}catch(e){s(e.message)}finally{T(!1)}};if(!r)return o?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let fe=yn(r),pe=Bt(r.plan,r.result),V=r.result,ge=(V?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,_e=r.plan.cases.filter(e=>e.included).length,ve=[{id:`overview`,label:`Overview`,icon:me},{id:`steps`,label:`Steps`,icon:re,n:_e?String(_e):void 0},...ge||c===`errors`?[{id:`errors`,label:`Errors`,icon:f,n:ge?String(ge):void 0,tone:ge?`text-fail`:void 0}]:[],{id:`activity`,label:`Activity`,icon:k}];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:bn(r.plan.source.file)}),(0,Q.jsx)(he,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(St,{framework:r.plan.target.id.split(`-`)[0],language:r.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),r.plan.target.title]})]}),(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted`,children:[(0,Q.jsxs)(`span`,{children:[`From Tricentis Tosca`,r.plan.source.project?`, ${r.plan.source.project}`:``]}),(0,Q.jsxs)(`span`,{children:[`Into `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:r.plan.target.dir})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Ne,{tone:fe.tone,children:fe.label}),R?(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,onClick:()=>void de(()=>U.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the conversion`,className:`text-fail hover:text-fail`,children:(0,Q.jsx)(se,{fill:`currentColor`,"aria-hidden":`true`})}):(0,Q.jsxs)(Q.Fragment,{children:[V&&(V.status===`stopped`||V.status===`failed`)&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,onClick:()=>ae(!0),"aria-label":`Start again`,"data-tip":`Start again: tests it already wrote are kept`,children:(0,Q.jsx)(d,{"aria-hidden":`true`})}),V&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,onClick:()=>location.hash=B(`migration`,e,`report`),"aria-label":`Report`,"data-tip":`Report`,children:(0,Q.jsx)(P,{"aria-hidden":`true`})}),V&&r.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,onClick:()=>void de(()=>U.verify(e)),"aria-label":`Run the tests`,"data-tip":`Run every converted test again, no agent`,children:(0,Q.jsx)(y,{"aria-hidden":`true`})}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,"aria-haspopup":`menu`,"aria-expanded":M,onClick:()=>N(!M),"aria-label":`More`,"data-tip":`More: re-import, CI, pull request, delete`,children:(0,Q.jsx)(ye,{"aria-hidden":`true`})}),(0,Q.jsxs)(st,{open:M,onClose:()=>N(!1),label:`More for this conversion`,align:`end`,className:`w-[240px]`,children:[V&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(_t,{onClick:()=>(N(!1),ne(!0)),children:[(0,Q.jsx)(p,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Re-import`]}),(0,Q.jsxs)(_t,{onClick:()=>(N(!1),j(!0)),children:[(0,Q.jsx)(Ce,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`CI`]}),(0,Q.jsxs)(_t,{onClick:()=>(N(!1),O(!0)),children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Pull request`]}),(0,Q.jsx)(`div`,{role:`separator`,className:`mx-2 my-1 border-t border-line-soft`})]}),(0,Q.jsxs)(_t,{onClick:()=>(N(!1),te(!0)),children:[(0,Q.jsx)(a,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-fail`}),(0,Q.jsx)(`span`,{className:`text-fail`,children:`Delete`})]})]})]})]})]})]}),E&&(0,Q.jsx)(xn,{d:r,onClose:()=>ne(!1)}),D&&(0,Q.jsx)(wn,{id:e,onClose:()=>O(!1)}),A&&(0,Q.jsx)(Cn,{id:e,onClose:()=>j(!1)}),I&&(0,Q.jsx)(sn,{plan:r.plan,acceptLimits:!1,again:!0,onClose:()=>ae(!1),onStarted:e=>{ae(!1),i(e)}}),ie&&r.result?.batch&&(0,Q.jsx)(sn,{plan:r.plan,acceptLimits:!1,next:r.result.batch,onClose:()=>F(!1),onStarted:e=>{F(!1),i(e)}}),ee&&(0,Q.jsx)(Tn,{id:e,title:`${bn(r.plan.source.file)} → ${r.plan.target.title}`,targetDir:r.plan.target.dir,onClose:()=>te(!1)}),(0,Q.jsxs)(`div`,{className:H(`grid grid-cols-[minmax(0,1fr)] items-start gap-6`,V&&`@3xl:grid-cols-[minmax(220px,260px)_minmax(0,1fr)] @3xl:gap-10`),children:[V&&(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6 @3xl:border-r @3xl:border-line-soft @3xl:pr-8 @3xl:pb-8`,children:(0,Q.jsx)(jt,{label:`Conversion stages`,items:tn(V.stages),...R?{progress:pe}:{}})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:ce}),o&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),(0,Q.jsx)(Ze,{prefix:`mtab`,className:`mb-0`,tabs:ve,current:c,onPick:u,label:`Tosca conversion`}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${c}`,"aria-labelledby":`mtab-${c}`,className:`pane-swap flex min-w-0 flex-col gap-4`,children:[c===`overview`&&(0,Q.jsx)(jn,{d:r,planView:t(r,ue),busy:w||R,onFix:_,onSteps:e=>(h(e),u(`steps`)),onOutput:x,onRun:t=>void de(()=>U.verify(e,t)),onNext:()=>F(!0),onErrors:()=>u(`errors`)}),c===`errors`&&(0,Q.jsx)(An,{d:r,busy:w||R,onFix:_,onSteps:e=>(h(e),u(`steps`)),onOutput:x}),c===`steps`&&(0,Q.jsx)($t,{id:e,plan:r.plan,result:V,initial:m}),c===`activity`&&(0,Q.jsx)(Fn,{d:r,events:S,running:R})]},c)]})]}),v&&(0,Q.jsx)(Dn,{d:r,unit:v,onClose:()=>x(null)}),g&&(0,Q.jsx)(En,{d:r,unit:g,onClose:()=>_(null),onSend:t=>{_(null),de(()=>U.fix(e,[g],t))}})]})}var Ln=e=>e.slice(e.lastIndexOf(`/`)+1),Rn=50,zn=[{id:`failed`,label:`Failed`,bar:`bg-fail`,open:!0},{id:`attention`,label:`Needs a look`,bar:`bg-warn`,open:!0},{id:`passed`,label:`Passed`,bar:`bg-pass`,open:!1},{id:`notrun`,label:`Not run`,bar:`bg-line-strong`,open:!1},{id:`leftout`,label:`Left out`,bar:`bg-line`,open:!1}];function Bn(e){return e===`converted`?Ut.converted:e===`failed`?Ut.failed:e===`blocked`?Ut.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?Ut.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function Vn(e){for(let t of qt){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function Hn({planId:e,unit:t,file:n}){let r=/\.(webm|mp4)$/i.test(n),[i,a]=(0,Z.useState)(!r),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{if(!i)return;let r=!1;return s(``),l(!1),U.evidence(e,t,n).then(e=>!r&&s(e),()=>!r&&l(!0)),()=>{r=!0}},[e,t,n,i]),(0,Q.jsxs)(`li`,{className:H(`flex min-w-0 flex-col gap-2`,r&&`@xl:col-span-2`),children:[o?r?(0,Q.jsx)(`video`,{controls:!0,autoPlay:!0,src:o,className:`aspect-video w-full rounded-[12px] bg-ink`}):(0,Q.jsx)(`img`,{src:o,alt:`Screenshot ${n}`,className:`w-full rounded-[12px] border border-line-soft object-contain`}):r&&!i?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>a(!0),"aria-label":`Play ${n}`,className:`group flex aspect-video w-full cursor-pointer items-center justify-center rounded-[12px] border-0 bg-surface-strong hover:bg-line`,children:(0,Q.jsx)(`span`,{className:`inline-flex size-16 items-center justify-center rounded-full bg-bg shadow-md transition-transform group-hover:scale-105`,children:(0,Q.jsx)(y,{size:24,"aria-hidden":`true`,className:`ml-1 text-ink`})})}):(0,Q.jsx)(`span`,{role:`status`,className:H(`flex items-center justify-center rounded-[12px] bg-surface-strong text-[13px] text-muted`,r?`aspect-video`:`h-[160px]`),children:c?`Not available`:`Loading…`}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:n})]})}function Un({planId:e,pick:t,video:n}){let[i,a]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let n=!1;return a(null),c(``),U.reportCase(e,t.case).then(e=>!n&&a(e),e=>!n&&c(e.message)),()=>{n=!0}},[e,t.case]);let l=Bn(t.status),u=t.group===`failed`||t.group===`attention`,d=qn[t.group];return(0,Q.jsxs)(`section`,{"aria-label":`Test case ${t.name}`,className:`@container flex min-w-0 flex-col gap-8`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,Q.jsx)(d.icon,{size:24,"aria-label":d.label,className:H(`translate-y-0.5 flex-none`,d.tone)}),(0,Q.jsx)(`h3`,{className:`m-0 min-w-0 flex-1 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t.name}),(0,Q.jsx)(Ne,{tone:l.tone,children:l.label}),t.ms>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-muted tabular-nums`,children:[(0,Q.jsx)(be,{size:14,"aria-hidden":`true`}),Tt(t.ms)]})]}),(0,Q.jsxs)(`ul`,{"aria-label":`About this test case`,className:`m-0 flex list-none flex-wrap gap-x-6 gap-y-2 p-0 text-[13px] text-ink-2`,children:[(0,Q.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(I,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`File`}),(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.file||`No file`})]}),t.suites.length>0&&(0,Q.jsxs)(`li`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(ie,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Suite`}),t.suites.join(`, `)]}),t.folders.length>0&&(0,Q.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(r,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Folder`}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.folders.join(` / `)})]}),t.uid&&(0,Q.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(O,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Tosca id`}),(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.uid})]}),t.change&&(0,Q.jsx)(`li`,{className:`inline-flex items-center gap-2 text-muted`,children:Wn[t.change]})]})]}),s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),!i&&!s&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),i&&(0,Q.jsxs)(Q.Fragment,{children:[(i.problems?.length||i.reason)&&(0,Q.jsx)(Kt,{icon:u?o:ve,title:u?`What went wrong`:`What happened`,children:(0,Q.jsx)(`div`,{className:H(`flex flex-col gap-2 rounded-[12px] px-4 py-4 text-[13px] leading-relaxed [overflow-wrap:anywhere]`,u?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:(i.problems?.length?i.problems:[i.reason]).map((e,t)=>(0,Q.jsx)(`p`,{className:`m-0`,children:e},t))})}),(0,Q.jsx)(Kt,{icon:S,title:n?`Recording`:`Screenshots`,children:i.media.length>0?(0,Q.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-4 p-0 @xl:grid-cols-2`,children:i.media.map(t=>(0,Q.jsx)(Hn,{planId:e,unit:i.unit,file:t},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:i.unit&&i.group!==`notrun`?u?`No screenshot${n?` or video`:``} was kept for this failure.`:n?`No video was kept for this run.`:`No screenshot: the test passed.`:`Not run, so nothing was recorded.`})}),i.fidelity&&i.fidelity.rows.length>0&&(0,Q.jsx)(Kt,{icon:fe,title:`Tosca steps`,aside:`${i.fidelity.matched} of ${i.fidelity.required} in the test`,children:(0,Q.jsx)(We,{label:`Tosca steps`,placeholder:`Find a step`,resetKey:t.case,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-14`),children:`Step`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`What it does`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`In the test`})]}),children:i.fidelity.rows.map(e=>{let t=Vt[e.status]||Vt.matched;return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`font-mono text-[13px] text-muted`),children:e.id}),(0,Q.jsxs)(`td`,{className:H(`px-4 py-2`,`[overflow-wrap:anywhere]`),children:[e.kind===`assert`?`check ${e.op}`:e.op,e.element?` on ${e.element}`:``,e.step&&(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca “`,e.step,`”`]})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`whitespace-nowrap`),children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-2 flex-none rounded-full`,t.dot)}),t.label]})})]},e.id)})})}),(i.command||i.output)&&(0,Q.jsx)(Kt,{icon:de,title:`How it ran`,children:(0,Q.jsx)(Zt,{label:`How the test ran`,className:`max-h-[50vh]`,files:[...i.output?[{name:`Output`,code:i.output,log:!0}]:[],...i.command?[{name:`Command`,code:`$ ${i.command}`,lang:`bash`}]:[]]})})]})]})}var Wn={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},Gn=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function Kn(e){let t=[`Tosca id`,`Test case`,`Tosca path`,`Status`,`Test file`,`Steps in the test`,`Change`,`Execution lists`],n=e.tests.map(t=>[t.uid||``,t.name,[...t.folders,t.name].join(` / `),Bn(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?Wn[t.change]:``,t.suites.join(`; `)]);for(let t of e.removed)n.push([t.uid||``,t.name,t.name,`Removed from Tosca`,t.file||``,``,``,``]);let r=[t,...n].map(e=>e.map(Gn).join(`,`)).join(`\r
|
|
6
|
-
`),i=URL.createObjectURL(new Blob([`${r}\r\n`],{type:`text/csv;charset=utf-8`})),a=document.createElement(`a`);a.href=i,a.download=`tosca-${e.id}-traceability.csv`,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}var qn={failed:{icon:f,tone:`text-fail`,label:`Failed`},attention:{icon:o,tone:`text-warn`,label:`Needs a look`},passed:{icon:h,tone:`text-pass`,label:`Passed`},notrun:{icon:v,tone:`text-muted`,label:`Not run`},leftout:{icon:ne,tone:`text-muted`,label:`Left out`}};function Jn({rows:e,pick:t,onPick:n}){let r=()=>Math.max(0,Math.floor(e.findIndex(e=>e.case===t)/Rn)),[i,a]=(0,Z.useState)(r);(0,Z.useEffect)(()=>a(r()),[e.length]);let o=e.slice(i*Rn,i*Rn+Rn);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>{let r=qn[e.group],i=t===e.case;return(0,Q.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>n(e),className:H(`relative flex w-full min-w-0 cursor-pointer items-start gap-2 overflow-hidden rounded-[10px] border-0 px-4 py-2 text-left`,i?`bg-surface-strong`:`bg-transparent hover:bg-surface-muted`),children:[i&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-1 bg-accent`}),(0,Q.jsx)(r.icon,{size:16,"aria-label":r.label,className:H(`translate-y-0.5 flex-none`,r.tone)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-[13px] text-muted`,children:e.file||`No file`}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-4 text-[13px] text-muted tabular-nums`,children:[e.fidelity&&(0,Q.jsxs)(`span`,{children:[e.fidelity.matched,`/`,e.fidelity.required,` steps`]}),e.ms>0&&(0,Q.jsx)(`span`,{children:Tt(e.ms)}),e.media>0&&(0,Q.jsx)(`span`,{children:X(e.media,`file`)})]}),e.note&&e.group!==`passed`&&(0,Q.jsx)(`span`,{className:H(`line-clamp-2 text-[13px]`,e.group===`failed`?`text-fail`:`text-ink-2`),children:e.note})]})]})},e.case)})}),e.length>Rn&&(0,Q.jsx)(Me,{page:i,size:Rn,total:e.length,onPage:a,label:`Test case pages`})]})}function Yn({id:e,caseId:t}){let[r,i]=(0,Z.useState)(null),[a,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!0),[u,d]=(0,Z.useState)(`all`),[f,p]=(0,Z.useState)(``),[m,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(t?`cases`:`summary`),[C,w]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{l(!0),U.report(e).then(e=>{if(i(e.report),s(e.report?``:`No report yet. Start the conversion first.`),l(!1),e.report){let n=t&&e.report.tests.find(e=>e.case===t)||e.report.tests.find(e=>e.group===`failed`||e.group===`attention`)||e.report.tests.find(e=>e.group!==`leftout`);g(n?n.case:``)}},e=>{s(e.message),l(!1)})},[e]),(0,Z.useEffect)(()=>{m&&history.replaceState(null,``,B(`migration`,e,`report`,encodeURIComponent(m)))},[e,m]);let T=f.trim().toLowerCase(),ee=(0,Z.useMemo)(()=>{let e={failed:[],attention:[],passed:[],notrun:[],leftout:[]};for(let t of r?.tests||[])u!==`all`&&t.group!==u||T&&!`${t.name} ${t.file} ${t.case} ${t.note||``} ${t.suites.join(` `)} ${t.folders.join(` `)}`.toLowerCase().includes(T)||e[t.group].push(t);return e},[r,u,T]),E=async t=>{v(t),w(``);try{let n=await(t===`zip`?U.reportZip(e):U.reportHtml(e)),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`tosca-${e}.${t}`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){w(e.message)}finally{v(``)}};if(c)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading report…`});if(a||!r)return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a||`No report.`})});let ne=Qt[r.status]||{label:r.status,tone:`neutral`},[D,...O]=r.target.id.split(`-`),k=Vn(r.stages),A=r.tests.length-r.counts.leftout,j=r.tests.find(e=>e.case===m)||null,re=zn.reduce((e,t)=>e+ee[t.id].length,0),ie=r.tests.filter(e=>e.group===`failed`||e.group===`attention`),P=e=>(g(e.case),S(`cases`)),F=r.status===`running`?{tone:`running`,text:`Converting: ${r.counts.passed} of ${A} test cases pass so far.`}:ie.length===0&&r.counts.passed===A&&A>0?{tone:`pass`,text:`All ${A===1?``:`${A} `}Tosca test case${A===1?``:`s`} became passing ${r.target.title} tests.`}:{tone:r.counts.failed?`fail`:`warn`,text:`${r.counts.passed} of ${A} test cases pass${[r.counts.failed?`${r.counts.failed} failed`:``,r.counts.attention?`${r.counts.attention} need${r.counts.attention===1?`s`:``} a look`:``,r.counts.notrun?`${r.counts.notrun} not run`:``].filter(Boolean).map((e,t)=>t?`, ${e}`:`; ${e}`).join(``)}.`},I=F.tone===`pass`?h:F.tone===`running`?ge:o,ae=[{id:`summary`,label:`Summary`,icon:me},{id:`cases`,label:`Test cases`,icon:te,n:r.tests.length},{id:`coverage`,label:`Coverage`,icon:le},{id:`trace`,label:`Traceability`,icon:M}];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`h2`,{className:`m-0 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:`Conversion report`}),(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:Ln(r.source.file)}),(0,Q.jsx)(he,{size:14,"aria-hidden":`true`,className:`text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(St,{framework:D,language:O.join(`-`),size:14}),r.target.title]})]})]}),(0,Q.jsx)(Ne,{tone:ne.tone,children:ne.label}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsxs)(K,{variant:`ghost`,disabled:!!_,"aria-haspopup":`menu`,"aria-expanded":y,onClick:()=>b(!y),children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),_===`html`?`Making the report…`:_===`zip`?`Making the zip…`:`Export`,(0,Q.jsx)(n,{"aria-hidden":`true`})]}),(0,Q.jsxs)(st,{open:y,onClose:()=>b(!1),label:`Export this report`,align:`end`,className:`w-[280px]`,children:[(0,Q.jsxs)(_t,{onClick:()=>(b(!1),void E(`html`)),children:[(0,Q.jsx)(xe,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`HTML report, screenshots inside`]}),(0,Q.jsxs)(_t,{onClick:()=>(b(!1),r.status===`running`?w(`The zip is made when the run ends.`):void E(`zip`)),children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Zip with videos`]}),(0,Q.jsxs)(_t,{onClick:()=>(b(!1),Kn(r)),children:[(0,Q.jsx)(N,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Traceability CSV, for Tosca`]})]})]})]}),C&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:C}),(0,Q.jsx)(Ze,{prefix:`rtab`,className:`mb-0`,tabs:ae,current:x,onPick:S,label:`Report`}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${x}`,"aria-labelledby":`rtab-${x}`,className:`pane-swap flex min-w-0 flex-col gap-8`,children:[x===`summary`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{"aria-label":`Outcome`,className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:H(`m-0 flex items-start gap-4 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,F.tone===`pass`?`text-ink`:F.tone===`fail`?`text-fail`:`text-ink`),children:[(0,Q.jsx)(I,{size:24,"aria-hidden":`true`,className:H(`translate-y-0.5 flex-none`,F.tone===`pass`?`text-pass`:F.tone===`fail`?`text-fail`:F.tone===`warn`?`text-warn`:`text-ink motion-safe:animate-spin`)}),F.text]}),(0,Q.jsx)(At,{label:`The conversion`,from:{framework:`tosca`,title:`Tosca${r.source.project?`, ${r.source.project}`:``}`,sub:r.source.file},to:{framework:D,language:O.join(`-`),title:r.target.title,sub:`Into ${r.target.dir}/`}}),(0,Q.jsxs)(qe,{label:`The run in numbers`,children:[(0,Q.jsx)(et,{label:`Passed`,value:`${r.counts.passed} of ${A}`,tone:r.counts.passed===A?`text-pass`:void 0,note:r.counts.leftout?`${r.counts.leftout} left out of the plan`:`Every test case in the plan`}),(0,Q.jsx)(et,{label:`Tosca steps kept`,value:r.steps.required?`${Math.round(r.steps.matched/r.steps.required*100)}%`:`—`,note:r.steps.required?`${r.steps.matched} of ${r.steps.required} steps and checks`:`No steps to keep`}),(0,Q.jsx)(et,{label:`Time`,value:Tt(r.ms),note:`Started ${kt(r.startedAt)}`}),(0,Q.jsx)(et,{label:`Model cost`,value:r.cost?`${r.cost.estimate?`~`:``}${gt(r.cost.amount,r.cost.currency)}`:`—`,note:[r.model||`Model not recorded`,r.usage.input||r.usage.output?`${ut(r.usage.input+r.usage.output)} tokens`:``].filter(Boolean).join(`, `)})]})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-attention`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-attention`,className:`m-0 text-[16px] font-semibold`,children:`Needs your attention`}),k&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`The run stopped in `,en[k.id],k.note?`: ${k.note}`:`.`]}),ie.length===0&&!r.personSteps?(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(h,{size:16,"aria-hidden":`true`,className:`text-pass`}),`Nothing needs attention: every test case that ran passed, with its Tosca steps kept.`]}):(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[ie.map(e=>(0,Q.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>P(e),className:`flex w-full cursor-pointer items-start gap-4 border-0 bg-transparent py-4 text-left hover:bg-surface-muted`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`,className:H(`translate-y-0.5 flex-none`,e.group===`failed`?`text-fail`:`text-warn`)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-semibold text-ink`,children:e.name}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.note||Bn(e.status).label})]}),(0,Q.jsx)(he,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-muted`})]})},e.case)),r.personSteps>0&&(0,Q.jsxs)(`li`,{className:`flex items-start gap-4 py-4 text-[13px] text-ink-2`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-warn`}),X(r.personSteps,`Tosca step`),` could not be automated and `,r.personSteps===1?`is`:`are`,` left for a person: see Coverage.`]})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-8 @3xl:grid-cols-2`,children:[(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-written`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-written`,className:`m-0 text-[16px] font-semibold`,children:`What was written`}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-[13px]`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Tests`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-ink`,children:[X(A,`test file`),` in `,(0,Q.jsxs)(`span`,{className:`font-mono`,children:[r.target.dir,`/`]})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Page objects`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink`,children:r.pages.length?X(r.pages.length,`page`):`None`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Media`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink`,children:r.media?X(r.media,`file`):r.target.video?`Videos and failure screenshots`:`Failure screenshots`}),r.reverted.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-ink`,children:[X(r.reverted.length,`edit`),` outside the target folder`]})]})]})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-needs`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-needs`,className:`m-0 text-[16px] font-semibold`,children:`What the tests need to run`}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-[13px]`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`App`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:r.source.baseUrl||`Not named`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Variables`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:r.env.length?r.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `):`None`})]})]})]}),(r.previous||r.removed.length>0)&&(0,Q.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-strong px-4 py-4 text-[13px] leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:[r.previous?(0,Q.jsxs)(Q.Fragment,{children:[`Re-imported from `,(0,Q.jsx)(`a`,{href:B(`migration`,r.previous,`report`),children:r.previous}),`: `,r.tests.filter(e=>e.change===`same`).length,` unchanged (their tests kept), `,r.tests.filter(e=>e.change===`changed`).length,` changed, `,r.tests.filter(e=>e.change===`new`).length,` new.`,` `]}):null,r.removed.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[X(r.removed.length,`test case`),` no longer in the exports; their tests are left as they are.`]})]}),r.notes.trim()&&(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-notes`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-notes`,className:`m-0 text-[16px] font-semibold`,children:`Notes from the conversion`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:r.notes.trim()})]})]}),x===`cases`&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(300px,360px)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(Re,{id:`tosca-report-search`,label:`Find a test case`,value:f,onChange:p,placeholder:`Find a test case, file or problem`,className:`max-w-none flex-none`}),(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex flex-wrap gap-1`,children:(0,Q.jsx)(Pe,{items:[{id:`all`,label:`All`,n:r.tests.length},...zn.filter(e=>r.counts[e.id]>0).map(e=>({id:e.id,label:e.label,n:r.counts[e.id],alert:e.id===`failed`}))],value:u,onChange:d})}),(0,Q.jsx)(`nav`,{"aria-label":`Test cases`,className:`flex min-w-0 flex-col overscroll-contain @5xl:max-h-[min(70vh,760px)] @5xl:overflow-y-auto`,children:re?(0,Q.jsx)(Jn,{rows:zn.flatMap(e=>ee[e.id]),pick:m,onPick:e=>g(e.case)}):(0,Q.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-sm text-muted`,children:`No test case matches.`})})]}),(0,Q.jsx)(`div`,{className:`min-w-0 @5xl:sticky @5xl:top-4`,children:j?(0,Q.jsx)(`div`,{className:`pane-swap`,children:(0,Q.jsx)(Un,{planId:r.id,pick:j,video:r.target.video})},j.case):(0,Q.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-sm text-muted`,children:`Pick a test case to see its steps, output and media.`})})]}),x===`coverage`&&(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-cov`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`h3`,{id:`rep-cov`,className:`m-0 text-[16px] font-semibold`,children:`How much of each Tosca test case is in its test`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:`Every Tosca step and check should be in the converted test. A short bar means steps are missing or left for a person.`})]}),(0,Q.jsx)(We,{label:`Coverage by test case`,placeholder:`Find a test case`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Tosca steps in the test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Result`})]}),children:r.tests.filter(e=>e.group!==`leftout`).map(e=>{let t=e.fidelity,n=t&&t.required?t.matched/t.required*100:0;return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>P(e),className:`cursor-pointer border-0 bg-transparent p-0 text-left text-[13px] font-medium text-ink hover:underline`,children:e.name})}),(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:t?(0,Q.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Ft,{value:n,tone:n===100?`bg-pass`:n>=80?`bg-warn`:`bg-fail`,label:`${e.name}: ${t.matched} of ${t.required} Tosca steps`})}),(0,Q.jsxs)(`span`,{className:`w-16 flex-none text-right text-[13px] tabular-nums text-ink-2`,children:[t.matched,`/`,t.required]})]}):(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not checked`})}),(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(Ne,{tone:Bn(e.status).tone,children:Bn(e.status).label})})]},e.case)})})]}),x===`trace`&&(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-trace`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`h3`,{id:`rep-trace`,className:`m-0 text-[16px] font-semibold`,children:`Each Tosca test case and what it became`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:`By its Tosca id and path, for audits and for Tosca itself. Export gives the same as a CSV.`})]}),(0,Q.jsx)(K,{variant:`icon`,size:`icon`,onClick:()=>Kn(r),"aria-label":`Download as CSV`,"data-tip":`Download as CSV`,children:(0,Q.jsx)(z,{"aria-hidden":`true`})})]}),(0,Q.jsx)(We,{label:`Traceability`,placeholder:`Find a Tosca id, test case or file`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Tosca test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Test file`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Result`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @3xl:table-cell`),children:`Execution lists`})]}),children:r.tests.map(e=>(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium text-ink`,children:e.name}),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.folders.join(` / `)||`—`}),e.uid&&(0,Q.jsx)(`span`,{className:`block font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.uid})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`),children:e.file||`—`}),(0,Q.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,Q.jsx)(Ne,{tone:Bn(e.status).tone,children:Bn(e.status).label}),e.change&&(0,Q.jsx)(`span`,{className:`mt-1 block text-[13px] text-muted`,children:Wn[e.change]})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:e.suites.join(`, `)||`—`})]},e.case))})]})]},x)]})}var Xn={converted:{icon:h,cls:`text-pass`,label:`Converted`},partly:{icon:c,cls:`text-warn`,label:`Converted, with steps for a person`},not:{icon:f,cls:`text-muted`,label:`Not converted`}},Zn=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function Qn(e,t,n){let r=[[`Test case id`,`Test case`,`Kind`,`What happens`,`Modules behind it`].map(Zn).join(`,`)];for(let n of e.rows)for(let e of n.cases)r.push([e,t.get(e)||e,n.label,Xn[n.outcome].label,n.modules.map(e=>e.name).join(`; `)].map(Zn).join(`,`));let i=URL.createObjectURL(new Blob([`${r.join(`\r
|
|
7
|
-
`)}\r\n`],{type:`text/csv;charset=utf-8`})),a=document.createElement(`a`);a.href=i,a.download=n,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function $n({coverage:e,names:t,file:r,folded:i=!1}){let a=e.converted+e.partly,[o,s]=(0,Z.useState)(!i),c=(0,Z.useId)();return(0,Q.jsx)(tt,{id:`tsc-coverage`,level:3,icon:le,title:`What can be migrated`,description:(0,Q.jsxs)(`span`,{className:`text-ink-2`,children:[a,` of `,e.total,` test case`,e.total===1?``:`s`,e.partly?`, ${e.partly} of them with steps for a person`:``,`; `,e.not,` not`]}),actions:(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,"aria-expanded":o,"aria-controls":c,onClick:()=>s(!o),children:[(0,Q.jsx)(n,{"aria-hidden":`true`,className:H(`transition-transform`,o&&`rotate-180`)}),o?`Hide the breakdown`:`Show the breakdown`]}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>Qn(e,t,r),"data-tip":`Every test case with its kind and what happens to it, for a spreadsheet.`,children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),`CSV`]})]}),children:(0,Q.jsx)(Ke,{open:o,id:c,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-[13px]`,children:e.rows.map(e=>{let t=Xn[e.outcome];return(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsx)(t.icon,{size:16,role:`img`,"aria-label":t.label,className:H(`mt-1 flex-none`,t.cls)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-ink`,children:e.label}),(0,Q.jsx)(`span`,{className:`tabular-nums text-ink-2`,children:e.cases.length===1?`1 test case`:`${e.cases.length} test cases`})]}),(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.becomes}),e.modules.length>0&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Because of: `,e.modules.slice(0,4).map(e=>`${e.name}${e.engine?` (${e.engine})`:``} in ${e.cases}`).join(`, `),e.modules.length>4?`, and ${e.modules.length-4} more`:``]}),e.reasons&&e.reasons.length>0&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Steps left: `,e.reasons.slice(0,3).map(e=>`${e.count}× ${e.reason}`).join(`, `),e.reasons.length>3?`, and ${e.reasons.length-3} more`:``]})]})]},e.kind)})})})})}var er={ok:{icon:h,cls:`text-pass`,label:`Ready`},answer:{icon:c,cls:`text-warn`,label:`Needs an answer`},blocker:{icon:f,cls:`text-fail`,label:`Blocks the start`}};function tr({planId:e,stamp:t,busy:n,open:r,onChanged:i,onAccept:a,acceptTip:o}){let[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{U.data(e).then(e=>{c(e),g(``)},e=>g(e.message))},[e,t]);let _=async t=>{m(!0),g(``);try{c(await U.setData(e,t)),u(``),f(``),i()}catch(e){g(e.message)}finally{m(!1)}},v=n||p,y=s?[...new Set(s.cases.flatMap(e=>e.missing))]:[];return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[s&&s.sources.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:s.sources.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.file}),e.sheet?` (sheet ${e.sheet})`:``,`: `,X(e.rows,`row`),e.transposed?`, attributes down the first column`:``]}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.file}${e.sheet?`, sheet ${e.sheet}`:``}`,disabled:v,onClick:()=>void _({remove:t}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Remove`})]},`${e.file}\u0000${e.sheet||``}`))}),s&&y.length>0&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Not found yet: `,(0,Q.jsx)(`span`,{className:`font-mono`,children:y.slice(0,12).join(`, `)}),y.length>12?` and ${y.length-12} more`:``]}),r&&(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),l&&_({file:l,...d.trim()?{sheet:d.trim()}:{}})},children:[(0,Q.jsxs)(ke,{size:`sm`,"aria-label":`A data file of the project`,value:l,disabled:v||!s,onChange:e=>u(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Q.jsx)(`option`,{value:``,children:s&&!s.files.length?`No CSV, TSV, Excel or JSON file in the project`:`A data file of the project…`}),(s?.files||[]).map(e=>(0,Q.jsx)(`option`,{value:e.path,children:e.path},e.path))]}),/\.xls[xm]$/i.test(l)&&(0,Q.jsx)(W,{size:`sm`,"aria-label":`Sheet, the first if empty`,placeholder:`Sheet, the first if empty`,value:d,onChange:e=>f(e.target.value),disabled:v,className:`min-w-0 flex-[1_1_160px]`}),(0,Q.jsx)(K,{size:`sm`,type:`submit`,disabled:v||!l,children:`Use it`}),a&&(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:v,onClick:a,"data-tip":o,children:`Leave them for a person`})]}),h&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail`,children:h})]})}function nr({r:e,busy:t,onAnswer:n}){let[r,i]=(0,Z.useState)(``),a=String(e.environments.findIndex(t=>t.environment===e.answers.environment&&t.app===e.answers.app));return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[e.environments.length>0&&(0,Q.jsxs)(ke,{size:`sm`,"aria-label":`An app of env.yaml`,value:a,disabled:t,onChange:t=>{let r=e.environments[Number(t.target.value)];r&&n({environment:r.environment,app:r.app})},className:`w-auto max-w-[320px]`,children:[(0,Q.jsx)(`option`,{value:`-1`,children:`An app of env.yaml…`}),e.environments.map((e,t)=>(0,Q.jsxs)(`option`,{value:String(t),children:[e.app,` on `,e.environment,`: `,e.url]},`${e.environment}\u0000${e.app}`))]}),(0,Q.jsxs)(`form`,{className:`flex min-w-0 flex-[1_1_280px] gap-2`,onSubmit:e=>{e.preventDefault(),r.trim()&&n({baseUrl:r.trim()})},children:[(0,Q.jsx)(W,{size:`sm`,type:`url`,"aria-label":`Or the address the tests start at`,placeholder:`Or the address, https://…`,value:r,onChange:e=>i(e.target.value),disabled:t,className:`min-w-0 flex-1`}),(0,Q.jsx)(K,{size:`sm`,type:`submit`,disabled:t||!r.trim(),children:`Use it`})]})]})}function rr({item:e,picked:t,busy:n,onPick:r}){let i=e.apps||[];return i.length?(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:(0,Q.jsxs)(ke,{size:`sm`,"aria-label":e.engine===`database`?`A database`:e.engine===`mobile`?`A mobile app`:`A desktop app`,value:t&&i.includes(t)?t:``,disabled:n,onChange:e=>e.target.value&&r(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Q.jsx)(`option`,{value:``,children:e.engine===`database`?`A database…`:e.engine===`mobile`?`A mobile app…`:`A desktop app…`}),i.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}):(0,Q.jsxs)(`p`,{className:`m-0 pt-1 text-[13px] text-muted`,children:[e.engine===`database`?`No databases yet: add one in `:`No ${e.engine} apps yet: add one in `,(0,Q.jsx)(`a`,{href:B(`settings`,e.engine===`database`?`databases`:`environments`),children:e.engine===`database`?`Settings, Databases`:`Settings, Environments`}),`.`]})}function ir({item:e,busy:t,secrets:n,onSaved:r,onAccept:i,onUse:a}){let[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(``),m=async()=>{d(!0),p(``);try{await De.saveSecrets({[e.name]:o}),s(``),r()}catch(e){p(e.message)}finally{d(!1)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o&&m()},children:[(0,Q.jsx)(W,{size:`sm`,type:e.secret?`password`:`text`,autoComplete:`off`,spellCheck:!1,"aria-label":`Value of ${e.name}`,placeholder:e.secret?`Its value, kept in the credential store`:`Its value`,value:o,onChange:e=>s(e.target.value),disabled:t||u,className:`min-w-0 flex-[1_1_220px]`}),(0,Q.jsx)(K,{size:`sm`,type:`submit`,disabled:t||u||!o,children:`Save`}),e.accept&&(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:t||u,onClick:i,"data-tip":e.accept,children:`Convert without it`})]}),n.length>0&&!e.uses&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`use-${e.name}`,className:`text-[13px] text-muted`,children:`Or use a saved secret`}),(0,Q.jsxs)(ke,{id:`use-${e.name}`,size:`sm`,value:c,disabled:t||u,onChange:e=>l(e.target.value),className:`w-auto min-w-[200px] font-mono`,children:[(0,Q.jsx)(`option`,{value:``,children:`A saved secret…`}),n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]}),(0,Q.jsx)(K,{size:`sm`,disabled:t||u||!c,onClick:()=>a(c),children:`Use it`})]}),f&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail`,children:f})]})}function ar({planId:e,onReady:t,onCoverage:n}){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),l=(0,Z.useCallback)(e=>{i(e.readiness),t?.(e.readiness.ready),n?.(e.coverage)},[t,n]),u=(0,Z.useCallback)(()=>{U.ready(e).then(l,e=>c(e.message))},[e,l]);(0,Z.useEffect)(()=>{i(null),c(``),t?.(!1)},[e]),(0,Z.useEffect)(u,[u]);let d=async t=>{o(!0),c(``);try{l(await U.answer(e,t))}catch(e){c(e.message)}finally{o(!1)}};return(0,Q.jsxs)(tt,{id:`tsc-ready`,level:3,icon:ue,title:`Before it runs`,description:(0,Q.jsx)(`span`,{role:`status`,className:H(r?r.ready?`text-pass`:`text-ink-2`:`text-muted`),children:r?r.ready?`Everything the tests need is in place.`:`${r.blockers?`${r.blockers} to fix`:``}${r.blockers&&r.open?`, `:``}${r.open?`${r.open} to answer`:``} before it can start.`:`Checking…`}),actions:(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:u,disabled:a,"data-tip":`Check again, after installing a program or setting a variable.`,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Check again`]}),children:[s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),r&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-[13px]`,children:r.items.map(t=>{let n=er[t.level];return(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:H(`mt-1 flex-none`,n.cls)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:H(`font-medium text-ink`,t.kind===`env`||t.kind===`tool`?`font-mono text-[13px]`:``),children:t.title}),(0,Q.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:t.text}),t.accepted&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-warn`,children:[`Accepted: `,t.accept,(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({unaccept:[t.id]}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Undo`})]}),t.kind===`url`&&(0,Q.jsx)(nr,{r,busy:a,onAnswer:e=>void d(e)}),t.kind===`app`&&t.engine&&(0,Q.jsx)(rr,{item:t,picked:t.engine===`desktop`?r.answers.desktopApp:t.engine===`mobile`?r.answers.mobileApp:r.answers.database,busy:a,onPick:e=>void d(t.engine===`desktop`?{desktopApp:e}:t.engine===`mobile`?{mobileApp:e}:{database:e})}),t.kind===`env`&&t.level===`answer`&&(0,Q.jsx)(ir,{item:t,busy:a,secrets:r.secrets||[],onSaved:u,onAccept:()=>void d({accept:[t.id]}),onUse:e=>void d({use:{name:t.name,secret:e}})}),t.kind===`env`&&t.uses&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Q.jsxs)(`span`,{children:[`Uses the saved secret `,(0,Q.jsx)(`span`,{className:`font-mono`,children:t.uses}),`.`]}),(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({use:{name:t.name,secret:``}}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Stop using it`})]}),t.kind===`data`&&(0,Q.jsx)(tr,{planId:e,stamp:r,busy:a,open:t.level===`answer`,onChanged:u,onAccept:t.accept&&t.level===`answer`?()=>void d({accept:[t.id]}):void 0,acceptTip:t.accept})]})]},t.id)})})]})}var or=/^[a-f0-9]{16}$/,sr=`forgeqe.tosca.assistant`;function cr(){try{let e=localStorage.getItem(sr)||``;return or.test(e)?e:``}catch{return``}}function lr(e){try{e?localStorage.setItem(sr,e):localStorage.removeItem(sr)}catch{}}var ur=[/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/,/\bgithub_pat_[A-Za-z0-9_]{20,}/,/\bglpat-[A-Za-z0-9_-]{20,}/,/\bATBB[A-Za-z0-9_-]{20,}/,/\b[a-z2-7]{52}\b/,/\bsk-[A-Za-z0-9_-]{16,}/,/\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{16,}/i,/\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*\S{6,}/i],dr=e=>e.replace(/^.*\//,``).replace(/\.tsu$/i,``);function fr(e){let t=e.exports[0]?.path||e.clones[0]?.exports[0]?.path,n=e.exports.length+e.clones.reduce((e,t)=>e+t.exports.length,0),r=[];return n>1&&r.push({icon:ie,title:`All ${n} exports to Playwright`,hint:`Every export in one plan, in TypeScript`,text:`Migrate all the exports to Playwright in TypeScript`}),t&&r.push({icon:I,title:`${dr(t)} to Selenium`,hint:`One export, in Java, with page objects`,text:`Migrate ${dr(t)} to Selenium in Java, with page objects`}),t&&r.push({icon:u,title:`${dr(t)} to Cypress`,hint:`Into a folder of its own`,text:`Migrate ${dr(t)} to Cypress in TypeScript, into e2e/tosca`}),r.push({icon:pe,title:`Help me choose`,hint:`The assistant asks one thing at a time`,text:`I want to migrate our Tosca tests. Help me choose.`}),r.slice(0,4)}function pr({view:e,sid:t,onSid:n}){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f=it();(0,Z.useEffect)(()=>{t&&r?.id!==t&&Ee.view(t).then(i,()=>{n(``),lr(``)})},[t]),(0,Z.useEffect)(()=>{if(!r?.thinking&&!r?.checking)return;let e=setTimeout(()=>Ee.view(r.id).then(i,e=>c(e.message)),1200);return()=>clearTimeout(e)},[r]);let p=r?.messages.length??0;(0,Z.useEffect)(()=>{p&&d.current?.scrollIntoView({block:`nearest`,behavior:Oe()})},[p,r?.thinking]);let m=e=>{o(e),setTimeout(()=>document.getElementById(`tosca-agent-box`)?.focus(),0)},h=async e=>{u(!0),c(``);try{let r=await e();return i(r),r.id!==t&&(n(r.id),lr(r.id)),!0}catch(e){return c(e.message),!1}finally{u(!1)}},g=async e=>{!e.trim()||l||r?.thinking||(ur.some(t=>t.test(e))?(o(``),c(`That looks like a token or a password, so it was not sent and the box was cleared. Use the token field of the clone question: it keeps it in your credential store.`)):await h(()=>r?Ee.say(r.id,e):Ee.start(e))&&o(``))},_=()=>{r&&Ee.end(r.id).catch(()=>{}),i(null),o(``),c(``),n(``),lr(``)},v=()=>r?.prefill&&(location.hash=B(`migration`,`new`,r.id)),y=!r,b=l||!!r?.thinking;return(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-agent`,"aria-labelledby":`tab-agent`,className:`mx-auto flex w-full max-w-[1080px] flex-auto flex-col gap-6`,children:[y?(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[880px] flex-col items-center gap-4 pt-2 text-center short:gap-4 short:pt-0`,children:[(0,Q.jsx)(Ve,{agent:`forgeqe-tosca`,px:f?72:112,working:b,className:`mb-1`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:`What do you want to migrate from Tosca?`}),(0,Q.jsx)(`p`,{className:`m-0 text-[16px] text-muted`,children:`Say it in your words: the exports, the framework and where the tests run. I ask only what I still need, then open the wizard with every stage filled in for you to check.`})]}),(0,Q.jsx)(yr,{view:e}),(0,Q.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:fr(e).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>m(e.text),className:`flex cursor-pointer items-start gap-4 rounded-[12px] panel px-4 py-2 text-left hover:border-line-strong hover:bg-surface-muted`,children:[(0,Q.jsx)(Be,{icon:e.icon,size:18,className:`mt-1 text-accent-fg`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.hint})]})]},e.title))}),(0,Q.jsxs)(`a`,{href:B(`migration`,`new`),className:`inline-flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]}):(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Q.jsxs)(`section`,{"aria-label":`Conversation with Guide`,className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:r.model?`Worked out by ForgeQE's model from what you said and what your project has.`:`Worked out by ForgeQE's rules: no model is set up.`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:_,disabled:l,children:`New conversation`})]}),(0,Q.jsxs)(`ol`,{"aria-live":`polite`,className:`m-0 flex list-none flex-col gap-6 p-0`,children:[r.messages.map((e,t)=>(0,Q.jsx)(`li`,{className:`fade-quick`,children:e.role===`person`?(0,Q.jsx)(vt,{text:e.text}):(0,Q.jsx)(mr,{text:e.text})},t)),r.thinking&&(0,Q.jsx)(`li`,{className:`fade-quick`,children:(0,Q.jsx)(mr,{text:r.working===`cloning`?`Cloning the repository and looking for Tosca exports…`:`Reading what you said…`,working:r.working===`cloning`?`cloning`:`reading`})})]}),!r.thinking&&r.question?.id===`clone`&&r.clone&&(0,Q.jsx)(gr,{c:r.clone,disabled:l,onToken:e=>h(()=>Ee.token(r.id,e)),onPick:e=>void h(()=>Ee.pick(r.id,`clone`,[e]))},`clone-${p}`),!r.thinking&&r.question&&r.question.id!==`clone`&&r.question.options.length>0&&(0,Q.jsx)(hr,{q:r.question,disabled:l,onPick:e=>void h(()=>Ee.pick(r.id,r.question.id,e)).then(()=>document.getElementById(`tosca-agent-box`)?.focus())},`${r.question.id}-${p}`),!r.thinking&&r.prefill&&(0,Q.jsxs)(`div`,{className:`fade-quick flex flex-wrap items-center gap-4 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px] text-ink`,children:r.question?`The wizard can open now; the rest is optional.`:`Everything is ready.`}),(0,Q.jsxs)(K,{variant:`primary`,onClick:v,children:[`Open the prefilled wizard`,(0,Q.jsx)(he,{"aria-hidden":`true`})]})]}),(0,Q.jsx)(`div`,{ref:d})]}),(0,Q.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Q.jsx)(_r,{v:r})})]}),(0,Q.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-auto flex flex-col bg-gradient-to-t from-bg from-85% to-transparent pt-6 pb-4`,children:[s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 bg-bg pb-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),(0,Q.jsx)(nt,{id:`tosca-agent-box`,label:`Tell Guide`,value:a,onChange:e=>{o(e),c(``)},onSend:()=>void g(a),busy:l,disabled:b,placeholder:y?`Migrate checkout.tsu to Playwright in TypeScript, on QA…`:`Answer, or change anything you said…`})]})]})}function mr({text:e,working:t}){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,Q.jsx)(je,{state:t?`working`:`idle`,px:28,label:t?`Guide is ${t}`:`Guide`,className:`mt-1 flex-none`}),(0,Q.jsx)(`p`,{className:H(`m-0 text-[16px] leading-relaxed whitespace-pre-line [overflow-wrap:anywhere]`,t?`text-muted`:`text-ink-2`),children:e})]})}function hr({q:e,disabled:t,onPick:n}){let[r,i]=(0,Z.useState)([]);return(0,Q.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.multi?(0,Q.jsx)(Ie,{items:e.options.filter(e=>!e.action).map(e=>({id:e.id,label:e.label})),value:r,onChange:e=>{let t=e.includes(`all`)&&!r.includes(`all`);i(t?[`all`]:e.filter(e=>e!==`all`))}}):e.options.map(e=>(0,Q.jsxs)(K,{size:`sm`,variant:e.id===`skip`?`ghost`:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.label,e.hint&&(0,Q.jsx)(`span`,{className:`text-[13px] font-normal text-muted`,children:e.hint})]},e.id))}),e.multi&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.options.some(e=>!e.action)&&(0,Q.jsxs)(K,{size:`sm`,variant:`primary`,disabled:t||!r.length,onClick:()=>n(r),children:[`Use `,r.includes(`all`)?`all`:r.length>1?`these ${r.length}`:`this`]}),e.options.filter(e=>e.action).map(e=>(0,Q.jsxs)(K,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.id===`git`&&(0,Q.jsx)(w,{"aria-hidden":`true`}),e.label]},e.id)),e.typed&&e.options.some(e=>!e.action)&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Or type the names below.`})]})]})}function gr({c:e,disabled:t,onToken:n,onPick:r}){let[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),u=[...new Set([...e.credentials,...e.tokenVar?[e.tokenVar]:[]])].sort(),d=async()=>{if(i){s(!0),l(``);try{await De.saveSecrets({[i.name]:i.value}),a(null),await n(i.name)}catch(e){l(e.message)}finally{s(!1)}}},f=t||o;return(0,Q.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-4 rounded-[14px] panel p-4`,children:[(0,Q.jsxs)(`legend`,{className:`sr-only`,children:[`Clone `,e.url]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Q.jsxs)(`label`,{htmlFor:`tsa-token`,className:`flex flex-col gap-1 text-[13px] font-medium text-muted`,children:[`Access token`,(0,Q.jsxs)(ke,{id:`tsa-token`,size:`sm`,value:e.tokenVar??``,disabled:f,onChange:e=>void n(e.target.value),className:`min-w-[220px]`,children:[(0,Q.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),u.map(t=>(0,Q.jsxs)(`option`,{value:t,children:[t,t===e.tokenVar&&!e.tokenSaved?` (not saved yet)`:``]},t))]})]}),!i&&(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>a({name:e.tokenVar&&!e.tokenSaved?e.tokenVar:e.suggested,value:``}),children:`Add a token`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>void n(e.tokenVar??``),children:`Check again`})]}),!i&&(0,Q.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Or save it in`,` `,(0,Q.jsx)(`a`,{href:B(`settings`,`repo-tokens`),target:`_blank`,rel:`noopener`,children:`Settings › Secrets › Repository tokens`}),`, then press Check again.`]}),i&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,Q.jsxs)(`label`,{htmlFor:`tsa-token-name`,className:`flex flex-col gap-1 text-[13px] font-medium text-muted`,children:[`Name`,(0,Q.jsx)(W,{id:`tsa-token-name`,size:`sm`,value:i.name,spellCheck:!1,maxLength:64,onChange:e=>a({...i,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})]}),(0,Q.jsxs)(`label`,{htmlFor:`tsa-token-value`,className:`flex flex-col gap-1 text-[13px] font-medium text-muted`,children:[`Token`,(0,Q.jsx)(W,{id:`tsa-token-value`,size:`sm`,type:`password`,autoComplete:`off`,value:i.value,onChange:e=>a({...i,value:e.target.value}),className:`w-[260px] max-w-full`})]}),(0,Q.jsx)(K,{size:`sm`,disabled:f||!i.name||!i.value,onClick:()=>void d(),children:o?`Saving…`:`Save`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>a(null),children:`Cancel`}),(0,Q.jsx)(`span`,{className:`w-full text-[13px] text-muted`,children:`Kept in ForgeQE's credential store, never in the chat, the address or this page. Give it read access to the repository only.`})]}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Q.jsxs)(K,{size:`sm`,variant:`primary`,disabled:f||!(!e.tokenVar||e.tokenSaved),onClick:()=>r(`yes`),children:[(0,Q.jsx)(w,{"aria-hidden":`true`}),`Clone it`]}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>r(`no`),children:`No`}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.tokenVar&&!e.tokenSaved?`Save a token as ${e.tokenVar} first, or pick None.`:e.tokenVar?`Signs in with ${e.tokenVar}.`:`Nothing is cloned until you say so.`})]})]})}function _r({v:e}){let t=(e,t)=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line-soft py-4 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:e}),(0,Q.jsx)(`div`,{className:`text-sm [overflow-wrap:anywhere]`,children:t})]}),n=(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`}),r=e.have;return(0,Q.jsxs)(`aside`,{"aria-label":`What the assistant has so far`,className:`flex flex-col rounded-[14px] panel p-6`,children:[t(r.exports.length>1?`Exports (${r.exports.length})`:`Export`,r.exports.length?(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[r.exports.slice(0,6).map(e=>(0,Q.jsx)(`li`,{className:`font-mono text-[13px]`,children:e},e)),r.exports.length>6&&(0,Q.jsxs)(`li`,{className:`text-[13px] text-muted`,children:[`and `,r.exports.length-6,` more`]})]}):n),t(`Target`,r.targetId?(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Q.jsx)(St,{framework:r.targetId.split(`-`)[0],language:r.targetId.split(`-`).slice(1).join(`-`)}),r.target]}):n),t(`Tests start at`,r.start||(0,Q.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`})),r.needs.map(e=>(0,Q.jsx)(Z.Fragment,{children:t(e.need===`database`?`Database`:e.need===`mobile`?`Mobile app`:`Desktop app`,e.picked?(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.picked}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`}))},e.need)),t(`Folder`,r.into?(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:r.into}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`tosca-<target>`})),t(`Saved secrets`,r.uses.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.uses.map(e=>(0,Q.jsxs)(`li`,{className:`font-mono text-[13px]`,children:[e.variable,` uses `,e.secret]},e.variable))}):(0,Q.jsx)(`span`,{className:`text-muted`,children:e.checking?`Reading which variables the tests need…`:`None`})),t(`Instructions`,r.instructions?(0,Q.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:r.instructions}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}var vr=e=>e.kind===`upload`||e.kind===`paste`?e.exports.map(e=>dr(e.path)).join(`, `)||`Uploaded files`:e.label.replace(/^.*[\\/]/,``).replace(/\.git$/,``);function yr({view:e}){let t=`inline-flex min-h-7 items-center gap-1 rounded-full border px-2 no-underline`,n=e.clones.reduce((e,t)=>e+t.exports.length,0);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`mr-1 text-muted`,children:`Exports`}),e.exports.slice(0,5).map(e=>(0,Q.jsxs)(`span`,{className:H(t,`border-transparent bg-surface-strong text-ink-2`),children:[(0,Q.jsx)(r,{size:12,"aria-hidden":`true`}),dr(e.path)]},e.path)),[...e.clones.reduce((e,t)=>{let n=`${t.kind===`git`||!t.kind?`git`:`file`}\u0000${vr(t)}`;return e.set(n,[...e.get(n)||[],t])},new Map).values()].map(e=>(0,Q.jsxs)(`span`,{className:H(t,`border-transparent bg-surface-strong text-ink-2`),children:[e[0].kind&&e[0].kind!==`git`?(0,Q.jsx)(r,{size:12,"aria-hidden":`true`}):(0,Q.jsx)(w,{size:12,"aria-hidden":`true`}),vr(e[0]),e.length>1&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.length,` copies)`]})]},e[0].id)),(0,Q.jsx)(`a`,{href:B(`migration`,`new`),className:H(t,`border-dashed border-line-strong bg-transparent text-muted no-underline hover:text-ink`),children:`Another source`}),(0,Q.jsx)(`span`,{className:`ml-1 text-muted`,children:e.exports.length+n?`${e.exports.length+n} found`:`none in this project yet`})]})}var br=[s,le,F,_e],xr={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function Sr({steps:e,at:t,reached:n,onGo:r}){return(0,Q.jsx)(`nav`,{"aria-label":`Steps`,className:`min-w-0`,children:(0,Q.jsx)(`ol`,{className:`m-0 flex list-none flex-wrap gap-4 p-0 @3xl:flex-col @3xl:flex-nowrap @3xl:gap-0`,children:e.map((i,a)=>{let o=a===t,s=a<n&&!o,c=a<=n&&!o,l=a===e.length-1,u=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:H(`text-[13px] leading-8 font-semibold @3xl:hidden`,o||s?`text-ink`:`text-muted`),children:i.short}),(0,Q.jsx)(`span`,{className:H(`hidden text-[16px] leading-8 font-semibold @3xl:inline`,o||s?`text-ink`:c?`text-ink-2`:`text-muted`),children:i.name})]});return(0,Q.jsxs)(`li`,{"aria-current":o?`step`:void 0,className:H(`relative flex min-w-0 gap-2 @3xl:gap-4 @3xl:pb-8`,l&&`@3xl:pb-0`),children:[!l&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`absolute top-10 bottom-2 left-4 hidden w-px @3xl:block`,s?`bg-ink/30`:`bg-line`)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`relative inline-flex size-8 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums`,s?`bg-ink text-bg`:o?`border-2 border-ink bg-bg text-ink`:`border border-line bg-surface-strong text-muted`),children:s?(0,Q.jsx)(C,{size:16,strokeWidth:2.5}):a+1}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[c?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(a),"aria-label":i.name,className:`w-fit cursor-pointer rounded-[8px] border-0 bg-transparent p-0 text-left hover:underline`,children:u}):(0,Q.jsx)(`span`,{children:u}),(0,Q.jsx)(`span`,{className:H(`hidden text-[13px] leading-relaxed @3xl:block`,o?`text-ink-2`:`text-muted`),children:i.about}),i.answer&&(0,Q.jsx)(`span`,{className:`sr-only flex min-w-0 flex-col gap-1 text-[13px] text-ink @3xl:not-sr-only @3xl:mt-2 @3xl:border-l-2 @3xl:border-line @3xl:pl-2`,children:i.answer}),s&&a<t&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(a),"aria-label":`Change: ${i.name}`,className:`hidden min-h-8 w-fit cursor-pointer items-center border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline @3xl:inline-flex`,children:`Change`})]})]},i.name)})})})}function $({id:e,label:t,help:n,children:r}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function Cr({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,Q.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-bg py-4`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Q.jsxs)(K,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`}),`Back`]}),(0,Q.jsx)(K,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function wr({on:e,onPick:t,logo:n,title:r,sub:i,label:a,disabled:o}){return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-label":a,disabled:o,onClick:t,className:H(`relative flex min-h-[72px] min-w-0 cursor-pointer items-center gap-4 overflow-hidden rounded-[12px] border-0 px-4 py-4 text-left transition-[box-shadow] disabled:cursor-default disabled:opacity-50`,`bg-surface-strong`),children:[(0,Q.jsx)(`span`,{className:`inline-flex size-10 flex-none items-center justify-center [&>svg]:size-7`,children:n??(0,Q.jsx)(g,{"aria-hidden":`true`,strokeWidth:1.8,className:`text-ink-2`})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col pr-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-ink`,children:r}),i&&(0,Q.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:i})]}),e&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-2 bg-accent`})]})}function Tr({id:e,at:t,moved:n,children:r}){let i=br[t],a=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{let e=a.current;n&&e&&(e.getBoundingClientRect().top<0&&e.scrollIntoView({block:`start`,behavior:Oe()}),e.focus({preventScroll:!0}))},[t,n]),(0,Q.jsxs)(`h2`,{ref:a,id:e,tabIndex:-1,className:`m-0 flex scroll-mt-4 items-center gap-2 text-[20px] leading-tight font-semibold tracking-[-0.01em] outline-none`,children:[i&&(0,Q.jsx)(Be,{icon:i,size:18,className:`flex-none text-accent-fg`}),(0,Q.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:r})]})}var Er=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],Dr=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function Or({s:e}){let t=e.duplicates||0;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:`Test cases`,value:e.test_cases.length}),(0,Q.jsx)(Y,{label:`Modules`,value:e.pages.length}),(0,Q.jsx)(Y,{label:`Steps`,value:e.totals.steps}),(0,Q.jsx)(Y,{label:`Checks`,value:e.totals.asserts})]}),(e.suites.length>0||e.totals.unsupported>0||t>0)&&(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:[e.suites.length>0&&(0,Q.jsxs)(`li`,{children:[X(e.suites.length,`execution list`),`, kept as tags on the tests.`]}),e.totals.unsupported>0&&(0,Q.jsxs)(`li`,{className:`text-warn`,children:[e.totals.unsupported===1?`1 step value cannot`:`${e.totals.unsupported} step values cannot`,` be converted: each stays in its test as a marked comment for a person.`]}),t>0&&(0,Q.jsxs)(`li`,{children:[X(t,`test case`),` in more than one export, converted once.`]})]})]})}var kr=e=>`${e.workspace||``}\u0000${e.file}`;function Ar({busy:e,onClone:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``);return(0,Q.jsxs)(`form`,{className:`flex flex-col gap-4 rounded-[12px] card border px-4 py-4`,onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim(),i.trim(),o.trim())},children:[(0,Q.jsx)($,{id:`tsc-git-url`,label:`Repository`,help:`https:// or git@ address. A shallow copy is made under ForgeQE's home, with no hooks run; the project is not changed.`,children:(0,Q.jsx)(W,{inputMode:`url`,id:`tsc-git-url`,value:n,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/tosca-exports.git`,onChange:e=>r(e.target.value)})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`tsc-git-branch`,label:`Branch`,help:`The default branch when empty.`,children:(0,Q.jsx)(W,{id:`tsc-git-branch`,value:i,spellCheck:!1,maxLength:200,placeholder:`main`,onChange:e=>a(e.target.value)})}),(0,Q.jsx)($,{id:`tsc-git-token`,label:`Credential variable`,help:`For a private repository: the name of the variable that holds its token (saved in Settings), never the token.`,children:(0,Q.jsx)(W,{id:`tsc-git-token`,value:o,spellCheck:!1,maxLength:80,placeholder:`GITHUB_TOKEN`,onChange:e=>s(e.target.value)})})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(K,{type:`submit`,disabled:e||!n.trim(),children:e?`Cloning…`:`Clone it`})})]})}function jr(e,t){let n=e.exports.map(e=>({p:{file:e.path},bytes:e.bytes,from:`This project`})),r=e.clones.filter(e=>!t||`workspace`in t&&t.workspace===e.id).flatMap(e=>e.exports.map(t=>({p:{file:t.path,workspace:e.id},bytes:t.bytes,from:`${e.label.replace(/^.*\//,``).replace(/\.git$/,``)}${e.branch?` (${e.branch})`:``}`})));return t&&`workspace`in t?r:t?n:[...n,...r]}function Mr({view:e,onView:t,scope:r,rows:i,part:a,setPart:o,busy:s,read:c,readError:l,picked:u,setPicked:d,found:f,setFound:p,only:m,setOnly:h}){let[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(e.clones.length>0&&e.exports.length===0),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(``),E=l||w,ne=new Set(u.map(kr)),D=e=>{p(null),T(``),d(t=>t.some(t=>kr(t)===kr(e))?t.filter(t=>kr(t)!==kr(e)):[...t,e])},O=i.length>0&&i.every(e=>ne.has(kr(e.p))),k=async(e,n,r)=>{y(!0),T(``);try{t?.(await U.clone(e,n||void 0,r||void 0))}catch(e){T(e.message)}finally{y(!1)}},A=async e=>{T(``),C(``);try{t?.(await U.removeClone(e)),d(t=>t.filter(t=>t.workspace!==e)),p(null)}catch(e){T(e.message)}},j=e=>{let t=new Set(m);t.has(e)?t.delete(e):t.add(e),h(t)},M=e=>Jt(e),N=f?f.test_cases.filter(M):[],re=!r||`project`in r,ie=!r,P=E&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:E});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(a===`tsc-exports`||!f)&&!(r&&i.length===1)&&(0,Q.jsxs)(tt,{id:`tsc-exports`,level:3,icon:I,title:(0,Q.jsxs)(Q.Fragment,{children:[`Exports`,r?(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` in this source, `,i.length]}):null]}),children:[i.length>0?(0,Q.jsx)(`div`,{className:`@container`,children:(0,Q.jsx)(We,{label:`Tosca exports`,size:10,placeholder:`Find an export`,tools:(0,Q.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(ct,{checked:O,onCheckedChange:e=>{p(null),T(``),d(e?i.map(e=>e.p):[])}}),`Pick all `,i.length]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Export`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Folder`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`From`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Size`})]}),children:i.map(e=>{let t=kr(e.p),n=e.p.file.slice(e.p.file.lastIndexOf(`/`)+1);return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(ct,{"aria-label":`Pick ${e.p.file}${e.p.workspace?` of ${e.from}`:``}`,checked:ne.has(t),onCheckedChange:()=>D(e.p)})}),(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(I,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n})]})}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`hidden font-mono text-[13px] text-muted @xl:table-cell`),children:e.p.file.includes(`/`)?e.p.file.slice(0,e.p.file.lastIndexOf(`/`)):`.`}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`text-ink-2`),children:e.from}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:Dr(e.bytes)})]},t)})})}):(0,Q.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-4 text-sm text-ink-2`,children:[`No Tosca export (.tsu) `,r&&`workspace`in r?`in this source.`:`in this project yet.`,` Export the test cases from Tosca Commander and put the files inside the project, for example `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:`tosca/checkout.tsu`}),`, or pick another source above.`]}),u.length>0&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:u.length>1?`Their test cases become one plan; a module they share becomes one page object.`:`Tick more to convert several exports in one plan.`}),s&&!E&&(0,Q.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Q.jsxs)(`span`,{children:[`Reading `,u.length===1?`the export`:`${u.length} exports`,`…`]})}),P,re&&(0,Q.jsx)($,{id:`tsc-path`,label:`Add by its path`,help:`A .tsu, or a folder of them, inside the project. Secrets in an export stay encrypted: they become environment variables.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(W,{id:`tsc-path`,value:g,spellCheck:!1,maxLength:300,placeholder:`tosca/checkout.tsu or tosca/`,onChange:e=>_(e.target.value),className:`min-w-0 flex-[1_1_300px]`}),(0,Q.jsxs)(K,{disabled:s||!g.trim(),onClick:()=>void c([...u.filter(e=>kr(e)!==kr({file:g.trim()})),{file:g.trim()}],u),"data-tip":`Add the export at this path and read it`,children:[(0,Q.jsx)(ee,{"aria-hidden":`true`}),`Add`]})]})}),ie&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":b,onClick:()=>x(!b),className:`inline-flex min-h-8 cursor-pointer items-center gap-2 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,Q.jsx)(n,{size:15,"aria-hidden":`true`,className:H(`transition-transform`,b&&`rotate-180`)}),`From a git repository`,e.clones.length?` (${e.clones.length} cloned)`:``]}),b&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.clones.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.clones.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.label,(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:[e.branch?`Branch ${e.branch}`:``,e.commit?`commit ${e.commit}`:``,X(e.exports.length,`export`),`cloned ${new Date(e.createdAt).toLocaleDateString()}`].filter(Boolean).join(`, `)})]}),S===e.id?(0,Q.jsxs)(`span`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-ink-2`,children:[`Remove this copy? Plans made from it can no longer run.`,(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>void A(e.id),children:`Remove it`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>C(``),children:`Keep it`})]}):(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,"aria-label":`Remove the copy of ${e.label}`,onClick:()=>C(e.id),children:`Remove`})]},e.id))}),(0,Q.jsx)(Ar,{busy:v,onClone:(e,t,n)=>void k(e,t,n)})]})]})]}),s&&!E&&a!==`tsc-exports`&&(0,Q.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Q.jsx)(`span`,{children:`Reading…`})}),f&&(0,Q.jsxs)(tt,{id:`tsc-cases`,level:3,icon:te,title:(0,Q.jsxs)(Q.Fragment,{children:[`Test cases`,(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` `,`in `,u.length===1?(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:u[0].file.replace(/^.*\//,``)}):X(u.length,`export`)]})]}),actions:a!==`tsc-exports`&&!(r&&i.length===1)?(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>o(`tsc-exports`),children:`Change exports`}):void 0,children:[P&&a!==`tsc-exports`?P:null,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Or,{s:f}),f.coverage&&(0,Q.jsx)($n,{coverage:f.coverage,names:new Map(f.test_cases.map(e=>[e.id,e.name])),file:`${u.length===1?u[0].file.replace(/^.*\//,``).replace(/\.tsu$/i,``):`tosca-exports`}-coverage.csv`,folded:!0}),(0,Q.jsx)(`div`,{className:`@container`,children:(0,Q.jsx)(We,{label:`Test cases to convert`,placeholder:`Find a test case`,tools:(0,Q.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(ct,{checked:N.length>0&&N.every(e=>m.has(e.id)),onCheckedChange:e=>h(new Set(e?N.map(e=>e.id):[]))}),`Pick all `,N.length,` test cases ForgeQE can convert`]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Folder`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Checks`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`})]}),children:f.test_cases.map(e=>{let t=M(e);return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(ct,{"aria-label":`Pick ${e.name}`,disabled:!t,checked:t&&m.has(e.id),onCheckedChange:()=>j(e.id)})}),(0,Q.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,Q.jsx)(`span`,{className:H(`font-medium [overflow-wrap:anywhere]`,t?`text-ink`:`text-muted`),children:e.name}),(e.unsupported>0||e.suites.length>0)&&(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[e.unsupported?`${e.unsupported} not convertible`:``,e.unsupported&&e.suites.length?`, `:``,e.suites.length?`${e.unsupported?`in`:`In`} ${e.suites.join(`, `)}`:``]})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`hidden text-muted @2xl:table-cell [overflow-wrap:anywhere]`),children:e.folders.join(` / `)||`Top level`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.steps}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.asserts}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`whitespace-nowrap`),children:(0,Q.jsx)(Ne,{tone:t?`neutral`:`warn`,children:t?Xt(e):`${Ht[e.route]||e.route}: later`})})]},e.id)})})}),f.env.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Environment variables`}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[f.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`. Their values are never in the export; you set them before the tests run.`]})]})]})]})]})}function Nr({view:e,to:t,setTo:n,fw:r,setFw:i,into:a,setInto:o,attr:s,setAttr:c}){let l=e=>e.split(`-`)[0],u=e=>e.split(`-`).slice(1).join(`-`),d=[...new Map(e.targets.map(e=>[l(e.id),e.framework])).entries()],f=r||(t?l(t):``),p=e.targets.filter(e=>l(e.id)===f);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Framework`}),(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:d.map(([e,t])=>{let r=Dt[e];return(0,Q.jsx)(wr,{on:f===e,onPick:()=>{e!==f&&(i(e),n(``))},logo:r?(0,Q.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:t,sub:xr[e],label:t},e)})})]}),(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Language`}),!f&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick a framework first.`}),f&&!t&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick its language.`}),(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`pane-swap grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:p.map(e=>{let r=Et[u(e.id)];return(0,Q.jsx)(wr,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Q.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,label:e.language},e.id)})},f)]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,Q.jsx)(W,{id:`tsc-into`,value:a,spellCheck:!1,maxLength:300,placeholder:t?`tosca-${t}`:`Named after the target`,onChange:e=>o(e.target.value)})}),(0,Q.jsx)($,{id:`tsc-attr`,label:`Test id attribute (optional)`,help:`When the app's is not data-test-id, data-testid, data-test, data-cy or data-qa.`,children:(0,Q.jsx)(W,{id:`tsc-attr`,value:s,spellCheck:!1,maxLength:40,placeholder:`data-automation-id`,onChange:e=>c(e.target.value.replace(/[^A-Za-z0-9_-]/g,``))})})]})]})}function Pr({view:e,picked:t,found:n,only:r,to:i,into:a,plan:o,embedded:s}){let c=e.targets.find(e=>e.id===i),l=(e,t)=>(0,Q.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 [overflow-wrap:anywhere]`,children:t},e),u=t.map(e=>e.file.slice(e.file.lastIndexOf(`/`)+1));return[{name:s?`Select the source`:`Pick the exports`,short:`Source`,about:`Pick the Tosca exports, then the test cases to convert. Web and API test cases become code; the rest are listed.`,answer:t.length?[l(`e`,(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:u.length>2?`${u.slice(0,2).join(`, `)} and ${u.length-2} more`:u.join(`, `)})),n&&l(`c`,`${r.size} of ${n.test_cases.length} test cases`)]:void 0},{name:`Choose the target`,short:`Target`,about:`Pick the framework and language they become, and where the code goes. Add your own rules if you have any.`,answer:c?[l(`t`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(St,{framework:c.id.split(`-`)[0],language:c.id.split(`-`).slice(1).join(`-`),size:14}),c.title]})),l(`i`,(0,Q.jsx)(`span`,{className:`text-muted`,children:o?`Into ${o.target.dir}`:a.trim()?`Into ${a.trim()}`:`Into a new folder`}))]:void 0},{name:`Review and start`,short:`Review`,about:`See what converts, what cannot, and what the tests need. Start runs it in the background.`,answer:o?l(`v`,Wt[o.feasibility.verdict].label):void 0}]}function Fr({view:e,onView:t,review:n,onStart:r,from:a,embedded:o}){let[s,c]=(0,Z.useState)(0),[l,u]=(0,Z.useState)(0),[d,f]=(0,Z.useState)([]),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(new Set),[_,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(``),[ee,te]=(0,Z.useState)(``),[E,ne]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(!1),[N,re]=(0,Z.useState)(``),ie=o?.scope,P=jr(e,ie),[F,I]=(0,Z.useState)(`tsc-exports`),[ae,oe]=(0,Z.useState)(!1),[L,se]=(0,Z.useState)(``),R=async(e,t)=>{if(f(e),m(null),se(``),e.length){oe(!0);try{let t=await U.inspectSources(e);m(t),g(new Set(t.test_cases.filter(Jt).map(e=>e.id))),I(`tsc-cases`)}catch(e){t&&f(t),se(e.message)}finally{oe(!1)}}},ce=!a&&P.length===1?P[0].p:null;(0,Z.useEffect)(()=>{ce&&R([ce])},[ce&&kr(ce)]);let le=[...h].sort().join(`,`);(0,Z.useEffect)(()=>{ne(null),O(!1),u(e=>Math.min(e,1))},[d.map(kr).join(`|`),le,_,S,w,ee]);let[z,ue]=(0,Z.useState)(`next`),[de,pe]=(0,Z.useState)(!1),me=e=>{ue(e<s?`back`:`next`),c(e),pe(!0)},V=e=>{me(e),u(t=>Math.max(t,e)),re(``)},[ge,_e]=(0,Z.useState)(a?`filling`:``);(0,Z.useEffect)(()=>{if(!a)return;let e=!0;return(async()=>{M(!0);try{let t=(await Ee.view(a)).prefill;if(!t)throw Error(`The assistant does not have the exports and the target yet: go back to it, or pick them here.`);if(!e)return;f(t.sources),x(t.to.split(`-`)[0]),v(t.to),C(t.into??``),te(t.instructions??``);let n=await U.inspectSources(t.sources);if(!e)return;let r=n.test_cases.filter(Jt).map(e=>e.id);if(m(n),g(new Set(r)),!r.length)throw Error(`These exports hold no web or API test case to convert.`);let i=await U.plan({sources:t.sources,to:t.to,...t.into?{into:t.into}:{},...t.instructions?{instructions:t.instructions}:{}});(t.app||t.baseUrl)&&await U.answer(i.plan.id,t.app?{environment:t.app.environment,app:t.app.app}:{baseUrl:t.baseUrl}).catch(()=>{});for(let[e,n]of Object.entries(t.uses||{}))await U.answer(i.plan.id,{use:{name:e,secret:n}}).catch(()=>{});if((t.desktopApp||t.mobileApp||t.database)&&await U.answer(i.plan.id,{...t.desktopApp?{desktopApp:t.desktopApp}:{},...t.mobileApp?{mobileApp:t.mobileApp}:{},...t.database?{database:t.database}:{}}).catch(()=>{}),!e)return;ne(i),u(2),me(2),_e(`done`)}catch(t){if(!e)return;re(t.message),_e(``)}finally{e&&M(!1)}})(),()=>{e=!1}},[a]);let ve=async()=>{M(!0),re(``);try{let e=!p||p.test_cases.filter(Jt).every(e=>h.has(e.id)),t=await U.plan({sources:d,to:_,...S.trim()?{into:S.trim()}:{},...e?{}:{only:[...h]},...ee.trim()?{instructions:ee.trim()}:{},...w?{testAttributes:[w]}:{}});ne(t),V(2)}catch(e){let t=e.message;re(t);let n=S.trim().replace(/\\/g,`/`).replace(/(?<!\/)\/+$/,``);n&&t.includes(n)&&me(1)}finally{M(!1)}},ye=E?.plan,be=ye?.feasibility.findings.some(e=>e.level===`limit`),xe=ye?.feasibility.verdict===`blocked`,Se=[o?`Where are the tests?`:`Which Tosca exports?`,`What should the tests become?`,`Check the plan, then start`],Ce=Pr({view:e,picked:d,found:p,only:h,to:_,into:S,embedded:!!o,...ye?{plan:ye}:{}});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[a&&ge&&(0,Q.jsxs)(`p`,{role:`status`,className:`fade-quick m-0 flex flex-wrap items-center gap-x-4 gap-y-1 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-2 text-sm text-ink`,children:[(0,Q.jsx)(`span`,{className:`flex-1`,children:ge===`filling`?`Filling in every stage from your conversation with the assistant…`:`Filled in from your conversation with the assistant. Check each stage before you start.`}),(0,Q.jsx)(`a`,{href:B(`migration`,`guide`),className:`text-[13px]`,children:`Back to the assistant`})]}),(0,Q.jsxs)(`div`,{className:`mt-4 grid grid-cols-[minmax(0,1fr)] items-stretch gap-6 @3xl:grid-cols-[minmax(240px,280px)_minmax(0,1fr)] @3xl:gap-12`,children:[(0,Q.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,Q.jsx)(Sr,{steps:Ce,at:s,reached:l,onGo:e=>!j&&(e<2||E)&&me(e)})})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-step`,className:H(`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,z===`next`?`pane-next`:`pane-back`),children:[(0,Q.jsx)(Tr,{id:`tsc-step`,at:s,moved:de,children:Se[s]}),N&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:N}),s===0&&(0,Q.jsxs)(Q.Fragment,{children:[o?.source,(0,Q.jsx)(Mr,{view:e,onView:t,...ie?{scope:ie}:{},rows:P,part:F,setPart:I,busy:ae,read:R,readError:L,picked:d,setPicked:f,found:p,setFound:m,only:h,setOnly:g}),p?(0,Q.jsx)(Cr,{busy:j||ae,next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>V(1),disabled:!h.size,aside:h.size?void 0:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Pick at least one web or API test case.`})}):(0,Q.jsx)(Cr,{busy:j||ae,next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),ae?`Reading…`:d.length>1?`Read ${d.length} exports`:`Read the export`]}),onNext:()=>void R(d),disabled:!d.length,aside:d.length?void 0:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Tick one or more exports.`})})]}),s===1&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nr,{view:e,to:_,setTo:v,fw:b,setFw:x,into:S,setInto:C,attr:w,setAttr:T}),(0,Q.jsx)(lt,{title:ee.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!ee.trim(),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsx)($,{id:`tsc-instructions`,label:`Rules`,help:`Style and structure for the new code. Every Tosca step and check is kept either way.`,children:(0,Q.jsx)(Ae,{id:`tsc-instructions`,value:ee,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per Tosca module.`,onChange:e=>te(e.target.value)})}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Er.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:ee.includes(e),onClick:()=>te(ee.trim()?`${ee.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-surface-strong px-2 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Q.jsx)(i,{size:13,"aria-hidden":`true`}),e]},e))})]})}),(0,Q.jsx)(Cr,{busy:j,onBack:()=>me(0),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(fe,{"aria-hidden":`true`}),j?`Checking…`:`Check the plan`]}),onNext:()=>_?void ve():re(`Pick the framework and its language first.`),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),s===2&&ye&&(0,Q.jsxs)(Q.Fragment,{children:[n(ye,D,O,A),(0,Q.jsx)(Cr,{busy:j,onBack:()=>me(1),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]}),disabled:xe||!k||be&&!D,onNext:()=>r(E,!!be&&D),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:xe?`Change what is not possible first.`:k?be&&!D?`Accept the limits to start.`:`Runs in the background.`:`Answer what the tests need first.`})})]})]},s)]})]})}function Ir({planId:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let t=!0;return n(null),i(!1),U.estimate(e).then(e=>t&&n(e),()=>t&&i(!0)),()=>{t=!1}},[e]),r?(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not known`}):t?t.files.setup+t.files.pages+t.files.tests?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{children:[`About `,ut(t.tokens.mid),` tokens`,t.cost?`, about ${gt(t.cost.mid,t.cost.currency)}`:``,(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` `,`(`,ut(t.tokens.low),` to `,ut(t.tokens.high),t.cost?`, ${gt(t.cost.low,t.cost.currency)} to ${gt(t.cost.high,t.cost.currency)}`:``,`)`]})]}),(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[t.model&&t.model!==`none`?`With ${t.model}. `:`No model is set up for Bridge yet. `,t.basis.from===`history`?`From ${t.basis.files} files written by earlier conversions here.`:`From defaults: no conversion has run here yet.`,t.cost||!t.model||t.model===`none`?``:` No price is set for this model.`]})]}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`Nothing left to write`}):(0,Q.jsx)(`span`,{role:`status`,className:`text-muted`,children:`Working it out…`})}function Lr({plan:e,accepted:t,onAccept:n,onReady:r}){let[i,a]=(0,Z.useState)(null),s=(0,Z.useMemo)(()=>new Map(e.cases.map(e=>[e.id,e.name])),[e]),c=e.feasibility.findings.filter(e=>e.level===`blocker`),l=e.feasibility.findings.filter(e=>e.level===`limit`),u=e.cases.filter(e=>e.included),d=e.units.filter(e=>e.kind===`page`).length,f=u.filter(e=>e.workflow).length;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[c.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-blockers`,className:`flex flex-col gap-2 rounded-[14px] bg-fail-soft px-6 py-4`,children:[(0,Q.jsxs)(`h3`,{id:`tsc-blockers`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-fail`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-sm text-ink`,children:c.map(e=>(0,Q.jsx)(`li`,{children:e.text},e.code))})]}),l.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-limits`,className:`flex flex-col gap-4 rounded-[14px] bg-warn-soft px-6 py-4`,children:[(0,Q.jsxs)(`h3`,{id:`tsc-limits`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-warn`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-2 pl-6 text-sm text-ink`,children:l.map(e=>(0,Q.jsx)(`li`,{children:e.text},e.code))}),n&&!c.length&&(0,Q.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm font-medium`,children:[(0,Q.jsx)(ct,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,Q.jsx)(ar,{planId:e.id,onReady:r,onCoverage:a}),(0,Q.jsx)(tt,{id:`tsc-plan`,level:3,icon:re,title:`The plan`,children:(0,Q.jsxs)(`dl`,{className:`m-0 grid gap-x-8 text-sm @xl:grid-cols-[180px_minmax(0,1fr)] [&>dd]:border-b [&>dd]:border-line-soft [&>dd]:py-2 [&>dt]:@xl:border-b [&>dt]:border-line-soft [&>dt]:pt-2 [&>dt]:@xl:pb-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,Q.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[`Tricentis Tosca`,e.source.project?`, ${e.source.project}`:``,(0,Q.jsx)(`span`,{className:`block text-muted`,children:e.sources&&e.sources.length>1?`${e.sources.length} exports`:(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.source.file})}),e.sources&&e.sources.length>1&&(0,Q.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.sources.map((t,n)=>(0,Q.jsxs)(`li`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.label,(0,Q.jsx)(`span`,{className:`block font-sans text-muted`,children:(e=>e?X(e,`test case`):`its test cases are all in another export`)(e.cases.filter(e=>e.source===n).length)})]},n))})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,Q.jsx)(`span`,{className:`block font-mono text-[13px] text-muted`,children:e.target.dir})]}),e.previous&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Since`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[(0,Q.jsx)(`a`,{href:B(`migration`,e.previous.id),children:e.previous.id}),(0,Q.jsxs)(`span`,{className:`block text-muted`,children:[X(e.cases.filter(e=>e.change===`same`).length,`test case`),` unchanged (their tests kept), `,e.cases.filter(e=>e.change===`changed`).length,` changed, `,e.cases.filter(e=>e.change===`new`).length,` new, `,(e.removed||[]).length,` removed`]})]})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[u.length-f,` test`,u.length-f===1?``:`s`,f?`, ${f} desktop or mobile workflow${f===1?``:`s`}`:``,` of `,e.cases.length,` test case`,e.cases.length===1?``:`s`,`, `,d,` page object`,d===1?``:`s`]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Estimate`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:(0,Q.jsx)(Ir,{planId:e.id})}),(e.suites||[]).length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Suites`}),(0,Q.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.suites.map(e=>`${e.name} (${X(e.cases.length,`test`)})`).join(`, `),(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca's execution lists, as tags on the tests: `,e.suites.map(e=>`@${e.tag}`).join(`, `),`.`]})]})]}),e.env.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Environment variables`}),(0,Q.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Never in the export: you set them before the tests run.`})]})]}),e.instructions&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,Q.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]})}),i&&(0,Q.jsx)($n,{coverage:i,names:s,file:`tosca-${e.id}-coverage.csv`}),(0,Q.jsx)(lt,{title:`Test cases (${e.cases.length})`,children:(0,Q.jsx)(`div`,{className:`@container`,children:(0,Q.jsx)(We,{label:`Test cases of the plan`,placeholder:`Find a test case`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`In the plan`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(ft,`hidden @xl:table-cell`),children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(ft,`hidden @xl:table-cell`),children:`Checks`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Kind`})]}),children:e.cases.map(e=>{let t=e.change;return(0,Q.jsxs)(`tr`,{className:Qe,children:[(0,Q.jsx)(`td`,{className:H(J,`[overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,Q.jsxs)(`td`,{className:H(J,`text-ink-2`),children:[e.included?`Converted`:e.why?e.why[0].toUpperCase()+e.why.slice(1):`Left out`,t?(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:{same:`Unchanged: its test kept`,changed:`Changed in Tosca`,new:`New in Tosca`}[t]}):null]}),(0,Q.jsx)(`td`,{className:H(pt,`hidden @xl:table-cell`),children:e.steps}),(0,Q.jsx)(`td`,{className:H(pt,`hidden @xl:table-cell`),children:e.asserts}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap text-muted`),children:Ht[e.route]||e.route})]},e.id)})})})}),(0,Q.jsx)(lt,{title:`Files, in order (${e.units.length})`,children:(0,Q.jsx)(We,{label:`Files, in order`,placeholder:`Find a file`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`w-24`),children:`Kind`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`File`})]}),children:e.units.map(e=>(0,Q.jsxs)(`tr`,{className:Qe,children:[(0,Q.jsx)(`td`,{className:H(J,`text-muted`),children:Gt(e)}),(0,Q.jsx)(`td`,{className:H(J,`font-mono text-[13px] [overflow-wrap:anywhere]`),children:e.target})]},e.id))})})]})}function Rr({d:e,onStarted:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=e.plan.feasibility.findings.some(e=>e.level===`limit`),l=e.plan.feasibility.verdict===`blocked`,u=!!e.job?.running;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!u&&(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Q.jsx)(Lr,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r,onReady:a}),!l&&!u&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Q.jsxs)(K,{variant:`primary`,disabled:!i||!e.confirmed&&c&&!n,onClick:()=>s(!0),"data-tip":`Start the conversion`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]}),!i&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Answer what the tests need first.`})]}),o&&(0,Q.jsx)(sn,{plan:e.plan,acceptLimits:c&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}var zr=`tsc-\\d{8}-\\d{6}-[0-9a-f]{4}`;function Br(e){return!!(e&&(e===`guide`||/^new\/[a-f0-9]{16}$/.test(e)||RegExp(`^${zr}(?:/(?:steps|errors|activity)|/report(?:/[^/]+)?)?$`).test(e)))}function Vr({sub:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(cr),l=(0,Z.useCallback)(()=>{U.list().then(e=>{n(e),i(``)},e=>i(e.message))},[]);(0,Z.useEffect)(l,[l,e]);let u=e.match(RegExp(`^(${zr})/report(?:/([^/]+))?$`)),d=e.match(RegExp(`^(${zr})/(steps|errors|activity)$`)),f=RegExp(`^${zr}$`).test(e)?e:u?.[1]||d?.[1]||``,p;try{p=u?.[2]?ce(u[2]):void 0}catch{}let m=!t&&!r&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),h=e.match(/^new\/([a-f0-9]{16})$/)?.[1];return h?(0,Q.jsxs)(rn,{tab:`migrations`,back:{href:B(`migration`,`guide`),label:`Guide`},children:[(0,Q.jsx)(Yt,{error:r}),m,t&&(0,Q.jsx)(Fr,{view:t,onView:n,from:h,review:(e,t,n,r)=>(0,Q.jsx)(Lr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>o({d:e,accept:t})},h),a&&(0,Q.jsx)(sn,{plan:a.d.plan,acceptLimits:a.accept,onClose:()=>o(null),onStarted:e=>{o(null),location.hash=B(`migration`,e.plan.id)}})]}):f&&u?(0,Q.jsx)(rn,{tab:`migrations`,wide:!0,back:{href:B(`migration`,f),label:`Conversion`},children:(0,Q.jsx)(Yn,{id:f,caseId:p},f)}):f?(0,Q.jsxs)(rn,{tab:`migrations`,wide:!0,back:nn,children:[(0,Q.jsx)(Yt,{error:r}),m,t&&(0,Q.jsx)(In,{id:f,...d?{tab:d[2]}:{},plan:(e,t)=>(0,Q.jsx)(Rr,{d:e,onStarted:t})},f)]}):(0,Q.jsxs)(rn,{tab:`migrations`,back:{href:B(`migration`,`new`),label:`New migration`},children:[(0,Q.jsx)(Yt,{error:r}),m,t&&(0,Q.jsx)(pr,{view:t,sid:s,onSid:c})]})}var Hr={py:`python`,ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,java:`java`,cs:`csharp`,rb:`ruby`};function Ur({path:e}){let t=Et[Hr[e.split(`.`).pop()?.toLowerCase()||``]||``];return t?(0,Q.jsx)(t,{"aria-hidden":`true`,width:15,height:15,className:`flex-none`}):(0,Q.jsx)(xe,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`})}function Wr(e){let t={name:``,path:``,dirs:new Map,files:[]};for(let n of e){let e=n.path.split(`/`),r=t;for(let t of e.slice(0,-1))r.dirs.has(t)||r.dirs.set(t,{name:t,path:r.path?`${r.path}/${t}`:t,dirs:new Map,files:[]}),r=r.dirs.get(t);r.files.push(n)}let n=e=>{for(let[t,r]of[...e.dirs]){let i=n(r);for(;i.files.length===0&&i.dirs.size===1;){let e=[...i.dirs.values()][0];i={...e,name:`${i.name}/${e.name}`}}e.dirs.set(t,i)}return e};return n(t)}function Gr({files:e,selected:t,onSelect:n,label:i}){let a=(0,Z.useMemo)(()=>Wr(e),[e]),[o,c]=(0,Z.useState)(new Set),l=e=>c(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e])),u=(e,i)=>(0,Q.jsxs)(Q.Fragment,{children:[[...e.dirs.values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>{let t=!o.has(e.path);return(0,Q.jsxs)(`li`,{role:`treeitem`,"aria-expanded":t,"aria-selected":!1,className:`list-none`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:`flex h-8 w-full cursor-pointer items-center gap-2 rounded-[6px] border-0 bg-transparent px-2 text-left text-[13px] text-ink hover:bg-surface-strong`,children:[(0,Q.jsx)(x,{size:14,"aria-hidden":`true`,className:H(`flex-none text-muted transition-transform duration-150`,t&&`rotate-90`)}),t?(0,Q.jsx)(r,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}):(0,Q.jsx)(s,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]}),t&&(0,Q.jsx)(`ul`,{role:`group`,className:`m-0 ml-4 border-l border-line-soft p-0 pl-2`,children:u(e,i+1)})]},e.path)}),[...e.files].sort((e,t)=>e.path.localeCompare(t.path)).map(e=>{let r=t===e.id;return(0,Q.jsx)(`li`,{role:`treeitem`,"aria-selected":r,className:`list-none`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n?.(e.id),"data-tip":e.title,className:H(`flex h-8 w-full items-center gap-2 rounded-[6px] border-0 px-2 text-left text-[13px]`,n?`cursor-pointer`:`cursor-default`,r?`bg-accent-soft font-medium text-ink`:`bg-transparent text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,Q.jsx)(`span`,{className:`w-[14px] flex-none`,"aria-hidden":`true`}),(0,Q.jsx)(Ur,{path:e.path}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path.slice(e.path.lastIndexOf(`/`)+1)}),e.tail]})},e.id)})]});return(0,Q.jsx)(`ul`,{role:`tree`,"aria-label":i,className:`m-0 flex flex-col p-0`,children:u(a,0)})}function Kr(e){let t={name:``,path:``,dirs:new Map};for(let n of e){let e=t;for(let t of n.split(`/`).filter(Boolean))e.dirs.has(t)||e.dirs.set(t,{name:t,path:e.path?`${e.path}/${t}`:t,dirs:new Map}),e=e.dirs.get(t)}return t}function qr({folders:e,value:t,onChange:n,label:i}){let a=(0,Z.useMemo)(()=>Kr(e),[e]),[o,c]=(0,Z.useState)(()=>new Set(t.flatMap(e=>e.split(`/`).slice(0,-1).map((e,t,n)=>n.slice(0,t+1).join(`/`))))),l=e=>c(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e])),u=e=>t.find(t=>t!==e&&e.startsWith(`${t}/`)),d=(e,r)=>n(r?[...t.filter(t=>!t.startsWith(`${e}/`)),e]:t.filter(t=>t!==e)),f=(e,n)=>{let i=e.dirs.size>0,a=o.has(e.path),c=u(e.path),f=!!c||t.includes(e.path);return(0,Q.jsxs)(`div`,{className:H(`flex h-10 items-center gap-2 rounded-[8px] pr-2`,f?`bg-surface-strong`:`hover:bg-surface-muted`),style:{paddingLeft:`${n*20}px`},children:[i?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>l(e.path),"aria-label":`${a?`Close`:`Open`} ${e.name}`,"aria-expanded":a,className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-[6px] border-0 bg-transparent text-muted hover:text-ink`,children:(0,Q.jsx)(x,{size:14,"aria-hidden":`true`,className:H(`transition-transform duration-200`,a&&`rotate-90`)})}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`w-8 flex-none`}),(0,Q.jsxs)(`label`,{className:H(`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,c?`cursor-default text-muted`:`cursor-pointer text-ink`),"data-tip":c?`In ${c}, ticked`:void 0,children:[(0,Q.jsx)(ct,{checked:f,disabled:!!c,onCheckedChange:t=>d(e.path,t===!0),"aria-label":e.path}),i&&a?(0,Q.jsx)(r,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}):(0,Q.jsx)(s,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.name})]})]})},p=(e,n)=>[...e.dirs.values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,Q.jsxs)(`li`,{role:`treeitem`,"aria-expanded":e.dirs.size?o.has(e.path):void 0,"aria-selected":t.includes(e.path),className:`list-none`,children:[f(e,n),e.dirs.size>0&&(0,Q.jsx)(Ke,{open:o.has(e.path),id:`ft-${e.path}`,children:(0,Q.jsx)(`ul`,{role:`group`,className:`m-0 p-0`,children:p(e,n+1)})})]},e.path));return(0,Q.jsx)(`ul`,{role:`tree`,"aria-label":i,"aria-multiselectable":`true`,className:`m-0 p-0`,children:p(a,0)})}function Jr({title:e,side:t,file:n,lang:r,text:i,missing:a}){let o=(i??``).split(`
|
|
8
|
-
`),s=Ge(i||null,r);return(0,Q.jsxs)(`figure`,{className:`m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Q.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-semibold text-ink`,children:t}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink-2`,"data-tip":n,children:n||e}),i&&(0,Q.jsx)(ot,{text:i,label:`Copy ${n||t}`})]}),i?(0,Q.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[13px] leading-[1.6]`,children:[(0,Q.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft px-4 py-4 text-right text-muted select-none`,children:o.map((e,t)=>`${t+1}\n`).join(``)}),(0,Q.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-4 py-4`,children:(0,Q.jsx)(`code`,{className:`hljs`,children:s})})]}):(0,Q.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:a||`Nothing to show.`})]})}function Yr({id:e,plan:t,result:n,initial:r}){let i=new Map((n?.units||[]).map(e=>[e.id,e.status])),a=[...t.units.filter(e=>e.kind!==`setup`).map(e=>({unit:e.id,kind:Nt[e.kind],source:e.source,target:e.target,status:i.get(e.id)})),...t.copies.map((e,t)=>({unit:`c${t}`,kind:`Data`,source:e.source,target:e.target,data:!0}))],[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(r||a.find(e=>e.kind===`Test`)?.unit||a[0]?.unit||``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{c&&(p(``),G.pair(e,c).then(d,e=>p(e.message)))},[e,c,n?.units.length,n?.endedAt]);let m=a.filter(e=>!o||`${e.source} ${e.target}`.toLowerCase().includes(o.toLowerCase())),h=a.filter(e=>e.status===`migrated`).length,g=a.filter(e=>e.status===`failed`||e.status===`blocked`).length;return(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-4 @4xl:h-[calc(var(--screen)-320px)] @4xl:min-h-[540px] @4xl:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`nav`,{"aria-label":`Files`,className:`flex max-h-[360px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-4 @4xl:max-h-none`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 px-1`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-semibold`,children:`Files`}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[h,` migrated, `,g,` failed, of `,a.length,` files`]})]}),(0,Q.jsx)(Re,{id:`find-a-file`,label:`Find a file`,value:o,onChange:s,className:`max-w-none flex-none`}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m.length?(0,Q.jsx)(Gr,{label:`Files`,selected:c,onSelect:l,files:m.map(e=>({id:e.unit,path:e.target,title:e.source?`from ${e.source}`:void 0,tail:(0,Q.jsx)(`span`,{role:`img`,"aria-label":e.status?Ct[e.status].label:e.data?`Copied`:`Waiting`,className:H(`size-2 flex-none rounded-full`,e.status===`migrated`?`bg-pass`:e.status===`failed`?`bg-fail`:e.status===`blocked`?`bg-warn`:e.status===`written`?`bg-line-strong`:`bg-line`)})}))}):(0,Q.jsx)(`p`,{className:`m-0 px-2 py-4 text-[13px] text-muted`,children:`No file matches.`})})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[f&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:f}),(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-4 @3xl:grid-cols-2`,children:[(0,Q.jsx)(Jr,{title:`Source`,side:`Source`,file:u?.source?.path,lang:u?.source?.lang||`plaintext`,text:u?.source?.text,missing:u&&!u.source?`This file is made new for the target.`:void 0}),(0,Q.jsx)(Jr,{title:`Target`,side:`Migrated`,file:u?.target.path,lang:u?.target.lang||`plaintext`,text:u?.target.text,missing:u&&!u.target.exists?`Not written yet.`:void 0})]})]})]})}var Xr=[`prepare`,`setup`,`migrate`,`validate`,`fix`,`review`];function Zr(e){if(e.job?.running)return{label:e.job.kind===`verify`?`Validating`:e.job.kind===`fix`?`Fixing`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:t.stage===`fix`?`Fixing`:`Running`,tone:`running`}:t?xt[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ot[e.plan.feasibility.verdict]}var Qr=e=>e.slice(e.lastIndexOf(`/`)+1);function $r({id:e,title:t,targetDir:n,onClose:r}){let[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),d=async()=>{c(!0),u(``);try{await G.delete(e,i),location.hash=B(`migration`,`migrations`)}catch(e){u(e.message),c(!1)}};return(0,Q.jsx)(Je,{open:!0,onClose:r,title:`Delete this migration`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),`Keep`]}),(0,Q.jsxs)(K,{variant:`danger`,disabled:s||i!==e,onClick:()=>void d(),children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Q.jsx)(W,{value:i,onChange:e=>o(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function ei({d:e,planView:t}){let n=e.result;if(!n)return(0,Q.jsx)(Q.Fragment,{children:t});let r=new Map(n.units.map(e=>[e.id,e])),i=e.plan.units.filter(e=>e.kind===`test`),a=n.units.filter(e=>e.kind===`test`&&e.status===`migrated`).length,o=e.plan.units.filter(e=>e.kind!==`setup`),s=n.units.filter(e=>e.kind!==`setup`&&(e.status===`migrated`||e.status===`written`)).length,c=n.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,l=e.plan.source.stack,[u,...d]=e.plan.target.id.split(`-`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:`Tests passing`,value:`${a} / ${i.length}`,tone:a===i.length&&i.length?`text-pass`:void 0}),(0,Q.jsx)(Y,{label:`Files migrated`,value:`${s} / ${o.length}`}),(0,Q.jsx)(Y,{label:`Need attention`,value:c,tone:c?`text-fail`:void 0}),(0,Q.jsx)(Y,{label:n.status===`running`?`Running for`:`Took`,value:Tt(n.status===`running`?Date.now()-Date.parse(n.startedAt):n.ms)})]}),n.notes&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n.notes}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Q.jsx)(We,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @3xl:table-cell`),children:`Note`})]}),children:e.plan.units.map(e=>{let t=r.get(e.id),n=t?Ct[t.status]:null;return(0,Q.jsxs)(`tr`,{className:Qe,children:[(0,Q.jsxs)(`td`,{className:J,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.kind===`setup`?`Project set-up`:Qr(e.target)}),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:e.source?`from ${Qr(e.source)}`:e.target})]}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap`),children:n?(0,Q.jsx)(Ne,{tone:n.tone,children:n.label}):(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`})}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:t?.problems?.[0]||t?.reason||``})})]},e.id)})}),(0,Q.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-6 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`From`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[l&&(0,Q.jsx)(St,{framework:l.framework,language:l.language}),e.plan.source.title]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-ink-2`,children:[(0,Q.jsx)(zt,{kind:e.origin.kind,label:e.origin.label,size:15}),(0,Q.jsxs)(`span`,{className:`truncate`,"data-tip":e.origin.label,children:[Mt(e.origin.label),e.origin.branch?`, branch ${e.origin.branch}`:``]})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`To`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Q.jsx)(St,{framework:u,language:d.join(`-`)}),e.plan.target.title]}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Q.jsx)(`dd`,{className:`m-0 text-right`,children:kt(n.startedAt)}),n.model&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Q.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":n.model,children:n.model})]}),n.reverted.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-right`,children:[n.reverted.length,` edits outside the target`]})]})]})]})]})]})}function ti({d:e,events:n,picked:r,setPicked:i,busy:a,working:o,onFix:s,onCheck:c}){let[l,u]=(0,Z.useState)(``),d=(0,Z.useRef)(null),f=e.result?.validation?.tests||[],p=f.filter(e=>!e.ok),m=[];for(let t of e.result?.fixes||[])t.auto||m.push({who:`you`,text:t.note?`${t.note}`:`Fix ${Qr(t.target)}`,at:t.at,detail:t.note?`for ${Qr(t.target)}`:void 0}),m.push({who:`agent`,tone:t.ok?`ok`:`fail`,at:t.at,text:t.ok?`${Qr(t.target)} passes now${t.attempts>1?` (${t.attempts} tries)`:``}. ${t.reason||``}`.trim():`I could not make ${Qr(t.target)} pass. ${t.problems?.[0]||t.reason||``}`.trim(),detail:t.auto?`after the first check`:void 0});let h=o?n.filter(e=>e.stage===`fix`&&(e.kind===`agent`||e.kind===`ok`||e.kind===`fail`||e.kind===`info`)).slice(-6):[];(0,Z.useEffect)(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[m.length,h.length]);let g=()=>{let e=[...r];e.length&&(s(e,l.trim()),u(``))},_=e=>{let t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(t)};return(0,Q.jsxs)(`section`,{"aria-label":`Mover`,className:`flex h-[560px] min-h-0 min-w-0 flex-col overflow-hidden rounded-[14px] card border @5xl:h-full`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center gap-4 border-b border-line-soft px-4 py-4`,children:[(0,Q.jsx)(Ve,{agent:`forgeqe-migrate`,px:28,working:o,decorative:!0}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-semibold`,children:`Mover`}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:o?`Working on it…`:p.length?`${p.length} test${p.length===1?``:`s`} to fix`:`Every test passes`})]}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,disabled:a,onClick:c,"data-tip":`Run every migrated test again`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Run`]})]}),(0,Q.jsxs)(`ol`,{ref:d,"aria-live":`polite`,className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-4 overflow-y-auto bg-surface-muted p-4`,children:[!m.length&&!h.length&&(0,Q.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[12px] bg-bg p-4 text-[13px] text-ink-2`,children:[(0,Q.jsx)(`span`,{children:`I fix migrated tests that fail. Pick the tests below and tell me what you know, or just send.`}),p.length>0&&(0,Q.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>s(p.map(e=>e.id),``),"data-tip":`Fix all failing tests`,className:`inline-flex items-center gap-2 self-start rounded-[8px] border-0 bg-surface-strong px-2 py-2 text-[13px] font-medium text-ink hover:bg-line disabled:opacity-50`,children:[(0,Q.jsx)(D,{size:14,"aria-hidden":`true`}),`Fix all`]})]}),m.map((e,t)=>(0,Q.jsxs)(`li`,{className:H(`flex max-w-[92%] flex-col gap-1`,e.who===`you`?`self-end items-end`:`self-start`),children:[(0,Q.jsxs)(`span`,{className:H(`rounded-[12px] px-4 py-2 text-[13px] leading-relaxed [overflow-wrap:anywhere]`,e.who===`you`?`bg-accent text-accent-ink`:e.tone===`fail`?`border border-fail-soft bg-bg text-ink`:`bg-bg text-ink`),children:[e.who===`agent`&&(0,Q.jsx)(`span`,{className:H(`mr-1 font-semibold`,e.tone===`ok`?`text-pass`:`text-fail`),children:e.tone===`ok`?`✓`:`✗`}),e.text]}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.detail?`${e.detail}, `:``,at(e.at)]})]},t)),h.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex max-w-[92%] items-start gap-2 self-start rounded-[12px] bg-bg px-4 py-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`flex-none`,e.kind===`ok`?`text-pass`:e.kind===`fail`?`text-fail`:`text-muted`),children:e.kind===`ok`?`✓`:e.kind===`fail`?`✗`:`•`}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text})]},`live-${t}`))]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft p-4`,children:[f.length>0&&(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Tests to fix`,className:`flex flex-wrap gap-2`,children:f.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":r.has(e.id),onClick:()=>_(e.id),className:H(`inline-flex min-h-7 items-center gap-2 rounded-full border px-2 text-[13px]`,r.has(e.id)?`border-accent bg-accent-soft text-ink`:`border-line-soft bg-bg text-ink-2 hover:bg-surface-muted`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-1.5 rounded-full`,e.ok?`bg-pass`:`bg-fail`)}),Qr(e.target)]},e.id))}),(0,Q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Q.jsx)(Ae,{"aria-label":`Message to the agent`,value:l,rows:2,maxLength:2e3,placeholder:r.size?`What should change? (optional)`:`Pick a test above first`,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!a&&r.size&&(e.preventDefault(),Ue(e)||g())},className:`min-h-[44px] flex-1 resize-none`}),(0,Q.jsx)(K,{variant:`primary`,size:`icon`,"aria-label":`Send to the agent`,"data-tip":`Send to the agent`,disabled:a||!r.size,onClick:g,children:(0,Q.jsx)(t,{"aria-hidden":`true`})})]})]})]})}var ni=`@5xl:h-[calc(var(--screen)-320px)] @5xl:min-h-[540px]`;function ri({d:e,events:t,busy:n,working:r,onFix:i,onCheck:a,onCompare:o}){let s=e.result?.validation?.tests||[],c=e.result?.fixes||[],l=s.filter(e=>!e.ok).map(e=>e.id).join(`,`),[u,d]=(0,Z.useState)(()=>s.find(e=>!e.ok)?.id||s[0]?.id||``),[f,p]=(0,Z.useState)(()=>new Set(s.filter(e=>!e.ok).map(e=>e.id)));(0,Z.useEffect)(()=>p(new Set(l?l.split(`,`):[])),[l]);let m=s.find(e=>e.id===u),h=m&&c.findLast(e=>e.id===m.id);return s.length?(0,Q.jsxs)(`div`,{className:H(`grid grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,1fr)_380px]`,ni),children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(We,{label:`Migrated tests`,placeholder:`Find a test`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`th`,{scope:`col`,className:q,children:[`Test `,(0,Q.jsxs)(`span`,{className:`font-normal`,children:[`· `,s.filter(e=>e.ok).length,` of `,s.length,` pass`]})]}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Result`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @2xl:table-cell`),children:`Kept from the source`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(ft,`hidden @3xl:table-cell`),children:`Time`})]}),children:s.map(e=>{let t=c.findLast(t=>t.id===e.id);return(0,Q.jsxs)(`tr`,{onClick:()=>d(e.id),"aria-selected":u===e.id,className:H(`cursor-pointer border-t border-line-soft`,u===e.id?`bg-accent-soft`:`hover:bg-surface-muted`),children:[(0,Q.jsxs)(`td`,{className:J,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>d(e.id),className:`cursor-pointer border-0 bg-transparent p-0 text-left font-medium text-ink`,children:Qr(e.target)}),t&&(0,Q.jsx)(`span`,{className:H(`block text-[13px]`,t.ok?`text-pass`:`text-muted`),children:t.ok?`Fixed by the agent`:`The agent could not fix it`})]}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap`),children:(0,Q.jsx)(Ne,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})}),(0,Q.jsxs)(`td`,{className:H(J,`hidden text-[13px] whitespace-nowrap text-ink-2 @2xl:table-cell`),children:[(0,Q.jsxs)(`span`,{className:e.after.tests<e.before.tests?`text-fail`:void 0,children:[e.after.tests,`/`,e.before.tests,` tests`]}),`, `,(0,Q.jsxs)(`span`,{className:e.after.assertions<e.before.assertions?`text-warn`:void 0,children:[e.after.assertions,`/`,e.before.assertions,` checks`]})]}),(0,Q.jsx)(`td`,{className:H(pt,`hidden text-[13px] text-muted @3xl:table-cell`),children:e.ms?Tt(e.ms):`Not timed`})]},e.id)})}),m&&(0,Q.jsxs)(`section`,{"aria-label":`${Qr(m.target)} details`,className:`flex min-h-[260px] flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:Qr(m.target)}),(0,Q.jsx)(Ne,{tone:m.ok?`pass`:`fail`,children:m.ok?`Passes`:m.exitCode===null&&m.ms?`Timed out`:`Fails`}),m.source&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`from `,Qr(m.source)]}),(0,Q.jsx)(`span`,{className:`flex-1`}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>o(m.id),children:[(0,Q.jsx)(j,{"aria-hidden":`true`}),`Compare`]}),!m.ok&&(0,Q.jsxs)(K,{size:`sm`,disabled:n,onClick:()=>p(new Set([m.id])),children:[(0,Q.jsx)(D,{"aria-hidden":`true`}),`Fix`]})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-auto bg-surface-muted px-4 py-4`,children:[m.problems.length>0&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:m.problems.join(` `)}),h&&(0,Q.jsxs)(`p`,{className:H(`m-0 text-[13px]`,h.ok?`text-pass`:`text-ink-2`),children:[h.ok?`Fixed by the agent`:`The agent could not fix it`,h.reason?`: ${h.reason}`:`.`]}),m.command&&(0,Q.jsxs)(`code`,{className:`block font-mono text-[13px] text-muted`,children:[`$ `,m.command]}),(0,Q.jsx)(`pre`,{className:`m-0 flex-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:m.output||(m.ok?`${m.after.tests} test${m.after.tests===1?``:`s`} passed in ${Tt(m.ms)}.`:`No output.`)})]})]})]}),(0,Q.jsx)(ti,{d:e,events:t,picked:f,setPicked:p,busy:n,working:r,onFix:i,onCheck:a})]}):(0,Q.jsx)(Fe,{center:!0,className:`py-6`,children:e.result?`The tests are checked once every file is migrated.`:`Start the migration first.`})}var ii={ok:{mark:`✓`,cls:`text-pass`},fail:{mark:`✗`,cls:`text-fail`},info:{mark:`•`,cls:`text-muted`},agent:{mark:`•`,cls:`text-accent-fg`},tool:{mark:`·`,cls:`text-muted`}};function ai({events:e,running:t}){let n=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,t]);let r=e.filter(e=>e.kind!==`tool`);return(0,Q.jsxs)(`ol`,{ref:n,"aria-live":t?`polite`:void 0,"aria-label":`Activity`,className:`m-0 flex max-h-[60vh] list-none flex-col overflow-y-auto rounded-[12px] card border p-0`,children:[r.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 text-[13px] last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:`w-[64px] flex-none text-[13px] text-muted tabular-nums`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`w-3 flex-none text-center`,ii[e.kind].cls),children:ii[e.kind].mark}),(0,Q.jsx)(`span`,{className:H(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:`text-ink-2`),children:e.text})]},t)),!r.length&&(0,Q.jsx)(`li`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`Nothing yet.`})]})}function oi({id:e,plan:t}){let[n,r]=(0,Z.useState)(null),[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(`overview`),[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)([]),[p,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),[v,b]=(0,Z.useState)(!1),x=(0,Z.useRef)(0),S=(0,Z.useCallback)(()=>{G.detail(e).then(e=>{r(e),o(``)},e=>o(e.message)),G.events(e,x.current).then(e=>{e.next<x.current?(x.current=0,f([])):(x.current=e.next,e.events.length&&f(t=>[...t,...e.events].slice(-2e3)))},()=>{})},[e]);(0,Z.useEffect)(S,[S]);let C=!!(n?.job?.running||n?.result?.status===`running`);(0,Z.useEffect)(()=>{if(!C)return;let e=Xe(S,1500);return()=>Ye(e)},[C,S]);let w=async e=>{_(!0),o(``);try{r(await e()),setTimeout(S,800)}catch(e){o(e.message)}finally{_(!1)}};if(!n)return i?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let T=Zr(n),ee=wt(n.plan,n.result),E=n.result,ne=(E?.validation?.tests||[]).filter(e=>!e.ok).length,D=[{id:`overview`,label:`Overview`,icon:me},{id:`tests`,label:`Tests`,icon:te,n:E?.validation?`${E.validation.tests.length-ne}/${E.validation.tests.length}`:void 0,tone:ne?`text-fail`:void 0},{id:`compare`,label:`Compare`,icon:j},{id:`activity`,label:`Activity`,icon:k}];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[n.plan.source.stack&&(0,Q.jsx)(St,{framework:n.plan.source.stack.framework,language:n.plan.source.stack.language,size:22}),n.plan.source.title]}),(0,Q.jsx)(he,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(St,{framework:n.plan.target.id.split(`-`)[0],language:n.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),n.plan.target.title]})]}),(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm text-muted`,children:[(0,Q.jsx)(zt,{kind:n.origin.kind,label:n.origin.label,size:15}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:Mt(n.origin.label)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsxs)(`span`,{children:[`into `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:n.plan.target.dir})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Ne,{tone:T.tone,children:T.label}),C?(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:g,onClick:()=>void w(()=>G.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the migration`,className:`text-fail hover:text-fail`,children:(0,Q.jsx)(se,{fill:`currentColor`,"aria-hidden":`true`})}):(0,Q.jsxs)(Q.Fragment,{children:[E?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`icon`,size:`icon`,onClick:()=>G.report(e).then(e=>h(e.text),()=>h(``)),"aria-label":`Report`,"data-tip":`Report`,children:(0,Q.jsx)(P,{"aria-hidden":`true`})}),(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:g,onClick:()=>void w(()=>G.verify(e)),"aria-label":`Run the tests`,"data-tip":`Check again: run every migrated test again`,children:(0,Q.jsx)(y,{"aria-hidden":`true`})})]}):null,(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:g,onClick:()=>b(!0),"aria-label":`Delete`,"data-tip":`Delete: remove this plan from the list; converted tests stay`,children:(0,Q.jsx)(a,{"aria-hidden":`true`})})]})]})]}),v&&(0,Q.jsx)($r,{id:e,title:`${n.plan.source.title} → ${n.plan.target.title}`,targetDir:n.plan.target.dir,onClose:()=>b(!1)}),(0,Q.jsxs)(`div`,{className:H(`grid grid-cols-[minmax(0,1fr)] items-start gap-6`,E&&`@3xl:grid-cols-[minmax(220px,260px)_minmax(0,1fr)] @3xl:gap-10`),children:[E&&(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6 @3xl:border-r @3xl:border-line-soft @3xl:pr-8 @3xl:pb-8`,children:(0,Q.jsx)(jt,{label:`Migration stages`,items:It(Xr,E.stages),...C?{progress:ee}:{}})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[i&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),(0,Q.jsx)(Ze,{prefix:`mtab`,className:`mb-0`,tabs:D,current:s,onPick:c,label:`Migration`}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${s}`,"aria-labelledby":`mtab-${s}`,className:`flex min-w-0 flex-col gap-4`,children:[s===`overview`&&(0,Q.jsx)(ei,{d:n,planView:t(n)}),s===`tests`&&(0,Q.jsx)(ri,{d:n,events:d,busy:g||C,working:C,onFix:(t,n)=>void w(()=>G.fix(e,t,n)),onCheck:()=>void w(()=>G.verify(e)),onCompare:e=>(u(e),c(`compare`))}),s===`compare`&&(0,Q.jsx)(Yr,{id:e,plan:n.plan,result:E,initial:l}),s===`activity`&&(0,Q.jsx)(ai,{events:d,running:C})]})]})]}),(0,Q.jsx)(Je,{open:p!==null,onClose:()=>h(null),wide:!0,title:`Report`,description:`migrate.md for ${n.plan.id}`,footer:(0,Q.jsxs)(K,{onClick:()=>h(null),children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Close`]}),children:p?(0,Q.jsx)(rt,{text:p}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report yet.`})})]})}var si=e=>/^[A-Za-z0-9_.-]+(\/[A-Za-z0-9_.-]+)*$/.test(e)&&!e.split(`/`).some(e=>e===`..`||e===`.`);function ci(e){let t=[...new Set(e.map(e=>e.replace(/\/+$/,``)).filter(si))].sort();return t.filter(e=>!t.some(t=>t!==e&&e.startsWith(`${t}/`)))}function li(e,t=``){let n=ci(e),r=t.trim().replace(/^\/+/,``);return n.length===0?{from:`.`,...r?{only:r}:{}}:{from:`.`,only:`${n.length===1?n[0]:`{${n.join(`,`)}}`}/${r||`**`}`}}var ui=[{id:`git`,label:`Git`,sub:`Clone a repository`},{id:`folder`,label:`Folder`,sub:`On this computer`},{id:`upload`,label:`Upload`,sub:`A folder or files`},{id:`paste`,label:`Paste`,sub:`A few test files`},{id:`project`,label:`This project`,sub:`Tests already here`}],di=[`Keep one page object per page, in pages/.`,`Read the base URL from BASE_URL.`,`Keep test names as they are.`];async function fi(e,t,n){let r=[],i=0,a=null,o=0,s=async()=>{r.length&&(a=await G.files(e,r),o+=r.length,n(o),r=[],i=0)};for(let e of t){let t=e.webkitRelativePath||``,n=t&&t.split(`/`).slice(1).join(`/`)||e.name,a=new Uint8Array(await e.arrayBuffer()),o=``;for(let e=0;e<a.length;e+=32768)o+=String.fromCharCode(...a.subarray(e,e+32768));let c=btoa(o);i+c.length>8388608&&await s(),r.push({path:n,data:c}),i+=c.length}return await s(),a}var pi=e=>(e.webkitRelativePath||e.name).split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`);function mi({view:e,kind:t,setKind:n,src:o,setSrc:s,from:c,setFrom:l,folders:u,setFolders:d,stack:f,setStack:p,custom:h,setCustom:_,found:v,setFound:y,tosca:b,onNext:x}){let[S,w]=(0,Z.useState)(``),[te,E]=(0,Z.useState)(``),[ne,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(e.credentials),[M,N]=(0,Z.useState)(null),[re,ie]=(0,Z.useState)(``),[P,F]=(0,Z.useState)([{path:``,text:``}]),[I,ae]=(0,Z.useState)(``),[oe,L]=(0,Z.useState)(``),[se,R]=(0,Z.useState)(``),ce=(0,Z.useRef)(null),le=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{ce.current?.setAttribute(`webkitdirectory`,``)},[t,o]);let z=o?.workspace,ue=async(e,t)=>{ae(e),L(``),R(``);try{await t()}catch(e){L(e.message)}finally{ae(``)}},de=e=>{s(e),l(`.`),y(e.discovery),x&&!e.tosca?.length&&e.discovery?.stack&&x()};(0,Z.useEffect)(()=>{if(t!==`project`)return;let e=setTimeout(()=>G.discover(void 0,c||`.`).then(y,()=>y(null)),300);return()=>clearTimeout(e)},[t,c,y]);let fe=e=>{let t=e.filter(e=>!pi(e));if(!t.length)return L(`Nothing to send: every file is hidden or a dependency.`);ue(`upload`,async()=>{let n=e[0],r=await G.source({kind:`upload`,label:n?.webkitRelativePath?n.webkitRelativePath.split(`/`)[0]:t.length===1?t[0].name:`${t.length} files`});await fi(r.workspace.id,t,e=>R(`Sending ${e} of ${t.length} files…`)),de(await G.finish(r.workspace.id))})},me=t===`project`||!!z?.ready,V=()=>{if(!I){if(L(``),me)return f===`other`&&!h.tests.trim()?L(`Say which files are the tests, such as *.jmx, under Framework.`):x?.();if(t===`git`){if(!S.trim())return L(`Paste the repository's address first.`);ue(`read`,async()=>de(await G.source({kind:`git`,url:S.trim(),...te?{branch:te}:{},...O?{tokenVar:O}:{}})))}else if(t===`folder`){if(!re.trim())return L(`Type the folder's path first.`);ue(`read`,async()=>de(await G.source({kind:`folder`,folder:re.trim()})))}else{if(t===`upload`)return L(`Choose a folder or some files first.`);if(t===`paste`){if(P.some(e=>!e.path.trim()||!e.text.trim()))return L(`Give every file a name and its code.`);ue(`read`,async()=>{let e=await G.source({kind:`paste`});await G.files(e.workspace.id,P.map(e=>({path:e.path.trim(),text:e.text}))),de(await G.finish(e.workspace.id))})}}}},ge=!!I,_e={read:t===`git`?`Cloning…`:t===`folder`?`Copying…`:`Reading…`,upload:`Sending…`,test:`Testing…`,token:`Saving…`}[I],[ve,ye]=(0,Z.useState)(null),be=e=>{d(ci(e)),ye(null)},xe=e=>{e!==t&&(d([]),n(e),s(null),y(null),L(``),l(e===`project`?``:`.`))},Se=z?.ready||t===`project`&&v;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[!z?.ready&&(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Where the tests are`,onKeyDown:e=>{let n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];if(!n||ge)return;e.preventDefault();let r=ui.length,i=ui[(ui.findIndex(e=>e.id===t)+n+r)%r].id;xe(i),requestAnimationFrame(()=>e.currentTarget.querySelector(`[aria-label="${ui.find(e=>e.id===i).label}"]`)?.focus())},className:`grid grid-cols-[repeat(auto-fill,minmax(208px,1fr))] gap-2`,children:ui.map(e=>(0,Q.jsx)(wr,{on:t===e.id,onPick:()=>xe(e.id),disabled:ge,logo:(0,Q.jsx)(bt,{logo:Lt[e.id].Logo,icon:Lt[e.id].Icon,size:20}),title:e.label,sub:e.sub,label:e.label},e.id))}),Se?(0,Q.jsx)(hi,{found:v,ws:z,onChange:z?()=>{s(null),y(null),requestAnimationFrame(()=>document.getElementById(`mig-step`)?.focus())}:void 0}):t===`git`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Q.jsx)($,{id:`mig-url`,label:`Repository`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`relative min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2`,children:(0,Q.jsx)(bt,{logo:Rt(S).Logo,size:18})}),(0,Q.jsx)(W,{inputMode:`url`,id:`mig-url`,value:S,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/ui-tests.git`,onChange:e=>(w(e.target.value),D(null)),onKeyDown:e=>He(e)&&V(),className:`w-full pl-10 font-mono`})]}),(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:!!I||!S.trim(),"aria-label":`Test the connection`,"data-tip":`Test the connection and list its branches`,onClick:()=>void ue(`test`,async()=>{let e=await G.testRepository(S.trim(),O||void 0);D(e.branches),!te&&e.head&&E(e.head),R(`Connected: ${e.branches.length} branch${e.branches.length===1?``:`es`}`)}),children:(0,Q.jsx)(T,{"aria-hidden":`true`})})]})}),(0,Q.jsx)($,{id:`mig-branch`,label:`Branch`,children:ne?.length?(0,Q.jsx)(ke,{id:`mig-branch`,value:te,onChange:e=>E(e.target.value),children:ne.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))}):(0,Q.jsx)(W,{id:`mig-branch`,value:te,spellCheck:!1,maxLength:200,placeholder:`Default branch`,onChange:e=>E(e.target.value),className:`font-mono`})})]}),(0,Q.jsx)(lt,{title:O?`Private repository: ${O}`:`Private repository? Add a token`,defaultOpen:!!O,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsx)($,{id:`mig-token`,label:`Access token`,help:M?void 0:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>N({name:`REPO_TOKEN`,value:``}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg underline`,children:`Save a new token`}),children:(0,Q.jsxs)(ke,{id:`mig-token`,value:O,onChange:e=>k(e.target.value),className:`max-w-[360px]`,children:[(0,Q.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),A.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}),M&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,Q.jsx)($,{id:`mig-token-name`,label:`Name`,children:(0,Q.jsx)(W,{id:`mig-token-name`,value:M.name,spellCheck:!1,maxLength:64,onChange:e=>N({...M,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})}),(0,Q.jsx)($,{id:`mig-token-value`,label:`Token`,children:(0,Q.jsx)(W,{id:`mig-token-value`,type:`password`,autoComplete:`off`,value:M.value,onChange:e=>N({...M,value:e.target.value}),className:`w-[260px] max-w-full`})}),(0,Q.jsxs)(K,{disabled:!!I||!M.name||!M.value,onClick:()=>void ue(`token`,async()=>{await De.saveSecrets({[M.name]:M.value}),j([...new Set([...A,M.name])].sort()),k(M.name),N(null)}),children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),`Save`]}),(0,Q.jsxs)(K,{variant:`ghost`,onClick:()=>N(null),children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsx)(`span`,{className:`w-full text-[13px] text-muted`,children:`Kept in ForgeQE's credential store, never in the address or on this page.`})]})]})})]}):t===`folder`?(0,Q.jsx)($,{id:`mig-folder`,label:`Folder path`,help:`Copied first; the folder itself is never changed.`,children:(0,Q.jsx)(W,{id:`mig-folder`,value:re,spellCheck:!1,maxLength:1e3,placeholder:`/home/me/projects/shop-ui-tests`,onChange:e=>ie(e.target.value),onKeyDown:e=>He(e)&&V(),className:`font-mono`})}):t===`upload`?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-[14px] border border-dashed border-line-strong px-6 py-10 text-center`,children:[(0,Q.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Choose a folder of tests, or some files. They are sent as soon as you pick them.`}),(0,Q.jsx)(`input`,{ref:ce,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&fe([...e.target.files])}),(0,Q.jsx)(`input`,{ref:le,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&fe([...e.target.files])}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,Q.jsxs)(K,{disabled:!!I,onClick:()=>ce.current?.click(),"data-tip":`Choose a folder`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),`Folder`]}),(0,Q.jsxs)(K,{disabled:!!I,onClick:()=>le.current?.click(),"data-tip":`Choose files`,children:[(0,Q.jsx)(ee,{"aria-hidden":`true`}),`Files`]})]})]}):t===`paste`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[P.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(W,{"aria-label":`File ${t+1} name`,value:e.path,spellCheck:!1,maxLength:300,placeholder:t?`pages/LoginPage.java`:`tests/LoginTest.java`,onChange:e=>F(P.map((n,r)=>r===t?{...n,path:e.target.value}:n)),className:`max-w-[360px] font-mono`}),P.length>1&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,"aria-label":`Remove file ${t+1}`,"data-tip":`Remove file ${t+1}`,onClick:()=>F(P.filter((e,n)=>n!==t)),children:(0,Q.jsx)(a,{"aria-hidden":`true`})})]}),(0,Q.jsx)(Ae,{"aria-label":`File ${t+1} code`,value:e.text,rows:7,spellCheck:!1,placeholder:`Paste the code`,onChange:e=>F(P.map((n,r)=>r===t?{...n,text:e.target.value}:n)),className:`font-mono`})]},t)),(0,Q.jsxs)(K,{variant:`ghost`,className:`self-start`,onClick:()=>F([...P,{path:``,text:``}]),"data-tip":`Add a file`,children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),`Add`]})]}):null,oe&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:oe}),se&&!oe&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:se}),me&&b.n>0&&(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`What to migrate`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`What to migrate`,className:`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2`,children:[(0,Q.jsx)(wr,{on:!b.on,disabled:b.locked,onPick:()=>b.set(!1),logo:(0,Q.jsx)(g,{size:20,"aria-hidden":`true`}),title:`Test code`,sub:b.locked?`Pick the source again for its code`:v?`${v.counts.tests} test file${v.counts.tests===1?``:`s`}`:`Selenium, Cypress, Playwright…`,label:`Test code`}),(0,Q.jsx)(wr,{on:b.on,onPick:()=>b.set(!0),logo:(0,Q.jsx)(bt,{logo:Lt.tosca.Logo,icon:Lt.tosca.Icon,size:20}),title:`Tosca test cases`,sub:`${b.n} export${b.n===1?``:`s`} (.tsu)`,label:`Tosca test cases`})]}),b.on&&(0,Q.jsxs)(`a`,{href:B(`migration`,`guide`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(pe,{size:14,"aria-hidden":`true`}),`Rather say what to convert? Ask Guide`]})]}),me&&!b.on&&(0,Q.jsx)(lt,{title:v?.stack?`Not quite right? Pick the tests folder or framework`:`Pick the tests folder and framework`,defaultOpen:!v?.stack||f===`other`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{id:`mig-from-label`,className:`text-sm font-medium`,children:`Tests folders`}),(0,Q.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2 rounded-[8px] border border-line bg-field pr-1 pl-4`,children:[(0,Q.jsx)(r,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{"aria-labelledby":`mig-from-label`,className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink`,children:u.length?u.join(`, `):t===`project`?`Whole project`:`All of it`}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>ye(u),"data-tip":`Pick one or more folders`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),`Choose`]})]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:u.length?`The plan takes only the tests in these folders and the code they use.`:`Where the tests are. Pick one or more; the folders under each are read too.`})]}),(0,Q.jsx)(Je,{open:ve!==null,onClose:()=>ye(null),title:`Tests folders`,description:`Tick the folders that hold the tests. A folder takes the ones under it; none ticked is the whole source.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:()=>ye([]),disabled:!ve?.length,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Clear`]}),(0,Q.jsxs)(K,{variant:`primary`,onClick:()=>be(ve||[]),children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),ve?.length?`Use ${ve.length===1?`this folder`:`these ${ci(ve).length} folders`}`:t===`project`?`Use the whole project`:`Use all of it`]})]}),children:(0,Q.jsx)(qr,{label:`Tests folders`,folders:t===`project`?e.folders:o?.folders||[],value:ve||[],onChange:ye})}),(0,Q.jsx)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:(0,Q.jsx)($,{id:`mig-stack`,label:`Framework`,children:(0,Q.jsxs)(ke,{id:`mig-stack`,value:f,onChange:e=>p(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:v?.stack?`${v.title} (detected)`:`Detect`}),e.sources.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.title},e.id)),(0,Q.jsx)(`option`,{value:`other`,children:`Other (name it)`})]})})}),f===`other`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{id:`mig-source-name`,label:`Framework name`,help:`Shown in the plan, such as JMeter or Karate.`,children:(0,Q.jsx)(W,{id:`mig-source-name`,value:h.name,maxLength:40,placeholder:`JMeter`,onChange:e=>_({...h,name:e.target.value})})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`mig-tests`,label:`Test file types`,help:`Such as *.jmx or *.feature.`,children:(0,Q.jsx)(W,{id:`mig-tests`,value:h.tests,spellCheck:!1,maxLength:120,placeholder:`*.jmx`,onChange:e=>_({...h,tests:e.target.value})})}),(0,Q.jsx)($,{id:`mig-support`,label:`Support file types (optional)`,help:`Code the tests use, such as *.groovy.`,children:(0,Q.jsx)(W,{id:`mig-support`,value:h.support,spellCheck:!1,maxLength:120,placeholder:`None`,onChange:e=>_({...h,support:e.target.value})})})]})]})]})},v?.stack?`known`:`unknown`),x&&!b.on&&(0,Q.jsx)(Cr,{busy:ge,next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),_e||`Continue`]}),onNext:V,aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:I===`test`?`Testing the connection…`:I===`token`?`Saving the token…`:ge?`Reading the source…`:`Nothing changes until you press Start.`})})]})}function hi({found:e,ws:t,onChange:n}){let r=e?.counts,i=r?.tests??0,a=[r&&r.support?`${r.support} support file${r.support===1?``:`s`}`:``,r&&r.features?`${r.features} feature file${r.features===1?``:`s`}`:``,r&&r.data?`${r.data} data file${r.data===1?``:`s`}`:``].filter(Boolean);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 border-y border-line-soft py-4`,children:[(0,Q.jsx)(`span`,{className:H(`inline-flex size-6 flex-none items-center justify-center rounded-full`,e?.stack?`bg-pass-soft text-pass`:`bg-warn-soft text-warn`),children:e?.stack?(0,Q.jsx)(C,{size:14,"aria-hidden":`true`}):(0,Q.jsx)(o,{size:14,"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{role:`status`,className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[16px] font-semibold tracking-[-0.01em]`,children:[e?.stack&&(0,Q.jsx)(St,{framework:e.stack.framework,language:e.stack.language}),e?`${i} ${e.stack?e.title:``} test file${i===1?``:`s`}`.replace(/\s+/g,` `):`Reading the tests…`]}),(0,Q.jsxs)(`span`,{className:`text-[13px] leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:[[t?`From ${Mt(t.label)}${t.branch?`, branch ${t.branch}`:``}`:`From this project`,...a].join(`, `),`.`,e&&!e.stack?` ForgeQE did not recognise the framework: pick it below.`:``,r&&r.skipped>0?` ${r.skipped} left out: links and large files are not copied.`:``]})]}),n&&(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,onClick:n,"data-tip":`Pick another source`,children:[(0,Q.jsx)(l,{"aria-hidden":`true`}),`Change`]})]})}function gi(e,t){let n=e?.stack;if(!n||n.framework===`playwright`)return;let r=t.filter(e=>e.id.startsWith(`playwright-`));return(r.find(e=>e.id===`playwright-${n.language}`)||r.find(e=>e.id===`playwright-typescript`)||r[0])?.id}function _i({view:e,to:t,setTo:n,other:r,setOther:a,into:o,setInto:s,only:c,setOnly:l,suggested:u,instructions:d,setInstructions:f}){let p=e=>e.split(`-`)[0],m=e=>e.split(`-`).slice(1).join(`-`),h=[...new Map(e.targets.map(e=>[p(e.id),e.framework])).entries()],g=r===null?p(t):``,_=e.targets.filter(e=>p(e.id)===g);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Framework`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[h.map(([r,i])=>{let o=Dt[r];return(0,Q.jsx)(wr,{on:g===r,onPick:()=>(a(null),n((e.targets.find(e=>p(e.id)===r&&m(e.id)===m(t))||e.targets.find(e=>p(e.id)===r)).id)),logo:o?(0,Q.jsx)(o,{width:22,height:22,"aria-hidden":`true`}):null,title:i,sub:u&&p(u)===r?`Suggested for your tests`:xr[r],label:i},r)}),(0,Q.jsx)(wr,{on:r!==null,onPick:()=>a(r??``),logo:(0,Q.jsx)(i,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:`Other`,sub:`Type the framework`,label:`Other framework`})]})]}),r===null?(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Language`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[_.map(e=>{let r=Et[m(e.id)];return(0,Q.jsx)(wr,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Q.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,sub:e.id===u?`Suggested`:e.title.includes(`(`)&&e.title.slice(e.title.indexOf(`(`)+1,-1).replace(e.language,``).replace(/^,\s*/,``)||void 0,label:e.language},e.id)}),(0,Q.jsx)(wr,{on:!1,onPick:()=>a(`${h.find(([e])=>e===g)?.[1]??``} with `),logo:(0,Q.jsx)(i,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:`Other`,sub:`Name the language`,label:`Other language`})]})]}):(0,Q.jsx)($,{id:`mig-other`,label:`Which framework and language?`,help:`ForgeQE checks it against what it can run, and says so before anything starts.`,children:(0,Q.jsx)(W,{id:`mig-other`,value:r,maxLength:120,autoFocus:!0,placeholder:`Playwright with Java, WebdriverIO TypeScript…`,onChange:e=>a(e.target.value)})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`mig-into`,label:`Output folder`,help:`A new folder. Empty: named after the source and the target.`,children:(0,Q.jsx)(W,{id:`mig-into`,value:o,spellCheck:!1,maxLength:300,placeholder:`tests-playwright`,onChange:e=>s(e.target.value),className:`font-mono`})}),(0,Q.jsx)($,{id:`mig-only`,label:`Only some tests (optional)`,help:`A pattern, such as checkout/** or **/*Login*.`,children:(0,Q.jsx)(W,{id:`mig-only`,value:c,spellCheck:!1,maxLength:200,placeholder:`All tests`,onChange:e=>l(e.target.value),className:`font-mono`})})]}),(0,Q.jsx)(lt,{title:d.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!d.trim(),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsx)($,{id:`mig-instructions`,label:`Rules`,help:`Style and structure for the new code. Every test and check is kept either way.`,children:(0,Q.jsx)(Ae,{id:`mig-instructions`,value:d,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per page.`,onChange:e=>f(e.target.value)})}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:di.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:d.includes(e),onClick:()=>f(d.trim()?`${d.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-surface-strong px-2 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Q.jsx)(i,{size:13,"aria-hidden":`true`}),e]},e))})]})})]})}var vi=[{name:`Select the source`,short:`Source`,about:`Point ForgeQE at your tests: a git repository, a folder, some files, pasted code or this project. It works on a copy.`},{name:`Choose the target`,short:`Target`,about:`Pick the framework and language they become, and where the new code goes. Add your own rules if you have any.`},{name:`Review and start`,short:`Review`,about:`See what moves, what cannot, and the limits to accept. Start runs it in the background.`}];function yi({view:e,review:t,onStart:n,tosca:r}){let[i,a]=(0,Z.useState)(0),[o,s]=(0,Z.useState)(0),[c,l]=(0,Z.useState)(`git`),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(`.`),[m,h]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(``),[v,b]=(0,Z.useState)({name:``,tests:``,support:``}),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(e.targets[0]?.id||``),[T,ee]=(0,Z.useState)(!1),te=e=>(ee(!0),w(e)),[E,ne]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(``),[N,re]=(0,Z.useState)(null),[ie,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(!1),[ae,oe]=(0,Z.useState)(``),L=gi(x,e.targets);(0,Z.useEffect)(()=>{!T&&L&&w(L)},[T,L]),(0,Z.useEffect)(()=>{re(null),P(!1),s(e=>Math.min(e,1))},[c,u,f,m,g,v,k,C,E,D,j]);let[se,R]=(0,Z.useState)(!1),ce=e=>{R(!0),a(e),s(t=>Math.max(t,e)),oe(``)},le=c===`project`||!!u?.workspace?.ready,z=u?.workspace,ue=le?c===`project`?r.view?.exports.length||0:u?.tosca?.length||0:0,[de,B]=(0,Z.useState)(!1),pe=x?.counts.tests;(0,Z.useEffect)(()=>{B(ue>0&&!pe)},[c,z?.id,ue,pe]);let[me,V]=(0,Z.useState)(``),[he,ge]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{if(!de||c===`project`||!z?.ready||me===z.id)return;let e=!0;return ge(``),U.adopt(z.id).then(t=>{e&&(r.onView(t),V(z.id))},t=>e&&(ge(t.message),B(!1))),()=>{e=!1}},[de,c,z?.id,z?.ready,me]);let _e=c!==`project`&&!!z&&me===z?.id,ve=!de||!le?null:c===`project`?{project:!0}:_e?{workspace:z.id}:null,ye={view:e,kind:c,setKind:l,src:u,setSrc:d,from:f,setFrom:p,folders:m,setFolders:h,stack:g,setStack:_,custom:v,setCustom:b,found:x,setFound:S,tosca:{n:ue,on:de,locked:_e,set:B}};if(ve&&r.view)return(0,Q.jsx)(Fr,{view:r.view,onView:r.onView,review:r.review,onStart:r.onStart,embedded:{scope:ve,source:(0,Q.jsx)(mi,{...ye})}},`workspace`in ve?ve.workspace:`project`);let be=async()=>{I(!0),oe(``);try{let e=m.length?li(m,k):{from:f.trim()||`.`,...k.trim()?{only:k.trim()}:{}},t=await G.plan({...c!==`project`&&u?.workspace?{workspace:u.workspace.id}:{},...e.from===`.`?{}:{from:e.from},...g?{stack:g}:{},...g===`other`?{sourceName:v.name.trim(),tests:v.tests.trim(),support:v.support.trim()}:{},...E===null?{to:C}:{to:``,toText:E.trim()},...D.trim()?{into:D.trim()}:{},...e.only?{only:e.only}:{},...j.trim()?{instructions:j.trim()}:{}});re(t),ce(2)}catch(e){oe(e.message)}finally{I(!1)}},xe=N?.plan,Se=xe?.feasibility.findings.some(e=>e.level===`limit`),Ce=xe?.feasibility.verdict===`blocked`,we=e.targets.find(e=>e.id===C),Te=xe?.units.filter(e=>e.kind===`test`).length,H=[`Where are the tests?`,`What should they become?`,`Check the plan, then start`],Ee=[`ForgeQE works on a copy. Your repository and folders are never changed.`,L&&!T&&E===null?`Suggested from your ${x?.title||``} tests. Change it if your team uses something else.`.replace(/\s+/g,` `):`The framework and language the tests are rewritten in.`,`Nothing has changed yet. Start runs it in the background, and you can leave this page.`],De=(...e)=>(0,Q.jsx)(Q.Fragment,{children:e.filter(Boolean).map((e,t)=>(0,Q.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 [overflow-wrap:anywhere]`,children:e},t))}),Oe=[{...vi[0],answer:le&&(z||x)?De((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(zt,{kind:z?.kind||`project`,label:z?.label,size:14}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:z?`${Mt(z.label)}${z.branch?`, ${z.branch}`:``}`:`This project`})]}),x&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(St,{framework:x.stack?.framework,language:x.stack?.language,size:14}),Te===void 0?`${x.counts.tests} test file${x.counts.tests===1?``:`s`}`:`${Te} test${Te===1?``:`s`} to migrate`]})):void 0},{...vi[1],answer:o>=1||L?De(E===null?we&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(St,{framework:we.id.split(`-`)[0],language:we.id.split(`-`).slice(1).join(`-`),size:14}),we.title]}):(0,Q.jsx)(`span`,{className:E.trim()?``:`text-muted`,children:E.trim()||`Type it in`}),(0,Q.jsx)(`span`,{className:`text-muted`,children:L&&!T&&E===null?`Suggested from your tests`:xe?`Into ${xe.target.dir}`:D.trim()?`Into ${D.trim()}`:`Into a new folder`})):void 0},{...vi[2],answer:xe?De((0,Q.jsx)(`span`,{children:Ot[xe.feasibility.verdict].label})):void 0}];return(0,Q.jsxs)(`div`,{className:`mt-4 grid grid-cols-[minmax(0,1fr)] items-stretch gap-6 @3xl:grid-cols-[minmax(240px,280px)_minmax(0,1fr)] @3xl:gap-12`,children:[(0,Q.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,Q.jsx)(Sr,{steps:Oe,at:i,reached:o,onGo:e=>!F&&(e<2||N)&&(R(!0),a(e))})})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-step`,className:`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Tr,{id:`mig-step`,at:i,moved:se,children:H[i]}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:Ee[i]})]}),(ae||he)&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:ae||he}),i===0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mi,{...ye,onNext:()=>ce(1)}),de&&(0,Q.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Q.jsx)(`span`,{children:`Getting the Tosca exports ready…`})})]}),i===1&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_i,{view:e,to:C,setTo:te,other:E,setOther:ne,into:D,setInto:O,only:k,setOnly:A,suggested:L,instructions:j,setInstructions:M}),(0,Q.jsx)(Cr,{busy:F,onBack:()=>(R(!0),a(0)),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(fe,{"aria-hidden":`true`}),F?`Checking…`:`Check the plan`]}),onNext:()=>E!==null&&!E.trim()?oe(`Type the framework and language first.`):void be(),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),i===2&&xe&&(0,Q.jsxs)(Q.Fragment,{children:[t(xe,ie,P),(0,Q.jsx)(Cr,{busy:F,onBack:()=>(R(!0),a(1)),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]}),disabled:Ce||Se&&!ie,onNext:()=>n(N,!!Se&&ie),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:Ce?`Change what is not possible first.`:Se&&!ie?`Accept the limits to start.`:`Runs in the background.`})})]})]})]})}function bi({error:e}){return e?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}function xi({finding:e}){let t=e.hits||[],n=e.files?.length||0;if(!t.length)return n?(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` (`,n,` file`,n===1?``:`s`,`)`]}):null;let r=n-new Set(t.map(e=>e.file)).size;return(0,Q.jsxs)(`details`,{className:`mt-1 text-[13px]`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-muted hover:text-ink`,children:[`Found in `,n||t.length,` file`,(n||t.length)===1?``:`s`]}),(0,Q.jsxs)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:[t.map(e=>(0,Q.jsxs)(`li`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.file,`:`,e.line]}),(0,Q.jsx)(`code`,{className:`mt-1 block overflow-x-auto rounded-[8px] bg-bg px-2 py-1 font-mono text-[13px] whitespace-pre text-ink`,children:e.code})]},`${e.file}:${e.line}`)),r>0&&(0,Q.jsxs)(`li`,{className:`text-muted`,children:[`and `,r,` more file`,r===1?``:`s`]})]})]})}function Si({f:e}){let t=e.level===`blocker`;return(0,Q.jsxs)(`li`,{className:`grid grid-cols-[24px_minmax(0,1fr)] gap-4 border-b border-line-soft py-4 last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:H(`inline-flex size-6 items-center justify-center rounded-full`,t?`bg-fail-soft text-fail`:`bg-warn-soft text-warn`),children:(0,Q.jsx)(o,{size:14,"aria-label":t?`Not possible`:`Limit`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 text-[13px] leading-relaxed text-ink [overflow-wrap:anywhere]`,children:[e.text,(0,Q.jsx)(xi,{finding:e})]})]})}function Ci({plan:e,accepted:t,onAccept:n}){let r=e.feasibility.findings.filter(e=>e.level===`blocker`),i=e.feasibility.findings.filter(e=>e.level===`limit`),a=e.units.filter(e=>e.kind===`test`).length,s=e.units.filter(e=>e.kind===`support`).length,l=e.workspace?Mt(e.workspace.label):`this project`,u=r.length?{icon:c,text:`Not possible yet: ${r.length===1?`one thing stops it`:`${r.length} things stop it`}`,tone:`text-fail`}:i.length?t&&!n?{icon:h,text:`Ready to start, ${i.length===1?`its limit`:`its ${i.length} limits`} accepted`,tone:`text-pass`}:{icon:o,text:`Ready, with ${i.length===1?`1 limit`:`${i.length} limits`} to accept`,tone:`text-warn`}:{icon:h,text:`Ready to start`,tone:`text-pass`};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsx)(At,{from:{...e.source.stack?e.source.stack:{},title:e.source.title,sub:`${a} test${a===1?``:`s`} to migrate, from ${l}${e.source.dir===`.`?``:`/${e.source.dir}`}`},to:{...Ei(e.target.id),title:e.target.title,sub:`Into ${e.target.dir}`}}),(0,Q.jsxs)(`p`,{className:H(`m-0 flex items-center gap-2 text-[13px] font-medium`,u.tone),children:[(0,Q.jsx)(u.icon,{size:16,"aria-hidden":`true`}),u.text]}),(0,Q.jsxs)(qe,{label:`The plan in numbers`,children:[(0,Q.jsx)(et,{label:`Tests`,value:a,note:`Rewritten, one by one`}),(0,Q.jsx)(et,{label:`Support files`,value:s,note:`Code the tests use`}),(0,Q.jsx)(et,{label:`Copied as is`,value:e.copies.length,note:`Not rewritten`}),(0,Q.jsx)(et,{label:`Not migrated`,value:e.notMigrated.length,note:e.notMigrated.length?`In What moves where`:`Nothing left out`})]}),r.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-blockers`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mig-blockers`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Not possible`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:r.map(e=>(0,Q.jsx)(Si,{f:e},e.code))})]}),i.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-limits`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mig-limits`,className:`m-0 text-[13px] font-semibold text-muted`,children:t&&!n?`Limits accepted`:`Limits to accept`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:i.map(e=>(0,Q.jsx)(Si,{f:e},e.code))}),n&&!r.length&&(0,Q.jsxs)(`label`,{className:`flex min-h-10 w-fit cursor-pointer items-center gap-2 text-[13px] font-medium`,children:[(0,Q.jsx)(ct,{checked:!!t,onCheckedChange:n}),`I accept `,i.length===1?`this limit`:`these ${i.length} limits`]})]}),e.instructions&&(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-rules`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mig-rules`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Your rules for the new code`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.instructions})]}),(0,Q.jsxs)(lt,{title:`What moves where (${e.units.length})`,children:[(0,Q.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-[13px]`,children:e.units.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap gap-x-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:`w-16 flex-none text-muted`,children:Nt[e.kind]}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.source?(0,Q.jsxs)(`span`,{className:`text-muted`,children:[e.source.slice(e.source.lastIndexOf(`/`)+1),` → `]}):null,e.target]})]},e.id))}),e.notMigrated.length>0&&(0,Q.jsxs)(`p`,{className:`m-0 mt-2 text-[13px] text-muted`,children:[`Not migrated: `,e.notMigrated.map(e=>e.rel.slice(e.rel.lastIndexOf(`/`)+1)).join(`, `)]})]})]})}function wi({plan:e,acceptLimits:t,onClose:n,onStarted:r}){let[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),u=async()=>{s(!0),l(``);try{r((await G.start(e.id,i,t)).detail)}catch(e){l(e.message),s(!1)}};return(0,Q.jsx)(Je,{open:!0,onClose:n,title:`Start the migration`,description:`The tests are rewritten in ${e.target.title} into ${e.target.dir}, and ForgeQE runs each one. It runs in the background; your source tests are not changed.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:n,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(K,{variant:`primary`,disabled:o||i!==e.id,onClick:()=>void u(),"data-tip":`Start the migration`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Q.jsx)(W,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Q.jsx)(bi,{error:c})]})})}function Ti({d:e,onStarted:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!1),o=e.plan.feasibility.findings.some(e=>e.level===`limit`),s=e.plan.feasibility.verdict===`blocked`,c=!!e.job?.running;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!c&&(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Q.jsx)(Ci,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!s&&!c&&(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(K,{variant:`primary`,disabled:!e.confirmed&&o&&!n,onClick:()=>a(!0),"data-tip":`Start the migration`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]})}),i&&(0,Q.jsx)(wi,{plan:e.plan,acceptLimits:o&&(e.confirmed||n),onClose:()=>a(!1),onStarted:e=>{a(!1),t(e)}})]})}var Ei=e=>({framework:e.split(`-`)[0],language:e.split(`-`).slice(1).join(`-`)});function Di(e,t){return e?.status===`running`?`running`:e?.status===t?`done`:e?`review`:`planned`}function Oi(e){return{key:e.id,link:B(`migration`,e.id),title:`${e.source} to ${e.target}`,under:e.to,from:(0,Q.jsx)(St,{framework:e.stack?.framework,language:e.stack?.language,size:18}),to:Ei(e.targetId),source:{mark:(0,Q.jsx)(zt,{kind:e.origin.kind,label:e.origin.label,size:15}),text:e.origin.kind===`project`?e.from:Mt(e.origin.label),tip:e.origin.label},running:e.result?.status===`running`?{pct:Math.min(99,Math.round(e.result.done/Math.max(1,e.files)*95))}:null,pass:e.result?{n:e.result.migrated,of:e.tests}:null,state:e.result?xt[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ot[e.verdict],filter:Di(e.result,`migrated`),at:e.result?.endedAt||e.result?.at||e.createdAt}}function ki(e){let t=e.file.slice(e.file.lastIndexOf(`/`)+1);return{key:e.id,link:B(`migration`,e.id),title:`${t} to ${e.target}`,under:`${e.project?`${e.project}, into `:`Into `}${e.into}`,from:(0,Q.jsx)(zt,{kind:`tosca`,size:18}),to:Ei(e.targetId),source:{mark:(0,Q.jsx)(zt,{kind:`tosca`,size:15}),text:t,tip:`Tosca export ${e.file}`},running:e.result?.status===`running`?{pct:Math.min(99,Math.round(e.result.done/Math.max(1,e.units||e.tests+1)*95))}:null,pass:e.result?{n:e.result.converted,of:e.tests}:null,state:e.result?Qt[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Wt[e.verdict],filter:Di(e.result,`converted`),at:e.result?.endedAt||e.result?.at||e.createdAt}}function Ai({rows:e}){let[t,n]=(0,Z.useState)(`all`),r=t=>t===`all`?e.length:e.filter(e=>e.filter===t).length,i=e.filter(e=>t===`all`||e.filter===t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,Q.jsx)(Y,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,Q.jsx)(Y,{label:`Migrated`,value:r(`done`),tone:r(`done`)?`text-pass`:void 0,onClick:()=>n(`done`),on:t===`done`}),(0,Q.jsx)(Y,{label:`Needs review`,value:r(`review`),tone:r(`review`)?`text-warn`:void 0,onClick:()=>n(`review`),on:t===`review`})]}),(0,Q.jsx)(We,{label:`Migrations`,placeholder:`Find a migration`,empty:t===`all`?`No migrations.`:`None here.`,resetKey:t,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Migration`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @3xl:table-cell`),children:`Source`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Tests`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @xl:table-cell`),children:`Updated`})]}),children:i.map(e=>(0,Q.jsxs)(`tr`,{onClick:()=>location.hash=e.link,className:$e,children:[(0,Q.jsx)(`td`,{className:J,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,Q.jsxs)(`span`,{className:`hidden flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:[e.from,(0,Q.jsx)(he,{size:13,className:`text-muted`}),(0,Q.jsx)(St,{framework:e.to.framework,language:e.to.language,size:18})]}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`a`,{href:e.link,onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:e.under})]})]})}),(0,Q.jsx)(`td`,{className:H(J,`hidden max-w-[260px] @3xl:table-cell`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] text-ink-2`,children:[e.source.mark,(0,Q.jsx)(`span`,{className:`truncate`,"data-tip":e.source.tip,children:e.source.text})]})}),(0,Q.jsx)(`td`,{className:H(J,`w-[180px] text-[13px]`),children:e.running?(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ft,{value:e.running.pct,label:`${e.title}: progress`}),(0,Q.jsxs)(`span`,{className:`w-9 flex-none text-right text-[13px] text-muted tabular-nums`,children:[e.running.pct,`%`]})]}):e.pass?(0,Q.jsxs)(`span`,{className:e.pass.n===e.pass.of?`text-pass`:`text-ink-2`,children:[e.pass.n,` of `,e.pass.of,` pass`]}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap`),children:(0,Q.jsx)(Ne,{tone:e.state.tone,children:e.state.label})}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),children:at(e.at)})]},e.key))})]})}function ji({sub:e}){let[t,n]=(0,Z.useState)(null),[r,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),m=e===`migrations`,h=(0,Z.useCallback)(()=>{G.list().then(e=>{n(e),s(``)},e=>s(e.message))},[]),g=(0,Z.useCallback)(()=>{U.list().then(e=>{a(e),l(``)},e=>l(e.message))},[]);(0,Z.useEffect)(h,[h,e]),(0,Z.useEffect)(()=>{(m||e===`new`)&&g()},[m,e,g]);let _=t?.plans.some(e=>e.result?.status===`running`)||r?.plans.some(e=>e.result?.status===`running`);(0,Z.useEffect)(()=>{if(!_||!m)return;let e=Xe(()=>{h(),g()},3e3);return()=>Ye(e)},[_,m,h,g]);let v=(0,Z.useMemo)(()=>[...t?.plans.map(Oi)||[],...r?.plans.map(ki)||[]].sort((e,t)=>e.at<t.at?1:e.at>t.at?-1:0),[t,r]),y=e&&/^mig-\d{8}-\d{6}-[0-9a-f]{4}$/.test(e)?e:``,b=()=>location.hash=B(`migration`,`new`),x=!t&&!o&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});return Br(e)?(0,Q.jsx)(Vr,{sub:e}):e===`new`?(0,Q.jsxs)(rn,{tab:`migrations`,back:nn,children:[(0,Q.jsx)(bi,{error:o}),x,t&&(0,Q.jsx)(yi,{view:t,review:(e,t,n)=>(0,Q.jsx)(Ci,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>d({d:e,accept:t}),tosca:{view:r,onView:a,review:(e,t,n,r)=>(0,Q.jsx)(Lr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>p({d:e,accept:t})}}),u&&(0,Q.jsx)(wi,{plan:u.d.plan,acceptLimits:u.accept,onClose:()=>d(null),onStarted:e=>location.hash=B(`migration`,e.plan.id)}),f&&(0,Q.jsx)(sn,{plan:f.d.plan,acceptLimits:f.accept,onClose:()=>p(null),onStarted:e=>location.hash=B(`migration`,e.plan.id)})]}):y?(0,Q.jsxs)(rn,{tab:`migrations`,wide:!0,back:nn,children:[(0,Q.jsx)(bi,{error:o}),x,t&&(0,Q.jsx)(oi,{id:y,view:t,plan:e=>(0,Q.jsx)(Ti,{d:e,onStarted:()=>location.reload()})},y)]}):m?(0,Q.jsxs)(rn,{tab:`migrations`,action:t&&!v.length?void 0:(0,Q.jsxs)(K,{variant:`primary`,disabled:!t,onClick:b,"data-tip":`New migration`,children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),`New`]}),children:[(0,Q.jsx)(bi,{error:o}),(0,Q.jsx)(bi,{error:c&&`Tosca conversions could not be read: ${c}`}),x,t&&(v.length?(0,Q.jsx)(Ai,{rows:v}):(0,Q.jsx)(Fe,{icon:E,title:`No migrations yet`,action:(0,Q.jsxs)(K,{size:`sm`,onClick:b,"data-tip":`New migration`,children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),`New`]}),children:`Bring in tests from git, a folder, uploaded files, pasted code or this project, Tosca exports among them, and pick the framework they move to. Nothing starts until you confirm.`}))]}):(0,Q.jsx)(rn,{tab:mt})}export{ji as Migration};
|
|
5
|
+
`)}function vn(e,t){return e.map((e,n)=>({u:e,i:n,at:Date.parse(t(e)||``)||0})).sort((e,t)=>t.at-e.at||t.i-e.i).map(e=>e.u)}function yn(e){if(e.job?.running)return{label:e.job.kind===`fix`?`Fixing`:e.job.kind===`verify`?`Running tests`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:`Running`,tone:`running`}:t?Qt[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Wt[e.plan.feasibility.verdict]}var bn=e=>e.slice(e.lastIndexOf(`/`)+1);function xn({d:e,onClose:t}){let n=(e.plan.sources||[]).some(e=>e.workspace),[r,i]=(0,Z.useState)(n),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),l=async()=>{o(!0),c(``);try{let t=await U.reimport(e.plan.id,n&&r);location.hash=B(`migration`,t.plan.id)}catch(e){c(e.message),o(!1)}};return(0,Q.jsx)(st,{open:!0,onClose:t,title:`Read the exports again`,description:`A new plan from the same exports, into the same folder. Test cases unchanged in Tosca keep their tests; changed and new ones are converted; ones no longer there are listed. Nothing is written until you start it.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,Q.jsx)(K,{variant:`primary`,disabled:a,onClick:()=>void l(),children:a?`Reading…`:`Make the new plan`})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[n&&(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Q.jsx)(dt,{className:`mt-1`,checked:r,onCheckedChange:i}),(0,Q.jsxs)(`span`,{children:[`Get the newest commit of the cloned repositories`,(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Each is cloned again, as before; the old copy stays for this plan.`})]})]}),s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s})]})})}var Sn=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function Cn({id:e,onClose:t}){let[n,r]=(0,Z.useState)(`github`),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let t=!0;return a(null),p(!1),s(``),l(``),U.ci(e,n).then(e=>t&&a(e),e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let m=i?i.file.slice(i.file.lastIndexOf(`/`)+1):``,h=()=>{if(!i)return;let e=URL.createObjectURL(new Blob([i.text],{type:`text/yaml;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=m,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},g=async()=>{d(!0),s(``);try{let t=await U.writeCi(e,n);p(!0),l(`Added ${t.file}.${n===`github`?` GitHub runs a workflow only from ${t.path}: move it there.`:` Create a pipeline from it in Azure DevOps.`}`)}catch(e){s(e.message)}finally{d(!1)}};return(0,Q.jsxs)(st,{open:!0,wide:!0,onClose:t,title:`CI pipeline`,description:`Runs the converted tests in your CI, one job per Tosca execution list. Review it before you commit it.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:t,children:`Close`}),(0,Q.jsxs)(K,{disabled:!i,onClick:h,children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),`Download`]}),!f&&(0,Q.jsx)(K,{variant:`primary`,disabled:!i||u,onClick:()=>void g(),"data-tip":`Into the target folder's ci/, so a pull request of the conversion carries it.`,children:u?`Adding…`:`Add to the target folder`})]}),children:[(0,Q.jsx)(qe,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:Sn}),(0,Q.jsxs)(`div`,{id:`panel-ci-${n}`,role:`tabpanel`,"aria-labelledby":`tab-ci-${n}`,className:`flex flex-col gap-4 text-sm`,children:[!i&&!o&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Making the pipeline…`}),o&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),c&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-ink [overflow-wrap:anywhere]`,children:c}),i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Jobs`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:[...i.tests?[i.suites.length?`One per Tosca execution list: ${i.suites.join(`, `)}`:`One for every test: the export has no execution lists`]:[],...i.workflows?[`One per kind of app (desktop, mobile), replaying ${X(i.workflows,`workflow`)}`]:[]].join(`; `)}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Goes in`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono text-[13px] [overflow-wrap:anywhere]`,children:i.path}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`To set`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[i.tests&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:`BASE_URL`}),` as a variable`]}),i.secrets.length?(0,Q.jsxs)(Q.Fragment,{children:[i.tests?`; as `:`As `,n===`github`?`secrets`:`secret variables`,`: `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px] [overflow-wrap:anywhere]`,children:i.secrets.join(`, `)})]}):null,!i.tests&&!i.secrets.length?`None`:null,i.skipped.length?(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Not passed, not a name the CI takes: `,i.skipped.join(`, `)]}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:m}),(0,Q.jsx)(ut,{text:i.text,label:`Copy ${m}`})]}),(0,Q.jsx)(`pre`,{"aria-label":m,tabIndex:0,className:`m-0 max-h-[420px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-ink-2`,children:i.text})]})]})]})]})}function wn({id:e,onClose:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(``),g=(t=``)=>U.pr(e,t).then(e=>{r(e),h(``),e.preview&&(a(e.preview),s(t=>t||e.preview.base),l(t=>t||e.preview.title))},e=>h(e.message));(0,Z.useEffect)(()=>{g()},[e]),(0,Z.useEffect)(()=>{if(n?.job?.state!==`running`)return;let e=setTimeout(()=>void g(o),1e3);return()=>clearTimeout(e)},[n]);let _=async()=>{p(!0),h(``);try{let t=await U.openPr(e,{base:o.trim(),title:c.trim(),draft:u});r(e=>e&&{...e,job:t.job})}catch(e){h(e.message)}finally{p(!1)}},v=i,y=n?.job,b=y?.state===`running`,x=y?.state===`done`?y.result:void 0,S=m||(y?.state===`failed`?y.error:``)||(n&&!n.preview?n.problem:``)||``,C=e=>/^https:\/\//.test(e)?e:void 0,w=(e,t)=>(0,Q.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 text-accent-fg`,children:[t,(0,Q.jsx)(R,{size:11,"aria-hidden":`true`})]});return(0,Q.jsx)(st,{open:!0,wide:!0,onClose:t,title:`Open a pull request`,description:`The converted tests on a branch of their own, for your team to review. ForgeQE commits in a separate copy of the repository, so your own branch and edits stay as they are, and merges nothing.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:t,children:x?`Close`:`Cancel`}),!x&&(0,Q.jsx)(K,{variant:`primary`,disabled:!v||!n?.preview||f||b||!o.trim(),onClick:()=>void _(),children:f?`Starting…`:b?`Pushing…`:`Push and open the pull request`})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&!m&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Checking the repository…`}),S&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:S}),x&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-ink [overflow-wrap:anywhere]`,children:[x.existing?`Nothing new to push: this is the pull request.`:`Pushed ${X(x.files,`file`)} on ${x.branch}.`,` `,C(x.url)?w(C(x.url),`Open the pull request`):`It is open on ${x.branch}; the host gave no https address to link to.`]}),v&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Repository`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[v.platform===`github`?`GitHub`:`Azure DevOps`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:v.repository}),` (`,v.remote,`)`]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono text-[13px] [overflow-wrap:anywhere]`,children:v.branch}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[X(v.files.length,`file`),` of `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:v.folder})]})]}),v.last&&C(v.last.url)&&!x&&(0,Q.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Opened before: `,w(C(v.last.url),`the pull request`),`. Pushing again updates its branch.`]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Merge into`}),(0,Q.jsx)(W,{value:o,spellCheck:!1,maxLength:200,placeholder:`main`,"aria-invalid":!(!n||n.preview),onChange:e=>s(e.target.value),onBlur:()=>o.trim()&&o.trim()!==n?.preview?.base&&void g(o.trim()),disabled:b,className:`font-mono`})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Title`}),(0,Q.jsx)(W,{value:c,maxLength:200,onChange:e=>l(e.target.value),disabled:b})]}),(0,Q.jsxs)(`label`,{className:H(`flex items-start gap-2`,b?`cursor-default`:`cursor-pointer`),children:[(0,Q.jsx)(dt,{className:`mt-1`,checked:u,onCheckedChange:d,disabled:b}),(0,Q.jsxs)(`span`,{children:[`Open it as a draft`,(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Reviewers are not asked yet.`})]})]}),(0,Q.jsx)(pt,{title:`Files (${v.files.length})`,children:(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-[13px]`,children:[v.files.slice(0,200).map(e=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e)),v.files.length>200&&(0,Q.jsxs)(`li`,{className:`text-muted`,children:[`and `,v.files.length-200,` more`]})]})}),v.skipped.length>0&&(0,Q.jsx)(pt,{title:`Left out (${v.skipped.length})`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:v.skipped.slice(0,100).map(e=>(0,Q.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.path}),`: `,(0,Q.jsx)(`span`,{className:`text-muted`,children:e.why})]},e.path))})})]})]})})}function Tn({id:e,title:t,targetDir:n,onClose:r}){let[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),d=async()=>{c(!0),u(``);try{await U.delete(e,i),location.hash=B(`migration`,`migrations`)}catch(e){u(e.message),c(!1)}};return(0,Q.jsx)(st,{open:!0,onClose:r,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),`Keep`]}),(0,Q.jsxs)(K,{variant:`danger`,disabled:s||i!==e,onClick:()=>void d(),children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Q.jsx)(W,{value:i,onChange:e=>o(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function En({d:e,unit:n,onClose:r,onSend:i}){let[a,o]=(0,Z.useState)(``),s=e.plan.units.find(e=>e.id===n),c=e.result?.units.find(e=>e.id===n);return(0,Q.jsx)(st,{open:!0,onClose:r,title:`Fix ${s?bn(s.target):n}`,description:`Bridge works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:r,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(K,{variant:`primary`,onClick:()=>i(a.trim()),"data-tip":`Send to the agent`,children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),`Send`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c.problems[0]}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,Q.jsx)(Ae,{value:a,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function Dn({d:e,unit:t,onClose:n}){let r=e.result?.units.find(e=>e.id===t),i=e.plan.units.find(e=>e.id===t);return(0,Q.jsx)(st,{open:!0,onClose:n,wide:!0,title:`Output of ${i?bn(i.target):t}`,description:r?.checkedAt?`Run again ${kt(r.checkedAt)}`:`From the conversion's own run`,footer:(0,Q.jsxs)(K,{onClick:n,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Close`]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r?.problems?.length?(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r.problems.join(` `)}):r?.status===`converted`?(0,Q.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,r?.command&&(0,Q.jsxs)(`code`,{className:`block font-mono text-[13px] text-muted`,children:[`$ `,r.command]}),(0,Q.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto rounded-[12px] bg-surface-muted px-4 py-2 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:(0,Q.jsx)(Le,{text:r?.output||`No output.`})})]})})}function On(e){let t=Object.fromEntries(qt.map(e=>[e,{status:e===`prepare`?`running`:`pending`,...e===`prepare`?{startedAt:new Date().toISOString()}:{}}]));return{status:`running`,plan:e.plan.id,target:e.plan.target,units:[],reverted:[],model:``,startedAt:e.job?.last?.startedAt||new Date().toISOString(),ms:0,stage:`prepare`,stages:t,notes:``}}function kn(e,t){let n=new Map(t.units.map(e=>[e.id,e])),r=e.plan.units.flatMap(t=>{let r=n.get(t.id);if(!r||!hn(r)||t.kind!==`test`)return[];let i=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return[{p:t,u:r,tc:i,title:i?.name||bn(t.target)}]}),i=new Map(t.units.map((e,t)=>[e.id,t]));return r.sort((e,t)=>i.get(e.p.id)-i.get(t.p.id)),vn(r,e=>e.u.checkedAt)}function An({d:e,busy:t,onFix:n,onSteps:r,onOutput:i}){let a=e.result?kn(e,e.result):[];return a.length?(0,Q.jsx)(`ol`,{"aria-label":`Errors, the latest first`,className:`m-0 flex list-none flex-col gap-8 p-0`,children:a.map(({p:e,u:a,tc:o,title:s})=>{let c=_n(a),l=a.problems?.length?a.problems:[];return(0,Q.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-4 border-b border-line pb-8 last:border-b-0 last:pb-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-[16px] font-semibold`,children:[(0,Q.jsx)(Ne,{tone:Ut[a.status].tone,children:Ut[a.status].label}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:s})]}),(0,Q.jsxs)(`p`,{className:`m-0 font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:[e.target,o?.suites?.length?(0,Q.jsxs)(`span`,{className:`font-sans`,children:[`, in `,o.suites.join(`, `)]}):null,(0,Q.jsxs)(`span`,{className:`font-sans`,children:[` `,`· `,X(a.attempts,`attempt`),a.checkedAt?`, run again ${lt(a.checkedAt)}`:``]})]})]}),(0,Q.jsxs)(Kt,{icon:f,title:`What went wrong`,children:[(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 font-mono text-[13px] text-fail [overflow-wrap:anywhere]`,children:gn(a)}),l.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-sm text-ink-2`,children:l.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))})]}),c&&(0,Q.jsx)(Kt,{icon:k,title:`What the test printed`,children:(0,Q.jsx)(Zt,{label:`Error of ${s}`,files:[{name:bn(e.target),code:c,log:!0}]})}),a.reason&&(0,Q.jsx)(Kt,{icon:Se,title:`The agent's note`,children:(0,Q.jsx)(`p`,{className:`m-0 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:a.reason})}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[!e.engine&&(0,Q.jsxs)(K,{size:`sm`,variant:`primary`,disabled:t,onClick:()=>n(e.id),children:[(0,Q.jsx)(D,{"aria-hidden":`true`}),`Fix with the agent`]}),e.case&&(0,Q.jsxs)(K,{size:`sm`,onClick:()=>r(e.case),children:[(0,Q.jsx)(L,{"aria-hidden":`true`}),`Steps beside the code`]}),(a.output||l.length>0)&&(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>i(e.id),children:[(0,Q.jsx)(k,{"aria-hidden":`true`}),`Full output`]})]})]},e.id)})}):(0,Q.jsx)(Fe,{icon:h,title:`No errors`,children:`Every converted test that ran passes.`})}function jn({d:e,planView:t,busy:n,onFix:r,onSteps:i,onOutput:a,onRun:o,onNext:s,onErrors:c}){let l=e.result||(e.job?.running?On(e):null);if(!l)return(0,Q.jsx)(Q.Fragment,{children:t});let u=new Map(l.units.map(e=>[e.id,e])),d=e.plan.units.filter(e=>e.kind===`test`&&!e.engine),p=e.plan.units.filter(e=>e.kind===`test`&&e.engine),m=new Set(d.map(e=>e.id)),h=new Set(p.map(e=>e.id)),g=l.units.filter(e=>m.has(e.id)&&e.status===`converted`).length,_=l.units.filter(e=>h.has(e.id)&&e.status===`written`).length,v=l.units.reduce((e,t)=>t.fidelity?{m:e.m+t.fidelity.matched,n:e.n+t.fidelity.required}:e,{m:0,n:0}),b=l.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,[x,...S]=e.plan.target.id.split(`-`),C=kn(e,l),w=C[0];return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:d.length?`Passing`:`Workflows written`,value:d.length?`${g} of ${d.length}`:`${_} of ${p.length}`,tone:d.length&&g===d.length?`text-pass`:void 0}),(0,Q.jsx)(Y,{label:`Need attention`,value:b,tone:b?`text-fail`:void 0}),(0,Q.jsx)(Y,{label:`Tosca steps kept`,value:v.n?`${v.m} of ${v.n}`:`None yet`,tone:v.n&&v.m===v.n?`text-pass`:void 0}),(0,Q.jsx)(Y,{label:l.status===`running`?`Running for`:`Took`,value:Tt(l.status===`running`?Date.now()-Date.parse(l.startedAt):l.ms)})]}),w&&(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-attn-h`,className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 rounded-[12px] bg-fail-soft py-2 pr-2 pl-4 @2xl:grid-cols-[auto_minmax(0,1fr)_auto]`,children:[(0,Q.jsx)(`h3`,{id:`tsc-attn-h`,className:`sr-only`,children:`Needs your attention`}),(0,Q.jsx)(f,{size:18,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,Q.jsxs)(`p`,{className:`m-0 min-w-0 truncate text-sm text-ink`,"data-tip":`${w.title}: ${gn(w.u)}`,children:[(0,Q.jsx)(`span`,{className:`hidden font-medium @2xl:inline`,children:w.title}),(0,Q.jsx)(`span`,{className:`hidden text-ink-2 @2xl:inline`,children:`: `}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:gn(w.u)})]}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,className:`col-start-2 -ml-4 justify-self-start text-fail hover:text-fail @2xl:col-start-auto @2xl:ml-0`,onClick:c,children:[C.length===1?`See the error`:`See all ${C.length} errors`,(0,Q.jsx)(he,{"aria-hidden":`true`})]})]}),l.notes&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l.notes}),l.batch&&l.batch.left>0&&l.status!==`running`&&(0,Q.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-sm text-ink`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Batch `,l.batch.runs,` is done. Check its tests, then continue: `,X(l.batch.left,`test case`),` not tried yet.`]}),(0,Q.jsxs)(K,{size:`sm`,disabled:n,onClick:s,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Continue with the next batch`]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Q.jsx)(`div`,{className:`@container min-w-0`,children:(0,Q.jsx)(tt,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @3xl:table-cell`),children:`Note`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let o=u.get(t.id),s=o?Ut[o.status]:null,c=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,Q.jsxs)(`tr`,{className:et,children:[(0,Q.jsxs)(`td`,{className:J,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:bn(t.target)}),(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[c?t.engine?`${Gt(t)}: ${c.name}`:c.name:`${Gt(t)}, ${t.target}`,c?.suites?.length?`, in ${c.suites.join(`, `)}`:``]})]}),(0,Q.jsxs)(`td`,{className:H(J,`whitespace-nowrap`),children:[s?(0,Q.jsx)(Ne,{tone:s.tone,children:s.label}):(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`}),o?.checkedAt&&(0,Q.jsxs)(`span`,{className:`block pt-1 text-[13px] text-muted`,children:[`Run again `,lt(o.checkedAt)]})]}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] whitespace-nowrap @2xl:table-cell`),children:o?.fidelity?(0,Q.jsxs)(`span`,{className:o.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[o.fidelity.matched,` of `,o.fidelity.required]}):t.kind===`test`?(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not checked yet`}):null}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:o?.problems?.[0]||o?.reason||``})}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap text-right`),children:(0,Q.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(o?.output||o?.problems?.length)&&(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,"aria-label":`Output of ${bn(t.target)}`,"data-tip":`Output of ${bn(t.target)}`,onClick:()=>a(t.id),children:(0,Q.jsx)(k,{"aria-hidden":`true`})}),t.case&&(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,"aria-label":`Steps of ${bn(t.target)}`,"data-tip":`Steps of ${bn(t.target)}`,onClick:()=>i(t.case),children:(0,Q.jsx)(L,{"aria-hidden":`true`})}),o&&(o.status===`failed`||o.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Fix ${bn(t.target)}`,"data-tip":`Fix ${bn(t.target)}`,onClick:()=>r(t.id),children:(0,Q.jsx)(D,{"aria-hidden":`true`})})]})})]},t.id)})})}),(0,Q.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] panel p-6 text-sm @5xl:sticky @5xl:top-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`From`}),(0,Q.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?`, ${e.plan.source.project}`:``]}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`To`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Q.jsx)(St,{framework:x,language:S.join(`-`)}),e.plan.target.title]}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,"data-tip":e.targetPath,children:e.plan.target.dir})]}),(e.plan.suites||[]).length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`Suites`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.plan.suites.map(e=>{let t=new Set(e.cases),r=l.units.filter(e=>e.kind===`test`&&e.case&&t.has(e.case)&&e.status===`converted`).length;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Q.jsxs)(`span`,{className:H(`text-[13px]`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,X(e.cases.length,`test`),` pass, tagged @`,e.tag]})]}),(0,Q.jsx)(K,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Run the ${e.name} suite`,"data-tip":`Run the ${e.name} suite`,onClick:()=>o(e.name),children:(0,Q.jsx)(y,{"aria-hidden":`true`})})]},e.name)})})]}),e.plan.env.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`Environment variables`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[e.name,e.secret?(0,Q.jsx)(`span`,{className:`font-sans text-muted`,children:` (secret)`}):null]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Q.jsx)(`dd`,{className:`m-0 text-right`,children:kt(l.startedAt)}),l.model&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Q.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":l.model,children:l.model})]}),l.reverted.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-right`,children:[l.reverted.length,` edits outside the target`]})]})]})]})]})]})}var Mn={fail:{icon:f,cls:`text-fail`,label:`Failed`},ok:{icon:h,cls:`text-pass`,label:`Done`},info:{icon:A,cls:`text-muted`,label:`Info`},agent:{icon:Se,cls:`text-accent-fg`,label:`Agent`},tool:{icon:D,cls:`text-muted`,label:`Tool`}};function Nn(e,t){let n=new Map;for(let r of e){let e=r.unit?`u:${r.unit}`:`s:${r.stage}`,i=n.get(e);if(!i){let a=r.unit?t.plan.units.find(e=>e.id===r.unit):void 0,o=a?.case?t.plan.cases.find(e=>e.id===a.case):void 0;i=a?{key:e,title:a.kind===`test`?o?.name||a.case||a.id:a.kind===`page`?`Page object ${a.page||``}`.trim():`Set-up`,sub:`${Gt(a)}, ${a.target} (${a.id})`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:en[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var Pn=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function Fn({d:e,events:t,running:r}){let i=(0,Z.useRef)(null),a=(0,Z.useRef)(!0),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(`all`),[u,d]=(0,Z.useState)({}),f=Nn(t,e),p=o.trim().toLowerCase(),m=e=>(c===`all`||e.kind===c)&&(!p||e.text.toLowerCase().includes(p)),h=c!==`all`||!!p,g=f.map(e=>({...e,lines:e.events.filter(m),matchTitle:!!p&&`${e.title} ${e.sub}`.toLowerCase().includes(p)})).map(e=>({...e,lines:e.matchTitle?e.events.filter(e=>c===`all`||e.kind===c):e.lines})).filter(e=>e.lines.length),_=e=>t.filter(t=>t.kind===e).length,v=f[f.length-1]?.key;return(0,Z.useEffect)(()=>{r&&!h&&a.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[t.length,r,h]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Re,{id:`tosca-activity-search`,label:`Find a line`,value:o,onChange:s,placeholder:`Find a line, test case or file`}),(0,Q.jsx)(Pe,{items:[{id:`all`,label:`All`,n:t.length},{id:`fail`,label:`Failed`,n:_(`fail`),alert:!0},{id:`ok`,label:`Done`,n:_(`ok`)},{id:`info`,label:`Info`,n:_(`info`)},{id:`agent`,label:`Agent`,n:_(`agent`)},{id:`tool`,label:`Tools`,n:_(`tool`)}],value:c,onChange:l})]}),(0,Q.jsxs)(`div`,{ref:i,role:`log`,"aria-live":r?`polite`:void 0,"aria-label":`Activity`,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:`flex max-h-[60vh] flex-col overflow-y-auto border-y border-line-soft`,children:[g.map(e=>{let t=e.events.filter(e=>e.kind===`fail`).length,i=u[e.key]??(h||t>0||r&&e.key===v),a=`act-${e.key.replace(/[^A-Za-z0-9_-]/g,`-`)}`,o=e.status?Ut[e.status]:void 0;return(0,Q.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":a,onClick:()=>d(t=>({...t,[e.key]:!i})),className:`flex w-full min-w-0 cursor-pointer items-center gap-4 border-0 bg-transparent px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,Q.jsx)(n,{size:15,"aria-hidden":`true`,className:H(`flex-none text-muted transition-transform`,i&&`rotate-180`)}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-muted`,children:e.sub})]}),(0,Q.jsxs)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:[h&&e.lines.length!==e.events.length?`${e.lines.length} of ${X(e.events.length,`line`)}`:X(e.events.length,`line`),t>0&&(0,Q.jsxs)(`span`,{className:`text-fail`,children:[`, `,t,` failed`]})]}),o&&(0,Q.jsx)(Ne,{tone:o.tone,children:o.label})]}),(0,Q.jsx)(Xe,{open:i,id:a,children:(0,Q.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:e.lines.map((e,t)=>{let n=Mn[e.kind];return(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft py-2 pr-4 pl-12 text-[13px] last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:`w-[76px] flex-none text-[13px] whitespace-nowrap text-muted tabular-nums`,children:Pn(e.ts)}),(0,Q.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:H(`mt-1 flex-none`,n.cls)}),(0,Q.jsx)(`span`,{className:H(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:e.kind===`tool`?`font-mono text-[13px] text-muted`:`text-ink-2`),children:e.text})]},t)})})})]},e.key)}),!g.length&&(0,Q.jsx)(`p`,{className:`m-0 px-4 py-8 text-center text-sm text-muted`,children:t.length?`No line matches.`:`Nothing yet.`})]})]})}function In({id:e,plan:t,tab:n=`overview`}){let[r,i]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(n),u=t=>{l(t),history.replaceState(null,``,B(`migration`,...t===`overview`?[e]:[e,t]))},[m,h]=(0,Z.useState)(),[g,_]=(0,Z.useState)(null),[v,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)([]),[w,T]=(0,Z.useState)(!1),[ee,te]=(0,Z.useState)(!1),[E,ne]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(!1),[ie,F]=(0,Z.useState)(!1),[I,ae]=(0,Z.useState)(!1),oe=(0,Z.useRef)(0),L=(0,Z.useCallback)(()=>{U.detail(e).then(e=>{i(e),s(``)},e=>s(e.message));let t=oe.current;U.events(e,t).then(e=>{if(e.next<oe.current){oe.current=0,C([]);return}let t=oe.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));oe.current=e.next,n.length&&C(e=>[...e,...n].slice(-2e3))},()=>{})},[e]);(0,Z.useEffect)(L,[L]);let R=!!(r?.job?.running||r?.result?.status===`running`);(0,Z.useEffect)(()=>{if(!R)return;let e=rt(L,1500);return()=>Qe(e)},[R,L]);let[ce,le]=(0,Z.useState)(``),z=(0,Z.useRef)(R);(0,Z.useEffect)(()=>{if(z.current&&!R&&r){let e=r.plan.units.filter(e=>e.kind===`test`).length,t=(r.result?.units||[]).filter(e=>e.kind===`test`&&e.status===`converted`).length;le(`The conversion ${r.result?.status===`stopped`?`stopped`:r.result?.status===`failed`?`failed`:`finished`}: ${t} of ${e} test${e===1?``:`s`} pass.`)}R&&le(``),z.current=R},[R,r]);let ue=(0,Z.useCallback)(e=>{i(e),s(``),u(`overview`),setTimeout(L,800)},[L]),de=async e=>{T(!0),s(``);try{i(await e()),setTimeout(L,800)}catch(e){s(e.message)}finally{T(!1)}};if(!r)return o?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let fe=yn(r),pe=Bt(r.plan,r.result),V=r.result,ge=(V?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,_e=r.plan.cases.filter(e=>e.included).length,ve=[{id:`overview`,label:`Overview`,icon:me},{id:`steps`,label:`Steps`,icon:re,n:_e?String(_e):void 0},...ge||c===`errors`?[{id:`errors`,label:`Errors`,icon:f,n:ge?String(ge):void 0,tone:ge?`text-fail`:void 0}]:[],{id:`activity`,label:`Activity`,icon:k}];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:bn(r.plan.source.file)}),(0,Q.jsx)(he,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(St,{framework:r.plan.target.id.split(`-`)[0],language:r.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),r.plan.target.title]})]}),(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted`,children:[(0,Q.jsxs)(`span`,{children:[`From Tricentis Tosca`,r.plan.source.project?`, ${r.plan.source.project}`:``]}),(0,Q.jsxs)(`span`,{children:[`Into `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:r.plan.target.dir})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Ne,{tone:fe.tone,children:fe.label}),R?(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,onClick:()=>void de(()=>U.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the conversion`,className:`text-fail hover:text-fail`,children:(0,Q.jsx)(se,{fill:`currentColor`,"aria-hidden":`true`})}):(0,Q.jsxs)(Q.Fragment,{children:[V&&(V.status===`stopped`||V.status===`failed`)&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,onClick:()=>ae(!0),"aria-label":`Start again`,"data-tip":`Start again: tests it already wrote are kept`,children:(0,Q.jsx)(d,{"aria-hidden":`true`})}),V&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,onClick:()=>location.hash=B(`migration`,e,`report`),"aria-label":`Report`,"data-tip":`Report`,children:(0,Q.jsx)(P,{"aria-hidden":`true`})}),V&&r.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,onClick:()=>void de(()=>U.verify(e)),"aria-label":`Run the tests`,"data-tip":`Run every converted test again, no agent`,children:(0,Q.jsx)(y,{"aria-hidden":`true`})}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:w,"aria-haspopup":`menu`,"aria-expanded":M,onClick:()=>N(!M),"aria-label":`More`,"data-tip":`More: re-import, CI, pull request, delete`,children:(0,Q.jsx)(ye,{"aria-hidden":`true`})}),(0,Q.jsxs)(vt,{open:M,onClose:()=>N(!1),label:`More for this conversion`,align:`end`,className:`w-[240px]`,children:[V&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ot,{onClick:()=>(N(!1),ne(!0)),children:[(0,Q.jsx)(p,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Re-import`]}),(0,Q.jsxs)(ot,{onClick:()=>(N(!1),j(!0)),children:[(0,Q.jsx)(Ce,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`CI`]}),(0,Q.jsxs)(ot,{onClick:()=>(N(!1),O(!0)),children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Pull request`]}),(0,Q.jsx)(`div`,{role:`separator`,className:`mx-2 my-1 border-t border-line-soft`})]}),(0,Q.jsxs)(ot,{onClick:()=>(N(!1),te(!0)),children:[(0,Q.jsx)(a,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-fail`}),(0,Q.jsx)(`span`,{className:`text-fail`,children:`Delete`})]})]})]})]})]})]}),E&&(0,Q.jsx)(xn,{d:r,onClose:()=>ne(!1)}),D&&(0,Q.jsx)(wn,{id:e,onClose:()=>O(!1)}),A&&(0,Q.jsx)(Cn,{id:e,onClose:()=>j(!1)}),I&&(0,Q.jsx)(sn,{plan:r.plan,acceptLimits:!1,again:!0,onClose:()=>ae(!1),onStarted:e=>{ae(!1),i(e)}}),ie&&r.result?.batch&&(0,Q.jsx)(sn,{plan:r.plan,acceptLimits:!1,next:r.result.batch,onClose:()=>F(!1),onStarted:e=>{F(!1),i(e)}}),ee&&(0,Q.jsx)(Tn,{id:e,title:`${bn(r.plan.source.file)} → ${r.plan.target.title}`,targetDir:r.plan.target.dir,onClose:()=>te(!1)}),(0,Q.jsxs)(`div`,{className:H(`grid grid-cols-[minmax(0,1fr)] items-start gap-6`,V&&`@3xl:grid-cols-[minmax(220px,260px)_minmax(0,1fr)] @3xl:gap-10`),children:[V&&(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6 @3xl:border-r @3xl:border-line-soft @3xl:pr-8 @3xl:pb-8`,children:(0,Q.jsx)(jt,{label:`Conversion stages`,items:tn(V.stages),...R?{progress:pe}:{}})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:ce}),o&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),(0,Q.jsx)(it,{prefix:`mtab`,className:`mb-0`,tabs:ve,current:c,onPick:u,label:`Tosca conversion`}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${c}`,"aria-labelledby":`mtab-${c}`,className:`pane-swap flex min-w-0 flex-col gap-4`,children:[c===`overview`&&(0,Q.jsx)(jn,{d:r,planView:t(r,ue),busy:w||R,onFix:_,onSteps:e=>(h(e),u(`steps`)),onOutput:x,onRun:t=>void de(()=>U.verify(e,t)),onNext:()=>F(!0),onErrors:()=>u(`errors`)}),c===`errors`&&(0,Q.jsx)(An,{d:r,busy:w||R,onFix:_,onSteps:e=>(h(e),u(`steps`)),onOutput:x}),c===`steps`&&(0,Q.jsx)($t,{id:e,plan:r.plan,result:V,initial:m}),c===`activity`&&(0,Q.jsx)(Fn,{d:r,events:S,running:R})]},c)]})]}),v&&(0,Q.jsx)(Dn,{d:r,unit:v,onClose:()=>x(null)}),g&&(0,Q.jsx)(En,{d:r,unit:g,onClose:()=>_(null),onSend:t=>{_(null),de(()=>U.fix(e,[g],t))}})]})}var Ln=e=>e.slice(e.lastIndexOf(`/`)+1),Rn=50,zn=[{id:`failed`,label:`Failed`,bar:`bg-fail`,open:!0},{id:`attention`,label:`Needs a look`,bar:`bg-warn`,open:!0},{id:`passed`,label:`Passed`,bar:`bg-pass`,open:!1},{id:`notrun`,label:`Not run`,bar:`bg-line-strong`,open:!1},{id:`leftout`,label:`Left out`,bar:`bg-line`,open:!1}];function Bn(e){return e===`converted`?Ut.converted:e===`failed`?Ut.failed:e===`blocked`?Ut.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?Ut.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function Vn(e){for(let t of qt){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function Hn({planId:e,unit:t,file:n}){let r=/\.(webm|mp4)$/i.test(n),[i,a]=(0,Z.useState)(!r),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{if(!i)return;let r=!1;return s(``),l(!1),U.evidence(e,t,n).then(e=>!r&&s(e),()=>!r&&l(!0)),()=>{r=!0}},[e,t,n,i]),(0,Q.jsxs)(`li`,{className:H(`flex min-w-0 flex-col gap-2`,r&&`@xl:col-span-2`),children:[o?r?(0,Q.jsx)(`video`,{controls:!0,autoPlay:!0,src:o,className:`aspect-video w-full rounded-[12px] bg-ink`}):(0,Q.jsx)(`img`,{src:o,alt:`Screenshot ${n}`,className:`w-full rounded-[12px] border border-line-soft object-contain`}):r&&!i?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>a(!0),"aria-label":`Play ${n}`,className:`group flex aspect-video w-full cursor-pointer items-center justify-center rounded-[12px] border-0 bg-surface-strong hover:bg-line`,children:(0,Q.jsx)(`span`,{className:`inline-flex size-16 items-center justify-center rounded-full bg-bg shadow-md transition-transform group-hover:scale-105`,children:(0,Q.jsx)(y,{size:24,"aria-hidden":`true`,className:`ml-1 text-ink`})})}):(0,Q.jsx)(`span`,{role:`status`,className:H(`flex items-center justify-center rounded-[12px] bg-surface-strong text-[13px] text-muted`,r?`aspect-video`:`h-[160px]`),children:c?`Not available`:`Loading…`}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:n})]})}function Un({planId:e,pick:t,video:n}){let[i,a]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let n=!1;return a(null),c(``),U.reportCase(e,t.case).then(e=>!n&&a(e),e=>!n&&c(e.message)),()=>{n=!0}},[e,t.case]);let l=Bn(t.status),u=t.group===`failed`||t.group===`attention`,d=qn[t.group];return(0,Q.jsxs)(`section`,{"aria-label":`Test case ${t.name}`,className:`@container flex min-w-0 flex-col gap-8`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,Q.jsx)(d.icon,{size:24,"aria-label":d.label,className:H(`translate-y-0.5 flex-none`,d.tone)}),(0,Q.jsx)(`h3`,{className:`m-0 min-w-0 flex-1 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t.name}),(0,Q.jsx)(Ne,{tone:l.tone,children:l.label}),t.ms>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-muted tabular-nums`,children:[(0,Q.jsx)(be,{size:14,"aria-hidden":`true`}),Tt(t.ms)]})]}),(0,Q.jsxs)(`ul`,{"aria-label":`About this test case`,className:`m-0 flex list-none flex-wrap gap-x-6 gap-y-2 p-0 text-[13px] text-ink-2`,children:[(0,Q.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(I,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`File`}),(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.file||`No file`})]}),t.suites.length>0&&(0,Q.jsxs)(`li`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(ie,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Suite`}),t.suites.join(`, `)]}),t.folders.length>0&&(0,Q.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(r,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Folder`}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.folders.join(` / `)})]}),t.uid&&(0,Q.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(O,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Tosca id`}),(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.uid})]}),t.change&&(0,Q.jsx)(`li`,{className:`inline-flex items-center gap-2 text-muted`,children:Wn[t.change]})]})]}),s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),!i&&!s&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),i&&(0,Q.jsxs)(Q.Fragment,{children:[(i.problems?.length||i.reason)&&(0,Q.jsx)(Kt,{icon:u?o:ve,title:u?`What went wrong`:`What happened`,children:(0,Q.jsx)(`div`,{className:H(`flex flex-col gap-2 rounded-[12px] px-4 py-4 text-[13px] leading-relaxed [overflow-wrap:anywhere]`,u?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:(i.problems?.length?i.problems:[i.reason]).map((e,t)=>(0,Q.jsx)(`p`,{className:`m-0`,children:e},t))})}),(0,Q.jsx)(Kt,{icon:S,title:n?`Recording`:`Screenshots`,children:i.media.length>0?(0,Q.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-4 p-0 @xl:grid-cols-2`,children:i.media.map(t=>(0,Q.jsx)(Hn,{planId:e,unit:i.unit,file:t},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:i.unit&&i.group!==`notrun`?u?`No screenshot${n?` or video`:``} was kept for this failure.`:n?`No video was kept for this run.`:`No screenshot: the test passed.`:`Not run, so nothing was recorded.`})}),i.fidelity&&i.fidelity.rows.length>0&&(0,Q.jsx)(Kt,{icon:fe,title:`Tosca steps`,aside:`${i.fidelity.matched} of ${i.fidelity.required} in the test`,children:(0,Q.jsx)(tt,{label:`Tosca steps`,placeholder:`Find a step`,resetKey:t.case,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-14`),children:`Step`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`What it does`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`In the test`})]}),children:i.fidelity.rows.map(e=>{let t=Vt[e.status]||Vt.matched;return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`font-mono text-[13px] text-muted`),children:e.id}),(0,Q.jsxs)(`td`,{className:H(`px-4 py-2`,`[overflow-wrap:anywhere]`),children:[e.kind===`assert`?`check ${e.op}`:e.op,e.element?` on ${e.element}`:``,e.step&&(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca “`,e.step,`”`]})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`whitespace-nowrap`),children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-2 flex-none rounded-full`,t.dot)}),t.label]})})]},e.id)})})}),(i.command||i.output)&&(0,Q.jsx)(Kt,{icon:de,title:`How it ran`,children:(0,Q.jsx)(Zt,{label:`How the test ran`,className:`max-h-[50vh]`,files:[...i.output?[{name:`Output`,code:i.output,log:!0}]:[],...i.command?[{name:`Command`,code:`$ ${i.command}`,lang:`bash`}]:[]]})})]})]})}var Wn={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},Gn=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function Kn(e){let t=[`Tosca id`,`Test case`,`Tosca path`,`Status`,`Test file`,`Steps in the test`,`Change`,`Execution lists`],n=e.tests.map(t=>[t.uid||``,t.name,[...t.folders,t.name].join(` / `),Bn(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?Wn[t.change]:``,t.suites.join(`; `)]);for(let t of e.removed)n.push([t.uid||``,t.name,t.name,`Removed from Tosca`,t.file||``,``,``,``]);let r=[t,...n].map(e=>e.map(Gn).join(`,`)).join(`\r
|
|
6
|
+
`),i=URL.createObjectURL(new Blob([`${r}\r\n`],{type:`text/csv;charset=utf-8`})),a=document.createElement(`a`);a.href=i,a.download=`tosca-${e.id}-traceability.csv`,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}var qn={failed:{icon:f,tone:`text-fail`,label:`Failed`},attention:{icon:o,tone:`text-warn`,label:`Needs a look`},passed:{icon:h,tone:`text-pass`,label:`Passed`},notrun:{icon:v,tone:`text-muted`,label:`Not run`},leftout:{icon:ne,tone:`text-muted`,label:`Left out`}};function Jn({rows:e,pick:t,onPick:n}){let r=()=>Math.max(0,Math.floor(e.findIndex(e=>e.case===t)/Rn)),[i,a]=(0,Z.useState)(r);(0,Z.useEffect)(()=>a(r()),[e.length]);let o=e.slice(i*Rn,i*Rn+Rn);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>{let r=qn[e.group],i=t===e.case;return(0,Q.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>n(e),className:H(`relative flex w-full min-w-0 cursor-pointer items-start gap-2 overflow-hidden rounded-[10px] border-0 px-4 py-2 text-left`,i?`bg-surface-strong`:`bg-transparent hover:bg-surface-muted`),children:[i&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-1 bg-accent`}),(0,Q.jsx)(r.icon,{size:16,"aria-label":r.label,className:H(`translate-y-0.5 flex-none`,r.tone)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-[13px] text-muted`,children:e.file||`No file`}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-4 text-[13px] text-muted tabular-nums`,children:[e.fidelity&&(0,Q.jsxs)(`span`,{children:[e.fidelity.matched,`/`,e.fidelity.required,` steps`]}),e.ms>0&&(0,Q.jsx)(`span`,{children:Tt(e.ms)}),e.media>0&&(0,Q.jsx)(`span`,{children:X(e.media,`file`)})]}),e.note&&e.group!==`passed`&&(0,Q.jsx)(`span`,{className:H(`line-clamp-2 text-[13px]`,e.group===`failed`?`text-fail`:`text-ink-2`),children:e.note})]})]})},e.case)})}),e.length>Rn&&(0,Q.jsx)(Me,{page:i,size:Rn,total:e.length,onPage:a,label:`Test case pages`})]})}function Yn({id:e,caseId:t}){let[r,i]=(0,Z.useState)(null),[a,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!0),[u,d]=(0,Z.useState)(`all`),[f,p]=(0,Z.useState)(``),[m,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(t?`cases`:`summary`),[C,w]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{l(!0),U.report(e).then(e=>{if(i(e.report),s(e.report?``:`No report yet. Start the conversion first.`),l(!1),e.report){let n=t&&e.report.tests.find(e=>e.case===t)||e.report.tests.find(e=>e.group===`failed`||e.group===`attention`)||e.report.tests.find(e=>e.group!==`leftout`);g(n?n.case:``)}},e=>{s(e.message),l(!1)})},[e]),(0,Z.useEffect)(()=>{m&&history.replaceState(null,``,B(`migration`,e,`report`,encodeURIComponent(m)))},[e,m]);let T=f.trim().toLowerCase(),ee=(0,Z.useMemo)(()=>{let e={failed:[],attention:[],passed:[],notrun:[],leftout:[]};for(let t of r?.tests||[])u!==`all`&&t.group!==u||T&&!`${t.name} ${t.file} ${t.case} ${t.note||``} ${t.suites.join(` `)} ${t.folders.join(` `)}`.toLowerCase().includes(T)||e[t.group].push(t);return e},[r,u,T]),E=async t=>{v(t),w(``);try{let n=await(t===`zip`?U.reportZip(e):U.reportHtml(e)),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`tosca-${e}.${t}`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){w(e.message)}finally{v(``)}};if(c)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading report…`});if(a||!r)return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a||`No report.`})});let ne=Qt[r.status]||{label:r.status,tone:`neutral`},[D,...O]=r.target.id.split(`-`),k=Vn(r.stages),A=r.tests.length-r.counts.leftout,j=r.tests.find(e=>e.case===m)||null,re=zn.reduce((e,t)=>e+ee[t.id].length,0),ie=r.tests.filter(e=>e.group===`failed`||e.group===`attention`),P=e=>(g(e.case),S(`cases`)),F=r.status===`running`?{tone:`running`,text:`Converting: ${r.counts.passed} of ${A} test cases pass so far.`}:ie.length===0&&r.counts.passed===A&&A>0?{tone:`pass`,text:`All ${A===1?``:`${A} `}Tosca test case${A===1?``:`s`} became passing ${r.target.title} tests.`}:{tone:r.counts.failed?`fail`:`warn`,text:`${r.counts.passed} of ${A} test cases pass${[r.counts.failed?`${r.counts.failed} failed`:``,r.counts.attention?`${r.counts.attention} need${r.counts.attention===1?`s`:``} a look`:``,r.counts.notrun?`${r.counts.notrun} not run`:``].filter(Boolean).map((e,t)=>t?`, ${e}`:`; ${e}`).join(``)}.`},I=F.tone===`pass`?h:F.tone===`running`?ge:o,ae=[{id:`summary`,label:`Summary`,icon:me},{id:`cases`,label:`Test cases`,icon:te,n:r.tests.length},{id:`coverage`,label:`Coverage`,icon:le},{id:`trace`,label:`Traceability`,icon:M}];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`h2`,{className:`m-0 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:`Conversion report`}),(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:Ln(r.source.file)}),(0,Q.jsx)(he,{size:14,"aria-hidden":`true`,className:`text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(St,{framework:D,language:O.join(`-`),size:14}),r.target.title]})]})]}),(0,Q.jsx)(Ne,{tone:ne.tone,children:ne.label}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsxs)(K,{variant:`ghost`,disabled:!!_,"aria-haspopup":`menu`,"aria-expanded":y,onClick:()=>b(!y),children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),_===`html`?`Making the report…`:_===`zip`?`Making the zip…`:`Export`,(0,Q.jsx)(n,{"aria-hidden":`true`})]}),(0,Q.jsxs)(vt,{open:y,onClose:()=>b(!1),label:`Export this report`,align:`end`,className:`w-[280px]`,children:[(0,Q.jsxs)(ot,{onClick:()=>(b(!1),void E(`html`)),children:[(0,Q.jsx)(xe,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`HTML report, screenshots inside`]}),(0,Q.jsxs)(ot,{onClick:()=>(b(!1),r.status===`running`?w(`The zip is made when the run ends.`):void E(`zip`)),children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Zip with videos`]}),(0,Q.jsxs)(ot,{onClick:()=>(b(!1),Kn(r)),children:[(0,Q.jsx)(N,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Traceability CSV, for Tosca`]})]})]})]}),C&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:C}),(0,Q.jsx)(it,{prefix:`rtab`,className:`mb-0`,tabs:ae,current:x,onPick:S,label:`Report`}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${x}`,"aria-labelledby":`rtab-${x}`,className:`pane-swap flex min-w-0 flex-col gap-8`,children:[x===`summary`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{"aria-label":`Outcome`,className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:H(`m-0 flex items-start gap-4 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,F.tone===`pass`?`text-ink`:F.tone===`fail`?`text-fail`:`text-ink`),children:[(0,Q.jsx)(I,{size:24,"aria-hidden":`true`,className:H(`translate-y-0.5 flex-none`,F.tone===`pass`?`text-pass`:F.tone===`fail`?`text-fail`:F.tone===`warn`?`text-warn`:`text-ink motion-safe:animate-spin`)}),F.text]}),(0,Q.jsx)(At,{label:`The conversion`,from:{framework:`tosca`,title:`Tosca${r.source.project?`, ${r.source.project}`:``}`,sub:r.source.file},to:{framework:D,language:O.join(`-`),title:r.target.title,sub:`Into ${r.target.dir}/`}}),(0,Q.jsxs)(Ze,{label:`The run in numbers`,children:[(0,Q.jsx)(Ye,{label:`Passed`,value:`${r.counts.passed} of ${A}`,tone:r.counts.passed===A?`text-pass`:void 0,note:r.counts.leftout?`${r.counts.leftout} left out of the plan`:`Every test case in the plan`}),(0,Q.jsx)(Ye,{label:`Tosca steps kept`,value:r.steps.required?`${Math.round(r.steps.matched/r.steps.required*100)}%`:`—`,note:r.steps.required?`${r.steps.matched} of ${r.steps.required} steps and checks`:`No steps to keep`}),(0,Q.jsx)(Ye,{label:`Time`,value:Tt(r.ms),note:`Started ${kt(r.startedAt)}`}),(0,Q.jsx)(Ye,{label:`Model cost`,value:r.cost?`${r.cost.estimate?`~`:``}${ft(r.cost.amount,r.cost.currency)}`:`—`,note:[r.model||`Model not recorded`,r.usage.input||r.usage.output?`${ht(r.usage.input+r.usage.output)} tokens`:``].filter(Boolean).join(`, `)})]})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-attention`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-attention`,className:`m-0 text-[16px] font-semibold`,children:`Needs your attention`}),k&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`The run stopped in `,en[k.id],k.note?`: ${k.note}`:`.`]}),ie.length===0&&!r.personSteps?(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(h,{size:16,"aria-hidden":`true`,className:`text-pass`}),`Nothing needs attention: every test case that ran passed, with its Tosca steps kept.`]}):(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[ie.map(e=>(0,Q.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>P(e),className:`flex w-full cursor-pointer items-start gap-4 border-0 bg-transparent py-4 text-left hover:bg-surface-muted`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`,className:H(`translate-y-0.5 flex-none`,e.group===`failed`?`text-fail`:`text-warn`)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-semibold text-ink`,children:e.name}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.note||Bn(e.status).label})]}),(0,Q.jsx)(he,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-muted`})]})},e.case)),r.personSteps>0&&(0,Q.jsxs)(`li`,{className:`flex items-start gap-4 py-4 text-[13px] text-ink-2`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-warn`}),X(r.personSteps,`Tosca step`),` could not be automated and `,r.personSteps===1?`is`:`are`,` left for a person: see Coverage.`]})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-8 @3xl:grid-cols-2`,children:[(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-written`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-written`,className:`m-0 text-[16px] font-semibold`,children:`What was written`}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-[13px]`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Tests`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-ink`,children:[X(A,`test file`),` in `,(0,Q.jsxs)(`span`,{className:`font-mono`,children:[r.target.dir,`/`]})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Page objects`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink`,children:r.pages.length?X(r.pages.length,`page`):`None`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Media`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink`,children:r.media?X(r.media,`file`):r.target.video?`Videos and failure screenshots`:`Failure screenshots`}),r.reverted.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-ink`,children:[X(r.reverted.length,`edit`),` outside the target folder`]})]})]})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-needs`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-needs`,className:`m-0 text-[16px] font-semibold`,children:`What the tests need to run`}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-[13px]`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`App`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:r.source.baseUrl||`Not named`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Variables`}),(0,Q.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:r.env.length?r.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `):`None`})]})]})]}),(r.previous||r.removed.length>0)&&(0,Q.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-strong px-4 py-4 text-[13px] leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:[r.previous?(0,Q.jsxs)(Q.Fragment,{children:[`Re-imported from `,(0,Q.jsx)(`a`,{href:B(`migration`,r.previous,`report`),children:r.previous}),`: `,r.tests.filter(e=>e.change===`same`).length,` unchanged (their tests kept), `,r.tests.filter(e=>e.change===`changed`).length,` changed, `,r.tests.filter(e=>e.change===`new`).length,` new.`,` `]}):null,r.removed.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[X(r.removed.length,`test case`),` no longer in the exports; their tests are left as they are.`]})]}),r.notes.trim()&&(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-notes`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`rep-notes`,className:`m-0 text-[16px] font-semibold`,children:`Notes from the conversion`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:r.notes.trim()})]})]}),x===`cases`&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(300px,360px)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(Re,{id:`tosca-report-search`,label:`Find a test case`,value:f,onChange:p,placeholder:`Find a test case, file or problem`,className:`max-w-none flex-none`}),(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex flex-wrap gap-1`,children:(0,Q.jsx)(Pe,{items:[{id:`all`,label:`All`,n:r.tests.length},...zn.filter(e=>r.counts[e.id]>0).map(e=>({id:e.id,label:e.label,n:r.counts[e.id],alert:e.id===`failed`}))],value:u,onChange:d})}),(0,Q.jsx)(`nav`,{"aria-label":`Test cases`,className:`flex min-w-0 flex-col overscroll-contain @5xl:max-h-[min(70vh,760px)] @5xl:overflow-y-auto`,children:re?(0,Q.jsx)(Jn,{rows:zn.flatMap(e=>ee[e.id]),pick:m,onPick:e=>g(e.case)}):(0,Q.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-sm text-muted`,children:`No test case matches.`})})]}),(0,Q.jsx)(`div`,{className:`min-w-0 @5xl:sticky @5xl:top-4`,children:j?(0,Q.jsx)(`div`,{className:`pane-swap`,children:(0,Q.jsx)(Un,{planId:r.id,pick:j,video:r.target.video})},j.case):(0,Q.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-sm text-muted`,children:`Pick a test case to see its steps, output and media.`})})]}),x===`coverage`&&(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-cov`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`h3`,{id:`rep-cov`,className:`m-0 text-[16px] font-semibold`,children:`How much of each Tosca test case is in its test`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:`Every Tosca step and check should be in the converted test. A short bar means steps are missing or left for a person.`})]}),(0,Q.jsx)(tt,{label:`Coverage by test case`,placeholder:`Find a test case`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Tosca steps in the test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Result`})]}),children:r.tests.filter(e=>e.group!==`leftout`).map(e=>{let t=e.fidelity,n=t&&t.required?t.matched/t.required*100:0;return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>P(e),className:`cursor-pointer border-0 bg-transparent p-0 text-left text-[13px] font-medium text-ink hover:underline`,children:e.name})}),(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:t?(0,Q.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Ft,{value:n,tone:n===100?`bg-pass`:n>=80?`bg-warn`:`bg-fail`,label:`${e.name}: ${t.matched} of ${t.required} Tosca steps`})}),(0,Q.jsxs)(`span`,{className:`w-16 flex-none text-right text-[13px] tabular-nums text-ink-2`,children:[t.matched,`/`,t.required]})]}):(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not checked`})}),(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(Ne,{tone:Bn(e.status).tone,children:Bn(e.status).label})})]},e.case)})})]}),x===`trace`&&(0,Q.jsxs)(`section`,{"aria-labelledby":`rep-trace`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`h3`,{id:`rep-trace`,className:`m-0 text-[16px] font-semibold`,children:`Each Tosca test case and what it became`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:`By its Tosca id and path, for audits and for Tosca itself. Export gives the same as a CSV.`})]}),(0,Q.jsx)(K,{variant:`icon`,size:`icon`,onClick:()=>Kn(r),"aria-label":`Download as CSV`,"data-tip":`Download as CSV`,children:(0,Q.jsx)(z,{"aria-hidden":`true`})})]}),(0,Q.jsx)(tt,{label:`Traceability`,placeholder:`Find a Tosca id, test case or file`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Tosca test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Test file`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Result`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @3xl:table-cell`),children:`Execution lists`})]}),children:r.tests.map(e=>(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium text-ink`,children:e.name}),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.folders.join(` / `)||`—`}),e.uid&&(0,Q.jsx)(`span`,{className:`block font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.uid})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`),children:e.file||`—`}),(0,Q.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,Q.jsx)(Ne,{tone:Bn(e.status).tone,children:Bn(e.status).label}),e.change&&(0,Q.jsx)(`span`,{className:`mt-1 block text-[13px] text-muted`,children:Wn[e.change]})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:e.suites.join(`, `)||`—`})]},e.case))})]})]},x)]})}var Xn={converted:{icon:h,cls:`text-pass`,label:`Converted`},partly:{icon:c,cls:`text-warn`,label:`Converted, with steps for a person`},not:{icon:f,cls:`text-muted`,label:`Not converted`}},Zn=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function Qn(e,t,n){let r=[[`Test case id`,`Test case`,`Kind`,`What happens`,`Modules behind it`].map(Zn).join(`,`)];for(let n of e.rows)for(let e of n.cases)r.push([e,t.get(e)||e,n.label,Xn[n.outcome].label,n.modules.map(e=>e.name).join(`; `)].map(Zn).join(`,`));let i=URL.createObjectURL(new Blob([`${r.join(`\r
|
|
7
|
+
`)}\r\n`],{type:`text/csv;charset=utf-8`})),a=document.createElement(`a`);a.href=i,a.download=n,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function $n({coverage:e,names:t,file:r,folded:i=!1}){let a=e.converted+e.partly,[o,s]=(0,Z.useState)(!i),c=(0,Z.useId)();return(0,Q.jsx)(We,{id:`tsc-coverage`,level:3,icon:le,title:`What can be migrated`,description:(0,Q.jsxs)(`span`,{className:`text-ink-2`,children:[a,` of `,e.total,` test case`,e.total===1?``:`s`,e.partly?`, ${e.partly} of them with steps for a person`:``,`; `,e.not,` not`]}),actions:(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,"aria-expanded":o,"aria-controls":c,onClick:()=>s(!o),children:[(0,Q.jsx)(n,{"aria-hidden":`true`,className:H(`transition-transform`,o&&`rotate-180`)}),o?`Hide the breakdown`:`Show the breakdown`]}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>Qn(e,t,r),"data-tip":`Every test case with its kind and what happens to it, for a spreadsheet.`,children:[(0,Q.jsx)(z,{"aria-hidden":`true`}),`CSV`]})]}),children:(0,Q.jsx)(Xe,{open:o,id:c,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-[13px]`,children:e.rows.map(e=>{let t=Xn[e.outcome];return(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsx)(t.icon,{size:16,role:`img`,"aria-label":t.label,className:H(`mt-1 flex-none`,t.cls)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-ink`,children:e.label}),(0,Q.jsx)(`span`,{className:`tabular-nums text-ink-2`,children:e.cases.length===1?`1 test case`:`${e.cases.length} test cases`})]}),(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.becomes}),e.modules.length>0&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Because of: `,e.modules.slice(0,4).map(e=>`${e.name}${e.engine?` (${e.engine})`:``} in ${e.cases}`).join(`, `),e.modules.length>4?`, and ${e.modules.length-4} more`:``]}),e.reasons&&e.reasons.length>0&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Steps left: `,e.reasons.slice(0,3).map(e=>`${e.count}× ${e.reason}`).join(`, `),e.reasons.length>3?`, and ${e.reasons.length-3} more`:``]})]})]},e.kind)})})})})}var er={ok:{icon:h,cls:`text-pass`,label:`Ready`},answer:{icon:c,cls:`text-warn`,label:`Needs an answer`},blocker:{icon:f,cls:`text-fail`,label:`Blocks the start`}};function tr({planId:e,stamp:t,busy:n,open:r,onChanged:i,onAccept:a,acceptTip:o}){let[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{U.data(e).then(e=>{c(e),g(``)},e=>g(e.message))},[e,t]);let _=async t=>{m(!0),g(``);try{c(await U.setData(e,t)),u(``),f(``),i()}catch(e){g(e.message)}finally{m(!1)}},v=n||p,y=s?[...new Set(s.cases.flatMap(e=>e.missing))]:[];return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[s&&s.sources.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:s.sources.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.file}),e.sheet?` (sheet ${e.sheet})`:``,`: `,X(e.rows,`row`),e.transposed?`, attributes down the first column`:``]}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.file}${e.sheet?`, sheet ${e.sheet}`:``}`,disabled:v,onClick:()=>void _({remove:t}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Remove`})]},`${e.file}\u0000${e.sheet||``}`))}),s&&y.length>0&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Not found yet: `,(0,Q.jsx)(`span`,{className:`font-mono`,children:y.slice(0,12).join(`, `)}),y.length>12?` and ${y.length-12} more`:``]}),r&&(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),l&&_({file:l,...d.trim()?{sheet:d.trim()}:{}})},children:[(0,Q.jsxs)(ke,{size:`sm`,"aria-label":`A data file of the project`,value:l,disabled:v||!s,onChange:e=>u(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Q.jsx)(`option`,{value:``,children:s&&!s.files.length?`No CSV, TSV, Excel or JSON file in the project`:`A data file of the project…`}),(s?.files||[]).map(e=>(0,Q.jsx)(`option`,{value:e.path,children:e.path},e.path))]}),/\.xls[xm]$/i.test(l)&&(0,Q.jsx)(W,{size:`sm`,"aria-label":`Sheet, the first if empty`,placeholder:`Sheet, the first if empty`,value:d,onChange:e=>f(e.target.value),disabled:v,className:`min-w-0 flex-[1_1_160px]`}),(0,Q.jsx)(K,{size:`sm`,type:`submit`,disabled:v||!l,children:`Use it`}),a&&(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:v,onClick:a,"data-tip":o,children:`Leave them for a person`})]}),h&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail`,children:h})]})}function nr({r:e,busy:t,onAnswer:n}){let[r,i]=(0,Z.useState)(``),a=String(e.environments.findIndex(t=>t.environment===e.answers.environment&&t.app===e.answers.app));return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[e.environments.length>0&&(0,Q.jsxs)(ke,{size:`sm`,"aria-label":`An app of env.yaml`,value:a,disabled:t,onChange:t=>{let r=e.environments[Number(t.target.value)];r&&n({environment:r.environment,app:r.app})},className:`w-auto max-w-[320px]`,children:[(0,Q.jsx)(`option`,{value:`-1`,children:`An app of env.yaml…`}),e.environments.map((e,t)=>(0,Q.jsxs)(`option`,{value:String(t),children:[e.app,` on `,e.environment,`: `,e.url]},`${e.environment}\u0000${e.app}`))]}),(0,Q.jsxs)(`form`,{className:`flex min-w-0 flex-[1_1_280px] gap-2`,onSubmit:e=>{e.preventDefault(),r.trim()&&n({baseUrl:r.trim()})},children:[(0,Q.jsx)(W,{size:`sm`,type:`url`,"aria-label":`Or the address the tests start at`,placeholder:`Or the address, https://…`,value:r,onChange:e=>i(e.target.value),disabled:t,className:`min-w-0 flex-1`}),(0,Q.jsx)(K,{size:`sm`,type:`submit`,disabled:t||!r.trim(),children:`Use it`})]})]})}function rr({item:e,picked:t,busy:n,onPick:r}){let i=e.apps||[];return i.length?(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:(0,Q.jsxs)(ke,{size:`sm`,"aria-label":e.engine===`database`?`A database`:e.engine===`mobile`?`A mobile app`:`A desktop app`,value:t&&i.includes(t)?t:``,disabled:n,onChange:e=>e.target.value&&r(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Q.jsx)(`option`,{value:``,children:e.engine===`database`?`A database…`:e.engine===`mobile`?`A mobile app…`:`A desktop app…`}),i.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}):(0,Q.jsxs)(`p`,{className:`m-0 pt-1 text-[13px] text-muted`,children:[e.engine===`database`?`No databases yet: add one in `:`No ${e.engine} apps yet: add one in `,(0,Q.jsx)(`a`,{href:B(`settings`,e.engine===`database`?`databases`:`environments`),children:e.engine===`database`?`Settings, Databases`:`Settings, Environments`}),`.`]})}function ir({item:e,busy:t,secrets:n,onSaved:r,onAccept:i,onUse:a}){let[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(``),m=async()=>{d(!0),p(``);try{await De.saveSecrets({[e.name]:o}),s(``),r()}catch(e){p(e.message)}finally{d(!1)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o&&m()},children:[(0,Q.jsx)(W,{size:`sm`,type:e.secret?`password`:`text`,autoComplete:`off`,spellCheck:!1,"aria-label":`Value of ${e.name}`,placeholder:e.secret?`Its value, kept in the credential store`:`Its value`,value:o,onChange:e=>s(e.target.value),disabled:t||u,className:`min-w-0 flex-[1_1_220px]`}),(0,Q.jsx)(K,{size:`sm`,type:`submit`,disabled:t||u||!o,children:`Save`}),e.accept&&(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:t||u,onClick:i,"data-tip":e.accept,children:`Convert without it`})]}),n.length>0&&!e.uses&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`use-${e.name}`,className:`text-[13px] text-muted`,children:`Or use a saved secret`}),(0,Q.jsxs)(ke,{id:`use-${e.name}`,size:`sm`,value:c,disabled:t||u,onChange:e=>l(e.target.value),className:`w-auto min-w-[200px] font-mono`,children:[(0,Q.jsx)(`option`,{value:``,children:`A saved secret…`}),n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]}),(0,Q.jsx)(K,{size:`sm`,disabled:t||u||!c,onClick:()=>a(c),children:`Use it`})]}),f&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail`,children:f})]})}function ar({planId:e,onReady:t,onCoverage:n}){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),l=(0,Z.useCallback)(e=>{i(e.readiness),t?.(e.readiness.ready),n?.(e.coverage)},[t,n]),u=(0,Z.useCallback)(()=>{U.ready(e).then(l,e=>c(e.message))},[e,l]);(0,Z.useEffect)(()=>{i(null),c(``),t?.(!1)},[e]),(0,Z.useEffect)(u,[u]);let d=async t=>{o(!0),c(``);try{l(await U.answer(e,t))}catch(e){c(e.message)}finally{o(!1)}};return(0,Q.jsxs)(We,{id:`tsc-ready`,level:3,icon:ue,title:`Before it runs`,description:(0,Q.jsx)(`span`,{role:`status`,className:H(r?r.ready?`text-pass`:`text-ink-2`:`text-muted`),children:r?r.ready?`Everything the tests need is in place.`:`${r.blockers?`${r.blockers} to fix`:``}${r.blockers&&r.open?`, `:``}${r.open?`${r.open} to answer`:``} before it can start.`:`Checking…`}),actions:(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:u,disabled:a,"data-tip":`Check again, after installing a program or setting a variable.`,children:[(0,Q.jsx)(p,{"aria-hidden":`true`}),`Check again`]}),children:[s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),r&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-[13px]`,children:r.items.map(t=>{let n=er[t.level];return(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:H(`mt-1 flex-none`,n.cls)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:H(`font-medium text-ink`,t.kind===`env`||t.kind===`tool`?`font-mono text-[13px]`:``),children:t.title}),(0,Q.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:t.text}),t.accepted&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-warn`,children:[`Accepted: `,t.accept,(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({unaccept:[t.id]}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Undo`})]}),t.kind===`url`&&(0,Q.jsx)(nr,{r,busy:a,onAnswer:e=>void d(e)}),t.kind===`app`&&t.engine&&(0,Q.jsx)(rr,{item:t,picked:t.engine===`desktop`?r.answers.desktopApp:t.engine===`mobile`?r.answers.mobileApp:r.answers.database,busy:a,onPick:e=>void d(t.engine===`desktop`?{desktopApp:e}:t.engine===`mobile`?{mobileApp:e}:{database:e})}),t.kind===`env`&&t.level===`answer`&&(0,Q.jsx)(ir,{item:t,busy:a,secrets:r.secrets||[],onSaved:u,onAccept:()=>void d({accept:[t.id]}),onUse:e=>void d({use:{name:t.name,secret:e}})}),t.kind===`env`&&t.uses&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Q.jsxs)(`span`,{children:[`Uses the saved secret `,(0,Q.jsx)(`span`,{className:`font-mono`,children:t.uses}),`.`]}),(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({use:{name:t.name,secret:``}}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Stop using it`})]}),t.kind===`data`&&(0,Q.jsx)(tr,{planId:e,stamp:r,busy:a,open:t.level===`answer`,onChanged:u,onAccept:t.accept&&t.level===`answer`?()=>void d({accept:[t.id]}):void 0,acceptTip:t.accept})]})]},t.id)})})]})}var or=/^[a-f0-9]{16}$/,sr=`forgeqe.tosca.assistant`;function cr(){try{let e=localStorage.getItem(sr)||``;return or.test(e)?e:``}catch{return``}}function lr(e){try{e?localStorage.setItem(sr,e):localStorage.removeItem(sr)}catch{}}var ur=[/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/,/\bgithub_pat_[A-Za-z0-9_]{20,}/,/\bglpat-[A-Za-z0-9_-]{20,}/,/\bATBB[A-Za-z0-9_-]{20,}/,/\b[a-z2-7]{52}\b/,/\bsk-[A-Za-z0-9_-]{16,}/,/\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{16,}/i,/\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*\S{6,}/i],dr=e=>e.replace(/^.*\//,``).replace(/\.tsu$/i,``);function fr(e){let t=e.exports[0]?.path||e.clones[0]?.exports[0]?.path,n=e.exports.length+e.clones.reduce((e,t)=>e+t.exports.length,0),r=[];return n>1&&r.push({icon:ie,title:`All ${n} exports to Playwright`,hint:`Every export in one plan, in TypeScript`,text:`Migrate all the exports to Playwright in TypeScript`}),t&&r.push({icon:I,title:`${dr(t)} to Selenium`,hint:`One export, in Java, with page objects`,text:`Migrate ${dr(t)} to Selenium in Java, with page objects`}),t&&r.push({icon:u,title:`${dr(t)} to Cypress`,hint:`Into a folder of its own`,text:`Migrate ${dr(t)} to Cypress in TypeScript, into e2e/tosca`}),r.push({icon:pe,title:`Help me choose`,hint:`The assistant asks one thing at a time`,text:`I want to migrate our Tosca tests. Help me choose.`}),r.slice(0,4)}function pr({view:e,sid:t,onSid:n}){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f=ct();(0,Z.useEffect)(()=>{t&&r?.id!==t&&Ee.view(t).then(i,()=>{n(``),lr(``)})},[t]),(0,Z.useEffect)(()=>{if(!r?.thinking&&!r?.checking)return;let e=setTimeout(()=>Ee.view(r.id).then(i,e=>c(e.message)),1200);return()=>clearTimeout(e)},[r]);let p=r?.messages.length??0;(0,Z.useEffect)(()=>{p&&d.current?.scrollIntoView({block:`nearest`,behavior:Oe()})},[p,r?.thinking]);let m=e=>{o(e),setTimeout(()=>document.getElementById(`tosca-agent-box`)?.focus(),0)},h=async e=>{u(!0),c(``);try{let r=await e();return i(r),r.id!==t&&(n(r.id),lr(r.id)),!0}catch(e){return c(e.message),!1}finally{u(!1)}},g=async e=>{!e.trim()||l||r?.thinking||(ur.some(t=>t.test(e))?(o(``),c(`That looks like a token or a password, so it was not sent and the box was cleared. Use the token field of the clone question: it keeps it in your credential store.`)):await h(()=>r?Ee.say(r.id,e):Ee.start(e))&&o(``))},_=()=>{r&&Ee.end(r.id).catch(()=>{}),i(null),o(``),c(``),n(``),lr(``)},v=()=>r?.prefill&&(location.hash=B(`migration`,`new`,r.id)),y=!r,b=l||!!r?.thinking;return(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-agent`,"aria-labelledby":`tab-agent`,className:`mx-auto flex w-full max-w-[1080px] flex-auto flex-col gap-6`,children:[y?(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[880px] flex-col items-center gap-4 pt-2 text-center short:gap-4 short:pt-0`,children:[(0,Q.jsx)(Ve,{agent:`forgeqe-tosca`,px:f?72:112,working:b,className:`mb-1`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:`What do you want to migrate from Tosca?`}),(0,Q.jsx)(`p`,{className:`m-0 text-[16px] text-muted`,children:`Say it in your words: the exports, the framework and where the tests run. I ask only what I still need, then open the wizard with every stage filled in for you to check.`})]}),(0,Q.jsx)(yr,{view:e}),(0,Q.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:fr(e).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>m(e.text),className:`flex cursor-pointer items-start gap-4 rounded-[12px] panel px-4 py-2 text-left hover:border-line-strong hover:bg-surface-muted`,children:[(0,Q.jsx)(Be,{icon:e.icon,size:18,className:`mt-1 text-accent-fg`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.hint})]})]},e.title))}),(0,Q.jsxs)(`a`,{href:B(`migration`,`new`),className:`inline-flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]}):(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Q.jsxs)(`section`,{"aria-label":`Conversation with Guide`,className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:r.model?`Worked out by ForgeQE's model from what you said and what your project has.`:`Worked out by ForgeQE's rules: no model is set up.`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:_,disabled:l,children:`New conversation`})]}),(0,Q.jsxs)(`ol`,{"aria-live":`polite`,className:`m-0 flex list-none flex-col gap-6 p-0`,children:[r.messages.map((e,t)=>(0,Q.jsx)(`li`,{className:`fade-quick`,children:e.role===`person`?(0,Q.jsx)(Ke,{text:e.text}):(0,Q.jsx)(mr,{text:e.text})},t)),r.thinking&&(0,Q.jsx)(`li`,{className:`fade-quick`,children:(0,Q.jsx)(mr,{text:r.working===`cloning`?`Cloning the repository and looking for Tosca exports…`:`Reading what you said…`,working:r.working===`cloning`?`cloning`:`reading`})})]}),!r.thinking&&r.question?.id===`clone`&&r.clone&&(0,Q.jsx)(gr,{c:r.clone,disabled:l,onToken:e=>h(()=>Ee.token(r.id,e)),onPick:e=>void h(()=>Ee.pick(r.id,`clone`,[e]))},`clone-${p}`),!r.thinking&&r.question&&r.question.id!==`clone`&&r.question.options.length>0&&(0,Q.jsx)(hr,{q:r.question,disabled:l,onPick:e=>void h(()=>Ee.pick(r.id,r.question.id,e)).then(()=>document.getElementById(`tosca-agent-box`)?.focus())},`${r.question.id}-${p}`),!r.thinking&&r.prefill&&(0,Q.jsxs)(`div`,{className:`fade-quick flex flex-wrap items-center gap-4 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px] text-ink`,children:r.question?`The wizard can open now; the rest is optional.`:`Everything is ready.`}),(0,Q.jsxs)(K,{variant:`primary`,onClick:v,children:[`Open the prefilled wizard`,(0,Q.jsx)(he,{"aria-hidden":`true`})]})]}),(0,Q.jsx)(`div`,{ref:d})]}),(0,Q.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Q.jsx)(_r,{v:r})})]}),(0,Q.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-auto flex flex-col bg-gradient-to-t from-bg from-85% to-transparent pt-6 pb-4`,children:[s&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 bg-bg pb-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),(0,Q.jsx)(yt,{id:`tosca-agent-box`,label:`Tell Guide`,value:a,onChange:e=>{o(e),c(``)},onSend:()=>void g(a),busy:l,disabled:b,placeholder:y?`Migrate checkout.tsu to Playwright in TypeScript, on QA…`:`Answer, or change anything you said…`})]})]})}function mr({text:e,working:t}){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,Q.jsx)(je,{state:t?`working`:`idle`,px:28,label:t?`Guide is ${t}`:`Guide`,className:`mt-1 flex-none`}),(0,Q.jsx)(`p`,{className:H(`m-0 text-[16px] leading-relaxed whitespace-pre-line [overflow-wrap:anywhere]`,t?`text-muted`:`text-ink-2`),children:e})]})}function hr({q:e,disabled:t,onPick:n}){let[r,i]=(0,Z.useState)([]);return(0,Q.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.multi?(0,Q.jsx)(Ie,{items:e.options.filter(e=>!e.action).map(e=>({id:e.id,label:e.label})),value:r,onChange:e=>{let t=e.includes(`all`)&&!r.includes(`all`);i(t?[`all`]:e.filter(e=>e!==`all`))}}):e.options.map(e=>(0,Q.jsxs)(K,{size:`sm`,variant:e.id===`skip`?`ghost`:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.label,e.hint&&(0,Q.jsx)(`span`,{className:`text-[13px] font-normal text-muted`,children:e.hint})]},e.id))}),e.multi&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.options.some(e=>!e.action)&&(0,Q.jsxs)(K,{size:`sm`,variant:`primary`,disabled:t||!r.length,onClick:()=>n(r),children:[`Use `,r.includes(`all`)?`all`:r.length>1?`these ${r.length}`:`this`]}),e.options.filter(e=>e.action).map(e=>(0,Q.jsxs)(K,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.id===`git`&&(0,Q.jsx)(w,{"aria-hidden":`true`}),e.label]},e.id)),e.typed&&e.options.some(e=>!e.action)&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Or type the names below.`})]})]})}function gr({c:e,disabled:t,onToken:n,onPick:r}){let[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),u=[...new Set([...e.credentials,...e.tokenVar?[e.tokenVar]:[]])].sort(),d=async()=>{if(i){s(!0),l(``);try{await De.saveSecrets({[i.name]:i.value}),a(null),await n(i.name)}catch(e){l(e.message)}finally{s(!1)}}},f=t||o;return(0,Q.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-4 rounded-[14px] panel p-4`,children:[(0,Q.jsxs)(`legend`,{className:`sr-only`,children:[`Clone `,e.url]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Q.jsxs)(`label`,{htmlFor:`tsa-token`,className:`flex flex-col gap-1 text-[13px] font-medium text-muted`,children:[`Access token`,(0,Q.jsxs)(ke,{id:`tsa-token`,size:`sm`,value:e.tokenVar??``,disabled:f,onChange:e=>void n(e.target.value),className:`min-w-[220px]`,children:[(0,Q.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),u.map(t=>(0,Q.jsxs)(`option`,{value:t,children:[t,t===e.tokenVar&&!e.tokenSaved?` (not saved yet)`:``]},t))]})]}),!i&&(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>a({name:e.tokenVar&&!e.tokenSaved?e.tokenVar:e.suggested,value:``}),children:`Add a token`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>void n(e.tokenVar??``),children:`Check again`})]}),!i&&(0,Q.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Or save it in`,` `,(0,Q.jsx)(`a`,{href:B(`settings`,`repo-tokens`),target:`_blank`,rel:`noopener`,children:`Settings › Secrets › Repository tokens`}),`, then press Check again.`]}),i&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,Q.jsxs)(`label`,{htmlFor:`tsa-token-name`,className:`flex flex-col gap-1 text-[13px] font-medium text-muted`,children:[`Name`,(0,Q.jsx)(W,{id:`tsa-token-name`,size:`sm`,value:i.name,spellCheck:!1,maxLength:64,onChange:e=>a({...i,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})]}),(0,Q.jsxs)(`label`,{htmlFor:`tsa-token-value`,className:`flex flex-col gap-1 text-[13px] font-medium text-muted`,children:[`Token`,(0,Q.jsx)(W,{id:`tsa-token-value`,size:`sm`,type:`password`,autoComplete:`off`,value:i.value,onChange:e=>a({...i,value:e.target.value}),className:`w-[260px] max-w-full`})]}),(0,Q.jsx)(K,{size:`sm`,disabled:f||!i.name||!i.value,onClick:()=>void d(),children:o?`Saving…`:`Save`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>a(null),children:`Cancel`}),(0,Q.jsx)(`span`,{className:`w-full text-[13px] text-muted`,children:`Kept in ForgeQE's credential store, never in the chat, the address or this page. Give it read access to the repository only.`})]}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Q.jsxs)(K,{size:`sm`,variant:`primary`,disabled:f||!(!e.tokenVar||e.tokenSaved),onClick:()=>r(`yes`),children:[(0,Q.jsx)(w,{"aria-hidden":`true`}),`Clone it`]}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>r(`no`),children:`No`}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.tokenVar&&!e.tokenSaved?`Save a token as ${e.tokenVar} first, or pick None.`:e.tokenVar?`Signs in with ${e.tokenVar}.`:`Nothing is cloned until you say so.`})]})]})}function _r({v:e}){let t=(e,t)=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line-soft py-4 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:e}),(0,Q.jsx)(`div`,{className:`text-sm [overflow-wrap:anywhere]`,children:t})]}),n=(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`}),r=e.have;return(0,Q.jsxs)(`aside`,{"aria-label":`What the assistant has so far`,className:`flex flex-col rounded-[14px] panel p-6`,children:[t(r.exports.length>1?`Exports (${r.exports.length})`:`Export`,r.exports.length?(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[r.exports.slice(0,6).map(e=>(0,Q.jsx)(`li`,{className:`font-mono text-[13px]`,children:e},e)),r.exports.length>6&&(0,Q.jsxs)(`li`,{className:`text-[13px] text-muted`,children:[`and `,r.exports.length-6,` more`]})]}):n),t(`Target`,r.targetId?(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Q.jsx)(St,{framework:r.targetId.split(`-`)[0],language:r.targetId.split(`-`).slice(1).join(`-`)}),r.target]}):n),t(`Tests start at`,r.start||(0,Q.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`})),r.needs.map(e=>(0,Q.jsx)(Z.Fragment,{children:t(e.need===`database`?`Database`:e.need===`mobile`?`Mobile app`:`Desktop app`,e.picked?(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.picked}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`}))},e.need)),t(`Folder`,r.into?(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:r.into}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`tosca-<target>`})),t(`Saved secrets`,r.uses.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.uses.map(e=>(0,Q.jsxs)(`li`,{className:`font-mono text-[13px]`,children:[e.variable,` uses `,e.secret]},e.variable))}):(0,Q.jsx)(`span`,{className:`text-muted`,children:e.checking?`Reading which variables the tests need…`:`None`})),t(`Instructions`,r.instructions?(0,Q.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:r.instructions}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}var vr=e=>e.kind===`upload`||e.kind===`paste`?e.exports.map(e=>dr(e.path)).join(`, `)||`Uploaded files`:e.label.replace(/^.*[\\/]/,``).replace(/\.git$/,``);function yr({view:e}){let t=`inline-flex min-h-7 items-center gap-1 rounded-full border px-2 no-underline`,n=e.clones.reduce((e,t)=>e+t.exports.length,0);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`mr-1 text-muted`,children:`Exports`}),e.exports.slice(0,5).map(e=>(0,Q.jsxs)(`span`,{className:H(t,`border-transparent bg-surface-strong text-ink-2`),children:[(0,Q.jsx)(r,{size:12,"aria-hidden":`true`}),dr(e.path)]},e.path)),[...e.clones.reduce((e,t)=>{let n=`${t.kind===`git`||!t.kind?`git`:`file`}\u0000${vr(t)}`;return e.set(n,[...e.get(n)||[],t])},new Map).values()].map(e=>(0,Q.jsxs)(`span`,{className:H(t,`border-transparent bg-surface-strong text-ink-2`),children:[e[0].kind&&e[0].kind!==`git`?(0,Q.jsx)(r,{size:12,"aria-hidden":`true`}):(0,Q.jsx)(w,{size:12,"aria-hidden":`true`}),vr(e[0]),e.length>1&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.length,` copies)`]})]},e[0].id)),(0,Q.jsx)(`a`,{href:B(`migration`,`new`),className:H(t,`border-dashed border-line-strong bg-transparent text-muted no-underline hover:text-ink`),children:`Another source`}),(0,Q.jsx)(`span`,{className:`ml-1 text-muted`,children:e.exports.length+n?`${e.exports.length+n} found`:`none in this project yet`})]})}var br=[s,le,F,_e],xr={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function Sr({steps:e,at:t,reached:n,onGo:r}){return(0,Q.jsx)(`nav`,{"aria-label":`Steps`,className:`min-w-0`,children:(0,Q.jsx)(`ol`,{className:`m-0 flex list-none flex-wrap gap-4 p-0 @3xl:flex-col @3xl:flex-nowrap @3xl:gap-0`,children:e.map((i,a)=>{let o=a===t,s=a<n&&!o,c=a<=n&&!o,l=a===e.length-1,u=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:H(`text-[13px] leading-8 font-semibold @3xl:hidden`,o||s?`text-ink`:`text-muted`),children:i.short}),(0,Q.jsx)(`span`,{className:H(`hidden text-[16px] leading-8 font-semibold @3xl:inline`,o||s?`text-ink`:c?`text-ink-2`:`text-muted`),children:i.name})]});return(0,Q.jsxs)(`li`,{"aria-current":o?`step`:void 0,className:H(`relative flex min-w-0 gap-2 @3xl:gap-4 @3xl:pb-8`,l&&`@3xl:pb-0`),children:[!l&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`absolute top-10 bottom-2 left-4 hidden w-px @3xl:block`,s?`bg-ink/30`:`bg-line`)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`relative inline-flex size-8 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums`,s?`bg-ink text-bg`:o?`border-2 border-ink bg-bg text-ink`:`border border-line bg-surface-strong text-muted`),children:s?(0,Q.jsx)(C,{size:16,strokeWidth:2.5}):a+1}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[c?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(a),"aria-label":i.name,className:`w-fit cursor-pointer rounded-[8px] border-0 bg-transparent p-0 text-left hover:underline`,children:u}):(0,Q.jsx)(`span`,{children:u}),(0,Q.jsx)(`span`,{className:H(`hidden text-[13px] leading-relaxed @3xl:block`,o?`text-ink-2`:`text-muted`),children:i.about}),i.answer&&(0,Q.jsx)(`span`,{className:`sr-only flex min-w-0 flex-col gap-1 text-[13px] text-ink @3xl:not-sr-only @3xl:mt-2 @3xl:border-l-2 @3xl:border-line @3xl:pl-2`,children:i.answer}),s&&a<t&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(a),"aria-label":`Change: ${i.name}`,className:`hidden min-h-8 w-fit cursor-pointer items-center border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline @3xl:inline-flex`,children:`Change`})]})]},i.name)})})})}function $({id:e,label:t,help:n,children:r}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function Cr({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,Q.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-bg py-4`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Q.jsxs)(K,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`}),`Back`]}),(0,Q.jsx)(K,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function wr({on:e,onPick:t,logo:n,title:r,sub:i,label:a,disabled:o}){return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-label":a,disabled:o,onClick:t,className:H(`relative flex min-h-[72px] min-w-0 cursor-pointer items-center gap-4 overflow-hidden rounded-[12px] border-0 px-4 py-4 text-left transition-[box-shadow] disabled:cursor-default disabled:opacity-50`,`bg-surface-strong`),children:[(0,Q.jsx)(`span`,{className:`inline-flex size-10 flex-none items-center justify-center [&>svg]:size-7`,children:n??(0,Q.jsx)(g,{"aria-hidden":`true`,strokeWidth:1.8,className:`text-ink-2`})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col pr-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-ink`,children:r}),i&&(0,Q.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:i})]}),e&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-2 bg-accent`})]})}function Tr({id:e,at:t,moved:n,children:r}){let i=br[t],a=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{let e=a.current;n&&e&&(e.getBoundingClientRect().top<0&&e.scrollIntoView({block:`start`,behavior:Oe()}),e.focus({preventScroll:!0}))},[t,n]),(0,Q.jsxs)(`h2`,{ref:a,id:e,tabIndex:-1,className:`m-0 flex scroll-mt-4 items-center gap-2 text-[20px] leading-tight font-semibold tracking-[-0.01em] outline-none`,children:[i&&(0,Q.jsx)(Be,{icon:i,size:18,className:`flex-none text-accent-fg`}),(0,Q.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:r})]})}var Er=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],Dr=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function Or({s:e}){let t=e.duplicates||0;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:`Test cases`,value:e.test_cases.length}),(0,Q.jsx)(Y,{label:`Modules`,value:e.pages.length}),(0,Q.jsx)(Y,{label:`Steps`,value:e.totals.steps}),(0,Q.jsx)(Y,{label:`Checks`,value:e.totals.asserts})]}),(e.suites.length>0||e.totals.unsupported>0||t>0)&&(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:[e.suites.length>0&&(0,Q.jsxs)(`li`,{children:[X(e.suites.length,`execution list`),`, kept as tags on the tests.`]}),e.totals.unsupported>0&&(0,Q.jsxs)(`li`,{className:`text-warn`,children:[e.totals.unsupported===1?`1 step value cannot`:`${e.totals.unsupported} step values cannot`,` be converted: each stays in its test as a marked comment for a person.`]}),t>0&&(0,Q.jsxs)(`li`,{children:[X(t,`test case`),` in more than one export, converted once.`]})]})]})}var kr=e=>`${e.workspace||``}\u0000${e.file}`;function Ar({busy:e,onClone:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``);return(0,Q.jsxs)(`form`,{className:`flex flex-col gap-4 rounded-[12px] card border px-4 py-4`,onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim(),i.trim(),o.trim())},children:[(0,Q.jsx)($,{id:`tsc-git-url`,label:`Repository`,help:`https:// or git@ address. A shallow copy is made under ForgeQE's home, with no hooks run; the project is not changed.`,children:(0,Q.jsx)(W,{inputMode:`url`,id:`tsc-git-url`,value:n,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/tosca-exports.git`,onChange:e=>r(e.target.value)})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`tsc-git-branch`,label:`Branch`,help:`The default branch when empty.`,children:(0,Q.jsx)(W,{id:`tsc-git-branch`,value:i,spellCheck:!1,maxLength:200,placeholder:`main`,onChange:e=>a(e.target.value)})}),(0,Q.jsx)($,{id:`tsc-git-token`,label:`Credential variable`,help:`For a private repository: the name of the variable that holds its token (saved in Settings), never the token.`,children:(0,Q.jsx)(W,{id:`tsc-git-token`,value:o,spellCheck:!1,maxLength:80,placeholder:`GITHUB_TOKEN`,onChange:e=>s(e.target.value)})})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(K,{type:`submit`,disabled:e||!n.trim(),children:e?`Cloning…`:`Clone it`})})]})}function jr(e,t){let n=e.exports.map(e=>({p:{file:e.path},bytes:e.bytes,from:`This project`})),r=e.clones.filter(e=>!t||`workspace`in t&&t.workspace===e.id).flatMap(e=>e.exports.map(t=>({p:{file:t.path,workspace:e.id},bytes:t.bytes,from:`${e.label.replace(/^.*\//,``).replace(/\.git$/,``)}${e.branch?` (${e.branch})`:``}`})));return t&&`workspace`in t?r:t?n:[...n,...r]}function Mr({view:e,onView:t,scope:r,rows:i,part:a,setPart:o,busy:s,read:c,readError:l,picked:u,setPicked:d,found:f,setFound:p,only:m,setOnly:h}){let[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(e.clones.length>0&&e.exports.length===0),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(``),E=l||w,ne=new Set(u.map(kr)),D=e=>{p(null),T(``),d(t=>t.some(t=>kr(t)===kr(e))?t.filter(t=>kr(t)!==kr(e)):[...t,e])},O=i.length>0&&i.every(e=>ne.has(kr(e.p))),k=async(e,n,r)=>{y(!0),T(``);try{t?.(await U.clone(e,n||void 0,r||void 0))}catch(e){T(e.message)}finally{y(!1)}},A=async e=>{T(``),C(``);try{t?.(await U.removeClone(e)),d(t=>t.filter(t=>t.workspace!==e)),p(null)}catch(e){T(e.message)}},j=e=>{let t=new Set(m);t.has(e)?t.delete(e):t.add(e),h(t)},M=e=>Jt(e),N=f?f.test_cases.filter(M):[],re=!r||`project`in r,ie=!r,P=E&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:E});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(a===`tsc-exports`||!f)&&!(r&&i.length===1)&&(0,Q.jsxs)(We,{id:`tsc-exports`,level:3,icon:I,title:(0,Q.jsxs)(Q.Fragment,{children:[`Exports`,r?(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` in this source, `,i.length]}):null]}),children:[i.length>0?(0,Q.jsx)(`div`,{className:`@container`,children:(0,Q.jsx)(tt,{label:`Tosca exports`,size:10,placeholder:`Find an export`,tools:(0,Q.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(dt,{checked:O,onCheckedChange:e=>{p(null),T(``),d(e?i.map(e=>e.p):[])}}),`Pick all `,i.length]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Export`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Folder`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`From`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Size`})]}),children:i.map(e=>{let t=kr(e.p),n=e.p.file.slice(e.p.file.lastIndexOf(`/`)+1);return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(dt,{"aria-label":`Pick ${e.p.file}${e.p.workspace?` of ${e.from}`:``}`,checked:ne.has(t),onCheckedChange:()=>D(e.p)})}),(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(I,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n})]})}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`hidden font-mono text-[13px] text-muted @xl:table-cell`),children:e.p.file.includes(`/`)?e.p.file.slice(0,e.p.file.lastIndexOf(`/`)):`.`}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`text-ink-2`),children:e.from}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:Dr(e.bytes)})]},t)})})}):(0,Q.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-4 text-sm text-ink-2`,children:[`No Tosca export (.tsu) `,r&&`workspace`in r?`in this source.`:`in this project yet.`,` Export the test cases from Tosca Commander and put the files inside the project, for example `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:`tosca/checkout.tsu`}),`, or pick another source above.`]}),u.length>0&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:u.length>1?`Their test cases become one plan; a module they share becomes one page object.`:`Tick more to convert several exports in one plan.`}),s&&!E&&(0,Q.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Q.jsxs)(`span`,{children:[`Reading `,u.length===1?`the export`:`${u.length} exports`,`…`]})}),P,re&&(0,Q.jsx)($,{id:`tsc-path`,label:`Add by its path`,help:`A .tsu, or a folder of them, inside the project. Secrets in an export stay encrypted: they become environment variables.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(W,{id:`tsc-path`,value:g,spellCheck:!1,maxLength:300,placeholder:`tosca/checkout.tsu or tosca/`,onChange:e=>_(e.target.value),className:`min-w-0 flex-[1_1_300px]`}),(0,Q.jsxs)(K,{disabled:s||!g.trim(),onClick:()=>void c([...u.filter(e=>kr(e)!==kr({file:g.trim()})),{file:g.trim()}],u),"data-tip":`Add the export at this path and read it`,children:[(0,Q.jsx)(ee,{"aria-hidden":`true`}),`Add`]})]})}),ie&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":b,onClick:()=>x(!b),className:`inline-flex min-h-8 cursor-pointer items-center gap-2 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,Q.jsx)(n,{size:15,"aria-hidden":`true`,className:H(`transition-transform`,b&&`rotate-180`)}),`From a git repository`,e.clones.length?` (${e.clones.length} cloned)`:``]}),b&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.clones.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.clones.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.label,(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:[e.branch?`Branch ${e.branch}`:``,e.commit?`commit ${e.commit}`:``,X(e.exports.length,`export`),`cloned ${new Date(e.createdAt).toLocaleDateString()}`].filter(Boolean).join(`, `)})]}),S===e.id?(0,Q.jsxs)(`span`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-ink-2`,children:[`Remove this copy? Plans made from it can no longer run.`,(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>void A(e.id),children:`Remove it`}),(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>C(``),children:`Keep it`})]}):(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,"aria-label":`Remove the copy of ${e.label}`,onClick:()=>C(e.id),children:`Remove`})]},e.id))}),(0,Q.jsx)(Ar,{busy:v,onClone:(e,t,n)=>void k(e,t,n)})]})]})]}),s&&!E&&a!==`tsc-exports`&&(0,Q.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Q.jsx)(`span`,{children:`Reading…`})}),f&&(0,Q.jsxs)(We,{id:`tsc-cases`,level:3,icon:te,title:(0,Q.jsxs)(Q.Fragment,{children:[`Test cases`,(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` `,`in `,u.length===1?(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:u[0].file.replace(/^.*\//,``)}):X(u.length,`export`)]})]}),actions:a!==`tsc-exports`&&!(r&&i.length===1)?(0,Q.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>o(`tsc-exports`),children:`Change exports`}):void 0,children:[P&&a!==`tsc-exports`?P:null,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Or,{s:f}),f.coverage&&(0,Q.jsx)($n,{coverage:f.coverage,names:new Map(f.test_cases.map(e=>[e.id,e.name])),file:`${u.length===1?u[0].file.replace(/^.*\//,``).replace(/\.tsu$/i,``):`tosca-exports`}-coverage.csv`,folded:!0}),(0,Q.jsx)(`div`,{className:`@container`,children:(0,Q.jsx)(tt,{label:`Test cases to convert`,placeholder:`Find a test case`,tools:(0,Q.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(dt,{checked:N.length>0&&N.every(e=>m.has(e.id)),onCheckedChange:e=>h(new Set(e?N.map(e=>e.id):[]))}),`Pick all `,N.length,` test cases ForgeQE can convert`]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Folder`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Checks`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`})]}),children:f.test_cases.map(e=>{let t=M(e);return(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Q.jsx)(`td`,{className:`px-4 py-2`,children:(0,Q.jsx)(dt,{"aria-label":`Pick ${e.name}`,disabled:!t,checked:t&&m.has(e.id),onCheckedChange:()=>j(e.id)})}),(0,Q.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,Q.jsx)(`span`,{className:H(`font-medium [overflow-wrap:anywhere]`,t?`text-ink`:`text-muted`),children:e.name}),(e.unsupported>0||e.suites.length>0)&&(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[e.unsupported?`${e.unsupported} not convertible`:``,e.unsupported&&e.suites.length?`, `:``,e.suites.length?`${e.unsupported?`in`:`In`} ${e.suites.join(`, `)}`:``]})]}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`hidden text-muted @2xl:table-cell [overflow-wrap:anywhere]`),children:e.folders.join(` / `)||`Top level`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.steps}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.asserts}),(0,Q.jsx)(`td`,{className:H(`px-4 py-2`,`whitespace-nowrap`),children:(0,Q.jsx)(Ne,{tone:t?`neutral`:`warn`,children:t?Xt(e):`${Ht[e.route]||e.route}: later`})})]},e.id)})})}),f.env.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Environment variables`}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[f.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`. Their values are never in the export; you set them before the tests run.`]})]})]})]})]})}function Nr({view:e,to:t,setTo:n,fw:r,setFw:i,into:a,setInto:o,attr:s,setAttr:c}){let l=e=>e.split(`-`)[0],u=e=>e.split(`-`).slice(1).join(`-`),d=[...new Map(e.targets.map(e=>[l(e.id),e.framework])).entries()],f=r||(t?l(t):``),p=e.targets.filter(e=>l(e.id)===f);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Framework`}),(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:d.map(([e,t])=>{let r=Dt[e];return(0,Q.jsx)(wr,{on:f===e,onPick:()=>{e!==f&&(i(e),n(``))},logo:r?(0,Q.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:t,sub:xr[e],label:t},e)})})]}),(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Language`}),!f&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick a framework first.`}),f&&!t&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick its language.`}),(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`pane-swap grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:p.map(e=>{let r=Et[u(e.id)];return(0,Q.jsx)(wr,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Q.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,label:e.language},e.id)})},f)]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,Q.jsx)(W,{id:`tsc-into`,value:a,spellCheck:!1,maxLength:300,placeholder:t?`tosca-${t}`:`Named after the target`,onChange:e=>o(e.target.value)})}),(0,Q.jsx)($,{id:`tsc-attr`,label:`Test id attribute (optional)`,help:`When the app's is not data-test-id, data-testid, data-test, data-cy or data-qa.`,children:(0,Q.jsx)(W,{id:`tsc-attr`,value:s,spellCheck:!1,maxLength:40,placeholder:`data-automation-id`,onChange:e=>c(e.target.value.replace(/[^A-Za-z0-9_-]/g,``))})})]})]})}function Pr({view:e,picked:t,found:n,only:r,to:i,into:a,plan:o,embedded:s}){let c=e.targets.find(e=>e.id===i),l=(e,t)=>(0,Q.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 [overflow-wrap:anywhere]`,children:t},e),u=t.map(e=>e.file.slice(e.file.lastIndexOf(`/`)+1));return[{name:s?`Select the source`:`Pick the exports`,short:`Source`,about:`Pick the Tosca exports, then the test cases to convert. Web and API test cases become code; the rest are listed.`,answer:t.length?[l(`e`,(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:u.length>2?`${u.slice(0,2).join(`, `)} and ${u.length-2} more`:u.join(`, `)})),n&&l(`c`,`${r.size} of ${n.test_cases.length} test cases`)]:void 0},{name:`Choose the target`,short:`Target`,about:`Pick the framework and language they become, and where the code goes. Add your own rules if you have any.`,answer:c?[l(`t`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(St,{framework:c.id.split(`-`)[0],language:c.id.split(`-`).slice(1).join(`-`),size:14}),c.title]})),l(`i`,(0,Q.jsx)(`span`,{className:`text-muted`,children:o?`Into ${o.target.dir}`:a.trim()?`Into ${a.trim()}`:`Into a new folder`}))]:void 0},{name:`Review and start`,short:`Review`,about:`See what converts, what cannot, and what the tests need. Start runs it in the background.`,answer:o?l(`v`,Wt[o.feasibility.verdict].label):void 0}]}function Fr({view:e,onView:t,review:n,onStart:r,from:a,embedded:o}){let[s,c]=(0,Z.useState)(0),[l,u]=(0,Z.useState)(0),[d,f]=(0,Z.useState)([]),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(new Set),[_,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(``),[ee,te]=(0,Z.useState)(``),[E,ne]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(!1),[N,re]=(0,Z.useState)(``),ie=o?.scope,P=jr(e,ie),[F,I]=(0,Z.useState)(`tsc-exports`),[ae,oe]=(0,Z.useState)(!1),[L,se]=(0,Z.useState)(``),R=async(e,t)=>{if(f(e),m(null),se(``),e.length){oe(!0);try{let t=await U.inspectSources(e);m(t),g(new Set(t.test_cases.filter(Jt).map(e=>e.id))),I(`tsc-cases`)}catch(e){t&&f(t),se(e.message)}finally{oe(!1)}}},ce=!a&&P.length===1?P[0].p:null;(0,Z.useEffect)(()=>{ce&&R([ce])},[ce&&kr(ce)]);let le=[...h].sort().join(`,`);(0,Z.useEffect)(()=>{ne(null),O(!1),u(e=>Math.min(e,1))},[d.map(kr).join(`|`),le,_,S,w,ee]);let[z,ue]=(0,Z.useState)(`next`),[de,pe]=(0,Z.useState)(!1),me=e=>{ue(e<s?`back`:`next`),c(e),pe(!0)},V=e=>{me(e),u(t=>Math.max(t,e)),re(``)},[ge,_e]=(0,Z.useState)(a?`filling`:``);(0,Z.useEffect)(()=>{if(!a)return;let e=!0;return(async()=>{M(!0);try{let t=(await Ee.view(a)).prefill;if(!t)throw Error(`The assistant does not have the exports and the target yet: go back to it, or pick them here.`);if(!e)return;f(t.sources),x(t.to.split(`-`)[0]),v(t.to),C(t.into??``),te(t.instructions??``);let n=await U.inspectSources(t.sources);if(!e)return;let r=n.test_cases.filter(Jt).map(e=>e.id);if(m(n),g(new Set(r)),!r.length)throw Error(`These exports hold no web or API test case to convert.`);let i=await U.plan({sources:t.sources,to:t.to,...t.into?{into:t.into}:{},...t.instructions?{instructions:t.instructions}:{}});(t.app||t.baseUrl)&&await U.answer(i.plan.id,t.app?{environment:t.app.environment,app:t.app.app}:{baseUrl:t.baseUrl}).catch(()=>{});for(let[e,n]of Object.entries(t.uses||{}))await U.answer(i.plan.id,{use:{name:e,secret:n}}).catch(()=>{});if((t.desktopApp||t.mobileApp||t.database)&&await U.answer(i.plan.id,{...t.desktopApp?{desktopApp:t.desktopApp}:{},...t.mobileApp?{mobileApp:t.mobileApp}:{},...t.database?{database:t.database}:{}}).catch(()=>{}),!e)return;ne(i),u(2),me(2),_e(`done`)}catch(t){if(!e)return;re(t.message),_e(``)}finally{e&&M(!1)}})(),()=>{e=!1}},[a]);let ve=async()=>{M(!0),re(``);try{let e=!p||p.test_cases.filter(Jt).every(e=>h.has(e.id)),t=await U.plan({sources:d,to:_,...S.trim()?{into:S.trim()}:{},...e?{}:{only:[...h]},...ee.trim()?{instructions:ee.trim()}:{},...w?{testAttributes:[w]}:{}});ne(t),V(2)}catch(e){let t=e.message;re(t);let n=S.trim().replace(/\\/g,`/`).replace(/(?<!\/)\/+$/,``);n&&t.includes(n)&&me(1)}finally{M(!1)}},ye=E?.plan,be=ye?.feasibility.findings.some(e=>e.level===`limit`),xe=ye?.feasibility.verdict===`blocked`,Se=[o?`Where are the tests?`:`Which Tosca exports?`,`What should the tests become?`,`Check the plan, then start`],Ce=Pr({view:e,picked:d,found:p,only:h,to:_,into:S,embedded:!!o,...ye?{plan:ye}:{}});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[a&&ge&&(0,Q.jsxs)(`p`,{role:`status`,className:`fade-quick m-0 flex flex-wrap items-center gap-x-4 gap-y-1 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-2 text-sm text-ink`,children:[(0,Q.jsx)(`span`,{className:`flex-1`,children:ge===`filling`?`Filling in every stage from your conversation with the assistant…`:`Filled in from your conversation with the assistant. Check each stage before you start.`}),(0,Q.jsx)(`a`,{href:B(`migration`,`guide`),className:`text-[13px]`,children:`Back to the assistant`})]}),(0,Q.jsxs)(`div`,{className:`mt-4 grid grid-cols-[minmax(0,1fr)] items-stretch gap-6 @3xl:grid-cols-[minmax(240px,280px)_minmax(0,1fr)] @3xl:gap-12`,children:[(0,Q.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,Q.jsx)(Sr,{steps:Ce,at:s,reached:l,onGo:e=>!j&&(e<2||E)&&me(e)})})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-step`,className:H(`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,z===`next`?`pane-next`:`pane-back`),children:[(0,Q.jsx)(Tr,{id:`tsc-step`,at:s,moved:de,children:Se[s]}),N&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:N}),s===0&&(0,Q.jsxs)(Q.Fragment,{children:[o?.source,(0,Q.jsx)(Mr,{view:e,onView:t,...ie?{scope:ie}:{},rows:P,part:F,setPart:I,busy:ae,read:R,readError:L,picked:d,setPicked:f,found:p,setFound:m,only:h,setOnly:g}),p?(0,Q.jsx)(Cr,{busy:j||ae,next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>V(1),disabled:!h.size,aside:h.size?void 0:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Pick at least one web or API test case.`})}):(0,Q.jsx)(Cr,{busy:j||ae,next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),ae?`Reading…`:d.length>1?`Read ${d.length} exports`:`Read the export`]}),onNext:()=>void R(d),disabled:!d.length,aside:d.length?void 0:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Tick one or more exports.`})})]}),s===1&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nr,{view:e,to:_,setTo:v,fw:b,setFw:x,into:S,setInto:C,attr:w,setAttr:T}),(0,Q.jsx)(pt,{title:ee.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!ee.trim(),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsx)($,{id:`tsc-instructions`,label:`Rules`,help:`Style and structure for the new code. Every Tosca step and check is kept either way.`,children:(0,Q.jsx)(Ae,{id:`tsc-instructions`,value:ee,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per Tosca module.`,onChange:e=>te(e.target.value)})}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Er.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:ee.includes(e),onClick:()=>te(ee.trim()?`${ee.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-surface-strong px-2 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Q.jsx)(i,{size:13,"aria-hidden":`true`}),e]},e))})]})}),(0,Q.jsx)(Cr,{busy:j,onBack:()=>me(0),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(fe,{"aria-hidden":`true`}),j?`Checking…`:`Check the plan`]}),onNext:()=>_?void ve():re(`Pick the framework and its language first.`),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),s===2&&ye&&(0,Q.jsxs)(Q.Fragment,{children:[n(ye,D,O,A),(0,Q.jsx)(Cr,{busy:j,onBack:()=>me(1),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]}),disabled:xe||!k||be&&!D,onNext:()=>r(E,!!be&&D),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:xe?`Change what is not possible first.`:k?be&&!D?`Accept the limits to start.`:`Runs in the background.`:`Answer what the tests need first.`})})]})]},s)]})]})}function Ir({planId:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let t=!0;return n(null),i(!1),U.estimate(e).then(e=>t&&n(e),()=>t&&i(!0)),()=>{t=!1}},[e]),r?(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not known`}):t?t.files.setup+t.files.pages+t.files.tests?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{children:[`About `,ht(t.tokens.mid),` tokens`,t.cost?`, about ${ft(t.cost.mid,t.cost.currency)}`:``,(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` `,`(`,ht(t.tokens.low),` to `,ht(t.tokens.high),t.cost?`, ${ft(t.cost.low,t.cost.currency)} to ${ft(t.cost.high,t.cost.currency)}`:``,`)`]})]}),(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[t.model&&t.model!==`none`?`With ${t.model}. `:`No model is set up for Bridge yet. `,t.basis.from===`history`?`From ${t.basis.files} files written by earlier conversions here.`:`From defaults: no conversion has run here yet.`,t.cost||!t.model||t.model===`none`?``:` No price is set for this model.`]})]}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`Nothing left to write`}):(0,Q.jsx)(`span`,{role:`status`,className:`text-muted`,children:`Working it out…`})}function Lr({plan:e,accepted:t,onAccept:n,onReady:r}){let[i,a]=(0,Z.useState)(null),s=(0,Z.useMemo)(()=>new Map(e.cases.map(e=>[e.id,e.name])),[e]),c=e.feasibility.findings.filter(e=>e.level===`blocker`),l=e.feasibility.findings.filter(e=>e.level===`limit`),u=e.cases.filter(e=>e.included),d=e.units.filter(e=>e.kind===`page`).length,f=u.filter(e=>e.workflow).length;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[c.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-blockers`,className:`flex flex-col gap-2 rounded-[14px] bg-fail-soft px-6 py-4`,children:[(0,Q.jsxs)(`h3`,{id:`tsc-blockers`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-fail`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-sm text-ink`,children:c.map(e=>(0,Q.jsx)(`li`,{children:e.text},e.code))})]}),l.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`tsc-limits`,className:`flex flex-col gap-4 rounded-[14px] bg-warn-soft px-6 py-4`,children:[(0,Q.jsxs)(`h3`,{id:`tsc-limits`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-warn`,children:[(0,Q.jsx)(o,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-2 pl-6 text-sm text-ink`,children:l.map(e=>(0,Q.jsx)(`li`,{children:e.text},e.code))}),n&&!c.length&&(0,Q.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm font-medium`,children:[(0,Q.jsx)(dt,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,Q.jsx)(ar,{planId:e.id,onReady:r,onCoverage:a}),(0,Q.jsx)(We,{id:`tsc-plan`,level:3,icon:re,title:`The plan`,children:(0,Q.jsxs)(`dl`,{className:`m-0 grid gap-x-8 text-sm @xl:grid-cols-[180px_minmax(0,1fr)] [&>dd]:border-b [&>dd]:border-line-soft [&>dd]:py-2 [&>dt]:@xl:border-b [&>dt]:border-line-soft [&>dt]:pt-2 [&>dt]:@xl:pb-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,Q.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[`Tricentis Tosca`,e.source.project?`, ${e.source.project}`:``,(0,Q.jsx)(`span`,{className:`block text-muted`,children:e.sources&&e.sources.length>1?`${e.sources.length} exports`:(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.source.file})}),e.sources&&e.sources.length>1&&(0,Q.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.sources.map((t,n)=>(0,Q.jsxs)(`li`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.label,(0,Q.jsx)(`span`,{className:`block font-sans text-muted`,children:(e=>e?X(e,`test case`):`its test cases are all in another export`)(e.cases.filter(e=>e.source===n).length)})]},n))})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,Q.jsx)(`span`,{className:`block font-mono text-[13px] text-muted`,children:e.target.dir})]}),e.previous&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Since`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[(0,Q.jsx)(`a`,{href:B(`migration`,e.previous.id),children:e.previous.id}),(0,Q.jsxs)(`span`,{className:`block text-muted`,children:[X(e.cases.filter(e=>e.change===`same`).length,`test case`),` unchanged (their tests kept), `,e.cases.filter(e=>e.change===`changed`).length,` changed, `,e.cases.filter(e=>e.change===`new`).length,` new, `,(e.removed||[]).length,` removed`]})]})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[u.length-f,` test`,u.length-f===1?``:`s`,f?`, ${f} desktop or mobile workflow${f===1?``:`s`}`:``,` of `,e.cases.length,` test case`,e.cases.length===1?``:`s`,`, `,d,` page object`,d===1?``:`s`]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Estimate`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:(0,Q.jsx)(Ir,{planId:e.id})}),(e.suites||[]).length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Suites`}),(0,Q.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.suites.map(e=>`${e.name} (${X(e.cases.length,`test`)})`).join(`, `),(0,Q.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca's execution lists, as tags on the tests: `,e.suites.map(e=>`@${e.tag}`).join(`, `),`.`]})]})]}),e.env.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Environment variables`}),(0,Q.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Never in the export: you set them before the tests run.`})]})]}),e.instructions&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,Q.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]})}),i&&(0,Q.jsx)($n,{coverage:i,names:s,file:`tosca-${e.id}-coverage.csv`}),(0,Q.jsx)(pt,{title:`Test cases (${e.cases.length})`,children:(0,Q.jsx)(`div`,{className:`@container`,children:(0,Q.jsx)(tt,{label:`Test cases of the plan`,placeholder:`Find a test case`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`In the plan`}),(0,Q.jsx)(`th`,{scope:`col`,className:H($e,`hidden @xl:table-cell`),children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:H($e,`hidden @xl:table-cell`),children:`Checks`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Kind`})]}),children:e.cases.map(e=>{let t=e.change;return(0,Q.jsxs)(`tr`,{className:et,children:[(0,Q.jsx)(`td`,{className:H(J,`[overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,Q.jsxs)(`td`,{className:H(J,`text-ink-2`),children:[e.included?`Converted`:e.why?e.why[0].toUpperCase()+e.why.slice(1):`Left out`,t?(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:{same:`Unchanged: its test kept`,changed:`Changed in Tosca`,new:`New in Tosca`}[t]}):null]}),(0,Q.jsx)(`td`,{className:H(Ge,`hidden @xl:table-cell`),children:e.steps}),(0,Q.jsx)(`td`,{className:H(Ge,`hidden @xl:table-cell`),children:e.asserts}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap text-muted`),children:Ht[e.route]||e.route})]},e.id)})})})}),(0,Q.jsx)(pt,{title:`Files, in order (${e.units.length})`,children:(0,Q.jsx)(tt,{label:`Files, in order`,placeholder:`Find a file`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`w-24`),children:`Kind`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`File`})]}),children:e.units.map(e=>(0,Q.jsxs)(`tr`,{className:et,children:[(0,Q.jsx)(`td`,{className:H(J,`text-muted`),children:Gt(e)}),(0,Q.jsx)(`td`,{className:H(J,`font-mono text-[13px] [overflow-wrap:anywhere]`),children:e.target})]},e.id))})})]})}function Rr({d:e,onStarted:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=e.plan.feasibility.findings.some(e=>e.level===`limit`),l=e.plan.feasibility.verdict===`blocked`,u=!!e.job?.running;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!u&&(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Q.jsx)(Lr,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r,onReady:a}),!l&&!u&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Q.jsxs)(K,{variant:`primary`,disabled:!i||!e.confirmed&&c&&!n,onClick:()=>s(!0),"data-tip":`Start the conversion`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]}),!i&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Answer what the tests need first.`})]}),o&&(0,Q.jsx)(sn,{plan:e.plan,acceptLimits:c&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}var zr=`tsc-\\d{8}-\\d{6}-[0-9a-f]{4}`;function Br(e){return!!(e&&(e===`guide`||/^new\/[a-f0-9]{16}$/.test(e)||RegExp(`^${zr}(?:/(?:steps|errors|activity)|/report(?:/[^/]+)?)?$`).test(e)))}function Vr({sub:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(cr),l=(0,Z.useCallback)(()=>{U.list().then(e=>{n(e),i(``)},e=>i(e.message))},[]);(0,Z.useEffect)(l,[l,e]);let u=e.match(RegExp(`^(${zr})/report(?:/([^/]+))?$`)),d=e.match(RegExp(`^(${zr})/(steps|errors|activity)$`)),f=RegExp(`^${zr}$`).test(e)?e:u?.[1]||d?.[1]||``,p;try{p=u?.[2]?ce(u[2]):void 0}catch{}let m=!t&&!r&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),h=e.match(/^new\/([a-f0-9]{16})$/)?.[1];return h?(0,Q.jsxs)(rn,{tab:`migrations`,back:{href:B(`migration`,`guide`),label:`Guide`},children:[(0,Q.jsx)(Yt,{error:r}),m,t&&(0,Q.jsx)(Fr,{view:t,onView:n,from:h,review:(e,t,n,r)=>(0,Q.jsx)(Lr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>o({d:e,accept:t})},h),a&&(0,Q.jsx)(sn,{plan:a.d.plan,acceptLimits:a.accept,onClose:()=>o(null),onStarted:e=>{o(null),location.hash=B(`migration`,e.plan.id)}})]}):f&&u?(0,Q.jsx)(rn,{tab:`migrations`,wide:!0,back:{href:B(`migration`,f),label:`Conversion`},children:(0,Q.jsx)(Yn,{id:f,caseId:p},f)}):f?(0,Q.jsxs)(rn,{tab:`migrations`,wide:!0,back:nn,children:[(0,Q.jsx)(Yt,{error:r}),m,t&&(0,Q.jsx)(In,{id:f,...d?{tab:d[2]}:{},plan:(e,t)=>(0,Q.jsx)(Rr,{d:e,onStarted:t})},f)]}):(0,Q.jsxs)(rn,{tab:`migrations`,back:{href:B(`migration`,`new`),label:`New migration`},children:[(0,Q.jsx)(Yt,{error:r}),m,t&&(0,Q.jsx)(pr,{view:t,sid:s,onSid:c})]})}var Hr={py:`python`,ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,java:`java`,cs:`csharp`,rb:`ruby`};function Ur({path:e}){let t=Et[Hr[e.split(`.`).pop()?.toLowerCase()||``]||``];return t?(0,Q.jsx)(t,{"aria-hidden":`true`,width:15,height:15,className:`flex-none`}):(0,Q.jsx)(xe,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`})}function Wr(e){let t={name:``,path:``,dirs:new Map,files:[]};for(let n of e){let e=n.path.split(`/`),r=t;for(let t of e.slice(0,-1))r.dirs.has(t)||r.dirs.set(t,{name:t,path:r.path?`${r.path}/${t}`:t,dirs:new Map,files:[]}),r=r.dirs.get(t);r.files.push(n)}let n=e=>{for(let[t,r]of[...e.dirs]){let i=n(r);for(;i.files.length===0&&i.dirs.size===1;){let e=[...i.dirs.values()][0];i={...e,name:`${i.name}/${e.name}`}}e.dirs.set(t,i)}return e};return n(t)}function Gr({files:e,selected:t,onSelect:n,label:i}){let a=(0,Z.useMemo)(()=>Wr(e),[e]),[o,c]=(0,Z.useState)(new Set),l=e=>c(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e])),u=(e,i)=>(0,Q.jsxs)(Q.Fragment,{children:[[...e.dirs.values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>{let t=!o.has(e.path);return(0,Q.jsxs)(`li`,{role:`treeitem`,"aria-expanded":t,"aria-selected":!1,className:`list-none`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:`flex h-8 w-full cursor-pointer items-center gap-2 rounded-[6px] border-0 bg-transparent px-2 text-left text-[13px] text-ink hover:bg-surface-strong`,children:[(0,Q.jsx)(x,{size:14,"aria-hidden":`true`,className:H(`flex-none text-muted transition-transform duration-150`,t&&`rotate-90`)}),t?(0,Q.jsx)(r,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}):(0,Q.jsx)(s,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]}),t&&(0,Q.jsx)(`ul`,{role:`group`,className:`m-0 ml-4 border-l border-line-soft p-0 pl-2`,children:u(e,i+1)})]},e.path)}),[...e.files].sort((e,t)=>e.path.localeCompare(t.path)).map(e=>{let r=t===e.id;return(0,Q.jsx)(`li`,{role:`treeitem`,"aria-selected":r,className:`list-none`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n?.(e.id),"data-tip":e.title,className:H(`flex h-8 w-full items-center gap-2 rounded-[6px] border-0 px-2 text-left text-[13px]`,n?`cursor-pointer`:`cursor-default`,r?`bg-accent-soft font-medium text-ink`:`bg-transparent text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,Q.jsx)(`span`,{className:`w-[14px] flex-none`,"aria-hidden":`true`}),(0,Q.jsx)(Ur,{path:e.path}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path.slice(e.path.lastIndexOf(`/`)+1)}),e.tail]})},e.id)})]});return(0,Q.jsx)(`ul`,{role:`tree`,"aria-label":i,className:`m-0 flex flex-col p-0`,children:u(a,0)})}function Kr(e){let t={name:``,path:``,dirs:new Map};for(let n of e){let e=t;for(let t of n.split(`/`).filter(Boolean))e.dirs.has(t)||e.dirs.set(t,{name:t,path:e.path?`${e.path}/${t}`:t,dirs:new Map}),e=e.dirs.get(t)}return t}function qr({folders:e,value:t,onChange:n,label:i}){let a=(0,Z.useMemo)(()=>Kr(e),[e]),[o,c]=(0,Z.useState)(()=>new Set(t.flatMap(e=>e.split(`/`).slice(0,-1).map((e,t,n)=>n.slice(0,t+1).join(`/`))))),l=e=>c(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e])),u=e=>t.find(t=>t!==e&&e.startsWith(`${t}/`)),d=(e,r)=>n(r?[...t.filter(t=>!t.startsWith(`${e}/`)),e]:t.filter(t=>t!==e)),f=(e,n)=>{let i=e.dirs.size>0,a=o.has(e.path),c=u(e.path),f=!!c||t.includes(e.path);return(0,Q.jsxs)(`div`,{className:H(`flex h-10 items-center gap-2 rounded-[8px] pr-2`,f?`bg-surface-strong`:`hover:bg-surface-muted`),style:{paddingLeft:`${n*20}px`},children:[i?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>l(e.path),"aria-label":`${a?`Close`:`Open`} ${e.name}`,"aria-expanded":a,className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-[6px] border-0 bg-transparent text-muted hover:text-ink`,children:(0,Q.jsx)(x,{size:14,"aria-hidden":`true`,className:H(`transition-transform duration-200`,a&&`rotate-90`)})}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`w-8 flex-none`}),(0,Q.jsxs)(`label`,{className:H(`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,c?`cursor-default text-muted`:`cursor-pointer text-ink`),"data-tip":c?`In ${c}, ticked`:void 0,children:[(0,Q.jsx)(dt,{checked:f,disabled:!!c,onCheckedChange:t=>d(e.path,t===!0),"aria-label":e.path}),i&&a?(0,Q.jsx)(r,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}):(0,Q.jsx)(s,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.name})]})]})},p=(e,n)=>[...e.dirs.values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,Q.jsxs)(`li`,{role:`treeitem`,"aria-expanded":e.dirs.size?o.has(e.path):void 0,"aria-selected":t.includes(e.path),className:`list-none`,children:[f(e,n),e.dirs.size>0&&(0,Q.jsx)(Xe,{open:o.has(e.path),id:`ft-${e.path}`,children:(0,Q.jsx)(`ul`,{role:`group`,className:`m-0 p-0`,children:p(e,n+1)})})]},e.path));return(0,Q.jsx)(`ul`,{role:`tree`,"aria-label":i,"aria-multiselectable":`true`,className:`m-0 p-0`,children:p(a,0)})}function Jr({title:e,side:t,file:n,lang:r,text:i,missing:a}){let o=(i??``).split(`
|
|
8
|
+
`),s=Je(i||null,r);return(0,Q.jsxs)(`figure`,{className:`m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Q.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-semibold text-ink`,children:t}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink-2`,"data-tip":n,children:n||e}),i&&(0,Q.jsx)(ut,{text:i,label:`Copy ${n||t}`})]}),i?(0,Q.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[13px] leading-[1.6]`,children:[(0,Q.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft px-4 py-4 text-right text-muted select-none`,children:o.map((e,t)=>`${t+1}\n`).join(``)}),(0,Q.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-4 py-4`,children:(0,Q.jsx)(`code`,{className:`hljs`,children:s})})]}):(0,Q.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:a||`Nothing to show.`})]})}function Yr({id:e,plan:t,result:n,initial:r}){let i=new Map((n?.units||[]).map(e=>[e.id,e.status])),a=[...t.units.filter(e=>e.kind!==`setup`).map(e=>({unit:e.id,kind:Nt[e.kind],source:e.source,target:e.target,status:i.get(e.id)})),...t.copies.map((e,t)=>({unit:`c${t}`,kind:`Data`,source:e.source,target:e.target,data:!0}))],[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(r||a.find(e=>e.kind===`Test`)?.unit||a[0]?.unit||``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{c&&(p(``),G.pair(e,c).then(d,e=>p(e.message)))},[e,c,n?.units.length,n?.endedAt]);let m=a.filter(e=>!o||`${e.source} ${e.target}`.toLowerCase().includes(o.toLowerCase())),h=a.filter(e=>e.status===`migrated`).length,g=a.filter(e=>e.status===`failed`||e.status===`blocked`).length;return(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-4 @4xl:h-[calc(var(--screen)-320px)] @4xl:min-h-[540px] @4xl:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`nav`,{"aria-label":`Files`,className:`flex max-h-[360px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-4 @4xl:max-h-none`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 px-1`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-semibold`,children:`Files`}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[h,` migrated, `,g,` failed, of `,a.length,` files`]})]}),(0,Q.jsx)(Re,{id:`find-a-file`,label:`Find a file`,value:o,onChange:s,className:`max-w-none flex-none`}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m.length?(0,Q.jsx)(Gr,{label:`Files`,selected:c,onSelect:l,files:m.map(e=>({id:e.unit,path:e.target,title:e.source?`from ${e.source}`:void 0,tail:(0,Q.jsx)(`span`,{role:`img`,"aria-label":e.status?Ct[e.status].label:e.data?`Copied`:`Waiting`,className:H(`size-2 flex-none rounded-full`,e.status===`migrated`?`bg-pass`:e.status===`failed`?`bg-fail`:e.status===`blocked`?`bg-warn`:e.status===`written`?`bg-line-strong`:`bg-line`)})}))}):(0,Q.jsx)(`p`,{className:`m-0 px-2 py-4 text-[13px] text-muted`,children:`No file matches.`})})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[f&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:f}),(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-4 @3xl:grid-cols-2`,children:[(0,Q.jsx)(Jr,{title:`Source`,side:`Source`,file:u?.source?.path,lang:u?.source?.lang||`plaintext`,text:u?.source?.text,missing:u&&!u.source?`This file is made new for the target.`:void 0}),(0,Q.jsx)(Jr,{title:`Target`,side:`Migrated`,file:u?.target.path,lang:u?.target.lang||`plaintext`,text:u?.target.text,missing:u&&!u.target.exists?`Not written yet.`:void 0})]})]})]})}var Xr=[`prepare`,`setup`,`migrate`,`validate`,`fix`,`review`];function Zr(e){if(e.job?.running)return{label:e.job.kind===`verify`?`Validating`:e.job.kind===`fix`?`Fixing`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:t.stage===`fix`?`Fixing`:`Running`,tone:`running`}:t?xt[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ot[e.plan.feasibility.verdict]}var Qr=e=>e.slice(e.lastIndexOf(`/`)+1);function $r({id:e,title:t,targetDir:n,onClose:r}){let[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),d=async()=>{c(!0),u(``);try{await G.delete(e,i),location.hash=B(`migration`,`migrations`)}catch(e){u(e.message),c(!1)}};return(0,Q.jsx)(st,{open:!0,onClose:r,title:`Delete this migration`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),`Keep`]}),(0,Q.jsxs)(K,{variant:`danger`,disabled:s||i!==e,onClick:()=>void d(),children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Q.jsx)(W,{value:i,onChange:e=>o(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function ei({d:e,planView:t}){let n=e.result;if(!n)return(0,Q.jsx)(Q.Fragment,{children:t});let r=new Map(n.units.map(e=>[e.id,e])),i=e.plan.units.filter(e=>e.kind===`test`),a=n.units.filter(e=>e.kind===`test`&&e.status===`migrated`).length,o=e.plan.units.filter(e=>e.kind!==`setup`),s=n.units.filter(e=>e.kind!==`setup`&&(e.status===`migrated`||e.status===`written`)).length,c=n.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,l=e.plan.source.stack,[u,...d]=e.plan.target.id.split(`-`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:`Tests passing`,value:`${a} / ${i.length}`,tone:a===i.length&&i.length?`text-pass`:void 0}),(0,Q.jsx)(Y,{label:`Files migrated`,value:`${s} / ${o.length}`}),(0,Q.jsx)(Y,{label:`Need attention`,value:c,tone:c?`text-fail`:void 0}),(0,Q.jsx)(Y,{label:n.status===`running`?`Running for`:`Took`,value:Tt(n.status===`running`?Date.now()-Date.parse(n.startedAt):n.ms)})]}),n.notes&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n.notes}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Q.jsx)(tt,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @3xl:table-cell`),children:`Note`})]}),children:e.plan.units.map(e=>{let t=r.get(e.id),n=t?Ct[t.status]:null;return(0,Q.jsxs)(`tr`,{className:et,children:[(0,Q.jsxs)(`td`,{className:J,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.kind===`setup`?`Project set-up`:Qr(e.target)}),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:e.source?`from ${Qr(e.source)}`:e.target})]}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap`),children:n?(0,Q.jsx)(Ne,{tone:n.tone,children:n.label}):(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`})}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:t?.problems?.[0]||t?.reason||``})})]},e.id)})}),(0,Q.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-6 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`From`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[l&&(0,Q.jsx)(St,{framework:l.framework,language:l.language}),e.plan.source.title]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-ink-2`,children:[(0,Q.jsx)(zt,{kind:e.origin.kind,label:e.origin.label,size:15}),(0,Q.jsxs)(`span`,{className:`truncate`,"data-tip":e.origin.label,children:[Mt(e.origin.label),e.origin.branch?`, branch ${e.origin.branch}`:``]})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`To`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Q.jsx)(St,{framework:u,language:d.join(`-`)}),e.plan.target.title]}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 border-t border-line-soft pt-4`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Q.jsx)(`dd`,{className:`m-0 text-right`,children:kt(n.startedAt)}),n.model&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Q.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":n.model,children:n.model})]}),n.reverted.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Q.jsxs)(`dd`,{className:`m-0 text-right`,children:[n.reverted.length,` edits outside the target`]})]})]})]})]})]})}function ti({d:e,events:n,picked:r,setPicked:i,busy:a,working:o,onFix:s,onCheck:c}){let[l,u]=(0,Z.useState)(``),d=(0,Z.useRef)(null),f=e.result?.validation?.tests||[],p=f.filter(e=>!e.ok),m=[];for(let t of e.result?.fixes||[])t.auto||m.push({who:`you`,text:t.note?`${t.note}`:`Fix ${Qr(t.target)}`,at:t.at,detail:t.note?`for ${Qr(t.target)}`:void 0}),m.push({who:`agent`,tone:t.ok?`ok`:`fail`,at:t.at,text:t.ok?`${Qr(t.target)} passes now${t.attempts>1?` (${t.attempts} tries)`:``}. ${t.reason||``}`.trim():`I could not make ${Qr(t.target)} pass. ${t.problems?.[0]||t.reason||``}`.trim(),detail:t.auto?`after the first check`:void 0});let h=o?n.filter(e=>e.stage===`fix`&&(e.kind===`agent`||e.kind===`ok`||e.kind===`fail`||e.kind===`info`)).slice(-6):[];(0,Z.useEffect)(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[m.length,h.length]);let g=()=>{let e=[...r];e.length&&(s(e,l.trim()),u(``))},_=e=>{let t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(t)};return(0,Q.jsxs)(`section`,{"aria-label":`Mover`,className:`flex h-[560px] min-h-0 min-w-0 flex-col overflow-hidden rounded-[14px] card border @5xl:h-full`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center gap-4 border-b border-line-soft px-4 py-4`,children:[(0,Q.jsx)(Ve,{agent:`forgeqe-migrate`,px:28,working:o,decorative:!0}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-semibold`,children:`Mover`}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:o?`Working on it…`:p.length?`${p.length} test${p.length===1?``:`s`} to fix`:`Every test passes`})]}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,disabled:a,onClick:c,"data-tip":`Run every migrated test again`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Run`]})]}),(0,Q.jsxs)(`ol`,{ref:d,"aria-live":`polite`,className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-4 overflow-y-auto bg-surface-muted p-4`,children:[!m.length&&!h.length&&(0,Q.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[12px] bg-bg p-4 text-[13px] text-ink-2`,children:[(0,Q.jsx)(`span`,{children:`I fix migrated tests that fail. Pick the tests below and tell me what you know, or just send.`}),p.length>0&&(0,Q.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>s(p.map(e=>e.id),``),"data-tip":`Fix all failing tests`,className:`inline-flex items-center gap-2 self-start rounded-[8px] border-0 bg-surface-strong px-2 py-2 text-[13px] font-medium text-ink hover:bg-line disabled:opacity-50`,children:[(0,Q.jsx)(D,{size:14,"aria-hidden":`true`}),`Fix all`]})]}),m.map((e,t)=>(0,Q.jsxs)(`li`,{className:H(`flex max-w-[92%] flex-col gap-1`,e.who===`you`?`self-end items-end`:`self-start`),children:[(0,Q.jsxs)(`span`,{className:H(`rounded-[12px] px-4 py-2 text-[13px] leading-relaxed [overflow-wrap:anywhere]`,e.who===`you`?`bg-accent text-accent-ink`:e.tone===`fail`?`border border-fail-soft bg-bg text-ink`:`bg-bg text-ink`),children:[e.who===`agent`&&(0,Q.jsx)(`span`,{className:H(`mr-1 font-semibold`,e.tone===`ok`?`text-pass`:`text-fail`),children:e.tone===`ok`?`✓`:`✗`}),e.text]}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.detail?`${e.detail}, `:``,lt(e.at)]})]},t)),h.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex max-w-[92%] items-start gap-2 self-start rounded-[12px] bg-bg px-4 py-2 text-[13px] text-ink-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`flex-none`,e.kind===`ok`?`text-pass`:e.kind===`fail`?`text-fail`:`text-muted`),children:e.kind===`ok`?`✓`:e.kind===`fail`?`✗`:`•`}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text})]},`live-${t}`))]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft p-4`,children:[f.length>0&&(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Tests to fix`,className:`flex flex-wrap gap-2`,children:f.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":r.has(e.id),onClick:()=>_(e.id),className:H(`inline-flex min-h-7 items-center gap-2 rounded-full border px-2 text-[13px]`,r.has(e.id)?`border-accent bg-accent-soft text-ink`:`border-line-soft bg-bg text-ink-2 hover:bg-surface-muted`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-1.5 rounded-full`,e.ok?`bg-pass`:`bg-fail`)}),Qr(e.target)]},e.id))}),(0,Q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Q.jsx)(Ae,{"aria-label":`Message to the agent`,value:l,rows:2,maxLength:2e3,placeholder:r.size?`What should change? (optional)`:`Pick a test above first`,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!a&&r.size&&(e.preventDefault(),Ue(e)||g())},className:`min-h-[44px] flex-1 resize-none`}),(0,Q.jsx)(K,{variant:`primary`,size:`icon`,"aria-label":`Send to the agent`,"data-tip":`Send to the agent`,disabled:a||!r.size,onClick:g,children:(0,Q.jsx)(t,{"aria-hidden":`true`})})]})]})]})}var ni=`@5xl:h-[calc(var(--screen)-320px)] @5xl:min-h-[540px]`;function ri({d:e,events:t,busy:n,working:r,onFix:i,onCheck:a,onCompare:o}){let s=e.result?.validation?.tests||[],c=e.result?.fixes||[],l=s.filter(e=>!e.ok).map(e=>e.id).join(`,`),[u,d]=(0,Z.useState)(()=>s.find(e=>!e.ok)?.id||s[0]?.id||``),[f,p]=(0,Z.useState)(()=>new Set(s.filter(e=>!e.ok).map(e=>e.id)));(0,Z.useEffect)(()=>p(new Set(l?l.split(`,`):[])),[l]);let m=s.find(e=>e.id===u),h=m&&c.findLast(e=>e.id===m.id);return s.length?(0,Q.jsxs)(`div`,{className:H(`grid grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,1fr)_380px]`,ni),children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(tt,{label:`Migrated tests`,placeholder:`Find a test`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`th`,{scope:`col`,className:q,children:[`Test `,(0,Q.jsxs)(`span`,{className:`font-normal`,children:[`· `,s.filter(e=>e.ok).length,` of `,s.length,` pass`]})]}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Result`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @2xl:table-cell`),children:`Kept from the source`}),(0,Q.jsx)(`th`,{scope:`col`,className:H($e,`hidden @3xl:table-cell`),children:`Time`})]}),children:s.map(e=>{let t=c.findLast(t=>t.id===e.id);return(0,Q.jsxs)(`tr`,{onClick:()=>d(e.id),"aria-selected":u===e.id,className:H(`cursor-pointer border-t border-line-soft`,u===e.id?`bg-accent-soft`:`hover:bg-surface-muted`),children:[(0,Q.jsxs)(`td`,{className:J,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>d(e.id),className:`cursor-pointer border-0 bg-transparent p-0 text-left font-medium text-ink`,children:Qr(e.target)}),t&&(0,Q.jsx)(`span`,{className:H(`block text-[13px]`,t.ok?`text-pass`:`text-muted`),children:t.ok?`Fixed by the agent`:`The agent could not fix it`})]}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap`),children:(0,Q.jsx)(Ne,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})}),(0,Q.jsxs)(`td`,{className:H(J,`hidden text-[13px] whitespace-nowrap text-ink-2 @2xl:table-cell`),children:[(0,Q.jsxs)(`span`,{className:e.after.tests<e.before.tests?`text-fail`:void 0,children:[e.after.tests,`/`,e.before.tests,` tests`]}),`, `,(0,Q.jsxs)(`span`,{className:e.after.assertions<e.before.assertions?`text-warn`:void 0,children:[e.after.assertions,`/`,e.before.assertions,` checks`]})]}),(0,Q.jsx)(`td`,{className:H(Ge,`hidden text-[13px] text-muted @3xl:table-cell`),children:e.ms?Tt(e.ms):`Not timed`})]},e.id)})}),m&&(0,Q.jsxs)(`section`,{"aria-label":`${Qr(m.target)} details`,className:`flex min-h-[260px] flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:Qr(m.target)}),(0,Q.jsx)(Ne,{tone:m.ok?`pass`:`fail`,children:m.ok?`Passes`:m.exitCode===null&&m.ms?`Timed out`:`Fails`}),m.source&&(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`from `,Qr(m.source)]}),(0,Q.jsx)(`span`,{className:`flex-1`}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>o(m.id),children:[(0,Q.jsx)(j,{"aria-hidden":`true`}),`Compare`]}),!m.ok&&(0,Q.jsxs)(K,{size:`sm`,disabled:n,onClick:()=>p(new Set([m.id])),children:[(0,Q.jsx)(D,{"aria-hidden":`true`}),`Fix`]})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-auto bg-surface-muted px-4 py-4`,children:[m.problems.length>0&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:m.problems.join(` `)}),h&&(0,Q.jsxs)(`p`,{className:H(`m-0 text-[13px]`,h.ok?`text-pass`:`text-ink-2`),children:[h.ok?`Fixed by the agent`:`The agent could not fix it`,h.reason?`: ${h.reason}`:`.`]}),m.command&&(0,Q.jsxs)(`code`,{className:`block font-mono text-[13px] text-muted`,children:[`$ `,m.command]}),(0,Q.jsx)(`pre`,{className:`m-0 flex-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:m.output||(m.ok?`${m.after.tests} test${m.after.tests===1?``:`s`} passed in ${Tt(m.ms)}.`:`No output.`)})]})]})]}),(0,Q.jsx)(ti,{d:e,events:t,picked:f,setPicked:p,busy:n,working:r,onFix:i,onCheck:a})]}):(0,Q.jsx)(Fe,{center:!0,className:`py-6`,children:e.result?`The tests are checked once every file is migrated.`:`Start the migration first.`})}var ii={ok:{mark:`✓`,cls:`text-pass`},fail:{mark:`✗`,cls:`text-fail`},info:{mark:`•`,cls:`text-muted`},agent:{mark:`•`,cls:`text-accent-fg`},tool:{mark:`·`,cls:`text-muted`}};function ai({events:e,running:t}){let n=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,t]);let r=e.filter(e=>e.kind!==`tool`);return(0,Q.jsxs)(`ol`,{ref:n,"aria-live":t?`polite`:void 0,"aria-label":`Activity`,className:`m-0 flex max-h-[60vh] list-none flex-col overflow-y-auto rounded-[12px] card border p-0`,children:[r.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 text-[13px] last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:`w-[64px] flex-none text-[13px] text-muted tabular-nums`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:H(`w-3 flex-none text-center`,ii[e.kind].cls),children:ii[e.kind].mark}),(0,Q.jsx)(`span`,{className:H(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:`text-ink-2`),children:e.text})]},t)),!r.length&&(0,Q.jsx)(`li`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`Nothing yet.`})]})}function oi({id:e,plan:t}){let[n,r]=(0,Z.useState)(null),[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(`overview`),[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)([]),[p,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),[v,b]=(0,Z.useState)(!1),x=(0,Z.useRef)(0),S=(0,Z.useCallback)(()=>{G.detail(e).then(e=>{r(e),o(``)},e=>o(e.message)),G.events(e,x.current).then(e=>{e.next<x.current?(x.current=0,f([])):(x.current=e.next,e.events.length&&f(t=>[...t,...e.events].slice(-2e3)))},()=>{})},[e]);(0,Z.useEffect)(S,[S]);let C=!!(n?.job?.running||n?.result?.status===`running`);(0,Z.useEffect)(()=>{if(!C)return;let e=rt(S,1500);return()=>Qe(e)},[C,S]);let w=async e=>{_(!0),o(``);try{r(await e()),setTimeout(S,800)}catch(e){o(e.message)}finally{_(!1)}};if(!n)return i?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let T=Zr(n),ee=wt(n.plan,n.result),E=n.result,ne=(E?.validation?.tests||[]).filter(e=>!e.ok).length,D=[{id:`overview`,label:`Overview`,icon:me},{id:`tests`,label:`Tests`,icon:te,n:E?.validation?`${E.validation.tests.length-ne}/${E.validation.tests.length}`:void 0,tone:ne?`text-fail`:void 0},{id:`compare`,label:`Compare`,icon:j},{id:`activity`,label:`Activity`,icon:k}];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[n.plan.source.stack&&(0,Q.jsx)(St,{framework:n.plan.source.stack.framework,language:n.plan.source.stack.language,size:22}),n.plan.source.title]}),(0,Q.jsx)(he,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(St,{framework:n.plan.target.id.split(`-`)[0],language:n.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),n.plan.target.title]})]}),(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm text-muted`,children:[(0,Q.jsx)(zt,{kind:n.origin.kind,label:n.origin.label,size:15}),(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:Mt(n.origin.label)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsxs)(`span`,{children:[`into `,(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:n.plan.target.dir})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Ne,{tone:T.tone,children:T.label}),C?(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:g,onClick:()=>void w(()=>G.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the migration`,className:`text-fail hover:text-fail`,children:(0,Q.jsx)(se,{fill:`currentColor`,"aria-hidden":`true`})}):(0,Q.jsxs)(Q.Fragment,{children:[E?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{variant:`icon`,size:`icon`,onClick:()=>G.report(e).then(e=>h(e.text),()=>h(``)),"aria-label":`Report`,"data-tip":`Report`,children:(0,Q.jsx)(P,{"aria-hidden":`true`})}),(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:g,onClick:()=>void w(()=>G.verify(e)),"aria-label":`Run the tests`,"data-tip":`Check again: run every migrated test again`,children:(0,Q.jsx)(y,{"aria-hidden":`true`})})]}):null,(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:g,onClick:()=>b(!0),"aria-label":`Delete`,"data-tip":`Delete: remove this plan from the list; converted tests stay`,children:(0,Q.jsx)(a,{"aria-hidden":`true`})})]})]})]}),v&&(0,Q.jsx)($r,{id:e,title:`${n.plan.source.title} → ${n.plan.target.title}`,targetDir:n.plan.target.dir,onClose:()=>b(!1)}),(0,Q.jsxs)(`div`,{className:H(`grid grid-cols-[minmax(0,1fr)] items-start gap-6`,E&&`@3xl:grid-cols-[minmax(220px,260px)_minmax(0,1fr)] @3xl:gap-10`),children:[E&&(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6 @3xl:border-r @3xl:border-line-soft @3xl:pr-8 @3xl:pb-8`,children:(0,Q.jsx)(jt,{label:`Migration stages`,items:It(Xr,E.stages),...C?{progress:ee}:{}})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[i&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),(0,Q.jsx)(it,{prefix:`mtab`,className:`mb-0`,tabs:D,current:s,onPick:c,label:`Migration`}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${s}`,"aria-labelledby":`mtab-${s}`,className:`flex min-w-0 flex-col gap-4`,children:[s===`overview`&&(0,Q.jsx)(ei,{d:n,planView:t(n)}),s===`tests`&&(0,Q.jsx)(ri,{d:n,events:d,busy:g||C,working:C,onFix:(t,n)=>void w(()=>G.fix(e,t,n)),onCheck:()=>void w(()=>G.verify(e)),onCompare:e=>(u(e),c(`compare`))}),s===`compare`&&(0,Q.jsx)(Yr,{id:e,plan:n.plan,result:E,initial:l}),s===`activity`&&(0,Q.jsx)(ai,{events:d,running:C})]})]})]}),(0,Q.jsx)(st,{open:p!==null,onClose:()=>h(null),wide:!0,title:`Report`,description:`migrate.md for ${n.plan.id}`,footer:(0,Q.jsxs)(K,{onClick:()=>h(null),children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Close`]}),children:p?(0,Q.jsx)(at,{text:p}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report yet.`})})]})}var si=e=>/^[A-Za-z0-9_.-]+(\/[A-Za-z0-9_.-]+)*$/.test(e)&&!e.split(`/`).some(e=>e===`..`||e===`.`);function ci(e){let t=[...new Set(e.map(e=>e.replace(/\/+$/,``)).filter(si))].sort();return t.filter(e=>!t.some(t=>t!==e&&e.startsWith(`${t}/`)))}function li(e,t=``){let n=ci(e),r=t.trim().replace(/^\/+/,``);return n.length===0?{from:`.`,...r?{only:r}:{}}:{from:`.`,only:`${n.length===1?n[0]:`{${n.join(`,`)}}`}/${r||`**`}`}}var ui=[{id:`git`,label:`Git`,sub:`Clone a repository`},{id:`folder`,label:`Folder`,sub:`On this computer`},{id:`upload`,label:`Upload`,sub:`A folder or files`},{id:`paste`,label:`Paste`,sub:`A few test files`},{id:`project`,label:`This project`,sub:`Tests already here`}],di=[`Keep one page object per page, in pages/.`,`Read the base URL from BASE_URL.`,`Keep test names as they are.`];async function fi(e,t,n){let r=[],i=0,a=null,o=0,s=async()=>{r.length&&(a=await G.files(e,r),o+=r.length,n(o),r=[],i=0)};for(let e of t){let t=e.webkitRelativePath||``,n=t&&t.split(`/`).slice(1).join(`/`)||e.name,a=new Uint8Array(await e.arrayBuffer()),o=``;for(let e=0;e<a.length;e+=32768)o+=String.fromCharCode(...a.subarray(e,e+32768));let c=btoa(o);i+c.length>8388608&&await s(),r.push({path:n,data:c}),i+=c.length}return await s(),a}var pi=e=>(e.webkitRelativePath||e.name).split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`);function mi({view:e,kind:t,setKind:n,src:o,setSrc:s,from:c,setFrom:l,folders:u,setFolders:d,stack:f,setStack:p,custom:h,setCustom:_,found:v,setFound:y,tosca:b,onNext:x}){let[S,w]=(0,Z.useState)(``),[te,E]=(0,Z.useState)(``),[ne,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(e.credentials),[M,N]=(0,Z.useState)(null),[re,ie]=(0,Z.useState)(``),[P,F]=(0,Z.useState)([{path:``,text:``}]),[I,ae]=(0,Z.useState)(``),[oe,L]=(0,Z.useState)(``),[se,R]=(0,Z.useState)(``),ce=(0,Z.useRef)(null),le=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{ce.current?.setAttribute(`webkitdirectory`,``)},[t,o]);let z=o?.workspace,ue=async(e,t)=>{ae(e),L(``),R(``);try{await t()}catch(e){L(e.message)}finally{ae(``)}},de=e=>{s(e),l(`.`),y(e.discovery),x&&!e.tosca?.length&&e.discovery?.stack&&x()};(0,Z.useEffect)(()=>{if(t!==`project`)return;let e=setTimeout(()=>G.discover(void 0,c||`.`).then(y,()=>y(null)),300);return()=>clearTimeout(e)},[t,c,y]);let fe=e=>{let t=e.filter(e=>!pi(e));if(!t.length)return L(`Nothing to send: every file is hidden or a dependency.`);ue(`upload`,async()=>{let n=e[0],r=await G.source({kind:`upload`,label:n?.webkitRelativePath?n.webkitRelativePath.split(`/`)[0]:t.length===1?t[0].name:`${t.length} files`});await fi(r.workspace.id,t,e=>R(`Sending ${e} of ${t.length} files…`)),de(await G.finish(r.workspace.id))})},me=t===`project`||!!z?.ready,V=()=>{if(!I){if(L(``),me)return f===`other`&&!h.tests.trim()?L(`Say which files are the tests, such as *.jmx, under Framework.`):x?.();if(t===`git`){if(!S.trim())return L(`Paste the repository's address first.`);ue(`read`,async()=>de(await G.source({kind:`git`,url:S.trim(),...te?{branch:te}:{},...O?{tokenVar:O}:{}})))}else if(t===`folder`){if(!re.trim())return L(`Type the folder's path first.`);ue(`read`,async()=>de(await G.source({kind:`folder`,folder:re.trim()})))}else{if(t===`upload`)return L(`Choose a folder or some files first.`);if(t===`paste`){if(P.some(e=>!e.path.trim()||!e.text.trim()))return L(`Give every file a name and its code.`);ue(`read`,async()=>{let e=await G.source({kind:`paste`});await G.files(e.workspace.id,P.map(e=>({path:e.path.trim(),text:e.text}))),de(await G.finish(e.workspace.id))})}}}},ge=!!I,_e={read:t===`git`?`Cloning…`:t===`folder`?`Copying…`:`Reading…`,upload:`Sending…`,test:`Testing…`,token:`Saving…`}[I],[ve,ye]=(0,Z.useState)(null),be=e=>{d(ci(e)),ye(null)},xe=e=>{e!==t&&(d([]),n(e),s(null),y(null),L(``),l(e===`project`?``:`.`))},Se=z?.ready||t===`project`&&v;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[!z?.ready&&(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Where the tests are`,onKeyDown:e=>{let n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];if(!n||ge)return;e.preventDefault();let r=ui.length,i=ui[(ui.findIndex(e=>e.id===t)+n+r)%r].id;xe(i),requestAnimationFrame(()=>e.currentTarget.querySelector(`[aria-label="${ui.find(e=>e.id===i).label}"]`)?.focus())},className:`grid grid-cols-[repeat(auto-fill,minmax(208px,1fr))] gap-2`,children:ui.map(e=>(0,Q.jsx)(wr,{on:t===e.id,onPick:()=>xe(e.id),disabled:ge,logo:(0,Q.jsx)(bt,{logo:Lt[e.id].Logo,icon:Lt[e.id].Icon,size:20}),title:e.label,sub:e.sub,label:e.label},e.id))}),Se?(0,Q.jsx)(hi,{found:v,ws:z,onChange:z?()=>{s(null),y(null),requestAnimationFrame(()=>document.getElementById(`mig-step`)?.focus())}:void 0}):t===`git`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Q.jsx)($,{id:`mig-url`,label:`Repository`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`relative min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2`,children:(0,Q.jsx)(bt,{logo:Rt(S).Logo,size:18})}),(0,Q.jsx)(W,{inputMode:`url`,id:`mig-url`,value:S,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/ui-tests.git`,onChange:e=>(w(e.target.value),D(null)),onKeyDown:e=>He(e)&&V(),className:`w-full pl-10 font-mono`})]}),(0,Q.jsx)(K,{variant:`icon`,size:`icon`,disabled:!!I||!S.trim(),"aria-label":`Test the connection`,"data-tip":`Test the connection and list its branches`,onClick:()=>void ue(`test`,async()=>{let e=await G.testRepository(S.trim(),O||void 0);D(e.branches),!te&&e.head&&E(e.head),R(`Connected: ${e.branches.length} branch${e.branches.length===1?``:`es`}`)}),children:(0,Q.jsx)(T,{"aria-hidden":`true`})})]})}),(0,Q.jsx)($,{id:`mig-branch`,label:`Branch`,children:ne?.length?(0,Q.jsx)(ke,{id:`mig-branch`,value:te,onChange:e=>E(e.target.value),children:ne.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))}):(0,Q.jsx)(W,{id:`mig-branch`,value:te,spellCheck:!1,maxLength:200,placeholder:`Default branch`,onChange:e=>E(e.target.value),className:`font-mono`})})]}),(0,Q.jsx)(pt,{title:O?`Private repository: ${O}`:`Private repository? Add a token`,defaultOpen:!!O,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsx)($,{id:`mig-token`,label:`Access token`,help:M?void 0:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>N({name:`REPO_TOKEN`,value:``}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg underline`,children:`Save a new token`}),children:(0,Q.jsxs)(ke,{id:`mig-token`,value:O,onChange:e=>k(e.target.value),className:`max-w-[360px]`,children:[(0,Q.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),A.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}),M&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,Q.jsx)($,{id:`mig-token-name`,label:`Name`,children:(0,Q.jsx)(W,{id:`mig-token-name`,value:M.name,spellCheck:!1,maxLength:64,onChange:e=>N({...M,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})}),(0,Q.jsx)($,{id:`mig-token-value`,label:`Token`,children:(0,Q.jsx)(W,{id:`mig-token-value`,type:`password`,autoComplete:`off`,value:M.value,onChange:e=>N({...M,value:e.target.value}),className:`w-[260px] max-w-full`})}),(0,Q.jsxs)(K,{disabled:!!I||!M.name||!M.value,onClick:()=>void ue(`token`,async()=>{await De.saveSecrets({[M.name]:M.value}),j([...new Set([...A,M.name])].sort()),k(M.name),N(null)}),children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),`Save`]}),(0,Q.jsxs)(K,{variant:`ghost`,onClick:()=>N(null),children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsx)(`span`,{className:`w-full text-[13px] text-muted`,children:`Kept in ForgeQE's credential store, never in the address or on this page.`})]})]})})]}):t===`folder`?(0,Q.jsx)($,{id:`mig-folder`,label:`Folder path`,help:`Copied first; the folder itself is never changed.`,children:(0,Q.jsx)(W,{id:`mig-folder`,value:re,spellCheck:!1,maxLength:1e3,placeholder:`/home/me/projects/shop-ui-tests`,onChange:e=>ie(e.target.value),onKeyDown:e=>He(e)&&V(),className:`font-mono`})}):t===`upload`?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-[14px] border border-dashed border-line-strong px-6 py-10 text-center`,children:[(0,Q.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Choose a folder of tests, or some files. They are sent as soon as you pick them.`}),(0,Q.jsx)(`input`,{ref:ce,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&fe([...e.target.files])}),(0,Q.jsx)(`input`,{ref:le,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&fe([...e.target.files])}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,Q.jsxs)(K,{disabled:!!I,onClick:()=>ce.current?.click(),"data-tip":`Choose a folder`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),`Folder`]}),(0,Q.jsxs)(K,{disabled:!!I,onClick:()=>le.current?.click(),"data-tip":`Choose files`,children:[(0,Q.jsx)(ee,{"aria-hidden":`true`}),`Files`]})]})]}):t===`paste`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[P.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(W,{"aria-label":`File ${t+1} name`,value:e.path,spellCheck:!1,maxLength:300,placeholder:t?`pages/LoginPage.java`:`tests/LoginTest.java`,onChange:e=>F(P.map((n,r)=>r===t?{...n,path:e.target.value}:n)),className:`max-w-[360px] font-mono`}),P.length>1&&(0,Q.jsx)(K,{variant:`icon`,size:`icon`,"aria-label":`Remove file ${t+1}`,"data-tip":`Remove file ${t+1}`,onClick:()=>F(P.filter((e,n)=>n!==t)),children:(0,Q.jsx)(a,{"aria-hidden":`true`})})]}),(0,Q.jsx)(Ae,{"aria-label":`File ${t+1} code`,value:e.text,rows:7,spellCheck:!1,placeholder:`Paste the code`,onChange:e=>F(P.map((n,r)=>r===t?{...n,text:e.target.value}:n)),className:`font-mono`})]},t)),(0,Q.jsxs)(K,{variant:`ghost`,className:`self-start`,onClick:()=>F([...P,{path:``,text:``}]),"data-tip":`Add a file`,children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),`Add`]})]}):null,oe&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:oe}),se&&!oe&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:se}),me&&b.n>0&&(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`What to migrate`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`What to migrate`,className:`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2`,children:[(0,Q.jsx)(wr,{on:!b.on,disabled:b.locked,onPick:()=>b.set(!1),logo:(0,Q.jsx)(g,{size:20,"aria-hidden":`true`}),title:`Test code`,sub:b.locked?`Pick the source again for its code`:v?`${v.counts.tests} test file${v.counts.tests===1?``:`s`}`:`Selenium, Cypress, Playwright…`,label:`Test code`}),(0,Q.jsx)(wr,{on:b.on,onPick:()=>b.set(!0),logo:(0,Q.jsx)(bt,{logo:Lt.tosca.Logo,icon:Lt.tosca.Icon,size:20}),title:`Tosca test cases`,sub:`${b.n} export${b.n===1?``:`s`} (.tsu)`,label:`Tosca test cases`})]}),b.on&&(0,Q.jsxs)(`a`,{href:B(`migration`,`guide`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(pe,{size:14,"aria-hidden":`true`}),`Rather say what to convert? Ask Guide`]})]}),me&&!b.on&&(0,Q.jsx)(pt,{title:v?.stack?`Not quite right? Pick the tests folder or framework`:`Pick the tests folder and framework`,defaultOpen:!v?.stack||f===`other`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{id:`mig-from-label`,className:`text-sm font-medium`,children:`Tests folders`}),(0,Q.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2 rounded-[8px] border border-line bg-field pr-1 pl-4`,children:[(0,Q.jsx)(r,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{"aria-labelledby":`mig-from-label`,className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink`,children:u.length?u.join(`, `):t===`project`?`Whole project`:`All of it`}),(0,Q.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>ye(u),"data-tip":`Pick one or more folders`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),`Choose`]})]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-muted`,children:u.length?`The plan takes only the tests in these folders and the code they use.`:`Where the tests are. Pick one or more; the folders under each are read too.`})]}),(0,Q.jsx)(st,{open:ve!==null,onClose:()=>ye(null),title:`Tests folders`,description:`Tick the folders that hold the tests. A folder takes the ones under it; none ticked is the whole source.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:()=>ye([]),disabled:!ve?.length,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Clear`]}),(0,Q.jsxs)(K,{variant:`primary`,onClick:()=>be(ve||[]),children:[(0,Q.jsx)(C,{"aria-hidden":`true`}),ve?.length?`Use ${ve.length===1?`this folder`:`these ${ci(ve).length} folders`}`:t===`project`?`Use the whole project`:`Use all of it`]})]}),children:(0,Q.jsx)(qr,{label:`Tests folders`,folders:t===`project`?e.folders:o?.folders||[],value:ve||[],onChange:ye})}),(0,Q.jsx)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:(0,Q.jsx)($,{id:`mig-stack`,label:`Framework`,children:(0,Q.jsxs)(ke,{id:`mig-stack`,value:f,onChange:e=>p(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:v?.stack?`${v.title} (detected)`:`Detect`}),e.sources.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.title},e.id)),(0,Q.jsx)(`option`,{value:`other`,children:`Other (name it)`})]})})}),f===`other`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{id:`mig-source-name`,label:`Framework name`,help:`Shown in the plan, such as JMeter or Karate.`,children:(0,Q.jsx)(W,{id:`mig-source-name`,value:h.name,maxLength:40,placeholder:`JMeter`,onChange:e=>_({...h,name:e.target.value})})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`mig-tests`,label:`Test file types`,help:`Such as *.jmx or *.feature.`,children:(0,Q.jsx)(W,{id:`mig-tests`,value:h.tests,spellCheck:!1,maxLength:120,placeholder:`*.jmx`,onChange:e=>_({...h,tests:e.target.value})})}),(0,Q.jsx)($,{id:`mig-support`,label:`Support file types (optional)`,help:`Code the tests use, such as *.groovy.`,children:(0,Q.jsx)(W,{id:`mig-support`,value:h.support,spellCheck:!1,maxLength:120,placeholder:`None`,onChange:e=>_({...h,support:e.target.value})})})]})]})]})},v?.stack?`known`:`unknown`),x&&!b.on&&(0,Q.jsx)(Cr,{busy:ge,next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),_e||`Continue`]}),onNext:V,aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:I===`test`?`Testing the connection…`:I===`token`?`Saving the token…`:ge?`Reading the source…`:`Nothing changes until you press Start.`})})]})}function hi({found:e,ws:t,onChange:n}){let r=e?.counts,i=r?.tests??0,a=[r&&r.support?`${r.support} support file${r.support===1?``:`s`}`:``,r&&r.features?`${r.features} feature file${r.features===1?``:`s`}`:``,r&&r.data?`${r.data} data file${r.data===1?``:`s`}`:``].filter(Boolean);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 border-y border-line-soft py-4`,children:[(0,Q.jsx)(`span`,{className:H(`inline-flex size-6 flex-none items-center justify-center rounded-full`,e?.stack?`bg-pass-soft text-pass`:`bg-warn-soft text-warn`),children:e?.stack?(0,Q.jsx)(C,{size:14,"aria-hidden":`true`}):(0,Q.jsx)(o,{size:14,"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{role:`status`,className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[16px] font-semibold tracking-[-0.01em]`,children:[e?.stack&&(0,Q.jsx)(St,{framework:e.stack.framework,language:e.stack.language}),e?`${i} ${e.stack?e.title:``} test file${i===1?``:`s`}`.replace(/\s+/g,` `):`Reading the tests…`]}),(0,Q.jsxs)(`span`,{className:`text-[13px] leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:[[t?`From ${Mt(t.label)}${t.branch?`, branch ${t.branch}`:``}`:`From this project`,...a].join(`, `),`.`,e&&!e.stack?` ForgeQE did not recognise the framework: pick it below.`:``,r&&r.skipped>0?` ${r.skipped} left out: links and large files are not copied.`:``]})]}),n&&(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,onClick:n,"data-tip":`Pick another source`,children:[(0,Q.jsx)(l,{"aria-hidden":`true`}),`Change`]})]})}function gi(e,t){let n=e?.stack;if(!n||n.framework===`playwright`)return;let r=t.filter(e=>e.id.startsWith(`playwright-`));return(r.find(e=>e.id===`playwright-${n.language}`)||r.find(e=>e.id===`playwright-typescript`)||r[0])?.id}function _i({view:e,to:t,setTo:n,other:r,setOther:a,into:o,setInto:s,only:c,setOnly:l,suggested:u,instructions:d,setInstructions:f}){let p=e=>e.split(`-`)[0],m=e=>e.split(`-`).slice(1).join(`-`),h=[...new Map(e.targets.map(e=>[p(e.id),e.framework])).entries()],g=r===null?p(t):``,_=e.targets.filter(e=>p(e.id)===g);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Framework`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[h.map(([r,i])=>{let o=Dt[r];return(0,Q.jsx)(wr,{on:g===r,onPick:()=>(a(null),n((e.targets.find(e=>p(e.id)===r&&m(e.id)===m(t))||e.targets.find(e=>p(e.id)===r)).id)),logo:o?(0,Q.jsx)(o,{width:22,height:22,"aria-hidden":`true`}):null,title:i,sub:u&&p(u)===r?`Suggested for your tests`:xr[r],label:i},r)}),(0,Q.jsx)(wr,{on:r!==null,onPick:()=>a(r??``),logo:(0,Q.jsx)(i,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:`Other`,sub:`Type the framework`,label:`Other framework`})]})]}),r===null?(0,Q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Language`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[_.map(e=>{let r=Et[m(e.id)];return(0,Q.jsx)(wr,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Q.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,sub:e.id===u?`Suggested`:e.title.includes(`(`)&&e.title.slice(e.title.indexOf(`(`)+1,-1).replace(e.language,``).replace(/^,\s*/,``)||void 0,label:e.language},e.id)}),(0,Q.jsx)(wr,{on:!1,onPick:()=>a(`${h.find(([e])=>e===g)?.[1]??``} with `),logo:(0,Q.jsx)(i,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:`Other`,sub:`Name the language`,label:`Other language`})]})]}):(0,Q.jsx)($,{id:`mig-other`,label:`Which framework and language?`,help:`ForgeQE checks it against what it can run, and says so before anything starts.`,children:(0,Q.jsx)(W,{id:`mig-other`,value:r,maxLength:120,autoFocus:!0,placeholder:`Playwright with Java, WebdriverIO TypeScript…`,onChange:e=>a(e.target.value)})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Q.jsx)($,{id:`mig-into`,label:`Output folder`,help:`A new folder. Empty: named after the source and the target.`,children:(0,Q.jsx)(W,{id:`mig-into`,value:o,spellCheck:!1,maxLength:300,placeholder:`tests-playwright`,onChange:e=>s(e.target.value),className:`font-mono`})}),(0,Q.jsx)($,{id:`mig-only`,label:`Only some tests (optional)`,help:`A pattern, such as checkout/** or **/*Login*.`,children:(0,Q.jsx)(W,{id:`mig-only`,value:c,spellCheck:!1,maxLength:200,placeholder:`All tests`,onChange:e=>l(e.target.value),className:`font-mono`})})]}),(0,Q.jsx)(pt,{title:d.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!d.trim(),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsx)($,{id:`mig-instructions`,label:`Rules`,help:`Style and structure for the new code. Every test and check is kept either way.`,children:(0,Q.jsx)(Ae,{id:`mig-instructions`,value:d,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per page.`,onChange:e=>f(e.target.value)})}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:di.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:d.includes(e),onClick:()=>f(d.trim()?`${d.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-surface-strong px-2 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Q.jsx)(i,{size:13,"aria-hidden":`true`}),e]},e))})]})})]})}var vi=[{name:`Select the source`,short:`Source`,about:`Point ForgeQE at your tests: a git repository, a folder, some files, pasted code or this project. It works on a copy.`},{name:`Choose the target`,short:`Target`,about:`Pick the framework and language they become, and where the new code goes. Add your own rules if you have any.`},{name:`Review and start`,short:`Review`,about:`See what moves, what cannot, and the limits to accept. Start runs it in the background.`}];function yi({view:e,review:t,onStart:n,tosca:r}){let[i,a]=(0,Z.useState)(0),[o,s]=(0,Z.useState)(0),[c,l]=(0,Z.useState)(`git`),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(`.`),[m,h]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(``),[v,b]=(0,Z.useState)({name:``,tests:``,support:``}),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(e.targets[0]?.id||``),[T,ee]=(0,Z.useState)(!1),te=e=>(ee(!0),w(e)),[E,ne]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(``),[N,re]=(0,Z.useState)(null),[ie,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(!1),[ae,oe]=(0,Z.useState)(``),L=gi(x,e.targets);(0,Z.useEffect)(()=>{!T&&L&&w(L)},[T,L]),(0,Z.useEffect)(()=>{re(null),P(!1),s(e=>Math.min(e,1))},[c,u,f,m,g,v,k,C,E,D,j]);let[se,R]=(0,Z.useState)(!1),ce=e=>{R(!0),a(e),s(t=>Math.max(t,e)),oe(``)},le=c===`project`||!!u?.workspace?.ready,z=u?.workspace,ue=le?c===`project`?r.view?.exports.length||0:u?.tosca?.length||0:0,[de,B]=(0,Z.useState)(!1),pe=x?.counts.tests;(0,Z.useEffect)(()=>{B(ue>0&&!pe)},[c,z?.id,ue,pe]);let[me,V]=(0,Z.useState)(``),[he,ge]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{if(!de||c===`project`||!z?.ready||me===z.id)return;let e=!0;return ge(``),U.adopt(z.id).then(t=>{e&&(r.onView(t),V(z.id))},t=>e&&(ge(t.message),B(!1))),()=>{e=!1}},[de,c,z?.id,z?.ready,me]);let _e=c!==`project`&&!!z&&me===z?.id,ve=!de||!le?null:c===`project`?{project:!0}:_e?{workspace:z.id}:null,ye={view:e,kind:c,setKind:l,src:u,setSrc:d,from:f,setFrom:p,folders:m,setFolders:h,stack:g,setStack:_,custom:v,setCustom:b,found:x,setFound:S,tosca:{n:ue,on:de,locked:_e,set:B}};if(ve&&r.view)return(0,Q.jsx)(Fr,{view:r.view,onView:r.onView,review:r.review,onStart:r.onStart,embedded:{scope:ve,source:(0,Q.jsx)(mi,{...ye})}},`workspace`in ve?ve.workspace:`project`);let be=async()=>{I(!0),oe(``);try{let e=m.length?li(m,k):{from:f.trim()||`.`,...k.trim()?{only:k.trim()}:{}},t=await G.plan({...c!==`project`&&u?.workspace?{workspace:u.workspace.id}:{},...e.from===`.`?{}:{from:e.from},...g?{stack:g}:{},...g===`other`?{sourceName:v.name.trim(),tests:v.tests.trim(),support:v.support.trim()}:{},...E===null?{to:C}:{to:``,toText:E.trim()},...D.trim()?{into:D.trim()}:{},...e.only?{only:e.only}:{},...j.trim()?{instructions:j.trim()}:{}});re(t),ce(2)}catch(e){oe(e.message)}finally{I(!1)}},xe=N?.plan,Se=xe?.feasibility.findings.some(e=>e.level===`limit`),Ce=xe?.feasibility.verdict===`blocked`,we=e.targets.find(e=>e.id===C),Te=xe?.units.filter(e=>e.kind===`test`).length,H=[`Where are the tests?`,`What should they become?`,`Check the plan, then start`],Ee=[`ForgeQE works on a copy. Your repository and folders are never changed.`,L&&!T&&E===null?`Suggested from your ${x?.title||``} tests. Change it if your team uses something else.`.replace(/\s+/g,` `):`The framework and language the tests are rewritten in.`,`Nothing has changed yet. Start runs it in the background, and you can leave this page.`],De=(...e)=>(0,Q.jsx)(Q.Fragment,{children:e.filter(Boolean).map((e,t)=>(0,Q.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 [overflow-wrap:anywhere]`,children:e},t))}),Oe=[{...vi[0],answer:le&&(z||x)?De((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(zt,{kind:z?.kind||`project`,label:z?.label,size:14}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:z?`${Mt(z.label)}${z.branch?`, ${z.branch}`:``}`:`This project`})]}),x&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(St,{framework:x.stack?.framework,language:x.stack?.language,size:14}),Te===void 0?`${x.counts.tests} test file${x.counts.tests===1?``:`s`}`:`${Te} test${Te===1?``:`s`} to migrate`]})):void 0},{...vi[1],answer:o>=1||L?De(E===null?we&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(St,{framework:we.id.split(`-`)[0],language:we.id.split(`-`).slice(1).join(`-`),size:14}),we.title]}):(0,Q.jsx)(`span`,{className:E.trim()?``:`text-muted`,children:E.trim()||`Type it in`}),(0,Q.jsx)(`span`,{className:`text-muted`,children:L&&!T&&E===null?`Suggested from your tests`:xe?`Into ${xe.target.dir}`:D.trim()?`Into ${D.trim()}`:`Into a new folder`})):void 0},{...vi[2],answer:xe?De((0,Q.jsx)(`span`,{children:Ot[xe.feasibility.verdict].label})):void 0}];return(0,Q.jsxs)(`div`,{className:`mt-4 grid grid-cols-[minmax(0,1fr)] items-stretch gap-6 @3xl:grid-cols-[minmax(240px,280px)_minmax(0,1fr)] @3xl:gap-12`,children:[(0,Q.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,Q.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,Q.jsx)(Sr,{steps:Oe,at:i,reached:o,onGo:e=>!F&&(e<2||N)&&(R(!0),a(e))})})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-step`,className:`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Tr,{id:`mig-step`,at:i,moved:se,children:H[i]}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:Ee[i]})]}),(ae||he)&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:ae||he}),i===0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mi,{...ye,onNext:()=>ce(1)}),de&&(0,Q.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Q.jsx)(`span`,{children:`Getting the Tosca exports ready…`})})]}),i===1&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_i,{view:e,to:C,setTo:te,other:E,setOther:ne,into:D,setInto:O,only:k,setOnly:A,suggested:L,instructions:j,setInstructions:M}),(0,Q.jsx)(Cr,{busy:F,onBack:()=>(R(!0),a(0)),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(fe,{"aria-hidden":`true`}),F?`Checking…`:`Check the plan`]}),onNext:()=>E!==null&&!E.trim()?oe(`Type the framework and language first.`):void be(),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),i===2&&xe&&(0,Q.jsxs)(Q.Fragment,{children:[t(xe,ie,P),(0,Q.jsx)(Cr,{busy:F,onBack:()=>(R(!0),a(1)),next:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]}),disabled:Ce||Se&&!ie,onNext:()=>n(N,!!Se&&ie),aside:(0,Q.jsx)(`span`,{className:`text-muted`,children:Ce?`Change what is not possible first.`:Se&&!ie?`Accept the limits to start.`:`Runs in the background.`})})]})]})]})}function bi({error:e}){return e?(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}function xi({finding:e}){let t=e.hits||[],n=e.files?.length||0;if(!t.length)return n?(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` (`,n,` file`,n===1?``:`s`,`)`]}):null;let r=n-new Set(t.map(e=>e.file)).size;return(0,Q.jsxs)(`details`,{className:`mt-1 text-[13px]`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-muted hover:text-ink`,children:[`Found in `,n||t.length,` file`,(n||t.length)===1?``:`s`]}),(0,Q.jsxs)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:[t.map(e=>(0,Q.jsxs)(`li`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.file,`:`,e.line]}),(0,Q.jsx)(`code`,{className:`mt-1 block overflow-x-auto rounded-[8px] bg-bg px-2 py-1 font-mono text-[13px] whitespace-pre text-ink`,children:e.code})]},`${e.file}:${e.line}`)),r>0&&(0,Q.jsxs)(`li`,{className:`text-muted`,children:[`and `,r,` more file`,r===1?``:`s`]})]})]})}function Si({f:e}){let t=e.level===`blocker`;return(0,Q.jsxs)(`li`,{className:`grid grid-cols-[24px_minmax(0,1fr)] gap-4 border-b border-line-soft py-4 last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:H(`inline-flex size-6 items-center justify-center rounded-full`,t?`bg-fail-soft text-fail`:`bg-warn-soft text-warn`),children:(0,Q.jsx)(o,{size:14,"aria-label":t?`Not possible`:`Limit`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 text-[13px] leading-relaxed text-ink [overflow-wrap:anywhere]`,children:[e.text,(0,Q.jsx)(xi,{finding:e})]})]})}function Ci({plan:e,accepted:t,onAccept:n}){let r=e.feasibility.findings.filter(e=>e.level===`blocker`),i=e.feasibility.findings.filter(e=>e.level===`limit`),a=e.units.filter(e=>e.kind===`test`).length,s=e.units.filter(e=>e.kind===`support`).length,l=e.workspace?Mt(e.workspace.label):`this project`,u=r.length?{icon:c,text:`Not possible yet: ${r.length===1?`one thing stops it`:`${r.length} things stop it`}`,tone:`text-fail`}:i.length?t&&!n?{icon:h,text:`Ready to start, ${i.length===1?`its limit`:`its ${i.length} limits`} accepted`,tone:`text-pass`}:{icon:o,text:`Ready, with ${i.length===1?`1 limit`:`${i.length} limits`} to accept`,tone:`text-warn`}:{icon:h,text:`Ready to start`,tone:`text-pass`};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsx)(At,{from:{...e.source.stack?e.source.stack:{},title:e.source.title,sub:`${a} test${a===1?``:`s`} to migrate, from ${l}${e.source.dir===`.`?``:`/${e.source.dir}`}`},to:{...Ei(e.target.id),title:e.target.title,sub:`Into ${e.target.dir}`}}),(0,Q.jsxs)(`p`,{className:H(`m-0 flex items-center gap-2 text-[13px] font-medium`,u.tone),children:[(0,Q.jsx)(u.icon,{size:16,"aria-hidden":`true`}),u.text]}),(0,Q.jsxs)(Ze,{label:`The plan in numbers`,children:[(0,Q.jsx)(Ye,{label:`Tests`,value:a,note:`Rewritten, one by one`}),(0,Q.jsx)(Ye,{label:`Support files`,value:s,note:`Code the tests use`}),(0,Q.jsx)(Ye,{label:`Copied as is`,value:e.copies.length,note:`Not rewritten`}),(0,Q.jsx)(Ye,{label:`Not migrated`,value:e.notMigrated.length,note:e.notMigrated.length?`In What moves where`:`Nothing left out`})]}),r.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-blockers`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mig-blockers`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Not possible`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:r.map(e=>(0,Q.jsx)(Si,{f:e},e.code))})]}),i.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-limits`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mig-limits`,className:`m-0 text-[13px] font-semibold text-muted`,children:t&&!n?`Limits accepted`:`Limits to accept`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:i.map(e=>(0,Q.jsx)(Si,{f:e},e.code))}),n&&!r.length&&(0,Q.jsxs)(`label`,{className:`flex min-h-10 w-fit cursor-pointer items-center gap-2 text-[13px] font-medium`,children:[(0,Q.jsx)(dt,{checked:!!t,onCheckedChange:n}),`I accept `,i.length===1?`this limit`:`these ${i.length} limits`]})]}),e.instructions&&(0,Q.jsxs)(`section`,{"aria-labelledby":`mig-rules`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mig-rules`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Your rules for the new code`}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.instructions})]}),(0,Q.jsxs)(pt,{title:`What moves where (${e.units.length})`,children:[(0,Q.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-[13px]`,children:e.units.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap gap-x-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Q.jsx)(`span`,{className:`w-16 flex-none text-muted`,children:Nt[e.kind]}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.source?(0,Q.jsxs)(`span`,{className:`text-muted`,children:[e.source.slice(e.source.lastIndexOf(`/`)+1),` → `]}):null,e.target]})]},e.id))}),e.notMigrated.length>0&&(0,Q.jsxs)(`p`,{className:`m-0 mt-2 text-[13px] text-muted`,children:[`Not migrated: `,e.notMigrated.map(e=>e.rel.slice(e.rel.lastIndexOf(`/`)+1)).join(`, `)]})]})]})}function wi({plan:e,acceptLimits:t,onClose:n,onStarted:r}){let[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),u=async()=>{s(!0),l(``);try{r((await G.start(e.id,i,t)).detail)}catch(e){l(e.message),s(!1)}};return(0,Q.jsx)(st,{open:!0,onClose:n,title:`Start the migration`,description:`The tests are rewritten in ${e.target.title} into ${e.target.dir}, and ForgeQE runs each one. It runs in the background; your source tests are not changed.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{variant:`ghost`,onClick:n,children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(K,{variant:`primary`,disabled:o||i!==e.id,onClick:()=>void u(),"data-tip":`Start the migration`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Q.jsx)(W,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Q.jsx)(bi,{error:c})]})})}function Ti({d:e,onStarted:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!1),o=e.plan.feasibility.findings.some(e=>e.level===`limit`),s=e.plan.feasibility.verdict===`blocked`,c=!!e.job?.running;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!c&&(0,Q.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Q.jsx)(Ci,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!s&&!c&&(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(K,{variant:`primary`,disabled:!e.confirmed&&o&&!n,onClick:()=>a(!0),"data-tip":`Start the migration`,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),`Start`]})}),i&&(0,Q.jsx)(wi,{plan:e.plan,acceptLimits:o&&(e.confirmed||n),onClose:()=>a(!1),onStarted:e=>{a(!1),t(e)}})]})}var Ei=e=>({framework:e.split(`-`)[0],language:e.split(`-`).slice(1).join(`-`)});function Di(e,t){return e?.status===`running`?`running`:e?.status===t?`done`:e?`review`:`planned`}function Oi(e){return{key:e.id,link:B(`migration`,e.id),title:`${e.source} to ${e.target}`,under:e.to,from:(0,Q.jsx)(St,{framework:e.stack?.framework,language:e.stack?.language,size:18}),to:Ei(e.targetId),source:{mark:(0,Q.jsx)(zt,{kind:e.origin.kind,label:e.origin.label,size:15}),text:e.origin.kind===`project`?e.from:Mt(e.origin.label),tip:e.origin.label},running:e.result?.status===`running`?{pct:Math.min(99,Math.round(e.result.done/Math.max(1,e.files)*95))}:null,pass:e.result?{n:e.result.migrated,of:e.tests}:null,state:e.result?xt[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ot[e.verdict],filter:Di(e.result,`migrated`),at:e.result?.endedAt||e.result?.at||e.createdAt}}function ki(e){let t=e.file.slice(e.file.lastIndexOf(`/`)+1);return{key:e.id,link:B(`migration`,e.id),title:`${t} to ${e.target}`,under:`${e.project?`${e.project}, into `:`Into `}${e.into}`,from:(0,Q.jsx)(zt,{kind:`tosca`,size:18}),to:Ei(e.targetId),source:{mark:(0,Q.jsx)(zt,{kind:`tosca`,size:15}),text:t,tip:`Tosca export ${e.file}`},running:e.result?.status===`running`?{pct:Math.min(99,Math.round(e.result.done/Math.max(1,e.units||e.tests+1)*95))}:null,pass:e.result?{n:e.result.converted,of:e.tests}:null,state:e.result?Qt[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Wt[e.verdict],filter:Di(e.result,`converted`),at:e.result?.endedAt||e.result?.at||e.createdAt}}function Ai({rows:e}){let[t,n]=(0,Z.useState)(`all`),r=t=>t===`all`?e.length:e.filter(e=>e.filter===t).length,i=e.filter(e=>t===`all`||e.filter===t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Y,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,Q.jsx)(Y,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,Q.jsx)(Y,{label:`Migrated`,value:r(`done`),tone:r(`done`)?`text-pass`:void 0,onClick:()=>n(`done`),on:t===`done`}),(0,Q.jsx)(Y,{label:`Needs review`,value:r(`review`),tone:r(`review`)?`text-warn`:void 0,onClick:()=>n(`review`),on:t===`review`})]}),(0,Q.jsx)(tt,{label:`Migrations`,placeholder:`Find a migration`,empty:t===`all`?`No migrations.`:`None here.`,resetKey:t,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Migration`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @3xl:table-cell`),children:`Source`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Tests`}),(0,Q.jsx)(`th`,{scope:`col`,className:q,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:H(q,`hidden @xl:table-cell`),children:`Updated`})]}),children:i.map(e=>(0,Q.jsxs)(`tr`,{onClick:()=>location.hash=e.link,className:nt,children:[(0,Q.jsx)(`td`,{className:J,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,Q.jsxs)(`span`,{className:`hidden flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:[e.from,(0,Q.jsx)(he,{size:13,className:`text-muted`}),(0,Q.jsx)(St,{framework:e.to.framework,language:e.to.language,size:18})]}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`a`,{href:e.link,onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-[13px] text-muted`,children:e.under})]})]})}),(0,Q.jsx)(`td`,{className:H(J,`hidden max-w-[260px] @3xl:table-cell`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] text-ink-2`,children:[e.source.mark,(0,Q.jsx)(`span`,{className:`truncate`,"data-tip":e.source.tip,children:e.source.text})]})}),(0,Q.jsx)(`td`,{className:H(J,`w-[180px] text-[13px]`),children:e.running?(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ft,{value:e.running.pct,label:`${e.title}: progress`}),(0,Q.jsxs)(`span`,{className:`w-9 flex-none text-right text-[13px] text-muted tabular-nums`,children:[e.running.pct,`%`]})]}):e.pass?(0,Q.jsxs)(`span`,{className:e.pass.n===e.pass.of?`text-pass`:`text-ink-2`,children:[e.pass.n,` of `,e.pass.of,` pass`]}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,Q.jsx)(`td`,{className:H(J,`whitespace-nowrap`),children:(0,Q.jsx)(Ne,{tone:e.state.tone,children:e.state.label})}),(0,Q.jsx)(`td`,{className:H(J,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),children:lt(e.at)})]},e.key))})]})}function ji({sub:e}){let[t,n]=(0,Z.useState)(null),[r,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),m=e===`migrations`,h=(0,Z.useCallback)(()=>{G.list().then(e=>{n(e),s(``)},e=>s(e.message))},[]),g=(0,Z.useCallback)(()=>{U.list().then(e=>{a(e),l(``)},e=>l(e.message))},[]);(0,Z.useEffect)(h,[h,e]),(0,Z.useEffect)(()=>{(m||e===`new`)&&g()},[m,e,g]);let _=t?.plans.some(e=>e.result?.status===`running`)||r?.plans.some(e=>e.result?.status===`running`);(0,Z.useEffect)(()=>{if(!_||!m)return;let e=rt(()=>{h(),g()},3e3);return()=>Qe(e)},[_,m,h,g]);let v=(0,Z.useMemo)(()=>[...t?.plans.map(Oi)||[],...r?.plans.map(ki)||[]].sort((e,t)=>e.at<t.at?1:e.at>t.at?-1:0),[t,r]),y=e&&/^mig-\d{8}-\d{6}-[0-9a-f]{4}$/.test(e)?e:``,b=()=>location.hash=B(`migration`,`new`),x=!t&&!o&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});return Br(e)?(0,Q.jsx)(Vr,{sub:e}):e===`new`?(0,Q.jsxs)(rn,{tab:`migrations`,back:nn,children:[(0,Q.jsx)(bi,{error:o}),x,t&&(0,Q.jsx)(yi,{view:t,review:(e,t,n)=>(0,Q.jsx)(Ci,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>d({d:e,accept:t}),tosca:{view:r,onView:a,review:(e,t,n,r)=>(0,Q.jsx)(Lr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>p({d:e,accept:t})}}),u&&(0,Q.jsx)(wi,{plan:u.d.plan,acceptLimits:u.accept,onClose:()=>d(null),onStarted:e=>location.hash=B(`migration`,e.plan.id)}),f&&(0,Q.jsx)(sn,{plan:f.d.plan,acceptLimits:f.accept,onClose:()=>p(null),onStarted:e=>location.hash=B(`migration`,e.plan.id)})]}):y?(0,Q.jsxs)(rn,{tab:`migrations`,wide:!0,back:nn,children:[(0,Q.jsx)(bi,{error:o}),x,t&&(0,Q.jsx)(oi,{id:y,view:t,plan:e=>(0,Q.jsx)(Ti,{d:e,onStarted:()=>location.reload()})},y)]}):m?(0,Q.jsxs)(rn,{tab:`migrations`,action:t&&!v.length?void 0:(0,Q.jsxs)(K,{variant:`primary`,disabled:!t,onClick:b,"data-tip":`New migration`,children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),`New`]}),children:[(0,Q.jsx)(bi,{error:o}),(0,Q.jsx)(bi,{error:c&&`Tosca conversions could not be read: ${c}`}),x,t&&(v.length?(0,Q.jsx)(Ai,{rows:v}):(0,Q.jsx)(Fe,{icon:E,title:`No migrations yet`,action:(0,Q.jsxs)(K,{size:`sm`,onClick:b,"data-tip":`New migration`,children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),`New`]}),children:`Bring in tests from git, a folder, uploaded files, pasted code or this project, Tosca exports among them, and pick the framework they move to. Nothing starts until you confirm.`}))]}):(0,Q.jsx)(rn,{tab:gt})}export{ji as Migration};
|