@capagents/forgeqe 3.4.7 → 3.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/forgeqe.js +1970 -1970
  2. package/dist/requirement-agent/requirements_agent/config.py +7 -8
  3. package/dist/requirement-agent/requirements_agent/llm/providers.py +11 -1
  4. package/dist/template.html +2 -2
  5. package/dist/web/assets/{3d-force-graph-nC19sloS.js → 3d-force-graph-CiCC5APC.js} +1 -1
  6. package/dist/web/assets/{Agent-5Q96YSvr.js → Agent-BB5w6CFT.js} +7 -7
  7. package/dist/web/assets/{AgentWork-BWjyDUEc.js → AgentWork-BIDUzmaq.js} +1 -1
  8. package/dist/web/assets/{ApiTests-D493px70.js → ApiTests-B9xJf6Cy.js} +5 -5
  9. package/dist/web/assets/{Browse-hN_pjYbP.js → Browse-DWBe9mKl.js} +1 -1
  10. package/dist/web/assets/Chat-DHpceBhs.js +3 -0
  11. package/dist/web/assets/CommandPalette-C94g3GC3.js +1 -0
  12. package/dist/web/assets/{Compare-sqYji9Pk.js → Compare-BZBgd0y1.js} +1 -1
  13. package/dist/web/assets/{Compare-BYFsbaGF.js → Compare-DdpFDNye.js} +1 -1
  14. package/dist/web/assets/Cost-DeG7MOk_.js +1 -0
  15. package/dist/web/assets/{Data-BNcT6ygh.js → Data-C23A9m-E.js} +1 -1
  16. package/dist/web/assets/Desktop-DEMEf1js.js +1 -0
  17. package/dist/web/assets/{DesktopReview-Cd-oH_U5.js → DesktopReview-QI-8PPuf.js} +1 -1
  18. package/dist/web/assets/{DeviceScreen-DDERg3YQ.js → DeviceScreen-DJiqz1aE.js} +1 -1
  19. package/dist/web/assets/Evidence-CCgOWjCG.js +1 -0
  20. package/dist/web/assets/{Explore-CIrFwA2S.js → Explore-BaWlUaKG.js} +1 -1
  21. package/dist/web/assets/Features-BVmUtZ3B.js +1 -0
  22. package/dist/web/assets/{FileTree-CNGOe2xf.js → FileTree-hV2COTtr.js} +1 -1
  23. package/dist/web/assets/{Flags-C69Twz3o.js → Flags-B4d9s8zr.js} +1 -1
  24. package/dist/web/assets/Flaky-CZw09rGV.js +1 -0
  25. package/dist/web/assets/{Impact-Dc1w1OJz.js → Impact-C0RrcnHq.js} +2 -2
  26. package/dist/web/assets/{Jobs-hS20eWew.js → Jobs-DJLhtCP4.js} +1 -1
  27. package/dist/web/assets/{KindPage-Dwn1bRlI.js → KindPage-BDDN_Tvk.js} +1 -1
  28. package/dist/web/assets/{LiveDevice-CAqR5xdi.js → LiveDevice-mowq_cHn.js} +1 -1
  29. package/dist/web/assets/{Migration-B8Cde1ef.js → Migration-BMN6ORSe.js} +4 -4
  30. package/dist/web/assets/Mobile-Cb-MttFC.js +2 -0
  31. package/dist/web/assets/Observability-Jj9dRXFD.js +1 -0
  32. package/dist/web/assets/{OwnItems-Cw923K1y.js → OwnItems-DE8fyJHx.js} +1 -1
  33. package/dist/web/assets/PageAgent--Trp4TeQ.js +1 -0
  34. package/dist/web/assets/Product-D6eFHH3k.js +6 -0
  35. package/dist/web/assets/Production-BHY4nlNS.js +1 -0
  36. package/dist/web/assets/Quality-D0ZwjBaV.js +1 -0
  37. package/dist/web/assets/Readiness-Ck09aYm6.js +1 -0
  38. package/dist/web/assets/Record-CZ8vdz9z.js +1 -0
  39. package/dist/web/assets/{Regression-DSGl56Mr.js → Regression-DpksCvrY.js} +2 -2
  40. package/dist/web/assets/RelationGraph-ceeoXUfO.js +1 -0
  41. package/dist/web/assets/Reports-DwQ4rGuE.js +2 -0
  42. package/dist/web/assets/{Requirements-D-FLXDK0.js → Requirements-CrrPYfmf.js} +1 -1
  43. package/dist/web/assets/Responsive-D-_Z1zWt.js +3 -0
  44. package/dist/web/assets/RunDiff-6ubx_siR.js +1 -0
  45. package/dist/web/assets/Settings-B-VqCcSI.js +21 -0
  46. package/dist/web/assets/{SiteScan-CKc7eUOn.js → SiteScan-Atalzdep.js} +1 -1
  47. package/dist/web/assets/{Steps-DvTL0-9L.js → Steps-DJKLOcXA.js} +1 -1
  48. package/dist/web/assets/{TestData-Bo0i6j6h.js → TestData-D8X3YVNO.js} +1 -1
  49. package/dist/web/assets/{TestManagement-a1zMxdc6.js → TestManagement-CFkof7HP.js} +2 -2
  50. package/dist/web/assets/WhatsNew-Zh7ANIT4.js +1 -0
  51. package/dist/web/assets/agentSettingsSheet-BXo7tt4e.js +1 -0
  52. package/dist/web/assets/api-C5wO4oo1.js +1 -0
  53. package/dist/web/assets/choice-DU4-gNa8.js +1 -0
  54. package/dist/web/assets/{dataParts-DCcZLVns.js → dataParts-XwGL6chT.js} +1 -1
  55. package/dist/web/assets/{desktopAppPath-Ch1JeF98.js → desktopAppPath-ClRxEs7y.js} +1 -1
  56. package/dist/web/assets/{flowTheme-BP9HI_83.js → flowTheme-C6XgxapL.js} +1 -1
  57. package/dist/web/assets/index-4aprf7A6.css +2 -0
  58. package/dist/web/assets/index-Bm0NGw2p.js +186 -0
  59. package/dist/web/assets/{nav-DS7OIItb.js → nav-BVGAdkgR.js} +1 -1
  60. package/dist/web/assets/{pageBack-BKHdI-pD.js → pageBack-C6KF2YWt.js} +1 -1
  61. package/dist/web/assets/paletteCommands-4ZbMQrvq.js +5 -0
  62. package/dist/web/assets/{parts-EZhmj8re.js → parts-Bw9UqYIt.js} +1 -1
  63. package/dist/web/assets/{productParts-BTy_xRc1.js → productParts-C2WZmf3J.js} +1 -1
  64. package/dist/web/assets/{qualityParts-CaibRb_n.js → qualityParts-xNbrX_EB.js} +1 -1
  65. package/dist/web/assets/{recordTest-DOqE44_1.js → recordTest-ecnqAff5.js} +1 -1
  66. package/dist/web/assets/searchRecents-BRxclL5B.js +1 -0
  67. package/dist/web/assets/{stepper-PKh2muBc.js → stepper-ghyjNRgc.js} +1 -1
  68. package/dist/web/assets/surface-CJmzHqOR.js +1 -0
  69. package/dist/web/assets/uploadBuild-sQwJpid1.js +1 -0
  70. package/dist/web/assets/{wizardParts-DgElx0Cb.js → wizardParts-CtlGV71f.js} +1 -1
  71. package/dist/web/index.html +8 -8
  72. package/package.json +1 -1
  73. package/py/forgeqe_engine/llm.py +30 -1
  74. package/py/forgeqe_engine/service.py +8 -0
  75. package/dist/web/assets/Chat-CzEPSJKG.js +0 -3
  76. package/dist/web/assets/CommandPalette-Bupa5F4q.js +0 -1
  77. package/dist/web/assets/Cost-CWWczZfn.js +0 -1
  78. package/dist/web/assets/Desktop-CG9lFU5l.js +0 -1
  79. package/dist/web/assets/Evidence-DPF6gCpK.js +0 -1
  80. package/dist/web/assets/Features-DzK_-8h1.js +0 -1
  81. package/dist/web/assets/Flaky-CNPjhYIZ.js +0 -1
  82. package/dist/web/assets/Mobile-D3Pch-1L.js +0 -2
  83. package/dist/web/assets/Observability-QUxLZNhO.js +0 -1
  84. package/dist/web/assets/PageAgent-xDYi2Zgw.js +0 -1
  85. package/dist/web/assets/Product-CVn9yHyn.js +0 -6
  86. package/dist/web/assets/Production-BNg-ims6.js +0 -1
  87. package/dist/web/assets/Quality-BzcQTBgO.js +0 -1
  88. package/dist/web/assets/Readiness-Bx5JZpXY.js +0 -1
  89. package/dist/web/assets/Record-CM_ZJv5n.js +0 -1
  90. package/dist/web/assets/RelationGraph-8Ko7oUzf.js +0 -1
  91. package/dist/web/assets/Reports-CBanmypE.js +0 -2
  92. package/dist/web/assets/Responsive-DLU7BLkW.js +0 -3
  93. package/dist/web/assets/RunDiff-D2IKjRcf.js +0 -1
  94. package/dist/web/assets/Settings-Bi99A4lM.js +0 -21
  95. package/dist/web/assets/WhatsNew-OtotufjV.js +0 -1
  96. package/dist/web/assets/agentSettingsSheet-DJDT3xqY.js +0 -1
  97. package/dist/web/assets/api-BJHzfOse.js +0 -1
  98. package/dist/web/assets/choice-W0qOx_1k.js +0 -1
  99. package/dist/web/assets/coverage-DbHm8BUP.js +0 -5
  100. package/dist/web/assets/index-B58JrUzp.js +0 -186
  101. package/dist/web/assets/index-B9F7yrF9.css +0 -2
  102. package/dist/web/assets/palette-BEo5X3wD.js +0 -1
  103. package/dist/web/assets/paletteCommands-DdFd3e0-.js +0 -1
  104. package/dist/web/assets/sectionList-B6NF3ZMb.js +0 -1
  105. package/dist/web/assets/surface-c1kG1KPS.js +0 -1
@@ -1,7 +1,7 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,L as a,P as o,V as s,a as c,c as l,o as u,s as d,z as f}from"./surface-c1kG1KPS.js";import{t as p}from"./utils-DJRAScIl.js";import{t as m}from"./jsx-runtime-LKYXHABd.js";import{G as h,U as g,W as _,r as v}from"./palette-BEo5X3wD.js";import{d as y}from"./sectionList-B6NF3ZMb.js";import{H as b,f as x,ft as S,pt as C}from"./api-BJHzfOse.js";import{D as w,E as T,F as E,I as D,N as O,O as k,P as A,T as j,d as ee,g as M,h as te,j as N,k as P,l as F,m as I,r as L}from"./pageBack-BKHdI-pD.js";import{At as R,B as z,Cr as B,E as V,Er as H,Fr as U,G as W,Gr as G,Hr as ne,Ht as re,In as ie,Kn as ae,Lr as K,Lt as oe,M as se,N as q,P as ce,Pt as J,R as le,Rn as ue,Sr as de,St as fe,Tn as pe,Tt as me,Un as he,Vn as ge,Wn as _e,Wr as ve,Zn as ye,Zt as be,_t as xe,ar as Se,bt as Ce,cn as we,cr as Te,ct as Ee,dn as De,er as Oe,et as ke,ft as Ae,h as je,ht as Me,it as Ne,l as Pe,ln as Fe,mr as Ie,mt as Le,nr as Re,o as ze,tn as Be,un as Ve,ur as He,w as Ue,xt as We,yn as Ge,z as Ke,zn as qe}from"./line-icons-Cwj9OmCz.js";import{t as Je}from"./collapse-C0q3vXUR.js";import{u as Ye}from"./nav-DS7OIItb.js";import{An as Xe,At as Ze,Bt as Qe,Et as $e,Fn as et,Ft as tt,Gt as nt,Ht as rt,In as it,Jt as at,Kt as ot,Lt as st,Mn as ct,On as lt,Rt as ut,Tt as dt,U as ft,Ut as pt,Vt as mt,W as ht,Wt as Y,Xt as gt,cn as _t,kn as vt,l as yt,n as bt,nt as xt,qt as St,t as Ct,tt as wt,xt as Tt,yt as Et,zt as Dt}from"./index-B58JrUzp.js";import{n as Ot,t as kt}from"./choice-W0qOx_1k.js";import{a as At,i as jt,n as X,r as Mt,t as Nt}from"./wizardParts-DgElx0Cb.js";import{a as Pt,i as Ft,n as It,o as Lt,r as Rt,s as zt,t as Bt}from"./logos-BIRpIwDG.js";import{a as Vt,c as Ht,d as Ut,f as Wt,g as Gt,h as Kt,l as qt,m as Jt,n as Yt,o as Xt,p as Zt,r as Qt,s as $t,t as en,u as tn}from"./parts-EZhmj8re.js";import{_ as nn,a as rn,c as an,d as on,f as sn,g as cn,h as ln,i as un,l as dn,m as Z,o as fn,p as pn,r as mn,s as hn,t as gn,u as _n}from"./Steps-DvTL0-9L.js";import{n as vn}from"./FileTree-CNGOe2xf.js";var Q=e(t(),1),$=m(),yn={href:r(`migration`,`migrations`),label:`Migrations`};function bn({tab:e,wide:t,action:n,agentBody:i,back:a,children:o}){let s=y(`migration`);return(0,$.jsx)(bt,{title:Ye(`migration`),page:s,label:`Migration`,current:e,tabHref:e=>e===`agent`?r(`migration`,Ct):r(`migration`,`migrations`),onPick:e=>location.hash=e===`agent`?r(`migration`,Ct):r(`migration`,`migrations`),tabs:[{id:`migrations`,label:`Migrations`,icon:Se}],below:(0,$.jsx)(yt,{page:s}),...i===void 0?{}:{agentBody:i},...t?{wide:t}:{},...n?{end:n}:{},...a?{back:a}:{},children:o})}var xn=500,Sn=10;function Cn({plan:e,acceptLimits:t,next:n,again:r,onClose:i,onStarted:a}){let s=e.units.filter(e=>e.kind===`test`).length,[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!!n),[f,p]=(0,Q.useState)(String(n?.size||Sn)),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),v=Number(f),y=Number.isInteger(v)&&v>=1&&v<=xn,b=async()=>{h(!0),_(``);try{a((await S.start(e.id,c,t,u?v:void 0)).detail)}catch(e){_(e.message),h(!1)}};return(0,$.jsx)(et,{open:!0,onClose:i,title:n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,description:n?`${(v||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 ${v||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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`outline`,onClick:i,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(A,{variant:`primary`,disabled:m||c!==e.id||u&&!y,onClick:()=>void b(),"data-tip":n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,children:[r?(0,$.jsx)(ae,{"aria-hidden":`true`}):(0,$.jsx)(ue,{"aria-hidden":`true`}),n?`Continue`:r?`Start again`:`Start`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[!n&&s>1&&(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,$.jsx)(at,{className:`mt-1`,checked:u,onCheckedChange:d}),(0,$.jsxs)(`span`,{children:[`Convert in batches`,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`A few test cases at a time, stopping after each batch so you can check them before the next.`})]})]}),u&&(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{children:`Test cases per batch`}),(0,$.jsx)(o,{type:`number`,min:1,max:xn,step:1,inputMode:`numeric`,value:f,"aria-invalid":!y,"aria-describedby":y?void 0:`batch-size-error`,onChange:e=>p(e.target.value),className:`w-24`}),!y&&(0,$.jsxs)(`p`,{id:`batch-size-error`,role:`alert`,className:`m-0 text-body-sm text-fail`,children:[`A whole number from 1 to `,xn,`.`]})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,$.jsx)(o,{value:c,onChange:e=>l(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,$.jsx)(rn,{error:g})]})})}var wn=/\u001b\[[0-9;]*[A-Za-z]/g,Tn=/[\u0000-\u0008\u000b-\u001f\u007f]/g,En=240,Dn=30,On=e=>e.replace(wn,``).replace(Tn,``),kn=e=>e.length>En?`${e.slice(0,239)}…`:e,An=/^\s*(?:(?:[A-Z]\w*)?Error\b:?\s*|E\s{2,})(.*\S)/;function jn(e){return e.status===`failed`||e.status===`blocked`}function Mn(e){let t=On(e.output||``).split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,L as a,P as o,V as s,a as c,c as l,o as u,s as d,z as f}from"./surface-CJmzHqOR.js";import{t as p}from"./utils-DJRAScIl.js";import{t as m}from"./jsx-runtime-LKYXHABd.js";import{J as h,K as g,o as _,q as v}from"./searchRecents-BRxclL5B.js";import{L as y}from"./paletteCommands-4ZbMQrvq.js";import{H as b,f as x,ft as S,pt as C}from"./api-C5wO4oo1.js";import{D as w,E as T,F as E,I as D,N as O,O as k,P as A,T as j,d as ee,g as M,h as te,j as N,k as P,l as F,m as I,r as L}from"./pageBack-C6KF2YWt.js";import{At as R,B as z,Cr as B,E as V,Er as H,Fr as U,G as W,Gr as G,Hr as ne,Ht as re,In as ie,Kn as ae,Lr as K,Lt as oe,M as se,N as q,P as ce,Pt as J,R as le,Rn as ue,Sr as de,St as fe,Tn as pe,Tt as me,Un as he,Vn as ge,Wn as _e,Wr as ve,Zn as ye,Zt as be,_t as xe,ar as Se,bt as Ce,cn as we,cr as Te,ct as Ee,dn as De,er as Oe,et as ke,ft as Ae,h as je,ht as Me,it as Ne,l as Pe,ln as Fe,mr as Ie,mt as Le,nr as Re,o as ze,tn as Be,un as Ve,ur as He,w as Ue,xt as We,yn as Ge,z as Ke,zn as qe}from"./line-icons-Cwj9OmCz.js";import{t as Je}from"./collapse-C0q3vXUR.js";import{u as Ye}from"./nav-BVGAdkgR.js";import{An as Xe,At as Ze,Bt as Qe,Et as $e,Fn as et,Ft as tt,Gt as nt,Ht as rt,In as it,Jt as at,Kt as ot,Lt as st,Mn as ct,On as lt,Rt as ut,Tt as dt,U as ft,Ut as pt,Vt as mt,W as ht,Wt as Y,Xt as gt,cn as _t,kn as vt,l as yt,n as bt,nt as xt,qt as St,t as Ct,tt as wt,xt as Tt,yt as Et,zt as Dt}from"./index-Bm0NGw2p.js";import{r as Ot,t as kt}from"./choice-DU4-gNa8.js";import{a as At,i as jt,n as X,r as Mt,t as Nt}from"./wizardParts-CtlGV71f.js";import{a as Pt,i as Ft,n as It,o as Lt,r as Rt,s as zt,t as Bt}from"./logos-BIRpIwDG.js";import{a as Vt,c as Ht,d as Ut,f as Wt,g as Gt,h as Kt,l as qt,m as Jt,n as Yt,o as Xt,p as Zt,r as Qt,s as $t,t as en,u as tn}from"./parts-Bw9UqYIt.js";import{_ as nn,a as rn,c as an,d as on,f as sn,g as cn,h as ln,i as un,l as dn,m as Z,o as fn,p as pn,r as mn,s as hn,t as gn,u as _n}from"./Steps-DJKLOcXA.js";import{n as vn}from"./FileTree-hV2COTtr.js";var Q=e(t(),1),$=m(),yn={href:r(`migration`,`migrations`),label:`Migrations`};function bn({tab:e,wide:t,action:n,agentBody:i,back:a,children:o}){let s=y(`migration`);return(0,$.jsx)(bt,{title:Ye(`migration`),page:s,label:`Migration`,current:e,tabHref:e=>e===`agent`?r(`migration`,Ct):r(`migration`,`migrations`),onPick:e=>location.hash=e===`agent`?r(`migration`,Ct):r(`migration`,`migrations`),tabs:[{id:`migrations`,label:`Migrations`,icon:Se}],below:(0,$.jsx)(yt,{page:s}),...i===void 0?{}:{agentBody:i},...t?{wide:t}:{},...n?{end:n}:{},...a?{back:a}:{},children:o})}var xn=500,Sn=10;function Cn({plan:e,acceptLimits:t,next:n,again:r,onClose:i,onStarted:a}){let s=e.units.filter(e=>e.kind===`test`).length,[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!!n),[f,p]=(0,Q.useState)(String(n?.size||Sn)),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),v=Number(f),y=Number.isInteger(v)&&v>=1&&v<=xn,b=async()=>{h(!0),_(``);try{a((await S.start(e.id,c,t,u?v:void 0)).detail)}catch(e){_(e.message),h(!1)}};return(0,$.jsx)(et,{open:!0,onClose:i,title:n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,description:n?`${(v||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 ${v||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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`outline`,onClick:i,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(A,{variant:`primary`,disabled:m||c!==e.id||u&&!y,onClick:()=>void b(),"data-tip":n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,children:[r?(0,$.jsx)(ae,{"aria-hidden":`true`}):(0,$.jsx)(ue,{"aria-hidden":`true`}),n?`Continue`:r?`Start again`:`Start`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[!n&&s>1&&(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,$.jsx)(at,{className:`mt-1`,checked:u,onCheckedChange:d}),(0,$.jsxs)(`span`,{children:[`Convert in batches`,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`A few test cases at a time, stopping after each batch so you can check them before the next.`})]})]}),u&&(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{children:`Test cases per batch`}),(0,$.jsx)(o,{type:`number`,min:1,max:xn,step:1,inputMode:`numeric`,value:f,"aria-invalid":!y,"aria-describedby":y?void 0:`batch-size-error`,onChange:e=>p(e.target.value),className:`w-24`}),!y&&(0,$.jsxs)(`p`,{id:`batch-size-error`,role:`alert`,className:`m-0 text-body-sm text-fail`,children:[`A whole number from 1 to `,xn,`.`]})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,$.jsx)(o,{value:c,onChange:e=>l(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,$.jsx)(rn,{error:g})]})})}var wn=/\u001b\[[0-9;]*[A-Za-z]/g,Tn=/[\u0000-\u0008\u000b-\u001f\u007f]/g,En=240,Dn=30,On=e=>e.replace(wn,``).replace(Tn,``),kn=e=>e.length>En?`${e.slice(0,239)}…`:e,An=/^\s*(?:(?:[A-Z]\w*)?Error\b:?\s*|E\s{2,})(.*\S)/;function jn(e){return e.status===`failed`||e.status===`blocked`}function Mn(e){let t=On(e.output||``).split(`
2
2
  `);for(let e of t){let t=e.match(An);if(t?.[1])return kn(t[1].trim())}let n=[...e.problems||[],e.reason||``].map(e=>On(e).split(`
3
3
  `).find(e=>e.trim())||``).find(Boolean);return n?kn(n.trim()):`No reason was recorded: the run ended before it said why.`}function Nn(e){let t=On(e.output||``).split(`
4
4
  `),n=t.findIndex(e=>An.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(kn(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 Pn(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 Fn(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?fn[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:on[e.plan.feasibility.verdict]}var In=e=>e.slice(e.lastIndexOf(`/`)+1);function Ln({d:e,onClose:t}){let n=(e.plan.sources||[]).some(e=>e.workspace),[i,a]=(0,Q.useState)(n),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=async()=>{s(!0),l(``);try{let t=await S.reimport(e.plan.id,n&&i);location.hash=r(`migration`,t.plan.id)}catch(e){l(e.message),s(!1)}};return(0,$.jsx)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{variant:`outline`,onClick:t,children:`Cancel`}),(0,$.jsx)(A,{busy:o,variant:`primary`,disabled:o,onClick:()=>void u(),children:o?`Reading…`:`Make the new plan`})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[n&&(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,$.jsx)(at,{className:`mt-1`,checked:i,onCheckedChange:a}),(0,$.jsxs)(`span`,{children:[`Get the newest commit of the cloned repositories`,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`Each is cloned again, as before; the old copy stays for this plan.`})]})]}),c&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:c})]})})}var Rn=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function zn({id:e,onClose:t}){let[n,r]=(0,Q.useState)(`github`),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let t=!0;return a(null),m(!1),s(``),l(``),S.ci(e,n).then(e=>t&&a(e),e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let h=i?i.file.slice(i.file.lastIndexOf(`/`)+1):``,g=()=>{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=h,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},_=async()=>{d(!0),s(``);try{let t=await S.writeCi(e,n);m(!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,$.jsxs)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{variant:`outline`,onClick:t,children:`Close`}),(0,$.jsxs)(A,{disabled:!i,onClick:g,children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),`Download`]}),!f&&(0,$.jsx)(A,{busy:u,variant:`primary`,disabled:!i||u,onClick:()=>void _(),"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,$.jsx)(Ze,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:Rn}),(0,$.jsxs)(`div`,{id:`panel-ci-${n}`,role:`tabpanel`,"aria-labelledby":`tab-ci-${n}`,className:`flex flex-col gap-4 text-body-sm`,children:[!i&&!o&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Making the pipeline…`}),o&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}),c&&(0,$.jsx)(`p`,{role:`status`,className:p(D.info,`m-0`),children:c}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Jobs`}),(0,$.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 ${Z(i.workflows,`workflow`)}`]:[]].join(`; `)}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Goes in`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-body-sm [overflow-wrap:anywhere]`,children:i.path}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`To set`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[i.tests&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:`BASE_URL`}),` as a variable`]}),i.secrets.length?(0,$.jsxs)($.Fragment,{children:[i.tests?`; as `:`As `,n===`github`?`secrets`:`secret variables`,`: `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:i.secrets.join(`, `)})]}):null,!i.tests&&!i.secrets.length?`None`:null,i.skipped.length?(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Not passed, not a name the CI takes: `,i.skipped.join(`, `)]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:h}),(0,$.jsx)(L,{text:i.text,label:`Copy ${h}`})]}),(0,$.jsx)(`pre`,{"aria-label":h,tabIndex:0,className:p(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[420px] whitespace-pre`),children:i.text})]})]})]})]})}function Bn({id:e,onClose:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),v=(t=``)=>S.pr(e,t).then(e=>{r(e),_(``),e.preview&&(a(e.preview),c(t=>t||e.preview.base),u(t=>t||e.preview.title))},e=>_(e.message));(0,Q.useEffect)(()=>{v()},[e]),(0,Q.useEffect)(()=>{if(n?.job?.state!==`running`)return;let e=setTimeout(()=>void v(s),1e3);return()=>clearTimeout(e)},[n]);let y=async()=>{h(!0),_(``);try{let t=await S.openPr(e,{base:s.trim(),title:l.trim(),draft:d});r(e=>e&&{...e,job:t.job})}catch(e){_(e.message)}finally{h(!1)}},b=i,x=n?.job,C=x?.state===`running`,w=x?.state===`done`?x.result:void 0,T=g||(x?.state===`failed`?x.error:``)||(n&&!n.preview?n.problem:``)||``,E=e=>/^https:\/\//.test(e)?e:void 0,O=(e,t)=>(0,$.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 text-accent-fg`,children:[t,(0,$.jsx)(Ee,{size:11,"aria-hidden":`true`})]});return(0,$.jsx)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{variant:`ghost`,onClick:t,children:w?`Close`:`Cancel`}),!w&&(0,$.jsx)(A,{busy:m,variant:`primary`,disabled:!b||!n?.preview||m||C||!s.trim(),onClick:()=>void y(),children:m?`Starting…`:C?`Pushing…`:`Push and open the pull request`})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[!n&&!g&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Checking the repository…`}),T&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:T}),w&&(0,$.jsxs)(`p`,{role:`status`,className:p(D.info,`m-0`),children:[w.existing?`Nothing new to push: this is the pull request.`:`Pushed ${Z(w.files,`file`)} on ${w.branch}.`,` `,E(w.url)?O(E(w.url),`Open the pull request`):`It is open on ${w.branch}; the host gave no https address to link to.`]}),b&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Repository`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[b.platform===`github`?`GitHub`:`Azure DevOps`,` `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:b.repository}),` (`,b.remote,`)`]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Branch`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-body-sm [overflow-wrap:anywhere]`,children:b.branch}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[Z(b.files.length,`file`),` of `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:b.folder})]})]}),b.last&&E(b.last.url)&&!w&&(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Opened before: `,O(E(b.last.url),`the pull request`),`. Pushing again updates its branch.`]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Merge into`}),(0,$.jsx)(o,{value:s,spellCheck:!1,maxLength:200,placeholder:`main`,"aria-invalid":!(!n||n.preview),onChange:e=>c(e.target.value),onBlur:()=>s.trim()&&s.trim()!==n?.preview?.base&&void v(s.trim()),disabled:C,className:`font-mono`})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Title`}),(0,$.jsx)(o,{value:l,maxLength:200,onChange:e=>u(e.target.value),disabled:C})]}),(0,$.jsxs)(`label`,{className:p(`flex items-start gap-2`,C?`cursor-default`:`cursor-pointer`),children:[(0,$.jsx)(at,{className:`mt-1`,checked:d,onCheckedChange:f,disabled:C}),(0,$.jsxs)(`span`,{children:[`Open it as a draft`,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`Reviewers are not asked yet.`})]})]}),(0,$.jsx)(wt,{title:`Files (${b.files.length})`,children:(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm`,children:[b.files.slice(0,200).map(e=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e)),b.files.length>200&&(0,$.jsxs)(`li`,{className:`text-muted`,children:[`and `,b.files.length-200,` more`]})]})}),b.skipped.length>0&&(0,$.jsx)(wt,{title:`Left out (${b.skipped.length})`,children:(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:b.skipped.slice(0,100).map(e=>(0,$.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.path}),`: `,(0,$.jsx)(`span`,{className:`text-muted`,children:e.why})]},e.path))})})]})]})})}function Vn({id:e,title:t,targetDir:n,onClose:i}){let[a,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),f=async()=>{l(!0),d(``);try{await S.delete(e,a),location.hash=r(`migration`,`migrations`)}catch(e){d(e.message),l(!1)}};return(0,$.jsx)(et,{open:!0,onClose:i,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`ghost`,onClick:i,"data-tip":`Keep it`,children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),`Keep`]}),(0,$.jsxs)(A,{variant:`danger`,disabled:c||a!==e,onClick:()=>void f(),children:[(0,$.jsx)(B,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,$.jsx)(o,{value:a,onChange:e=>s(e.target.value),autoComplete:`off`,spellCheck:!1})]}),u?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:u}):null]})})}function Hn({d:e,unit:t,onClose:n,onSend:r}){let[i,o]=(0,Q.useState)(``),s=e.plan.units.find(e=>e.id===t),c=e.result?.units.find(e=>e.id===t);return(0,$.jsx)(et,{open:!0,onClose:n,title:`Fix ${s?In(s.target):t}`,description:`Bridge works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`outline`,onClick:n,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(A,{variant:`primary`,onClick:()=>r(i.trim()),"data-tip":`Send to the agent`,children:[(0,$.jsx)(Oe,{"aria-hidden":`true`}),`Send`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:c.problems[0]}):null,(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,$.jsx)(a,{value:i,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function Un({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,$.jsx)(et,{open:!0,onClose:n,wide:!0,title:`Output of ${i?In(i.target):t}`,description:r?.checkedAt?`Run again ${Gt(r.checkedAt)}`:`From the conversion's own run`,footer:(0,$.jsxs)(A,{onClick:n,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r?.problems?.length?(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:r.problems.join(` `)}):r?.status===`converted`?(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,r?.command&&(0,$.jsxs)(`code`,{className:`block font-mono text-body-sm text-muted`,children:[`$ `,r.command]}),(0,$.jsx)(`pre`,{className:p(ee,`m-0 max-h-[60vh]`),children:(0,$.jsx)(I,{text:r?.output||`No output.`})})]})})}function Wn(e){let t=Object.fromEntries(an.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 Gn(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||!jn(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||In(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)),Pn(r,e=>e.u.checkedAt)}var Kn=`@5xl:h-[calc(var(--screen)-312px)] @5xl:min-h-[540px]`;function qn({d:e,busy:t,onFix:n,onSteps:r,onOutput:i}){let a=e.result?Gn(e,e.result):[];return a.length?(0,$.jsx)(`ol`,{"aria-label":`Errors, the latest first`,className:`m-0 flex min-h-0 list-none flex-col gap-8 p-0 @5xl:flex-1 @5xl:overflow-y-auto`,children:a.map(({p:e,u:a,tc:o,title:s})=>{let c=Nn(a),l=a.problems?.length?a.problems:[];return(0,$.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,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`h3`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-body-lg font-medium`,children:[(0,$.jsx)(P,{tone:_n[a.status].tone,children:_n[a.status].label}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:s})]}),(0,$.jsxs)(`p`,{className:`m-0 font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:[e.target,o?.suites?.length?(0,$.jsxs)(`span`,{className:`font-sans`,children:[`, in `,o.suites.join(`, `)]}):null,(0,$.jsxs)(`span`,{className:`font-sans`,children:[` `,`· `,Z(a.attempts,`attempt`),a.checkedAt?`, run again ${tt(a.checkedAt)}`:``]})]})]}),(0,$.jsxs)(mn,{icon:Ke,title:`What went wrong`,children:[(0,$.jsx)(`p`,{className:p(D.fail,`m-0 font-mono`),children:Mn(a)}),l.length>0&&(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:l.map((e,t)=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))})]}),c&&(0,$.jsx)(mn,{icon:ye,title:`What the test printed`,children:(0,$.jsx)(F,{label:`Error of ${s}`,files:[{name:In(e.target),code:c,log:!0}]})}),a.reason&&(0,$.jsx)(mn,{icon:je,title:`The agent's note`,children:(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:a.reason})}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[!e.engine&&(0,$.jsxs)(A,{size:`sm`,variant:`primary`,disabled:t,onClick:()=>n(e.id),children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix with the agent`]}),e.case&&(0,$.jsxs)(A,{size:`sm`,onClick:()=>r(e.case),children:[(0,$.jsx)(Ve,{"aria-hidden":`true`}),`Steps beside the code`]}),(a.output||l.length>0)&&(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:()=>i(e.id),children:[(0,$.jsx)(ye,{"aria-hidden":`true`}),`Full output`]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:p(l,`flex min-h-[240px] flex-1 items-center justify-center`),children:(0,$.jsx)(_t,{center:!0,icon:q,title:`No errors`,children:e.result?.status===`running`?`None so far: a test that fails shows here, with what to do.`:`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?Wn(e):null);if(!l)return(0,$.jsx)($.Fragment,{children:t});let u=new Map(l.units.map(e=>[e.id,e])),f=e.plan.units.filter(e=>e.kind===`test`&&!e.engine),m=e.plan.units.filter(e=>e.kind===`test`&&e.engine),h=new Set(f.map(e=>e.id)),g=new Set(m.map(e=>e.id)),_=l.units.filter(e=>h.has(e.id)&&e.status===`converted`).length,v=l.units.filter(e=>g.has(e.id)&&e.status===`written`).length,y=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=Gn(e,l),w=C[0];return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-8`,children:[(0,$.jsxs)(ft,{label:`The conversion in numbers`,children:[(0,$.jsx)(ht,{dot:`pass`,value:f.length?`${_} of ${f.length}`:`${v} of ${m.length}`,label:f.length?`passing`:`workflows written`}),(0,$.jsx)(ht,{dot:b?`fail`:`neutral`,value:b,label:`need attention`}),(0,$.jsx)(ht,{dot:`neutral`,value:y.n?`${y.m} of ${y.n}`:`None yet`,label:`Tosca steps kept`}),(0,$.jsx)(ht,{dot:l.status===`running`?`running`:`neutral`,value:Jt(l.status===`running`?Date.now()-Date.parse(l.startedAt):l.ms),label:l.status===`running`?`running`:`taken`})]}),w&&(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-attn-h`,className:p(D.fail,`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 @2xl:grid-cols-[auto_minmax(0,1fr)_auto]`),children:[(0,$.jsx)(`h3`,{id:`tsc-attn-h`,className:`sr-only`,children:`Needs your attention`}),(0,$.jsx)(Ke,{size:18,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,$.jsxs)(`p`,{className:`m-0 min-w-0 truncate text-body-sm text-ink`,"data-tip":`${w.title}: ${Mn(w.u)}`,children:[(0,$.jsx)(`span`,{className:`hidden font-medium @2xl:inline`,children:w.title}),(0,$.jsx)(`span`,{className:`hidden text-ink-2 @2xl:inline`,children:`: `}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:Mn(w.u)})]}),(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`col-start-2 -ml-4 justify-self-start @2xl:col-start-auto @2xl:ml-0`,onClick:c,children:[C.length===1?`See the error`:`See all ${C.length} errors`,(0,$.jsx)(ze,{"aria-hidden":`true`})]})]}),l.notes&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:l.notes}),l.batch&&l.batch.left>0&&l.status!==`running`&&(0,$.jsxs)(`div`,{role:`status`,className:p(D.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Batch `,l.batch.runs,` is done. Check its tests, then continue: `,Z(l.batch.left,`test case`),` not tried yet.`]}),(0,$.jsxs)(A,{size:`sm`,disabled:n,onClick:s,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Continue with the next batch`]})]}),(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,$.jsx)(`div`,{className:`@container flex min-h-0 min-w-0 flex-col`,children:(0,$.jsx)(Dt,{className:`min-h-[240px] flex-1 overflow-y-auto`,label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`File`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @3xl:table-cell`),children:`Note`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let o=u.get(t.id),s=o?_n[o.status]:null,c=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsxs)(`td`,{className:mt,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:In(t.target)}),(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[c?t.engine?`${ln(t)}: ${c.name}`:c.name:`${ln(t)}, ${t.target}`,c?.suites?.length?`, in ${c.suites.join(`, `)}`:``]})]}),(0,$.jsxs)(`td`,{className:p(mt,`whitespace-nowrap`),children:[s?(0,$.jsx)(P,{tone:s.tone,children:s.label}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Waiting`}),o?.checkedAt&&(0,$.jsxs)(`span`,{className:`block pt-1 text-body-sm text-muted`,children:[`Run again `,tt(o.checkedAt)]})]}),(0,$.jsx)(`td`,{className:p(mt,`hidden text-body-sm whitespace-nowrap @2xl:table-cell`),"data-sort":o?.fidelity?o.fidelity.matched/Math.max(1,o.fidelity.required):-1,children:o?.fidelity?(0,$.jsxs)(`span`,{className:o.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[o.fidelity.matched,` of `,o.fidelity.required]}):t.kind===`test`?(0,$.jsx)(`span`,{className:`text-muted`,children:`Not checked yet`}):null}),(0,$.jsx)(`td`,{className:p(mt,`hidden text-body-sm text-ink-2 @3xl:table-cell`),children:(0,$.jsx)(`span`,{className:`line-clamp-2`,children:o?.problems?.[0]||o?.reason||``})}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap text-right`),children:(0,$.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(o?.output||o?.problems?.length)&&(0,$.jsx)(A,{variant:`icon`,size:`icon-sm`,"aria-label":`Output of ${In(t.target)}`,"data-tip":`Output of ${In(t.target)}`,onClick:()=>a(t.id),children:(0,$.jsx)(ye,{"aria-hidden":`true`})}),t.case&&(0,$.jsx)(A,{variant:`icon`,size:`icon-sm`,"aria-label":`Steps of ${In(t.target)}`,"data-tip":`Steps of ${In(t.target)}`,onClick:()=>i(t.case),children:(0,$.jsx)(Ve,{"aria-hidden":`true`})}),o&&(o.status===`failed`||o.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,$.jsx)(A,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Fix ${In(t.target)}`,"data-tip":`Fix ${In(t.target)}`,onClick:()=>r(t.id),children:(0,$.jsx)(ve,{"aria-hidden":`true`})})]})})]},t.id)})})}),(0,$.jsxs)(`aside`,{"aria-label":`Details`,className:p(d,`flex min-h-0 flex-col gap-4 overflow-y-auto text-body-sm`),children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`From`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?`, ${e.plan.source.project}`:``]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`To`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,$.jsx)(Lt,{framework:x,language:S.join(`-`)}),e.plan.target.title]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,"data-tip":e.targetPath,children:e.plan.target.dir})]}),(e.plan.suites||[]).length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`Suites`}),(0,$.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,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),(0,$.jsxs)(`span`,{className:p(`text-body-sm`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,Z(e.cases.length,`test`),` pass, tagged @`,e.tag]})]}),(0,$.jsx)(A,{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,$.jsx)(ue,{"aria-hidden":`true`})})]},e.name)})})]}),e.plan.env.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`Environment variables`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,$.jsxs)(`li`,{className:`flex flex-col`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-body-sm`,children:[e.name,e.secret?(0,$.jsx)(`span`,{className:`font-sans text-muted`,children:` (secret)`}):null]}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 pt-4`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,$.jsx)(`dd`,{className:`m-0 text-right`,children:Gt(l.startedAt)}),l.model&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,$.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":l.model,children:l.model})]}),l.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-right`,children:[l.reverted.length,` edits outside the target`]})]})]})]})]})]})}var Yn={fail:{icon:Ke,cls:`text-fail`,label:`Failed`},ok:{icon:q,cls:`text-pass`,label:`Done`},info:{icon:be,cls:`text-muted`,label:`Info`},agent:{icon:je,cls:`text-accent-fg`,label:`Agent`},tool:{icon:ve,cls:`text-muted`,label:`Tool`}};function Xn(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:`${ln(a)}, ${a.target} (${a.id})`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:dn[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var Zn=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function Qn({d:e,events:t,running:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(!0),[a,o]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(`all`),[u,d]=(0,Q.useState)({}),f=Xn(t,e),m=a.trim().toLowerCase(),h=e=>(c===`all`||e.kind===c)&&(!m||e.text.toLowerCase().includes(m)),g=c!==`all`||!!m,_=f.map(e=>({...e,lines:e.events.filter(h),matchTitle:!!m&&`${e.title} ${e.sub}`.toLowerCase().includes(m)})).map(e=>({...e,lines:e.matchTitle?e.events.filter(e=>c===`all`||e.kind===c):e.lines})).filter(e=>e.lines.length),v=e=>t.filter(t=>t.kind===e).length,y=f[f.length-1]?.key;return(0,Q.useEffect)(()=>{n&&!g&&i.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t.length,n,g]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(k,{id:`tosca-activity-search`,label:`Find a line`,value:a,onChange:o,placeholder:`Find a line, test case or file`}),(0,$.jsx)(j,{items:[{id:`all`,label:`All`,n:t.length},{id:`fail`,label:`Failed`,n:v(`fail`),alert:!0},{id:`ok`,label:`Done`,n:v(`ok`)},{id:`info`,label:`Info`,n:v(`info`)},{id:`agent`,label:`Agent`,n:v(`agent`)},{id:`tool`,label:`Tools`,n:v(`tool`)}],value:c,onChange:l})]}),(0,$.jsxs)(`div`,{ref:r,role:`log`,"aria-live":n?`polite`:void 0,"aria-label":`Activity`,onScroll:e=>{let t=e.currentTarget;i.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:`flex max-h-[60vh] min-h-0 flex-col overflow-y-auto border-y border-line-soft @5xl:max-h-none @5xl:flex-1`,children:[_.map(e=>{let t=e.events.filter(e=>e.kind===`fail`).length,r=u[e.key]??(g||t>0||n&&e.key===y),i=`act-${e.key.replace(/[^A-Za-z0-9_-]/g,`-`)}`,a=e.status?_n[e.status]:void 0;return(0,$.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":i,onClick:()=>d(t=>({...t,[e.key]:!r})),className:p(s,`min-w-0`),children:[(0,$.jsx)(V,{size:15,"aria-hidden":`true`,className:p(`flex-none text-muted transition-transform`,r&&`rotate-180`)}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-body-sm text-muted`,children:e.sub})]}),(0,$.jsxs)(`span`,{className:`flex-none text-body-sm text-muted tabular-nums`,children:[g&&e.lines.length!==e.events.length?`${e.lines.length} of ${Z(e.events.length,`line`)}`:Z(e.events.length,`line`),t>0&&(0,$.jsxs)(`span`,{className:`text-fail`,children:[`, `,t,` failed`]})]}),a&&(0,$.jsx)(P,{tone:a.tone,children:a.label})]}),(0,$.jsx)(Je,{open:r,id:i,children:(0,$.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=Yn[e.kind];return(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft py-2 pr-4 pl-12 text-body-sm last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`w-[76px] flex-none text-body-sm whitespace-nowrap text-muted tabular-nums`,children:Zn(e.ts)}),(0,$.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:p(`mt-1 flex-none`,n.cls)}),(0,$.jsx)(`span`,{className:p(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:e.kind===`tool`?`font-mono text-body-sm text-muted`:`text-ink-2`),children:e.text})]},t)})})})]},e.key)}),!_.length&&(0,$.jsx)(`p`,{className:`m-0 px-4 py-8 text-center text-body-sm text-muted`,children:t.length?`No line matches.`:`Nothing yet.`})]})]})}function $n({id:e,plan:t,tab:n=`overview`}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(n),u=t=>{l(t),history.replaceState(null,``,r(`migration`,...t===`overview`?[e]:[e,t]))},[d,f]=(0,Q.useState)(),[m,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)([]),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),[j,ee]=(0,Q.useState)(!1),[te,N]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[z,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(0),U=(0,Q.useCallback)(()=>{S.detail(e).then(e=>{a(e),s(``)},e=>s(e.message));let t=H.current;S.events(e,t).then(e=>{if(e.next<H.current){H.current=0,x([]);return}let t=H.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));H.current=e.next,n.length&&x(e=>[...e,...n].slice(-2e3))},()=>{})},[e]);(0,Q.useEffect)(U,[U]);let W=!!(i?.job?.running||i?.result?.status===`running`);(0,Q.useEffect)(()=>{if(!W)return;let e=vt(U,1500);return()=>lt(e)},[W,U]);let[G,re]=(0,Q.useState)(``),ie=(0,Q.useRef)(W);(0,Q.useEffect)(()=>{if(ie.current&&!W&&i){let e=i.plan.units.filter(e=>e.kind===`test`).length,t=(i.result?.units||[]).filter(e=>e.kind===`test`&&e.status===`converted`).length;re(`The conversion ${i.result?.status===`stopped`?`stopped`:i.result?.status===`failed`?`failed`:`finished`}: ${t} of ${e} test${e===1?``:`s`} pass.`)}W&&re(``),ie.current=W},[W,i]);let K=(0,Q.useCallback)(e=>{a(e),s(``),u(`overview`),setTimeout(U,800)},[U]),se=async e=>{w(!0),s(``);try{a(await e()),setTimeout(U,800)}catch(e){s(e.message)}finally{w(!1)}};if(!i)return o?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}):(0,$.jsx)(M,{shape:`detail`});let q=Fn(i),ce=cn(i.plan,i.result),J=i.result,le=(J?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,de=i.plan.cases.filter(e=>e.included).length,fe=[{id:`overview`,label:`Overview`},{id:`steps`,label:`Steps`,n:de?String(de):void 0},...le||c===`errors`?[{id:`errors`,label:`Errors`,n:le?String(le):void 0,tone:le?`text-fail`:void 0}]:[],{id:`activity`,label:`Activity`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-headline-sm`,children:[(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:In(i.plan.source.file)}),(0,$.jsx)(ze,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(Lt,{framework:i.plan.target.id.split(`-`)[0],language:i.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),i.plan.target.title]})]}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-1 text-body-sm text-muted`,children:[(0,$.jsxs)(`span`,{children:[`From Tricentis Tosca`,i.plan.source.project?`, ${i.plan.source.project}`:``]}),(0,$.jsxs)(`span`,{children:[`Into `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:i.plan.target.dir})]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(P,{tone:q.tone,children:q.label}),W?(0,$.jsx)(A,{variant:`danger`,size:`icon`,disabled:C,onClick:()=>void se(()=>S.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the conversion`,children:(0,$.jsx)(He,{fill:`currentColor`,"aria-hidden":`true`})}):(0,$.jsxs)($.Fragment,{children:[J&&(J.status===`stopped`||J.status===`failed`)&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:C,onClick:()=>V(!0),"aria-label":`Start again`,"data-tip":`Start again: tests it already wrote are kept`,children:(0,$.jsx)(ae,{"aria-hidden":`true`})}),J&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,onClick:()=>location.hash=r(`migration`,e,`report`),"aria-label":`Report`,"data-tip":`Report`,children:(0,$.jsx)(Ae,{"aria-hidden":`true`})}),J&&i.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:C,onClick:()=>void se(()=>S.verify(e)),"aria-label":`Run the tests`,"data-tip":`Run every converted test again, no agent`,children:(0,$.jsx)(ue,{"aria-hidden":`true`})}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:C,"aria-haspopup":`menu`,"aria-expanded":F,onClick:()=>I(!F),"aria-label":`More`,"data-tip":`More: re-import, CI, pull request, delete`,children:(0,$.jsx)(pe,{"aria-hidden":`true`})}),(0,$.jsxs)(_,{open:F,onClose:()=>I(!1),label:`More for this conversion`,align:`end`,className:`w-[240px]`,children:[J&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(h,{onClick:()=>(I(!1),k(!0)),children:[(0,$.jsx)(he,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Re-import`]}),(0,$.jsxs)(h,{onClick:()=>(I(!1),N(!0)),children:[(0,$.jsx)(ne,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`CI`]}),(0,$.jsxs)(h,{onClick:()=>(I(!1),ee(!0)),children:[(0,$.jsx)(oe,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Pull request`]}),(0,$.jsx)(`div`,{role:`separator`,className:`mx-2 my-1 border-t border-line-soft`})]}),(0,$.jsxs)(h,{onClick:()=>(I(!1),E(!0)),children:[(0,$.jsx)(B,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-fail`}),(0,$.jsx)(`span`,{className:`text-fail`,children:`Delete`})]})]})]})]})]})]}),O&&(0,$.jsx)(Ln,{d:i,onClose:()=>k(!1)}),j&&(0,$.jsx)(Bn,{id:e,onClose:()=>ee(!1)}),te&&(0,$.jsx)(zn,{id:e,onClose:()=>N(!1)}),z&&(0,$.jsx)(Cn,{plan:i.plan,acceptLimits:!1,again:!0,onClose:()=>V(!1),onStarted:e=>{V(!1),a(e)}}),L&&i.result?.batch&&(0,$.jsx)(Cn,{plan:i.plan,acceptLimits:!1,next:i.result.batch,onClose:()=>R(!1),onStarted:e=>{R(!1),a(e)}}),T&&(0,$.jsx)(Vn,{id:e,title:`${In(i.plan.source.file)} → ${i.plan.target.title}`,targetDir:i.plan.target.dir,onClose:()=>E(!1)}),(0,$.jsxs)(`div`,{className:p(`grid grid-cols-[minmax(0,1fr)] gap-6`,J&&`@3xl:grid-cols-[208px_minmax(0,1fr)] @3xl:gap-8`),children:[J&&(0,$.jsx)(`div`,{className:`@3xl:flex @3xl:flex-col @3xl:border-r @3xl:border-line-soft @3xl:pr-6`,children:(0,$.jsx)(Xt,{label:`Conversion stages`,items:nn(J.stages),...W?{progress:ce}:{}})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,$.jsx)(`p`,{role:`status`,className:`sr-only`,children:G}),o&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}),(0,$.jsx)(Ze,{prefix:`mtab`,className:`mb-0`,tabs:fe,current:c,onPick:u,label:`Tosca conversion`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${c}`,"aria-labelledby":`mtab-${c}`,className:p(`pane-swap flex min-w-0 flex-col gap-4`,J&&Kn),children:[c===`overview`&&(0,$.jsx)(Jn,{d:i,planView:t(i,K),busy:C||W,onFix:g,onSteps:e=>(f(e),u(`steps`)),onOutput:y,onRun:t=>void se(()=>S.verify(e,t)),onNext:()=>R(!0),onErrors:()=>u(`errors`)}),c===`errors`&&(0,$.jsx)(qn,{d:i,busy:C||W,onFix:g,onSteps:e=>(f(e),u(`steps`)),onOutput:y}),c===`steps`&&(0,$.jsx)(gn,{id:e,plan:i.plan,result:J,initial:d}),c===`activity`&&(0,$.jsx)(Qn,{d:i,events:b,running:W})]},c)]})]}),v&&(0,$.jsx)(Un,{d:i,unit:v,onClose:()=>y(null)}),m&&(0,$.jsx)(Hn,{d:i,unit:m,onClose:()=>g(null),onSend:t=>{g(null),se(()=>S.fix(e,[m],t))}})]})}var er=e=>e.slice(e.lastIndexOf(`/`)+1),tr=50,nr=[{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 rr(e){return e===`converted`?_n.converted:e===`failed`?_n.failed:e===`blocked`?_n.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?_n.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function ir(e){for(let t of an){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function ar({planId:e,unit:t,file:n}){let r=/\.(webm|mp4)$/i.test(n),[i,a]=(0,Q.useState)(!r),[o,s]=(0,Q.useState)(``),[l,d]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!i)return;let r=!1;return s(``),d(!1),S.evidence(e,t,n).then(e=>!r&&s(e),()=>!r&&d(!0)),()=>{r=!0}},[e,t,n,i]),(0,$.jsxs)(`li`,{className:p(`flex min-w-0 flex-col gap-2`,r&&`@xl:col-span-2`),children:[o?r?(0,$.jsx)(`video`,{controls:!0,autoPlay:!0,src:o,className:p(c,`aspect-video w-full object-contain`)}):(0,$.jsx)(`img`,{src:o,alt:`Screenshot ${n}`,className:p(c,`w-full object-contain`)}):r&&!i?(0,$.jsx)(`button`,{type:`button`,onClick:()=>a(!0),"aria-label":`Play ${n}`,className:p(c,`group flex aspect-video w-full cursor-pointer items-center justify-center border-0`),children:(0,$.jsx)(`span`,{className:p(u,`inline-flex size-16 items-center justify-center rounded-full transition-transform group-hover:scale-105`),children:(0,$.jsx)(ue,{size:24,"aria-hidden":`true`,className:`ml-1 text-ink`})})}):l?(0,$.jsx)(`span`,{role:`status`,className:p(c,`flex items-center justify-center text-body-sm text-muted`,r?`aspect-video`:`h-[160px]`),children:`Not available`}):(0,$.jsxs)(`span`,{role:`status`,className:`block`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`Loading…`}),(0,$.jsx)(te,{className:p(`w-full rounded-md`,r?`aspect-video h-auto`:`h-[160px]`)})]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:n})]})}function or({planId:e,pick:t,video:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{let n=!1;return i(null),o(``),S.reportCase(e,t.case).then(e=>!n&&i(e),e=>!n&&o(e.message)),()=>{n=!0}},[e,t.case]);let s=rr(t.status),c=t.group===`failed`||t.group===`attention`,l=ur[t.group];return(0,$.jsxs)(`section`,{"aria-label":`Test case ${t.name}`,className:`@container flex min-w-0 flex-col gap-8`,children:[(0,$.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,$.jsx)(l.icon,{size:24,"aria-label":l.label,className:p(`translate-y-0.5 flex-none`,l.tone)}),(0,$.jsx)(`h3`,{className:`m-0 min-w-0 flex-1 text-headline-sm [overflow-wrap:anywhere]`,children:t.name}),(0,$.jsx)(P,{tone:s.tone,children:s.label}),t.ms>0&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-muted tabular-nums`,children:[(0,$.jsx)(de,{size:14,"aria-hidden":`true`}),Jt(t.ms)]})]}),(0,$.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-body-sm text-ink-2`,children:[(0,$.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Me,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`File`}),(0,$.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.file||`No file`})]}),t.suites.length>0&&(0,$.jsxs)(`li`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(Be,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Suite`}),t.suites.join(`, `)]}),t.folders.length>0&&(0,$.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(R,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Folder`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.folders.join(` / `)})]}),t.uid&&(0,$.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(re,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Tosca id`}),(0,$.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.uid})]}),t.change&&(0,$.jsx)(`li`,{className:`inline-flex items-center gap-2 text-muted`,children:sr[t.change]})]})]}),a&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:a}),!r&&!a&&(0,$.jsx)(M,{shape:`lines`,count:5}),r&&(0,$.jsxs)($.Fragment,{children:[(r.problems?.length||r.reason)&&(0,$.jsx)(mn,{icon:c?H:Ge,title:c?`What went wrong`:`What happened`,children:(0,$.jsx)(`div`,{className:p(D[c?`fail`:`info`],`flex flex-col gap-2 leading-relaxed`),children:(r.problems?.length?r.problems:[r.reason]).map((e,t)=>(0,$.jsx)(`p`,{className:`m-0`,children:e},t))})}),(0,$.jsx)(mn,{icon:U,title:n?`Recording`:`Screenshots`,children:r.media.length>0?(0,$.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-4 p-0 @xl:grid-cols-2`,children:r.media.map(t=>(0,$.jsx)(ar,{planId:e,unit:r.unit,file:t},t))}):(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:r.unit&&r.group!==`notrun`?c?`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.`})}),r.fidelity&&r.fidelity.rows.length>0&&(0,$.jsx)(mn,{icon:we,title:`Tosca steps`,aside:`${r.fidelity.matched} of ${r.fidelity.required} in the test`,children:(0,$.jsx)(Dt,{label:`Tosca steps`,placeholder:`Find a step`,sortable:!1,resetKey:t.case,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-14`),children:`Step`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`What it does`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`In the test`})]}),children:r.fidelity.rows.map(e=>{let t=un[e.status]||un.matched;return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`font-mono text-body-sm text-muted`),children:e.id}),(0,$.jsxs)(`td`,{className:p(`px-4 py-2`,`[overflow-wrap:anywhere]`),children:[e.kind===`assert`?`check ${e.op}`:e.op,e.element?` on ${e.element}`:``,e.step&&(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Tosca “`,e.step,`”`]})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`whitespace-nowrap`),children:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`size-2 flex-none rounded-full`,t.dot)}),t.label]})})]},e.id)})})}),(r.command||r.output)&&(0,$.jsx)(mn,{icon:Ie,title:`How it ran`,children:(0,$.jsx)(F,{label:`How the test ran`,className:`max-h-[50vh]`,files:[...r.output?[{name:`Output`,code:r.output,log:!0}]:[],...r.command?[{name:`Command`,code:`$ ${r.command}`,lang:`bash`}]:[]]})})]})]})}var sr={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},cr=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function lr(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(` / `),rr(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?sr[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(cr).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 ur={failed:{icon:Ke,tone:`text-fail`,label:`Failed`},attention:{icon:H,tone:`text-warn`,label:`Needs a look`},passed:{icon:q,tone:`text-pass`,label:`Passed`},notrun:{icon:ce,tone:`text-muted`,label:`Not run`},leftout:{icon:le,tone:`text-muted`,label:`Left out`}};function dr({rows:e,pick:t,onPick:n}){let r=()=>Math.max(0,Math.floor(e.findIndex(e=>e.case===t)/tr)),[i,a]=(0,Q.useState)(r);(0,Q.useEffect)(()=>a(r()),[e.length]);let o=e.slice(i*tr,i*tr+tr);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>{let r=ur[e.group],i=t===e.case;return(0,$.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>n(e),className:p(s,`relative min-w-0 items-start gap-2 overflow-hidden`),children:[i&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-1 bg-accent`}),(0,$.jsx)(r.icon,{size:16,"aria-label":r.label,className:p(`translate-y-0.5 flex-none`,r.tone)}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate font-mono text-body-sm text-muted`,children:e.file||`No file`}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-4 text-body-sm text-muted tabular-nums`,children:[e.fidelity&&(0,$.jsxs)(`span`,{children:[e.fidelity.matched,`/`,e.fidelity.required,` steps`]}),e.ms>0&&(0,$.jsx)(`span`,{children:Jt(e.ms)}),e.media>0&&(0,$.jsx)(`span`,{children:Z(e.media,`file`)})]}),e.note&&e.group!==`passed`&&(0,$.jsx)(`span`,{className:p(`line-clamp-2 text-body-sm`,e.group===`failed`?`text-fail`:`text-ink-2`),children:e.note})]})]})},e.case)})}),e.length>tr&&(0,$.jsx)(T,{page:i,size:tr,total:e.length,onPage:a,label:`Test case pages`})]})}function fr({id:e,caseId:t,tab:n=`summary`}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!0),[u,d]=(0,Q.useState)(`all`),[f,m]=(0,Q.useState)(``),[g,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(!1),w=(...t)=>r(`migration`,e,`report`,...t),T=e=>location.hash=e===`summary`?w():e===`cases`&&g?w(encodeURIComponent(g)):w(`tab`,e),[E,O]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{l(!0),S.report(e).then(e=>{if(a(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`);v(n?n.case:``)}},e=>{s(e.message),l(!1)})},[e]),(0,Q.useEffect)(()=>{g&&n===`cases`&&history.replaceState(null,``,w(encodeURIComponent(g)))},[e,g,n]);let ee=f.trim().toLowerCase(),te=(0,Q.useMemo)(()=>{let e={failed:[],attention:[],passed:[],notrun:[],leftout:[]};for(let t of i?.tests||[])u!==`all`&&t.group!==u||ee&&!`${t.name} ${t.file} ${t.case} ${t.note||``} ${t.suites.join(` `)} ${t.folders.join(` `)}`.toLowerCase().includes(ee)||e[t.group].push(t);return e},[i,u,ee]),N=async t=>{b(t),O(``);try{let n=await(t===`zip`?S.reportZip(e):S.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){O(e.message)}finally{b(``)}};if(c)return(0,$.jsx)(M,{shape:`detail`,label:`Loading report…`});if(o||!i)return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o||`No report.`})});let F=fn[i.status]||{label:i.status,tone:`neutral`},[I,...L]=i.target.id.split(`-`),R=ir(i.stages),z=i.tests.length-i.counts.leftout,B=i.tests.find(e=>e.case===g)||null,U=nr.reduce((e,t)=>e+te[t.id].length,0),W=i.tests.filter(e=>e.group===`failed`||e.group===`attention`),G=e=>(v(e.case),location.hash=w(encodeURIComponent(e.case))),ne=i.status===`running`?{tone:`running`,text:`Converting: ${i.counts.passed} of ${z} test cases pass so far.`}:W.length===0&&i.counts.passed===z&&z>0?{tone:`pass`,text:`All ${z===1?``:`${z} `}Tosca test case${z===1?``:`s`} became passing ${i.target.title} tests.`}:{tone:i.counts.failed?`fail`:`warn`,text:`${i.counts.passed} of ${z} test cases pass${[i.counts.failed?`${i.counts.failed} failed`:``,i.counts.attention?`${i.counts.attention} need${i.counts.attention===1?`s`:``} a look`:``,i.counts.notrun?`${i.counts.notrun} not run`:``].filter(Boolean).map((e,t)=>t?`, ${e}`:`; ${e}`).join(``)}.`},re=ne.tone===`pass`?q:ne.tone===`running`?De:H,ie=[{id:`summary`,label:`Summary`},{id:`cases`,label:`Test cases`,n:i.tests.length},{id:`coverage`,label:`Coverage`},{id:`trace`,label:`Traceability`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:`Conversion report`}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:er(i.source.file)}),(0,$.jsx)(ze,{size:14,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Lt,{framework:I,language:L.join(`-`),size:14}),i.target.title]})]})]}),(0,$.jsx)(P,{tone:F.tone,children:F.label}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsxs)(A,{busy:y===`html`,variant:`ghost`,disabled:!!y,"aria-haspopup":`menu`,"aria-expanded":x,onClick:()=>C(!x),children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),y===`html`?`Making the report…`:y===`zip`?`Making the zip…`:`Export`,(0,$.jsx)(V,{"aria-hidden":`true`})]}),(0,$.jsxs)(_,{open:x,onClose:()=>C(!1),label:`Export this report`,align:`end`,className:`w-[280px]`,children:[(0,$.jsxs)(h,{onClick:()=>(C(!1),void N(`html`)),children:[(0,$.jsx)(We,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`HTML report, screenshots inside`]}),(0,$.jsxs)(h,{onClick:()=>(C(!1),i.status===`running`?O(`The zip is made when the run ends.`):void N(`zip`)),children:[(0,$.jsx)(Ne,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Zip with videos`]}),(0,$.jsxs)(h,{onClick:()=>(C(!1),lr(i)),children:[(0,$.jsx)(Ce,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Traceability CSV, for Tosca`]})]})]})]}),E&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:E}),(0,$.jsx)(Ze,{prefix:`rtab`,className:`mb-0`,tabs:ie,current:n,onPick:T,label:`Report`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${n}`,"aria-labelledby":`rtab-${n}`,className:`pane-swap flex min-w-0 flex-col gap-8`,children:[n===`summary`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{"aria-label":`Outcome`,className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`p`,{className:p(`m-0 flex items-start gap-4 text-headline-sm`,ne.tone===`pass`?`text-ink`:ne.tone===`fail`?`text-fail`:`text-ink`),children:[(0,$.jsx)(re,{size:24,"aria-hidden":`true`,className:p(`translate-y-0.5 flex-none`,ne.tone===`pass`?`text-pass`:ne.tone===`fail`?`text-fail`:ne.tone===`warn`?`text-warn`:`text-ink motion-safe:animate-spin`)}),ne.text]}),(0,$.jsx)(Yt,{label:`The conversion`,from:{framework:`tosca`,title:`Tosca${i.source.project?`, ${i.source.project}`:``}`,sub:i.source.file},to:{framework:I,language:L.join(`-`),title:i.target.title,sub:`Into ${i.target.dir}/`}}),(0,$.jsxs)($e,{label:`The run in numbers`,children:[(0,$.jsx)(dt,{label:`Passed`,value:`${i.counts.passed} of ${z}`,tone:i.counts.passed===z?`text-pass`:void 0,note:i.counts.leftout?`${i.counts.leftout} left out of the plan`:`Every test case in the plan`}),(0,$.jsx)(dt,{label:`Tosca steps kept`,value:i.steps.required?`${Math.round(i.steps.matched/i.steps.required*100)}%`:`—`,note:i.steps.required?`${i.steps.matched} of ${i.steps.required} steps and checks`:`No steps to keep`}),(0,$.jsx)(dt,{label:`Time`,value:Jt(i.ms),note:`Started ${Gt(i.startedAt)}`}),(0,$.jsx)(dt,{label:`Model cost`,value:i.cost?`${i.cost.estimate?`~`:``}${Et(i.cost.amount,i.cost.currency)}`:`—`,note:[i.model||`Model not recorded`,i.usage.input||i.usage.output?`${Tt(i.usage.input+i.usage.output)} tokens`:``].filter(Boolean).join(`, `)})]})]}),(0,$.jsxs)(`section`,{"aria-labelledby":`rep-attention`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-attention`,className:`m-0 text-body-lg font-medium`,children:`Needs your attention`}),R&&(0,$.jsxs)(`p`,{role:`status`,className:p(D.fail,`m-0`),children:[`The run stopped in `,dn[R.id],R.note?`: ${R.note}`:`.`]}),W.length===0&&!i.personSteps?(0,$.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(q,{size:16,"aria-hidden":`true`,className:`text-pass`}),`Nothing needs attention: every test case that ran passed, with its Tosca steps kept.`]}):(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[W.map(e=>(0,$.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>G(e),className:p(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`items-start`),children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`,className:p(`translate-y-0.5 flex-none`,e.group===`failed`?`text-fail`:`text-warn`)}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.note||rr(e.status).label})]}),(0,$.jsx)(ze,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-muted`})]})},e.case)),i.personSteps>0&&(0,$.jsxs)(`li`,{className:`flex items-start gap-4 py-4 text-body-sm text-ink-2`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-warn`}),Z(i.personSteps,`Tosca step`),` could not be automated and `,i.personSteps===1?`is`:`are`,` left for a person: see Coverage.`]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-8 @3xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{"aria-labelledby":`rep-written`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-written`,className:`m-0 text-body-lg font-medium`,children:`What was written`}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-body-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Tests`}),(0,$.jsxs)(`dd`,{className:`m-0 text-ink`,children:[Z(z,`test file`),` in `,(0,$.jsxs)(`span`,{className:`font-mono`,children:[i.target.dir,`/`]})]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Page objects`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:i.pages.length?Z(i.pages.length,`page`):`None`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Media`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:i.media?Z(i.media,`file`):i.target.video?`Videos and failure screenshots`:`Failure screenshots`}),i.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-ink`,children:[Z(i.reverted.length,`edit`),` outside the target folder`]})]})]})]}),(0,$.jsxs)(`section`,{"aria-labelledby":`rep-needs`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-needs`,className:`m-0 text-body-lg font-medium`,children:`What the tests need to run`}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-body-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`App`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:i.source.baseUrl||`Not named`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Variables`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:i.env.length?i.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `):`None`})]})]})]}),(i.previous||i.removed.length>0)&&(0,$.jsxs)(`p`,{className:p(`m-0 leading-relaxed`,D.info),children:[i.previous?(0,$.jsxs)($.Fragment,{children:[`Re-imported from `,(0,$.jsx)(`a`,{href:r(`migration`,i.previous,`report`),children:i.previous}),`: `,i.tests.filter(e=>e.change===`same`).length,` unchanged (their tests kept), `,i.tests.filter(e=>e.change===`changed`).length,` changed, `,i.tests.filter(e=>e.change===`new`).length,` new.`,` `]}):null,i.removed.length>0&&(0,$.jsxs)($.Fragment,{children:[Z(i.removed.length,`test case`),` no longer in the exports; their tests are left as they are.`]})]}),i.notes.trim()&&(0,$.jsxs)(`section`,{"aria-labelledby":`rep-notes`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-notes`,className:`m-0 text-body-lg font-medium`,children:`Notes from the conversion`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:i.notes.trim()})]})]}),n===`cases`&&(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(300px,360px)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,$.jsx)(k,{id:`tosca-report-search`,label:`Find a test case`,value:f,onChange:m,placeholder:`Find a test case, file or problem`,className:`max-w-none flex-none`}),(0,$.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex flex-wrap gap-1`,children:(0,$.jsx)(j,{items:[{id:`all`,label:`All`,n:i.tests.length},...nr.filter(e=>i.counts[e.id]>0).map(e=>({id:e.id,label:e.label,n:i.counts[e.id],alert:e.id===`failed`}))],value:u,onChange:d})}),(0,$.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:U?(0,$.jsx)(dr,{rows:nr.flatMap(e=>te[e.id]),pick:g,onPick:e=>v(e.case)}):(0,$.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-body-sm text-muted`,children:`No test case matches.`})})]}),(0,$.jsx)(`div`,{className:`min-w-0 @5xl:sticky @5xl:top-4`,children:B?(0,$.jsx)(`div`,{className:`pane-swap`,children:(0,$.jsx)(or,{planId:i.id,pick:B,video:i.target.video})},B.case):(0,$.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-body-sm text-muted`,children:`Pick a test case to see its steps, output and media.`})})]}),n===`coverage`&&(0,$.jsxs)(`section`,{"aria-labelledby":`rep-cov`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`rep-cov`,className:`m-0 text-body-lg font-medium`,children:`How much of each Tosca test case is in its test`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm 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,$.jsx)(Dt,{label:`Coverage by test case`,placeholder:`Find a test case`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Tosca steps in the test`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Result`})]}),children:i.tests.filter(e=>e.group!==`leftout`).map(e=>{let t=e.fidelity,n=t&&t.required?t.matched/t.required*100:0;return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(A,{variant:`link`,size:`inline`,onClick:()=>G(e),className:`whitespace-normal text-left`,children:e.name})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,"data-sort":t?n:-1,children:t?(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:(0,$.jsx)(en,{value:n,marks:[.8,1],tone:n===100?`bg-pass`:n>=80?`bg-warn`:`bg-fail`,label:`${e.name}: ${t.matched} of ${t.required} Tosca steps`})}),(0,$.jsxs)(`span`,{className:`w-16 flex-none text-right text-body-sm tabular-nums text-ink-2`,children:[t.matched,`/`,t.required]})]}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not checked`})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(P,{tone:rr(e.status).tone,children:rr(e.status).label})})]},e.case)})})]}),n===`trace`&&(0,$.jsxs)(`section`,{"aria-labelledby":`rep-trace`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`rep-trace`,className:`m-0 text-body-lg font-medium`,children:`Each Tosca test case and what it became`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`By its Tosca id and path, for audits and for Tosca itself. Export gives the same as a CSV.`})]}),(0,$.jsx)(A,{variant:`icon`,size:`icon`,onClick:()=>lr(i),"aria-label":`Download as CSV`,"data-tip":`Download as CSV`,children:(0,$.jsx)(Ne,{"aria-hidden":`true`})})]}),(0,$.jsx)(Dt,{label:`Traceability`,placeholder:`Find a Tosca id, test case or file`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Tosca test case`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test file`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @3xl:table-cell`),children:`Execution lists`})]}),children:i.tests.map(e=>(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`span`,{className:`block text-body-sm font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.folders.join(` / `)||`—`}),e.uid&&(0,$.jsx)(`span`,{className:`block font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.uid})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`),children:e.file||`—`}),(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(P,{tone:rr(e.status).tone,children:rr(e.status).label}),e.change&&(0,$.jsx)(`span`,{className:`mt-1 block text-body-sm text-muted`,children:sr[e.change]})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-body-sm text-ink-2 @3xl:table-cell`),children:e.suites.join(`, `)||`—`})]},e.case))})]})]},n)]})}var pr={converted:{icon:q,cls:`text-pass`,label:`Converted`},partly:{icon:se,cls:`text-warn`,label:`Converted, with steps for a person`},not:{icon:Ke,cls:`text-muted`,label:`Not converted`}},mr=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function hr(e,t,n){let r=[[`Test case id`,`Test case`,`Kind`,`What happens`,`Modules behind it`].map(mr).join(`,`)];for(let n of e.rows)for(let e of n.cases)r.push([e,t.get(e)||e,n.label,pr[n.outcome].label,n.modules.map(e=>e.name).join(`; `)].map(mr).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 gr({coverage:e,names:t,file:n,folded:r=!1}){let i=e.converted+e.partly,[a,o]=(0,Q.useState)(!r),s=(0,Q.useId)();return(0,$.jsx)(gt,{id:`tsc-coverage`,level:3,icon:ke,title:`What can be migrated`,description:(0,$.jsxs)(`span`,{className:`text-ink-2`,children:[i,` 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,$.jsxs)($.Fragment,{children:[r&&(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,"aria-expanded":a,"aria-controls":s,onClick:()=>o(!a),children:[(0,$.jsx)(V,{"aria-hidden":`true`,className:p(`transition-transform`,a&&`rotate-180`)}),a?`Hide the breakdown`:`Show the breakdown`]}),(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:()=>hr(e,t,n),"data-tip":`Every test case with its kind and what happens to it, for a spreadsheet.`,children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),`CSV`]})]}),children:(0,$.jsx)(Je,{open:a,id:s,children:(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-body-sm`,children:e.rows.map(e=>{let t=pr[e.outcome];return(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,$.jsx)(t.icon,{size:16,role:`img`,"aria-label":t.label,className:p(`mt-1 flex-none`,t.cls)}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,$.jsx)(`span`,{className:`font-medium text-ink`,children:e.label}),(0,$.jsx)(`span`,{className:`tabular-nums text-ink-2`,children:e.cases.length===1?`1 test case`:`${e.cases.length} test cases`})]}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:e.becomes}),e.modules.length>0&&(0,$.jsxs)(`span`,{className:`text-body-sm 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,$.jsxs)(`span`,{className:`text-body-sm 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 _r={ok:{icon:q,cls:`text-pass`,label:`Ready`},answer:{icon:se,cls:`text-warn`,label:`Needs an answer`},blocker:{icon:Ke,cls:`text-fail`,label:`Blocks the start`}};function vr({planId:e,stamp:t,busy:n,open:r,onChanged:a,onAccept:s,acceptTip:c}){let[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{S.data(e).then(e=>{u(e),v(``)},e=>v(e.message))},[e,t]);let y=async t=>{g(!0),v(``);try{u(await S.setData(e,t)),f(``),m(``),a()}catch(e){v(e.message)}finally{g(!1)}},b=n||h,x=l?[...new Set(l.cases.flatMap(e=>e.missing))]:[];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[l&&l.sources.length>0&&(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:l.sources.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.file}),e.sheet?` (sheet ${e.sheet})`:``,`: `,Z(e.rows,`row`),e.transposed?`, attributes down the first column`:``]}),(0,$.jsx)(A,{variant:`link`,size:`inline`,"aria-label":`Remove ${e.file}${e.sheet?`, sheet ${e.sheet}`:``}`,disabled:b,onClick:()=>void y({remove:t}),children:`Remove`})]},`${e.file}\u0000${e.sheet||``}`))}),l&&x.length>0&&(0,$.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Not found yet: `,(0,$.jsx)(`span`,{className:`font-mono`,children:x.slice(0,12).join(`, `)}),x.length>12?` and ${x.length-12} more`:``]}),r&&(0,$.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d&&y({file:d,...p.trim()?{sheet:p.trim()}:{}})},children:[(0,$.jsxs)(i,{size:`sm`,"aria-label":`A data file of the project`,value:d,disabled:b||!l,onChange:e=>f(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,$.jsx)(`option`,{value:``,children:l&&!l.files.length?`No CSV, TSV, Excel or JSON file in the project`:`A data file of the project…`}),(l?.files||[]).map(e=>(0,$.jsx)(`option`,{value:e.path,children:e.path},e.path))]}),/\.xls[xm]$/i.test(d)&&(0,$.jsx)(o,{size:`sm`,"aria-label":`Sheet, the first if empty`,placeholder:`Sheet, the first if empty`,value:p,onChange:e=>m(e.target.value),disabled:b,className:`min-w-0 flex-[1_1_160px]`}),(0,$.jsx)(A,{size:`sm`,type:`submit`,disabled:b||!d,children:`Use it`}),s&&(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:b,onClick:s,"data-tip":c,children:`Leave them for a person`})]}),_&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-body-sm text-fail`,children:_})]})}function yr({r:e,busy:t,onAnswer:n}){let[r,a]=(0,Q.useState)(``),s=String(e.environments.findIndex(t=>t.environment===e.answers.environment&&t.app===e.answers.app));return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[e.environments.length>0&&(0,$.jsxs)(i,{size:`sm`,"aria-label":`An app of env.yaml`,value:s,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,$.jsx)(`option`,{value:`-1`,children:`An app of env.yaml…`}),e.environments.map((e,t)=>(0,$.jsxs)(`option`,{value:String(t),children:[e.app,` on `,e.environment,`: `,e.url]},`${e.environment}\u0000${e.app}`))]}),(0,$.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,$.jsx)(o,{size:`sm`,type:`url`,"aria-label":`Or the address the tests start at`,placeholder:`Or the address, https://…`,value:r,onChange:e=>a(e.target.value),disabled:t,className:`min-w-0 flex-1`}),(0,$.jsx)(A,{size:`sm`,type:`submit`,disabled:t||!r.trim(),children:`Use it`})]})]})}function br({item:e,picked:t,busy:n,onPick:a}){let o=e.apps||[];return o.length?(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:(0,$.jsxs)(i,{size:`sm`,"aria-label":e.engine===`database`?`A database`:e.engine===`mobile`?`A mobile app`:`A desktop app`,value:t&&o.includes(t)?t:``,disabled:n,onChange:e=>e.target.value&&a(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,$.jsx)(`option`,{value:``,children:e.engine===`database`?`A database…`:e.engine===`mobile`?`A mobile app…`:`A desktop app…`}),o.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})}):(0,$.jsxs)(`p`,{className:`m-0 pt-1 text-body-sm text-muted`,children:[e.engine===`database`?`No databases yet: add one in `:`No ${e.engine} apps yet: add one in `,(0,$.jsx)(`a`,{href:r(`settings`,e.engine===`database`?`databases`:`environments`),children:e.engine===`database`?`Settings, Databases`:`Settings, Environments`}),`.`]})}function xr({item:e,busy:t,secrets:n,onSaved:r,onAccept:a,onUse:s}){let[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),g=async()=>{p(!0),h(``);try{await x.saveSecrets({[e.name]:c}),l(``),r()}catch(e){h(e.message)}finally{p(!1)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[(0,$.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),c&&g()},children:[(0,$.jsx)(o,{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:c,onChange:e=>l(e.target.value),disabled:t||f,className:`min-w-0 flex-[1_1_220px]`}),(0,$.jsx)(A,{size:`sm`,variant:`primary`,type:`submit`,disabled:t||f||!c,children:`Save`}),e.accept&&(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:t||f,onClick:a,"data-tip":e.accept,children:`Convert without it`})]}),n.length>0&&!e.uses&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`use-${e.name}`,className:`text-body-sm text-muted`,children:`Or use a saved secret`}),(0,$.jsxs)(i,{id:`use-${e.name}`,size:`sm`,value:u,disabled:t||f,onChange:e=>d(e.target.value),className:`w-auto min-w-[200px] font-mono`,children:[(0,$.jsx)(`option`,{value:``,children:`A saved secret…`}),n.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),(0,$.jsx)(A,{size:`sm`,disabled:t||f||!u,onClick:()=>s(u),children:`Use it`})]}),m&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-body-sm text-fail`,children:m})]})}function Sr({planId:e,onReady:t,onCoverage:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),l=(0,Q.useCallback)(e=>{i(e.readiness),t?.(e.readiness.ready),n?.(e.coverage)},[t,n]),u=(0,Q.useCallback)(()=>{S.ready(e).then(l,e=>c(e.message))},[e,l]);(0,Q.useEffect)(()=>{i(null),c(``),t?.(!1)},[e]),(0,Q.useEffect)(u,[u]);let d=async t=>{o(!0),c(``);try{l(await S.answer(e,t))}catch(e){c(e.message)}finally{o(!1)}};return(0,$.jsxs)(gt,{id:`tsc-ready`,level:3,icon:Pe,title:`Before it runs`,description:(0,$.jsx)(`span`,{role:`status`,className:p(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,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:u,disabled:a,"data-tip":`Check again, after installing a program or setting a variable.`,children:[(0,$.jsx)(he,{"aria-hidden":`true`}),`Check again`]}),children:[s&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:s}),r&&(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-body-sm`,children:r.items.map(t=>{let n=_r[t.level];return(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,$.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:p(`mt-1 flex-none`,n.cls)}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:p(`font-medium text-ink`,t.kind===`env`||t.kind===`tool`?`font-mono text-body-sm`:``),children:t.title}),(0,$.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:t.text}),t.accepted&&(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-warn`,children:[`Accepted: `,t.accept,(0,$.jsx)(A,{variant:`link`,size:`inline`,disabled:a,onClick:()=>void d({unaccept:[t.id]}),children:`Undo`})]}),t.kind===`url`&&(0,$.jsx)(yr,{r,busy:a,onAnswer:e=>void d(e)}),t.kind===`app`&&t.engine&&(0,$.jsx)(br,{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,$.jsx)(xr,{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,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,$.jsxs)(`span`,{children:[`Uses the saved secret `,(0,$.jsx)(`span`,{className:`font-mono`,children:t.uses}),`.`]}),(0,$.jsx)(A,{variant:`link`,size:`inline`,disabled:a,onClick:()=>void d({use:{name:t.name,secret:``}}),children:`Stop using it`})]}),t.kind===`data`&&(0,$.jsx)(vr,{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 Cr=/^[a-f0-9]{16}$/,wr=`forgeqe.tosca.assistant`;function Tr(){try{let e=localStorage.getItem(wr)||``;return Cr.test(e)?e:``}catch{return``}}function Er(e){try{e?localStorage.setItem(wr,e):localStorage.removeItem(wr)}catch{}}var Dr=[/\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],Or=e=>e.replace(/^.*\//,``).replace(/\.tsu$/i,``);function kr(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:Be,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:Me,title:`${Or(t)} to Selenium`,hint:`One export, in Java, with page objects`,text:`Migrate ${Or(t)} to Selenium in Java, with page objects`}),t&&r.push({icon:K,title:`${Or(t)} to Cypress`,hint:`Into a folder of its own`,text:`Migrate ${Or(t)} to Cypress in TypeScript, into e2e/tosca`}),r.push({icon:Te,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 Ar({view:e,sid:t,onSid:n}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=it();(0,Q.useEffect)(()=>{t&&i?.id!==t&&C.view(t).then(a,()=>{n(``),Er(``)})},[t]),(0,Q.useEffect)(()=>{if(!i?.thinking&&!i?.checking)return;let e=setTimeout(()=>C.view(i.id).then(a,e=>l(e.message)),1200);return()=>clearTimeout(e)},[i]);let g=i?.messages.length??0;(0,Q.useEffect)(()=>{g&&m.current?.scrollIntoView({block:`nearest`,behavior:f()})},[g,i?.thinking]);let _=e=>{s(e),setTimeout(()=>document.getElementById(`tosca-agent-box`)?.focus(),0)},y=async e=>{d(!0),l(``);try{let r=await e();return a(r),r.id!==t&&(n(r.id),Er(r.id)),!0}catch(e){return l(e.message),!1}finally{d(!1)}},b=async e=>{!e.trim()||u||i?.thinking||(Dr.some(t=>t.test(e))?(s(``),l(`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 y(()=>i?C.say(i.id,e):C.start(e))&&s(``))},x=()=>{i&&C.end(i.id).catch(()=>{}),a(null),s(``),l(``),n(``),Er(``)},S=()=>i?.prefill&&(location.hash=r(`migration`,`new`,i.id)),w=!i,T=u||!!i?.thinking;return(0,$.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:[w?(0,$.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,$.jsx)(v,{agent:`forgeqe-tosca`,px:h?72:112,working:T,className:`mb-1`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:`What do you want to migrate from Tosca?`}),(0,$.jsx)(`p`,{className:`m-0 text-body-lg 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,$.jsx)(Ir,{view:e}),(0,$.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:kr(e).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>_(e.text),className:p(kt,`items-start`),children:[(0,$.jsx)(O,{icon:e.icon,size:18,className:`mt-1 text-icon`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.hint})]})]},e.title))}),(0,$.jsxs)(`a`,{href:r(`migration`,`new`),className:`inline-flex items-center gap-2 text-body-sm`,children:[(0,$.jsx)(Re,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]}):(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,$.jsxs)(`section`,{"aria-label":`Conversation with Guide`,className:`flex min-w-0 flex-col gap-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:i.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,$.jsx)(A,{size:`sm`,variant:`ghost`,onClick:x,disabled:u,children:`New conversation`})]}),(0,$.jsxs)(`ol`,{"aria-live":`polite`,className:`m-0 flex list-none flex-col gap-6 p-0`,children:[i.messages.map((e,t)=>(0,$.jsx)(`li`,{className:`fade-quick`,children:e.role===`person`?(0,$.jsx)(ct,{text:e.text}):(0,$.jsx)(jr,{text:e.text})},t)),i.thinking&&(0,$.jsx)(`li`,{className:`fade-quick`,children:(0,$.jsx)(jr,{text:i.working===`cloning`?`Cloning the repository and looking for Tosca exports…`:`Reading what you said…`,working:i.working===`cloning`?`cloning`:`reading`})})]}),!i.thinking&&i.question?.id===`clone`&&i.clone&&(0,$.jsx)(Nr,{c:i.clone,disabled:u,onToken:e=>y(()=>C.token(i.id,e)),onPick:e=>void y(()=>C.pick(i.id,`clone`,[e]))},`clone-${g}`),!i.thinking&&i.question&&i.question.id!==`clone`&&i.question.options.length>0&&(0,$.jsx)(Mr,{q:i.question,disabled:u,onPick:e=>void y(()=>C.pick(i.id,i.question.id,e)).then(()=>document.getElementById(`tosca-agent-box`)?.focus())},`${i.question.id}-${g}`),!i.thinking&&i.prefill&&(0,$.jsxs)(`div`,{className:p(D.info,`fade-quick flex flex-wrap items-center gap-4`),children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm text-ink`,children:i.question?`The wizard can open now; the rest is optional.`:`Everything is ready.`}),(0,$.jsxs)(A,{variant:`primary`,onClick:S,children:[`Open the prefilled wizard`,(0,$.jsx)(ze,{"aria-hidden":`true`})]})]}),(0,$.jsx)(`div`,{ref:m})]}),(0,$.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,$.jsx)(Pr,{v:i})})]}),(0,$.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-auto flex flex-col bg-gradient-to-t from-canvas from-85% to-transparent pt-6 pb-4`,children:[c&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 bg-bg pb-2 text-body-sm text-fail [overflow-wrap:anywhere]`,children:c}),(0,$.jsx)(Xe,{id:`tosca-agent-box`,label:`Tell Guide`,value:o,onChange:e=>{s(e),l(``)},onSend:()=>void b(o),busy:u,disabled:T,placeholder:w?`Migrate checkout.tsu to Playwright in TypeScript, on QA…`:`Answer, or change anything you said…`})]})]})}function jr({text:e,working:t}){return(0,$.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,$.jsx)(N,{state:t?`working`:`idle`,px:28,label:t?`Guide is ${t}`:`Guide`,className:`mt-1 flex-none`}),(0,$.jsx)(`p`,{className:p(`m-0 text-body-lg leading-relaxed whitespace-pre-line [overflow-wrap:anywhere]`,t?`text-muted`:`text-ink-2`),children:e})]})}function Mr({q:e,disabled:t,onPick:n}){let[r,i]=(0,Q.useState)([]);return(0,$.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.multi?(0,$.jsx)(w,{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,$.jsxs)(A,{size:`sm`,variant:e.id===`skip`?`ghost`:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.label,e.hint&&(0,$.jsx)(`span`,{className:`text-body-sm font-normal text-muted`,children:e.hint})]},e.id))}),e.multi&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.options.some(e=>!e.action)&&(0,$.jsxs)(A,{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,$.jsxs)(A,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.id===`git`&&(0,$.jsx)(J,{"aria-hidden":`true`}),e.label]},e.id)),e.typed&&e.options.some(e=>!e.action)&&(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Or type the names below.`})]})]})}function Nr({c:e,disabled:t,onToken:n,onPick:a}){let[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(``),h=[...new Set([...e.credentials,...e.tokenVar?[e.tokenVar]:[]])].sort(),g=async()=>{if(s){u(!0),m(``);try{await x.saveSecrets({[s.name]:s.value}),c(null),await n(s.name)}catch(e){m(e.message)}finally{u(!1)}}},_=t||l;return(0,$.jsxs)(`fieldset`,{className:p(d,`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-4`),children:[(0,$.jsxs)(`legend`,{className:`sr-only`,children:[`Clone `,e.url]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,$.jsxs)(`label`,{htmlFor:`tsa-token`,className:`flex flex-col gap-1 text-body-sm font-medium text-muted`,children:[`Access token`,(0,$.jsxs)(i,{id:`tsa-token`,size:`sm`,value:e.tokenVar??``,disabled:_,onChange:e=>void n(e.target.value),className:`min-w-[220px]`,children:[(0,$.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),h.map(t=>(0,$.jsxs)(`option`,{value:t,children:[t,t===e.tokenVar&&!e.tokenSaved?` (not saved yet)`:``]},t))]})]}),!s&&(0,$.jsx)(A,{size:`sm`,variant:`outline`,disabled:_,onClick:()=>c({name:e.tokenVar&&!e.tokenSaved?e.tokenVar:e.suggested,value:``}),children:`Add a token`}),(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:_,onClick:()=>void n(e.tokenVar??``),children:`Check again`})]}),!s&&(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Or save it in`,` `,(0,$.jsx)(`a`,{href:r(`settings`,`repo-tokens`),target:`_blank`,rel:`noopener`,children:`Settings › Secrets › Repository tokens`}),`, then press Check again.`]}),s&&(0,$.jsxs)(`div`,{className:p(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex flex-wrap items-end gap-2`),children:[(0,$.jsxs)(`label`,{htmlFor:`tsa-token-name`,className:`flex flex-col gap-1 text-body-sm font-medium text-muted`,children:[`Name`,(0,$.jsx)(o,{id:`tsa-token-name`,size:`sm`,value:s.name,spellCheck:!1,maxLength:64,onChange:e=>c({...s,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})]}),(0,$.jsxs)(`label`,{htmlFor:`tsa-token-value`,className:`flex flex-col gap-1 text-body-sm font-medium text-muted`,children:[`Token`,(0,$.jsx)(o,{id:`tsa-token-value`,size:`sm`,type:`password`,autoComplete:`off`,value:s.value,onChange:e=>c({...s,value:e.target.value}),className:`w-[260px] max-w-full`})]}),(0,$.jsx)(A,{busy:l,size:`sm`,disabled:_||!s.name||!s.value,onClick:()=>void g(),children:l?`Saving…`:`Save`}),(0,$.jsx)(A,{size:`sm`,variant:`outline`,disabled:l,onClick:()=>c(null),children:`Cancel`}),(0,$.jsx)(`span`,{className:`w-full text-body-sm 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.`})]}),f&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-body-sm text-fail [overflow-wrap:anywhere]`,children:f}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,$.jsxs)(A,{size:`sm`,variant:`primary`,disabled:_||!(!e.tokenVar||e.tokenSaved),onClick:()=>a(`yes`),children:[(0,$.jsx)(J,{"aria-hidden":`true`}),`Clone it`]}),(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:_,onClick:()=>a(`no`),children:`No`}),(0,$.jsx)(`span`,{className:`text-body-sm 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 Pr({v:e}){let t=(e,t)=>(0,$.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,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:e}),(0,$.jsx)(`div`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:t})]}),n=(0,$.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`}),r=e.have;return(0,$.jsxs)(`aside`,{"aria-label":`What the assistant has so far`,className:p(d,`flex flex-col`),children:[t(r.exports.length>1?`Exports (${r.exports.length})`:`Export`,r.exports.length?(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[r.exports.slice(0,6).map(e=>(0,$.jsx)(`li`,{className:`font-mono text-body-sm`,children:e},e)),r.exports.length>6&&(0,$.jsxs)(`li`,{className:`text-body-sm text-muted`,children:[`and `,r.exports.length-6,` more`]})]}):n),t(`Target`,r.targetId?(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,$.jsx)(Lt,{framework:r.targetId.split(`-`)[0],language:r.targetId.split(`-`).slice(1).join(`-`)}),r.target]}):n),t(`Tests start at`,r.start||(0,$.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`})),r.needs.map(e=>(0,$.jsx)(Q.Fragment,{children:t(e.need===`database`?`Database`:e.need===`mobile`?`Mobile app`:`Desktop app`,e.picked?(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.picked}):(0,$.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`}))},e.need)),t(`Folder`,r.into?(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:r.into}):(0,$.jsx)(`span`,{className:`text-muted`,children:`tosca-<target>`})),t(`Saved secrets`,r.uses.length?(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.uses.map(e=>(0,$.jsxs)(`li`,{className:`font-mono text-body-sm`,children:[e.variable,` uses `,e.secret]},e.variable))}):(0,$.jsx)(`span`,{className:`text-muted`,children:e.checking?`Reading which variables the tests need…`:`None`})),t(`Instructions`,r.instructions?(0,$.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:r.instructions}):(0,$.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}var Fr=e=>e.kind===`upload`||e.kind===`paste`?e.exports.map(e=>Or(e.path)).join(`, `)||`Uploaded files`:e.label.replace(/^.*[\\/]/,``).replace(/\.git$/,``);function Ir({view:e}){let t=e.clones.reduce((e,t)=>e+t.exports.length,0);return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{className:`mr-1 text-muted`,children:`Exports`}),e.exports.slice(0,5).map(e=>(0,$.jsxs)(P,{tone:`neutral`,icon:!1,children:[(0,$.jsx)(R,{size:12,"aria-hidden":`true`}),Or(e.path)]},e.path)),[...e.clones.reduce((e,t)=>{let n=`${t.kind===`git`||!t.kind?`git`:`file`}\u0000${Fr(t)}`;return e.set(n,[...e.get(n)||[],t])},new Map).values()].map(e=>(0,$.jsxs)(P,{tone:`neutral`,icon:!1,children:[e[0].kind&&e[0].kind!==`git`?(0,$.jsx)(R,{size:12,"aria-hidden":`true`}):(0,$.jsx)(J,{size:12,"aria-hidden":`true`}),Fr(e[0]),e.length>1&&(0,$.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.length,` copies)`]})]},e[0].id)),(0,$.jsx)(`a`,{href:r(`migration`,`new`),className:p(E({size:`sm`}),`no-underline`),children:`Another source`}),(0,$.jsx)(`span`,{className:`ml-1 text-muted`,children:e.exports.length+t?`${e.exports.length+t} found`:`none in this project yet`})]})}var Lr=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],Rr=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function zr({s:e}){let t=e.duplicates||0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(ft,{label:`What the exports hold`,children:[(0,$.jsx)(ht,{dot:`neutral`,value:e.test_cases.length,label:`test cases`}),(0,$.jsx)(ht,{dot:`neutral`,value:e.pages.length,label:`modules`}),(0,$.jsx)(ht,{dot:`neutral`,value:e.totals.steps,label:`steps`}),(0,$.jsx)(ht,{dot:`neutral`,value:e.totals.asserts,label:`checks`})]}),(e.suites.length>0||e.totals.unsupported>0||t>0)&&(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:[e.suites.length>0&&(0,$.jsxs)(`li`,{children:[Z(e.suites.length,`execution list`),`, kept as tags on the tests.`]}),e.totals.unsupported>0&&(0,$.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,$.jsxs)(`li`,{children:[Z(t,`test case`),` in more than one export, converted once.`]})]})]})}var Br=e=>`${e.workspace||``}\u0000${e.file}`;function Vr({busy:e,onClone:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``);return(0,$.jsxs)(`form`,{className:p(l,`flex flex-col gap-4`),onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim(),i.trim(),s.trim())},children:[(0,$.jsx)(X,{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,$.jsx)(o,{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,$.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`tsc-git-branch`,label:`Branch`,help:`The default branch when empty.`,children:(0,$.jsx)(o,{id:`tsc-git-branch`,value:i,spellCheck:!1,maxLength:200,placeholder:`main`,onChange:e=>a(e.target.value)})}),(0,$.jsx)(X,{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,$.jsx)(o,{id:`tsc-git-token`,value:s,spellCheck:!1,maxLength:80,placeholder:`GITHUB_TOKEN`,onChange:e=>c(e.target.value)})})]}),(0,$.jsx)(`div`,{children:(0,$.jsx)(A,{busy:e,type:`submit`,disabled:e||!n.trim(),children:e?`Cloning…`:`Clone it`})})]})}function Hr(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 Ur({view:e,onView:t,scope:n,rows:r,part:i,setPart:a,busy:s,read:c,readError:l,picked:u,setPicked:d,found:f,setFound:m,only:h,setOnly:g}){let[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(e.clones.length>0&&e.exports.length===0),[w,T]=(0,Q.useState)(``),[E,O]=(0,Q.useState)(``),k=l||E,j=new Set(u.map(Br)),ee=e=>{m(null),O(``),d(t=>t.some(t=>Br(t)===Br(e))?t.filter(t=>Br(t)!==Br(e)):[...t,e])},M=r.length>0&&r.every(e=>j.has(Br(e.p))),te=async(e,n,r)=>{b(!0),O(``);try{t?.(await S.clone(e,n||void 0,r||void 0))}catch(e){O(e.message)}finally{b(!1)}},N=async e=>{O(``),T(``);try{t?.(await S.removeClone(e)),d(t=>t.filter(t=>t.workspace!==e)),m(null)}catch(e){O(e.message)}},F=e=>{let t=new Set(h);t.has(e)?t.delete(e):t.add(e),g(t)},I=e=>pn(e),L=f?f.test_cases.filter(I):[],R=!n||`project`in n,B=!n,H=k&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:k});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(i===`tsc-exports`||!f)&&!(n&&r.length===1)&&(0,$.jsxs)(gt,{id:`tsc-exports`,level:3,icon:Me,title:(0,$.jsxs)($.Fragment,{children:[`Exports`,n?(0,$.jsxs)(`span`,{className:`font-normal text-muted`,children:[` in this source, `,r.length]}):null]}),children:[r.length>0?(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Dt,{label:`Tosca exports`,size:10,placeholder:`Find an export`,tools:(0,$.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(at,{checked:M,onCheckedChange:e=>{m(null),O(``),d(e?r.map(e=>e.p):[])}}),`Pick all `,r.length]}),head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Export`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Folder`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`From`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Size`})]}),children:r.map(e=>{let t=Br(e.p),n=e.p.file.slice(e.p.file.lastIndexOf(`/`)+1);return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,"data-state":j.has(t)?`selected`:void 0,children:[(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(at,{"aria-label":`Pick ${e.p.file}${e.p.workspace?` of ${e.from}`:``}`,checked:j.has(t),onCheckedChange:()=>ee(e.p)})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Me,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n})]})}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden font-mono text-body-sm text-muted @xl:table-cell`),children:e.p.file.includes(`/`)?e.p.file.slice(0,e.p.file.lastIndexOf(`/`)):`.`}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-ink-2`),children:e.from}),(0,$.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.bytes,children:Rr(e.bytes)})]},t)})})}):(0,$.jsxs)(`p`,{className:p(D.info,`m-0`),children:[`No Tosca export (.tsu) `,n&&`workspace`in n?`in this source.`:`in this project yet.`,` Export the test cases from Tosca Commander and put the files inside the project, for example `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:`tosca/checkout.tsu`}),`, or pick another source above.`]}),u.length>0&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm 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&&!k&&(0,$.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-body-sm`,children:(0,$.jsxs)(`span`,{children:[`Reading `,u.length===1?`the export`:`${u.length} exports`,`…`]})}),H,R&&(0,$.jsx)(X,{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,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(o,{id:`tsc-path`,value:_,spellCheck:!1,maxLength:300,placeholder:`tosca/checkout.tsu or tosca/`,onChange:e=>v(e.target.value),className:`min-w-0 flex-[1_1_300px]`}),(0,$.jsxs)(A,{disabled:s||!_.trim(),onClick:()=>void c([...u.filter(e=>Br(e)!==Br({file:_.trim()})),{file:_.trim()}],u),"data-tip":`Add the export at this path and read it`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`}),`Add`]})]})}),B&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(A,{variant:`ghost`,size:`sm`,"aria-expanded":x,onClick:()=>C(!x),className:`self-start`,children:[(0,$.jsx)(V,{"aria-hidden":`true`,className:p(`transition-transform`,x&&`rotate-180`)}),`From a git repository`,e.clones.length?` (${e.clones.length} cloned)`:``]}),x&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.clones.length>0&&(0,$.jsx)(`ul`,{className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:e.clones.map(e=>(0,$.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,$.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.label,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:[e.branch?`Branch ${e.branch}`:``,e.commit?`commit ${e.commit}`:``,Z(e.exports.length,`export`),`cloned ${new Date(e.createdAt).toLocaleDateString()}`].filter(Boolean).join(`, `)})]}),w===e.id?(0,$.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,$.jsx)(A,{size:`sm`,variant:`destructive`,onClick:()=>void N(e.id),children:`Remove it`}),(0,$.jsx)(A,{size:`sm`,variant:`ghost`,onClick:()=>T(``),children:`Keep it`})]}):(0,$.jsx)(A,{size:`sm`,variant:`danger`,"aria-label":`Remove the copy of ${e.label}`,onClick:()=>T(e.id),children:`Remove`})]},e.id))}),(0,$.jsx)(Vr,{busy:y,onClone:(e,t,n)=>void te(e,t,n)})]})]})]}),s&&!k&&i!==`tsc-exports`&&(0,$.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-body-sm`,children:(0,$.jsx)(`span`,{children:`Reading…`})}),f&&(0,$.jsxs)(gt,{id:`tsc-cases`,level:3,icon:z,title:(0,$.jsxs)($.Fragment,{children:[`Test cases`,(0,$.jsxs)(`span`,{className:`font-normal text-muted`,children:[` `,`in `,u.length===1?(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:u[0].file.replace(/^.*\//,``)}):Z(u.length,`export`)]})]}),actions:i!==`tsc-exports`&&!(n&&r.length===1)?(0,$.jsx)(A,{size:`sm`,variant:`ghost`,onClick:()=>a(`tsc-exports`),children:`Change exports`}):void 0,children:[H&&i!==`tsc-exports`?H:null,(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(zr,{s:f}),f.coverage&&(0,$.jsx)(gr,{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,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Dt,{label:`Test cases to convert`,placeholder:`Find a test case`,tools:(0,$.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(at,{checked:L.length>0&&L.every(e=>h.has(e.id)),onCheckedChange:e=>g(new Set(e?L.map(e=>e.id):[]))}),`Pick all `,L.length,` test cases ForgeQE can convert`]}),head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Folder`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Steps`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Checks`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`})]}),children:f.test_cases.map(e=>{let t=I(e);return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,"data-state":t&&h.has(e.id)?`selected`:void 0,children:[(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(at,{"aria-label":`Pick ${e.name}`,disabled:!t,checked:t&&h.has(e.id),onCheckedChange:()=>F(e.id)})}),(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`span`,{className:p(`font-medium [overflow-wrap:anywhere]`,t?`text-ink`:`text-muted`),children:e.name}),(e.unsupported>0||e.suites.length>0)&&(0,$.jsxs)(`span`,{className:`block text-body-sm 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,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-muted @2xl:table-cell [overflow-wrap:anywhere]`),children:e.folders.join(` / `)||`Top level`}),(0,$.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.steps}),(0,$.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.asserts}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`whitespace-nowrap`),children:(0,$.jsx)(P,{tone:t?`neutral`:`warn`,children:t?sn(e):`${hn[e.route]||e.route}: later`})})]},e.id)})})}),f.env.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Environment variables`}),(0,$.jsxs)(`span`,{className:`text-body-sm 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 Wr({view:e,to:t,setTo:n,fw:r,setFw:i,into:a,setInto:s,attr:c,setAttr:l}){let u=e=>e.split(`-`)[0],d=e=>e.split(`-`).slice(1).join(`-`),f=[...new Map(e.targets.map(e=>[u(e.id),e.framework])).entries()],p=r||(t?u(t):``),m=e.targets.filter(e=>u(e.id)===p);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Framework`}),(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:f.map(([e,t])=>{let r=Bt[e];return(0,$.jsx)(Ot,{on:p===e,onPick:()=>{e!==p&&(i(e),n(``))},logo:r?(0,$.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:t,sub:Nt[e],label:t},e)})})]}),(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Language`}),!p&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Pick a framework first.`}),p&&!t&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Pick its language.`}),(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`pane-swap grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:m.map(e=>{let r=It[d(e.id)];return(0,$.jsx)(Ot,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,$.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,label:e.language},e.id)})},p)]}),(0,$.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,$.jsx)(o,{id:`tsc-into`,value:a,spellCheck:!1,maxLength:300,placeholder:t?`tosca-${t}`:`Named after the target`,onChange:e=>s(e.target.value)})}),(0,$.jsx)(X,{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,$.jsx)(o,{id:`tsc-attr`,value:c,spellCheck:!1,maxLength:40,placeholder:`data-automation-id`,onChange:e=>l(e.target.value.replace(/[^A-Za-z0-9_-]/g,``))})})]})]})}function Gr({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,$.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,$.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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lt,{framework:c.id.split(`-`)[0],language:c.id.split(`-`).slice(1).join(`-`),size:14}),c.title]})),l(`i`,(0,$.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`,on[o.feasibility.verdict].label):void 0}]}function Kr({view:e,onView:t,review:n,onStart:i,from:o,embedded:s}){let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(0),[f,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(new Set),[y,b]=(0,Q.useState)(``),[x,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(``),[j,ee]=(0,Q.useState)(``),[M,te]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(``),V=s?.scope,H=Hr(e,V),[U,W]=(0,Q.useState)(`tsc-exports`),[G,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(``),ae=async(e,t)=>{if(m(e),g(null),ie(``),e.length){ne(!0);try{let t=await S.inspectSources(e);g(t),v(new Set(t.test_cases.filter(pn).map(e=>e.id))),W(`tsc-cases`)}catch(e){t&&m(t),ie(e.message)}finally{ne(!1)}}},K=!o&&H.length===1?H[0].p:null;(0,Q.useEffect)(()=>{K&&ae([K])},[K&&Br(K)]);let oe=[..._].sort().join(`,`);(0,Q.useEffect)(()=>{te(null),P(!1),d(e=>Math.min(e,1))},[f.map(Br).join(`|`),oe,y,T,O,j]);let[se,q]=(0,Q.useState)(`next`),[ce,J]=(0,Q.useState)(!1),le=e=>{q(e<c?`back`:`next`),l(e),J(!0)},de=e=>{le(e),d(t=>Math.max(t,e)),B(``)},[fe,pe]=(0,Q.useState)(o?`filling`:``);(0,Q.useEffect)(()=>{if(!o)return;let e=!0;return(async()=>{R(!0);try{let t=(await C.view(o)).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;m(t.sources),w(t.to.split(`-`)[0]),b(t.to),E(t.into??``),ee(t.instructions??``);let n=await S.inspectSources(t.sources);if(!e)return;let r=n.test_cases.filter(pn).map(e=>e.id);if(g(n),v(new Set(r)),!r.length)throw Error(`These exports hold no web or API test case to convert.`);let i=await S.plan({sources:t.sources,to:t.to,...t.into?{into:t.into}:{},...t.instructions?{instructions:t.instructions}:{}});(t.app||t.baseUrl)&&await S.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 S.answer(i.plan.id,{use:{name:e,secret:n}}).catch(()=>{});if((t.desktopApp||t.mobileApp||t.database)&&await S.answer(i.plan.id,{...t.desktopApp?{desktopApp:t.desktopApp}:{},...t.mobileApp?{mobileApp:t.mobileApp}:{},...t.database?{database:t.database}:{}}).catch(()=>{}),!e)return;te(i),d(2),le(2),pe(`done`)}catch(t){if(!e)return;B(t.message),pe(``)}finally{e&&R(!1)}})(),()=>{e=!1}},[o]);let me=async()=>{R(!0),B(``);try{let e=!h||h.test_cases.filter(pn).every(e=>_.has(e.id)),t=await S.plan({sources:f,to:y,...T.trim()?{into:T.trim()}:{},...e?{}:{only:[..._]},...j.trim()?{instructions:j.trim()}:{},...O?{testAttributes:[O]}:{}});te(t),de(2)}catch(e){let t=e.message;B(t);let n=T.trim().replace(/\\/g,`/`).replace(/(?<!\/)\/+$/,``);n&&t.includes(n)&&le(1)}finally{R(!1)}},he=M?.plan,_e=he?.feasibility.findings.some(e=>e.level===`limit`),ve=he?.feasibility.verdict===`blocked`,ye=[s?`Where are the tests?`:`Which Tosca exports?`,`What should the tests become?`,`Check the plan, then start`],be=Gr({view:e,picked:f,found:h,only:_,to:y,into:T,embedded:!!s,...he?{plan:he}:{}});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[o&&fe&&(0,$.jsxs)(`p`,{role:`status`,className:p(D.info,`fade-quick m-0 flex flex-wrap items-center gap-x-4 gap-y-1`),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:fe===`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,$.jsx)(`a`,{href:r(`migration`,`guide`),className:`text-body-sm`,children:`Back to the assistant`})]}),(0,$.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,$.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,$.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,$.jsx)(jt,{steps:be,at:c,reached:u,onGo:e=>!L&&(e<2||M)&&le(e)})})}),(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-step`,className:p(`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,se===`next`?`pane-next`:`pane-back`),children:[(0,$.jsx)(At,{id:`tsc-step`,at:c,moved:ce,children:ye[c]}),z&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:z}),c===0&&(0,$.jsxs)($.Fragment,{children:[s?.source,(0,$.jsx)(Ur,{view:e,onView:t,...V?{scope:V}:{},rows:H,part:U,setPart:W,busy:G,read:ae,readError:re,picked:f,setPicked:m,found:h,setFound:g,only:_,setOnly:v}),h?(0,$.jsx)(Mt,{busy:L||G,next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>de(1),disabled:!_.size,aside:_.size?void 0:(0,$.jsx)(`span`,{className:`text-muted`,children:`Pick at least one web or API test case.`})}):(0,$.jsx)(Mt,{busy:L||G,next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{"aria-hidden":`true`}),G?`Reading…`:f.length>1?`Read ${f.length} exports`:`Read the export`]}),onNext:()=>void ae(f),disabled:!f.length,aside:f.length?void 0:(0,$.jsx)(`span`,{className:`text-muted`,children:`Tick one or more exports.`})})]}),c===1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Wr,{view:e,to:y,setTo:b,fw:x,setFw:w,into:T,setInto:E,attr:O,setAttr:k}),(0,$.jsx)(wt,{title:j.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!j.trim(),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsx)(X,{id:`tsc-instructions`,label:`Rules`,help:`Style and structure for the new code. Every Tosca step and check is kept either way.`,children:(0,$.jsx)(a,{id:`tsc-instructions`,value:j,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per Tosca module.`,onChange:e=>ee(e.target.value)})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Lr.map(e=>(0,$.jsxs)(A,{size:`sm`,disabled:j.includes(e),onClick:()=>ee(j.trim()?`${j.trim()}\n${e}`:e),children:[(0,$.jsx)(ge,{"aria-hidden":`true`}),e]},e))})]})}),(0,$.jsx)(Mt,{busy:L,onBack:()=>le(0),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(we,{"aria-hidden":`true`}),L?`Checking…`:`Check the plan`]}),onNext:()=>y?void me():B(`Pick the framework and its language first.`),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),c===2&&he&&(0,$.jsxs)($.Fragment,{children:[n(he,N,P,I),(0,$.jsx)(Mt,{busy:L,onBack:()=>le(1),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]}),disabled:ve||!F||_e&&!N,onNext:()=>i(M,!!_e&&N),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:ve?`Change what is not possible first.`:F?_e&&!N?`Accept the limits to start.`:`Runs in the background.`:`Answer what the tests need first.`})})]})]},c)]})]})}function qr({planId:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{let t=!0;return n(null),i(!1),S.estimate(e).then(e=>t&&n(e),()=>t&&i(!0)),()=>{t=!1}},[e]),r?(0,$.jsx)(`span`,{className:`text-muted`,children:`Not known`}):t?t.files.setup+t.files.pages+t.files.tests?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[`About `,Tt(t.tokens.mid),` tokens`,t.cost?`, about ${Et(t.cost.mid,t.cost.currency)}`:``,(0,$.jsxs)(`span`,{className:`text-muted`,children:[` `,`(`,Tt(t.tokens.low),` to `,Tt(t.tokens.high),t.cost?`, ${Et(t.cost.low,t.cost.currency)} to ${Et(t.cost.high,t.cost.currency)}`:``,`)`]})]}),(0,$.jsxs)(`span`,{className:`block text-body-sm 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,$.jsx)(`span`,{className:`text-muted`,children:`Nothing left to write`}):(0,$.jsx)(`span`,{role:`status`,className:`text-muted`,children:`Working it out…`})}function Jr({plan:e,accepted:t,onAccept:n,onReady:i}){let[a,o]=(0,Q.useState)(null),s=(0,Q.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,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[c.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-blockers`,className:p(D.fail,`flex flex-col gap-2`),children:[(0,$.jsxs)(`h3`,{id:`tsc-blockers`,className:`m-0 flex items-center gap-2 text-body-sm font-medium text-fail`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink`,children:c.map(e=>(0,$.jsx)(`li`,{children:e.text},e.code))})]}),l.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-limits`,className:p(D.warn,`flex flex-col gap-4`),children:[(0,$.jsxs)(`h3`,{id:`tsc-limits`,className:`m-0 flex items-center gap-2 text-body-sm font-medium text-warn`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-2 pl-6 text-body-sm text-ink`,children:l.map(e=>(0,$.jsx)(`li`,{children:e.text},e.code))}),n&&!c.length&&(0,$.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-body-sm font-medium`,children:[(0,$.jsx)(at,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,$.jsx)(Sr,{planId:e.id,onReady:i,onCoverage:o}),(0,$.jsx)(gt,{id:`tsc-plan`,level:3,icon:Fe,title:`The plan`,children:(0,$.jsxs)(`dl`,{className:`m-0 grid gap-x-8 text-body-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,$.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,$.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[`Tricentis Tosca`,e.source.project?`, ${e.source.project}`:``,(0,$.jsx)(`span`,{className:`block text-muted`,children:e.sources&&e.sources.length>1?`${e.sources.length} exports`:(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.source.file})}),e.sources&&e.sources.length>1&&(0,$.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.sources.map((t,n)=>(0,$.jsxs)(`li`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[t.label,(0,$.jsx)(`span`,{className:`block font-sans text-muted`,children:(e=>e?Z(e,`test case`):`its test cases are all in another export`)(e.cases.filter(e=>e.source===n).length)})]},n))})]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,$.jsx)(`span`,{className:`block font-mono text-body-sm text-muted`,children:e.target.dir})]}),e.previous&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Since`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[(0,$.jsx)(`a`,{href:r(`migration`,e.previous.id),children:e.previous.id}),(0,$.jsxs)(`span`,{className:`block text-muted`,children:[Z(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,$.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,$.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,$.jsx)(`dt`,{className:`text-muted`,children:`Estimate`}),(0,$.jsx)(`dd`,{className:`m-0`,children:(0,$.jsx)(qr,{planId:e.id})}),(e.suites||[]).length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Suites`}),(0,$.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.suites.map(e=>`${e.name} (${Z(e.cases.length,`test`)})`).join(`, `),(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Tosca's execution lists, as tags on the tests: `,e.suites.map(e=>`@${e.tag}`).join(`, `),`.`]})]})]}),e.env.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Environment variables`}),(0,$.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`Never in the export: you set them before the tests run.`})]})]}),e.instructions&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,$.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]})}),a&&(0,$.jsx)(gr,{coverage:a,names:s,file:`tosca-${e.id}-coverage.csv`}),(0,$.jsx)(wt,{title:`Test cases (${e.cases.length})`,children:(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Dt,{label:`Test cases of the plan`,placeholder:`Find a test case`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Test case`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`In the plan`}),(0,$.jsx)(`th`,{scope:`col`,className:p(nt,`hidden @xl:table-cell`),children:`Steps`}),(0,$.jsx)(`th`,{scope:`col`,className:p(nt,`hidden @xl:table-cell`),children:`Checks`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Kind`})]}),children:e.cases.map(e=>{let t=e.change;return(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsx)(`td`,{className:p(mt,`[overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,$.jsxs)(`td`,{className:p(mt,`text-ink-2`),children:[e.included?`Converted`:e.why?e.why[0].toUpperCase()+e.why.slice(1):`Left out`,t?(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:{same:`Unchanged: its test kept`,changed:`Changed in Tosca`,new:`New in Tosca`}[t]}):null]}),(0,$.jsx)(`td`,{className:p(pt,`hidden @xl:table-cell`),children:e.steps}),(0,$.jsx)(`td`,{className:p(pt,`hidden @xl:table-cell`),children:e.asserts}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap text-muted`),children:hn[e.route]||e.route})]},e.id)})})})}),(0,$.jsx)(wt,{title:`Files, in order (${e.units.length})`,children:(0,$.jsx)(Dt,{label:`Files, in order`,placeholder:`Find a file`,sortable:!1,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`w-24`),children:`Kind`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`File`})]}),children:e.units.map(e=>(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsx)(`td`,{className:p(mt,`text-muted`),children:ln(e)}),(0,$.jsx)(`td`,{className:p(mt,`font-mono text-body-sm [overflow-wrap:anywhere]`),children:e.target})]},e.id))})})]})}function Yr({d:e,onStarted:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),c=e.plan.feasibility.findings.some(e=>e.level===`limit`),l=e.plan.feasibility.verdict===`blocked`,u=!!e.job?.running;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!u&&(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,$.jsx)(Jr,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r,onReady:a}),!l&&!u&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,$.jsxs)(A,{variant:`primary`,disabled:!i||!e.confirmed&&c&&!n,onClick:()=>s(!0),"data-tip":`Start the conversion`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]}),!i&&(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Answer what the tests need first.`})]}),o&&(0,$.jsx)(Cn,{plan:e.plan,acceptLimits:c&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}var Xr=`tsc-\\d{8}-\\d{6}-[0-9a-f]{4}`;function Zr(e){return!!(e&&(e===`guide`||/^new\/[a-f0-9]{16}$/.test(e)||RegExp(`^${Xr}(?:/(?:steps|errors|activity)|/report(?:/[^/]+|/tab/(?:cases|coverage|trace))?)?$`).test(e)))}function Qr({sub:e}){let[t,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(Tr),d=(0,Q.useCallback)(()=>{S.list().then(e=>{i(e),o(``)},e=>o(e.message))},[]);(0,Q.useEffect)(d,[d,e]);let f=e.match(RegExp(`^(${Xr})/report(?:/tab/(cases|coverage|trace)|/([^/]+))?$`)),p=e.match(RegExp(`^(${Xr})/(steps|errors|activity)$`)),m=RegExp(`^${Xr}$`).test(e)?e:f?.[1]||p?.[1]||``,h=f?.[2],g;try{g=f?.[3]?n(f[3]):void 0}catch{}let _=!t&&!a&&(0,$.jsx)(M,{shape:`detail`}),v=e.match(/^new\/([a-f0-9]{16})$/)?.[1];return v?(0,$.jsxs)(bn,{tab:`migrations`,back:{href:r(`migration`,`guide`),label:`Guide`},children:[(0,$.jsx)(rn,{error:a}),_,t&&(0,$.jsx)(Kr,{view:t,onView:i,from:v,review:(e,t,n,r)=>(0,$.jsx)(Jr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>c({d:e,accept:t})},v),s&&(0,$.jsx)(Cn,{plan:s.d.plan,acceptLimits:s.accept,onClose:()=>c(null),onStarted:e=>{c(null),location.hash=r(`migration`,e.plan.id)}})]}):m&&f?(0,$.jsx)(bn,{tab:`migrations`,wide:!0,back:{href:r(`migration`,m),label:`Conversion`},children:(0,$.jsx)(fr,{id:m,caseId:g,tab:h??(g?`cases`:`summary`)},m)}):m?(0,$.jsxs)(bn,{tab:`migrations`,wide:!0,back:yn,children:[(0,$.jsx)(rn,{error:a}),_,t&&(0,$.jsx)($n,{id:m,...p?{tab:p[2]}:{},plan:(e,t)=>(0,$.jsx)(Yr,{d:e,onStarted:t})},m)]}):(0,$.jsxs)(bn,{tab:`migrations`,back:{href:r(`migration`,`new`),label:`New migration`},children:[(0,$.jsx)(rn,{error:a}),_,t&&(0,$.jsx)(Ar,{view:t,sid:l,onSid:u})]})}var $r=[`prepare`,`setup`,`migrate`,`validate`,`fix`,`review`];function ei(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?Vt[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ht[e.plan.feasibility.verdict]}var ti=e=>e.slice(e.lastIndexOf(`/`)+1);function ni({id:e,title:t,targetDir:n,onClose:i}){let[a,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),f=async()=>{l(!0),d(``);try{await b.delete(e,a),location.hash=r(`migration`,`migrations`)}catch(e){d(e.message),l(!1)}};return(0,$.jsx)(et,{open:!0,onClose:i,title:`Delete this migration`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`ghost`,onClick:i,"data-tip":`Keep it`,children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),`Keep`]}),(0,$.jsxs)(A,{variant:`danger`,disabled:c||a!==e,onClick:()=>void f(),children:[(0,$.jsx)(B,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,$.jsx)(o,{value:a,onChange:e=>s(e.target.value),autoComplete:`off`,spellCheck:!1})]}),u?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:u}):null]})})}function ri({d:e,planView:t}){let n=e.result;if(!n)return(0,$.jsx)($.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,u=n.status!==`running`||n.units.some(e=>e.kind===`test`&&(e.status===`migrated`||e.status===`failed`)),d=e.plan.source.stack,[f,...m]=e.plan.target.id.split(`-`);return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6`,children:[(0,$.jsxs)(ft,{label:`The migration in numbers`,children:[(0,$.jsx)(ht,{dot:u?`pass`:`neutral`,value:u?`${a} of ${i.length}`:`—`,label:u?`tests passing`:`tests checked once migrated`}),(0,$.jsx)(ht,{dot:`neutral`,value:`${s} of ${o.length}`,label:`files migrated`}),(0,$.jsx)(ht,{dot:c?`fail`:`neutral`,value:c,label:`need attention`}),(0,$.jsx)(ht,{dot:n.status===`running`?`running`:`neutral`,value:Jt(n.status===`running`?Date.now()-Date.parse(n.startedAt):n.ms),label:n.status===`running`?`running`:`taken`})]}),n.notes&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:n.notes}),(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col`,children:(0,$.jsx)(Dt,{className:`min-h-[240px] flex-1 overflow-y-auto`,label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`File`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @3xl:table-cell`),children:`Note`})]}),children:e.plan.units.map(e=>{let t=r.get(e.id),n=t?$t[t.status]:null;return(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsxs)(`td`,{className:mt,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.kind===`setup`?`Project set-up`:ti(e.target)}),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:e.source?`from ${ti(e.source)}`:e.target}),(t?.status===`failed`||t?.status===`blocked`)&&(t.problems?.[0]||t.reason)&&(0,$.jsx)(`span`,{className:`mt-1 line-clamp-2 text-body-sm text-ink-2 @3xl:hidden`,children:t.problems?.[0]||t.reason})]}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap`),children:n?(0,$.jsx)(P,{tone:n.tone,children:n.label}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Waiting`})}),(0,$.jsx)(`td`,{className:p(mt,`hidden text-body-sm text-ink-2 @3xl:table-cell`),children:(0,$.jsx)(`span`,{className:`line-clamp-2`,children:t?.problems?.[0]||t?.reason||``})})]},e.id)})})}),(0,$.jsxs)(`aside`,{"aria-label":`Details`,className:p(l,`flex min-h-0 flex-col gap-4 overflow-y-auto text-body-sm`),children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`From`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[d&&(0,$.jsx)(Lt,{framework:d.framework,language:d.language}),e.plan.source.title]}),(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-ink-2`,children:[(0,$.jsx)(Pt,{kind:e.origin.kind,label:e.origin.label,size:16}),(0,$.jsxs)(`span`,{className:`truncate`,"data-tip":e.origin.label,children:[Kt(e.origin.label),e.origin.branch?`, branch ${e.origin.branch}`:``]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`To`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,$.jsx)(Lt,{framework:f,language:m.join(`-`)}),e.plan.target.title]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 pt-4`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,$.jsx)(`dd`,{className:`m-0 text-right`,children:Gt(n.startedAt)}),n.model&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,$.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":n.model,children:n.model})]}),n.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-right`,children:[n.reverted.length,` edits outside the target`]})]})]})]})]})]})}var ii=`@5xl:h-[calc(var(--screen)-360px)] @5xl:min-h-[540px]`;function ai({label:e,children:t}){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`text-body-sm text-muted`,children:e}),(0,$.jsx)(`dd`,{className:`m-0 text-body-sm font-medium`,children:t})]})}function oi({d:e,busy:t}){let n=e.result?.validation?.tests||[],r=e.result?.fixes||[],i=n.filter(e=>!e.ok),[a,o]=(0,Q.useState)(()=>i[0]?.id||n[0]?.id||``),s=n.find(e=>e.id===a)||n[0],c=s?r.filter(e=>e.id===s.id):[];if(!n.length)return(0,$.jsx)(`div`,{className:p(l,`flex min-h-[240px] flex-1 items-center justify-center`),children:(0,$.jsx)(_t,{center:!0,icon:me,title:e.result?`No tests run yet`:`Not started`,children:e.result?`ForgeQE runs every migrated test once each file is migrated. Their results show here.`:`Start the migration first.`})});let u=Ut(e.plan.id,i),d=s&&!s.ok?Ut(e.plan.id,[s]):``;return(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]`,children:[(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col`,children:(0,$.jsx)(Dt,{className:`min-h-[320px] flex-1 overflow-y-auto`,label:`Migrated tests`,placeholder:`Find a test`,end:i.length>1&&u?(0,$.jsxs)(A,{size:`sm`,disabled:t,onClick:()=>xt(u),"data-tip":`Ask Atlas, at the corner, to fix every failing test`,children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix all `,i.length]}):void 0,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Test`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,className:p(nt,`hidden @3xl:table-cell`),children:`Time`})]}),children:n.map(e=>{let t=r.findLast(t=>t.id===e.id);return(0,$.jsxs)(`tr`,{onClick:()=>o(e.id),"aria-selected":s?.id===e.id,className:p(St,s?.id===e.id&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,$.jsxs)(`td`,{className:mt,children:[(0,$.jsx)(A,{variant:`link`,size:`inline`,onClick:()=>o(e.id),className:`text-left text-body-sm [overflow-wrap:anywhere]`,children:ti(e.target)}),t&&(0,$.jsx)(`span`,{className:p(`block text-body-sm`,tn(t,e)?`text-pass`:`text-muted`),children:tn(t,e)?`Fixed by the agent`:`The agent could not fix it`})]}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap`),children:(0,$.jsx)(P,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})}),(0,$.jsx)(`td`,{className:p(pt,`hidden text-body-sm text-muted @3xl:table-cell`),"data-sort":e.ms||-1,children:e.ms?Jt(e.ms):`Not timed`})]},e.id)})})}),s&&(0,$.jsxs)(`section`,{"aria-label":`${ti(s.target)} details`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex min-h-[320px] min-w-0 flex-col overflow-hidden p-0`),children:[(0,$.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-4 py-4`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:ti(s.target)}),(0,$.jsx)(P,{tone:s.ok?`pass`:`fail`,children:s.ok?`Passes`:s.exitCode===null&&s.ms?`Timed out`:`Fails`})]}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,"data-tip":s.target,children:s.source?`from ${s.source}`:s.target})]}),(0,$.jsxs)(`a`,{href:qt(e.plan.id,s.id),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`The source beside the migrated test, in a tab of their own`,className:E({size:`sm`,variant:`ghost`}),children:[(0,$.jsx)(xe,{"aria-hidden":`true`}),`Compare`]}),d&&(0,$.jsxs)(A,{size:`sm`,variant:`primary`,disabled:t,onClick:()=>xt(d),"data-tip":`Ask Atlas, at the corner, to fix this test`,children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix`]})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-auto px-4 py-4`,children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-2 gap-4 @3xl:grid-cols-4`,children:[(0,$.jsx)(ai,{label:`Tests kept`,children:(0,$.jsxs)(`span`,{className:s.after.tests<s.before.tests?`text-fail`:void 0,children:[s.after.tests,` of `,s.before.tests]})}),(0,$.jsx)(ai,{label:`Checks kept`,children:(0,$.jsxs)(`span`,{className:s.after.assertions<s.before.assertions?`text-warn`:void 0,children:[s.after.assertions,` of `,s.before.assertions]})}),(0,$.jsx)(ai,{label:`Checks proved`,children:s.checksProved===void 0?`Not tried`:s.checksProved?`Yes`:(0,$.jsx)(`span`,{className:`text-fail`,children:`No`})}),(0,$.jsx)(ai,{label:`Time`,children:s.ms?Jt(s.ms):`Not timed`})]}),s.problems.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-body-sm font-medium`,children:`What ForgeQE found`}),(0,$.jsx)(`ul`,{className:p(D.fail,`m-0 flex flex-col gap-1 pl-6`),children:s.problems.map((e,t)=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))})]}),c.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-body-sm font-medium`,children:`The fixing agent`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.map((e,t)=>{let n=tn(e,t===c.length-1?s:void 0);return(0,$.jsxs)(`li`,{className:`flex items-start gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`flex-none font-medium`,n?`text-pass`:`text-fail`),children:n?`✓`:`✗`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[n?`Fixed`:e.ok?`Passed its own run, not the check after it`:`Could not fix it`,e.attempts>1?` (${e.attempts} tries)`:``,e.note?`. Asked: ${e.note}`:``,e.reason?`. It said: ${e.reason}`:``]}),(0,$.jsx)(`span`,{className:`flex-none text-muted`,children:tt(e.at)})]},t)})})]}),(0,$.jsxs)(`div`,{className:`flex min-h-[160px] flex-1 flex-col gap-2`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-body-sm font-medium`,children:`Run output`}),(0,$.jsxs)(`div`,{className:p(`rounded-base bg-surface-muted p-4`,`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`),children:[s.command&&(0,$.jsxs)(`code`,{className:`block font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`$ `,s.command]}),(0,$.jsx)(`pre`,{className:`m-0 font-mono text-body-sm whitespace-pre-wrap text-ink-2`,children:s.output||(s.ok?`${s.after.tests} test${s.after.tests===1?``:`s`} passed in ${Jt(s.ms)}.`:s.exitCode===0?`The run itself passed in ${Jt(s.ms)}; the check above is what failed.`:`No output.`)})]})]})]})]})]})})}var si={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 ci({events:e,running:t}){let n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,t]);let r=e.filter(e=>e.kind!==`tool`);return(0,$.jsxs)(`ol`,{ref:n,"aria-live":t?`polite`:void 0,"aria-label":`Activity`,className:p(l,`m-0 flex max-h-[60vh] min-h-0 list-none flex-col overflow-y-auto p-0 @5xl:max-h-none @5xl:flex-1`),children:[r.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 text-body-sm last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`min-w-[64px] flex-none text-body-sm whitespace-nowrap text-muted tabular-nums`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`w-3 flex-none text-center`,si[e.kind].cls),children:si[e.kind].mark}),(0,$.jsx)(`span`,{className:p(`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,$.jsx)(`li`,{className:`px-4 py-8 text-center text-body-sm text-muted`,children:`Nothing yet.`})]})}function li({id:e,tab:t=`overview`,plan:n}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),c=t=>location.hash=t===`overview`?r(`migration`,e):r(`migration`,e,t),[l,u]=(0,Q.useState)([]),[d,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(0),_=(0,Q.useCallback)(()=>{b.detail(e).then(e=>{a(e),s(``)},e=>s(e.message));let t=g.current;b.events(e,t).then(e=>{if(e.next<g.current){g.current=0,u([]);return}let t=g.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));g.current=e.next,n.length&&u(e=>[...e,...n].slice(-2e3))},()=>{})},[e]);(0,Q.useEffect)(_,[_]);let v=!!(i?.job?.running||i?.result?.status===`running`);(0,Q.useEffect)(()=>{if(!v)return;let e=vt(_,1500);return()=>lt(e)},[v,_]);let y=async e=>{f(!0),s(``);try{a(await e()),setTimeout(_,800)}catch(e){s(e.message)}finally{f(!1)}};if(!i)return o?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}):(0,$.jsx)(M,{shape:`detail`});let x=ei(i),S=Zt(i.plan,i.result),C=i.result,w=(C?.validation?.tests||[]).filter(e=>!e.ok).length,T=[{id:`overview`,label:`Overview`},{id:`tests`,label:`Tests`,n:C?.validation?`${C.validation.tests.length-w}/${C.validation.tests.length}`:void 0,tone:w?`text-fail`:void 0},{id:`activity`,label:`Activity`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`mt-6 flex flex-col gap-4 border-b border-line-soft pb-6 @3xl:flex-row @3xl:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-2 text-headline-sm`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[i.plan.source.stack&&(0,$.jsx)(Lt,{framework:i.plan.source.stack.framework,language:i.plan.source.stack.language,size:20}),i.plan.source.title]}),(0,$.jsx)(ze,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(Lt,{framework:i.plan.target.id.split(`-`)[0],language:i.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),i.plan.target.title]})]}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,$.jsx)(Pt,{kind:i.origin.kind,label:i.origin.label,size:15}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:Kt(i.origin.label)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsxs)(`span`,{children:[`into `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:i.plan.target.dir})]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(P,{tone:x.tone,children:x.label}),v?(0,$.jsx)(A,{variant:`danger`,size:`icon`,disabled:d,onClick:()=>void y(()=>b.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the migration`,children:(0,$.jsx)(He,{fill:`currentColor`,"aria-hidden":`true`})}):(0,$.jsxs)($.Fragment,{children:[C?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`a`,{href:qt(e),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Compare`,"data-tip":`Compare: the source beside what it became, in a tab of their own`,className:E({variant:`icon`,size:`icon`}),children:(0,$.jsx)(xe,{"aria-hidden":`true`})}),(0,$.jsx)(`a`,{href:r(`migration`,e,`report`),"aria-label":`Report`,"data-tip":`Report`,className:E({variant:`icon`,size:`icon`}),children:(0,$.jsx)(Ae,{"aria-hidden":`true`})}),(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:d,onClick:()=>void y(()=>b.verify(e)),"aria-label":`Run the tests again`,"data-tip":`Run every migrated test again, with no agent`,children:(0,$.jsx)(ue,{"aria-hidden":`true`})})]}):null,(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:d,onClick:()=>h(!0),"aria-label":`Delete`,"data-tip":`Delete: remove this plan from the list; converted tests stay`,children:(0,$.jsx)(B,{"aria-hidden":`true`})})]})]})]}),m&&(0,$.jsx)(ni,{id:e,title:`${i.plan.source.title} → ${i.plan.target.title}`,targetDir:i.plan.target.dir,onClose:()=>h(!1)}),(0,$.jsxs)(`div`,{className:p(`grid grid-cols-[minmax(0,1fr)] gap-6`,C&&`@3xl:grid-cols-[208px_minmax(0,1fr)] @3xl:gap-8`),children:[C&&(0,$.jsx)(`div`,{className:`@3xl:flex @3xl:flex-col @3xl:border-r @3xl:border-line-soft @3xl:pr-6`,children:(0,$.jsx)(Xt,{label:`Migration stages`,items:Wt($r,C.stages,w),...v?{progress:S}:{}})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[o&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}),(0,$.jsx)(Ze,{prefix:`mtab`,className:`mb-0`,tabs:T,current:t,onPick:c,label:`Migration`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${t}`,"aria-labelledby":`mtab-${t}`,className:p(`flex min-w-0 flex-col gap-4`,C&&ii),children:[t===`overview`&&(0,$.jsx)(ri,{d:i,planView:n(i)}),t===`tests`&&(0,$.jsx)(oi,{d:i,busy:d||v}),t===`activity`&&(0,$.jsx)(ci,{events:l,running:v})]})]})]})]})}function ui(e){let t=e?.match(/^(mig-\d{8}-\d{6}-[0-9a-f]{4})\/report(?:\/tab\/(files|checks))?$/);return t?{id:t[1],...t[2]?{tab:t[2]}:{}}:null}var di=[{id:`migrated`,label:`Migrated`,bar:`bg-pass`},{id:`written`,label:`Written, not checked yet`,bar:`bg-accent`},{id:`failed`,label:`Failed`,bar:`bg-fail`},{id:`blocked`,label:`Blocked`,bar:`bg-warn`},{id:`waiting`,label:`Waiting`,bar:`bg-line-strong`}],fi={prepare:`preparing`,setup:`setting up the new project`,migrate:`rewriting each file`,validate:`running every migrated test`,fix:`fixing the tests that failed`,review:`comparing the result with the source`},pi=e=>e.slice(e.lastIndexOf(`/`)+1),mi=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function hi({id:e,tab:t=`summary`}){let[n,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),m=(...t)=>r(`migration`,e,`report`,...t),g=e=>location.hash=e===`summary`?m():m(`tab`,e);(0,Q.useEffect)(()=>{b.detail(e).then(e=>(i(e),o(e.result?``:`No report yet. Start the migration first.`)),e=>o(e.message))},[e]);let v=async t=>{u(!0),f(``);try{let n=t===`html`?await b.reportHtml(e):new Blob([(await b.report(e)).text],{type:`text/markdown`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`migration-${e}.${t}`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){f(e.message)}finally{u(!1)}};if(!n&&!a)return(0,$.jsx)(M,{shape:`detail`,label:`Loading report…`});if(a||!n?.result)return(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:a||`No report.`});let y=n.result,x=n.plan,S=Vt[y.status]||{label:y.status,tone:`neutral`},[C,...w]=x.target.id.split(`-`),T=y.units.filter(e=>e.kind!==`setup`),O=T.filter(e=>e.status===`migrated`).length,k=y.validation?.tests||[],j=k.filter(e=>e.ok).length,ee=k.reduce((e,t)=>e+t.before.assertions,0),te=k.reduce((e,t)=>e+Math.min(t.after.assertions,t.before.assertions),0),N=k.filter(e=>!e.ok),F=T.filter(e=>(e.status===`failed`||e.status===`blocked`)&&!k.some(t=>t.id===e.id)),I=x.units.filter(e=>e.kind!==`setup`).length,L=y.status===`running`?{tone:`running`,text:`Migrating: ${T.length} of ${I} files written so far.`}:k.length&&!N.length&&!F.length?{tone:`pass`,text:`All ${k.length===1?``:`${k.length} `}migrated test${k.length===1?``:`s`} pass in ${x.target.title}.`}:k.length?{tone:`fail`,text:`${j} of ${k.length} migrated tests pass; ${N.length} ${N.length===1?`fails`:`fail`}${F.length?`, ${mi(F.length,`file`)} not migrated`:``}.`}:{tone:`warn`,text:`${O} of ${T.length} files migrated; the tests were not checked.`},R=k.filter(e=>e.checksProved!==void 0),z=R.filter(e=>e.checksProved).length,B={migrated:0,written:0,failed:0,blocked:0,waiting:0};for(let e of x.units.filter(e=>e.kind!==`setup`)){let t=T.find(t=>t.id===e.id);B[t?t.status===`skipped`?`blocked`:t.status:`waiting`]++}let U=y.status===`running`&&y.stage?fi[y.stage]:``,W=[...N.map(e=>({id:e.id,file:e.target,why:e.problems[0]||`The test fails.`,words:Ut(x.id,[e])})),...F.map(e=>({id:e.id,file:e.target,why:e.reason||e.problems?.[0]||$t[e.status].label,words:``}))],G=L.tone===`pass`?q:L.tone===`running`?De:H,ne=[{id:`summary`,label:`Summary`},{id:`files`,label:`Files`,n:T.length},{id:`checks`,label:`Checks`,n:k.length||void 0}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,$.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:`Migration report`}),(0,$.jsx)(P,{tone:S.tone,children:S.label})]}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 text-body-sm text-ink-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[x.source.stack&&(0,$.jsx)(Lt,{framework:x.source.stack.framework,language:x.source.stack.language,size:14}),x.source.title]}),(0,$.jsx)(ze,{size:14,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Lt,{framework:C,language:w.join(`-`),size:14}),x.target.title]})]})]}),(0,$.jsxs)(`a`,{href:qt(e),target:`_blank`,rel:`noopener noreferrer`,className:E({variant:`ghost`}),children:[(0,$.jsx)(xe,{"aria-hidden":`true`}),`Compare`]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsxs)(A,{busy:l,variant:`ghost`,disabled:l,"aria-haspopup":`menu`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),l?`Making the report…`:`Export`,(0,$.jsx)(V,{"aria-hidden":`true`})]}),(0,$.jsxs)(_,{open:s,onClose:()=>c(!1),label:`Export this report`,align:`end`,className:`w-[280px]`,children:[(0,$.jsxs)(h,{onClick:()=>(c(!1),n.result?.status===`running`?f(`The HTML report is made when the run ends.`):void v(`html`)),children:[(0,$.jsx)(Le,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`HTML report`]}),(0,$.jsxs)(h,{onClick:()=>(c(!1),void v(`md`)),children:[(0,$.jsx)(We,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Markdown report (migrate.md)`]})]})]})]}),d&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:d}),(0,$.jsx)(Ze,{prefix:`rtab`,className:`mb-0`,tabs:ne,current:t,onPick:g,label:`Report`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${t}`,"aria-labelledby":`rtab-${t}`,className:`pane-swap flex min-w-0 flex-col gap-8`,children:[t===`summary`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{"aria-label":`Outcome`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-2`,children:[(0,$.jsxs)(`p`,{className:p(`m-0 flex min-w-0 flex-1 items-start gap-2 text-body-md font-medium`,L.tone===`fail`?`text-fail`:`text-ink`),children:[(0,$.jsx)(G,{size:20,"aria-hidden":`true`,className:p(`flex-none`,L.tone===`pass`?`text-pass`:L.tone===`fail`?`text-fail`:L.tone===`warn`?`text-warn`:`text-accent-fg motion-safe:animate-spin`)}),L.text]}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:[y.status===`running`?`Started ${Gt(y.startedAt)}`:y.validation?`Checked ${Gt(y.validation.at)}`:`Started ${Gt(y.startedAt)}`,Jt(y.ms),y.model].filter(Boolean).join(` · `)})]}),y.status===`running`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(en,{value:Zt(x,y),label:`Migration progress: ${Math.round(Zt(x,y))}%`}),(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[U?`Now: ${U}`:`Starting`,` · `,Math.round(Zt(x,y)),`%`]})]}),T.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`div`,{role:`img`,"aria-label":di.map(e=>`${B[e.id]} ${e.label.toLowerCase()}`).join(`, `),className:`flex h-2 w-full overflow-hidden rounded-full bg-surface-strong`,children:di.map(e=>B[e.id]?(0,$.jsx)(`span`,{className:e.bar,style:{width:`${B[e.id]/Math.max(1,I)*100}%`}},e.id):null)}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-x-6 gap-y-1 p-0 text-body-sm text-ink-2`,children:di.filter(e=>B[e.id]).map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`size-2 rounded-full`,e.bar)}),B[e.id],` `,e.label.toLowerCase()]},e.id))})]})]}),(0,$.jsxs)($e,{label:`The run in numbers`,children:[(0,$.jsx)(dt,{label:`Tests passing`,value:k.length?`${j} of ${k.length}`:`—`,tone:k.length&&j===k.length?`text-pass`:N.length?`text-fail`:void 0,note:k.length?`Run by ForgeQE after the migration`:`Checked once every file is migrated`}),(0,$.jsx)(dt,{label:`Checks kept`,value:ee?`${Math.round(te/ee*100)}%`:`—`,note:ee?`${te} of ${ee} checks of the source`:`Counted when the tests run`}),(0,$.jsx)(dt,{label:`Checks proved`,value:R.length?`${z} of ${R.length}`:`—`,tone:R.length&&z<R.length?`text-fail`:void 0,note:R.length?`Fail when the source's values are made wrong`:`Proved when the tests run`}),(0,$.jsx)(dt,{label:`Files migrated`,value:`${O} of ${I}`,note:x.copies.length?`and ${mi(x.copies.length,`data file`)} copied`:`No data files to copy`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`section`,{"aria-labelledby":`mrep-attention`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2 p-0`),children:[(0,$.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-line-soft px-4 py-4`,children:[(0,$.jsx)(`h3`,{id:`mrep-attention`,className:`m-0 flex-1 text-body-md font-medium`,children:`Needs your attention`}),W.length>0&&(0,$.jsx)(P,{tone:`fail`,children:W.length})]}),W.length===0?(0,$.jsx)(`p`,{className:`m-0 flex items-center gap-2 px-4 pb-4 text-body-sm text-ink-2`,children:y.status===`running`?`Nothing yet: each test is checked once every file is migrated.`:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{size:16,"aria-hidden":`true`,className:`text-pass`}),`Nothing needs attention: every migrated test passes, with its checks kept.`]})}):(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:W.map(t=>(0,$.jsxs)(`li`,{className:`flex items-start gap-4 border-b border-line-soft px-4 py-4 last:border-b-0`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-fail`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:pi(t.file)}),(0,$.jsx)(`span`,{className:`line-clamp-2 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,"data-tip":t.why,children:t.why})]}),(0,$.jsxs)(`a`,{href:qt(e,t.id),target:`_blank`,rel:`noopener noreferrer`,className:E({size:`sm`,variant:`ghost`}),children:[(0,$.jsx)(xe,{"aria-hidden":`true`}),`Compare`]}),t.words&&(0,$.jsxs)(A,{size:`sm`,disabled:y.status===`running`,onClick:()=>xt(t.words),"data-tip":`Ask Atlas, at the corner, to fix this test`,children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix`]})]},t.id))})]}),(0,$.jsxs)(`aside`,{"aria-labelledby":`mrep-details`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,$.jsx)(`h3`,{id:`mrep-details`,className:`m-0 text-body-md font-medium`,children:`Details`}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 text-body-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,$.jsxs)(`dd`,{className:`m-0 font-mono text-ink [overflow-wrap:anywhere]`,children:[x.source.dir,`/`]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Into`}),(0,$.jsxs)(`dd`,{className:`m-0 font-mono text-ink [overflow-wrap:anywhere]`,children:[x.target.dir,`/`]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Written`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:T.length?`${mi(T.filter(e=>e.kind===`test`||e.kind===`feature`).length,`test`)}, ${mi(T.filter(e=>e.kind===`support`).length,`support file`)}`:`Nothing yet`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Command`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-ink [overflow-wrap:anywhere]`,children:x.sampleCommand||`Not recorded`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Not migrated`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:x.notMigrated.length?mi(x.notMigrated.length,`file`):`None`}),y.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-ink`,children:[mi(y.reverted.length,`edit`),` outside the target folder`]})]})]}),y.notes.trim()&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 pt-2`,children:[(0,$.jsx)(`h4`,{className:`m-0 text-body-sm font-medium`,children:`Notes from the migration`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:y.notes.trim()})]})]})]})]}),t===`files`&&(0,$.jsxs)(`section`,{"aria-labelledby":`mrep-files`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`mrep-files`,className:`m-0 text-body-lg font-medium`,children:`Each source file and what it became`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Compare opens the source beside the migrated file, in a tab of their own.`})]}),(0,$.jsx)(Dt,{label:`Files`,placeholder:`Find a file`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`File`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Outcome`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @3xl:table-cell`),children:`Why`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Compare`})})]}),children:T.map(t=>(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`span`,{className:`block text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:pi(t.target)}),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted [overflow-wrap:anywhere]`,children:t.source?`from ${t.source}`:`made new`})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-body-sm text-ink-2`),children:Qt[t.kind]}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(P,{tone:$t[t.status].tone,children:$t[t.status].label})}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-body-sm text-ink-2 @3xl:table-cell [overflow-wrap:anywhere]`),children:t.reason||t.problems?.[0]||`—`}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-right`),children:(0,$.jsx)(`a`,{href:qt(e,t.id),target:`_blank`,rel:`noopener noreferrer`,className:`text-body-sm`,children:`Compare`})})]},t.id))})]}),t===`checks`&&(0,$.jsxs)(`section`,{"aria-labelledby":`mrep-checks`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`mrep-checks`,className:`m-0 text-body-lg font-medium`,children:`How much of each source test's checks its migrated test kept`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Every check of the source should be in the migrated test, and fail when its value is made wrong. A short bar means checks are missing.`})]}),k.length?(0,$.jsx)(Dt,{label:`Checks by test`,placeholder:`Find a test`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Checks kept`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Checks proved`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Result`})]}),children:k.map(e=>{let t=e.before.assertions?Math.min(e.after.assertions,e.before.assertions)/e.before.assertions*100:100;return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`),children:pi(e.target)}),(0,$.jsx)(`td`,{className:`px-4 py-2`,"data-sort":t,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:(0,$.jsx)(en,{value:t,marks:[.8,1],tone:t===100?`bg-pass`:t>=80?`bg-warn`:`bg-fail`,label:`${pi(e.target)}: ${e.after.assertions} of ${e.before.assertions} checks`})}),(0,$.jsxs)(`span`,{className:`w-16 flex-none text-right text-body-sm tabular-nums text-ink-2`,children:[e.after.assertions,`/`,e.before.assertions]})]})}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-body-sm`),children:e.checksProved===void 0?(0,$.jsx)(`span`,{className:`text-muted`,children:`Not tried`}):e.checksProved?`Yes`:(0,$.jsx)(`span`,{className:`text-fail`,children:`No`})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(P,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})})]},e.id)})}):(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The tests are checked once every file is migrated.`})]})]},t)]})}var gi=e=>/^[A-Za-z0-9_.-]+(\/[A-Za-z0-9_.-]+)*$/.test(e)&&!e.split(`/`).some(e=>e===`..`||e===`.`);function _i(e){let t=[...new Set(e.map(e=>e.replace(/(?<!\/)\/+$/,``)).filter(gi))].sort();return t.filter(e=>!t.some(t=>t!==e&&e.startsWith(`${t}/`)))}function vi(e,t=``){let n=_i(e),r=t.trim().replace(/^\/+/,``);return n.length===0?{from:`.`,...r?{only:r}:{}}:{from:`.`,only:`${n.length===1?n[0]:`{${n.join(`,`)}}`}/${r||`**`}`}}var yi=[{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`}],bi=[`Keep one page object per page, in pages/.`,`Read the base URL from BASE_URL.`,`Keep test names as they are.`];async function xi(e,t,n){let r=[],i=0,a=null,o=0,s=async()=>{r.length&&(a=await b.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 Si=e=>(e.webkitRelativePath||e.name).split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`);function Ci({view:e,kind:t,setKind:n,src:s,setSrc:c,from:l,setFrom:u,folders:d,setFolders:f,stack:m,setStack:h,custom:_,setCustom:v,found:y,setFound:S,tosca:C,onNext:w}){let[T,E]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(``),[j,ee]=(0,Q.useState)(null),[M,te]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(e.credentials),[F,I]=(0,Q.useState)(null),[L,z]=(0,Q.useState)(``),[V,H]=(0,Q.useState)([{path:``,text:``}]),[U,ne]=(0,Q.useState)(``),[re,ie]=(0,Q.useState)(``),[ae,K]=(0,Q.useState)(``),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{oe.current?.setAttribute(`webkitdirectory`,``)},[t,s]);let q=s?.workspace,ce=async(e,t)=>{ne(e),ie(``),K(``);try{await t()}catch(e){ie(e.message)}finally{ne(``)}},J=e=>{c(e),u(`.`),S(e.discovery),w&&!e.tosca?.length&&e.discovery?.stack&&w()};(0,Q.useEffect)(()=>{if(t!==`project`)return;let e=setTimeout(()=>b.discover(void 0,l||`.`).then(S,()=>S(null)),300);return()=>clearTimeout(e)},[t,l,S]);let le=e=>{let t=e.filter(e=>!Si(e));if(!t.length)return ie(`Nothing to send: every file is hidden or a dependency.`);ce(`upload`,async()=>{let n=e[0],r=await b.source({kind:`upload`,label:n?.webkitRelativePath?n.webkitRelativePath.split(`/`)[0]:t.length===1?t[0].name:`${t.length} files`});await xi(r.workspace.id,t,e=>K(`Sending ${e} of ${t.length} files…`)),J(await b.finish(r.workspace.id))})},ue=t===`project`||!!q?.ready,de=()=>{if(!U){if(ie(``),ue)return m===`other`&&!_.tests.trim()?ie(`Say which files are the tests, such as *.jmx, under Framework.`):w?.();if(t===`git`){if(!T.trim())return ie(`Paste the repository's address first.`);ce(`read`,async()=>J(await b.source({kind:`git`,url:T.trim(),...O?{branch:O}:{},...M?{tokenVar:M}:{}})))}else if(t===`folder`){if(!L.trim())return ie(`Type the folder's path first.`);ce(`read`,async()=>J(await b.source({kind:`folder`,folder:L.trim()})))}else{if(t===`upload`)return ie(`Choose a folder or some files first.`);if(t===`paste`){if(V.some(e=>!e.path.trim()||!e.text.trim()))return ie(`Give every file a name and its code.`);ce(`read`,async()=>{let e=await b.source({kind:`paste`});await b.files(e.workspace.id,V.map(e=>({path:e.path.trim(),text:e.text}))),J(await b.finish(e.workspace.id))})}}}},pe=!!U,me={read:t===`git`?`Cloning…`:t===`folder`?`Copying…`:`Reading…`,upload:`Sending…`,test:`Testing…`,token:`Saving…`}[U],[he,_e]=(0,Q.useState)(null),ve=e=>{f(_i(e)),_e(null)},ye=e=>{e!==t&&(f([]),n(e),c(null),S(null),ie(``),u(e===`project`?``:`.`))},be=q?.ready||t===`project`&&y;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[!q?.ready&&(0,$.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||pe)return;e.preventDefault();let r=yi.length,i=yi[(yi.findIndex(e=>e.id===t)+n+r)%r].id;ye(i);let a=e.currentTarget;requestAnimationFrame(()=>a.querySelector(`[aria-label="${yi.find(e=>e.id===i).label}"]`)?.focus())},className:`grid grid-cols-[repeat(auto-fill,minmax(208px,1fr))] gap-2`,children:yi.map(e=>(0,$.jsx)(Ot,{on:t===e.id,onPick:()=>ye(e.id),disabled:pe,logo:(0,$.jsx)(Rt,{logo:Ft[e.id].Logo,icon:Ft[e.id].Icon,size:20}),title:e.label,sub:e.sub,label:e.label},e.id))}),be?(0,$.jsx)(wi,{found:y,ws:q,onChange:q?()=>{c(null),S(null),requestAnimationFrame(()=>document.getElementById(`mig-step`)?.focus())}:void 0}):t===`git`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,$.jsx)(X,{id:`mig-url`,label:`Repository`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2`,children:(0,$.jsx)(Rt,{logo:zt(T).Logo,size:18})}),(0,$.jsx)(o,{inputMode:`url`,id:`mig-url`,value:T,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/ui-tests.git`,onChange:e=>(E(e.target.value),ee(null)),onKeyDown:e=>g(e)&&de(),className:`w-full pl-10 font-mono`})]}),(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:!!U||!T.trim(),"aria-label":`Test the connection`,"data-tip":`Test the connection and list its branches`,onClick:()=>void ce(`test`,async()=>{let e=await b.testRepository(T.trim(),M||void 0);ee(e.branches),!O&&e.head&&k(e.head),K(`Connected: ${e.branches.length} branch${e.branches.length===1?``:`es`}`)}),children:(0,$.jsx)(qe,{"aria-hidden":`true`})})]})}),(0,$.jsx)(X,{id:`mig-branch`,label:`Branch`,children:j?.length?(0,$.jsx)(i,{id:`mig-branch`,value:O,onChange:e=>k(e.target.value),children:j.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}):(0,$.jsx)(o,{id:`mig-branch`,value:O,spellCheck:!1,maxLength:200,placeholder:`Default branch`,onChange:e=>k(e.target.value),className:`font-mono`})})]}),(0,$.jsx)(wt,{title:M?`Private repository: ${M}`:`Private repository? Add a token`,defaultOpen:!!M,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsx)(X,{id:`mig-token`,label:`Access token`,help:F?void 0:(0,$.jsx)(A,{variant:`link`,size:`inline`,onClick:()=>I({name:`REPO_TOKEN`,value:``}),children:`Save a new token`}),children:(0,$.jsxs)(i,{id:`mig-token`,value:M,onChange:e=>te(e.target.value),className:`max-w-[360px]`,children:[(0,$.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),N.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})}),F&&(0,$.jsxs)(`div`,{className:p(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex flex-wrap items-end gap-2`),children:[(0,$.jsx)(X,{id:`mig-token-name`,label:`Name`,children:(0,$.jsx)(o,{id:`mig-token-name`,value:F.name,spellCheck:!1,maxLength:64,onChange:e=>I({...F,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})}),(0,$.jsx)(X,{id:`mig-token-value`,label:`Token`,children:(0,$.jsx)(o,{id:`mig-token-value`,type:`password`,autoComplete:`off`,value:F.value,onChange:e=>I({...F,value:e.target.value}),className:`w-[260px] max-w-full`})}),(0,$.jsxs)(A,{disabled:!!U||!F.name||!F.value,onClick:()=>void ce(`token`,async()=>{await x.saveSecrets({[F.name]:F.value}),P([...new Set([...N,F.name])].sort()),te(F.name),I(null)}),children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),`Save`]}),(0,$.jsxs)(A,{variant:`outline`,onClick:()=>I(null),children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsx)(`span`,{className:`w-full text-body-sm text-muted`,children:`Kept in ForgeQE's credential store, never in the address or on this page.`})]})]})})]}):t===`folder`?(0,$.jsx)(X,{id:`mig-folder`,label:`Folder path`,help:`Copied first; the folder itself is never changed.`,children:(0,$.jsx)(o,{id:`mig-folder`,value:L,spellCheck:!1,maxLength:1e3,placeholder:`/home/me/projects/shop-ui-tests`,onChange:e=>z(e.target.value),onKeyDown:e=>g(e)&&de(),className:`font-mono`})}):t===`upload`?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-md border border-dashed border-line-strong px-6 py-10 text-center`,children:[(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Choose a folder of tests, or some files. They are sent as soon as you pick them.`}),(0,$.jsx)(`input`,{ref:oe,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&le([...e.target.files])}),(0,$.jsx)(`input`,{ref:se,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&le([...e.target.files])}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,$.jsxs)(A,{disabled:!!U,onClick:()=>oe.current?.click(),"data-tip":`Choose a folder`,children:[(0,$.jsx)(R,{"aria-hidden":`true`}),`Folder`]}),(0,$.jsxs)(A,{disabled:!!U,onClick:()=>se.current?.click(),"data-tip":`Choose files`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`}),`Files`]})]})]}):t===`paste`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[V.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(o,{"aria-label":`File ${t+1} name`,value:e.path,spellCheck:!1,maxLength:300,placeholder:t?`pages/LoginPage.java`:`tests/LoginTest.java`,onChange:e=>H(V.map((n,r)=>r===t?{...n,path:e.target.value}:n)),className:`max-w-[360px] font-mono`}),V.length>1&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Remove file ${t+1}`,"data-tip":`Remove file ${t+1}`,onClick:()=>H(V.filter((e,n)=>n!==t)),children:(0,$.jsx)(B,{"aria-hidden":`true`})})]}),(0,$.jsx)(a,{"aria-label":`File ${t+1} code`,value:e.text,rows:7,spellCheck:!1,placeholder:`Paste the code`,onChange:e=>H(V.map((n,r)=>r===t?{...n,text:e.target.value}:n)),className:`font-mono`})]},t)),(0,$.jsxs)(A,{variant:`outline`,className:`self-start`,onClick:()=>H([...V,{path:``,text:``}]),"data-tip":`Add a file`,children:[(0,$.jsx)(ge,{"aria-hidden":`true`}),`Add`]})]}):null,re&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:re}),ae&&!re&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:ae}),ue&&C.n>0&&(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`What to migrate`}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`What to migrate`,className:`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2`,children:[(0,$.jsx)(Ot,{on:!C.on,disabled:C.locked,onPick:()=>C.set(!1),logo:(0,$.jsx)(W,{size:20,"aria-hidden":`true`}),title:`Test code`,sub:C.locked?`Pick the source again for its code`:y?`${y.counts.tests} test file${y.counts.tests===1?``:`s`}`:`Selenium, Cypress, Playwright…`,label:`Test code`}),(0,$.jsx)(Ot,{on:C.on,onPick:()=>C.set(!0),logo:(0,$.jsx)(Rt,{logo:Ft.tosca.Logo,icon:Ft.tosca.Icon,size:20}),title:`Tosca test cases`,sub:`${C.n} export${C.n===1?``:`s`} (.tsu)`,label:`Tosca test cases`})]}),C.on&&(0,$.jsxs)(`a`,{href:r(`migration`,`guide`),className:`inline-flex w-fit items-center gap-2 text-body-sm`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":`true`}),`Rather say what to convert? Ask Guide`]})]}),ue&&!C.on&&(0,$.jsx)(wt,{title:y?.stack?`Not quite right? Pick the tests folder or framework`:`Pick the tests folder and framework`,defaultOpen:!y?.stack||m===`other`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{id:`mig-from-label`,className:`text-body-sm font-medium`,children:`Tests folders`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(o,{readOnly:!0,"aria-labelledby":`mig-from-label`,value:d.length?d.join(`, `):t===`project`?`Whole project`:`All of it`,className:`min-w-0 flex-1 truncate font-mono`}),(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:()=>_e(d),"data-tip":`Pick one or more folders`,children:[(0,$.jsx)(R,{"aria-hidden":`true`}),`Choose`]})]}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:d.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,$.jsx)(et,{open:he!==null,onClose:()=>_e(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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`ghost`,onClick:()=>_e([]),disabled:!he?.length,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Clear`]}),(0,$.jsxs)(A,{variant:`primary`,onClick:()=>ve(he||[]),children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),he?.length?`Use ${he.length===1?`this folder`:`these ${_i(he).length} folders`}`:t===`project`?`Use the whole project`:`Use all of it`]})]}),children:(0,$.jsx)(vn,{label:`Tests folders`,folders:t===`project`?e.folders:s?.folders||[],value:he||[],onChange:_e})}),(0,$.jsx)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:(0,$.jsx)(X,{id:`mig-stack`,label:`Framework`,children:(0,$.jsxs)(i,{id:`mig-stack`,value:m,onChange:e=>h(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:y?.stack?`${y.title} (detected)`:`Detect`}),e.sources.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id)),(0,$.jsx)(`option`,{value:`other`,children:`Other (name it)`})]})})}),m===`other`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{id:`mig-source-name`,label:`Framework name`,help:`Shown in the plan, such as JMeter or Karate.`,children:(0,$.jsx)(o,{id:`mig-source-name`,value:_.name,maxLength:40,placeholder:`JMeter`,onChange:e=>v({..._,name:e.target.value})})}),(0,$.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`mig-tests`,label:`Test file types`,help:`Such as *.jmx or *.feature.`,children:(0,$.jsx)(o,{id:`mig-tests`,value:_.tests,spellCheck:!1,maxLength:120,placeholder:`*.jmx`,onChange:e=>v({..._,tests:e.target.value})})}),(0,$.jsx)(X,{id:`mig-support`,label:`Support file types (optional)`,help:`Code the tests use, such as *.groovy.`,children:(0,$.jsx)(o,{id:`mig-support`,value:_.support,spellCheck:!1,maxLength:120,placeholder:`None`,onChange:e=>v({..._,support:e.target.value})})})]})]})]})},y?.stack?`known`:`unknown`),w&&!C.on&&(0,$.jsx)(Mt,{busy:pe,next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{"aria-hidden":`true`}),me||`Continue`]}),onNext:de,aside:(0,$.jsx)(`span`,{className:`text-muted`,children:U===`test`?`Testing the connection…`:U===`token`?`Saving the token…`:pe?`Reading the source…`:`Nothing changes until you press Start.`})})]})}function wi({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,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 border-y border-line-soft py-4`,children:[(0,$.jsx)(`span`,{className:p(`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,$.jsx)(Ue,{size:14,"aria-hidden":`true`}):(0,$.jsx)(H,{size:14,"aria-hidden":`true`})}),(0,$.jsxs)(`span`,{role:`status`,className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-lg font-medium tracking-[-0.01em]`,children:[e?.stack&&(0,$.jsx)(Lt,{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,$.jsxs)(`span`,{className:`text-body-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:[[t?`From ${Kt(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,$.jsxs)(A,{variant:`ghost`,size:`sm`,onClick:n,"data-tip":`Pick another source`,children:[(0,$.jsx)(ie,{"aria-hidden":`true`}),`Change`]})]})}function Ti(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 Ei({view:e,to:t,setTo:n,other:r,setOther:i,into:s,setInto:c,only:l,setOnly:u,suggested:d,instructions:f,setInstructions:p}){let m=e=>e.split(`-`)[0],h=e=>e.split(`-`).slice(1).join(`-`),g=[...new Map(e.targets.map(e=>[m(e.id),e.framework])).entries()],_=r===null?m(t):``,v=e.targets.filter(e=>m(e.id)===_);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Framework`}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[g.map(([r,a])=>{let o=Bt[r];return(0,$.jsx)(Ot,{on:_===r,onPick:()=>(i(null),n((e.targets.find(e=>m(e.id)===r&&h(e.id)===h(t))||e.targets.find(e=>m(e.id)===r)).id)),logo:o?(0,$.jsx)(o,{width:22,height:22,"aria-hidden":`true`}):null,title:a,sub:d&&m(d)===r?`Suggested for your tests`:Nt[r],label:a},r)}),(0,$.jsx)(Ot,{on:r!==null,onPick:()=>i(r??``),logo:(0,$.jsx)(ge,{size:18,"aria-hidden":`true`,className:`text-icon`}),title:`Other`,sub:`Type the framework`,label:`Other framework`})]})]}),r===null?(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Language`}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[v.map(e=>{let r=It[h(e.id)];return(0,$.jsx)(Ot,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,$.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,sub:e.id===d?`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,$.jsx)(Ot,{on:!1,onPick:()=>i(`${g.find(([e])=>e===_)?.[1]??``} with `),logo:(0,$.jsx)(ge,{size:18,"aria-hidden":`true`,className:`text-icon`}),title:`Other`,sub:`Name the language`,label:`Other language`})]})]}):(0,$.jsx)(X,{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,$.jsx)(o,{id:`mig-other`,value:r,maxLength:120,autoFocus:!0,placeholder:`Playwright with Java, WebdriverIO TypeScript…`,onChange:e=>i(e.target.value)})}),(0,$.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`mig-into`,label:`Output folder`,help:`A new folder. Empty: named after the source and the target.`,children:(0,$.jsx)(o,{id:`mig-into`,value:s,spellCheck:!1,maxLength:300,placeholder:`tests-playwright`,onChange:e=>c(e.target.value),className:`font-mono`})}),(0,$.jsx)(X,{id:`mig-only`,label:`Only some tests (optional)`,help:`A pattern, such as checkout/** or **/*Login*.`,children:(0,$.jsx)(o,{id:`mig-only`,value:l,spellCheck:!1,maxLength:200,placeholder:`All tests`,onChange:e=>u(e.target.value),className:`font-mono`})})]}),(0,$.jsx)(wt,{title:f.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!f.trim(),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsx)(X,{id:`mig-instructions`,label:`Rules`,help:`Style and structure for the new code. Every test and check is kept either way.`,children:(0,$.jsx)(a,{id:`mig-instructions`,value:f,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per page.`,onChange:e=>p(e.target.value)})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:bi.map(e=>(0,$.jsxs)(A,{size:`sm`,disabled:f.includes(e),onClick:()=>p(f.trim()?`${f.trim()}\n${e}`:e),className:`font-normal`,children:[(0,$.jsx)(ge,{size:13,"aria-hidden":`true`}),e]},e))})]})})]})}var Di=[{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 Oi({view:e,review:t,onStart:n,tosca:r}){let[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(0),[c,l]=(0,Q.useState)(`git`),[u,d]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(`.`),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(``),[y,x]=(0,Q.useState)({name:``,tests:``,support:``}),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(e.targets[0]?.id||``),[O,k]=(0,Q.useState)(!1),A=e=>(k(!0),E(e)),[j,ee]=(0,Q.useState)(null),[M,te]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(!1),[V,H]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(``),G=Ti(C,e.targets);(0,Q.useEffect)(()=>{!O&&G&&E(G)},[O,G]),(0,Q.useEffect)(()=>{R(null),B(!1),s(e=>Math.min(e,1))},[c,u,f,h,_,y,N,T,j,M,F]);let[ne,re]=(0,Q.useState)(!1),ie=e=>{re(!0),a(e),s(t=>Math.max(t,e)),W(``)},ae=c===`project`||!!u?.workspace?.ready,K=u?.workspace,oe=ae?c===`project`?r.view?.exports.length||0:u?.tosca?.length||0:0,[se,q]=(0,Q.useState)(!1),ce=C?.counts.tests;(0,Q.useEffect)(()=>{q(oe>0&&!ce)},[c,K?.id,oe,ce]);let[J,le]=(0,Q.useState)(``),[de,fe]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{if(!se||c===`project`||!K?.ready||J===K.id)return;let e=!0;return fe(``),S.adopt(K.id).then(t=>{e&&(r.onView(t),le(K.id))},t=>e&&(fe(t.message),q(!1))),()=>{e=!1}},[se,c,K?.id,K?.ready,J]);let pe=c!==`project`&&!!K&&J===K?.id,me=!se||!ae?null:c===`project`?{project:!0}:pe?{workspace:K.id}:null,he={view:e,kind:c,setKind:l,src:u,setSrc:d,from:f,setFrom:m,folders:h,setFolders:g,stack:_,setStack:v,custom:y,setCustom:x,found:C,setFound:w,tosca:{n:oe,on:se,locked:pe,set:q}};if(me&&r.view)return(0,$.jsx)(Kr,{view:r.view,onView:r.onView,review:r.review,onStart:r.onStart,embedded:{scope:me,source:(0,$.jsx)(Ci,{...he})}},`workspace`in me?me.workspace:`project`);let ge=async()=>{H(!0),W(``);try{let e=h.length?vi(h,N):{from:f.trim()||`.`,...N.trim()?{only:N.trim()}:{}},t=await b.plan({...c!==`project`&&u?.workspace?{workspace:u.workspace.id}:{},...e.from===`.`?{}:{from:e.from},..._?{stack:_}:{},..._===`other`?{sourceName:y.name.trim(),tests:y.tests.trim(),support:y.support.trim()}:{},...j===null?{to:T}:{to:``,toText:j.trim()},...M.trim()?{into:M.trim()}:{},...e.only?{only:e.only}:{},...F.trim()?{instructions:F.trim()}:{}});R(t),ie(2)}catch(e){W(e.message)}finally{H(!1)}},_e=L?.plan,ve=_e?.feasibility.findings.some(e=>e.level===`limit`),ye=_e?.feasibility.verdict===`blocked`,be=e.targets.find(e=>e.id===T),xe=_e?.units.filter(e=>e.kind===`test`).length,Se=[`Where are the tests?`,`What should they become?`,`Check the plan, then start`],Ce=[`ForgeQE works on a copy. Your repository and folders are never changed.`,G&&!O&&j===null?`Suggested from your ${C?.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.`],Te=(...e)=>(0,$.jsx)($.Fragment,{children:e.filter(Boolean).map((e,t)=>(0,$.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 [overflow-wrap:anywhere]`,children:e},t))}),Ee=[{...Di[0],answer:ae&&(K||C)?Te((0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pt,{kind:K?.kind||`project`,label:K?.label,size:14}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:K?`${Kt(K.label)}${K.branch?`, ${K.branch}`:``}`:`This project`})]}),C&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lt,{framework:C.stack?.framework,language:C.stack?.language,size:14}),xe===void 0?`${C.counts.tests} test file${C.counts.tests===1?``:`s`}`:`${xe} test${xe===1?``:`s`} to migrate`]})):void 0},{...Di[1],answer:o>=1||G?Te(j===null?be&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lt,{framework:be.id.split(`-`)[0],language:be.id.split(`-`).slice(1).join(`-`),size:14}),be.title]}):(0,$.jsx)(`span`,{className:j.trim()?``:`text-muted`,children:j.trim()||`Type it in`}),(0,$.jsx)(`span`,{className:`text-muted`,children:G&&!O&&j===null?`Suggested from your tests`:_e?`Into ${_e.target.dir}`:M.trim()?`Into ${M.trim()}`:`Into a new folder`})):void 0},{...Di[2],answer:_e?Te((0,$.jsx)(`span`,{children:Ht[_e.feasibility.verdict].label})):void 0}];return(0,$.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,$.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,$.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,$.jsx)(jt,{steps:Ee,at:i,reached:o,onGo:e=>!V&&(e<2||L)&&(re(!0),a(e))})})}),(0,$.jsxs)(`section`,{"aria-labelledby":`mig-step`,className:`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(At,{id:`mig-step`,at:i,moved:ne,children:Se[i]}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:Ce[i]})]}),(U||de)&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:U||de}),i===0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ci,{...he,onNext:()=>ie(1)}),se&&(0,$.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-body-sm`,children:(0,$.jsx)(`span`,{children:`Getting the Tosca exports ready…`})})]}),i===1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ei,{view:e,to:T,setTo:A,other:j,setOther:ee,into:M,setInto:te,only:N,setOnly:P,suggested:G,instructions:F,setInstructions:I}),(0,$.jsx)(Mt,{busy:V,onBack:()=>(re(!0),a(0)),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(we,{"aria-hidden":`true`}),V?`Checking…`:`Check the plan`]}),onNext:()=>j!==null&&!j.trim()?W(`Type the framework and language first.`):void ge(),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),i===2&&_e&&(0,$.jsxs)($.Fragment,{children:[t(_e,z,B),(0,$.jsx)(Mt,{busy:V,onBack:()=>(re(!0),a(1)),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]}),disabled:ye||ve&&!z,onNext:()=>n(L,!!ve&&z),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:ye?`Change what is not possible first.`:ve&&!z?`Accept the limits to start.`:`Runs in the background.`})})]})]})]})}function ki({error:e}){return e?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:e}):null}function Ai({finding:e}){let t=e.hits||[],n=e.files?.length||0;if(!t.length)return n?(0,$.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,$.jsxs)(`details`,{className:`mt-1 text-body-sm`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-muted hover:text-ink`,children:[`Found in `,n||t.length,` file`,(n||t.length)===1?``:`s`]}),(0,$.jsxs)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:[t.map(e=>(0,$.jsxs)(`li`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.file,`:`,e.line]}),(0,$.jsx)(`code`,{className:p(u,`mt-1 block overflow-x-auto rounded-sm px-2 py-1 font-mono text-body-sm whitespace-pre text-ink`),children:e.code})]},`${e.file}:${e.line}`)),r>0&&(0,$.jsxs)(`li`,{className:`text-muted`,children:[`and `,r,` more file`,r===1?``:`s`]})]})]})}function ji({f:e}){let t=e.level===`blocker`;return(0,$.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,$.jsx)(`span`,{className:p(`inline-flex size-6 items-center justify-center rounded-full`,t?`bg-fail-soft text-fail`:`bg-warn-soft text-warn`),children:(0,$.jsx)(H,{size:14,"aria-label":t?`Not possible`:`Limit`})}),(0,$.jsxs)(`span`,{className:`min-w-0 text-body-sm leading-relaxed text-ink [overflow-wrap:anywhere]`,children:[e.text,(0,$.jsx)(Ai,{finding:e})]})]})}function Mi({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,o=e.units.filter(e=>e.kind===`support`).length,s=e.workspace?Kt(e.workspace.label):`this project`,c=r.length?{icon:se,text:`Not possible yet: ${r.length===1?`one thing stops it`:`${r.length} things stop it`}`,tone:`text-fail`}:i.length?t&&!n?{icon:q,text:`Ready to start, ${i.length===1?`its limit`:`its ${i.length} limits`} accepted`,tone:`text-pass`}:{icon:H,text:`Ready, with ${i.length===1?`1 limit`:`${i.length} limits`} to accept`,tone:`text-warn`}:{icon:q,text:`Ready to start`,tone:`text-pass`};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsx)(Yt,{from:{...e.source.stack?e.source.stack:{},title:e.source.title,sub:`${a} test${a===1?``:`s`} to migrate, from ${s}${e.source.dir===`.`?``:`/${e.source.dir}`}`},to:{...Fi(e.target.id),title:e.target.title,sub:`Into ${e.target.dir}`}}),(0,$.jsxs)(`p`,{className:p(`m-0 flex items-center gap-2 text-body-sm font-medium`,c.tone),children:[(0,$.jsx)(c.icon,{size:16,"aria-hidden":`true`}),c.text]}),(0,$.jsxs)($e,{label:`The plan in numbers`,children:[(0,$.jsx)(dt,{label:`Tests`,value:a,note:`Rewritten, one by one`}),(0,$.jsx)(dt,{label:`Support files`,value:o,note:`Code the tests use`}),(0,$.jsx)(dt,{label:`Copied as is`,value:e.copies.length,note:`Not rewritten`}),(0,$.jsx)(dt,{label:`Not migrated`,value:e.notMigrated.length,note:e.notMigrated.length?`In What moves where`:`Nothing left out`})]}),r.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`mig-blockers`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`mig-blockers`,className:`m-0 text-body-sm font-medium text-muted`,children:`Not possible`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:r.map(e=>(0,$.jsx)(ji,{f:e},e.code))})]}),i.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`mig-limits`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`mig-limits`,className:`m-0 text-body-sm font-medium text-muted`,children:t&&!n?`Limits accepted`:`Limits to accept`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:i.map(e=>(0,$.jsx)(ji,{f:e},e.code))}),n&&!r.length&&(0,$.jsxs)(`label`,{className:`flex min-h-10 w-fit cursor-pointer items-center gap-2 text-body-sm font-medium`,children:[(0,$.jsx)(at,{checked:!!t,onCheckedChange:n}),`I accept `,i.length===1?`this limit`:`these ${i.length} limits`]})]}),e.instructions&&(0,$.jsxs)(`section`,{"aria-labelledby":`mig-rules`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`mig-rules`,className:`m-0 text-body-sm font-medium text-muted`,children:`Your rules for the new code`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.instructions})]}),(0,$.jsxs)(wt,{title:`What moves where (${e.units.length})`,children:[(0,$.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-body-sm`,children:e.units.map(e=>(0,$.jsxs)(`li`,{className:`flex flex-wrap gap-x-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`w-16 flex-none text-muted`,children:Qt[e.kind]}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.source?(0,$.jsxs)(`span`,{className:`text-muted`,children:[e.source.slice(e.source.lastIndexOf(`/`)+1),` → `]}):null,e.target]})]},e.id))}),e.notMigrated.length>0&&(0,$.jsxs)(`p`,{className:`m-0 mt-2 text-body-sm text-muted`,children:[`Not migrated: `,e.notMigrated.map(e=>e.rel.slice(e.rel.lastIndexOf(`/`)+1)).join(`, `)]})]})]})}function Ni({plan:e,acceptLimits:t,onClose:n,onStarted:r}){let[i,a]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(``),d=async()=>{c(!0),u(``);try{r((await b.start(e.id,i,t)).detail)}catch(e){u(e.message),c(!1)}};return(0,$.jsx)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`outline`,onClick:n,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(A,{variant:`primary`,disabled:s||i!==e.id,onClick:()=>void d(),"data-tip":`Start the migration`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,$.jsx)(o,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,$.jsx)(ki,{error:l})]})})}function Pi({d:e,onStarted:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),o=e.plan.feasibility.findings.some(e=>e.level===`limit`),s=e.plan.feasibility.verdict===`blocked`,c=!!e.job?.running;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!c&&(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,$.jsx)(Mi,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!s&&!c&&(0,$.jsx)(`div`,{children:(0,$.jsxs)(A,{variant:`primary`,disabled:!e.confirmed&&o&&!n,onClick:()=>a(!0),"data-tip":`Start the migration`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]})}),i&&(0,$.jsx)(Ni,{plan:e.plan,acceptLimits:o&&(e.confirmed||n),onClose:()=>a(!1),onStarted:e=>{a(!1),t(e)}})]})}var Fi=e=>({framework:e.split(`-`)[0],language:e.split(`-`).slice(1).join(`-`)});function Ii(e,t){return e?.status===`running`?`running`:e?.status===t?`done`:e?`review`:`planned`}function Li(e){return{key:e.id,link:r(`migration`,e.id),title:e.target,under:`From ${e.source}, into ${e.to}`,from:(0,$.jsx)(Lt,{framework:e.stack?.framework,language:e.stack?.language,size:18}),to:Fi(e.targetId),source:{mark:(0,$.jsx)(Pt,{kind:e.origin.kind,label:e.origin.label,size:15}),text:e.origin.kind===`project`?e.from&&e.from!==`.`?e.from:`This project`:Kt(e.origin.label),tip:e.origin.kind===`project`&&(!e.from||e.from===`.`)?`This project's own tests`: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?Vt[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ht[e.verdict],filter:Ii(e.result,`migrated`),at:e.result?.endedAt||e.result?.at||e.createdAt}}function Ri(e){let t=e.file.slice(e.file.lastIndexOf(`/`)+1);return{key:e.id,link:r(`migration`,e.id),title:e.target,under:`From ${t}, into ${e.into}`,from:(0,$.jsx)(Pt,{kind:`tosca`,size:18}),to:Fi(e.targetId),source:{mark:(0,$.jsx)(Pt,{kind:`tosca`,size:15}),text:e.project||t,tip:e.project?`${e.project} (Tosca export ${e.file})`:`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?fn[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:on[e.verdict],filter:Ii(e.result,`converted`),at:e.result?.endedAt||e.result?.at||e.createdAt}}var zi=(e,t)=>`${t?Math.round(e/t*100):0}%`;function Bi({rows:e}){let[t,n]=(0,Q.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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ft,{label:`Migrations by status`,children:[(0,$.jsx)(ht,{dot:`neutral`,value:r(`all`),label:`migrations`,onClick:()=>n(`all`),on:t===`all`}),(0,$.jsx)(ht,{dot:`running`,value:r(`running`),label:`running`,onClick:()=>n(`running`),on:t===`running`}),(0,$.jsx)(ht,{dot:`pass`,value:r(`done`),label:`migrated (${zi(r(`done`),r(`all`))})`,onClick:()=>n(`done`),on:t===`done`}),(0,$.jsx)(ht,{dot:`warn`,value:r(`review`),label:`need review`,onClick:()=>n(`review`),on:t===`review`})]}),(0,$.jsx)(Dt,{label:`Migrations`,placeholder:`Find a migration`,empty:t===`all`?`No migrations.`:`None here.`,resetKey:t,height:Qe,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Migration`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @3xl:table-cell`),children:`Source`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Tests`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @xl:table-cell`),children:`Updated`})]}),children:i.map(e=>(0,$.jsxs)(`tr`,{onClick:()=>location.hash=e.link,className:St,children:[(0,$.jsx)(`td`,{className:rt,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,$.jsxs)(`span`,{className:`hidden w-[104px] flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:[e.from,(0,$.jsx)(ze,{size:13,className:`flex-none text-muted`}),(0,$.jsx)(Lt,{framework:e.to.framework,language:e.to.language,size:18})]}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`a`,{href:e.link,onClick:e=>e.stopPropagation(),className:p(ut,`no-underline hover:underline`),"data-tip":e.title,children:e.title}),(0,$.jsx)(`span`,{className:st,"data-tip":e.under,children:e.under})]})]})}),(0,$.jsx)(`td`,{className:p(mt,`hidden w-[200px] max-w-[200px] @3xl:table-cell`),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.source.mark,(0,$.jsx)(`span`,{className:`truncate`,"data-tip":e.source.tip,children:e.source.text})]})}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap tabular-nums`),"data-sort":e.running?e.running.pct/100:e.pass?e.pass.n/Math.max(1,e.pass.of):-1,children:e.running?(0,$.jsxs)(`span`,{className:`flex w-[160px] items-center gap-2`,children:[(0,$.jsx)(en,{value:e.running.pct,label:`${e.title}, ${e.under}: progress`}),(0,$.jsxs)(`span`,{className:`w-9 flex-none text-right text-muted`,children:[e.running.pct,`%`]})]}):e.pass?(0,$.jsxs)($.Fragment,{children:[e.pass.n,` of `,e.pass.of,` pass`]}):(0,$.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap`),children:(0,$.jsx)(P,{tone:e.state.tone,children:e.state.label})}),(0,$.jsx)(`td`,{className:p(mt,`hidden whitespace-nowrap text-muted @xl:table-cell`),"data-tip":new Date(e.at).toLocaleString(),"data-sort":new Date(e.at).getTime()||0,children:tt(e.at)})]},e.key))})]})}function Vi({sub:e}){let[t,n]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=e===`migrations`,h=(0,Q.useCallback)(()=>{b.list().then(e=>{n(e),s(``)},e=>s(e.message))},[]),g=(0,Q.useCallback)(()=>{S.list().then(e=>{a(e),l(``)},e=>l(e.message))},[]);(0,Q.useEffect)(h,[h,e]),(0,Q.useEffect)(()=>{(m||e===`new`)&&g()},[m,e,g]);let _=t?.plans.some(e=>e.result?.status===`running`)||i?.plans.some(e=>e.result?.status===`running`);(0,Q.useEffect)(()=>{if(!_||!m)return;let e=vt(()=>{h(),g()},3e3);return()=>lt(e)},[_,m,h,g]);let v=(0,Q.useMemo)(()=>[...t?.plans.map(Li)||[],...i?.plans.map(Ri)||[]].sort((e,t)=>e.at<t.at?1:e.at>t.at?-1:0),[t,i]),y=e?.match(/^(mig-\d{8}-\d{6}-[0-9a-f]{4})(?:\/(tests|activity))?$/),x=ui(e),C=y?.[1]??``,w=()=>location.hash=r(`migration`,`new`),T=!t&&!o&&(0,$.jsx)(M,{shape:e===`new`?`lines`:C?`detail`:`rows`});return Zr(e)?(0,$.jsx)(Qr,{sub:e}):e===`new`?(0,$.jsxs)(bn,{tab:`migrations`,back:yn,children:[(0,$.jsx)(ki,{error:o}),T,t&&(0,$.jsx)(Oi,{view:t,review:(e,t,n)=>(0,$.jsx)(Mi,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>d({d:e,accept:t}),tosca:{view:i,onView:a,review:(e,t,n,r)=>(0,$.jsx)(Jr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>p({d:e,accept:t})}}),u&&(0,$.jsx)(Ni,{plan:u.d.plan,acceptLimits:u.accept,onClose:()=>d(null),onStarted:e=>location.hash=r(`migration`,e.plan.id)}),f&&(0,$.jsx)(Cn,{plan:f.d.plan,acceptLimits:f.accept,onClose:()=>p(null),onStarted:e=>location.hash=r(`migration`,e.plan.id)})]}):x?(0,$.jsx)(bn,{tab:`migrations`,wide:!0,back:{href:r(`migration`,x.id),label:`Migration`},children:(0,$.jsx)(hi,{id:x.id,...x.tab?{tab:x.tab}:{}},x.id)}):C?(0,$.jsxs)(bn,{tab:`migrations`,wide:!0,back:yn,children:[(0,$.jsx)(ki,{error:o}),T,t&&(0,$.jsx)(li,{id:C,...y?.[2]?{tab:y[2]}:{},view:t,plan:e=>(0,$.jsx)(Pi,{d:e,onStarted:()=>location.reload()})},C)]}):m?(0,$.jsxs)(bn,{tab:`migrations`,action:t&&!v.length?void 0:(0,$.jsxs)(A,{variant:`accent`,disabled:!t,onClick:w,"data-tip":`New migration`,children:[(0,$.jsx)(ge,{"aria-hidden":`true`}),`New`]}),children:[(0,$.jsx)(ki,{error:o}),(0,$.jsx)(ki,{error:c&&`Tosca conversions could not be read: ${c}`}),T,t&&(v.length?(0,$.jsx)(Bi,{rows:v}):(0,$.jsx)(_t,{icon:_e,title:`No migrations yet`,action:(0,$.jsxs)(A,{size:`sm`,onClick:w,"data-tip":`New migration`,children:[(0,$.jsx)(ge,{"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,$.jsx)(bn,{tab:Ct})}export{Vi as Migration};
5
+ `)}function Pn(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 Fn(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?fn[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:on[e.plan.feasibility.verdict]}var In=e=>e.slice(e.lastIndexOf(`/`)+1);function Ln({d:e,onClose:t}){let n=(e.plan.sources||[]).some(e=>e.workspace),[i,a]=(0,Q.useState)(n),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=async()=>{s(!0),l(``);try{let t=await S.reimport(e.plan.id,n&&i);location.hash=r(`migration`,t.plan.id)}catch(e){l(e.message),s(!1)}};return(0,$.jsx)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{variant:`outline`,onClick:t,children:`Cancel`}),(0,$.jsx)(A,{busy:o,variant:`primary`,disabled:o,onClick:()=>void u(),children:o?`Reading…`:`Make the new plan`})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[n&&(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,$.jsx)(at,{className:`mt-1`,checked:i,onCheckedChange:a}),(0,$.jsxs)(`span`,{children:[`Get the newest commit of the cloned repositories`,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`Each is cloned again, as before; the old copy stays for this plan.`})]})]}),c&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:c})]})})}var Rn=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function zn({id:e,onClose:t}){let[n,r]=(0,Q.useState)(`github`),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let t=!0;return a(null),m(!1),s(``),l(``),S.ci(e,n).then(e=>t&&a(e),e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let h=i?i.file.slice(i.file.lastIndexOf(`/`)+1):``,g=()=>{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=h,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},_=async()=>{d(!0),s(``);try{let t=await S.writeCi(e,n);m(!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,$.jsxs)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{variant:`outline`,onClick:t,children:`Close`}),(0,$.jsxs)(A,{disabled:!i,onClick:g,children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),`Download`]}),!f&&(0,$.jsx)(A,{busy:u,variant:`primary`,disabled:!i||u,onClick:()=>void _(),"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,$.jsx)(Ze,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:Rn}),(0,$.jsxs)(`div`,{id:`panel-ci-${n}`,role:`tabpanel`,"aria-labelledby":`tab-ci-${n}`,className:`flex flex-col gap-4 text-body-sm`,children:[!i&&!o&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Making the pipeline…`}),o&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}),c&&(0,$.jsx)(`p`,{role:`status`,className:p(D.info,`m-0`),children:c}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Jobs`}),(0,$.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 ${Z(i.workflows,`workflow`)}`]:[]].join(`; `)}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Goes in`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-body-sm [overflow-wrap:anywhere]`,children:i.path}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`To set`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[i.tests&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:`BASE_URL`}),` as a variable`]}),i.secrets.length?(0,$.jsxs)($.Fragment,{children:[i.tests?`; as `:`As `,n===`github`?`secrets`:`secret variables`,`: `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:i.secrets.join(`, `)})]}):null,!i.tests&&!i.secrets.length?`None`:null,i.skipped.length?(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Not passed, not a name the CI takes: `,i.skipped.join(`, `)]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:h}),(0,$.jsx)(L,{text:i.text,label:`Copy ${h}`})]}),(0,$.jsx)(`pre`,{"aria-label":h,tabIndex:0,className:p(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[420px] whitespace-pre`),children:i.text})]})]})]})]})}function Bn({id:e,onClose:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),v=(t=``)=>S.pr(e,t).then(e=>{r(e),_(``),e.preview&&(a(e.preview),c(t=>t||e.preview.base),u(t=>t||e.preview.title))},e=>_(e.message));(0,Q.useEffect)(()=>{v()},[e]),(0,Q.useEffect)(()=>{if(n?.job?.state!==`running`)return;let e=setTimeout(()=>void v(s),1e3);return()=>clearTimeout(e)},[n]);let y=async()=>{h(!0),_(``);try{let t=await S.openPr(e,{base:s.trim(),title:l.trim(),draft:d});r(e=>e&&{...e,job:t.job})}catch(e){_(e.message)}finally{h(!1)}},b=i,x=n?.job,C=x?.state===`running`,w=x?.state===`done`?x.result:void 0,T=g||(x?.state===`failed`?x.error:``)||(n&&!n.preview?n.problem:``)||``,E=e=>/^https:\/\//.test(e)?e:void 0,O=(e,t)=>(0,$.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 text-accent-fg`,children:[t,(0,$.jsx)(Ee,{size:11,"aria-hidden":`true`})]});return(0,$.jsx)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{variant:`ghost`,onClick:t,children:w?`Close`:`Cancel`}),!w&&(0,$.jsx)(A,{busy:m,variant:`primary`,disabled:!b||!n?.preview||m||C||!s.trim(),onClick:()=>void y(),children:m?`Starting…`:C?`Pushing…`:`Push and open the pull request`})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[!n&&!g&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Checking the repository…`}),T&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:T}),w&&(0,$.jsxs)(`p`,{role:`status`,className:p(D.info,`m-0`),children:[w.existing?`Nothing new to push: this is the pull request.`:`Pushed ${Z(w.files,`file`)} on ${w.branch}.`,` `,E(w.url)?O(E(w.url),`Open the pull request`):`It is open on ${w.branch}; the host gave no https address to link to.`]}),b&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Repository`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[b.platform===`github`?`GitHub`:`Azure DevOps`,` `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:b.repository}),` (`,b.remote,`)`]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Branch`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-body-sm [overflow-wrap:anywhere]`,children:b.branch}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[Z(b.files.length,`file`),` of `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:b.folder})]})]}),b.last&&E(b.last.url)&&!w&&(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Opened before: `,O(E(b.last.url),`the pull request`),`. Pushing again updates its branch.`]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Merge into`}),(0,$.jsx)(o,{value:s,spellCheck:!1,maxLength:200,placeholder:`main`,"aria-invalid":!(!n||n.preview),onChange:e=>c(e.target.value),onBlur:()=>s.trim()&&s.trim()!==n?.preview?.base&&void v(s.trim()),disabled:C,className:`font-mono`})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Title`}),(0,$.jsx)(o,{value:l,maxLength:200,onChange:e=>u(e.target.value),disabled:C})]}),(0,$.jsxs)(`label`,{className:p(`flex items-start gap-2`,C?`cursor-default`:`cursor-pointer`),children:[(0,$.jsx)(at,{className:`mt-1`,checked:d,onCheckedChange:f,disabled:C}),(0,$.jsxs)(`span`,{children:[`Open it as a draft`,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`Reviewers are not asked yet.`})]})]}),(0,$.jsx)(wt,{title:`Files (${b.files.length})`,children:(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm`,children:[b.files.slice(0,200).map(e=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e)),b.files.length>200&&(0,$.jsxs)(`li`,{className:`text-muted`,children:[`and `,b.files.length-200,` more`]})]})}),b.skipped.length>0&&(0,$.jsx)(wt,{title:`Left out (${b.skipped.length})`,children:(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:b.skipped.slice(0,100).map(e=>(0,$.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.path}),`: `,(0,$.jsx)(`span`,{className:`text-muted`,children:e.why})]},e.path))})})]})]})})}function Vn({id:e,title:t,targetDir:n,onClose:i}){let[a,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),f=async()=>{l(!0),d(``);try{await S.delete(e,a),location.hash=r(`migration`,`migrations`)}catch(e){d(e.message),l(!1)}};return(0,$.jsx)(et,{open:!0,onClose:i,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`ghost`,onClick:i,"data-tip":`Keep it`,children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),`Keep`]}),(0,$.jsxs)(A,{variant:`danger`,disabled:c||a!==e,onClick:()=>void f(),children:[(0,$.jsx)(B,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,$.jsx)(o,{value:a,onChange:e=>s(e.target.value),autoComplete:`off`,spellCheck:!1})]}),u?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:u}):null]})})}function Hn({d:e,unit:t,onClose:n,onSend:r}){let[i,o]=(0,Q.useState)(``),s=e.plan.units.find(e=>e.id===t),c=e.result?.units.find(e=>e.id===t);return(0,$.jsx)(et,{open:!0,onClose:n,title:`Fix ${s?In(s.target):t}`,description:`Bridge works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`outline`,onClick:n,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(A,{variant:`primary`,onClick:()=>r(i.trim()),"data-tip":`Send to the agent`,children:[(0,$.jsx)(Oe,{"aria-hidden":`true`}),`Send`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:c.problems[0]}):null,(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,$.jsx)(a,{value:i,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function Un({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,$.jsx)(et,{open:!0,onClose:n,wide:!0,title:`Output of ${i?In(i.target):t}`,description:r?.checkedAt?`Run again ${Gt(r.checkedAt)}`:`From the conversion's own run`,footer:(0,$.jsxs)(A,{onClick:n,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r?.problems?.length?(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:r.problems.join(` `)}):r?.status===`converted`?(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,r?.command&&(0,$.jsxs)(`code`,{className:`block font-mono text-body-sm text-muted`,children:[`$ `,r.command]}),(0,$.jsx)(`pre`,{className:p(ee,`m-0 max-h-[60vh]`),children:(0,$.jsx)(I,{text:r?.output||`No output.`})})]})})}function Wn(e){let t=Object.fromEntries(an.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 Gn(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||!jn(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||In(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)),Pn(r,e=>e.u.checkedAt)}var Kn=`@5xl:h-[calc(var(--screen)-312px)] @5xl:min-h-[540px]`;function qn({d:e,busy:t,onFix:n,onSteps:r,onOutput:i}){let a=e.result?Gn(e,e.result):[];return a.length?(0,$.jsx)(`ol`,{"aria-label":`Errors, the latest first`,className:`m-0 flex min-h-0 list-none flex-col gap-8 p-0 @5xl:flex-1 @5xl:overflow-y-auto`,children:a.map(({p:e,u:a,tc:o,title:s})=>{let c=Nn(a),l=a.problems?.length?a.problems:[];return(0,$.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,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`h3`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-body-lg font-medium`,children:[(0,$.jsx)(P,{tone:_n[a.status].tone,children:_n[a.status].label}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:s})]}),(0,$.jsxs)(`p`,{className:`m-0 font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:[e.target,o?.suites?.length?(0,$.jsxs)(`span`,{className:`font-sans`,children:[`, in `,o.suites.join(`, `)]}):null,(0,$.jsxs)(`span`,{className:`font-sans`,children:[` `,`· `,Z(a.attempts,`attempt`),a.checkedAt?`, run again ${tt(a.checkedAt)}`:``]})]})]}),(0,$.jsxs)(mn,{icon:Ke,title:`What went wrong`,children:[(0,$.jsx)(`p`,{className:p(D.fail,`m-0 font-mono`),children:Mn(a)}),l.length>0&&(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:l.map((e,t)=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))})]}),c&&(0,$.jsx)(mn,{icon:ye,title:`What the test printed`,children:(0,$.jsx)(F,{label:`Error of ${s}`,files:[{name:In(e.target),code:c,log:!0}]})}),a.reason&&(0,$.jsx)(mn,{icon:je,title:`The agent's note`,children:(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:a.reason})}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[!e.engine&&(0,$.jsxs)(A,{size:`sm`,variant:`primary`,disabled:t,onClick:()=>n(e.id),children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix with the agent`]}),e.case&&(0,$.jsxs)(A,{size:`sm`,onClick:()=>r(e.case),children:[(0,$.jsx)(Ve,{"aria-hidden":`true`}),`Steps beside the code`]}),(a.output||l.length>0)&&(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:()=>i(e.id),children:[(0,$.jsx)(ye,{"aria-hidden":`true`}),`Full output`]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:p(l,`flex min-h-[240px] flex-1 items-center justify-center`),children:(0,$.jsx)(_t,{center:!0,icon:q,title:`No errors`,children:e.result?.status===`running`?`None so far: a test that fails shows here, with what to do.`:`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?Wn(e):null);if(!l)return(0,$.jsx)($.Fragment,{children:t});let u=new Map(l.units.map(e=>[e.id,e])),f=e.plan.units.filter(e=>e.kind===`test`&&!e.engine),m=e.plan.units.filter(e=>e.kind===`test`&&e.engine),h=new Set(f.map(e=>e.id)),g=new Set(m.map(e=>e.id)),_=l.units.filter(e=>h.has(e.id)&&e.status===`converted`).length,v=l.units.filter(e=>g.has(e.id)&&e.status===`written`).length,y=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=Gn(e,l),w=C[0];return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-8`,children:[(0,$.jsxs)(ft,{label:`The conversion in numbers`,children:[(0,$.jsx)(ht,{dot:`pass`,value:f.length?`${_} of ${f.length}`:`${v} of ${m.length}`,label:f.length?`passing`:`workflows written`}),(0,$.jsx)(ht,{dot:b?`fail`:`neutral`,value:b,label:`need attention`}),(0,$.jsx)(ht,{dot:`neutral`,value:y.n?`${y.m} of ${y.n}`:`None yet`,label:`Tosca steps kept`}),(0,$.jsx)(ht,{dot:l.status===`running`?`running`:`neutral`,value:Jt(l.status===`running`?Date.now()-Date.parse(l.startedAt):l.ms),label:l.status===`running`?`running`:`taken`})]}),w&&(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-attn-h`,className:p(D.fail,`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 @2xl:grid-cols-[auto_minmax(0,1fr)_auto]`),children:[(0,$.jsx)(`h3`,{id:`tsc-attn-h`,className:`sr-only`,children:`Needs your attention`}),(0,$.jsx)(Ke,{size:18,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,$.jsxs)(`p`,{className:`m-0 min-w-0 truncate text-body-sm text-ink`,"data-tip":`${w.title}: ${Mn(w.u)}`,children:[(0,$.jsx)(`span`,{className:`hidden font-medium @2xl:inline`,children:w.title}),(0,$.jsx)(`span`,{className:`hidden text-ink-2 @2xl:inline`,children:`: `}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:Mn(w.u)})]}),(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`col-start-2 -ml-4 justify-self-start @2xl:col-start-auto @2xl:ml-0`,onClick:c,children:[C.length===1?`See the error`:`See all ${C.length} errors`,(0,$.jsx)(ze,{"aria-hidden":`true`})]})]}),l.notes&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:l.notes}),l.batch&&l.batch.left>0&&l.status!==`running`&&(0,$.jsxs)(`div`,{role:`status`,className:p(D.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Batch `,l.batch.runs,` is done. Check its tests, then continue: `,Z(l.batch.left,`test case`),` not tried yet.`]}),(0,$.jsxs)(A,{size:`sm`,disabled:n,onClick:s,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Continue with the next batch`]})]}),(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,$.jsx)(`div`,{className:`@container flex min-h-0 min-w-0 flex-col`,children:(0,$.jsx)(Dt,{className:`min-h-[240px] flex-1 overflow-y-auto`,label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`File`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @3xl:table-cell`),children:`Note`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let o=u.get(t.id),s=o?_n[o.status]:null,c=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsxs)(`td`,{className:mt,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:In(t.target)}),(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[c?t.engine?`${ln(t)}: ${c.name}`:c.name:`${ln(t)}, ${t.target}`,c?.suites?.length?`, in ${c.suites.join(`, `)}`:``]})]}),(0,$.jsxs)(`td`,{className:p(mt,`whitespace-nowrap`),children:[s?(0,$.jsx)(P,{tone:s.tone,children:s.label}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Waiting`}),o?.checkedAt&&(0,$.jsxs)(`span`,{className:`block pt-1 text-body-sm text-muted`,children:[`Run again `,tt(o.checkedAt)]})]}),(0,$.jsx)(`td`,{className:p(mt,`hidden text-body-sm whitespace-nowrap @2xl:table-cell`),"data-sort":o?.fidelity?o.fidelity.matched/Math.max(1,o.fidelity.required):-1,children:o?.fidelity?(0,$.jsxs)(`span`,{className:o.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[o.fidelity.matched,` of `,o.fidelity.required]}):t.kind===`test`?(0,$.jsx)(`span`,{className:`text-muted`,children:`Not checked yet`}):null}),(0,$.jsx)(`td`,{className:p(mt,`hidden text-body-sm text-ink-2 @3xl:table-cell`),children:(0,$.jsx)(`span`,{className:`line-clamp-2`,children:o?.problems?.[0]||o?.reason||``})}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap text-right`),children:(0,$.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(o?.output||o?.problems?.length)&&(0,$.jsx)(A,{variant:`icon`,size:`icon-sm`,"aria-label":`Output of ${In(t.target)}`,"data-tip":`Output of ${In(t.target)}`,onClick:()=>a(t.id),children:(0,$.jsx)(ye,{"aria-hidden":`true`})}),t.case&&(0,$.jsx)(A,{variant:`icon`,size:`icon-sm`,"aria-label":`Steps of ${In(t.target)}`,"data-tip":`Steps of ${In(t.target)}`,onClick:()=>i(t.case),children:(0,$.jsx)(Ve,{"aria-hidden":`true`})}),o&&(o.status===`failed`||o.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,$.jsx)(A,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Fix ${In(t.target)}`,"data-tip":`Fix ${In(t.target)}`,onClick:()=>r(t.id),children:(0,$.jsx)(ve,{"aria-hidden":`true`})})]})})]},t.id)})})}),(0,$.jsxs)(`aside`,{"aria-label":`Details`,className:p(d,`flex min-h-0 flex-col gap-4 overflow-y-auto text-body-sm`),children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`From`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?`, ${e.plan.source.project}`:``]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`To`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,$.jsx)(Lt,{framework:x,language:S.join(`-`)}),e.plan.target.title]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,"data-tip":e.targetPath,children:e.plan.target.dir})]}),(e.plan.suites||[]).length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`Suites`}),(0,$.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,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),(0,$.jsxs)(`span`,{className:p(`text-body-sm`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,Z(e.cases.length,`test`),` pass, tagged @`,e.tag]})]}),(0,$.jsx)(A,{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,$.jsx)(ue,{"aria-hidden":`true`})})]},e.name)})})]}),e.plan.env.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`Environment variables`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,$.jsxs)(`li`,{className:`flex flex-col`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-body-sm`,children:[e.name,e.secret?(0,$.jsx)(`span`,{className:`font-sans text-muted`,children:` (secret)`}):null]}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 pt-4`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,$.jsx)(`dd`,{className:`m-0 text-right`,children:Gt(l.startedAt)}),l.model&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,$.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":l.model,children:l.model})]}),l.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-right`,children:[l.reverted.length,` edits outside the target`]})]})]})]})]})]})}var Yn={fail:{icon:Ke,cls:`text-fail`,label:`Failed`},ok:{icon:q,cls:`text-pass`,label:`Done`},info:{icon:be,cls:`text-muted`,label:`Info`},agent:{icon:je,cls:`text-accent-fg`,label:`Agent`},tool:{icon:ve,cls:`text-muted`,label:`Tool`}};function Xn(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:`${ln(a)}, ${a.target} (${a.id})`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:dn[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var Zn=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function Qn({d:e,events:t,running:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(!0),[a,o]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(`all`),[u,d]=(0,Q.useState)({}),f=Xn(t,e),m=a.trim().toLowerCase(),h=e=>(c===`all`||e.kind===c)&&(!m||e.text.toLowerCase().includes(m)),g=c!==`all`||!!m,_=f.map(e=>({...e,lines:e.events.filter(h),matchTitle:!!m&&`${e.title} ${e.sub}`.toLowerCase().includes(m)})).map(e=>({...e,lines:e.matchTitle?e.events.filter(e=>c===`all`||e.kind===c):e.lines})).filter(e=>e.lines.length),v=e=>t.filter(t=>t.kind===e).length,y=f[f.length-1]?.key;return(0,Q.useEffect)(()=>{n&&!g&&i.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t.length,n,g]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(k,{id:`tosca-activity-search`,label:`Find a line`,value:a,onChange:o,placeholder:`Find a line, test case or file`}),(0,$.jsx)(j,{items:[{id:`all`,label:`All`,n:t.length},{id:`fail`,label:`Failed`,n:v(`fail`),alert:!0},{id:`ok`,label:`Done`,n:v(`ok`)},{id:`info`,label:`Info`,n:v(`info`)},{id:`agent`,label:`Agent`,n:v(`agent`)},{id:`tool`,label:`Tools`,n:v(`tool`)}],value:c,onChange:l})]}),(0,$.jsxs)(`div`,{ref:r,role:`log`,"aria-live":n?`polite`:void 0,"aria-label":`Activity`,onScroll:e=>{let t=e.currentTarget;i.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:`flex max-h-[60vh] min-h-0 flex-col overflow-y-auto border-y border-line-soft @5xl:max-h-none @5xl:flex-1`,children:[_.map(e=>{let t=e.events.filter(e=>e.kind===`fail`).length,r=u[e.key]??(g||t>0||n&&e.key===y),i=`act-${e.key.replace(/[^A-Za-z0-9_-]/g,`-`)}`,a=e.status?_n[e.status]:void 0;return(0,$.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":i,onClick:()=>d(t=>({...t,[e.key]:!r})),className:p(s,`min-w-0`),children:[(0,$.jsx)(V,{size:15,"aria-hidden":`true`,className:p(`flex-none text-muted transition-transform`,r&&`rotate-180`)}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-body-sm text-muted`,children:e.sub})]}),(0,$.jsxs)(`span`,{className:`flex-none text-body-sm text-muted tabular-nums`,children:[g&&e.lines.length!==e.events.length?`${e.lines.length} of ${Z(e.events.length,`line`)}`:Z(e.events.length,`line`),t>0&&(0,$.jsxs)(`span`,{className:`text-fail`,children:[`, `,t,` failed`]})]}),a&&(0,$.jsx)(P,{tone:a.tone,children:a.label})]}),(0,$.jsx)(Je,{open:r,id:i,children:(0,$.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=Yn[e.kind];return(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft py-2 pr-4 pl-12 text-body-sm last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`w-[76px] flex-none text-body-sm whitespace-nowrap text-muted tabular-nums`,children:Zn(e.ts)}),(0,$.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:p(`mt-1 flex-none`,n.cls)}),(0,$.jsx)(`span`,{className:p(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:e.kind===`tool`?`font-mono text-body-sm text-muted`:`text-ink-2`),children:e.text})]},t)})})})]},e.key)}),!_.length&&(0,$.jsx)(`p`,{className:`m-0 px-4 py-8 text-center text-body-sm text-muted`,children:t.length?`No line matches.`:`Nothing yet.`})]})]})}function $n({id:e,plan:t,tab:n=`overview`}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(n),u=t=>{l(t),history.replaceState(null,``,r(`migration`,...t===`overview`?[e]:[e,t]))},[d,f]=(0,Q.useState)(),[m,g]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)([]),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),[j,ee]=(0,Q.useState)(!1),[te,N]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[z,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(0),U=(0,Q.useCallback)(()=>{S.detail(e).then(e=>{a(e),s(``)},e=>s(e.message));let t=H.current;S.events(e,t).then(e=>{if(e.next<H.current){H.current=0,x([]);return}let t=H.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));H.current=e.next,n.length&&x(e=>[...e,...n].slice(-2e3))},()=>{})},[e]);(0,Q.useEffect)(U,[U]);let W=!!(i?.job?.running||i?.result?.status===`running`);(0,Q.useEffect)(()=>{if(!W)return;let e=vt(U,1500);return()=>lt(e)},[W,U]);let[G,re]=(0,Q.useState)(``),ie=(0,Q.useRef)(W);(0,Q.useEffect)(()=>{if(ie.current&&!W&&i){let e=i.plan.units.filter(e=>e.kind===`test`).length,t=(i.result?.units||[]).filter(e=>e.kind===`test`&&e.status===`converted`).length;re(`The conversion ${i.result?.status===`stopped`?`stopped`:i.result?.status===`failed`?`failed`:`finished`}: ${t} of ${e} test${e===1?``:`s`} pass.`)}W&&re(``),ie.current=W},[W,i]);let K=(0,Q.useCallback)(e=>{a(e),s(``),u(`overview`),setTimeout(U,800)},[U]),se=async e=>{w(!0),s(``);try{a(await e()),setTimeout(U,800)}catch(e){s(e.message)}finally{w(!1)}};if(!i)return o?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}):(0,$.jsx)(M,{shape:`detail`});let q=Fn(i),ce=cn(i.plan,i.result),J=i.result,le=(J?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,de=i.plan.cases.filter(e=>e.included).length,fe=[{id:`overview`,label:`Overview`},{id:`steps`,label:`Steps`,n:de?String(de):void 0},...le||c===`errors`?[{id:`errors`,label:`Errors`,n:le?String(le):void 0,tone:le?`text-fail`:void 0}]:[],{id:`activity`,label:`Activity`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-headline-sm`,children:[(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:In(i.plan.source.file)}),(0,$.jsx)(ze,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(Lt,{framework:i.plan.target.id.split(`-`)[0],language:i.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),i.plan.target.title]})]}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-1 text-body-sm text-muted`,children:[(0,$.jsxs)(`span`,{children:[`From Tricentis Tosca`,i.plan.source.project?`, ${i.plan.source.project}`:``]}),(0,$.jsxs)(`span`,{children:[`Into `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:i.plan.target.dir})]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(P,{tone:q.tone,children:q.label}),W?(0,$.jsx)(A,{variant:`danger`,size:`icon`,disabled:C,onClick:()=>void se(()=>S.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the conversion`,children:(0,$.jsx)(He,{fill:`currentColor`,"aria-hidden":`true`})}):(0,$.jsxs)($.Fragment,{children:[J&&(J.status===`stopped`||J.status===`failed`)&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:C,onClick:()=>V(!0),"aria-label":`Start again`,"data-tip":`Start again: tests it already wrote are kept`,children:(0,$.jsx)(ae,{"aria-hidden":`true`})}),J&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,onClick:()=>location.hash=r(`migration`,e,`report`),"aria-label":`Report`,"data-tip":`Report`,children:(0,$.jsx)(Ae,{"aria-hidden":`true`})}),J&&i.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:C,onClick:()=>void se(()=>S.verify(e)),"aria-label":`Run the tests`,"data-tip":`Run every converted test again, no agent`,children:(0,$.jsx)(ue,{"aria-hidden":`true`})}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:C,"aria-haspopup":`menu`,"aria-expanded":F,onClick:()=>I(!F),"aria-label":`More`,"data-tip":`More: re-import, CI, pull request, delete`,children:(0,$.jsx)(pe,{"aria-hidden":`true`})}),(0,$.jsxs)(v,{open:F,onClose:()=>I(!1),label:`More for this conversion`,align:`end`,className:`w-[240px]`,children:[J&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(h,{onClick:()=>(I(!1),k(!0)),children:[(0,$.jsx)(he,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Re-import`]}),(0,$.jsxs)(h,{onClick:()=>(I(!1),N(!0)),children:[(0,$.jsx)(ne,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`CI`]}),(0,$.jsxs)(h,{onClick:()=>(I(!1),ee(!0)),children:[(0,$.jsx)(oe,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Pull request`]}),(0,$.jsx)(`div`,{role:`separator`,className:`mx-2 my-1 border-t border-line-soft`})]}),(0,$.jsxs)(h,{onClick:()=>(I(!1),E(!0)),children:[(0,$.jsx)(B,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-fail`}),(0,$.jsx)(`span`,{className:`text-fail`,children:`Delete`})]})]})]})]})]})]}),O&&(0,$.jsx)(Ln,{d:i,onClose:()=>k(!1)}),j&&(0,$.jsx)(Bn,{id:e,onClose:()=>ee(!1)}),te&&(0,$.jsx)(zn,{id:e,onClose:()=>N(!1)}),z&&(0,$.jsx)(Cn,{plan:i.plan,acceptLimits:!1,again:!0,onClose:()=>V(!1),onStarted:e=>{V(!1),a(e)}}),L&&i.result?.batch&&(0,$.jsx)(Cn,{plan:i.plan,acceptLimits:!1,next:i.result.batch,onClose:()=>R(!1),onStarted:e=>{R(!1),a(e)}}),T&&(0,$.jsx)(Vn,{id:e,title:`${In(i.plan.source.file)} → ${i.plan.target.title}`,targetDir:i.plan.target.dir,onClose:()=>E(!1)}),(0,$.jsxs)(`div`,{className:p(`grid grid-cols-[minmax(0,1fr)] gap-6`,J&&`@3xl:grid-cols-[208px_minmax(0,1fr)] @3xl:gap-8`),children:[J&&(0,$.jsx)(`div`,{className:`@3xl:flex @3xl:flex-col @3xl:border-r @3xl:border-line-soft @3xl:pr-6`,children:(0,$.jsx)(Xt,{label:`Conversion stages`,items:nn(J.stages),...W?{progress:ce}:{}})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,$.jsx)(`p`,{role:`status`,className:`sr-only`,children:G}),o&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}),(0,$.jsx)(Ze,{prefix:`mtab`,className:`mb-0`,tabs:fe,current:c,onPick:u,label:`Tosca conversion`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${c}`,"aria-labelledby":`mtab-${c}`,className:p(`pane-swap flex min-w-0 flex-col gap-4`,J&&Kn),children:[c===`overview`&&(0,$.jsx)(Jn,{d:i,planView:t(i,K),busy:C||W,onFix:g,onSteps:e=>(f(e),u(`steps`)),onOutput:y,onRun:t=>void se(()=>S.verify(e,t)),onNext:()=>R(!0),onErrors:()=>u(`errors`)}),c===`errors`&&(0,$.jsx)(qn,{d:i,busy:C||W,onFix:g,onSteps:e=>(f(e),u(`steps`)),onOutput:y}),c===`steps`&&(0,$.jsx)(gn,{id:e,plan:i.plan,result:J,initial:d}),c===`activity`&&(0,$.jsx)(Qn,{d:i,events:b,running:W})]},c)]})]}),_&&(0,$.jsx)(Un,{d:i,unit:_,onClose:()=>y(null)}),m&&(0,$.jsx)(Hn,{d:i,unit:m,onClose:()=>g(null),onSend:t=>{g(null),se(()=>S.fix(e,[m],t))}})]})}var er=e=>e.slice(e.lastIndexOf(`/`)+1),tr=50,nr=[{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 rr(e){return e===`converted`?_n.converted:e===`failed`?_n.failed:e===`blocked`?_n.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?_n.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function ir(e){for(let t of an){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function ar({planId:e,unit:t,file:n}){let r=/\.(webm|mp4)$/i.test(n),[i,a]=(0,Q.useState)(!r),[o,s]=(0,Q.useState)(``),[l,d]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!i)return;let r=!1;return s(``),d(!1),S.evidence(e,t,n).then(e=>!r&&s(e),()=>!r&&d(!0)),()=>{r=!0}},[e,t,n,i]),(0,$.jsxs)(`li`,{className:p(`flex min-w-0 flex-col gap-2`,r&&`@xl:col-span-2`),children:[o?r?(0,$.jsx)(`video`,{controls:!0,autoPlay:!0,src:o,className:p(c,`aspect-video w-full object-contain`)}):(0,$.jsx)(`img`,{src:o,alt:`Screenshot ${n}`,className:p(c,`w-full object-contain`)}):r&&!i?(0,$.jsx)(`button`,{type:`button`,onClick:()=>a(!0),"aria-label":`Play ${n}`,className:p(c,`group flex aspect-video w-full cursor-pointer items-center justify-center border-0`),children:(0,$.jsx)(`span`,{className:p(u,`inline-flex size-16 items-center justify-center rounded-full transition-transform group-hover:scale-105`),children:(0,$.jsx)(ue,{size:24,"aria-hidden":`true`,className:`ml-1 text-ink`})})}):l?(0,$.jsx)(`span`,{role:`status`,className:p(c,`flex items-center justify-center text-body-sm text-muted`,r?`aspect-video`:`h-[160px]`),children:`Not available`}):(0,$.jsxs)(`span`,{role:`status`,className:`block`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`Loading…`}),(0,$.jsx)(te,{className:p(`w-full rounded-md`,r?`aspect-video h-auto`:`h-[160px]`)})]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:n})]})}function or({planId:e,pick:t,video:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{let n=!1;return i(null),o(``),S.reportCase(e,t.case).then(e=>!n&&i(e),e=>!n&&o(e.message)),()=>{n=!0}},[e,t.case]);let s=rr(t.status),c=t.group===`failed`||t.group===`attention`,l=ur[t.group];return(0,$.jsxs)(`section`,{"aria-label":`Test case ${t.name}`,className:`@container flex min-w-0 flex-col gap-8`,children:[(0,$.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,$.jsx)(l.icon,{size:24,"aria-label":l.label,className:p(`translate-y-0.5 flex-none`,l.tone)}),(0,$.jsx)(`h3`,{className:`m-0 min-w-0 flex-1 text-headline-sm [overflow-wrap:anywhere]`,children:t.name}),(0,$.jsx)(P,{tone:s.tone,children:s.label}),t.ms>0&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-muted tabular-nums`,children:[(0,$.jsx)(de,{size:14,"aria-hidden":`true`}),Jt(t.ms)]})]}),(0,$.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-body-sm text-ink-2`,children:[(0,$.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Me,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`File`}),(0,$.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.file||`No file`})]}),t.suites.length>0&&(0,$.jsxs)(`li`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(Be,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Suite`}),t.suites.join(`, `)]}),t.folders.length>0&&(0,$.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(R,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Folder`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.folders.join(` / `)})]}),t.uid&&(0,$.jsxs)(`li`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(re,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Tosca id`}),(0,$.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:t.uid})]}),t.change&&(0,$.jsx)(`li`,{className:`inline-flex items-center gap-2 text-muted`,children:sr[t.change]})]})]}),a&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:a}),!r&&!a&&(0,$.jsx)(M,{shape:`lines`,count:5}),r&&(0,$.jsxs)($.Fragment,{children:[(r.problems?.length||r.reason)&&(0,$.jsx)(mn,{icon:c?H:Ge,title:c?`What went wrong`:`What happened`,children:(0,$.jsx)(`div`,{className:p(D[c?`fail`:`info`],`flex flex-col gap-2 leading-relaxed`),children:(r.problems?.length?r.problems:[r.reason]).map((e,t)=>(0,$.jsx)(`p`,{className:`m-0`,children:e},t))})}),(0,$.jsx)(mn,{icon:U,title:n?`Recording`:`Screenshots`,children:r.media.length>0?(0,$.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-4 p-0 @xl:grid-cols-2`,children:r.media.map(t=>(0,$.jsx)(ar,{planId:e,unit:r.unit,file:t},t))}):(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:r.unit&&r.group!==`notrun`?c?`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.`})}),r.fidelity&&r.fidelity.rows.length>0&&(0,$.jsx)(mn,{icon:we,title:`Tosca steps`,aside:`${r.fidelity.matched} of ${r.fidelity.required} in the test`,children:(0,$.jsx)(Dt,{label:`Tosca steps`,placeholder:`Find a step`,sortable:!1,resetKey:t.case,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-14`),children:`Step`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`What it does`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`In the test`})]}),children:r.fidelity.rows.map(e=>{let t=un[e.status]||un.matched;return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`font-mono text-body-sm text-muted`),children:e.id}),(0,$.jsxs)(`td`,{className:p(`px-4 py-2`,`[overflow-wrap:anywhere]`),children:[e.kind===`assert`?`check ${e.op}`:e.op,e.element?` on ${e.element}`:``,e.step&&(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Tosca “`,e.step,`”`]})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`whitespace-nowrap`),children:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`size-2 flex-none rounded-full`,t.dot)}),t.label]})})]},e.id)})})}),(r.command||r.output)&&(0,$.jsx)(mn,{icon:Ie,title:`How it ran`,children:(0,$.jsx)(F,{label:`How the test ran`,className:`max-h-[50vh]`,files:[...r.output?[{name:`Output`,code:r.output,log:!0}]:[],...r.command?[{name:`Command`,code:`$ ${r.command}`,lang:`bash`}]:[]]})})]})]})}var sr={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},cr=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function lr(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(` / `),rr(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?sr[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(cr).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 ur={failed:{icon:Ke,tone:`text-fail`,label:`Failed`},attention:{icon:H,tone:`text-warn`,label:`Needs a look`},passed:{icon:q,tone:`text-pass`,label:`Passed`},notrun:{icon:ce,tone:`text-muted`,label:`Not run`},leftout:{icon:le,tone:`text-muted`,label:`Left out`}};function dr({rows:e,pick:t,onPick:n}){let r=()=>Math.max(0,Math.floor(e.findIndex(e=>e.case===t)/tr)),[i,a]=(0,Q.useState)(r);(0,Q.useEffect)(()=>a(r()),[e.length]);let o=e.slice(i*tr,i*tr+tr);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>{let r=ur[e.group],i=t===e.case;return(0,$.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>n(e),className:p(s,`relative min-w-0 items-start gap-2 overflow-hidden`),children:[i&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-1 bg-accent`}),(0,$.jsx)(r.icon,{size:16,"aria-label":r.label,className:p(`translate-y-0.5 flex-none`,r.tone)}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate font-mono text-body-sm text-muted`,children:e.file||`No file`}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-4 text-body-sm text-muted tabular-nums`,children:[e.fidelity&&(0,$.jsxs)(`span`,{children:[e.fidelity.matched,`/`,e.fidelity.required,` steps`]}),e.ms>0&&(0,$.jsx)(`span`,{children:Jt(e.ms)}),e.media>0&&(0,$.jsx)(`span`,{children:Z(e.media,`file`)})]}),e.note&&e.group!==`passed`&&(0,$.jsx)(`span`,{className:p(`line-clamp-2 text-body-sm`,e.group===`failed`?`text-fail`:`text-ink-2`),children:e.note})]})]})},e.case)})}),e.length>tr&&(0,$.jsx)(T,{page:i,size:tr,total:e.length,onPage:a,label:`Test case pages`})]})}function fr({id:e,caseId:t,tab:n=`summary`}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!0),[u,d]=(0,Q.useState)(`all`),[f,m]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(!1),w=(...t)=>r(`migration`,e,`report`,...t),T=e=>location.hash=e===`summary`?w():e===`cases`&&g?w(encodeURIComponent(g)):w(`tab`,e),[E,O]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{l(!0),S.report(e).then(e=>{if(a(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`);_(n?n.case:``)}},e=>{s(e.message),l(!1)})},[e]),(0,Q.useEffect)(()=>{g&&n===`cases`&&history.replaceState(null,``,w(encodeURIComponent(g)))},[e,g,n]);let ee=f.trim().toLowerCase(),te=(0,Q.useMemo)(()=>{let e={failed:[],attention:[],passed:[],notrun:[],leftout:[]};for(let t of i?.tests||[])u!==`all`&&t.group!==u||ee&&!`${t.name} ${t.file} ${t.case} ${t.note||``} ${t.suites.join(` `)} ${t.folders.join(` `)}`.toLowerCase().includes(ee)||e[t.group].push(t);return e},[i,u,ee]),N=async t=>{b(t),O(``);try{let n=await(t===`zip`?S.reportZip(e):S.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){O(e.message)}finally{b(``)}};if(c)return(0,$.jsx)(M,{shape:`detail`,label:`Loading report…`});if(o||!i)return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o||`No report.`})});let F=fn[i.status]||{label:i.status,tone:`neutral`},[I,...L]=i.target.id.split(`-`),R=ir(i.stages),z=i.tests.length-i.counts.leftout,B=i.tests.find(e=>e.case===g)||null,U=nr.reduce((e,t)=>e+te[t.id].length,0),W=i.tests.filter(e=>e.group===`failed`||e.group===`attention`),G=e=>(_(e.case),location.hash=w(encodeURIComponent(e.case))),ne=i.status===`running`?{tone:`running`,text:`Converting: ${i.counts.passed} of ${z} test cases pass so far.`}:W.length===0&&i.counts.passed===z&&z>0?{tone:`pass`,text:`All ${z===1?``:`${z} `}Tosca test case${z===1?``:`s`} became passing ${i.target.title} tests.`}:{tone:i.counts.failed?`fail`:`warn`,text:`${i.counts.passed} of ${z} test cases pass${[i.counts.failed?`${i.counts.failed} failed`:``,i.counts.attention?`${i.counts.attention} need${i.counts.attention===1?`s`:``} a look`:``,i.counts.notrun?`${i.counts.notrun} not run`:``].filter(Boolean).map((e,t)=>t?`, ${e}`:`; ${e}`).join(``)}.`},re=ne.tone===`pass`?q:ne.tone===`running`?De:H,ie=[{id:`summary`,label:`Summary`},{id:`cases`,label:`Test cases`,n:i.tests.length},{id:`coverage`,label:`Coverage`},{id:`trace`,label:`Traceability`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:`Conversion report`}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:er(i.source.file)}),(0,$.jsx)(ze,{size:14,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Lt,{framework:I,language:L.join(`-`),size:14}),i.target.title]})]})]}),(0,$.jsx)(P,{tone:F.tone,children:F.label}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsxs)(A,{busy:y===`html`,variant:`ghost`,disabled:!!y,"aria-haspopup":`menu`,"aria-expanded":x,onClick:()=>C(!x),children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),y===`html`?`Making the report…`:y===`zip`?`Making the zip…`:`Export`,(0,$.jsx)(V,{"aria-hidden":`true`})]}),(0,$.jsxs)(v,{open:x,onClose:()=>C(!1),label:`Export this report`,align:`end`,className:`w-[280px]`,children:[(0,$.jsxs)(h,{onClick:()=>(C(!1),void N(`html`)),children:[(0,$.jsx)(We,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`HTML report, screenshots inside`]}),(0,$.jsxs)(h,{onClick:()=>(C(!1),i.status===`running`?O(`The zip is made when the run ends.`):void N(`zip`)),children:[(0,$.jsx)(Ne,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Zip with videos`]}),(0,$.jsxs)(h,{onClick:()=>(C(!1),lr(i)),children:[(0,$.jsx)(Ce,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Traceability CSV, for Tosca`]})]})]})]}),E&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:E}),(0,$.jsx)(Ze,{prefix:`rtab`,className:`mb-0`,tabs:ie,current:n,onPick:T,label:`Report`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${n}`,"aria-labelledby":`rtab-${n}`,className:`pane-swap flex min-w-0 flex-col gap-8`,children:[n===`summary`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{"aria-label":`Outcome`,className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`p`,{className:p(`m-0 flex items-start gap-4 text-headline-sm`,ne.tone===`pass`?`text-ink`:ne.tone===`fail`?`text-fail`:`text-ink`),children:[(0,$.jsx)(re,{size:24,"aria-hidden":`true`,className:p(`translate-y-0.5 flex-none`,ne.tone===`pass`?`text-pass`:ne.tone===`fail`?`text-fail`:ne.tone===`warn`?`text-warn`:`text-ink motion-safe:animate-spin`)}),ne.text]}),(0,$.jsx)(Yt,{label:`The conversion`,from:{framework:`tosca`,title:`Tosca${i.source.project?`, ${i.source.project}`:``}`,sub:i.source.file},to:{framework:I,language:L.join(`-`),title:i.target.title,sub:`Into ${i.target.dir}/`}}),(0,$.jsxs)($e,{label:`The run in numbers`,children:[(0,$.jsx)(dt,{label:`Passed`,value:`${i.counts.passed} of ${z}`,tone:i.counts.passed===z?`text-pass`:void 0,note:i.counts.leftout?`${i.counts.leftout} left out of the plan`:`Every test case in the plan`}),(0,$.jsx)(dt,{label:`Tosca steps kept`,value:i.steps.required?`${Math.round(i.steps.matched/i.steps.required*100)}%`:`—`,note:i.steps.required?`${i.steps.matched} of ${i.steps.required} steps and checks`:`No steps to keep`}),(0,$.jsx)(dt,{label:`Time`,value:Jt(i.ms),note:`Started ${Gt(i.startedAt)}`}),(0,$.jsx)(dt,{label:`Model cost`,value:i.cost?`${i.cost.estimate?`~`:``}${Et(i.cost.amount,i.cost.currency)}`:`—`,note:[i.model||`Model not recorded`,i.usage.input||i.usage.output?`${Tt(i.usage.input+i.usage.output)} tokens`:``].filter(Boolean).join(`, `)})]})]}),(0,$.jsxs)(`section`,{"aria-labelledby":`rep-attention`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-attention`,className:`m-0 text-body-lg font-medium`,children:`Needs your attention`}),R&&(0,$.jsxs)(`p`,{role:`status`,className:p(D.fail,`m-0`),children:[`The run stopped in `,dn[R.id],R.note?`: ${R.note}`:`.`]}),W.length===0&&!i.personSteps?(0,$.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(q,{size:16,"aria-hidden":`true`,className:`text-pass`}),`Nothing needs attention: every test case that ran passed, with its Tosca steps kept.`]}):(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[W.map(e=>(0,$.jsx)(`li`,{className:`border-b border-line-soft last:border-b-0`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>G(e),className:p(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`items-start`),children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`,className:p(`translate-y-0.5 flex-none`,e.group===`failed`?`text-fail`:`text-warn`)}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.note||rr(e.status).label})]}),(0,$.jsx)(ze,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-muted`})]})},e.case)),i.personSteps>0&&(0,$.jsxs)(`li`,{className:`flex items-start gap-4 py-4 text-body-sm text-ink-2`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`,className:`translate-y-0.5 flex-none text-warn`}),Z(i.personSteps,`Tosca step`),` could not be automated and `,i.personSteps===1?`is`:`are`,` left for a person: see Coverage.`]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-8 @3xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{"aria-labelledby":`rep-written`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-written`,className:`m-0 text-body-lg font-medium`,children:`What was written`}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-body-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Tests`}),(0,$.jsxs)(`dd`,{className:`m-0 text-ink`,children:[Z(z,`test file`),` in `,(0,$.jsxs)(`span`,{className:`font-mono`,children:[i.target.dir,`/`]})]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Page objects`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:i.pages.length?Z(i.pages.length,`page`):`None`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Media`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:i.media?Z(i.media,`file`):i.target.video?`Videos and failure screenshots`:`Failure screenshots`}),i.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-ink`,children:[Z(i.reverted.length,`edit`),` outside the target folder`]})]})]})]}),(0,$.jsxs)(`section`,{"aria-labelledby":`rep-needs`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-needs`,className:`m-0 text-body-lg font-medium`,children:`What the tests need to run`}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-body-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`App`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:i.source.baseUrl||`Not named`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Variables`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:i.env.length?i.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `):`None`})]})]})]}),(i.previous||i.removed.length>0)&&(0,$.jsxs)(`p`,{className:p(`m-0 leading-relaxed`,D.info),children:[i.previous?(0,$.jsxs)($.Fragment,{children:[`Re-imported from `,(0,$.jsx)(`a`,{href:r(`migration`,i.previous,`report`),children:i.previous}),`: `,i.tests.filter(e=>e.change===`same`).length,` unchanged (their tests kept), `,i.tests.filter(e=>e.change===`changed`).length,` changed, `,i.tests.filter(e=>e.change===`new`).length,` new.`,` `]}):null,i.removed.length>0&&(0,$.jsxs)($.Fragment,{children:[Z(i.removed.length,`test case`),` no longer in the exports; their tests are left as they are.`]})]}),i.notes.trim()&&(0,$.jsxs)(`section`,{"aria-labelledby":`rep-notes`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`rep-notes`,className:`m-0 text-body-lg font-medium`,children:`Notes from the conversion`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:i.notes.trim()})]})]}),n===`cases`&&(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(300px,360px)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,$.jsx)(k,{id:`tosca-report-search`,label:`Find a test case`,value:f,onChange:m,placeholder:`Find a test case, file or problem`,className:`max-w-none flex-none`}),(0,$.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex flex-wrap gap-1`,children:(0,$.jsx)(j,{items:[{id:`all`,label:`All`,n:i.tests.length},...nr.filter(e=>i.counts[e.id]>0).map(e=>({id:e.id,label:e.label,n:i.counts[e.id],alert:e.id===`failed`}))],value:u,onChange:d})}),(0,$.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:U?(0,$.jsx)(dr,{rows:nr.flatMap(e=>te[e.id]),pick:g,onPick:e=>_(e.case)}):(0,$.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-body-sm text-muted`,children:`No test case matches.`})})]}),(0,$.jsx)(`div`,{className:`min-w-0 @5xl:sticky @5xl:top-4`,children:B?(0,$.jsx)(`div`,{className:`pane-swap`,children:(0,$.jsx)(or,{planId:i.id,pick:B,video:i.target.video})},B.case):(0,$.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-body-sm text-muted`,children:`Pick a test case to see its steps, output and media.`})})]}),n===`coverage`&&(0,$.jsxs)(`section`,{"aria-labelledby":`rep-cov`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`rep-cov`,className:`m-0 text-body-lg font-medium`,children:`How much of each Tosca test case is in its test`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm 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,$.jsx)(Dt,{label:`Coverage by test case`,placeholder:`Find a test case`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Tosca steps in the test`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Result`})]}),children:i.tests.filter(e=>e.group!==`leftout`).map(e=>{let t=e.fidelity,n=t&&t.required?t.matched/t.required*100:0;return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(A,{variant:`link`,size:`inline`,onClick:()=>G(e),className:`whitespace-normal text-left`,children:e.name})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,"data-sort":t?n:-1,children:t?(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:(0,$.jsx)(en,{value:n,marks:[.8,1],tone:n===100?`bg-pass`:n>=80?`bg-warn`:`bg-fail`,label:`${e.name}: ${t.matched} of ${t.required} Tosca steps`})}),(0,$.jsxs)(`span`,{className:`w-16 flex-none text-right text-body-sm tabular-nums text-ink-2`,children:[t.matched,`/`,t.required]})]}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not checked`})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(P,{tone:rr(e.status).tone,children:rr(e.status).label})})]},e.case)})})]}),n===`trace`&&(0,$.jsxs)(`section`,{"aria-labelledby":`rep-trace`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`rep-trace`,className:`m-0 text-body-lg font-medium`,children:`Each Tosca test case and what it became`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`By its Tosca id and path, for audits and for Tosca itself. Export gives the same as a CSV.`})]}),(0,$.jsx)(A,{variant:`icon`,size:`icon`,onClick:()=>lr(i),"aria-label":`Download as CSV`,"data-tip":`Download as CSV`,children:(0,$.jsx)(Ne,{"aria-hidden":`true`})})]}),(0,$.jsx)(Dt,{label:`Traceability`,placeholder:`Find a Tosca id, test case or file`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Tosca test case`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test file`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @3xl:table-cell`),children:`Execution lists`})]}),children:i.tests.map(e=>(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`span`,{className:`block text-body-sm font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.folders.join(` / `)||`—`}),e.uid&&(0,$.jsx)(`span`,{className:`block font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.uid})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`),children:e.file||`—`}),(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(P,{tone:rr(e.status).tone,children:rr(e.status).label}),e.change&&(0,$.jsx)(`span`,{className:`mt-1 block text-body-sm text-muted`,children:sr[e.change]})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-body-sm text-ink-2 @3xl:table-cell`),children:e.suites.join(`, `)||`—`})]},e.case))})]})]},n)]})}var pr={converted:{icon:q,cls:`text-pass`,label:`Converted`},partly:{icon:se,cls:`text-warn`,label:`Converted, with steps for a person`},not:{icon:Ke,cls:`text-muted`,label:`Not converted`}},mr=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function hr(e,t,n){let r=[[`Test case id`,`Test case`,`Kind`,`What happens`,`Modules behind it`].map(mr).join(`,`)];for(let n of e.rows)for(let e of n.cases)r.push([e,t.get(e)||e,n.label,pr[n.outcome].label,n.modules.map(e=>e.name).join(`; `)].map(mr).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 gr({coverage:e,names:t,file:n,folded:r=!1}){let i=e.converted+e.partly,[a,o]=(0,Q.useState)(!r),s=(0,Q.useId)();return(0,$.jsx)(gt,{id:`tsc-coverage`,level:3,icon:ke,title:`What can be migrated`,description:(0,$.jsxs)(`span`,{className:`text-ink-2`,children:[i,` 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,$.jsxs)($.Fragment,{children:[r&&(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,"aria-expanded":a,"aria-controls":s,onClick:()=>o(!a),children:[(0,$.jsx)(V,{"aria-hidden":`true`,className:p(`transition-transform`,a&&`rotate-180`)}),a?`Hide the breakdown`:`Show the breakdown`]}),(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:()=>hr(e,t,n),"data-tip":`Every test case with its kind and what happens to it, for a spreadsheet.`,children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),`CSV`]})]}),children:(0,$.jsx)(Je,{open:a,id:s,children:(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-body-sm`,children:e.rows.map(e=>{let t=pr[e.outcome];return(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,$.jsx)(t.icon,{size:16,role:`img`,"aria-label":t.label,className:p(`mt-1 flex-none`,t.cls)}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,$.jsx)(`span`,{className:`font-medium text-ink`,children:e.label}),(0,$.jsx)(`span`,{className:`tabular-nums text-ink-2`,children:e.cases.length===1?`1 test case`:`${e.cases.length} test cases`})]}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:e.becomes}),e.modules.length>0&&(0,$.jsxs)(`span`,{className:`text-body-sm 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,$.jsxs)(`span`,{className:`text-body-sm 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 _r={ok:{icon:q,cls:`text-pass`,label:`Ready`},answer:{icon:se,cls:`text-warn`,label:`Needs an answer`},blocker:{icon:Ke,cls:`text-fail`,label:`Blocks the start`}};function vr({planId:e,stamp:t,busy:n,open:r,onChanged:a,onAccept:s,acceptTip:c}){let[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{S.data(e).then(e=>{u(e),v(``)},e=>v(e.message))},[e,t]);let y=async t=>{g(!0),v(``);try{u(await S.setData(e,t)),f(``),m(``),a()}catch(e){v(e.message)}finally{g(!1)}},b=n||h,x=l?[...new Set(l.cases.flatMap(e=>e.missing))]:[];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[l&&l.sources.length>0&&(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:l.sources.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.file}),e.sheet?` (sheet ${e.sheet})`:``,`: `,Z(e.rows,`row`),e.transposed?`, attributes down the first column`:``]}),(0,$.jsx)(A,{variant:`link`,size:`inline`,"aria-label":`Remove ${e.file}${e.sheet?`, sheet ${e.sheet}`:``}`,disabled:b,onClick:()=>void y({remove:t}),children:`Remove`})]},`${e.file}\u0000${e.sheet||``}`))}),l&&x.length>0&&(0,$.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Not found yet: `,(0,$.jsx)(`span`,{className:`font-mono`,children:x.slice(0,12).join(`, `)}),x.length>12?` and ${x.length-12} more`:``]}),r&&(0,$.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d&&y({file:d,...p.trim()?{sheet:p.trim()}:{}})},children:[(0,$.jsxs)(i,{size:`sm`,"aria-label":`A data file of the project`,value:d,disabled:b||!l,onChange:e=>f(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,$.jsx)(`option`,{value:``,children:l&&!l.files.length?`No CSV, TSV, Excel or JSON file in the project`:`A data file of the project…`}),(l?.files||[]).map(e=>(0,$.jsx)(`option`,{value:e.path,children:e.path},e.path))]}),/\.xls[xm]$/i.test(d)&&(0,$.jsx)(o,{size:`sm`,"aria-label":`Sheet, the first if empty`,placeholder:`Sheet, the first if empty`,value:p,onChange:e=>m(e.target.value),disabled:b,className:`min-w-0 flex-[1_1_160px]`}),(0,$.jsx)(A,{size:`sm`,type:`submit`,disabled:b||!d,children:`Use it`}),s&&(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:b,onClick:s,"data-tip":c,children:`Leave them for a person`})]}),_&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-body-sm text-fail`,children:_})]})}function yr({r:e,busy:t,onAnswer:n}){let[r,a]=(0,Q.useState)(``),s=String(e.environments.findIndex(t=>t.environment===e.answers.environment&&t.app===e.answers.app));return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[e.environments.length>0&&(0,$.jsxs)(i,{size:`sm`,"aria-label":`An app of env.yaml`,value:s,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,$.jsx)(`option`,{value:`-1`,children:`An app of env.yaml…`}),e.environments.map((e,t)=>(0,$.jsxs)(`option`,{value:String(t),children:[e.app,` on `,e.environment,`: `,e.url]},`${e.environment}\u0000${e.app}`))]}),(0,$.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,$.jsx)(o,{size:`sm`,type:`url`,"aria-label":`Or the address the tests start at`,placeholder:`Or the address, https://…`,value:r,onChange:e=>a(e.target.value),disabled:t,className:`min-w-0 flex-1`}),(0,$.jsx)(A,{size:`sm`,type:`submit`,disabled:t||!r.trim(),children:`Use it`})]})]})}function br({item:e,picked:t,busy:n,onPick:a}){let o=e.apps||[];return o.length?(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:(0,$.jsxs)(i,{size:`sm`,"aria-label":e.engine===`database`?`A database`:e.engine===`mobile`?`A mobile app`:`A desktop app`,value:t&&o.includes(t)?t:``,disabled:n,onChange:e=>e.target.value&&a(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,$.jsx)(`option`,{value:``,children:e.engine===`database`?`A database…`:e.engine===`mobile`?`A mobile app…`:`A desktop app…`}),o.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})}):(0,$.jsxs)(`p`,{className:`m-0 pt-1 text-body-sm text-muted`,children:[e.engine===`database`?`No databases yet: add one in `:`No ${e.engine} apps yet: add one in `,(0,$.jsx)(`a`,{href:r(`settings`,e.engine===`database`?`databases`:`environments`),children:e.engine===`database`?`Settings, Databases`:`Settings, Environments`}),`.`]})}function xr({item:e,busy:t,secrets:n,onSaved:r,onAccept:a,onUse:s}){let[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),g=async()=>{p(!0),h(``);try{await x.saveSecrets({[e.name]:c}),l(``),r()}catch(e){h(e.message)}finally{p(!1)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[(0,$.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),c&&g()},children:[(0,$.jsx)(o,{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:c,onChange:e=>l(e.target.value),disabled:t||f,className:`min-w-0 flex-[1_1_220px]`}),(0,$.jsx)(A,{size:`sm`,variant:`primary`,type:`submit`,disabled:t||f||!c,children:`Save`}),e.accept&&(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:t||f,onClick:a,"data-tip":e.accept,children:`Convert without it`})]}),n.length>0&&!e.uses&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`use-${e.name}`,className:`text-body-sm text-muted`,children:`Or use a saved secret`}),(0,$.jsxs)(i,{id:`use-${e.name}`,size:`sm`,value:u,disabled:t||f,onChange:e=>d(e.target.value),className:`w-auto min-w-[200px] font-mono`,children:[(0,$.jsx)(`option`,{value:``,children:`A saved secret…`}),n.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),(0,$.jsx)(A,{size:`sm`,disabled:t||f||!u,onClick:()=>s(u),children:`Use it`})]}),m&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-body-sm text-fail`,children:m})]})}function Sr({planId:e,onReady:t,onCoverage:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),l=(0,Q.useCallback)(e=>{i(e.readiness),t?.(e.readiness.ready),n?.(e.coverage)},[t,n]),u=(0,Q.useCallback)(()=>{S.ready(e).then(l,e=>c(e.message))},[e,l]);(0,Q.useEffect)(()=>{i(null),c(``),t?.(!1)},[e]),(0,Q.useEffect)(u,[u]);let d=async t=>{o(!0),c(``);try{l(await S.answer(e,t))}catch(e){c(e.message)}finally{o(!1)}};return(0,$.jsxs)(gt,{id:`tsc-ready`,level:3,icon:Pe,title:`Before it runs`,description:(0,$.jsx)(`span`,{role:`status`,className:p(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,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:u,disabled:a,"data-tip":`Check again, after installing a program or setting a variable.`,children:[(0,$.jsx)(he,{"aria-hidden":`true`}),`Check again`]}),children:[s&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:s}),r&&(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-body-sm`,children:r.items.map(t=>{let n=_r[t.level];return(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,$.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:p(`mt-1 flex-none`,n.cls)}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:p(`font-medium text-ink`,t.kind===`env`||t.kind===`tool`?`font-mono text-body-sm`:``),children:t.title}),(0,$.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:t.text}),t.accepted&&(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-warn`,children:[`Accepted: `,t.accept,(0,$.jsx)(A,{variant:`link`,size:`inline`,disabled:a,onClick:()=>void d({unaccept:[t.id]}),children:`Undo`})]}),t.kind===`url`&&(0,$.jsx)(yr,{r,busy:a,onAnswer:e=>void d(e)}),t.kind===`app`&&t.engine&&(0,$.jsx)(br,{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,$.jsx)(xr,{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,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,$.jsxs)(`span`,{children:[`Uses the saved secret `,(0,$.jsx)(`span`,{className:`font-mono`,children:t.uses}),`.`]}),(0,$.jsx)(A,{variant:`link`,size:`inline`,disabled:a,onClick:()=>void d({use:{name:t.name,secret:``}}),children:`Stop using it`})]}),t.kind===`data`&&(0,$.jsx)(vr,{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 Cr=/^[a-f0-9]{16}$/,wr=`forgeqe.tosca.assistant`;function Tr(){try{let e=localStorage.getItem(wr)||``;return Cr.test(e)?e:``}catch{return``}}function Er(e){try{e?localStorage.setItem(wr,e):localStorage.removeItem(wr)}catch{}}var Dr=[/\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],Or=e=>e.replace(/^.*\//,``).replace(/\.tsu$/i,``);function kr(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:Be,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:Me,title:`${Or(t)} to Selenium`,hint:`One export, in Java, with page objects`,text:`Migrate ${Or(t)} to Selenium in Java, with page objects`}),t&&r.push({icon:K,title:`${Or(t)} to Cypress`,hint:`Into a folder of its own`,text:`Migrate ${Or(t)} to Cypress in TypeScript, into e2e/tosca`}),r.push({icon:Te,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 Ar({view:e,sid:t,onSid:n}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=it();(0,Q.useEffect)(()=>{t&&i?.id!==t&&C.view(t).then(a,()=>{n(``),Er(``)})},[t]),(0,Q.useEffect)(()=>{if(!i?.thinking&&!i?.checking)return;let e=setTimeout(()=>C.view(i.id).then(a,e=>l(e.message)),1200);return()=>clearTimeout(e)},[i]);let g=i?.messages.length??0;(0,Q.useEffect)(()=>{g&&m.current?.scrollIntoView({block:`nearest`,behavior:f()})},[g,i?.thinking]);let v=e=>{s(e),setTimeout(()=>document.getElementById(`tosca-agent-box`)?.focus(),0)},y=async e=>{d(!0),l(``);try{let r=await e();return a(r),r.id!==t&&(n(r.id),Er(r.id)),!0}catch(e){return l(e.message),!1}finally{d(!1)}},b=async e=>{!e.trim()||u||i?.thinking||(Dr.some(t=>t.test(e))?(s(``),l(`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 y(()=>i?C.say(i.id,e):C.start(e))&&s(``))},x=()=>{i&&C.end(i.id).catch(()=>{}),a(null),s(``),l(``),n(``),Er(``)},S=()=>i?.prefill&&(location.hash=r(`migration`,`new`,i.id)),w=!i,T=u||!!i?.thinking;return(0,$.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:[w?(0,$.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,$.jsx)(_,{agent:`forgeqe-tosca`,px:h?72:112,working:T,className:`mb-1`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:`What do you want to migrate from Tosca?`}),(0,$.jsx)(`p`,{className:`m-0 text-body-lg 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,$.jsx)(Ir,{view:e}),(0,$.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:kr(e).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(e.text),className:p(kt,`items-start`),children:[(0,$.jsx)(O,{icon:e.icon,size:18,className:`mt-1 text-icon`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.hint})]})]},e.title))}),(0,$.jsxs)(`a`,{href:r(`migration`,`new`),className:`inline-flex items-center gap-2 text-body-sm`,children:[(0,$.jsx)(Re,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]}):(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,$.jsxs)(`section`,{"aria-label":`Conversation with Guide`,className:`flex min-w-0 flex-col gap-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:i.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,$.jsx)(A,{size:`sm`,variant:`ghost`,onClick:x,disabled:u,children:`New conversation`})]}),(0,$.jsxs)(`ol`,{"aria-live":`polite`,className:`m-0 flex list-none flex-col gap-6 p-0`,children:[i.messages.map((e,t)=>(0,$.jsx)(`li`,{className:`fade-quick`,children:e.role===`person`?(0,$.jsx)(ct,{text:e.text}):(0,$.jsx)(jr,{text:e.text})},t)),i.thinking&&(0,$.jsx)(`li`,{className:`fade-quick`,children:(0,$.jsx)(jr,{text:i.working===`cloning`?`Cloning the repository and looking for Tosca exports…`:`Reading what you said…`,working:i.working===`cloning`?`cloning`:`reading`})})]}),!i.thinking&&i.question?.id===`clone`&&i.clone&&(0,$.jsx)(Nr,{c:i.clone,disabled:u,onToken:e=>y(()=>C.token(i.id,e)),onPick:e=>void y(()=>C.pick(i.id,`clone`,[e]))},`clone-${g}`),!i.thinking&&i.question&&i.question.id!==`clone`&&i.question.options.length>0&&(0,$.jsx)(Mr,{q:i.question,disabled:u,onPick:e=>void y(()=>C.pick(i.id,i.question.id,e)).then(()=>document.getElementById(`tosca-agent-box`)?.focus())},`${i.question.id}-${g}`),!i.thinking&&i.prefill&&(0,$.jsxs)(`div`,{className:p(D.info,`fade-quick flex flex-wrap items-center gap-4`),children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm text-ink`,children:i.question?`The wizard can open now; the rest is optional.`:`Everything is ready.`}),(0,$.jsxs)(A,{variant:`primary`,onClick:S,children:[`Open the prefilled wizard`,(0,$.jsx)(ze,{"aria-hidden":`true`})]})]}),(0,$.jsx)(`div`,{ref:m})]}),(0,$.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,$.jsx)(Pr,{v:i})})]}),(0,$.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-auto flex flex-col bg-gradient-to-t from-canvas from-85% to-transparent pt-6 pb-4`,children:[c&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 bg-bg pb-2 text-body-sm text-fail [overflow-wrap:anywhere]`,children:c}),(0,$.jsx)(Xe,{id:`tosca-agent-box`,label:`Tell Guide`,value:o,onChange:e=>{s(e),l(``)},onSend:()=>void b(o),busy:u,disabled:T,placeholder:w?`Migrate checkout.tsu to Playwright in TypeScript, on QA…`:`Answer, or change anything you said…`})]})]})}function jr({text:e,working:t}){return(0,$.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,$.jsx)(N,{state:t?`working`:`idle`,px:28,label:t?`Guide is ${t}`:`Guide`,className:`mt-1 flex-none`}),(0,$.jsx)(`p`,{className:p(`m-0 text-body-lg leading-relaxed whitespace-pre-line [overflow-wrap:anywhere]`,t?`text-muted`:`text-ink-2`),children:e})]})}function Mr({q:e,disabled:t,onPick:n}){let[r,i]=(0,Q.useState)([]);return(0,$.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.multi?(0,$.jsx)(w,{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,$.jsxs)(A,{size:`sm`,variant:e.id===`skip`?`ghost`:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.label,e.hint&&(0,$.jsx)(`span`,{className:`text-body-sm font-normal text-muted`,children:e.hint})]},e.id))}),e.multi&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.options.some(e=>!e.action)&&(0,$.jsxs)(A,{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,$.jsxs)(A,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.id===`git`&&(0,$.jsx)(J,{"aria-hidden":`true`}),e.label]},e.id)),e.typed&&e.options.some(e=>!e.action)&&(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Or type the names below.`})]})]})}function Nr({c:e,disabled:t,onToken:n,onPick:a}){let[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(``),h=[...new Set([...e.credentials,...e.tokenVar?[e.tokenVar]:[]])].sort(),g=async()=>{if(s){u(!0),m(``);try{await x.saveSecrets({[s.name]:s.value}),c(null),await n(s.name)}catch(e){m(e.message)}finally{u(!1)}}},_=t||l;return(0,$.jsxs)(`fieldset`,{className:p(d,`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-4`),children:[(0,$.jsxs)(`legend`,{className:`sr-only`,children:[`Clone `,e.url]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,$.jsxs)(`label`,{htmlFor:`tsa-token`,className:`flex flex-col gap-1 text-body-sm font-medium text-muted`,children:[`Access token`,(0,$.jsxs)(i,{id:`tsa-token`,size:`sm`,value:e.tokenVar??``,disabled:_,onChange:e=>void n(e.target.value),className:`min-w-[220px]`,children:[(0,$.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),h.map(t=>(0,$.jsxs)(`option`,{value:t,children:[t,t===e.tokenVar&&!e.tokenSaved?` (not saved yet)`:``]},t))]})]}),!s&&(0,$.jsx)(A,{size:`sm`,variant:`outline`,disabled:_,onClick:()=>c({name:e.tokenVar&&!e.tokenSaved?e.tokenVar:e.suggested,value:``}),children:`Add a token`}),(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:_,onClick:()=>void n(e.tokenVar??``),children:`Check again`})]}),!s&&(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Or save it in`,` `,(0,$.jsx)(`a`,{href:r(`settings`,`repo-tokens`),target:`_blank`,rel:`noopener`,children:`Settings › Secrets › Repository tokens`}),`, then press Check again.`]}),s&&(0,$.jsxs)(`div`,{className:p(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex flex-wrap items-end gap-2`),children:[(0,$.jsxs)(`label`,{htmlFor:`tsa-token-name`,className:`flex flex-col gap-1 text-body-sm font-medium text-muted`,children:[`Name`,(0,$.jsx)(o,{id:`tsa-token-name`,size:`sm`,value:s.name,spellCheck:!1,maxLength:64,onChange:e=>c({...s,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})]}),(0,$.jsxs)(`label`,{htmlFor:`tsa-token-value`,className:`flex flex-col gap-1 text-body-sm font-medium text-muted`,children:[`Token`,(0,$.jsx)(o,{id:`tsa-token-value`,size:`sm`,type:`password`,autoComplete:`off`,value:s.value,onChange:e=>c({...s,value:e.target.value}),className:`w-[260px] max-w-full`})]}),(0,$.jsx)(A,{busy:l,size:`sm`,disabled:_||!s.name||!s.value,onClick:()=>void g(),children:l?`Saving…`:`Save`}),(0,$.jsx)(A,{size:`sm`,variant:`outline`,disabled:l,onClick:()=>c(null),children:`Cancel`}),(0,$.jsx)(`span`,{className:`w-full text-body-sm 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.`})]}),f&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-body-sm text-fail [overflow-wrap:anywhere]`,children:f}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,$.jsxs)(A,{size:`sm`,variant:`primary`,disabled:_||!(!e.tokenVar||e.tokenSaved),onClick:()=>a(`yes`),children:[(0,$.jsx)(J,{"aria-hidden":`true`}),`Clone it`]}),(0,$.jsx)(A,{size:`sm`,variant:`ghost`,disabled:_,onClick:()=>a(`no`),children:`No`}),(0,$.jsx)(`span`,{className:`text-body-sm 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 Pr({v:e}){let t=(e,t)=>(0,$.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,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:e}),(0,$.jsx)(`div`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:t})]}),n=(0,$.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`}),r=e.have;return(0,$.jsxs)(`aside`,{"aria-label":`What the assistant has so far`,className:p(d,`flex flex-col`),children:[t(r.exports.length>1?`Exports (${r.exports.length})`:`Export`,r.exports.length?(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[r.exports.slice(0,6).map(e=>(0,$.jsx)(`li`,{className:`font-mono text-body-sm`,children:e},e)),r.exports.length>6&&(0,$.jsxs)(`li`,{className:`text-body-sm text-muted`,children:[`and `,r.exports.length-6,` more`]})]}):n),t(`Target`,r.targetId?(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,$.jsx)(Lt,{framework:r.targetId.split(`-`)[0],language:r.targetId.split(`-`).slice(1).join(`-`)}),r.target]}):n),t(`Tests start at`,r.start||(0,$.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`})),r.needs.map(e=>(0,$.jsx)(Q.Fragment,{children:t(e.need===`database`?`Database`:e.need===`mobile`?`Mobile app`:`Desktop app`,e.picked?(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.picked}):(0,$.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`}))},e.need)),t(`Folder`,r.into?(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:r.into}):(0,$.jsx)(`span`,{className:`text-muted`,children:`tosca-<target>`})),t(`Saved secrets`,r.uses.length?(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.uses.map(e=>(0,$.jsxs)(`li`,{className:`font-mono text-body-sm`,children:[e.variable,` uses `,e.secret]},e.variable))}):(0,$.jsx)(`span`,{className:`text-muted`,children:e.checking?`Reading which variables the tests need…`:`None`})),t(`Instructions`,r.instructions?(0,$.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:r.instructions}):(0,$.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}var Fr=e=>e.kind===`upload`||e.kind===`paste`?e.exports.map(e=>Or(e.path)).join(`, `)||`Uploaded files`:e.label.replace(/^.*[\\/]/,``).replace(/\.git$/,``);function Ir({view:e}){let t=e.clones.reduce((e,t)=>e+t.exports.length,0);return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{className:`mr-1 text-muted`,children:`Exports`}),e.exports.slice(0,5).map(e=>(0,$.jsxs)(P,{tone:`neutral`,icon:!1,children:[(0,$.jsx)(R,{size:12,"aria-hidden":`true`}),Or(e.path)]},e.path)),[...e.clones.reduce((e,t)=>{let n=`${t.kind===`git`||!t.kind?`git`:`file`}\u0000${Fr(t)}`;return e.set(n,[...e.get(n)||[],t])},new Map).values()].map(e=>(0,$.jsxs)(P,{tone:`neutral`,icon:!1,children:[e[0].kind&&e[0].kind!==`git`?(0,$.jsx)(R,{size:12,"aria-hidden":`true`}):(0,$.jsx)(J,{size:12,"aria-hidden":`true`}),Fr(e[0]),e.length>1&&(0,$.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.length,` copies)`]})]},e[0].id)),(0,$.jsx)(`a`,{href:r(`migration`,`new`),className:p(E({size:`sm`}),`no-underline`),children:`Another source`}),(0,$.jsx)(`span`,{className:`ml-1 text-muted`,children:e.exports.length+t?`${e.exports.length+t} found`:`none in this project yet`})]})}var Lr=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],Rr=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function zr({s:e}){let t=e.duplicates||0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(ft,{label:`What the exports hold`,children:[(0,$.jsx)(ht,{dot:`neutral`,value:e.test_cases.length,label:`test cases`}),(0,$.jsx)(ht,{dot:`neutral`,value:e.pages.length,label:`modules`}),(0,$.jsx)(ht,{dot:`neutral`,value:e.totals.steps,label:`steps`}),(0,$.jsx)(ht,{dot:`neutral`,value:e.totals.asserts,label:`checks`})]}),(e.suites.length>0||e.totals.unsupported>0||t>0)&&(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:[e.suites.length>0&&(0,$.jsxs)(`li`,{children:[Z(e.suites.length,`execution list`),`, kept as tags on the tests.`]}),e.totals.unsupported>0&&(0,$.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,$.jsxs)(`li`,{children:[Z(t,`test case`),` in more than one export, converted once.`]})]})]})}var Br=e=>`${e.workspace||``}\u0000${e.file}`;function Vr({busy:e,onClone:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``);return(0,$.jsxs)(`form`,{className:p(l,`flex flex-col gap-4`),onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim(),i.trim(),s.trim())},children:[(0,$.jsx)(X,{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,$.jsx)(o,{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,$.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`tsc-git-branch`,label:`Branch`,help:`The default branch when empty.`,children:(0,$.jsx)(o,{id:`tsc-git-branch`,value:i,spellCheck:!1,maxLength:200,placeholder:`main`,onChange:e=>a(e.target.value)})}),(0,$.jsx)(X,{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,$.jsx)(o,{id:`tsc-git-token`,value:s,spellCheck:!1,maxLength:80,placeholder:`GITHUB_TOKEN`,onChange:e=>c(e.target.value)})})]}),(0,$.jsx)(`div`,{children:(0,$.jsx)(A,{busy:e,type:`submit`,disabled:e||!n.trim(),children:e?`Cloning…`:`Clone it`})})]})}function Hr(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 Ur({view:e,onView:t,scope:n,rows:r,part:i,setPart:a,busy:s,read:c,readError:l,picked:u,setPicked:d,found:f,setFound:m,only:h,setOnly:g}){let[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(e.clones.length>0&&e.exports.length===0),[w,T]=(0,Q.useState)(``),[E,O]=(0,Q.useState)(``),k=l||E,j=new Set(u.map(Br)),ee=e=>{m(null),O(``),d(t=>t.some(t=>Br(t)===Br(e))?t.filter(t=>Br(t)!==Br(e)):[...t,e])},M=r.length>0&&r.every(e=>j.has(Br(e.p))),te=async(e,n,r)=>{b(!0),O(``);try{t?.(await S.clone(e,n||void 0,r||void 0))}catch(e){O(e.message)}finally{b(!1)}},N=async e=>{O(``),T(``);try{t?.(await S.removeClone(e)),d(t=>t.filter(t=>t.workspace!==e)),m(null)}catch(e){O(e.message)}},F=e=>{let t=new Set(h);t.has(e)?t.delete(e):t.add(e),g(t)},I=e=>pn(e),L=f?f.test_cases.filter(I):[],R=!n||`project`in n,B=!n,H=k&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:k});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(i===`tsc-exports`||!f)&&!(n&&r.length===1)&&(0,$.jsxs)(gt,{id:`tsc-exports`,level:3,icon:Me,title:(0,$.jsxs)($.Fragment,{children:[`Exports`,n?(0,$.jsxs)(`span`,{className:`font-normal text-muted`,children:[` in this source, `,r.length]}):null]}),children:[r.length>0?(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Dt,{label:`Tosca exports`,size:10,placeholder:`Find an export`,tools:(0,$.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(at,{checked:M,onCheckedChange:e=>{m(null),O(``),d(e?r.map(e=>e.p):[])}}),`Pick all `,r.length]}),head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Export`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Folder`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`From`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Size`})]}),children:r.map(e=>{let t=Br(e.p),n=e.p.file.slice(e.p.file.lastIndexOf(`/`)+1);return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,"data-state":j.has(t)?`selected`:void 0,children:[(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(at,{"aria-label":`Pick ${e.p.file}${e.p.workspace?` of ${e.from}`:``}`,checked:j.has(t),onCheckedChange:()=>ee(e.p)})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Me,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n})]})}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden font-mono text-body-sm text-muted @xl:table-cell`),children:e.p.file.includes(`/`)?e.p.file.slice(0,e.p.file.lastIndexOf(`/`)):`.`}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-ink-2`),children:e.from}),(0,$.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.bytes,children:Rr(e.bytes)})]},t)})})}):(0,$.jsxs)(`p`,{className:p(D.info,`m-0`),children:[`No Tosca export (.tsu) `,n&&`workspace`in n?`in this source.`:`in this project yet.`,` Export the test cases from Tosca Commander and put the files inside the project, for example `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:`tosca/checkout.tsu`}),`, or pick another source above.`]}),u.length>0&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm 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&&!k&&(0,$.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-body-sm`,children:(0,$.jsxs)(`span`,{children:[`Reading `,u.length===1?`the export`:`${u.length} exports`,`…`]})}),H,R&&(0,$.jsx)(X,{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,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(o,{id:`tsc-path`,value:_,spellCheck:!1,maxLength:300,placeholder:`tosca/checkout.tsu or tosca/`,onChange:e=>v(e.target.value),className:`min-w-0 flex-[1_1_300px]`}),(0,$.jsxs)(A,{disabled:s||!_.trim(),onClick:()=>void c([...u.filter(e=>Br(e)!==Br({file:_.trim()})),{file:_.trim()}],u),"data-tip":`Add the export at this path and read it`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`}),`Add`]})]})}),B&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(A,{variant:`ghost`,size:`sm`,"aria-expanded":x,onClick:()=>C(!x),className:`self-start`,children:[(0,$.jsx)(V,{"aria-hidden":`true`,className:p(`transition-transform`,x&&`rotate-180`)}),`From a git repository`,e.clones.length?` (${e.clones.length} cloned)`:``]}),x&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.clones.length>0&&(0,$.jsx)(`ul`,{className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:e.clones.map(e=>(0,$.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,$.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.label,(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:[e.branch?`Branch ${e.branch}`:``,e.commit?`commit ${e.commit}`:``,Z(e.exports.length,`export`),`cloned ${new Date(e.createdAt).toLocaleDateString()}`].filter(Boolean).join(`, `)})]}),w===e.id?(0,$.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,$.jsx)(A,{size:`sm`,variant:`destructive`,onClick:()=>void N(e.id),children:`Remove it`}),(0,$.jsx)(A,{size:`sm`,variant:`ghost`,onClick:()=>T(``),children:`Keep it`})]}):(0,$.jsx)(A,{size:`sm`,variant:`danger`,"aria-label":`Remove the copy of ${e.label}`,onClick:()=>T(e.id),children:`Remove`})]},e.id))}),(0,$.jsx)(Vr,{busy:y,onClone:(e,t,n)=>void te(e,t,n)})]})]})]}),s&&!k&&i!==`tsc-exports`&&(0,$.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-body-sm`,children:(0,$.jsx)(`span`,{children:`Reading…`})}),f&&(0,$.jsxs)(gt,{id:`tsc-cases`,level:3,icon:z,title:(0,$.jsxs)($.Fragment,{children:[`Test cases`,(0,$.jsxs)(`span`,{className:`font-normal text-muted`,children:[` `,`in `,u.length===1?(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:u[0].file.replace(/^.*\//,``)}):Z(u.length,`export`)]})]}),actions:i!==`tsc-exports`&&!(n&&r.length===1)?(0,$.jsx)(A,{size:`sm`,variant:`ghost`,onClick:()=>a(`tsc-exports`),children:`Change exports`}):void 0,children:[H&&i!==`tsc-exports`?H:null,(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(zr,{s:f}),f.coverage&&(0,$.jsx)(gr,{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,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Dt,{label:`Test cases to convert`,placeholder:`Find a test case`,tools:(0,$.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(at,{checked:L.length>0&&L.every(e=>h.has(e.id)),onCheckedChange:e=>g(new Set(e?L.map(e=>e.id):[]))}),`Pick all `,L.length,` test cases ForgeQE can convert`]}),head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Folder`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Steps`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Checks`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`})]}),children:f.test_cases.map(e=>{let t=I(e);return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,"data-state":t&&h.has(e.id)?`selected`:void 0,children:[(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(at,{"aria-label":`Pick ${e.name}`,disabled:!t,checked:t&&h.has(e.id),onCheckedChange:()=>F(e.id)})}),(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`span`,{className:p(`font-medium [overflow-wrap:anywhere]`,t?`text-ink`:`text-muted`),children:e.name}),(e.unsupported>0||e.suites.length>0)&&(0,$.jsxs)(`span`,{className:`block text-body-sm 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,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-muted @2xl:table-cell [overflow-wrap:anywhere]`),children:e.folders.join(` / `)||`Top level`}),(0,$.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.steps}),(0,$.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.asserts}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`whitespace-nowrap`),children:(0,$.jsx)(P,{tone:t?`neutral`:`warn`,children:t?sn(e):`${hn[e.route]||e.route}: later`})})]},e.id)})})}),f.env.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Environment variables`}),(0,$.jsxs)(`span`,{className:`text-body-sm 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 Wr({view:e,to:t,setTo:n,fw:r,setFw:i,into:a,setInto:s,attr:c,setAttr:l}){let u=e=>e.split(`-`)[0],d=e=>e.split(`-`).slice(1).join(`-`),f=[...new Map(e.targets.map(e=>[u(e.id),e.framework])).entries()],p=r||(t?u(t):``),m=e.targets.filter(e=>u(e.id)===p);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Framework`}),(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:f.map(([e,t])=>{let r=Bt[e];return(0,$.jsx)(Ot,{on:p===e,onPick:()=>{e!==p&&(i(e),n(``))},logo:r?(0,$.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:t,sub:Nt[e],label:t},e)})})]}),(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Language`}),!p&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Pick a framework first.`}),p&&!t&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Pick its language.`}),(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`pane-swap grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:m.map(e=>{let r=It[d(e.id)];return(0,$.jsx)(Ot,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,$.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,label:e.language},e.id)})},p)]}),(0,$.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,$.jsx)(o,{id:`tsc-into`,value:a,spellCheck:!1,maxLength:300,placeholder:t?`tosca-${t}`:`Named after the target`,onChange:e=>s(e.target.value)})}),(0,$.jsx)(X,{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,$.jsx)(o,{id:`tsc-attr`,value:c,spellCheck:!1,maxLength:40,placeholder:`data-automation-id`,onChange:e=>l(e.target.value.replace(/[^A-Za-z0-9_-]/g,``))})})]})]})}function Gr({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,$.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,$.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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lt,{framework:c.id.split(`-`)[0],language:c.id.split(`-`).slice(1).join(`-`),size:14}),c.title]})),l(`i`,(0,$.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`,on[o.feasibility.verdict].label):void 0}]}function Kr({view:e,onView:t,review:n,onStart:i,from:o,embedded:s}){let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(0),[f,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(new Set),[y,b]=(0,Q.useState)(``),[x,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(``),[j,ee]=(0,Q.useState)(``),[M,te]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(``),V=s?.scope,H=Hr(e,V),[U,W]=(0,Q.useState)(`tsc-exports`),[G,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(``),ae=async(e,t)=>{if(m(e),g(null),ie(``),e.length){ne(!0);try{let t=await S.inspectSources(e);g(t),v(new Set(t.test_cases.filter(pn).map(e=>e.id))),W(`tsc-cases`)}catch(e){t&&m(t),ie(e.message)}finally{ne(!1)}}},K=!o&&H.length===1?H[0].p:null;(0,Q.useEffect)(()=>{K&&ae([K])},[K&&Br(K)]);let oe=[..._].sort().join(`,`);(0,Q.useEffect)(()=>{te(null),P(!1),d(e=>Math.min(e,1))},[f.map(Br).join(`|`),oe,y,T,O,j]);let[se,q]=(0,Q.useState)(`next`),[ce,J]=(0,Q.useState)(!1),le=e=>{q(e<c?`back`:`next`),l(e),J(!0)},de=e=>{le(e),d(t=>Math.max(t,e)),B(``)},[fe,pe]=(0,Q.useState)(o?`filling`:``);(0,Q.useEffect)(()=>{if(!o)return;let e=!0;return(async()=>{R(!0);try{let t=(await C.view(o)).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;m(t.sources),w(t.to.split(`-`)[0]),b(t.to),E(t.into??``),ee(t.instructions??``);let n=await S.inspectSources(t.sources);if(!e)return;let r=n.test_cases.filter(pn).map(e=>e.id);if(g(n),v(new Set(r)),!r.length)throw Error(`These exports hold no web or API test case to convert.`);let i=await S.plan({sources:t.sources,to:t.to,...t.into?{into:t.into}:{},...t.instructions?{instructions:t.instructions}:{}});(t.app||t.baseUrl)&&await S.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 S.answer(i.plan.id,{use:{name:e,secret:n}}).catch(()=>{});if((t.desktopApp||t.mobileApp||t.database)&&await S.answer(i.plan.id,{...t.desktopApp?{desktopApp:t.desktopApp}:{},...t.mobileApp?{mobileApp:t.mobileApp}:{},...t.database?{database:t.database}:{}}).catch(()=>{}),!e)return;te(i),d(2),le(2),pe(`done`)}catch(t){if(!e)return;B(t.message),pe(``)}finally{e&&R(!1)}})(),()=>{e=!1}},[o]);let me=async()=>{R(!0),B(``);try{let e=!h||h.test_cases.filter(pn).every(e=>_.has(e.id)),t=await S.plan({sources:f,to:y,...T.trim()?{into:T.trim()}:{},...e?{}:{only:[..._]},...j.trim()?{instructions:j.trim()}:{},...O?{testAttributes:[O]}:{}});te(t),de(2)}catch(e){let t=e.message;B(t);let n=T.trim().replace(/\\/g,`/`).replace(/(?<!\/)\/+$/,``);n&&t.includes(n)&&le(1)}finally{R(!1)}},he=M?.plan,_e=he?.feasibility.findings.some(e=>e.level===`limit`),ve=he?.feasibility.verdict===`blocked`,ye=[s?`Where are the tests?`:`Which Tosca exports?`,`What should the tests become?`,`Check the plan, then start`],be=Gr({view:e,picked:f,found:h,only:_,to:y,into:T,embedded:!!s,...he?{plan:he}:{}});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[o&&fe&&(0,$.jsxs)(`p`,{role:`status`,className:p(D.info,`fade-quick m-0 flex flex-wrap items-center gap-x-4 gap-y-1`),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:fe===`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,$.jsx)(`a`,{href:r(`migration`,`guide`),className:`text-body-sm`,children:`Back to the assistant`})]}),(0,$.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,$.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,$.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,$.jsx)(jt,{steps:be,at:c,reached:u,onGo:e=>!L&&(e<2||M)&&le(e)})})}),(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-step`,className:p(`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,se===`next`?`pane-next`:`pane-back`),children:[(0,$.jsx)(At,{id:`tsc-step`,at:c,moved:ce,children:ye[c]}),z&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:z}),c===0&&(0,$.jsxs)($.Fragment,{children:[s?.source,(0,$.jsx)(Ur,{view:e,onView:t,...V?{scope:V}:{},rows:H,part:U,setPart:W,busy:G,read:ae,readError:re,picked:f,setPicked:m,found:h,setFound:g,only:_,setOnly:v}),h?(0,$.jsx)(Mt,{busy:L||G,next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>de(1),disabled:!_.size,aside:_.size?void 0:(0,$.jsx)(`span`,{className:`text-muted`,children:`Pick at least one web or API test case.`})}):(0,$.jsx)(Mt,{busy:L||G,next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{"aria-hidden":`true`}),G?`Reading…`:f.length>1?`Read ${f.length} exports`:`Read the export`]}),onNext:()=>void ae(f),disabled:!f.length,aside:f.length?void 0:(0,$.jsx)(`span`,{className:`text-muted`,children:`Tick one or more exports.`})})]}),c===1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Wr,{view:e,to:y,setTo:b,fw:x,setFw:w,into:T,setInto:E,attr:O,setAttr:k}),(0,$.jsx)(wt,{title:j.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!j.trim(),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsx)(X,{id:`tsc-instructions`,label:`Rules`,help:`Style and structure for the new code. Every Tosca step and check is kept either way.`,children:(0,$.jsx)(a,{id:`tsc-instructions`,value:j,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per Tosca module.`,onChange:e=>ee(e.target.value)})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Lr.map(e=>(0,$.jsxs)(A,{size:`sm`,disabled:j.includes(e),onClick:()=>ee(j.trim()?`${j.trim()}\n${e}`:e),children:[(0,$.jsx)(ge,{"aria-hidden":`true`}),e]},e))})]})}),(0,$.jsx)(Mt,{busy:L,onBack:()=>le(0),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(we,{"aria-hidden":`true`}),L?`Checking…`:`Check the plan`]}),onNext:()=>y?void me():B(`Pick the framework and its language first.`),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),c===2&&he&&(0,$.jsxs)($.Fragment,{children:[n(he,N,P,I),(0,$.jsx)(Mt,{busy:L,onBack:()=>le(1),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]}),disabled:ve||!F||_e&&!N,onNext:()=>i(M,!!_e&&N),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:ve?`Change what is not possible first.`:F?_e&&!N?`Accept the limits to start.`:`Runs in the background.`:`Answer what the tests need first.`})})]})]},c)]})]})}function qr({planId:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{let t=!0;return n(null),i(!1),S.estimate(e).then(e=>t&&n(e),()=>t&&i(!0)),()=>{t=!1}},[e]),r?(0,$.jsx)(`span`,{className:`text-muted`,children:`Not known`}):t?t.files.setup+t.files.pages+t.files.tests?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[`About `,Tt(t.tokens.mid),` tokens`,t.cost?`, about ${Et(t.cost.mid,t.cost.currency)}`:``,(0,$.jsxs)(`span`,{className:`text-muted`,children:[` `,`(`,Tt(t.tokens.low),` to `,Tt(t.tokens.high),t.cost?`, ${Et(t.cost.low,t.cost.currency)} to ${Et(t.cost.high,t.cost.currency)}`:``,`)`]})]}),(0,$.jsxs)(`span`,{className:`block text-body-sm 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,$.jsx)(`span`,{className:`text-muted`,children:`Nothing left to write`}):(0,$.jsx)(`span`,{role:`status`,className:`text-muted`,children:`Working it out…`})}function Jr({plan:e,accepted:t,onAccept:n,onReady:i}){let[a,o]=(0,Q.useState)(null),s=(0,Q.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,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[c.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-blockers`,className:p(D.fail,`flex flex-col gap-2`),children:[(0,$.jsxs)(`h3`,{id:`tsc-blockers`,className:`m-0 flex items-center gap-2 text-body-sm font-medium text-fail`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink`,children:c.map(e=>(0,$.jsx)(`li`,{children:e.text},e.code))})]}),l.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`tsc-limits`,className:p(D.warn,`flex flex-col gap-4`),children:[(0,$.jsxs)(`h3`,{id:`tsc-limits`,className:`m-0 flex items-center gap-2 text-body-sm font-medium text-warn`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-2 pl-6 text-body-sm text-ink`,children:l.map(e=>(0,$.jsx)(`li`,{children:e.text},e.code))}),n&&!c.length&&(0,$.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-body-sm font-medium`,children:[(0,$.jsx)(at,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,$.jsx)(Sr,{planId:e.id,onReady:i,onCoverage:o}),(0,$.jsx)(gt,{id:`tsc-plan`,level:3,icon:Fe,title:`The plan`,children:(0,$.jsxs)(`dl`,{className:`m-0 grid gap-x-8 text-body-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,$.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,$.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[`Tricentis Tosca`,e.source.project?`, ${e.source.project}`:``,(0,$.jsx)(`span`,{className:`block text-muted`,children:e.sources&&e.sources.length>1?`${e.sources.length} exports`:(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.source.file})}),e.sources&&e.sources.length>1&&(0,$.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.sources.map((t,n)=>(0,$.jsxs)(`li`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[t.label,(0,$.jsx)(`span`,{className:`block font-sans text-muted`,children:(e=>e?Z(e,`test case`):`its test cases are all in another export`)(e.cases.filter(e=>e.source===n).length)})]},n))})]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,$.jsx)(`span`,{className:`block font-mono text-body-sm text-muted`,children:e.target.dir})]}),e.previous&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Since`}),(0,$.jsxs)(`dd`,{className:`m-0`,children:[(0,$.jsx)(`a`,{href:r(`migration`,e.previous.id),children:e.previous.id}),(0,$.jsxs)(`span`,{className:`block text-muted`,children:[Z(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,$.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,$.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,$.jsx)(`dt`,{className:`text-muted`,children:`Estimate`}),(0,$.jsx)(`dd`,{className:`m-0`,children:(0,$.jsx)(qr,{planId:e.id})}),(e.suites||[]).length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Suites`}),(0,$.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.suites.map(e=>`${e.name} (${Z(e.cases.length,`test`)})`).join(`, `),(0,$.jsxs)(`span`,{className:`block text-body-sm text-muted`,children:[`Tosca's execution lists, as tags on the tests: `,e.suites.map(e=>`@${e.tag}`).join(`, `),`.`]})]})]}),e.env.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Environment variables`}),(0,$.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`Never in the export: you set them before the tests run.`})]})]}),e.instructions&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,$.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]})}),a&&(0,$.jsx)(gr,{coverage:a,names:s,file:`tosca-${e.id}-coverage.csv`}),(0,$.jsx)(wt,{title:`Test cases (${e.cases.length})`,children:(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Dt,{label:`Test cases of the plan`,placeholder:`Find a test case`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Test case`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`In the plan`}),(0,$.jsx)(`th`,{scope:`col`,className:p(nt,`hidden @xl:table-cell`),children:`Steps`}),(0,$.jsx)(`th`,{scope:`col`,className:p(nt,`hidden @xl:table-cell`),children:`Checks`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Kind`})]}),children:e.cases.map(e=>{let t=e.change;return(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsx)(`td`,{className:p(mt,`[overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,$.jsxs)(`td`,{className:p(mt,`text-ink-2`),children:[e.included?`Converted`:e.why?e.why[0].toUpperCase()+e.why.slice(1):`Left out`,t?(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:{same:`Unchanged: its test kept`,changed:`Changed in Tosca`,new:`New in Tosca`}[t]}):null]}),(0,$.jsx)(`td`,{className:p(pt,`hidden @xl:table-cell`),children:e.steps}),(0,$.jsx)(`td`,{className:p(pt,`hidden @xl:table-cell`),children:e.asserts}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap text-muted`),children:hn[e.route]||e.route})]},e.id)})})})}),(0,$.jsx)(wt,{title:`Files, in order (${e.units.length})`,children:(0,$.jsx)(Dt,{label:`Files, in order`,placeholder:`Find a file`,sortable:!1,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`w-24`),children:`Kind`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`File`})]}),children:e.units.map(e=>(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsx)(`td`,{className:p(mt,`text-muted`),children:ln(e)}),(0,$.jsx)(`td`,{className:p(mt,`font-mono text-body-sm [overflow-wrap:anywhere]`),children:e.target})]},e.id))})})]})}function Yr({d:e,onStarted:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),c=e.plan.feasibility.findings.some(e=>e.level===`limit`),l=e.plan.feasibility.verdict===`blocked`,u=!!e.job?.running;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!u&&(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,$.jsx)(Jr,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r,onReady:a}),!l&&!u&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,$.jsxs)(A,{variant:`primary`,disabled:!i||!e.confirmed&&c&&!n,onClick:()=>s(!0),"data-tip":`Start the conversion`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]}),!i&&(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Answer what the tests need first.`})]}),o&&(0,$.jsx)(Cn,{plan:e.plan,acceptLimits:c&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}var Xr=`tsc-\\d{8}-\\d{6}-[0-9a-f]{4}`;function Zr(e){return!!(e&&(e===`guide`||/^new\/[a-f0-9]{16}$/.test(e)||RegExp(`^${Xr}(?:/(?:steps|errors|activity)|/report(?:/[^/]+|/tab/(?:cases|coverage|trace))?)?$`).test(e)))}function Qr({sub:e}){let[t,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(Tr),d=(0,Q.useCallback)(()=>{S.list().then(e=>{i(e),o(``)},e=>o(e.message))},[]);(0,Q.useEffect)(d,[d,e]);let f=e.match(RegExp(`^(${Xr})/report(?:/tab/(cases|coverage|trace)|/([^/]+))?$`)),p=e.match(RegExp(`^(${Xr})/(steps|errors|activity)$`)),m=RegExp(`^${Xr}$`).test(e)?e:f?.[1]||p?.[1]||``,h=f?.[2],g;try{g=f?.[3]?n(f[3]):void 0}catch{}let _=!t&&!a&&(0,$.jsx)(M,{shape:`detail`}),v=e.match(/^new\/([a-f0-9]{16})$/)?.[1];return v?(0,$.jsxs)(bn,{tab:`migrations`,back:{href:r(`migration`,`guide`),label:`Guide`},children:[(0,$.jsx)(rn,{error:a}),_,t&&(0,$.jsx)(Kr,{view:t,onView:i,from:v,review:(e,t,n,r)=>(0,$.jsx)(Jr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>c({d:e,accept:t})},v),s&&(0,$.jsx)(Cn,{plan:s.d.plan,acceptLimits:s.accept,onClose:()=>c(null),onStarted:e=>{c(null),location.hash=r(`migration`,e.plan.id)}})]}):m&&f?(0,$.jsx)(bn,{tab:`migrations`,wide:!0,back:{href:r(`migration`,m),label:`Conversion`},children:(0,$.jsx)(fr,{id:m,caseId:g,tab:h??(g?`cases`:`summary`)},m)}):m?(0,$.jsxs)(bn,{tab:`migrations`,wide:!0,back:yn,children:[(0,$.jsx)(rn,{error:a}),_,t&&(0,$.jsx)($n,{id:m,...p?{tab:p[2]}:{},plan:(e,t)=>(0,$.jsx)(Yr,{d:e,onStarted:t})},m)]}):(0,$.jsxs)(bn,{tab:`migrations`,back:{href:r(`migration`,`new`),label:`New migration`},children:[(0,$.jsx)(rn,{error:a}),_,t&&(0,$.jsx)(Ar,{view:t,sid:l,onSid:u})]})}var $r=[`prepare`,`setup`,`migrate`,`validate`,`fix`,`review`];function ei(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?Vt[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ht[e.plan.feasibility.verdict]}var ti=e=>e.slice(e.lastIndexOf(`/`)+1);function ni({id:e,title:t,targetDir:n,onClose:i}){let[a,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),f=async()=>{l(!0),d(``);try{await b.delete(e,a),location.hash=r(`migration`,`migrations`)}catch(e){d(e.message),l(!1)}};return(0,$.jsx)(et,{open:!0,onClose:i,title:`Delete this migration`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`ghost`,onClick:i,"data-tip":`Keep it`,children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),`Keep`]}),(0,$.jsxs)(A,{variant:`danger`,disabled:c||a!==e,onClick:()=>void f(),children:[(0,$.jsx)(B,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,$.jsx)(o,{value:a,onChange:e=>s(e.target.value),autoComplete:`off`,spellCheck:!1})]}),u?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:u}):null]})})}function ri({d:e,planView:t}){let n=e.result;if(!n)return(0,$.jsx)($.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,u=n.status!==`running`||n.units.some(e=>e.kind===`test`&&(e.status===`migrated`||e.status===`failed`)),d=e.plan.source.stack,[f,...m]=e.plan.target.id.split(`-`);return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6`,children:[(0,$.jsxs)(ft,{label:`The migration in numbers`,children:[(0,$.jsx)(ht,{dot:u?`pass`:`neutral`,value:u?`${a} of ${i.length}`:`—`,label:u?`tests passing`:`tests checked once migrated`}),(0,$.jsx)(ht,{dot:`neutral`,value:`${s} of ${o.length}`,label:`files migrated`}),(0,$.jsx)(ht,{dot:c?`fail`:`neutral`,value:c,label:`need attention`}),(0,$.jsx)(ht,{dot:n.status===`running`?`running`:`neutral`,value:Jt(n.status===`running`?Date.now()-Date.parse(n.startedAt):n.ms),label:n.status===`running`?`running`:`taken`})]}),n.notes&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:n.notes}),(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col`,children:(0,$.jsx)(Dt,{className:`min-h-[240px] flex-1 overflow-y-auto`,label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`File`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @3xl:table-cell`),children:`Note`})]}),children:e.plan.units.map(e=>{let t=r.get(e.id),n=t?$t[t.status]:null;return(0,$.jsxs)(`tr`,{className:ot,children:[(0,$.jsxs)(`td`,{className:mt,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.kind===`setup`?`Project set-up`:ti(e.target)}),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted`,children:e.source?`from ${ti(e.source)}`:e.target}),(t?.status===`failed`||t?.status===`blocked`)&&(t.problems?.[0]||t.reason)&&(0,$.jsx)(`span`,{className:`mt-1 line-clamp-2 text-body-sm text-ink-2 @3xl:hidden`,children:t.problems?.[0]||t.reason})]}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap`),children:n?(0,$.jsx)(P,{tone:n.tone,children:n.label}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Waiting`})}),(0,$.jsx)(`td`,{className:p(mt,`hidden text-body-sm text-ink-2 @3xl:table-cell`),children:(0,$.jsx)(`span`,{className:`line-clamp-2`,children:t?.problems?.[0]||t?.reason||``})})]},e.id)})})}),(0,$.jsxs)(`aside`,{"aria-label":`Details`,className:p(l,`flex min-h-0 flex-col gap-4 overflow-y-auto text-body-sm`),children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`From`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[d&&(0,$.jsx)(Lt,{framework:d.framework,language:d.language}),e.plan.source.title]}),(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-ink-2`,children:[(0,$.jsx)(Pt,{kind:e.origin.kind,label:e.origin.label,size:16}),(0,$.jsxs)(`span`,{className:`truncate`,"data-tip":e.origin.label,children:[Kt(e.origin.label),e.origin.branch?`, branch ${e.origin.branch}`:``]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`To`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,$.jsx)(Lt,{framework:f,language:m.join(`-`)}),e.plan.target.title]}),(0,$.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 pt-4`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,$.jsx)(`dd`,{className:`m-0 text-right`,children:Gt(n.startedAt)}),n.model&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,$.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":n.model,children:n.model})]}),n.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-right`,children:[n.reverted.length,` edits outside the target`]})]})]})]})]})]})}var ii=`@5xl:h-[calc(var(--screen)-360px)] @5xl:min-h-[540px]`;function ai({label:e,children:t}){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`text-body-sm text-muted`,children:e}),(0,$.jsx)(`dd`,{className:`m-0 text-body-sm font-medium`,children:t})]})}function oi({d:e,busy:t}){let n=e.result?.validation?.tests||[],r=e.result?.fixes||[],i=n.filter(e=>!e.ok),[a,o]=(0,Q.useState)(()=>i[0]?.id||n[0]?.id||``),s=n.find(e=>e.id===a)||n[0],c=s?r.filter(e=>e.id===s.id):[];if(!n.length)return(0,$.jsx)(`div`,{className:p(l,`flex min-h-[240px] flex-1 items-center justify-center`),children:(0,$.jsx)(_t,{center:!0,icon:me,title:e.result?`No tests run yet`:`Not started`,children:e.result?`ForgeQE runs every migrated test once each file is migrated. Their results show here.`:`Start the migration first.`})});let u=Ut(e.plan.id,i),d=s&&!s.ok?Ut(e.plan.id,[s]):``;return(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]`,children:[(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-col`,children:(0,$.jsx)(Dt,{className:`min-h-[320px] flex-1 overflow-y-auto`,label:`Migrated tests`,placeholder:`Find a test`,end:i.length>1&&u?(0,$.jsxs)(A,{size:`sm`,disabled:t,onClick:()=>xt(u),"data-tip":`Ask Atlas, at the corner, to fix every failing test`,children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix all `,i.length]}):void 0,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Test`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,className:p(nt,`hidden @3xl:table-cell`),children:`Time`})]}),children:n.map(e=>{let t=r.findLast(t=>t.id===e.id);return(0,$.jsxs)(`tr`,{onClick:()=>o(e.id),"aria-selected":s?.id===e.id,className:p(St,s?.id===e.id&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,$.jsxs)(`td`,{className:mt,children:[(0,$.jsx)(A,{variant:`link`,size:`inline`,onClick:()=>o(e.id),className:`text-left text-body-sm [overflow-wrap:anywhere]`,children:ti(e.target)}),t&&(0,$.jsx)(`span`,{className:p(`block text-body-sm`,tn(t,e)?`text-pass`:`text-muted`),children:tn(t,e)?`Fixed by the agent`:`The agent could not fix it`})]}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap`),children:(0,$.jsx)(P,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})}),(0,$.jsx)(`td`,{className:p(pt,`hidden text-body-sm text-muted @3xl:table-cell`),"data-sort":e.ms||-1,children:e.ms?Jt(e.ms):`Not timed`})]},e.id)})})}),s&&(0,$.jsxs)(`section`,{"aria-label":`${ti(s.target)} details`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex min-h-[320px] min-w-0 flex-col overflow-hidden p-0`),children:[(0,$.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-4 py-4`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:ti(s.target)}),(0,$.jsx)(P,{tone:s.ok?`pass`:`fail`,children:s.ok?`Passes`:s.exitCode===null&&s.ms?`Timed out`:`Fails`})]}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,"data-tip":s.target,children:s.source?`from ${s.source}`:s.target})]}),(0,$.jsxs)(`a`,{href:qt(e.plan.id,s.id),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`The source beside the migrated test, in a tab of their own`,className:E({size:`sm`,variant:`ghost`}),children:[(0,$.jsx)(xe,{"aria-hidden":`true`}),`Compare`]}),d&&(0,$.jsxs)(A,{size:`sm`,variant:`primary`,disabled:t,onClick:()=>xt(d),"data-tip":`Ask Atlas, at the corner, to fix this test`,children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix`]})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-auto px-4 py-4`,children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-2 gap-4 @3xl:grid-cols-4`,children:[(0,$.jsx)(ai,{label:`Tests kept`,children:(0,$.jsxs)(`span`,{className:s.after.tests<s.before.tests?`text-fail`:void 0,children:[s.after.tests,` of `,s.before.tests]})}),(0,$.jsx)(ai,{label:`Checks kept`,children:(0,$.jsxs)(`span`,{className:s.after.assertions<s.before.assertions?`text-warn`:void 0,children:[s.after.assertions,` of `,s.before.assertions]})}),(0,$.jsx)(ai,{label:`Checks proved`,children:s.checksProved===void 0?`Not tried`:s.checksProved?`Yes`:(0,$.jsx)(`span`,{className:`text-fail`,children:`No`})}),(0,$.jsx)(ai,{label:`Time`,children:s.ms?Jt(s.ms):`Not timed`})]}),s.problems.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-body-sm font-medium`,children:`What ForgeQE found`}),(0,$.jsx)(`ul`,{className:p(D.fail,`m-0 flex flex-col gap-1 pl-6`),children:s.problems.map((e,t)=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))})]}),c.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-body-sm font-medium`,children:`The fixing agent`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.map((e,t)=>{let n=tn(e,t===c.length-1?s:void 0);return(0,$.jsxs)(`li`,{className:`flex items-start gap-2 text-body-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`flex-none font-medium`,n?`text-pass`:`text-fail`),children:n?`✓`:`✗`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[n?`Fixed`:e.ok?`Passed its own run, not the check after it`:`Could not fix it`,e.attempts>1?` (${e.attempts} tries)`:``,e.note?`. Asked: ${e.note}`:``,e.reason?`. It said: ${e.reason}`:``]}),(0,$.jsx)(`span`,{className:`flex-none text-muted`,children:tt(e.at)})]},t)})})]}),(0,$.jsxs)(`div`,{className:`flex min-h-[160px] flex-1 flex-col gap-2`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-body-sm font-medium`,children:`Run output`}),(0,$.jsxs)(`div`,{className:p(`rounded-base bg-surface-muted p-4`,`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`),children:[s.command&&(0,$.jsxs)(`code`,{className:`block font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`$ `,s.command]}),(0,$.jsx)(`pre`,{className:`m-0 font-mono text-body-sm whitespace-pre-wrap text-ink-2`,children:s.output||(s.ok?`${s.after.tests} test${s.after.tests===1?``:`s`} passed in ${Jt(s.ms)}.`:s.exitCode===0?`The run itself passed in ${Jt(s.ms)}; the check above is what failed.`:`No output.`)})]})]})]})]})]})})}var si={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 ci({events:e,running:t}){let n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,t]);let r=e.filter(e=>e.kind!==`tool`);return(0,$.jsxs)(`ol`,{ref:n,"aria-live":t?`polite`:void 0,"aria-label":`Activity`,className:p(l,`m-0 flex max-h-[60vh] min-h-0 list-none flex-col overflow-y-auto p-0 @5xl:max-h-none @5xl:flex-1`),children:[r.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-4 border-b border-line-soft px-4 py-2 text-body-sm last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`min-w-[64px] flex-none text-body-sm whitespace-nowrap text-muted tabular-nums`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`w-3 flex-none text-center`,si[e.kind].cls),children:si[e.kind].mark}),(0,$.jsx)(`span`,{className:p(`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,$.jsx)(`li`,{className:`px-4 py-8 text-center text-body-sm text-muted`,children:`Nothing yet.`})]})}function li({id:e,tab:t=`overview`,plan:n}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),c=t=>location.hash=t===`overview`?r(`migration`,e):r(`migration`,e,t),[l,u]=(0,Q.useState)([]),[d,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(0),_=(0,Q.useCallback)(()=>{b.detail(e).then(e=>{a(e),s(``)},e=>s(e.message));let t=g.current;b.events(e,t).then(e=>{if(e.next<g.current){g.current=0,u([]);return}let t=g.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));g.current=e.next,n.length&&u(e=>[...e,...n].slice(-2e3))},()=>{})},[e]);(0,Q.useEffect)(_,[_]);let v=!!(i?.job?.running||i?.result?.status===`running`);(0,Q.useEffect)(()=>{if(!v)return;let e=vt(_,1500);return()=>lt(e)},[v,_]);let y=async e=>{f(!0),s(``);try{a(await e()),setTimeout(_,800)}catch(e){s(e.message)}finally{f(!1)}};if(!i)return o?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}):(0,$.jsx)(M,{shape:`detail`});let x=ei(i),S=Zt(i.plan,i.result),C=i.result,w=(C?.validation?.tests||[]).filter(e=>!e.ok).length,T=[{id:`overview`,label:`Overview`},{id:`tests`,label:`Tests`,n:C?.validation?`${C.validation.tests.length-w}/${C.validation.tests.length}`:void 0,tone:w?`text-fail`:void 0},{id:`activity`,label:`Activity`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`mt-6 flex flex-col gap-4 border-b border-line-soft pb-6 @3xl:flex-row @3xl:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-2 text-headline-sm`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[i.plan.source.stack&&(0,$.jsx)(Lt,{framework:i.plan.source.stack.framework,language:i.plan.source.stack.language,size:20}),i.plan.source.title]}),(0,$.jsx)(ze,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(Lt,{framework:i.plan.target.id.split(`-`)[0],language:i.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),i.plan.target.title]})]}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,$.jsx)(Pt,{kind:i.origin.kind,label:i.origin.label,size:15}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:Kt(i.origin.label)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsxs)(`span`,{children:[`into `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:i.plan.target.dir})]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(P,{tone:x.tone,children:x.label}),v?(0,$.jsx)(A,{variant:`danger`,size:`icon`,disabled:d,onClick:()=>void y(()=>b.stop(e)),"aria-label":`Stop`,"data-tip":`Stop the migration`,children:(0,$.jsx)(He,{fill:`currentColor`,"aria-hidden":`true`})}):(0,$.jsxs)($.Fragment,{children:[C?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`a`,{href:qt(e),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Compare`,"data-tip":`Compare: the source beside what it became, in a tab of their own`,className:E({variant:`icon`,size:`icon`}),children:(0,$.jsx)(xe,{"aria-hidden":`true`})}),(0,$.jsx)(`a`,{href:r(`migration`,e,`report`),"aria-label":`Report`,"data-tip":`Report`,className:E({variant:`icon`,size:`icon`}),children:(0,$.jsx)(Ae,{"aria-hidden":`true`})}),(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:d,onClick:()=>void y(()=>b.verify(e)),"aria-label":`Run the tests again`,"data-tip":`Run every migrated test again, with no agent`,children:(0,$.jsx)(ue,{"aria-hidden":`true`})})]}):null,(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:d,onClick:()=>h(!0),"aria-label":`Delete`,"data-tip":`Delete: remove this plan from the list; converted tests stay`,children:(0,$.jsx)(B,{"aria-hidden":`true`})})]})]})]}),m&&(0,$.jsx)(ni,{id:e,title:`${i.plan.source.title} → ${i.plan.target.title}`,targetDir:i.plan.target.dir,onClose:()=>h(!1)}),(0,$.jsxs)(`div`,{className:p(`grid grid-cols-[minmax(0,1fr)] gap-6`,C&&`@3xl:grid-cols-[208px_minmax(0,1fr)] @3xl:gap-8`),children:[C&&(0,$.jsx)(`div`,{className:`@3xl:flex @3xl:flex-col @3xl:border-r @3xl:border-line-soft @3xl:pr-6`,children:(0,$.jsx)(Xt,{label:`Migration stages`,items:Wt($r,C.stages,w),...v?{progress:S}:{}})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[o&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:o}),(0,$.jsx)(Ze,{prefix:`mtab`,className:`mb-0`,tabs:T,current:t,onPick:c,label:`Migration`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`mtab-panel-${t}`,"aria-labelledby":`mtab-${t}`,className:p(`flex min-w-0 flex-col gap-4`,C&&ii),children:[t===`overview`&&(0,$.jsx)(ri,{d:i,planView:n(i)}),t===`tests`&&(0,$.jsx)(oi,{d:i,busy:d||v}),t===`activity`&&(0,$.jsx)(ci,{events:l,running:v})]})]})]})]})}function ui(e){let t=e?.match(/^(mig-\d{8}-\d{6}-[0-9a-f]{4})\/report(?:\/tab\/(files|checks))?$/);return t?{id:t[1],...t[2]?{tab:t[2]}:{}}:null}var di=[{id:`migrated`,label:`Migrated`,bar:`bg-pass`},{id:`written`,label:`Written, not checked yet`,bar:`bg-accent`},{id:`failed`,label:`Failed`,bar:`bg-fail`},{id:`blocked`,label:`Blocked`,bar:`bg-warn`},{id:`waiting`,label:`Waiting`,bar:`bg-line-strong`}],fi={prepare:`preparing`,setup:`setting up the new project`,migrate:`rewriting each file`,validate:`running every migrated test`,fix:`fixing the tests that failed`,review:`comparing the result with the source`},pi=e=>e.slice(e.lastIndexOf(`/`)+1),mi=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function hi({id:e,tab:t=`summary`}){let[n,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),m=(...t)=>r(`migration`,e,`report`,...t),g=e=>location.hash=e===`summary`?m():m(`tab`,e);(0,Q.useEffect)(()=>{b.detail(e).then(e=>(i(e),o(e.result?``:`No report yet. Start the migration first.`)),e=>o(e.message))},[e]);let _=async t=>{u(!0),f(``);try{let n=t===`html`?await b.reportHtml(e):new Blob([(await b.report(e)).text],{type:`text/markdown`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`migration-${e}.${t}`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){f(e.message)}finally{u(!1)}};if(!n&&!a)return(0,$.jsx)(M,{shape:`detail`,label:`Loading report…`});if(a||!n?.result)return(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:a||`No report.`});let y=n.result,x=n.plan,S=Vt[y.status]||{label:y.status,tone:`neutral`},[C,...w]=x.target.id.split(`-`),T=y.units.filter(e=>e.kind!==`setup`),O=T.filter(e=>e.status===`migrated`).length,k=y.validation?.tests||[],j=k.filter(e=>e.ok).length,ee=k.reduce((e,t)=>e+t.before.assertions,0),te=k.reduce((e,t)=>e+Math.min(t.after.assertions,t.before.assertions),0),N=k.filter(e=>!e.ok),F=T.filter(e=>(e.status===`failed`||e.status===`blocked`)&&!k.some(t=>t.id===e.id)),I=x.units.filter(e=>e.kind!==`setup`).length,L=y.status===`running`?{tone:`running`,text:`Migrating: ${T.length} of ${I} files written so far.`}:k.length&&!N.length&&!F.length?{tone:`pass`,text:`All ${k.length===1?``:`${k.length} `}migrated test${k.length===1?``:`s`} pass in ${x.target.title}.`}:k.length?{tone:`fail`,text:`${j} of ${k.length} migrated tests pass; ${N.length} ${N.length===1?`fails`:`fail`}${F.length?`, ${mi(F.length,`file`)} not migrated`:``}.`}:{tone:`warn`,text:`${O} of ${T.length} files migrated; the tests were not checked.`},R=k.filter(e=>e.checksProved!==void 0),z=R.filter(e=>e.checksProved).length,B={migrated:0,written:0,failed:0,blocked:0,waiting:0};for(let e of x.units.filter(e=>e.kind!==`setup`)){let t=T.find(t=>t.id===e.id);B[t?t.status===`skipped`?`blocked`:t.status:`waiting`]++}let U=y.status===`running`&&y.stage?fi[y.stage]:``,W=[...N.map(e=>({id:e.id,file:e.target,why:e.problems[0]||`The test fails.`,words:Ut(x.id,[e])})),...F.map(e=>({id:e.id,file:e.target,why:e.reason||e.problems?.[0]||$t[e.status].label,words:``}))],G=L.tone===`pass`?q:L.tone===`running`?De:H,ne=[{id:`summary`,label:`Summary`},{id:`files`,label:`Files`,n:T.length},{id:`checks`,label:`Checks`,n:k.length||void 0}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,$.jsx)(`h2`,{className:`m-0 text-headline-sm`,children:`Migration report`}),(0,$.jsx)(P,{tone:S.tone,children:S.label})]}),(0,$.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-2 text-body-sm text-ink-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[x.source.stack&&(0,$.jsx)(Lt,{framework:x.source.stack.framework,language:x.source.stack.language,size:14}),x.source.title]}),(0,$.jsx)(ze,{size:14,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Lt,{framework:C,language:w.join(`-`),size:14}),x.target.title]})]})]}),(0,$.jsxs)(`a`,{href:qt(e),target:`_blank`,rel:`noopener noreferrer`,className:E({variant:`ghost`}),children:[(0,$.jsx)(xe,{"aria-hidden":`true`}),`Compare`]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsxs)(A,{busy:l,variant:`ghost`,disabled:l,"aria-haspopup":`menu`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,$.jsx)(Ne,{"aria-hidden":`true`}),l?`Making the report…`:`Export`,(0,$.jsx)(V,{"aria-hidden":`true`})]}),(0,$.jsxs)(v,{open:s,onClose:()=>c(!1),label:`Export this report`,align:`end`,className:`w-[280px]`,children:[(0,$.jsxs)(h,{onClick:()=>(c(!1),n.result?.status===`running`?f(`The HTML report is made when the run ends.`):void _(`html`)),children:[(0,$.jsx)(Le,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`HTML report`]}),(0,$.jsxs)(h,{onClick:()=>(c(!1),void _(`md`)),children:[(0,$.jsx)(We,{size:16,"aria-hidden":`true`,className:`mr-2 flex-none text-muted`}),`Markdown report (migrate.md)`]})]})]})]}),d&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:d}),(0,$.jsx)(Ze,{prefix:`rtab`,className:`mb-0`,tabs:ne,current:t,onPick:g,label:`Report`}),(0,$.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${t}`,"aria-labelledby":`rtab-${t}`,className:`pane-swap flex min-w-0 flex-col gap-8`,children:[t===`summary`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{"aria-label":`Outcome`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-2`,children:[(0,$.jsxs)(`p`,{className:p(`m-0 flex min-w-0 flex-1 items-start gap-2 text-body-md font-medium`,L.tone===`fail`?`text-fail`:`text-ink`),children:[(0,$.jsx)(G,{size:20,"aria-hidden":`true`,className:p(`flex-none`,L.tone===`pass`?`text-pass`:L.tone===`fail`?`text-fail`:L.tone===`warn`?`text-warn`:`text-accent-fg motion-safe:animate-spin`)}),L.text]}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:[y.status===`running`?`Started ${Gt(y.startedAt)}`:y.validation?`Checked ${Gt(y.validation.at)}`:`Started ${Gt(y.startedAt)}`,Jt(y.ms),y.model].filter(Boolean).join(` · `)})]}),y.status===`running`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(en,{value:Zt(x,y),label:`Migration progress: ${Math.round(Zt(x,y))}%`}),(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[U?`Now: ${U}`:`Starting`,` · `,Math.round(Zt(x,y)),`%`]})]}),T.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`div`,{role:`img`,"aria-label":di.map(e=>`${B[e.id]} ${e.label.toLowerCase()}`).join(`, `),className:`flex h-2 w-full overflow-hidden rounded-full bg-surface-strong`,children:di.map(e=>B[e.id]?(0,$.jsx)(`span`,{className:e.bar,style:{width:`${B[e.id]/Math.max(1,I)*100}%`}},e.id):null)}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-x-6 gap-y-1 p-0 text-body-sm text-ink-2`,children:di.filter(e=>B[e.id]).map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:p(`size-2 rounded-full`,e.bar)}),B[e.id],` `,e.label.toLowerCase()]},e.id))})]})]}),(0,$.jsxs)($e,{label:`The run in numbers`,children:[(0,$.jsx)(dt,{label:`Tests passing`,value:k.length?`${j} of ${k.length}`:`—`,tone:k.length&&j===k.length?`text-pass`:N.length?`text-fail`:void 0,note:k.length?`Run by ForgeQE after the migration`:`Checked once every file is migrated`}),(0,$.jsx)(dt,{label:`Checks kept`,value:ee?`${Math.round(te/ee*100)}%`:`—`,note:ee?`${te} of ${ee} checks of the source`:`Counted when the tests run`}),(0,$.jsx)(dt,{label:`Checks proved`,value:R.length?`${z} of ${R.length}`:`—`,tone:R.length&&z<R.length?`text-fail`:void 0,note:R.length?`Fail when the source's values are made wrong`:`Proved when the tests run`}),(0,$.jsx)(dt,{label:`Files migrated`,value:`${O} of ${I}`,note:x.copies.length?`and ${mi(x.copies.length,`data file`)} copied`:`No data files to copy`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`section`,{"aria-labelledby":`mrep-attention`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2 p-0`),children:[(0,$.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-line-soft px-4 py-4`,children:[(0,$.jsx)(`h3`,{id:`mrep-attention`,className:`m-0 flex-1 text-body-md font-medium`,children:`Needs your attention`}),W.length>0&&(0,$.jsx)(P,{tone:`fail`,children:W.length})]}),W.length===0?(0,$.jsx)(`p`,{className:`m-0 flex items-center gap-2 px-4 pb-4 text-body-sm text-ink-2`,children:y.status===`running`?`Nothing yet: each test is checked once every file is migrated.`:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{size:16,"aria-hidden":`true`,className:`text-pass`}),`Nothing needs attention: every migrated test passes, with its checks kept.`]})}):(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:W.map(t=>(0,$.jsxs)(`li`,{className:`flex items-start gap-4 border-b border-line-soft px-4 py-4 last:border-b-0`,children:[(0,$.jsx)(H,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-fail`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:pi(t.file)}),(0,$.jsx)(`span`,{className:`line-clamp-2 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,"data-tip":t.why,children:t.why})]}),(0,$.jsxs)(`a`,{href:qt(e,t.id),target:`_blank`,rel:`noopener noreferrer`,className:E({size:`sm`,variant:`ghost`}),children:[(0,$.jsx)(xe,{"aria-hidden":`true`}),`Compare`]}),t.words&&(0,$.jsxs)(A,{size:`sm`,disabled:y.status===`running`,onClick:()=>xt(t.words),"data-tip":`Ask Atlas, at the corner, to fix this test`,children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Fix`]})]},t.id))})]}),(0,$.jsxs)(`aside`,{"aria-labelledby":`mrep-details`,className:p(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,$.jsx)(`h3`,{id:`mrep-details`,className:`m-0 text-body-md font-medium`,children:`Details`}),(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 text-body-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,$.jsxs)(`dd`,{className:`m-0 font-mono text-ink [overflow-wrap:anywhere]`,children:[x.source.dir,`/`]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Into`}),(0,$.jsxs)(`dd`,{className:`m-0 font-mono text-ink [overflow-wrap:anywhere]`,children:[x.target.dir,`/`]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Written`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:T.length?`${mi(T.filter(e=>e.kind===`test`||e.kind===`feature`).length,`test`)}, ${mi(T.filter(e=>e.kind===`support`).length,`support file`)}`:`Nothing yet`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Command`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-ink [overflow-wrap:anywhere]`,children:x.sampleCommand||`Not recorded`}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Not migrated`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink`,children:x.notMigrated.length?mi(x.notMigrated.length,`file`):`None`}),y.reverted.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,$.jsxs)(`dd`,{className:`m-0 text-ink`,children:[mi(y.reverted.length,`edit`),` outside the target folder`]})]})]}),y.notes.trim()&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 pt-2`,children:[(0,$.jsx)(`h4`,{className:`m-0 text-body-sm font-medium`,children:`Notes from the migration`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:y.notes.trim()})]})]})]})]}),t===`files`&&(0,$.jsxs)(`section`,{"aria-labelledby":`mrep-files`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`mrep-files`,className:`m-0 text-body-lg font-medium`,children:`Each source file and what it became`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Compare opens the source beside the migrated file, in a tab of their own.`})]}),(0,$.jsx)(Dt,{label:`Files`,placeholder:`Find a file`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`File`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Outcome`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @3xl:table-cell`),children:`Why`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Compare`})})]}),children:T.map(t=>(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`span`,{className:`block text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:pi(t.target)}),(0,$.jsx)(`span`,{className:`block text-body-sm text-muted [overflow-wrap:anywhere]`,children:t.source?`from ${t.source}`:`made new`})]}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-body-sm text-ink-2`),children:Qt[t.kind]}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(P,{tone:$t[t.status].tone,children:$t[t.status].label})}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-body-sm text-ink-2 @3xl:table-cell [overflow-wrap:anywhere]`),children:t.reason||t.problems?.[0]||`—`}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-right`),children:(0,$.jsx)(`a`,{href:qt(e,t.id),target:`_blank`,rel:`noopener noreferrer`,className:`text-body-sm`,children:`Compare`})})]},t.id))})]}),t===`checks`&&(0,$.jsxs)(`section`,{"aria-labelledby":`mrep-checks`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{id:`mrep-checks`,className:`m-0 text-body-lg font-medium`,children:`How much of each source test's checks its migrated test kept`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Every check of the source should be in the migrated test, and fail when its value is made wrong. A short bar means checks are missing.`})]}),k.length?(0,$.jsx)(Dt,{label:`Checks by test`,placeholder:`Find a test`,height:`max(320px, calc(var(--screen) - 288px))`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Test`}),(0,$.jsx)(`th`,{scope:`col`,className:p(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Checks kept`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Checks proved`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Result`})]}),children:k.map(e=>{let t=e.before.assertions?Math.min(e.after.assertions,e.before.assertions)/e.before.assertions*100:100;return(0,$.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`),children:pi(e.target)}),(0,$.jsx)(`td`,{className:`px-4 py-2`,"data-sort":t,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:(0,$.jsx)(en,{value:t,marks:[.8,1],tone:t===100?`bg-pass`:t>=80?`bg-warn`:`bg-fail`,label:`${pi(e.target)}: ${e.after.assertions} of ${e.before.assertions} checks`})}),(0,$.jsxs)(`span`,{className:`w-16 flex-none text-right text-body-sm tabular-nums text-ink-2`,children:[e.after.assertions,`/`,e.before.assertions]})]})}),(0,$.jsx)(`td`,{className:p(`px-4 py-2`,`text-body-sm`),children:e.checksProved===void 0?(0,$.jsx)(`span`,{className:`text-muted`,children:`Not tried`}):e.checksProved?`Yes`:(0,$.jsx)(`span`,{className:`text-fail`,children:`No`})}),(0,$.jsx)(`td`,{className:`px-4 py-2`,children:(0,$.jsx)(P,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})})]},e.id)})}):(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The tests are checked once every file is migrated.`})]})]},t)]})}var gi=e=>/^[A-Za-z0-9_.-]+(\/[A-Za-z0-9_.-]+)*$/.test(e)&&!e.split(`/`).some(e=>e===`..`||e===`.`);function _i(e){let t=[...new Set(e.map(e=>e.replace(/(?<!\/)\/+$/,``)).filter(gi))].sort();return t.filter(e=>!t.some(t=>t!==e&&e.startsWith(`${t}/`)))}function vi(e,t=``){let n=_i(e),r=t.trim().replace(/^\/+/,``);return n.length===0?{from:`.`,...r?{only:r}:{}}:{from:`.`,only:`${n.length===1?n[0]:`{${n.join(`,`)}}`}/${r||`**`}`}}var yi=[{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`}],bi=[`Keep one page object per page, in pages/.`,`Read the base URL from BASE_URL.`,`Keep test names as they are.`];async function xi(e,t,n){let r=[],i=0,a=null,o=0,s=async()=>{r.length&&(a=await b.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 Si=e=>(e.webkitRelativePath||e.name).split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`);function Ci({view:e,kind:t,setKind:n,src:s,setSrc:c,from:l,setFrom:u,folders:d,setFolders:f,stack:m,setStack:h,custom:_,setCustom:v,found:y,setFound:S,tosca:C,onNext:w}){let[T,E]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(``),[j,ee]=(0,Q.useState)(null),[M,te]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(e.credentials),[F,I]=(0,Q.useState)(null),[L,z]=(0,Q.useState)(``),[V,H]=(0,Q.useState)([{path:``,text:``}]),[U,ne]=(0,Q.useState)(``),[re,ie]=(0,Q.useState)(``),[ae,K]=(0,Q.useState)(``),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{oe.current?.setAttribute(`webkitdirectory`,``)},[t,s]);let q=s?.workspace,ce=async(e,t)=>{ne(e),ie(``),K(``);try{await t()}catch(e){ie(e.message)}finally{ne(``)}},J=e=>{c(e),u(`.`),S(e.discovery),w&&!e.tosca?.length&&e.discovery?.stack&&w()};(0,Q.useEffect)(()=>{if(t!==`project`)return;let e=setTimeout(()=>b.discover(void 0,l||`.`).then(S,()=>S(null)),300);return()=>clearTimeout(e)},[t,l,S]);let le=e=>{let t=e.filter(e=>!Si(e));if(!t.length)return ie(`Nothing to send: every file is hidden or a dependency.`);ce(`upload`,async()=>{let n=e[0],r=await b.source({kind:`upload`,label:n?.webkitRelativePath?n.webkitRelativePath.split(`/`)[0]:t.length===1?t[0].name:`${t.length} files`});await xi(r.workspace.id,t,e=>K(`Sending ${e} of ${t.length} files…`)),J(await b.finish(r.workspace.id))})},ue=t===`project`||!!q?.ready,de=()=>{if(!U){if(ie(``),ue)return m===`other`&&!_.tests.trim()?ie(`Say which files are the tests, such as *.jmx, under Framework.`):w?.();if(t===`git`){if(!T.trim())return ie(`Paste the repository's address first.`);ce(`read`,async()=>J(await b.source({kind:`git`,url:T.trim(),...O?{branch:O}:{},...M?{tokenVar:M}:{}})))}else if(t===`folder`){if(!L.trim())return ie(`Type the folder's path first.`);ce(`read`,async()=>J(await b.source({kind:`folder`,folder:L.trim()})))}else{if(t===`upload`)return ie(`Choose a folder or some files first.`);if(t===`paste`){if(V.some(e=>!e.path.trim()||!e.text.trim()))return ie(`Give every file a name and its code.`);ce(`read`,async()=>{let e=await b.source({kind:`paste`});await b.files(e.workspace.id,V.map(e=>({path:e.path.trim(),text:e.text}))),J(await b.finish(e.workspace.id))})}}}},pe=!!U,me={read:t===`git`?`Cloning…`:t===`folder`?`Copying…`:`Reading…`,upload:`Sending…`,test:`Testing…`,token:`Saving…`}[U],[he,_e]=(0,Q.useState)(null),ve=e=>{f(_i(e)),_e(null)},ye=e=>{e!==t&&(f([]),n(e),c(null),S(null),ie(``),u(e===`project`?``:`.`))},be=q?.ready||t===`project`&&y;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[!q?.ready&&(0,$.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||pe)return;e.preventDefault();let r=yi.length,i=yi[(yi.findIndex(e=>e.id===t)+n+r)%r].id;ye(i);let a=e.currentTarget;requestAnimationFrame(()=>a.querySelector(`[aria-label="${yi.find(e=>e.id===i).label}"]`)?.focus())},className:`grid grid-cols-[repeat(auto-fill,minmax(208px,1fr))] gap-2`,children:yi.map(e=>(0,$.jsx)(Ot,{on:t===e.id,onPick:()=>ye(e.id),disabled:pe,logo:(0,$.jsx)(Rt,{logo:Ft[e.id].Logo,icon:Ft[e.id].Icon,size:20}),title:e.label,sub:e.sub,label:e.label},e.id))}),be?(0,$.jsx)(wi,{found:y,ws:q,onChange:q?()=>{c(null),S(null),requestAnimationFrame(()=>document.getElementById(`mig-step`)?.focus())}:void 0}):t===`git`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,$.jsx)(X,{id:`mig-url`,label:`Repository`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2`,children:(0,$.jsx)(Rt,{logo:zt(T).Logo,size:18})}),(0,$.jsx)(o,{inputMode:`url`,id:`mig-url`,value:T,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/ui-tests.git`,onChange:e=>(E(e.target.value),ee(null)),onKeyDown:e=>g(e)&&de(),className:`w-full pl-10 font-mono`})]}),(0,$.jsx)(A,{variant:`icon`,size:`icon`,disabled:!!U||!T.trim(),"aria-label":`Test the connection`,"data-tip":`Test the connection and list its branches`,onClick:()=>void ce(`test`,async()=>{let e=await b.testRepository(T.trim(),M||void 0);ee(e.branches),!O&&e.head&&k(e.head),K(`Connected: ${e.branches.length} branch${e.branches.length===1?``:`es`}`)}),children:(0,$.jsx)(qe,{"aria-hidden":`true`})})]})}),(0,$.jsx)(X,{id:`mig-branch`,label:`Branch`,children:j?.length?(0,$.jsx)(i,{id:`mig-branch`,value:O,onChange:e=>k(e.target.value),children:j.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}):(0,$.jsx)(o,{id:`mig-branch`,value:O,spellCheck:!1,maxLength:200,placeholder:`Default branch`,onChange:e=>k(e.target.value),className:`font-mono`})})]}),(0,$.jsx)(wt,{title:M?`Private repository: ${M}`:`Private repository? Add a token`,defaultOpen:!!M,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsx)(X,{id:`mig-token`,label:`Access token`,help:F?void 0:(0,$.jsx)(A,{variant:`link`,size:`inline`,onClick:()=>I({name:`REPO_TOKEN`,value:``}),children:`Save a new token`}),children:(0,$.jsxs)(i,{id:`mig-token`,value:M,onChange:e=>te(e.target.value),className:`max-w-[360px]`,children:[(0,$.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),N.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})}),F&&(0,$.jsxs)(`div`,{className:p(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex flex-wrap items-end gap-2`),children:[(0,$.jsx)(X,{id:`mig-token-name`,label:`Name`,children:(0,$.jsx)(o,{id:`mig-token-name`,value:F.name,spellCheck:!1,maxLength:64,onChange:e=>I({...F,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})}),(0,$.jsx)(X,{id:`mig-token-value`,label:`Token`,children:(0,$.jsx)(o,{id:`mig-token-value`,type:`password`,autoComplete:`off`,value:F.value,onChange:e=>I({...F,value:e.target.value}),className:`w-[260px] max-w-full`})}),(0,$.jsxs)(A,{disabled:!!U||!F.name||!F.value,onClick:()=>void ce(`token`,async()=>{await x.saveSecrets({[F.name]:F.value}),P([...new Set([...N,F.name])].sort()),te(F.name),I(null)}),children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),`Save`]}),(0,$.jsxs)(A,{variant:`outline`,onClick:()=>I(null),children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsx)(`span`,{className:`w-full text-body-sm text-muted`,children:`Kept in ForgeQE's credential store, never in the address or on this page.`})]})]})})]}):t===`folder`?(0,$.jsx)(X,{id:`mig-folder`,label:`Folder path`,help:`Copied first; the folder itself is never changed.`,children:(0,$.jsx)(o,{id:`mig-folder`,value:L,spellCheck:!1,maxLength:1e3,placeholder:`/home/me/projects/shop-ui-tests`,onChange:e=>z(e.target.value),onKeyDown:e=>g(e)&&de(),className:`font-mono`})}):t===`upload`?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-md border border-dashed border-line-strong px-6 py-10 text-center`,children:[(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Choose a folder of tests, or some files. They are sent as soon as you pick them.`}),(0,$.jsx)(`input`,{ref:oe,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&le([...e.target.files])}),(0,$.jsx)(`input`,{ref:se,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&le([...e.target.files])}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,$.jsxs)(A,{disabled:!!U,onClick:()=>oe.current?.click(),"data-tip":`Choose a folder`,children:[(0,$.jsx)(R,{"aria-hidden":`true`}),`Folder`]}),(0,$.jsxs)(A,{disabled:!!U,onClick:()=>se.current?.click(),"data-tip":`Choose files`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`}),`Files`]})]})]}):t===`paste`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[V.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(o,{"aria-label":`File ${t+1} name`,value:e.path,spellCheck:!1,maxLength:300,placeholder:t?`pages/LoginPage.java`:`tests/LoginTest.java`,onChange:e=>H(V.map((n,r)=>r===t?{...n,path:e.target.value}:n)),className:`max-w-[360px] font-mono`}),V.length>1&&(0,$.jsx)(A,{variant:`icon`,size:`icon`,"aria-label":`Remove file ${t+1}`,"data-tip":`Remove file ${t+1}`,onClick:()=>H(V.filter((e,n)=>n!==t)),children:(0,$.jsx)(B,{"aria-hidden":`true`})})]}),(0,$.jsx)(a,{"aria-label":`File ${t+1} code`,value:e.text,rows:7,spellCheck:!1,placeholder:`Paste the code`,onChange:e=>H(V.map((n,r)=>r===t?{...n,text:e.target.value}:n)),className:`font-mono`})]},t)),(0,$.jsxs)(A,{variant:`outline`,className:`self-start`,onClick:()=>H([...V,{path:``,text:``}]),"data-tip":`Add a file`,children:[(0,$.jsx)(ge,{"aria-hidden":`true`}),`Add`]})]}):null,re&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:re}),ae&&!re&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:ae}),ue&&C.n>0&&(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`What to migrate`}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`What to migrate`,className:`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2`,children:[(0,$.jsx)(Ot,{on:!C.on,disabled:C.locked,onPick:()=>C.set(!1),logo:(0,$.jsx)(W,{size:20,"aria-hidden":`true`}),title:`Test code`,sub:C.locked?`Pick the source again for its code`:y?`${y.counts.tests} test file${y.counts.tests===1?``:`s`}`:`Selenium, Cypress, Playwright…`,label:`Test code`}),(0,$.jsx)(Ot,{on:C.on,onPick:()=>C.set(!0),logo:(0,$.jsx)(Rt,{logo:Ft.tosca.Logo,icon:Ft.tosca.Icon,size:20}),title:`Tosca test cases`,sub:`${C.n} export${C.n===1?``:`s`} (.tsu)`,label:`Tosca test cases`})]}),C.on&&(0,$.jsxs)(`a`,{href:r(`migration`,`guide`),className:`inline-flex w-fit items-center gap-2 text-body-sm`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":`true`}),`Rather say what to convert? Ask Guide`]})]}),ue&&!C.on&&(0,$.jsx)(wt,{title:y?.stack?`Not quite right? Pick the tests folder or framework`:`Pick the tests folder and framework`,defaultOpen:!y?.stack||m===`other`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{id:`mig-from-label`,className:`text-body-sm font-medium`,children:`Tests folders`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(o,{readOnly:!0,"aria-labelledby":`mig-from-label`,value:d.length?d.join(`, `):t===`project`?`Whole project`:`All of it`,className:`min-w-0 flex-1 truncate font-mono`}),(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,onClick:()=>_e(d),"data-tip":`Pick one or more folders`,children:[(0,$.jsx)(R,{"aria-hidden":`true`}),`Choose`]})]}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:d.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,$.jsx)(et,{open:he!==null,onClose:()=>_e(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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`ghost`,onClick:()=>_e([]),disabled:!he?.length,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Clear`]}),(0,$.jsxs)(A,{variant:`primary`,onClick:()=>ve(he||[]),children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),he?.length?`Use ${he.length===1?`this folder`:`these ${_i(he).length} folders`}`:t===`project`?`Use the whole project`:`Use all of it`]})]}),children:(0,$.jsx)(vn,{label:`Tests folders`,folders:t===`project`?e.folders:s?.folders||[],value:he||[],onChange:_e})}),(0,$.jsx)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:(0,$.jsx)(X,{id:`mig-stack`,label:`Framework`,children:(0,$.jsxs)(i,{id:`mig-stack`,value:m,onChange:e=>h(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:y?.stack?`${y.title} (detected)`:`Detect`}),e.sources.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id)),(0,$.jsx)(`option`,{value:`other`,children:`Other (name it)`})]})})}),m===`other`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{id:`mig-source-name`,label:`Framework name`,help:`Shown in the plan, such as JMeter or Karate.`,children:(0,$.jsx)(o,{id:`mig-source-name`,value:_.name,maxLength:40,placeholder:`JMeter`,onChange:e=>v({..._,name:e.target.value})})}),(0,$.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`mig-tests`,label:`Test file types`,help:`Such as *.jmx or *.feature.`,children:(0,$.jsx)(o,{id:`mig-tests`,value:_.tests,spellCheck:!1,maxLength:120,placeholder:`*.jmx`,onChange:e=>v({..._,tests:e.target.value})})}),(0,$.jsx)(X,{id:`mig-support`,label:`Support file types (optional)`,help:`Code the tests use, such as *.groovy.`,children:(0,$.jsx)(o,{id:`mig-support`,value:_.support,spellCheck:!1,maxLength:120,placeholder:`None`,onChange:e=>v({..._,support:e.target.value})})})]})]})]})},y?.stack?`known`:`unknown`),w&&!C.on&&(0,$.jsx)(Mt,{busy:pe,next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{"aria-hidden":`true`}),me||`Continue`]}),onNext:de,aside:(0,$.jsx)(`span`,{className:`text-muted`,children:U===`test`?`Testing the connection…`:U===`token`?`Saving the token…`:pe?`Reading the source…`:`Nothing changes until you press Start.`})})]})}function wi({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,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 border-y border-line-soft py-4`,children:[(0,$.jsx)(`span`,{className:p(`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,$.jsx)(Ue,{size:14,"aria-hidden":`true`}):(0,$.jsx)(H,{size:14,"aria-hidden":`true`})}),(0,$.jsxs)(`span`,{role:`status`,className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-lg font-medium tracking-[-0.01em]`,children:[e?.stack&&(0,$.jsx)(Lt,{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,$.jsxs)(`span`,{className:`text-body-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:[[t?`From ${Kt(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,$.jsxs)(A,{variant:`ghost`,size:`sm`,onClick:n,"data-tip":`Pick another source`,children:[(0,$.jsx)(ie,{"aria-hidden":`true`}),`Change`]})]})}function Ti(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 Ei({view:e,to:t,setTo:n,other:r,setOther:i,into:s,setInto:c,only:l,setOnly:u,suggested:d,instructions:f,setInstructions:p}){let m=e=>e.split(`-`)[0],h=e=>e.split(`-`).slice(1).join(`-`),g=[...new Map(e.targets.map(e=>[m(e.id),e.framework])).entries()],_=r===null?m(t):``,v=e.targets.filter(e=>m(e.id)===_);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Framework`}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[g.map(([r,a])=>{let o=Bt[r];return(0,$.jsx)(Ot,{on:_===r,onPick:()=>(i(null),n((e.targets.find(e=>m(e.id)===r&&h(e.id)===h(t))||e.targets.find(e=>m(e.id)===r)).id)),logo:o?(0,$.jsx)(o,{width:22,height:22,"aria-hidden":`true`}):null,title:a,sub:d&&m(d)===r?`Suggested for your tests`:Nt[r],label:a},r)}),(0,$.jsx)(Ot,{on:r!==null,onPick:()=>i(r??``),logo:(0,$.jsx)(ge,{size:18,"aria-hidden":`true`,className:`text-icon`}),title:`Other`,sub:`Type the framework`,label:`Other framework`})]})]}),r===null?(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-body-sm font-medium`,children:`Language`}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2`,children:[v.map(e=>{let r=It[h(e.id)];return(0,$.jsx)(Ot,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,$.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,sub:e.id===d?`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,$.jsx)(Ot,{on:!1,onPick:()=>i(`${g.find(([e])=>e===_)?.[1]??``} with `),logo:(0,$.jsx)(ge,{size:18,"aria-hidden":`true`,className:`text-icon`}),title:`Other`,sub:`Name the language`,label:`Other language`})]})]}):(0,$.jsx)(X,{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,$.jsx)(o,{id:`mig-other`,value:r,maxLength:120,autoFocus:!0,placeholder:`Playwright with Java, WebdriverIO TypeScript…`,onChange:e=>i(e.target.value)})}),(0,$.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,$.jsx)(X,{id:`mig-into`,label:`Output folder`,help:`A new folder. Empty: named after the source and the target.`,children:(0,$.jsx)(o,{id:`mig-into`,value:s,spellCheck:!1,maxLength:300,placeholder:`tests-playwright`,onChange:e=>c(e.target.value),className:`font-mono`})}),(0,$.jsx)(X,{id:`mig-only`,label:`Only some tests (optional)`,help:`A pattern, such as checkout/** or **/*Login*.`,children:(0,$.jsx)(o,{id:`mig-only`,value:l,spellCheck:!1,maxLength:200,placeholder:`All tests`,onChange:e=>u(e.target.value),className:`font-mono`})})]}),(0,$.jsx)(wt,{title:f.trim()?`Your rules for the new code`:`Your rules for the new code (optional)`,defaultOpen:!!f.trim(),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsx)(X,{id:`mig-instructions`,label:`Rules`,help:`Style and structure for the new code. Every test and check is kept either way.`,children:(0,$.jsx)(a,{id:`mig-instructions`,value:f,rows:5,maxLength:4e3,placeholder:`Page objects go in pages/, one class per page.`,onChange:e=>p(e.target.value)})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:bi.map(e=>(0,$.jsxs)(A,{size:`sm`,disabled:f.includes(e),onClick:()=>p(f.trim()?`${f.trim()}\n${e}`:e),className:`font-normal`,children:[(0,$.jsx)(ge,{size:13,"aria-hidden":`true`}),e]},e))})]})})]})}var Di=[{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 Oi({view:e,review:t,onStart:n,tosca:r}){let[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(0),[c,l]=(0,Q.useState)(`git`),[u,d]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(`.`),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(``),[y,x]=(0,Q.useState)({name:``,tests:``,support:``}),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(e.targets[0]?.id||``),[O,k]=(0,Q.useState)(!1),A=e=>(k(!0),E(e)),[j,ee]=(0,Q.useState)(null),[M,te]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(!1),[V,H]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(``),G=Ti(C,e.targets);(0,Q.useEffect)(()=>{!O&&G&&E(G)},[O,G]),(0,Q.useEffect)(()=>{R(null),B(!1),s(e=>Math.min(e,1))},[c,u,f,h,_,y,N,T,j,M,F]);let[ne,re]=(0,Q.useState)(!1),ie=e=>{re(!0),a(e),s(t=>Math.max(t,e)),W(``)},ae=c===`project`||!!u?.workspace?.ready,K=u?.workspace,oe=ae?c===`project`?r.view?.exports.length||0:u?.tosca?.length||0:0,[se,q]=(0,Q.useState)(!1),ce=C?.counts.tests;(0,Q.useEffect)(()=>{q(oe>0&&!ce)},[c,K?.id,oe,ce]);let[J,le]=(0,Q.useState)(``),[de,fe]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{if(!se||c===`project`||!K?.ready||J===K.id)return;let e=!0;return fe(``),S.adopt(K.id).then(t=>{e&&(r.onView(t),le(K.id))},t=>e&&(fe(t.message),q(!1))),()=>{e=!1}},[se,c,K?.id,K?.ready,J]);let pe=c!==`project`&&!!K&&J===K?.id,me=!se||!ae?null:c===`project`?{project:!0}:pe?{workspace:K.id}:null,he={view:e,kind:c,setKind:l,src:u,setSrc:d,from:f,setFrom:m,folders:h,setFolders:g,stack:_,setStack:v,custom:y,setCustom:x,found:C,setFound:w,tosca:{n:oe,on:se,locked:pe,set:q}};if(me&&r.view)return(0,$.jsx)(Kr,{view:r.view,onView:r.onView,review:r.review,onStart:r.onStart,embedded:{scope:me,source:(0,$.jsx)(Ci,{...he})}},`workspace`in me?me.workspace:`project`);let ge=async()=>{H(!0),W(``);try{let e=h.length?vi(h,N):{from:f.trim()||`.`,...N.trim()?{only:N.trim()}:{}},t=await b.plan({...c!==`project`&&u?.workspace?{workspace:u.workspace.id}:{},...e.from===`.`?{}:{from:e.from},..._?{stack:_}:{},..._===`other`?{sourceName:y.name.trim(),tests:y.tests.trim(),support:y.support.trim()}:{},...j===null?{to:T}:{to:``,toText:j.trim()},...M.trim()?{into:M.trim()}:{},...e.only?{only:e.only}:{},...F.trim()?{instructions:F.trim()}:{}});R(t),ie(2)}catch(e){W(e.message)}finally{H(!1)}},_e=L?.plan,ve=_e?.feasibility.findings.some(e=>e.level===`limit`),ye=_e?.feasibility.verdict===`blocked`,be=e.targets.find(e=>e.id===T),xe=_e?.units.filter(e=>e.kind===`test`).length,Se=[`Where are the tests?`,`What should they become?`,`Check the plan, then start`],Ce=[`ForgeQE works on a copy. Your repository and folders are never changed.`,G&&!O&&j===null?`Suggested from your ${C?.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.`],Te=(...e)=>(0,$.jsx)($.Fragment,{children:e.filter(Boolean).map((e,t)=>(0,$.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 [overflow-wrap:anywhere]`,children:e},t))}),Ee=[{...Di[0],answer:ae&&(K||C)?Te((0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pt,{kind:K?.kind||`project`,label:K?.label,size:14}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:K?`${Kt(K.label)}${K.branch?`, ${K.branch}`:``}`:`This project`})]}),C&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lt,{framework:C.stack?.framework,language:C.stack?.language,size:14}),xe===void 0?`${C.counts.tests} test file${C.counts.tests===1?``:`s`}`:`${xe} test${xe===1?``:`s`} to migrate`]})):void 0},{...Di[1],answer:o>=1||G?Te(j===null?be&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lt,{framework:be.id.split(`-`)[0],language:be.id.split(`-`).slice(1).join(`-`),size:14}),be.title]}):(0,$.jsx)(`span`,{className:j.trim()?``:`text-muted`,children:j.trim()||`Type it in`}),(0,$.jsx)(`span`,{className:`text-muted`,children:G&&!O&&j===null?`Suggested from your tests`:_e?`Into ${_e.target.dir}`:M.trim()?`Into ${M.trim()}`:`Into a new folder`})):void 0},{...Di[2],answer:_e?Te((0,$.jsx)(`span`,{children:Ht[_e.feasibility.verdict].label})):void 0}];return(0,$.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,$.jsx)(`div`,{className:`@3xl:min-h-[calc(var(--screen)-240px)] @3xl:border-r @3xl:border-line-soft @3xl:pr-8`,children:(0,$.jsx)(`div`,{className:`@3xl:sticky @3xl:top-6`,children:(0,$.jsx)(jt,{steps:Ee,at:i,reached:o,onGo:e=>!V&&(e<2||L)&&(re(!0),a(e))})})}),(0,$.jsxs)(`section`,{"aria-labelledby":`mig-step`,className:`flex max-w-[880px] min-w-0 flex-col gap-6 self-start`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(At,{id:`mig-step`,at:i,moved:ne,children:Se[i]}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:Ce[i]})]}),(U||de)&&(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:U||de}),i===0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ci,{...he,onNext:()=>ie(1)}),se&&(0,$.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-body-sm`,children:(0,$.jsx)(`span`,{children:`Getting the Tosca exports ready…`})})]}),i===1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ei,{view:e,to:T,setTo:A,other:j,setOther:ee,into:M,setInto:te,only:N,setOnly:P,suggested:G,instructions:F,setInstructions:I}),(0,$.jsx)(Mt,{busy:V,onBack:()=>(re(!0),a(0)),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(we,{"aria-hidden":`true`}),V?`Checking…`:`Check the plan`]}),onNext:()=>j!==null&&!j.trim()?W(`Type the framework and language first.`):void ge(),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:`Nothing changes until you press Start.`})})]}),i===2&&_e&&(0,$.jsxs)($.Fragment,{children:[t(_e,z,B),(0,$.jsx)(Mt,{busy:V,onBack:()=>(re(!0),a(1)),next:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]}),disabled:ye||ve&&!z,onNext:()=>n(L,!!ve&&z),aside:(0,$.jsx)(`span`,{className:`text-muted`,children:ye?`Change what is not possible first.`:ve&&!z?`Accept the limits to start.`:`Runs in the background.`})})]})]})]})}function ki({error:e}){return e?(0,$.jsx)(`p`,{role:`alert`,className:p(D.fail,`m-0`),children:e}):null}function Ai({finding:e}){let t=e.hits||[],n=e.files?.length||0;if(!t.length)return n?(0,$.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,$.jsxs)(`details`,{className:`mt-1 text-body-sm`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-muted hover:text-ink`,children:[`Found in `,n||t.length,` file`,(n||t.length)===1?``:`s`]}),(0,$.jsxs)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:[t.map(e=>(0,$.jsxs)(`li`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.file,`:`,e.line]}),(0,$.jsx)(`code`,{className:p(u,`mt-1 block overflow-x-auto rounded-sm px-2 py-1 font-mono text-body-sm whitespace-pre text-ink`),children:e.code})]},`${e.file}:${e.line}`)),r>0&&(0,$.jsxs)(`li`,{className:`text-muted`,children:[`and `,r,` more file`,r===1?``:`s`]})]})]})}function ji({f:e}){let t=e.level===`blocker`;return(0,$.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,$.jsx)(`span`,{className:p(`inline-flex size-6 items-center justify-center rounded-full`,t?`bg-fail-soft text-fail`:`bg-warn-soft text-warn`),children:(0,$.jsx)(H,{size:14,"aria-label":t?`Not possible`:`Limit`})}),(0,$.jsxs)(`span`,{className:`min-w-0 text-body-sm leading-relaxed text-ink [overflow-wrap:anywhere]`,children:[e.text,(0,$.jsx)(Ai,{finding:e})]})]})}function Mi({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,o=e.units.filter(e=>e.kind===`support`).length,s=e.workspace?Kt(e.workspace.label):`this project`,c=r.length?{icon:se,text:`Not possible yet: ${r.length===1?`one thing stops it`:`${r.length} things stop it`}`,tone:`text-fail`}:i.length?t&&!n?{icon:q,text:`Ready to start, ${i.length===1?`its limit`:`its ${i.length} limits`} accepted`,tone:`text-pass`}:{icon:H,text:`Ready, with ${i.length===1?`1 limit`:`${i.length} limits`} to accept`,tone:`text-warn`}:{icon:q,text:`Ready to start`,tone:`text-pass`};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsx)(Yt,{from:{...e.source.stack?e.source.stack:{},title:e.source.title,sub:`${a} test${a===1?``:`s`} to migrate, from ${s}${e.source.dir===`.`?``:`/${e.source.dir}`}`},to:{...Fi(e.target.id),title:e.target.title,sub:`Into ${e.target.dir}`}}),(0,$.jsxs)(`p`,{className:p(`m-0 flex items-center gap-2 text-body-sm font-medium`,c.tone),children:[(0,$.jsx)(c.icon,{size:16,"aria-hidden":`true`}),c.text]}),(0,$.jsxs)($e,{label:`The plan in numbers`,children:[(0,$.jsx)(dt,{label:`Tests`,value:a,note:`Rewritten, one by one`}),(0,$.jsx)(dt,{label:`Support files`,value:o,note:`Code the tests use`}),(0,$.jsx)(dt,{label:`Copied as is`,value:e.copies.length,note:`Not rewritten`}),(0,$.jsx)(dt,{label:`Not migrated`,value:e.notMigrated.length,note:e.notMigrated.length?`In What moves where`:`Nothing left out`})]}),r.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`mig-blockers`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`mig-blockers`,className:`m-0 text-body-sm font-medium text-muted`,children:`Not possible`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:r.map(e=>(0,$.jsx)(ji,{f:e},e.code))})]}),i.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`mig-limits`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`mig-limits`,className:`m-0 text-body-sm font-medium text-muted`,children:t&&!n?`Limits accepted`:`Limits to accept`}),(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:i.map(e=>(0,$.jsx)(ji,{f:e},e.code))}),n&&!r.length&&(0,$.jsxs)(`label`,{className:`flex min-h-10 w-fit cursor-pointer items-center gap-2 text-body-sm font-medium`,children:[(0,$.jsx)(at,{checked:!!t,onCheckedChange:n}),`I accept `,i.length===1?`this limit`:`these ${i.length} limits`]})]}),e.instructions&&(0,$.jsxs)(`section`,{"aria-labelledby":`mig-rules`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{id:`mig-rules`,className:`m-0 text-body-sm font-medium text-muted`,children:`Your rules for the new code`}),(0,$.jsx)(`p`,{className:`m-0 text-body-sm whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.instructions})]}),(0,$.jsxs)(wt,{title:`What moves where (${e.units.length})`,children:[(0,$.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-y border-line-soft p-0 text-body-sm`,children:e.units.map(e=>(0,$.jsxs)(`li`,{className:`flex flex-wrap gap-x-4 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`w-16 flex-none text-muted`,children:Qt[e.kind]}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.source?(0,$.jsxs)(`span`,{className:`text-muted`,children:[e.source.slice(e.source.lastIndexOf(`/`)+1),` → `]}):null,e.target]})]},e.id))}),e.notMigrated.length>0&&(0,$.jsxs)(`p`,{className:`m-0 mt-2 text-body-sm text-muted`,children:[`Not migrated: `,e.notMigrated.map(e=>e.rel.slice(e.rel.lastIndexOf(`/`)+1)).join(`, `)]})]})]})}function Ni({plan:e,acceptLimits:t,onClose:n,onStarted:r}){let[i,a]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(``),d=async()=>{c(!0),u(``);try{r((await b.start(e.id,i,t)).detail)}catch(e){u(e.message),c(!1)}};return(0,$.jsx)(et,{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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(A,{variant:`outline`,onClick:n,children:[(0,$.jsx)(G,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(A,{variant:`primary`,disabled:s||i!==e.id,onClick:()=>void d(),"data-tip":`Start the migration`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm`,children:[(0,$.jsxs)(`span`,{children:[`Type `,(0,$.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,$.jsx)(o,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,$.jsx)(ki,{error:l})]})})}function Pi({d:e,onStarted:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),o=e.plan.feasibility.findings.some(e=>e.level===`limit`),s=e.plan.feasibility.verdict===`blocked`,c=!!e.job?.running;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!c&&(0,$.jsx)(`p`,{className:p(D.fail,`m-0`),children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,$.jsx)(Mi,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!s&&!c&&(0,$.jsx)(`div`,{children:(0,$.jsxs)(A,{variant:`primary`,disabled:!e.confirmed&&o&&!n,onClick:()=>a(!0),"data-tip":`Start the migration`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Start`]})}),i&&(0,$.jsx)(Ni,{plan:e.plan,acceptLimits:o&&(e.confirmed||n),onClose:()=>a(!1),onStarted:e=>{a(!1),t(e)}})]})}var Fi=e=>({framework:e.split(`-`)[0],language:e.split(`-`).slice(1).join(`-`)});function Ii(e,t){return e?.status===`running`?`running`:e?.status===t?`done`:e?`review`:`planned`}function Li(e){return{key:e.id,link:r(`migration`,e.id),title:e.target,under:`From ${e.source}, into ${e.to}`,from:(0,$.jsx)(Lt,{framework:e.stack?.framework,language:e.stack?.language,size:18}),to:Fi(e.targetId),source:{mark:(0,$.jsx)(Pt,{kind:e.origin.kind,label:e.origin.label,size:15}),text:e.origin.kind===`project`?e.from&&e.from!==`.`?e.from:`This project`:Kt(e.origin.label),tip:e.origin.kind===`project`&&(!e.from||e.from===`.`)?`This project's own tests`: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?Vt[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:Ht[e.verdict],filter:Ii(e.result,`migrated`),at:e.result?.endedAt||e.result?.at||e.createdAt}}function Ri(e){let t=e.file.slice(e.file.lastIndexOf(`/`)+1);return{key:e.id,link:r(`migration`,e.id),title:e.target,under:`From ${t}, into ${e.into}`,from:(0,$.jsx)(Pt,{kind:`tosca`,size:18}),to:Fi(e.targetId),source:{mark:(0,$.jsx)(Pt,{kind:`tosca`,size:15}),text:e.project||t,tip:e.project?`${e.project} (Tosca export ${e.file})`:`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?fn[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:on[e.verdict],filter:Ii(e.result,`converted`),at:e.result?.endedAt||e.result?.at||e.createdAt}}var zi=(e,t)=>`${t?Math.round(e/t*100):0}%`;function Bi({rows:e}){let[t,n]=(0,Q.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,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ft,{label:`Migrations by status`,children:[(0,$.jsx)(ht,{dot:`neutral`,value:r(`all`),label:`migrations`,onClick:()=>n(`all`),on:t===`all`}),(0,$.jsx)(ht,{dot:`running`,value:r(`running`),label:`running`,onClick:()=>n(`running`),on:t===`running`}),(0,$.jsx)(ht,{dot:`pass`,value:r(`done`),label:`migrated (${zi(r(`done`),r(`all`))})`,onClick:()=>n(`done`),on:t===`done`}),(0,$.jsx)(ht,{dot:`warn`,value:r(`review`),label:`need review`,onClick:()=>n(`review`),on:t===`review`})]}),(0,$.jsx)(Dt,{label:`Migrations`,placeholder:`Find a migration`,empty:t===`all`?`No migrations.`:`None here.`,resetKey:t,height:Qe,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Migration`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @3xl:table-cell`),children:`Source`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Tests`}),(0,$.jsx)(`th`,{scope:`col`,className:Y,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:p(Y,`hidden @xl:table-cell`),children:`Updated`})]}),children:i.map(e=>(0,$.jsxs)(`tr`,{onClick:()=>location.hash=e.link,className:St,children:[(0,$.jsx)(`td`,{className:rt,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,$.jsxs)(`span`,{className:`hidden w-[104px] flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:[e.from,(0,$.jsx)(ze,{size:13,className:`flex-none text-muted`}),(0,$.jsx)(Lt,{framework:e.to.framework,language:e.to.language,size:18})]}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`a`,{href:e.link,onClick:e=>e.stopPropagation(),className:p(ut,`no-underline hover:underline`),"data-tip":e.title,children:e.title}),(0,$.jsx)(`span`,{className:st,"data-tip":e.under,children:e.under})]})]})}),(0,$.jsx)(`td`,{className:p(mt,`hidden w-[200px] max-w-[200px] @3xl:table-cell`),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.source.mark,(0,$.jsx)(`span`,{className:`truncate`,"data-tip":e.source.tip,children:e.source.text})]})}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap tabular-nums`),"data-sort":e.running?e.running.pct/100:e.pass?e.pass.n/Math.max(1,e.pass.of):-1,children:e.running?(0,$.jsxs)(`span`,{className:`flex w-[160px] items-center gap-2`,children:[(0,$.jsx)(en,{value:e.running.pct,label:`${e.title}, ${e.under}: progress`}),(0,$.jsxs)(`span`,{className:`w-9 flex-none text-right text-muted`,children:[e.running.pct,`%`]})]}):e.pass?(0,$.jsxs)($.Fragment,{children:[e.pass.n,` of `,e.pass.of,` pass`]}):(0,$.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,$.jsx)(`td`,{className:p(mt,`whitespace-nowrap`),children:(0,$.jsx)(P,{tone:e.state.tone,children:e.state.label})}),(0,$.jsx)(`td`,{className:p(mt,`hidden whitespace-nowrap text-muted @xl:table-cell`),"data-tip":new Date(e.at).toLocaleString(),"data-sort":new Date(e.at).getTime()||0,children:tt(e.at)})]},e.key))})]})}function Vi({sub:e}){let[t,n]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=e===`migrations`,h=(0,Q.useCallback)(()=>{b.list().then(e=>{n(e),s(``)},e=>s(e.message))},[]),g=(0,Q.useCallback)(()=>{S.list().then(e=>{a(e),l(``)},e=>l(e.message))},[]);(0,Q.useEffect)(h,[h,e]),(0,Q.useEffect)(()=>{(m||e===`new`)&&g()},[m,e,g]);let _=t?.plans.some(e=>e.result?.status===`running`)||i?.plans.some(e=>e.result?.status===`running`);(0,Q.useEffect)(()=>{if(!_||!m)return;let e=vt(()=>{h(),g()},3e3);return()=>lt(e)},[_,m,h,g]);let v=(0,Q.useMemo)(()=>[...t?.plans.map(Li)||[],...i?.plans.map(Ri)||[]].sort((e,t)=>e.at<t.at?1:e.at>t.at?-1:0),[t,i]),y=e?.match(/^(mig-\d{8}-\d{6}-[0-9a-f]{4})(?:\/(tests|activity))?$/),x=ui(e),C=y?.[1]??``,w=()=>location.hash=r(`migration`,`new`),T=!t&&!o&&(0,$.jsx)(M,{shape:e===`new`?`lines`:C?`detail`:`rows`});return Zr(e)?(0,$.jsx)(Qr,{sub:e}):e===`new`?(0,$.jsxs)(bn,{tab:`migrations`,back:yn,children:[(0,$.jsx)(ki,{error:o}),T,t&&(0,$.jsx)(Oi,{view:t,review:(e,t,n)=>(0,$.jsx)(Mi,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>d({d:e,accept:t}),tosca:{view:i,onView:a,review:(e,t,n,r)=>(0,$.jsx)(Jr,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>p({d:e,accept:t})}}),u&&(0,$.jsx)(Ni,{plan:u.d.plan,acceptLimits:u.accept,onClose:()=>d(null),onStarted:e=>location.hash=r(`migration`,e.plan.id)}),f&&(0,$.jsx)(Cn,{plan:f.d.plan,acceptLimits:f.accept,onClose:()=>p(null),onStarted:e=>location.hash=r(`migration`,e.plan.id)})]}):x?(0,$.jsx)(bn,{tab:`migrations`,wide:!0,back:{href:r(`migration`,x.id),label:`Migration`},children:(0,$.jsx)(hi,{id:x.id,...x.tab?{tab:x.tab}:{}},x.id)}):C?(0,$.jsxs)(bn,{tab:`migrations`,wide:!0,back:yn,children:[(0,$.jsx)(ki,{error:o}),T,t&&(0,$.jsx)(li,{id:C,...y?.[2]?{tab:y[2]}:{},view:t,plan:e=>(0,$.jsx)(Pi,{d:e,onStarted:()=>location.reload()})},C)]}):m?(0,$.jsxs)(bn,{tab:`migrations`,action:t&&!v.length?void 0:(0,$.jsxs)(A,{variant:`accent`,disabled:!t,onClick:w,"data-tip":`New migration`,children:[(0,$.jsx)(ge,{"aria-hidden":`true`}),`New`]}),children:[(0,$.jsx)(ki,{error:o}),(0,$.jsx)(ki,{error:c&&`Tosca conversions could not be read: ${c}`}),T,t&&(v.length?(0,$.jsx)(Bi,{rows:v}):(0,$.jsx)(_t,{icon:_e,title:`No migrations yet`,action:(0,$.jsxs)(A,{size:`sm`,onClick:w,"data-tip":`New migration`,children:[(0,$.jsx)(ge,{"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,$.jsx)(bn,{tab:Ct})}export{Vi as Migration};