@capagents/forgeqe 2.9.6 → 2.9.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 (79) hide show
  1. package/HOW_TO_USE.md +19 -1
  2. package/dist/docs-site/docs/architecture/index.html +1 -1
  3. package/dist/docs-site/docs/containers/index.html +2 -2
  4. package/dist/docs-site/docs/cost-architecture/index.html +1 -1
  5. package/dist/docs-site/docs/custom-agents-first-run/index.html +216 -0
  6. package/dist/docs-site/docs/desktop/index.html +1 -1
  7. package/dist/docs-site/docs/desktop-ci/index.html +1 -1
  8. package/dist/docs-site/docs/evidence/index.html +992 -0
  9. package/dist/docs-site/docs/feature-test-prompts/index.html +1 -1
  10. package/dist/docs-site/docs/graphify/index.html +380 -0
  11. package/dist/docs-site/docs/guardrails/index.html +2 -2
  12. package/dist/docs-site/docs/index.html +20 -5
  13. package/dist/docs-site/docs/mobile/index.html +1 -1
  14. package/dist/docs-site/docs/model-routing/index.html +1 -1
  15. package/dist/docs-site/docs/product-graph/index.html +356 -0
  16. package/dist/docs-site/docs/product-knowledge/index.html +3 -3
  17. package/dist/docs-site/docs/product-views/index.html +431 -0
  18. package/dist/docs-site/docs/search.js +1 -1
  19. package/dist/docs-site/docs/web-app/index.html +2 -2
  20. package/dist/forgeqe.js +1705 -1691
  21. package/dist/web/assets/Agent-D0jovbz1.js +6 -0
  22. package/dist/web/assets/{ApiTests-BVvDTNOF.js → ApiTests-CMMMApBR.js} +1 -1
  23. package/dist/web/assets/{Browse-DWtHfslb.js → Browse-Bimy9-t0.js} +2 -2
  24. package/dist/web/assets/{Chat-6ZM6dG91.js → Chat-DSlBwNAI.js} +1 -1
  25. package/dist/web/assets/{CommandPalette-Cdjwbda-.js → CommandPalette-D7NWAtOU.js} +1 -1
  26. package/dist/web/assets/{Compare-DFRXMkZb.js → Compare-BI8IMq49.js} +1 -1
  27. package/dist/web/assets/{Cost-BAJ8OwYF.js → Cost-BV0JavsG.js} +1 -1
  28. package/dist/web/assets/{Data-BKgbQF5L.js → Data-CjnqjcAx.js} +1 -1
  29. package/dist/web/assets/{Desktop-DR0SPUpa.js → Desktop-Bu72INy4.js} +1 -1
  30. package/dist/web/assets/{DesktopReview-RwGj52iT.js → DesktopReview-jDnb5Gfn.js} +1 -1
  31. package/dist/web/assets/{Evidence-CAmhcrWH.js → Evidence-CIlcAy5n.js} +1 -1
  32. package/dist/web/assets/{Explore-CEqgVwSY.js → Explore-Cc-1cTwG.js} +1 -1
  33. package/dist/web/assets/{Features-BGwhjQCB.js → Features-CewFSOSI.js} +1 -1
  34. package/dist/web/assets/{Flags-xn0sSPIa.js → Flags-CICcBCkH.js} +1 -1
  35. package/dist/web/assets/{Flaky-YNkwSUV0.js → Flaky-BrWbRajc.js} +1 -1
  36. package/dist/web/assets/{Impact-COvx15JE.js → Impact-D7seby-G.js} +1 -1
  37. package/dist/web/assets/{Jobs-B_AMFjhY.js → Jobs-D7yPretO.js} +1 -1
  38. package/dist/web/assets/{KindPage-Bs0utNlI.js → KindPage-Cjt1s7Vd.js} +1 -1
  39. package/dist/web/assets/{Migration-CDfhBjFm.js → Migration-CbCqOsJI.js} +1 -1
  40. package/dist/web/assets/{Product-Dk2nFc1g.js → Product-CxXVrpoD.js} +1 -1
  41. package/dist/web/assets/{Production-CPqGEo0W.js → Production-D5jIe328.js} +1 -1
  42. package/dist/web/assets/{Quality-DlFvpmDu.js → Quality-D3G8IKLZ.js} +1 -1
  43. package/dist/web/assets/{Readiness-CyYHV3qv.js → Readiness-B4Fy4Vln.js} +1 -1
  44. package/dist/web/assets/{Record-C1UE1ESU.js → Record-DLfODYjy.js} +1 -1
  45. package/dist/web/assets/{Regression-n0n9EsCb.js → Regression-Daoc9Qvx.js} +1 -1
  46. package/dist/web/assets/{Reports-CE--CULd.js → Reports-DEzDDoGF.js} +1 -1
  47. package/dist/web/assets/{Response-C4jADREA.js → Response-CaWPiZyx.js} +1 -1
  48. package/dist/web/assets/{RunDiff-CpPIvPDP.js → RunDiff-BQKwTCbM.js} +1 -1
  49. package/dist/web/assets/{Runs-BE8r8ctC.js → Runs-BIUnN08h.js} +1 -1
  50. package/dist/web/assets/{Steps-CknoiWv9.js → Steps-DjR_K32c.js} +1 -1
  51. package/dist/web/assets/{TestCases-CV1sKVIL.js → TestCases-BZWiTLjC.js} +1 -1
  52. package/dist/web/assets/{TestData-CxmtyZgT.js → TestData-D6YiouU4.js} +1 -1
  53. package/dist/web/assets/{TestDebt-DLNkmbFY.js → TestDebt-COFagfQU.js} +1 -1
  54. package/dist/web/assets/{Tosca-CYBQxyy-.js → Tosca-B3sZ9uqe.js} +1 -1
  55. package/dist/web/assets/{WhatsNew-D2EKxd96.js → WhatsNew-CznfTEFM.js} +1 -1
  56. package/dist/web/assets/{dataParts-DVmwyJxx.js → dataParts-DpVitZdm.js} +1 -1
  57. package/dist/web/assets/{fold-C8qhDrNk.js → fold-HnodvJWj.js} +1 -1
  58. package/dist/web/assets/{frame-CInX-4Bh.js → frame-DiKY0GWx.js} +2 -2
  59. package/dist/web/assets/{index-BCb4cUBF.js → index-HjX2EOmp.js} +5 -5
  60. package/dist/web/assets/{logos-CWOa7QH1.js → logos-CNarWSPL.js} +1 -1
  61. package/dist/web/assets/{palette-pcRC5zbt.js → palette-B2YywN1k.js} +1 -1
  62. package/dist/web/assets/{qualityParts-Cw5dR80i.js → qualityParts-jsPhayON.js} +1 -1
  63. package/dist/web/assets/{rows-BzbMQOJ2.js → rows-7zDrF-Yp.js} +1 -1
  64. package/dist/web/assets/{thread-BgQjmXDJ.js → thread-BUBgX0xW.js} +1 -1
  65. package/dist/web/assets/{usePageChat-DlFXcVhv.js → usePageChat-DnOXyd_B.js} +1 -1
  66. package/dist/web/index.html +2 -2
  67. package/docs/user-guide.html +16 -1
  68. package/env.example.yaml +1 -0
  69. package/forgeqe.example.yaml +1 -0
  70. package/package.json +1 -1
  71. package/prompts/README.md +1 -0
  72. package/prompts/api-tests.md +2 -0
  73. package/prompts/heal.md +3 -1
  74. package/prompts/requests-rule.md +14 -0
  75. package/prompts/test-agent.md +5 -2
  76. package/py/forgeqe_engine/logins.py +27 -0
  77. package/py/forgeqe_engine/service.py +6 -1
  78. package/skills/cypress-typescript/SKILL.md +35 -0
  79. package/dist/web/assets/Agent-Ckze0-_m.js +0 -7
@@ -1 +1 @@
1
- import{$t as e,Ir as t,J as n,L as r,M as i,Mn as ee,Nr as a,gr as o,j as s,nr as te,o as c,vr as ne}from"./line-icons-CQ-3V8ax.js";import{B as l,R as u,a as re,f as d,l as f,nt as p,o as m,qt as h,rt as g,t as _,z as v}from"./filters-mFECJpMB.js";import{Et as ie,et as y,gt as ae,r as oe,t as b}from"./frame-CInX-4Bh.js";import{r as x}from"./index-BCb4cUBF.js";import{_ as S,o as C}from"./qualityParts-Cw5dR80i.js";var w=t(a(),1),T={view:()=>p(`GET`,`/api/testdebt`),refresh:()=>p(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>p(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},E=h(),D=[`untested`,`signal`,`duplicates`,`cases`],O={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},k={test:`Test`,recording:`Recording`,case:`Test case`},se={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},A={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},j=e=>`${Math.round(e*100)}%`,M=e=>D.includes(e)?e:`untested`;function N({part:e,what:t,action:n}){return(0,E.jsxs)(f,{icon:o,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,E.jsx)(c,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function P({text:e,tip:t}){return(0,E.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function F({sub:t}){let[a,o]=(0,w.useState)(null),[p,h]=(0,w.useState)(``),[D,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(``),R=M(t),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(`manual`),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(``);(0,w.useEffect)(()=>{T.view().then(e=>{o(e),h(``)},e=>h(e.message))},[]);let q=(0,w.useCallback)(async(e,t)=>{F(!0),L(``);try{o(await e()),h(``),t&&L(t)}catch(e){h(e.message)}finally{F(!1)}},[]),ce=async e=>{if(e){F(!0);try{let{id:t}=await g.start(e,{});location.hash=d(`chats`,t)}catch(e){h(e.message),F(!1)}}},J=(e,t)=>(0,E.jsx)(u,{size:`icon`,variant:`icon`,className:`size-8`,disabled:D||!e,onClick:()=>void ce(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,E.jsx)(te,{"aria-hidden":`true`})}),Y=a?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=U||Y[0]?.id||``,Z=a?.cases.filter(e=>!e.automated).length??0,le=a?.areas.filter(e=>z===`all`||e.kind===z)??[],ue=a?.cases.filter(e=>V===`all`||(V===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-3 text-right tabular-nums`,$={untested:(a?.areas.length??0)+(a?.rules.length??0),signal:(a?.quiet.length??0)+(a?.gone.length??0),duplicates:a?.duplicates.length??0,cases:Z};return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(oe,{}),(0,E.jsxs)(`main`,{className:l(b,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(ie,{pixel:ae[`test-debt`],size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),a&&(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,E.jsxs)(`span`,{"data-tip":S(a.at),children:[`Worked out `,x(a.at)]}),(0,E.jsxs)(u,{size:`sm`,disabled:D,onClick:()=>void q(T.refresh,`Worked out again.`),children:[(0,E.jsx)(ee,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,E.jsx)(`a`,{href:d(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,a?.repo&&a.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:a.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),p&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),!a&&!p&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),I&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:I}),a&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,E.jsx)(C,{label:`Untested code`,value:a.graph.state===`ok`?a.areas.length:`–`,tone:a.areas.length?`text-warn`:void 0,sub:a.graph.state===`ok`?`of ${a.graph.checked} areas`:`graph not built`}),(0,E.jsx)(C,{label:`Untested rules`,value:a.rules.length,tone:a.rules.length?`text-warn`:void 0,sub:`of ${a.graph.rulesChecked} rules`}),(0,E.jsx)(C,{label:`Never fail`,value:a.quiet.length,sub:`30 passes in a row`}),(0,E.jsx)(C,{label:`Code gone`,value:a.gone.length,tone:a.gone.length?`text-fail`:void 0,sub:`of ${a.files.count} files listed`}),(0,E.jsx)(C,{label:`Near-duplicates`,value:a.duplicates.length,sub:`from ${j(a.threshold)} alike`}),(0,E.jsx)(C,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${a.cases.length} test cases`})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:R,onChange:e=>location.hash=d(`test-debt`,e)})}),a.notes.map(e=>(0,E.jsx)(`p`,{className:`m-0 text-[12.5px] text-ink-2`,children:e},e)),R===`untested`&&(0,E.jsxs)(E.Fragment,{children:[a.graph.state===`ok`?(0,E.jsx)(y,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:z,empty:a.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`all`,label:`All`,n:a.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${O[e]}s`,n:a.areas.filter(t=>t.kind===e).length}))],value:z,onChange:B})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[34%] py-1.5 pr-3 pl-3 font-medium`,children:`Code`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Kind`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Used by`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:le.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(i,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:O[e.kind]}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:l(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,O[e.kind].toLowerCase())})]},e.id))}):(0,E.jsx)(N,{part:a.graph,what:`product graph`,action:{label:`Product`,to:d(`product`)}}),(0,E.jsx)(y,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:a.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Rule`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`From`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Closest test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.rules.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(i,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.nearest?(0,E.jsx)(P,{text:`${e.nearest.name} (${j(e.nearest.score)})`,tip:`${j(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`rule`)})]},e.id))})]}),R===`signal`&&(a.history.state===`ok`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[50%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Passes`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Since`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.quiet.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(s,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,E.jsx)(P,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,E.jsx)(`td`,{className:l(Q,`text-muted`),children:e.runs}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.since?S(e.since):void 0,children:e.since?x(e.since):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))}),(0,E.jsx)(y,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${a.files.count} files, listed by ${a.files.by===`git`?`git`:`walking the folder`}).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[40%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`File`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Last run`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.gone.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,E.jsx)(P,{text:e.name})]})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2`,children:(0,E.jsx)(P,{text:e.file})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.last?S(e.last):void 0,children:e.last?x(e.last):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))})]}):(0,E.jsx)(N,{part:a.history,what:`test history`,action:{label:`Regression`,to:d(`regression`)}})),R===`duplicates`&&(0,E.jsx)(y,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${j(a.threshold)} of their words (${a.compared} pairs compared).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 text-right font-medium`,children:`Alike`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`First`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`Second`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Shared words`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.duplicates.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:l(Q,`pl-3`,e.score>=.85?`text-warn`:`text-muted`),children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,E.jsx)(n,{size:14,"aria-hidden":`true`}),j(e.score)]})}),[e.a,e.b].map((e,t)=>(0,E.jsxs)(`td`,{className:`max-w-0 py-2 pr-3`,children:[(0,E.jsx)(P,{text:e.name,tip:`${k[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,E.jsx)(`span`,{className:`block text-[12px] text-muted`,children:k[e.kind]})]},t)),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:(0,E.jsx)(P,{text:e.shared.join(`, `)})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),R===`cases`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,E.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:a.sources.map(e=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,E.jsx)(s,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,E.jsx)(i,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${x(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,E.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>T.readCases(X,G.trim()),`Test cases read.`)},children:[(0,E.jsx)(m,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>W(e.target.value),children:Y.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,E.jsx)(re,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?A[X]:``,value:G,maxLength:80,onChange:e=>K(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,E.jsxs)(u,{size:`sm`,type:`submit`,disabled:D||!G.trim(),"data-tip":`Read the test cases`,children:[(0,E.jsx)(ne,{"aria-hidden":`true`}),`Import`]})]}),a.cases.length?(0,E.jsx)(y,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:V,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:a.cases.length-Z},{id:`all`,label:`All`,n:a.cases.length}],value:V,onChange:H})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Case`}),(0,E.jsx)(`th`,{className:`w-[36%] py-1.5 pr-3 font-medium`,children:`Title`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Source`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Automated`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pr-3 pl-3 font-mono text-[12.5px] whitespace-nowrap`,children:/^https?:\/\//i.test(e.url)?(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3`,children:(0,E.jsx)(P,{text:e.title||`–`})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap @xl:table-cell`,"data-tip":`From ${e.scope}`,children:se[e.source]}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,E.jsx)(s,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,E.jsx)(i,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.test?(0,E.jsx)(P,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,E.jsx)(f,{icon:e,title:`No test cases yet`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:d(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,E.jsx)(c,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{F as TestDebt};
1
+ import{$t as e,Ir as t,J as n,L as r,M as i,Mn as ee,Nr as a,gr as o,j as s,nr as te,o as c,vr as ne}from"./line-icons-CQ-3V8ax.js";import{B as l,R as u,a as re,f as d,l as f,nt as p,o as m,qt as h,rt as g,t as _,z as v}from"./filters-mFECJpMB.js";import{Et as ie,et as y,gt as ae,r as oe,t as b}from"./frame-DiKY0GWx.js";import{r as x}from"./index-HjX2EOmp.js";import{_ as S,o as C}from"./qualityParts-jsPhayON.js";var w=t(a(),1),T={view:()=>p(`GET`,`/api/testdebt`),refresh:()=>p(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>p(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},E=h(),D=[`untested`,`signal`,`duplicates`,`cases`],O={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},k={test:`Test`,recording:`Recording`,case:`Test case`},se={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},A={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},j=e=>`${Math.round(e*100)}%`,M=e=>D.includes(e)?e:`untested`;function N({part:e,what:t,action:n}){return(0,E.jsxs)(f,{icon:o,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,E.jsx)(c,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function P({text:e,tip:t}){return(0,E.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function F({sub:t}){let[a,o]=(0,w.useState)(null),[p,h]=(0,w.useState)(``),[D,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(``),R=M(t),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(`manual`),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(``);(0,w.useEffect)(()=>{T.view().then(e=>{o(e),h(``)},e=>h(e.message))},[]);let q=(0,w.useCallback)(async(e,t)=>{F(!0),L(``);try{o(await e()),h(``),t&&L(t)}catch(e){h(e.message)}finally{F(!1)}},[]),ce=async e=>{if(e){F(!0);try{let{id:t}=await g.start(e,{});location.hash=d(`chats`,t)}catch(e){h(e.message),F(!1)}}},J=(e,t)=>(0,E.jsx)(u,{size:`icon`,variant:`icon`,className:`size-8`,disabled:D||!e,onClick:()=>void ce(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,E.jsx)(te,{"aria-hidden":`true`})}),Y=a?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=U||Y[0]?.id||``,Z=a?.cases.filter(e=>!e.automated).length??0,le=a?.areas.filter(e=>z===`all`||e.kind===z)??[],ue=a?.cases.filter(e=>V===`all`||(V===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-3 text-right tabular-nums`,$={untested:(a?.areas.length??0)+(a?.rules.length??0),signal:(a?.quiet.length??0)+(a?.gone.length??0),duplicates:a?.duplicates.length??0,cases:Z};return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(oe,{}),(0,E.jsxs)(`main`,{className:l(b,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(ie,{pixel:ae[`test-debt`],size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),a&&(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,E.jsxs)(`span`,{"data-tip":S(a.at),children:[`Worked out `,x(a.at)]}),(0,E.jsxs)(u,{size:`sm`,disabled:D,onClick:()=>void q(T.refresh,`Worked out again.`),children:[(0,E.jsx)(ee,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,E.jsx)(`a`,{href:d(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,a?.repo&&a.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:a.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),p&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),!a&&!p&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),I&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:I}),a&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,E.jsx)(C,{label:`Untested code`,value:a.graph.state===`ok`?a.areas.length:`–`,tone:a.areas.length?`text-warn`:void 0,sub:a.graph.state===`ok`?`of ${a.graph.checked} areas`:`graph not built`}),(0,E.jsx)(C,{label:`Untested rules`,value:a.rules.length,tone:a.rules.length?`text-warn`:void 0,sub:`of ${a.graph.rulesChecked} rules`}),(0,E.jsx)(C,{label:`Never fail`,value:a.quiet.length,sub:`30 passes in a row`}),(0,E.jsx)(C,{label:`Code gone`,value:a.gone.length,tone:a.gone.length?`text-fail`:void 0,sub:`of ${a.files.count} files listed`}),(0,E.jsx)(C,{label:`Near-duplicates`,value:a.duplicates.length,sub:`from ${j(a.threshold)} alike`}),(0,E.jsx)(C,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${a.cases.length} test cases`})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:R,onChange:e=>location.hash=d(`test-debt`,e)})}),a.notes.map(e=>(0,E.jsx)(`p`,{className:`m-0 text-[12.5px] text-ink-2`,children:e},e)),R===`untested`&&(0,E.jsxs)(E.Fragment,{children:[a.graph.state===`ok`?(0,E.jsx)(y,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:z,empty:a.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`all`,label:`All`,n:a.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${O[e]}s`,n:a.areas.filter(t=>t.kind===e).length}))],value:z,onChange:B})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[34%] py-1.5 pr-3 pl-3 font-medium`,children:`Code`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Kind`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Used by`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:le.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(i,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:O[e.kind]}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:l(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,O[e.kind].toLowerCase())})]},e.id))}):(0,E.jsx)(N,{part:a.graph,what:`product graph`,action:{label:`Product`,to:d(`product`)}}),(0,E.jsx)(y,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:a.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Rule`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`From`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Closest test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.rules.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(i,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.nearest?(0,E.jsx)(P,{text:`${e.nearest.name} (${j(e.nearest.score)})`,tip:`${j(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`rule`)})]},e.id))})]}),R===`signal`&&(a.history.state===`ok`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[50%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Passes`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Since`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.quiet.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(s,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,E.jsx)(P,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,E.jsx)(`td`,{className:l(Q,`text-muted`),children:e.runs}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.since?S(e.since):void 0,children:e.since?x(e.since):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))}),(0,E.jsx)(y,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${a.files.count} files, listed by ${a.files.by===`git`?`git`:`walking the folder`}).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[40%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`File`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Last run`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.gone.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,E.jsx)(P,{text:e.name})]})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2`,children:(0,E.jsx)(P,{text:e.file})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.last?S(e.last):void 0,children:e.last?x(e.last):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))})]}):(0,E.jsx)(N,{part:a.history,what:`test history`,action:{label:`Regression`,to:d(`regression`)}})),R===`duplicates`&&(0,E.jsx)(y,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${j(a.threshold)} of their words (${a.compared} pairs compared).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 text-right font-medium`,children:`Alike`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`First`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`Second`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Shared words`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.duplicates.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:l(Q,`pl-3`,e.score>=.85?`text-warn`:`text-muted`),children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,E.jsx)(n,{size:14,"aria-hidden":`true`}),j(e.score)]})}),[e.a,e.b].map((e,t)=>(0,E.jsxs)(`td`,{className:`max-w-0 py-2 pr-3`,children:[(0,E.jsx)(P,{text:e.name,tip:`${k[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,E.jsx)(`span`,{className:`block text-[12px] text-muted`,children:k[e.kind]})]},t)),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:(0,E.jsx)(P,{text:e.shared.join(`, `)})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),R===`cases`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,E.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:a.sources.map(e=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,E.jsx)(s,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,E.jsx)(i,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${x(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,E.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>T.readCases(X,G.trim()),`Test cases read.`)},children:[(0,E.jsx)(m,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>W(e.target.value),children:Y.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,E.jsx)(re,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?A[X]:``,value:G,maxLength:80,onChange:e=>K(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,E.jsxs)(u,{size:`sm`,type:`submit`,disabled:D||!G.trim(),"data-tip":`Read the test cases`,children:[(0,E.jsx)(ne,{"aria-hidden":`true`}),`Import`]})]}),a.cases.length?(0,E.jsx)(y,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:V,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:a.cases.length-Z},{id:`all`,label:`All`,n:a.cases.length}],value:V,onChange:H})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Case`}),(0,E.jsx)(`th`,{className:`w-[36%] py-1.5 pr-3 font-medium`,children:`Title`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Source`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Automated`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pr-3 pl-3 font-mono text-[12.5px] whitespace-nowrap`,children:/^https?:\/\//i.test(e.url)?(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3`,children:(0,E.jsx)(P,{text:e.title||`–`})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap @xl:table-cell`,"data-tip":`From ${e.scope}`,children:se[e.source]}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,E.jsx)(s,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,E.jsx)(i,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.test?(0,E.jsx)(P,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,E.jsx)(f,{icon:e,title:`No test cases yet`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:d(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,E.jsx)(c,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{F as TestDebt};
@@ -1,3 +1,3 @@
1
- import{$n as e,$t as t,A as n,An as r,Ar as i,At as a,Bn as o,C as s,Dn as c,Dt as l,Fn as u,Gn as d,Ht as f,Ir as p,Kt as m,L as h,Mn as g,Nr as _,Or as v,T as y,Un as b,Zn as x,a as S,gr as C,gt as w,hn as T,j as E,kr as D,lt as O,m as k,o as ee,ot as te,pr as ne,rt as re,tn as A,tt as j,wr as ie,wt as ae}from"./line-icons-CQ-3V8ax.js";import{B as M,R as N,Ut as P,Wt as F,Z as oe,_ as se,a as I,c as L,d as R,f as z,h as B,i as V,l as H,m as ce,n as U,o as W,qt as le,r as G,s as ue,t as de}from"./filters-mFECJpMB.js";import{Dt as fe,Et as pe,L as me,N as he,Ot as ge,at as _e,et as ve,gt as ye,it as be,nt as xe,ot as Se,r as Ce,rt as K,t as we,tt as q,z as Te}from"./frame-CInX-4Bh.js";import{B as Ee,M as De,N as Oe,c as ke,r as Ae,s as J,z as je}from"./index-BCb4cUBF.js";import{n as Me,t as Ne}from"./segmented-DANusepM.js";import{n as Pe}from"./families-B0QIuAe3.js";import{t as Fe}from"./fold-C8qhDrNk.js";import{r as Ie,s as Le,t as Re}from"./logos-CWOa7QH1.js";import{d as ze,o as Be,p as Ve,r as He,s as Ue,t as We}from"./parts-z_AE9U-M.js";import{a as Ge,c as Ke,d as qe,f as Je,g as Ye,h as Xe,i as Ze,l as Qe,m as Y,o as $e,p as et,r as tt,s as nt,t as rt,u as it}from"./Steps-CknoiWv9.js";var X=p(_(),1),Z=le(),at=500,ot=10;function st({plan:e,acceptLimits:t,next:n,again:r,onClose:a,onStarted:o}){let s=e.units.filter(e=>e.kind===`test`).length,[l,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!!n),[m,h]=(0,X.useState)(String(n?.size||ot)),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(``),b=Number(m),x=Number.isInteger(b)&&b>=1&&b<=at,S=async()=>{_(!0),y(``);try{o((await P.start(e.id,l,t,f?b:void 0)).detail)}catch(e){y(e.message),_(!1)}};return(0,Z.jsx)(ge,{open:!0,onClose:a,title:n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,description:n?`${(b||n.size)>=n.left?`The last ${n.left===1?`test case`:`${n.left} test cases`} not tried yet ${n.left===1?`is`:`are`}`:`The next ${b||n.size} of the ${n.left} test cases not tried yet are`} written as ${e.target.title} tests in ${e.target.dir}. What is done is kept; a failed test stays for you to fix.`:r?`ForgeQE picks up where the conversion stopped: what is done and unchanged is kept, the rest is written as ${e.target.title} tests in ${e.target.dir}. It runs in the background.`:`The Tosca test cases are written as ${e.target.title} tests in ${e.target.dir}, and ForgeQE runs each one. It runs in the background; the Tosca export is not changed.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:a,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(N,{variant:`primary`,disabled:g||l!==e.id||f&&!x,onClick:()=>void S(),"data-tip":n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,children:[r?(0,Z.jsx)(u,{"aria-hidden":`true`}):(0,Z.jsx)(c,{"aria-hidden":`true`}),n?`Continue`:r?`Start again`:`Start`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&s>1&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:f,onCheckedChange:p}),(0,Z.jsxs)(`span`,{children:[`Convert in batches`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`A few test cases at a time, stopping after each batch so you can check them before the next.`})]})]}),f&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{children:`Test cases per batch`}),(0,Z.jsx)(I,{type:`number`,min:1,max:at,step:1,inputMode:`numeric`,value:m,"aria-invalid":!x,"aria-describedby":x?void 0:`batch-size-error`,onChange:e=>h(e.target.value),className:`w-24`}),!x&&(0,Z.jsxs)(`p`,{id:`batch-size-error`,role:`alert`,className:`m-0 text-[12.5px] text-fail`,children:[`A whole number from 1 to `,at,`.`]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Z.jsx)(I,{value:l,onChange:e=>d(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Z.jsx)(Ze,{error:v})]})})}function ct(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?Ge[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:qe[e.plan.feasibility.verdict]}var Q=e=>e.slice(e.lastIndexOf(`/`)+1);function lt({d:e,onClose:t}){let n=(e.plan.sources||[]).some(e=>e.workspace),[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),l=async()=>{o(!0),c(``);try{let t=await P.reimport(e.plan.id,n&&r);location.hash=z(`tosca`,t.plan.id)}catch(e){c(e.message),o(!1)}};return(0,Z.jsx)(ge,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,Z.jsx)(N,{variant:`primary`,disabled:a,onClick:()=>void l(),children:a?`Reading…`:`Make the new plan`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[n&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:r,onCheckedChange:i}),(0,Z.jsxs)(`span`,{children:[`Get the newest commit of the cloned repositories`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Each is cloned again, as before; the old copy stays for this plan.`})]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s})]})})}var ut=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function dt({id:e,onClose:t}){let[n,r]=(0,X.useState)(`github`),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let t=!0;return a(null),p(!1),s(``),l(``),P.ci(e,n).then(e=>t&&a(e),e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let m=i?i.file.slice(i.file.lastIndexOf(`/`)+1):``,h=()=>{if(!i)return;let e=URL.createObjectURL(new Blob([i.text],{type:`text/yaml;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=m,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},g=async()=>{d(!0),s(``);try{let t=await P.writeCi(e,n);p(!0),l(`Added ${t.file}.${n===`github`?` GitHub runs a workflow only from ${t.path}: move it there.`:` Create a pipeline from it in Azure DevOps.`}`)}catch(e){s(e.message)}finally{d(!1)}};return(0,Z.jsxs)(ge,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:`Close`}),(0,Z.jsxs)(N,{disabled:!i,onClick:h,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`Download`]}),!f&&(0,Z.jsx)(N,{variant:`primary`,disabled:!i||u,onClick:()=>void g(),"data-tip":`Into the target folder's ci/, so a pull request of the conversion carries it.`,children:u?`Adding…`:`Add to the target folder`})]}),children:[(0,Z.jsx)(he,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:ut}),(0,Z.jsxs)(`div`,{id:`panel-ci-${n}`,role:`tabpanel`,"aria-labelledby":`tab-ci-${n}`,className:`flex flex-col gap-4 text-sm`,children:[!i&&!o&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Making the pipeline…`}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),c&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-ink [overflow-wrap:anywhere]`,children:c}),i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1.5`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Jobs`}),(0,Z.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 ${Y(i.workflows,`workflow`)}`]:[]].join(`; `)}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Goes in`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:i.path}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`To set`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[i.tests&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:`BASE_URL`}),` as a variable`]}),i.secrets.length?(0,Z.jsxs)(Z.Fragment,{children:[i.tests?`; as `:`As `,n===`github`?`secrets`:`secret variables`,`: `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:i.secrets.join(`, `)})]}):null,!i.tests&&!i.secrets.length?`None`:null,i.skipped.length?(0,Z.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[`Not passed, not a name the CI takes: `,i.skipped.join(`, `)]}):null]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px] text-muted`,children:m}),(0,Z.jsx)(ke,{text:i.text,label:`Copy ${m}`})]}),(0,Z.jsx)(`pre`,{"aria-label":m,tabIndex:0,className:`m-0 max-h-[420px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-3 font-mono text-[12px] leading-relaxed whitespace-pre text-ink-2`,children:i.text})]})]})]})]})}function ft({id:e,onClose:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(``),g=(t=``)=>P.pr(e,t).then(e=>{r(e),h(``),e.preview&&(a(e.preview),s(t=>t||e.preview.base),l(t=>t||e.preview.title))},e=>h(e.message));(0,X.useEffect)(()=>{g()},[e]),(0,X.useEffect)(()=>{if(n?.job?.state!==`running`)return;let e=setTimeout(()=>void g(o),1e3);return()=>clearTimeout(e)},[n]);let _=async()=>{p(!0),h(``);try{let t=await P.openPr(e,{base:o.trim(),title:c.trim(),draft:u});r(e=>e&&{...e,job:t.job})}catch(e){h(e.message)}finally{p(!1)}},v=i,y=n?.job,b=y?.state===`running`,x=y?.state===`done`?y.result:void 0,S=m||(y?.state===`failed`?y.error:``)||(n&&!n.preview?n.problem:``)||``,C=e=>/^https:\/\//.test(e)?e:void 0,w=(e,t)=>(0,Z.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 text-accent-fg`,children:[t,(0,Z.jsx)(re,{size:11,"aria-hidden":`true`})]});return(0,Z.jsx)(ge,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:x?`Close`:`Cancel`}),!x&&(0,Z.jsx)(N,{variant:`primary`,disabled:!v||!n?.preview||f||b||!o.trim(),onClick:()=>void _(),children:f?`Starting…`:b?`Pushing…`:`Push and open the pull request`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&!m&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Checking the repository…`}),S&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:S}),x&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-ink [overflow-wrap:anywhere]`,children:[x.existing?`Nothing new to push: this is the pull request.`:`Pushed ${Y(x.files,`file`)} on ${x.branch}.`,` `,C(x.url)?w(C(x.url),`Open the pull request`):`It is open on ${x.branch}; the host gave no https address to link to.`]}),v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1.5`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Repository`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[v.platform===`github`?`GitHub`:`Azure DevOps`,` `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:v.repository}),` (`,v.remote,`)`]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Branch`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:v.branch}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[Y(v.files.length,`file`),` of `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:v.folder})]})]}),v.last&&C(v.last.url)&&!x&&(0,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Opened before: `,w(C(v.last.url),`the pull request`),`. Pushing again updates its branch.`]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Merge into`}),(0,Z.jsx)(I,{value:o,spellCheck:!1,maxLength:200,placeholder:`main`,"aria-invalid":!(!n||n.preview),onChange:e=>s(e.target.value),onBlur:()=>o.trim()&&o.trim()!==n?.preview?.base&&void g(o.trim()),disabled:b,className:`font-mono`})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Title`}),(0,Z.jsx)(I,{value:c,maxLength:200,onChange:e=>l(e.target.value),disabled:b})]}),(0,Z.jsxs)(`label`,{className:M(`flex items-start gap-2`,b?`cursor-default`:`cursor-pointer`),children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:u,onCheckedChange:d,disabled:b}),(0,Z.jsxs)(`span`,{children:[`Open it as a draft`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Reviewers are not asked yet.`})]})]}),(0,Z.jsx)(Fe,{title:`Files (${v.files.length})`,children:(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 font-mono text-[12.5px]`,children:[v.files.slice(0,200).map(e=>(0,Z.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e)),v.files.length>200&&(0,Z.jsxs)(`li`,{className:`text-muted`,children:[`and `,v.files.length-200,` more`]})]})}),v.skipped.length>0&&(0,Z.jsx)(Fe,{title:`Left out (${v.skipped.length})`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[12.5px]`,children:v.skipped.slice(0,100).map(e=>(0,Z.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),`: `,(0,Z.jsx)(`span`,{className:`text-muted`,children:e.why})]},e.path))})})]})]})})}function pt({id:e,title:t,targetDir:n,onClose:r}){let[i,a]=(0,X.useState)(``),[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=async()=>{c(!0),u(``);try{await P.delete(e,i),location.hash=z(`tosca`,`conversions`)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(ge,{open:!0,onClose:r,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Z.jsx)(s,{"aria-hidden":`true`}),`Keep`]}),(0,Z.jsxs)(N,{variant:`danger`,disabled:o||i!==e,onClick:()=>void d(),children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Z.jsx)(I,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function mt({d:e,unit:t,onClose:n,onSend:r}){let[a,o]=(0,X.useState)(``),s=e.plan.units.find(e=>e.id===t),c=e.result?.units.find(e=>e.id===t);return(0,Z.jsx)(ge,{open:!0,onClose:n,title:`Fix ${s?Q(s.target):t}`,description:`The Tosca agent works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:n,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(N,{variant:`primary`,onClick:()=>r(a.trim()),"data-tip":`Send to the agent`,children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Send`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c.problems[0]}):null,(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,Z.jsx)(ue,{value:a,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function ht({d:e,unit:t,onClose:n}){let r=e.result?.units.find(e=>e.id===t),a=e.plan.units.find(e=>e.id===t);return(0,Z.jsx)(ge,{open:!0,onClose:n,wide:!0,title:`Output of ${a?Q(a.target):t}`,description:r?.checkedAt?`Run again ${Ve(r.checkedAt)}`:`From the conversion's own run`,footer:(0,Z.jsxs)(N,{onClick:n,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Close`]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r?.problems?.length?(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r.problems.join(` `)}):r?.status===`converted`?(0,Z.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,r?.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted`,children:[`$ `,r.command]}),(0,Z.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto rounded-[12px] bg-surface-muted px-3 py-2 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:r?.output||`No output.`})]})})}function gt(e){let t=Object.fromEntries(nt.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 _t({label:e,children:t}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`dt`,{className:`text-[11.5px] text-muted`,children:e}),(0,Z.jsx)(`dd`,{className:`m-0 text-[13px] text-ink [overflow-wrap:anywhere] tabular-nums`,children:t})]})}function vt({d:e,planView:t,busy:n,onFix:r,onSteps:i,onOutput:a,onRun:s,onNext:l}){let u=e.result||(e.job?.running?gt(e):null);if(!u)return(0,Z.jsx)(Z.Fragment,{children:t});let d=new Map(u.units.map(e=>[e.id,e])),f=e.plan.units.filter(e=>e.kind===`test`&&!e.engine),p=e.plan.units.filter(e=>e.kind===`test`&&e.engine),m=new Set(f.map(e=>e.id)),h=new Set(p.map(e=>e.id)),g=u.units.filter(e=>m.has(e.id)&&e.status===`converted`).length,_=u.units.filter(e=>h.has(e.id)&&e.status===`written`).length,v=u.units.reduce((e,t)=>t.fidelity?{m:e.m+t.fidelity.matched,n:e.n+t.fidelity.required}:e,{m:0,n:0}),y=u.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,b=e=>u.units.filter(t=>(m.has(t.id)||h.has(t.id))&&t.status===e).length,x=f.length+p.length,S=[{label:`Failed`,n:b(`failed`),bar:`bg-fail`},{label:`Needs a look`,n:b(`blocked`),bar:`bg-warn`},{label:`Passing`,n:g,bar:`bg-pass`},{label:p.length===1?`Workflow written`:`Workflows written`,n:_,bar:`bg-line-strong`},{label:p.length?`Not done yet`:`Not run yet`,n:Math.max(0,x-u.units.filter(e=>m.has(e.id)||h.has(e.id)).length),bar:`bg-line`}],[C,...w]=e.plan.target.id.split(`-`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-[12px] card border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:f.length?`${g} of ${f.length} passing`:`${_} of ${Y(p.length,`workflow`)} written`}),S.filter(e=>e.n>0).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-ink-2`,children:[(0,Z.jsx)(`span`,{className:M(`size-2 rounded-full`,e.bar),"aria-hidden":`true`}),e.label,` `,(0,Z.jsx)(`span`,{className:M(`tabular-nums`,e.label===`Failed`?`text-fail`:``),children:e.n})]},e.label))]}),(0,Z.jsx)(`div`,{className:`flex h-1.5 overflow-hidden rounded-full bg-surface-strong`,"aria-hidden":`true`,children:S.map(e=>e.n?(0,Z.jsx)(`span`,{className:e.bar,style:{width:`${e.n/Math.max(1,x)*100}%`}},e.label):null)}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-2 gap-x-6 gap-y-2 @3xl:grid-cols-4`,children:[(0,Z.jsx)(_t,{label:u.status===`running`?`Running for`:`Took`,children:ze(u.status===`running`?Date.now()-Date.parse(u.startedAt):u.ms)}),(0,Z.jsx)(_t,{label:`Tosca steps in the tests`,children:(0,Z.jsx)(`span`,{className:v.n&&v.m===v.n?`text-pass`:void 0,children:v.n?`${v.m} of ${v.n}`:`–`})}),(0,Z.jsx)(_t,{label:`Need attention`,children:(0,Z.jsx)(`span`,{className:y?`text-fail`:void 0,children:y})}),(0,Z.jsx)(_t,{label:`Pages`,children:Y(e.plan.units.filter(e=>e.kind===`page`).length,`page object`)})]})]}),u.notes&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:u.notes}),u.batch&&u.batch.left>0&&u.status!==`running`&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-sm text-ink`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Batch `,u.batch.runs,` is done. Check its tests, then continue: `,Y(u.batch.left,`test case`),` not tried yet.`]}),(0,Z.jsxs)(N,{size:`sm`,disabled:n,onClick:l,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Continue with the next batch`]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-5 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Z.jsx)(`div`,{className:`@container min-w-0`,children:(0,Z.jsx)(ve,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,height:`min(58vh, 580px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:K,children:`File`}),(0,Z.jsx)(`th`,{className:K,children:`Status`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @3xl:table-cell`),children:`Note`}),(0,Z.jsx)(`th`,{className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let s=d.get(t.id),c=s?it[s.status]:null,l=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,Z.jsxs)(`tr`,{className:_e,children:[(0,Z.jsxs)(`td`,{className:q,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:Q(t.target)}),(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[l?t.engine?`${Xe(t)} · ${l.name}`:l.name:`${Xe(t)} · ${t.target}`,l?.suites?.length?` · ${l.suites.join(`, `)}`:``]})]}),(0,Z.jsxs)(`td`,{className:M(q,`whitespace-nowrap`),children:[c?(0,Z.jsx)(L,{tone:c.tone,children:c.label}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`}),s?.checkedAt&&(0,Z.jsxs)(`span`,{className:`block pt-1 text-[12px] text-muted`,children:[`Run again `,Ae(s.checkedAt)]})]}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[13px] whitespace-nowrap @2xl:table-cell`),children:s?.fidelity?(0,Z.jsxs)(`span`,{className:s.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[s.fidelity.matched,` of `,s.fidelity.required]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Z.jsx)(`span`,{className:`line-clamp-2`,children:s?.problems?.[0]||s?.reason||``})}),(0,Z.jsx)(`td`,{className:M(q,`whitespace-nowrap text-right`),children:(0,Z.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(s?.output||s?.problems?.length)&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,"aria-label":`Output of ${Q(t.target)}`,"data-tip":`Output of ${Q(t.target)}`,onClick:()=>a(t.id),children:(0,Z.jsx)(o,{"aria-hidden":`true`})}),t.case&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,"aria-label":`Steps of ${Q(t.target)}`,"data-tip":`Steps of ${Q(t.target)}`,onClick:()=>i(t.case),children:(0,Z.jsx)(A,{"aria-hidden":`true`})}),s&&(s.status===`failed`||s.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Fix ${Q(t.target)}`,"data-tip":`Fix ${Q(t.target)}`,onClick:()=>r(t.id),children:(0,Z.jsx)(D,{"aria-hidden":`true`})})]})})]},t.id)})})}),(0,Z.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-5 text-sm @5xl:sticky @5xl:top-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`From`}),(0,Z.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?` · ${e.plan.source.project}`:``]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`To`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Le,{framework:C,language:w.join(`-`)}),e.plan.target.title]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(e.plan.suites||[]).length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Suites`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:e.plan.suites.map(e=>{let t=new Set(e.cases),r=u.units.filter(e=>e.kind===`test`&&e.case&&t.has(e.case)&&e.status===`converted`).length;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Z.jsxs)(`span`,{className:M(`text-[12px]`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,Y(e.cases.length,`test`),` pass · @`,e.tag]})]}),(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Run the ${e.name} suite`,"data-tip":`Run the ${e.name} suite`,onClick:()=>s(e.name),children:(0,Z.jsx)(c,{"aria-hidden":`true`})})]},e.name)})})]}),e.plan.env.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Environment variables`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[e.name,e.secret?(0,Z.jsx)(`span`,{className:`font-sans text-muted`,children:` · secret`}):null]}),(0,Z.jsx)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Z.jsx)(`dd`,{className:`m-0 text-right`,children:Ve(u.startedAt)}),u.model&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Z.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":u.model,children:u.model})]}),u.reverted.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Z.jsxs)(`dd`,{className:`m-0 text-right`,children:[u.reverted.length,` edits outside the target`]})]})]})]})]})]})}var yt={fail:{icon:h,cls:`text-fail`,label:`Failed`},ok:{icon:E,cls:`text-pass`,label:`Done`},info:{icon:f,cls:`text-muted`,label:`Info`},agent:{icon:k,cls:`text-accent-fg`,label:`Agent`},tool:{icon:D,cls:`text-muted`,label:`Tool`}};function bt(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:`${a.id} · ${Xe(a)} · ${a.target}`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:Ke[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var xt=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function St({d:e,events:t,running:n}){let r=(0,X.useRef)(null),i=(0,X.useRef)(!0),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(`all`),[l,u]=(0,X.useState)({}),d=bt(t,e),f=a.trim().toLowerCase(),p=e=>(s===`all`||e.kind===s)&&(!f||e.text.toLowerCase().includes(f)),m=s!==`all`||!!f,h=d.map(e=>({...e,lines:e.events.filter(p),matchTitle:!!f&&`${e.title} ${e.sub}`.toLowerCase().includes(f)})).map(e=>({...e,lines:e.matchTitle?e.events.filter(e=>s===`all`||e.kind===s):e.lines})).filter(e=>e.lines.length),g=e=>t.filter(t=>t.kind===e).length,_=d[d.length-1]?.key;return(0,X.useEffect)(()=>{n&&!m&&i.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t.length,n,m]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{id:`tosca-activity-search`,label:`Find a line`,value:a,onChange:o,placeholder:`Find a line, test case or file`}),(0,Z.jsx)(de,{items:[{id:`all`,label:`All`,n:t.length},{id:`fail`,label:`Failed`,n:g(`fail`),alert:!0},{id:`ok`,label:`Done`,n:g(`ok`)},{id:`info`,label:`Info`,n:g(`info`)},{id:`agent`,label:`Agent`,n:g(`agent`)},{id:`tool`,label:`Tools`,n:g(`tool`)}],value:s,onChange:c})]}),(0,Z.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] flex-col overflow-y-auto rounded-[12px] card border`,children:[h.map(e=>{let t=e.events.filter(e=>e.kind===`fail`).length,r=l[e.key]??(m||t>0||n&&e.key===_),i=`act-${e.key.replace(/[^A-Za-z0-9_-]/g,`-`)}`,a=e.status?it[e.status]:void 0;return(0,Z.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":i,onClick:()=>u(t=>({...t,[e.key]:!r})),className:`flex w-full min-w-0 cursor-pointer items-center gap-3 border-0 bg-transparent px-4 py-2.5 text-left hover:bg-surface-muted`,children:[(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:M(`flex-none text-muted transition-transform`,r&&`rotate-180`)}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsx)(`span`,{className:`block truncate font-mono text-[12px] text-muted`,children:e.sub})]}),(0,Z.jsxs)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:[m&&e.lines.length!==e.events.length?`${e.lines.length} of ${Y(e.events.length,`line`)}`:Y(e.events.length,`line`),t>0&&(0,Z.jsxs)(`span`,{className:`text-fail`,children:[` · `,t,` failed`]})]}),a&&(0,Z.jsx)(L,{tone:a.tone,children:a.label})]}),(0,Z.jsx)(fe,{open:r,id:i,children:(0,Z.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=yt[e.kind];return(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft py-2 pr-4 pl-11 text-[13px] last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`w-[76px] flex-none text-[12px] whitespace-nowrap text-muted tabular-nums`,children:xt(e.ts)}),(0,Z.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:M(`mt-0.5 flex-none`,n.cls)}),(0,Z.jsx)(`span`,{className:M(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:e.kind===`tool`?`font-mono text-[12px] text-muted`:`text-ink-2`),children:e.text})]},t)})})})]},e.key)}),!h.length&&(0,Z.jsx)(`p`,{className:`m-0 px-4 py-8 text-center text-sm text-muted`,children:t.length?`No line matches.`:`Nothing yet.`})]})]})}function Ct({id:t,plan:n}){let[r,i]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[l,d]=(0,X.useState)(`overview`),[f,p]=(0,X.useState)(),[m,h]=(0,X.useState)(null),[_,b]=(0,X.useState)(null),[x,C]=(0,X.useState)([]),[w,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,re]=(0,X.useState)(!1),[A,j]=(0,X.useState)(!1),[ie,ae]=(0,X.useState)(!1),[M,F]=(0,X.useState)(!1),[oe,se]=(0,X.useState)(!1),[I,R]=(0,X.useState)(!1),B=(0,X.useRef)(0),V=(0,X.useCallback)(()=>{P.detail(t).then(e=>{i(e),s(``)},e=>s(e.message));let e=B.current;P.events(t,e).then(e=>{if(e.next<B.current){B.current=0,C([]);return}let t=B.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));B.current=e.next,n.length&&C(e=>[...e,...n].slice(-2e3))},()=>{})},[t]);(0,X.useEffect)(V,[V]);let H=!!(r?.job?.running||r?.result?.status===`running`);(0,X.useEffect)(()=>{if(!H)return;let e=setInterval(V,1500);return()=>clearInterval(e)},[H,V]);let ce=(0,X.useCallback)(e=>{i(e),s(``),d(`overview`),setTimeout(V,800)},[V]),U=async e=>{E(!0),s(``);try{i(await e()),setTimeout(V,800)}catch(e){s(e.message)}finally{E(!1)}};if(!r)return o?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let W=ct(r),le=Ye(r.plan,r.result),G=r.result,ue=(G?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,de=r.plan.cases.filter(e=>e.included).length,fe=[{id:`overview`,label:`Overview`},{id:`steps`,label:`Steps`,n:de?String(de):void 0,tone:ue?`text-fail`:void 0},{id:`activity`,label:`Activity`}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,`conversions`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),`Conversions`]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 @3xl:flex-row @3xl:items-start`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:Q(r.plan.source.file)}),(0,Z.jsx)(ee,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(Le,{framework:r.plan.target.id.split(`-`)[0],language:r.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),r.plan.target.title]})]}),(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-1.5 text-sm text-muted`,children:[(0,Z.jsxs)(`span`,{children:[`Tricentis Tosca`,r.plan.source.project?` · ${r.plan.source.project}`:``]}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsxs)(`span`,{children:[`into `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:r.plan.target.dir})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{tone:W.tone,children:W.label}),H?(0,Z.jsxs)(N,{variant:`danger`,disabled:w,onClick:()=>void U(()=>P.stop(t)),children:[(0,Z.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,Z.jsxs)(Z.Fragment,{children:[G&&(G.status===`stopped`||G.status===`failed`)&&(0,Z.jsxs)(N,{disabled:w,onClick:()=>R(!0),"data-tip":`Start this conversion again. Tests it already wrote are kept.`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Start again`]}),G&&(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>location.hash=z(`tosca`,t,`report`),children:[(0,Z.jsx)(te,{"aria-hidden":`true`}),`Report`]}),G&&r.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,Z.jsxs)(N,{disabled:w,onClick:()=>void U(()=>P.verify(t)),"data-tip":`Run every converted test again, no agent`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Run`]}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsxs)(N,{variant:`ghost`,disabled:w,"aria-haspopup":`menu`,"aria-expanded":M,onClick:()=>F(!M),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`More`,(0,Z.jsx)(y,{"aria-hidden":`true`})]}),(0,Z.jsxs)(De,{open:M,onClose:()=>F(!1),label:`More for this conversion`,side:`auto`,className:`right-0 w-[240px]`,children:[G&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),re(!0)),children:[(0,Z.jsx)(g,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`Re-import`]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),ae(!0)),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`CI`]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),j(!0)),children:[(0,Z.jsx)(a,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`Pull request`]}),(0,Z.jsx)(`div`,{role:`separator`,className:`mx-2 my-1 border-t border-line-soft`})]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),O(!0)),children:[(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-fail`}),(0,Z.jsx)(`span`,{className:`text-fail`,children:`Delete`})]})]})]})]})]})]}),k&&(0,Z.jsx)(lt,{d:r,onClose:()=>re(!1)}),A&&(0,Z.jsx)(ft,{id:t,onClose:()=>j(!1)}),ie&&(0,Z.jsx)(dt,{id:t,onClose:()=>ae(!1)}),I&&(0,Z.jsx)(st,{plan:r.plan,acceptLimits:!1,again:!0,onClose:()=>R(!1),onStarted:e=>{R(!1),i(e)}}),oe&&r.result?.batch&&(0,Z.jsx)(st,{plan:r.plan,acceptLimits:!1,next:r.result.batch,onClose:()=>se(!1),onStarted:e=>{se(!1),i(e)}}),D&&(0,Z.jsx)(pt,{id:t,title:`${Q(r.plan.source.file)} → ${r.plan.target.title}`,targetDir:r.plan.target.dir,onClose:()=>O(!1)}),G&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[12px] card border px-3 py-2.5 @xl:gap-4 @xl:px-4`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(Qe,{states:G.stages})}),H&&(0,Z.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(le)}% done`,children:[Math.round(le),`%`]})]}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),(0,Z.jsx)(Ue,{tabs:fe,tab:l,onTab:d,label:`Tosca conversion`}),(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`mpanel-${l}`,"aria-labelledby":`mtab-${l}`,className:`pane-swap flex min-w-0 flex-col gap-4`,children:[l===`overview`&&(0,Z.jsx)(vt,{d:r,planView:n(r,ce),busy:w||H,onFix:h,onSteps:e=>(p(e),d(`steps`)),onOutput:b,onRun:e=>void U(()=>P.verify(t,e)),onNext:()=>se(!0)}),l===`steps`&&(0,Z.jsx)(rt,{id:t,plan:r.plan,result:G,initial:f}),l===`activity`&&(0,Z.jsx)(St,{d:r,events:x,running:H})]},l),_&&(0,Z.jsx)(ht,{d:r,unit:_,onClose:()=>b(null)}),m&&(0,Z.jsx)(mt,{d:r,unit:m,onClose:()=>h(null),onSend:e=>{h(null),U(()=>P.fix(t,[m],e))}})]})}var wt=e=>e.slice(e.lastIndexOf(`/`)+1),Tt=50,Et=[{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 Dt(e){return e===`converted`?it.converted:e===`failed`?it.failed:e===`blocked`?it.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?it.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function Ot(e){for(let t of nt){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function kt({planId:e,unit:t,file:n}){let r=/\.(webm|mp4)$/i.test(n),[i,a]=(0,X.useState)(!r),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{if(!i)return;let r=!1;return s(``),u(!1),P.evidence(e,t,n).then(e=>!r&&s(e),()=>!r&&u(!0)),()=>{r=!0}},[e,t,n,i]),(0,Z.jsxs)(`li`,{className:`flex w-[260px] max-w-full flex-col gap-1`,children:[o?r?(0,Z.jsx)(`video`,{controls:!0,autoPlay:!0,src:o,className:`max-h-[200px] w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,Z.jsx)(`img`,{src:o,alt:`Screenshot ${n}`,className:`max-h-[200px] w-full rounded-[10px] border border-line-soft object-contain`}):r&&!i?(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>a(!0),className:`h-[120px] w-full rounded-[10px] border border-line-soft bg-surface-muted`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Play video`]}):(0,Z.jsx)(`span`,{role:`status`,className:`flex h-[120px] items-center justify-center rounded-[10px] border border-line-soft bg-surface-muted text-[12px] text-muted`,children:l?`Not available`:`Loading…`}),(0,Z.jsx)(`span`,{className:`font-mono text-[11px] text-muted`,children:n})]})}function At({planId:e,pick:t,video:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``);(0,X.useEffect)(()=>{let n=!1;return i(null),o(``),P.reportCase(e,t.case).then(e=>!n&&i(e),e=>!n&&o(e.message)),()=>{n=!0}},[e,t.case]);let s=Dt(t.status),c=t.group===`failed`||t.group===`attention`;return(0,Z.jsxs)(`section`,{"aria-label":`Test case ${t.name}`,className:`flex min-w-0 flex-col gap-3 rounded-[12px] card border p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-1`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[15px] font-semibold [overflow-wrap:anywhere]`,children:t.name}),(0,Z.jsxs)(`p`,{className:`m-0 pt-0.5 text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[t.file?(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:t.file}):`No file`,t.suites.length?` · ${t.suites.join(`, `)}`:``,t.folders.length?` · ${t.folders.join(` / `)}`:``]}),(t.uid||t.change)&&(0,Z.jsxs)(`p`,{className:`m-0 pt-0.5 text-[12px] text-muted [overflow-wrap:anywhere]`,children:[t.uid?(0,Z.jsxs)(`span`,{children:[`Tosca id `,(0,Z.jsx)(`span`,{className:`font-mono`,children:t.uid})]}):null,t.uid&&t.change?` · `:``,t.change?jt[t.change]:``]})]}),(0,Z.jsx)(L,{tone:s.tone,children:s.label}),t.ms>0&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:ze(t.ms)})]}),a&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),!r&&!a&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&(0,Z.jsxs)(Z.Fragment,{children:[(r.problems?.length||r.reason)&&(0,Z.jsx)(`div`,{className:M(`flex flex-col gap-1 rounded-[10px] px-3 py-2 text-[13px] [overflow-wrap:anywhere]`,c?`bg-fail-soft text-fail`:`bg-surface-muted text-ink-2`),children:(r.problems?.length?r.problems:[r.reason]).map((e,t)=>(0,Z.jsx)(`span`,{children:e},t))}),r.media.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:n?`Video and failure screenshots`:`Failure screenshots`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-3 p-0`,children:r.media.map(t=>(0,Z.jsx)(kt,{planId:e,unit:r.unit,file:t},t))})]}):r.unit&&r.group!==`notrun`?(0,Z.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:c?`No screenshot${n?` or video`:``} was kept for this failure.`:n?`No video was kept for this run.`:`No screenshot: the test passed.`}):null,r.fidelity&&r.fidelity.rows.length>0&&(0,Z.jsx)(Fe,{title:`Tosca steps (${r.fidelity.matched} of ${r.fidelity.required} in the test)`,defaultOpen:!!(r.fidelity.missing.length||r.personSteps.length),children:(0,Z.jsx)(ve,{label:`Tosca steps`,placeholder:`Find a step`,height:`min(40vh, 360px)`,resetKey:t.case,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,`w-14`),children:`Step`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`What it does`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`In the test`})]}),children:r.fidelity.rows.map(e=>{let t=tt[e.status]||tt.matched;return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`font-mono text-[12px] text-muted`),children:e.id}),(0,Z.jsxs)(`td`,{className:M(`px-3 py-2`,`[overflow-wrap:anywhere]`),children:[e.kind===`assert`?`check ${e.op}`:e.op,` on `,e.element||`—`,e.step&&(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[`Tosca “`,e.step,`”`]})]}),(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`whitespace-nowrap`),children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:M(`size-2 flex-none rounded-full`,t.dot)}),t.label]})})]},e.id)})})}),r.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`$ `,r.command]}),r.output&&(0,Z.jsx)(Fe,{title:`Test output`,defaultOpen:c,children:(0,Z.jsx)(`pre`,{className:`m-0 max-h-[40vh] overflow-auto rounded-[10px] bg-surface-muted px-3 py-2 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:r.output})})]})]})}var jt={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},Mt=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function Nt(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(` / `),Dt(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?jt[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(Mt).join(`,`)).join(`\r
1
+ import{$n as e,$t as t,A as n,An as r,Ar as i,At as a,Bn as o,C as s,Dn as c,Dt as l,Fn as u,Gn as d,Ht as f,Ir as p,Kt as m,L as h,Mn as g,Nr as _,Or as v,T as y,Un as b,Zn as x,a as S,gr as C,gt as w,hn as T,j as E,kr as D,lt as O,m as k,o as ee,ot as te,pr as ne,rt as re,tn as A,tt as j,wr as ie,wt as ae}from"./line-icons-CQ-3V8ax.js";import{B as M,R as N,Ut as P,Wt as F,Z as oe,_ as se,a as I,c as L,d as R,f as z,h as B,i as V,l as H,m as ce,n as U,o as W,qt as le,r as G,s as ue,t as de}from"./filters-mFECJpMB.js";import{Dt as fe,Et as pe,L as me,N as he,Ot as ge,at as _e,et as ve,gt as ye,it as be,nt as xe,ot as Se,r as Ce,rt as K,t as we,tt as q,z as Te}from"./frame-DiKY0GWx.js";import{B as Ee,M as De,N as Oe,c as ke,r as Ae,s as J,z as je}from"./index-HjX2EOmp.js";import{n as Me,t as Ne}from"./segmented-DANusepM.js";import{n as Pe}from"./families-B0QIuAe3.js";import{t as Fe}from"./fold-HnodvJWj.js";import{r as Ie,s as Le,t as Re}from"./logos-CNarWSPL.js";import{d as ze,o as Be,p as Ve,r as He,s as Ue,t as We}from"./parts-z_AE9U-M.js";import{a as Ge,c as Ke,d as qe,f as Je,g as Ye,h as Xe,i as Ze,l as Qe,m as Y,o as $e,p as et,r as tt,s as nt,t as rt,u as it}from"./Steps-DjR_K32c.js";var X=p(_(),1),Z=le(),at=500,ot=10;function st({plan:e,acceptLimits:t,next:n,again:r,onClose:a,onStarted:o}){let s=e.units.filter(e=>e.kind===`test`).length,[l,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!!n),[m,h]=(0,X.useState)(String(n?.size||ot)),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(``),b=Number(m),x=Number.isInteger(b)&&b>=1&&b<=at,S=async()=>{_(!0),y(``);try{o((await P.start(e.id,l,t,f?b:void 0)).detail)}catch(e){y(e.message),_(!1)}};return(0,Z.jsx)(ge,{open:!0,onClose:a,title:n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,description:n?`${(b||n.size)>=n.left?`The last ${n.left===1?`test case`:`${n.left} test cases`} not tried yet ${n.left===1?`is`:`are`}`:`The next ${b||n.size} of the ${n.left} test cases not tried yet are`} written as ${e.target.title} tests in ${e.target.dir}. What is done is kept; a failed test stays for you to fix.`:r?`ForgeQE picks up where the conversion stopped: what is done and unchanged is kept, the rest is written as ${e.target.title} tests in ${e.target.dir}. It runs in the background.`:`The Tosca test cases are written as ${e.target.title} tests in ${e.target.dir}, and ForgeQE runs each one. It runs in the background; the Tosca export is not changed.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:a,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(N,{variant:`primary`,disabled:g||l!==e.id||f&&!x,onClick:()=>void S(),"data-tip":n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,children:[r?(0,Z.jsx)(u,{"aria-hidden":`true`}):(0,Z.jsx)(c,{"aria-hidden":`true`}),n?`Continue`:r?`Start again`:`Start`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&s>1&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:f,onCheckedChange:p}),(0,Z.jsxs)(`span`,{children:[`Convert in batches`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`A few test cases at a time, stopping after each batch so you can check them before the next.`})]})]}),f&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{children:`Test cases per batch`}),(0,Z.jsx)(I,{type:`number`,min:1,max:at,step:1,inputMode:`numeric`,value:m,"aria-invalid":!x,"aria-describedby":x?void 0:`batch-size-error`,onChange:e=>h(e.target.value),className:`w-24`}),!x&&(0,Z.jsxs)(`p`,{id:`batch-size-error`,role:`alert`,className:`m-0 text-[12.5px] text-fail`,children:[`A whole number from 1 to `,at,`.`]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Z.jsx)(I,{value:l,onChange:e=>d(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Z.jsx)(Ze,{error:v})]})})}function ct(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?Ge[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:qe[e.plan.feasibility.verdict]}var Q=e=>e.slice(e.lastIndexOf(`/`)+1);function lt({d:e,onClose:t}){let n=(e.plan.sources||[]).some(e=>e.workspace),[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),l=async()=>{o(!0),c(``);try{let t=await P.reimport(e.plan.id,n&&r);location.hash=z(`tosca`,t.plan.id)}catch(e){c(e.message),o(!1)}};return(0,Z.jsx)(ge,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,Z.jsx)(N,{variant:`primary`,disabled:a,onClick:()=>void l(),children:a?`Reading…`:`Make the new plan`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[n&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:r,onCheckedChange:i}),(0,Z.jsxs)(`span`,{children:[`Get the newest commit of the cloned repositories`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Each is cloned again, as before; the old copy stays for this plan.`})]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s})]})})}var ut=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function dt({id:e,onClose:t}){let[n,r]=(0,X.useState)(`github`),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let t=!0;return a(null),p(!1),s(``),l(``),P.ci(e,n).then(e=>t&&a(e),e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let m=i?i.file.slice(i.file.lastIndexOf(`/`)+1):``,h=()=>{if(!i)return;let e=URL.createObjectURL(new Blob([i.text],{type:`text/yaml;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=m,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},g=async()=>{d(!0),s(``);try{let t=await P.writeCi(e,n);p(!0),l(`Added ${t.file}.${n===`github`?` GitHub runs a workflow only from ${t.path}: move it there.`:` Create a pipeline from it in Azure DevOps.`}`)}catch(e){s(e.message)}finally{d(!1)}};return(0,Z.jsxs)(ge,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:`Close`}),(0,Z.jsxs)(N,{disabled:!i,onClick:h,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`Download`]}),!f&&(0,Z.jsx)(N,{variant:`primary`,disabled:!i||u,onClick:()=>void g(),"data-tip":`Into the target folder's ci/, so a pull request of the conversion carries it.`,children:u?`Adding…`:`Add to the target folder`})]}),children:[(0,Z.jsx)(he,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:ut}),(0,Z.jsxs)(`div`,{id:`panel-ci-${n}`,role:`tabpanel`,"aria-labelledby":`tab-ci-${n}`,className:`flex flex-col gap-4 text-sm`,children:[!i&&!o&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Making the pipeline…`}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),c&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-ink [overflow-wrap:anywhere]`,children:c}),i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1.5`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Jobs`}),(0,Z.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 ${Y(i.workflows,`workflow`)}`]:[]].join(`; `)}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Goes in`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:i.path}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`To set`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[i.tests&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:`BASE_URL`}),` as a variable`]}),i.secrets.length?(0,Z.jsxs)(Z.Fragment,{children:[i.tests?`; as `:`As `,n===`github`?`secrets`:`secret variables`,`: `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:i.secrets.join(`, `)})]}):null,!i.tests&&!i.secrets.length?`None`:null,i.skipped.length?(0,Z.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[`Not passed, not a name the CI takes: `,i.skipped.join(`, `)]}):null]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px] text-muted`,children:m}),(0,Z.jsx)(ke,{text:i.text,label:`Copy ${m}`})]}),(0,Z.jsx)(`pre`,{"aria-label":m,tabIndex:0,className:`m-0 max-h-[420px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-3 font-mono text-[12px] leading-relaxed whitespace-pre text-ink-2`,children:i.text})]})]})]})]})}function ft({id:e,onClose:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(``),g=(t=``)=>P.pr(e,t).then(e=>{r(e),h(``),e.preview&&(a(e.preview),s(t=>t||e.preview.base),l(t=>t||e.preview.title))},e=>h(e.message));(0,X.useEffect)(()=>{g()},[e]),(0,X.useEffect)(()=>{if(n?.job?.state!==`running`)return;let e=setTimeout(()=>void g(o),1e3);return()=>clearTimeout(e)},[n]);let _=async()=>{p(!0),h(``);try{let t=await P.openPr(e,{base:o.trim(),title:c.trim(),draft:u});r(e=>e&&{...e,job:t.job})}catch(e){h(e.message)}finally{p(!1)}},v=i,y=n?.job,b=y?.state===`running`,x=y?.state===`done`?y.result:void 0,S=m||(y?.state===`failed`?y.error:``)||(n&&!n.preview?n.problem:``)||``,C=e=>/^https:\/\//.test(e)?e:void 0,w=(e,t)=>(0,Z.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 text-accent-fg`,children:[t,(0,Z.jsx)(re,{size:11,"aria-hidden":`true`})]});return(0,Z.jsx)(ge,{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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:x?`Close`:`Cancel`}),!x&&(0,Z.jsx)(N,{variant:`primary`,disabled:!v||!n?.preview||f||b||!o.trim(),onClick:()=>void _(),children:f?`Starting…`:b?`Pushing…`:`Push and open the pull request`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&!m&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Checking the repository…`}),S&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:S}),x&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-ink [overflow-wrap:anywhere]`,children:[x.existing?`Nothing new to push: this is the pull request.`:`Pushed ${Y(x.files,`file`)} on ${x.branch}.`,` `,C(x.url)?w(C(x.url),`Open the pull request`):`It is open on ${x.branch}; the host gave no https address to link to.`]}),v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1.5`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Repository`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[v.platform===`github`?`GitHub`:`Azure DevOps`,` `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:v.repository}),` (`,v.remote,`)`]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Branch`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:v.branch}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[Y(v.files.length,`file`),` of `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:v.folder})]})]}),v.last&&C(v.last.url)&&!x&&(0,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Opened before: `,w(C(v.last.url),`the pull request`),`. Pushing again updates its branch.`]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Merge into`}),(0,Z.jsx)(I,{value:o,spellCheck:!1,maxLength:200,placeholder:`main`,"aria-invalid":!(!n||n.preview),onChange:e=>s(e.target.value),onBlur:()=>o.trim()&&o.trim()!==n?.preview?.base&&void g(o.trim()),disabled:b,className:`font-mono`})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Title`}),(0,Z.jsx)(I,{value:c,maxLength:200,onChange:e=>l(e.target.value),disabled:b})]}),(0,Z.jsxs)(`label`,{className:M(`flex items-start gap-2`,b?`cursor-default`:`cursor-pointer`),children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:u,onCheckedChange:d,disabled:b}),(0,Z.jsxs)(`span`,{children:[`Open it as a draft`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Reviewers are not asked yet.`})]})]}),(0,Z.jsx)(Fe,{title:`Files (${v.files.length})`,children:(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 font-mono text-[12.5px]`,children:[v.files.slice(0,200).map(e=>(0,Z.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e)),v.files.length>200&&(0,Z.jsxs)(`li`,{className:`text-muted`,children:[`and `,v.files.length-200,` more`]})]})}),v.skipped.length>0&&(0,Z.jsx)(Fe,{title:`Left out (${v.skipped.length})`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[12.5px]`,children:v.skipped.slice(0,100).map(e=>(0,Z.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),`: `,(0,Z.jsx)(`span`,{className:`text-muted`,children:e.why})]},e.path))})})]})]})})}function pt({id:e,title:t,targetDir:n,onClose:r}){let[i,a]=(0,X.useState)(``),[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=async()=>{c(!0),u(``);try{await P.delete(e,i),location.hash=z(`tosca`,`conversions`)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(ge,{open:!0,onClose:r,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Z.jsx)(s,{"aria-hidden":`true`}),`Keep`]}),(0,Z.jsxs)(N,{variant:`danger`,disabled:o||i!==e,onClick:()=>void d(),children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Z.jsx)(I,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function mt({d:e,unit:t,onClose:n,onSend:r}){let[a,o]=(0,X.useState)(``),s=e.plan.units.find(e=>e.id===t),c=e.result?.units.find(e=>e.id===t);return(0,Z.jsx)(ge,{open:!0,onClose:n,title:`Fix ${s?Q(s.target):t}`,description:`The Tosca agent works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:n,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(N,{variant:`primary`,onClick:()=>r(a.trim()),"data-tip":`Send to the agent`,children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Send`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c.problems[0]}):null,(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,Z.jsx)(ue,{value:a,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function ht({d:e,unit:t,onClose:n}){let r=e.result?.units.find(e=>e.id===t),a=e.plan.units.find(e=>e.id===t);return(0,Z.jsx)(ge,{open:!0,onClose:n,wide:!0,title:`Output of ${a?Q(a.target):t}`,description:r?.checkedAt?`Run again ${Ve(r.checkedAt)}`:`From the conversion's own run`,footer:(0,Z.jsxs)(N,{onClick:n,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Close`]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r?.problems?.length?(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r.problems.join(` `)}):r?.status===`converted`?(0,Z.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,r?.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted`,children:[`$ `,r.command]}),(0,Z.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto rounded-[12px] bg-surface-muted px-3 py-2 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:r?.output||`No output.`})]})})}function gt(e){let t=Object.fromEntries(nt.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 _t({label:e,children:t}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`dt`,{className:`text-[11.5px] text-muted`,children:e}),(0,Z.jsx)(`dd`,{className:`m-0 text-[13px] text-ink [overflow-wrap:anywhere] tabular-nums`,children:t})]})}function vt({d:e,planView:t,busy:n,onFix:r,onSteps:i,onOutput:a,onRun:s,onNext:l}){let u=e.result||(e.job?.running?gt(e):null);if(!u)return(0,Z.jsx)(Z.Fragment,{children:t});let d=new Map(u.units.map(e=>[e.id,e])),f=e.plan.units.filter(e=>e.kind===`test`&&!e.engine),p=e.plan.units.filter(e=>e.kind===`test`&&e.engine),m=new Set(f.map(e=>e.id)),h=new Set(p.map(e=>e.id)),g=u.units.filter(e=>m.has(e.id)&&e.status===`converted`).length,_=u.units.filter(e=>h.has(e.id)&&e.status===`written`).length,v=u.units.reduce((e,t)=>t.fidelity?{m:e.m+t.fidelity.matched,n:e.n+t.fidelity.required}:e,{m:0,n:0}),y=u.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,b=e=>u.units.filter(t=>(m.has(t.id)||h.has(t.id))&&t.status===e).length,x=f.length+p.length,S=[{label:`Failed`,n:b(`failed`),bar:`bg-fail`},{label:`Needs a look`,n:b(`blocked`),bar:`bg-warn`},{label:`Passing`,n:g,bar:`bg-pass`},{label:p.length===1?`Workflow written`:`Workflows written`,n:_,bar:`bg-line-strong`},{label:p.length?`Not done yet`:`Not run yet`,n:Math.max(0,x-u.units.filter(e=>m.has(e.id)||h.has(e.id)).length),bar:`bg-line`}],[C,...w]=e.plan.target.id.split(`-`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-[12px] card border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:f.length?`${g} of ${f.length} passing`:`${_} of ${Y(p.length,`workflow`)} written`}),S.filter(e=>e.n>0).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-ink-2`,children:[(0,Z.jsx)(`span`,{className:M(`size-2 rounded-full`,e.bar),"aria-hidden":`true`}),e.label,` `,(0,Z.jsx)(`span`,{className:M(`tabular-nums`,e.label===`Failed`?`text-fail`:``),children:e.n})]},e.label))]}),(0,Z.jsx)(`div`,{className:`flex h-1.5 overflow-hidden rounded-full bg-surface-strong`,"aria-hidden":`true`,children:S.map(e=>e.n?(0,Z.jsx)(`span`,{className:e.bar,style:{width:`${e.n/Math.max(1,x)*100}%`}},e.label):null)}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-2 gap-x-6 gap-y-2 @3xl:grid-cols-4`,children:[(0,Z.jsx)(_t,{label:u.status===`running`?`Running for`:`Took`,children:ze(u.status===`running`?Date.now()-Date.parse(u.startedAt):u.ms)}),(0,Z.jsx)(_t,{label:`Tosca steps in the tests`,children:(0,Z.jsx)(`span`,{className:v.n&&v.m===v.n?`text-pass`:void 0,children:v.n?`${v.m} of ${v.n}`:`–`})}),(0,Z.jsx)(_t,{label:`Need attention`,children:(0,Z.jsx)(`span`,{className:y?`text-fail`:void 0,children:y})}),(0,Z.jsx)(_t,{label:`Pages`,children:Y(e.plan.units.filter(e=>e.kind===`page`).length,`page object`)})]})]}),u.notes&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:u.notes}),u.batch&&u.batch.left>0&&u.status!==`running`&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-sm text-ink`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Batch `,u.batch.runs,` is done. Check its tests, then continue: `,Y(u.batch.left,`test case`),` not tried yet.`]}),(0,Z.jsxs)(N,{size:`sm`,disabled:n,onClick:l,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Continue with the next batch`]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-5 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Z.jsx)(`div`,{className:`@container min-w-0`,children:(0,Z.jsx)(ve,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,height:`min(58vh, 580px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:K,children:`File`}),(0,Z.jsx)(`th`,{className:K,children:`Status`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @3xl:table-cell`),children:`Note`}),(0,Z.jsx)(`th`,{className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let s=d.get(t.id),c=s?it[s.status]:null,l=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,Z.jsxs)(`tr`,{className:_e,children:[(0,Z.jsxs)(`td`,{className:q,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:Q(t.target)}),(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[l?t.engine?`${Xe(t)} · ${l.name}`:l.name:`${Xe(t)} · ${t.target}`,l?.suites?.length?` · ${l.suites.join(`, `)}`:``]})]}),(0,Z.jsxs)(`td`,{className:M(q,`whitespace-nowrap`),children:[c?(0,Z.jsx)(L,{tone:c.tone,children:c.label}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`}),s?.checkedAt&&(0,Z.jsxs)(`span`,{className:`block pt-1 text-[12px] text-muted`,children:[`Run again `,Ae(s.checkedAt)]})]}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[13px] whitespace-nowrap @2xl:table-cell`),children:s?.fidelity?(0,Z.jsxs)(`span`,{className:s.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[s.fidelity.matched,` of `,s.fidelity.required]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Z.jsx)(`span`,{className:`line-clamp-2`,children:s?.problems?.[0]||s?.reason||``})}),(0,Z.jsx)(`td`,{className:M(q,`whitespace-nowrap text-right`),children:(0,Z.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(s?.output||s?.problems?.length)&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,"aria-label":`Output of ${Q(t.target)}`,"data-tip":`Output of ${Q(t.target)}`,onClick:()=>a(t.id),children:(0,Z.jsx)(o,{"aria-hidden":`true`})}),t.case&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,"aria-label":`Steps of ${Q(t.target)}`,"data-tip":`Steps of ${Q(t.target)}`,onClick:()=>i(t.case),children:(0,Z.jsx)(A,{"aria-hidden":`true`})}),s&&(s.status===`failed`||s.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Fix ${Q(t.target)}`,"data-tip":`Fix ${Q(t.target)}`,onClick:()=>r(t.id),children:(0,Z.jsx)(D,{"aria-hidden":`true`})})]})})]},t.id)})})}),(0,Z.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-5 text-sm @5xl:sticky @5xl:top-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`From`}),(0,Z.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?` · ${e.plan.source.project}`:``]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`To`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Le,{framework:C,language:w.join(`-`)}),e.plan.target.title]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(e.plan.suites||[]).length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Suites`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:e.plan.suites.map(e=>{let t=new Set(e.cases),r=u.units.filter(e=>e.kind===`test`&&e.case&&t.has(e.case)&&e.status===`converted`).length;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Z.jsxs)(`span`,{className:M(`text-[12px]`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,Y(e.cases.length,`test`),` pass · @`,e.tag]})]}),(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Run the ${e.name} suite`,"data-tip":`Run the ${e.name} suite`,onClick:()=>s(e.name),children:(0,Z.jsx)(c,{"aria-hidden":`true`})})]},e.name)})})]}),e.plan.env.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Environment variables`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[e.name,e.secret?(0,Z.jsx)(`span`,{className:`font-sans text-muted`,children:` · secret`}):null]}),(0,Z.jsx)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Z.jsx)(`dd`,{className:`m-0 text-right`,children:Ve(u.startedAt)}),u.model&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Z.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":u.model,children:u.model})]}),u.reverted.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Z.jsxs)(`dd`,{className:`m-0 text-right`,children:[u.reverted.length,` edits outside the target`]})]})]})]})]})]})}var yt={fail:{icon:h,cls:`text-fail`,label:`Failed`},ok:{icon:E,cls:`text-pass`,label:`Done`},info:{icon:f,cls:`text-muted`,label:`Info`},agent:{icon:k,cls:`text-accent-fg`,label:`Agent`},tool:{icon:D,cls:`text-muted`,label:`Tool`}};function bt(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:`${a.id} · ${Xe(a)} · ${a.target}`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:Ke[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var xt=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function St({d:e,events:t,running:n}){let r=(0,X.useRef)(null),i=(0,X.useRef)(!0),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(`all`),[l,u]=(0,X.useState)({}),d=bt(t,e),f=a.trim().toLowerCase(),p=e=>(s===`all`||e.kind===s)&&(!f||e.text.toLowerCase().includes(f)),m=s!==`all`||!!f,h=d.map(e=>({...e,lines:e.events.filter(p),matchTitle:!!f&&`${e.title} ${e.sub}`.toLowerCase().includes(f)})).map(e=>({...e,lines:e.matchTitle?e.events.filter(e=>s===`all`||e.kind===s):e.lines})).filter(e=>e.lines.length),g=e=>t.filter(t=>t.kind===e).length,_=d[d.length-1]?.key;return(0,X.useEffect)(()=>{n&&!m&&i.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t.length,n,m]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{id:`tosca-activity-search`,label:`Find a line`,value:a,onChange:o,placeholder:`Find a line, test case or file`}),(0,Z.jsx)(de,{items:[{id:`all`,label:`All`,n:t.length},{id:`fail`,label:`Failed`,n:g(`fail`),alert:!0},{id:`ok`,label:`Done`,n:g(`ok`)},{id:`info`,label:`Info`,n:g(`info`)},{id:`agent`,label:`Agent`,n:g(`agent`)},{id:`tool`,label:`Tools`,n:g(`tool`)}],value:s,onChange:c})]}),(0,Z.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] flex-col overflow-y-auto rounded-[12px] card border`,children:[h.map(e=>{let t=e.events.filter(e=>e.kind===`fail`).length,r=l[e.key]??(m||t>0||n&&e.key===_),i=`act-${e.key.replace(/[^A-Za-z0-9_-]/g,`-`)}`,a=e.status?it[e.status]:void 0;return(0,Z.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":i,onClick:()=>u(t=>({...t,[e.key]:!r})),className:`flex w-full min-w-0 cursor-pointer items-center gap-3 border-0 bg-transparent px-4 py-2.5 text-left hover:bg-surface-muted`,children:[(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:M(`flex-none text-muted transition-transform`,r&&`rotate-180`)}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsx)(`span`,{className:`block truncate font-mono text-[12px] text-muted`,children:e.sub})]}),(0,Z.jsxs)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:[m&&e.lines.length!==e.events.length?`${e.lines.length} of ${Y(e.events.length,`line`)}`:Y(e.events.length,`line`),t>0&&(0,Z.jsxs)(`span`,{className:`text-fail`,children:[` · `,t,` failed`]})]}),a&&(0,Z.jsx)(L,{tone:a.tone,children:a.label})]}),(0,Z.jsx)(fe,{open:r,id:i,children:(0,Z.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=yt[e.kind];return(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft py-2 pr-4 pl-11 text-[13px] last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`w-[76px] flex-none text-[12px] whitespace-nowrap text-muted tabular-nums`,children:xt(e.ts)}),(0,Z.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:M(`mt-0.5 flex-none`,n.cls)}),(0,Z.jsx)(`span`,{className:M(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:e.kind===`tool`?`font-mono text-[12px] text-muted`:`text-ink-2`),children:e.text})]},t)})})})]},e.key)}),!h.length&&(0,Z.jsx)(`p`,{className:`m-0 px-4 py-8 text-center text-sm text-muted`,children:t.length?`No line matches.`:`Nothing yet.`})]})]})}function Ct({id:t,plan:n}){let[r,i]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[l,d]=(0,X.useState)(`overview`),[f,p]=(0,X.useState)(),[m,h]=(0,X.useState)(null),[_,b]=(0,X.useState)(null),[x,C]=(0,X.useState)([]),[w,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,re]=(0,X.useState)(!1),[A,j]=(0,X.useState)(!1),[ie,ae]=(0,X.useState)(!1),[M,F]=(0,X.useState)(!1),[oe,se]=(0,X.useState)(!1),[I,R]=(0,X.useState)(!1),B=(0,X.useRef)(0),V=(0,X.useCallback)(()=>{P.detail(t).then(e=>{i(e),s(``)},e=>s(e.message));let e=B.current;P.events(t,e).then(e=>{if(e.next<B.current){B.current=0,C([]);return}let t=B.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));B.current=e.next,n.length&&C(e=>[...e,...n].slice(-2e3))},()=>{})},[t]);(0,X.useEffect)(V,[V]);let H=!!(r?.job?.running||r?.result?.status===`running`);(0,X.useEffect)(()=>{if(!H)return;let e=setInterval(V,1500);return()=>clearInterval(e)},[H,V]);let ce=(0,X.useCallback)(e=>{i(e),s(``),d(`overview`),setTimeout(V,800)},[V]),U=async e=>{E(!0),s(``);try{i(await e()),setTimeout(V,800)}catch(e){s(e.message)}finally{E(!1)}};if(!r)return o?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let W=ct(r),le=Ye(r.plan,r.result),G=r.result,ue=(G?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,de=r.plan.cases.filter(e=>e.included).length,fe=[{id:`overview`,label:`Overview`},{id:`steps`,label:`Steps`,n:de?String(de):void 0,tone:ue?`text-fail`:void 0},{id:`activity`,label:`Activity`}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,`conversions`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),`Conversions`]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 @3xl:flex-row @3xl:items-start`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:Q(r.plan.source.file)}),(0,Z.jsx)(ee,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(Le,{framework:r.plan.target.id.split(`-`)[0],language:r.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),r.plan.target.title]})]}),(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-1.5 text-sm text-muted`,children:[(0,Z.jsxs)(`span`,{children:[`Tricentis Tosca`,r.plan.source.project?` · ${r.plan.source.project}`:``]}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsxs)(`span`,{children:[`into `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:r.plan.target.dir})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{tone:W.tone,children:W.label}),H?(0,Z.jsxs)(N,{variant:`danger`,disabled:w,onClick:()=>void U(()=>P.stop(t)),children:[(0,Z.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,Z.jsxs)(Z.Fragment,{children:[G&&(G.status===`stopped`||G.status===`failed`)&&(0,Z.jsxs)(N,{disabled:w,onClick:()=>R(!0),"data-tip":`Start this conversion again. Tests it already wrote are kept.`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Start again`]}),G&&(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>location.hash=z(`tosca`,t,`report`),children:[(0,Z.jsx)(te,{"aria-hidden":`true`}),`Report`]}),G&&r.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,Z.jsxs)(N,{disabled:w,onClick:()=>void U(()=>P.verify(t)),"data-tip":`Run every converted test again, no agent`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Run`]}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsxs)(N,{variant:`ghost`,disabled:w,"aria-haspopup":`menu`,"aria-expanded":M,onClick:()=>F(!M),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`More`,(0,Z.jsx)(y,{"aria-hidden":`true`})]}),(0,Z.jsxs)(De,{open:M,onClose:()=>F(!1),label:`More for this conversion`,side:`auto`,className:`right-0 w-[240px]`,children:[G&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),re(!0)),children:[(0,Z.jsx)(g,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`Re-import`]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),ae(!0)),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`CI`]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),j(!0)),children:[(0,Z.jsx)(a,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`Pull request`]}),(0,Z.jsx)(`div`,{role:`separator`,className:`mx-2 my-1 border-t border-line-soft`})]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),O(!0)),children:[(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-fail`}),(0,Z.jsx)(`span`,{className:`text-fail`,children:`Delete`})]})]})]})]})]})]}),k&&(0,Z.jsx)(lt,{d:r,onClose:()=>re(!1)}),A&&(0,Z.jsx)(ft,{id:t,onClose:()=>j(!1)}),ie&&(0,Z.jsx)(dt,{id:t,onClose:()=>ae(!1)}),I&&(0,Z.jsx)(st,{plan:r.plan,acceptLimits:!1,again:!0,onClose:()=>R(!1),onStarted:e=>{R(!1),i(e)}}),oe&&r.result?.batch&&(0,Z.jsx)(st,{plan:r.plan,acceptLimits:!1,next:r.result.batch,onClose:()=>se(!1),onStarted:e=>{se(!1),i(e)}}),D&&(0,Z.jsx)(pt,{id:t,title:`${Q(r.plan.source.file)} → ${r.plan.target.title}`,targetDir:r.plan.target.dir,onClose:()=>O(!1)}),G&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[12px] card border px-3 py-2.5 @xl:gap-4 @xl:px-4`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(Qe,{states:G.stages})}),H&&(0,Z.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(le)}% done`,children:[Math.round(le),`%`]})]}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),(0,Z.jsx)(Ue,{tabs:fe,tab:l,onTab:d,label:`Tosca conversion`}),(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`mpanel-${l}`,"aria-labelledby":`mtab-${l}`,className:`pane-swap flex min-w-0 flex-col gap-4`,children:[l===`overview`&&(0,Z.jsx)(vt,{d:r,planView:n(r,ce),busy:w||H,onFix:h,onSteps:e=>(p(e),d(`steps`)),onOutput:b,onRun:e=>void U(()=>P.verify(t,e)),onNext:()=>se(!0)}),l===`steps`&&(0,Z.jsx)(rt,{id:t,plan:r.plan,result:G,initial:f}),l===`activity`&&(0,Z.jsx)(St,{d:r,events:x,running:H})]},l),_&&(0,Z.jsx)(ht,{d:r,unit:_,onClose:()=>b(null)}),m&&(0,Z.jsx)(mt,{d:r,unit:m,onClose:()=>h(null),onSend:e=>{h(null),U(()=>P.fix(t,[m],e))}})]})}var wt=e=>e.slice(e.lastIndexOf(`/`)+1),Tt=50,Et=[{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 Dt(e){return e===`converted`?it.converted:e===`failed`?it.failed:e===`blocked`?it.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?it.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function Ot(e){for(let t of nt){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function kt({planId:e,unit:t,file:n}){let r=/\.(webm|mp4)$/i.test(n),[i,a]=(0,X.useState)(!r),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{if(!i)return;let r=!1;return s(``),u(!1),P.evidence(e,t,n).then(e=>!r&&s(e),()=>!r&&u(!0)),()=>{r=!0}},[e,t,n,i]),(0,Z.jsxs)(`li`,{className:`flex w-[260px] max-w-full flex-col gap-1`,children:[o?r?(0,Z.jsx)(`video`,{controls:!0,autoPlay:!0,src:o,className:`max-h-[200px] w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,Z.jsx)(`img`,{src:o,alt:`Screenshot ${n}`,className:`max-h-[200px] w-full rounded-[10px] border border-line-soft object-contain`}):r&&!i?(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>a(!0),className:`h-[120px] w-full rounded-[10px] border border-line-soft bg-surface-muted`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Play video`]}):(0,Z.jsx)(`span`,{role:`status`,className:`flex h-[120px] items-center justify-center rounded-[10px] border border-line-soft bg-surface-muted text-[12px] text-muted`,children:l?`Not available`:`Loading…`}),(0,Z.jsx)(`span`,{className:`font-mono text-[11px] text-muted`,children:n})]})}function At({planId:e,pick:t,video:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``);(0,X.useEffect)(()=>{let n=!1;return i(null),o(``),P.reportCase(e,t.case).then(e=>!n&&i(e),e=>!n&&o(e.message)),()=>{n=!0}},[e,t.case]);let s=Dt(t.status),c=t.group===`failed`||t.group===`attention`;return(0,Z.jsxs)(`section`,{"aria-label":`Test case ${t.name}`,className:`flex min-w-0 flex-col gap-3 rounded-[12px] card border p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-1`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[15px] font-semibold [overflow-wrap:anywhere]`,children:t.name}),(0,Z.jsxs)(`p`,{className:`m-0 pt-0.5 text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[t.file?(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:t.file}):`No file`,t.suites.length?` · ${t.suites.join(`, `)}`:``,t.folders.length?` · ${t.folders.join(` / `)}`:``]}),(t.uid||t.change)&&(0,Z.jsxs)(`p`,{className:`m-0 pt-0.5 text-[12px] text-muted [overflow-wrap:anywhere]`,children:[t.uid?(0,Z.jsxs)(`span`,{children:[`Tosca id `,(0,Z.jsx)(`span`,{className:`font-mono`,children:t.uid})]}):null,t.uid&&t.change?` · `:``,t.change?jt[t.change]:``]})]}),(0,Z.jsx)(L,{tone:s.tone,children:s.label}),t.ms>0&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:ze(t.ms)})]}),a&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),!r&&!a&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&(0,Z.jsxs)(Z.Fragment,{children:[(r.problems?.length||r.reason)&&(0,Z.jsx)(`div`,{className:M(`flex flex-col gap-1 rounded-[10px] px-3 py-2 text-[13px] [overflow-wrap:anywhere]`,c?`bg-fail-soft text-fail`:`bg-surface-muted text-ink-2`),children:(r.problems?.length?r.problems:[r.reason]).map((e,t)=>(0,Z.jsx)(`span`,{children:e},t))}),r.media.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:n?`Video and failure screenshots`:`Failure screenshots`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-3 p-0`,children:r.media.map(t=>(0,Z.jsx)(kt,{planId:e,unit:r.unit,file:t},t))})]}):r.unit&&r.group!==`notrun`?(0,Z.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:c?`No screenshot${n?` or video`:``} was kept for this failure.`:n?`No video was kept for this run.`:`No screenshot: the test passed.`}):null,r.fidelity&&r.fidelity.rows.length>0&&(0,Z.jsx)(Fe,{title:`Tosca steps (${r.fidelity.matched} of ${r.fidelity.required} in the test)`,defaultOpen:!!(r.fidelity.missing.length||r.personSteps.length),children:(0,Z.jsx)(ve,{label:`Tosca steps`,placeholder:`Find a step`,height:`min(40vh, 360px)`,resetKey:t.case,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,`w-14`),children:`Step`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`What it does`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`In the test`})]}),children:r.fidelity.rows.map(e=>{let t=tt[e.status]||tt.matched;return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`font-mono text-[12px] text-muted`),children:e.id}),(0,Z.jsxs)(`td`,{className:M(`px-3 py-2`,`[overflow-wrap:anywhere]`),children:[e.kind===`assert`?`check ${e.op}`:e.op,` on `,e.element||`—`,e.step&&(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[`Tosca “`,e.step,`”`]})]}),(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`whitespace-nowrap`),children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:M(`size-2 flex-none rounded-full`,t.dot)}),t.label]})})]},e.id)})})}),r.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`$ `,r.command]}),r.output&&(0,Z.jsx)(Fe,{title:`Test output`,defaultOpen:c,children:(0,Z.jsx)(`pre`,{className:`m-0 max-h-[40vh] overflow-auto rounded-[10px] bg-surface-muted px-3 py-2 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:r.output})})]})]})}var jt={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},Mt=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function Nt(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(` / `),Dt(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?jt[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(Mt).join(`,`)).join(`\r
2
2
  `),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)}function Pt({g:e,rows:t,open:n,onToggle:r,pick:i,onPick:a}){let o=()=>Math.max(0,Math.floor(t.findIndex(e=>e.case===i)/Tt)),[s,c]=(0,X.useState)(o),l=(0,X.useId)();(0,X.useEffect)(()=>c(o()),[t.length]);let u=t.slice(s*Tt,s*Tt+Tt);return(0,Z.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":l,onClick:r,className:`flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-3 py-2 text-left hover:bg-surface-muted`,children:[(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:M(`flex-none text-muted transition-transform`,n&&`rotate-180`)}),(0,Z.jsx)(`span`,{className:M(`size-2 flex-none rounded-full`,e.bar),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:t.length})]}),(0,Z.jsxs)(fe,{open:n,id:l,children:[(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:u.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":i===e.case,onClick:()=>a(e),className:M(`flex w-full min-w-0 cursor-pointer flex-col gap-0.5 border-0 px-3 py-1.5 pl-[38px] text-left`,i===e.case?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),e.ms>0&&(0,Z.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:ze(e.ms)})]}),e.note&&(0,Z.jsx)(`span`,{className:M(`truncate text-[12px]`,e.group===`failed`?`text-fail`:`text-muted`),children:e.note}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 gap-2 text-[11.5px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.file||`No file`}),e.fidelity&&(0,Z.jsxs)(`span`,{className:`flex-none tabular-nums`,children:[e.fidelity.matched,`/`,e.fidelity.required,` steps`]}),e.media>0&&(0,Z.jsx)(`span`,{className:`flex-none tabular-nums`,children:Y(e.media,`file`)})]})]})},e.case))}),t.length>Tt&&(0,Z.jsx)(U,{page:s,size:Tt,total:t.length,onPage:c,label:`${e.label} pages`})]})]})}function Ft({label:e,children:t,wide:n}){return(0,Z.jsxs)(`div`,{className:M(`flex min-w-0 flex-col gap-0.5`,n&&`@3xl:col-span-2`),children:[(0,Z.jsx)(`dt`,{className:`text-[11.5px] text-muted`,children:e}),(0,Z.jsx)(`dd`,{className:`m-0 text-[13px] text-ink [overflow-wrap:anywhere]`,children:t})]})}function It({id:e,caseId:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!0),[c,l]=(0,X.useState)(`all`),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)({}),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(``);(0,X.useEffect)(()=>{s(!0),P.report(e).then(e=>{if(r(e.report),a(e.report?``:`No report yet. Start the conversion first.`),s(!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`);p(n?n.case:``)}},e=>{a(e.message),s(!1)})},[e]),(0,X.useEffect)(()=>{f&&history.replaceState(null,``,z(`tosca`,e,`report`,encodeURIComponent(f)))},[e,f]);let b=u.trim().toLowerCase(),x=(0,X.useMemo)(()=>{let e={failed:[],attention:[],passed:[],notrun:[],leftout:[]};for(let t of n?.tests||[])c!==`all`&&t.group!==c||b&&!`${t.name} ${t.file} ${t.case} ${t.note||``} ${t.suites.join(` `)} ${t.folders.join(` `)}`.toLowerCase().includes(b)||e[t.group].push(t);return e},[n,c,b]),C=async t=>{_(t),y(``);try{let n=await(t===`zip`?P.reportZip(e):P.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){y(e.message)}finally{_(``)}};if(o)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading report…`});if(i||!n)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,e),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),`Conversion`]}),(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i||`No report.`})]});let w=Ge[n.status]||{label:n.status,tone:`neutral`},[T,...E]=n.target.id.split(`-`),D=Ot(n.stages),O=n.tests.length-n.counts.leftout,k=n.tests.find(e=>e.case===f)||null,te=Et.reduce((e,t)=>e+x[t.id].length,0),ne=Math.max(1,n.tests.length);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,e),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),`Conversion`]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-[12px] font-medium tracking-wide text-muted uppercase`,children:`Conversion report`}),(0,Z.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:wt(n.source.file)}),(0,Z.jsx)(ee,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(Le,{framework:T,language:E.join(`-`),size:20}),n.target.title]})]})]}),(0,Z.jsx)(L,{tone:w.tone,children:w.label}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(N,{size:`sm`,onClick:()=>void C(`html`),disabled:!!g,"data-tip":`ForgeQE's HTML report of this conversion: one file with the failure screenshots inside. The zip has the videos too.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),g===`html`?`Making the HTML report…`:`HTML report`]}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:()=>Nt(n),"data-tip":`Every Tosca test case by its unique id and path, with what became of it: its test file, outcome and steps.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`Traceability CSV`]}),(0,Z.jsxs)(N,{size:`sm`,onClick:()=>void C(`zip`),disabled:!!g||n.status===`running`,"data-tip":n.status===`running`?`The zip is made when the run ends.`:`The HTML report with every screenshot and video: unzip it and open report.html.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),g===`zip`?`Making the zip…`:`Zip with videos`]})]})]}),v&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:v}),(0,Z.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-[12px] card border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]`,children:[(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[n.counts.passed,` of `,O,` passed`]}),Et.filter(e=>n.counts[e.id]>0).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-ink-2`,children:[(0,Z.jsx)(`span`,{className:M(`size-2 rounded-full`,e.bar),"aria-hidden":`true`}),e.label,` `,(0,Z.jsx)(`span`,{className:M(`tabular-nums`,e.id===`failed`?`text-fail`:``),children:n.counts[e.id]})]},e.id))]}),(0,Z.jsx)(`div`,{className:`flex h-1.5 overflow-hidden rounded-full bg-surface-strong`,"aria-hidden":`true`,children:Et.map(e=>n.counts[e.id]?(0,Z.jsx)(`span`,{className:e.bar,style:{width:`${n.counts[e.id]/ne*100}%`}},e.id):null)}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-2 gap-x-6 gap-y-2 @3xl:grid-cols-4 @5xl:grid-cols-6`,children:[(0,Z.jsxs)(Ft,{label:`Time`,children:[ze(n.ms),` · started `,Ve(n.startedAt)]}),(0,Z.jsxs)(Ft,{label:`Tosca steps in the tests`,children:[n.steps.required?`${n.steps.matched} of ${n.steps.required}`:`–`,n.personSteps?(0,Z.jsxs)(`span`,{className:`text-warn`,children:[` · `,n.personSteps,` for a person`]}):null]}),(0,Z.jsx)(Ft,{label:`Media`,children:n.media?Y(n.media,`file`):n.target.video?`Videos and failure screenshots`:`Failure screenshots`}),(0,Z.jsxs)(Ft,{label:`LLM`,children:[n.model||`–`,n.usage.input||n.usage.output?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,Te(n.usage.input+n.usage.output),` tokens`,n.cost?` · ${n.cost.estimate?`≈`:``}${me(n.cost.amount,n.cost.currency)}`:``]}):null]}),(0,Z.jsxs)(Ft,{label:`From`,children:[`Tosca`,n.source.project?` · ${n.source.project}`:``,` · `,(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:n.source.file}),n.source.baseUrl&&(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:n.source.baseUrl})]}),(0,Z.jsxs)(Ft,{label:`To`,children:[n.target.title,` · `,(0,Z.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[n.target.dir,`/`]}),n.reverted.length>0&&(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[Y(n.reverted.length,`edit`),` outside it put back`]})]})]}),(n.previous||n.removed.length>0)&&(0,Z.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-surface-muted px-3 py-2 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[n.previous?(0,Z.jsxs)(Z.Fragment,{children:[`Re-imported from `,(0,Z.jsx)(`a`,{href:z(`tosca`,n.previous,`report`),children:n.previous}),`: `,n.tests.filter(e=>e.change===`same`).length,` unchanged (their tests kept), `,n.tests.filter(e=>e.change===`changed`).length,` changed, `,n.tests.filter(e=>e.change===`new`).length,` new.`,` `]}):null,n.removed.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[Y(n.removed.length,`test case`),` no longer in the exports; their tests are left as they are: `,n.removed.slice(0,5).map(e=>`${e.name}${e.file?` (${e.file})`:``}`).join(`; `),n.removed.length>5?`; …`:``,`.`]})]}),D&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[`Failed in `,Ke[D.id],D.note?`: ${D.note}`:``]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-4 @5xl:grid-cols-[minmax(320px,400px)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(V,{id:`tosca-report-search`,label:`Find a test case`,value:u,onChange:d,placeholder:`Find a test case, file or problem`,className:`max-w-none flex-none`}),(0,Z.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex flex-wrap gap-1`,children:(0,Z.jsx)(de,{items:[{id:`all`,label:`All`,n:n.tests.length},...Et.filter(e=>n.counts[e.id]>0).map(e=>({id:e.id,label:e.label,n:n.counts[e.id],alert:e.id===`failed`}))],value:c,onChange:l})}),(0,Z.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex flex-col overflow-hidden overscroll-contain rounded-[12px] card border @5xl:max-h-[min(70vh,760px)] @5xl:overflow-y-auto`,children:[Et.filter(e=>x[e.id].length).map(e=>(0,Z.jsx)(Pt,{g:e,rows:x[e.id],open:m[e.id]??(e.open||c===e.id||!!b||x[e.id].some(e=>e.case===f)),onToggle:()=>h(t=>({...t,[e.id]:!(t[e.id]??(e.open||c===e.id||!!b||x[e.id].some(e=>e.case===f)))})),pick:f,onPick:e=>p(e.case)},e.id)),!te&&(0,Z.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-sm text-muted`,children:`No test case matches.`})]})]}),(0,Z.jsx)(`div`,{className:`min-w-0 @5xl:sticky @5xl:top-4`,children:k?(0,Z.jsx)(`div`,{className:`pane-swap`,children:(0,Z.jsx)(At,{planId:n.id,pick:k,video:n.target.video})},k.case):(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] card border px-4 py-6 text-center text-sm text-muted`,children:`Pick a test case to see its steps, output and media.`})})]})]})}var Lt={converted:{icon:E,cls:`text-pass`,label:`Converted`},partly:{icon:n,cls:`text-warn`,label:`Converted, with steps for a person`},not:{icon:h,cls:`text-muted`,label:`Not converted`}},Rt=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function zt(e,t,n){let r=[[`Test case id`,`Test case`,`Kind`,`What happens`,`Modules behind it`].map(Rt).join(`,`)];for(let n of e.rows)for(let e of n.cases)r.push([e,t.get(e)||e,n.label,Lt[n.outcome].label,n.modules.map(e=>e.name).join(`; `)].map(Rt).join(`,`));let i=URL.createObjectURL(new Blob([`${r.join(`\r
3
3
  `)}\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 Bt({coverage:e,names:t,file:n,folded:r=!1}){let i=e.converted+e.partly,[a,o]=(0,X.useState)(!r),s=(0,X.useId)();return(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-coverage`,className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,Z.jsx)(`h3`,{id:`tsc-coverage`,className:`m-0 text-sm font-semibold`,children:`What can be migrated`}),(0,Z.jsxs)(`span`,{className:`flex-1 text-[13px] 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`]}),r&&(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,"aria-expanded":a,"aria-controls":s,onClick:()=>o(!a),children:[(0,Z.jsx)(y,{"aria-hidden":`true`,className:M(`transition-transform`,a&&`rotate-180`)}),a?`Hide the breakdown`:`Show the breakdown`]}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:()=>zt(e,t,n),"data-tip":`Every test case with its kind and what happens to it, for a spreadsheet.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`CSV`]})]}),(0,Z.jsx)(fe,{open:a,id:s,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.rows.map(e=>{let t=Lt[e.outcome];return(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft px-4 py-2.5 last:border-b-0`,children:[(0,Z.jsx)(t.icon,{size:16,role:`img`,"aria-label":t.label,className:M(`mt-0.5 flex-none`,t.cls)}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-ink`,children:e.label}),(0,Z.jsx)(`span`,{className:`tabular-nums text-ink-2`,children:e.cases.length===1?`1 test case`:`${e.cases.length} test cases`})]}),(0,Z.jsx)(`span`,{className:`text-ink-2`,children:e.becomes}),e.modules.length>0&&(0,Z.jsxs)(`span`,{className:`text-[12px] 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,Z.jsxs)(`span`,{className:`text-[12px] 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 Vt={ok:{icon:E,cls:`text-pass`,label:`Ready`},answer:{icon:n,cls:`text-warn`,label:`Needs an answer`},blocker:{icon:h,cls:`text-fail`,label:`Blocks the start`}};function Ht({planId:e,stamp:t,busy:n,open:r,onChanged:i,onAccept:a,acceptTip:o}){let[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``);(0,X.useEffect)(()=>{P.data(e).then(e=>{c(e),g(``)},e=>g(e.message))},[e,t]);let _=async t=>{m(!0),g(``);try{c(await P.setData(e,t)),u(``),f(``),i()}catch(e){g(e.message)}finally{m(!1)}},v=n||p,y=s?[...new Set(s.cases.flatMap(e=>e.missing))]:[];return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[s&&s.sources.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[12.5px] text-ink-2`,children:s.sources.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.file}),e.sheet?` (sheet ${e.sheet})`:``,`: `,Y(e.rows,`row`),e.transposed?`, attributes down the first column`:``]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.file}${e.sheet?`, sheet ${e.sheet}`:``}`,disabled:v,onClick:()=>void _({remove:t}),className:`cursor-pointer border-0 bg-transparent p-0 text-[12.5px] text-accent-fg hover:underline`,children:`Remove`})]},`${e.file}\u0000${e.sheet||``}`))}),s&&y.length>0&&(0,Z.jsxs)(`span`,{className:`text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[`Not found yet: `,(0,Z.jsx)(`span`,{className:`font-mono`,children:y.slice(0,12).join(`, `)}),y.length>12?` and ${y.length-12} more`:``]}),r&&(0,Z.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),l&&_({file:l,...d.trim()?{sheet:d.trim()}:{}})},children:[(0,Z.jsxs)(W,{size:`sm`,"aria-label":`A data file of the project`,value:l,disabled:v||!s,onChange:e=>u(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Z.jsx)(`option`,{value:``,children:s&&!s.files.length?`No CSV, TSV, Excel or JSON file in the project`:`A data file of the project…`}),(s?.files||[]).map(e=>(0,Z.jsx)(`option`,{value:e.path,children:e.path},e.path))]}),/\.xls[xm]$/i.test(l)&&(0,Z.jsx)(I,{size:`sm`,"aria-label":`Sheet, the first if empty`,placeholder:`Sheet, the first if empty`,value:d,onChange:e=>f(e.target.value),disabled:v,className:`min-w-0 flex-[1_1_160px]`}),(0,Z.jsx)(N,{size:`sm`,type:`submit`,disabled:v||!l,children:`Use it`}),a&&(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:v,onClick:a,"data-tip":o,children:`Leave them for a person`})]}),h&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 text-[12.5px] text-fail`,children:h})]})}function Ut({r:e,busy:t,onAnswer:n}){let[r,i]=(0,X.useState)(``),a=String(e.environments.findIndex(t=>t.environment===e.answers.environment&&t.app===e.answers.app));return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[e.environments.length>0&&(0,Z.jsxs)(W,{size:`sm`,"aria-label":`An app of env.yaml`,value:a,disabled:t,onChange:t=>{let r=e.environments[Number(t.target.value)];r&&n({environment:r.environment,app:r.app})},className:`w-auto max-w-[320px]`,children:[(0,Z.jsx)(`option`,{value:`-1`,children:`An app of env.yaml…`}),e.environments.map((e,t)=>(0,Z.jsxs)(`option`,{value:String(t),children:[e.environment,` · `,e.app,` · `,e.url]},`${e.environment}\u0000${e.app}`))]}),(0,Z.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,Z.jsx)(I,{size:`sm`,type:`url`,"aria-label":`Or the address the tests start at`,placeholder:`Or the address, https://…`,value:r,onChange:e=>i(e.target.value),disabled:t,className:`min-w-0 flex-1`}),(0,Z.jsx)(N,{size:`sm`,type:`submit`,disabled:t||!r.trim(),children:`Use it`})]})]})}function Wt({item:e,picked:t,busy:n,onPick:r}){let i=e.apps||[];return i.length?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:(0,Z.jsxs)(W,{size:`sm`,"aria-label":e.engine===`database`?`A database`:e.engine===`mobile`?`A mobile app`:`A desktop app`,value:t&&i.includes(t)?t:``,disabled:n,onChange:e=>e.target.value&&r(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Z.jsx)(`option`,{value:``,children:e.engine===`database`?`A database…`:e.engine===`mobile`?`A mobile app…`:`A desktop app…`}),i.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})}):(0,Z.jsxs)(`p`,{className:`m-0 pt-1 text-[13px] text-muted`,children:[e.engine===`database`?`No databases yet: add one in `:`No ${e.engine} apps yet: add one in `,(0,Z.jsx)(`a`,{href:z(`settings`,e.engine===`database`?`databases`:`environments`),children:e.engine===`database`?`Settings, Databases`:`Settings, Environments`}),`.`]})}function Gt({item:e,busy:t,secrets:n,onSaved:r,onAccept:i,onUse:a}){let[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``),m=async()=>{d(!0),p(``);try{await oe.saveSecrets({[e.name]:o}),s(``),r()}catch(e){p(e.message)}finally{d(!1)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[(0,Z.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o&&m()},children:[(0,Z.jsx)(I,{size:`sm`,type:e.secret?`password`:`text`,autoComplete:`off`,spellCheck:!1,"aria-label":`Value of ${e.name}`,placeholder:e.secret?`Its value, kept in the credential store`:`Its value`,value:o,onChange:e=>s(e.target.value),disabled:t||u,className:`min-w-0 flex-[1_1_220px]`}),(0,Z.jsx)(N,{size:`sm`,type:`submit`,disabled:t||u||!o,children:`Save`}),e.accept&&(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:t||u,onClick:i,"data-tip":e.accept,children:`Convert without it`})]}),n.length>0&&!e.uses&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`use-${e.name}`,className:`text-[12.5px] text-muted`,children:`Or use a saved secret`}),(0,Z.jsxs)(W,{id:`use-${e.name}`,size:`sm`,value:c,disabled:t||u,onChange:e=>l(e.target.value),className:`w-auto min-w-[200px] font-mono`,children:[(0,Z.jsx)(`option`,{value:``,children:`A saved secret…`}),n.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]}),(0,Z.jsx)(N,{size:`sm`,disabled:t||u||!c,onClick:()=>a(c),children:`Use it`})]}),f&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 text-[12.5px] text-fail`,children:f})]})}function Kt({planId:e,onReady:t,onCoverage:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),l=(0,X.useCallback)(e=>{i(e.readiness),t?.(e.readiness.ready),n?.(e.coverage)},[t,n]),u=(0,X.useCallback)(()=>{P.ready(e).then(l,e=>c(e.message))},[e,l]);(0,X.useEffect)(()=>{i(null),c(``),t?.(!1)},[e]),(0,X.useEffect)(u,[u]);let d=async t=>{o(!0),c(``);try{l(await P.answer(e,t))}catch(e){c(e.message)}finally{o(!1)}};return(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-ready`,className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,Z.jsx)(`h3`,{id:`tsc-ready`,className:`m-0 text-sm font-semibold`,children:`Before it runs`}),(0,Z.jsx)(`span`,{role:`status`,className:M(`flex-1 text-[13px]`,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…`}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:u,disabled:a,"data-tip":`Check again, after installing a program or setting a variable.`,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Check again`]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),r&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:r.items.map(t=>{let n=Vt[t.level];return(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft px-4 py-2.5 last:border-b-0`,children:[(0,Z.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:M(`mt-0.5 flex-none`,n.cls)}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:M(`font-medium text-ink`,t.kind===`env`||t.kind===`tool`?`font-mono text-[12.5px]`:``),children:t.title}),(0,Z.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:t.text}),t.accepted&&(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[12.5px] text-warn`,children:[`Accepted: `,t.accept,(0,Z.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({unaccept:[t.id]}),className:`cursor-pointer border-0 bg-transparent p-0 text-[12.5px] text-accent-fg hover:underline`,children:`Undo`})]}),t.kind===`url`&&(0,Z.jsx)(Ut,{r,busy:a,onAnswer:e=>void d(e)}),t.kind===`app`&&t.engine&&(0,Z.jsx)(Wt,{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,Z.jsx)(Gt,{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,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[12.5px] text-muted`,children:[(0,Z.jsxs)(`span`,{children:[`Uses the saved secret `,(0,Z.jsx)(`span`,{className:`font-mono`,children:t.uses}),`.`]}),(0,Z.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({use:{name:t.name,secret:``}}),className:`cursor-pointer border-0 bg-transparent p-0 text-[12.5px] text-accent-fg hover:underline`,children:`Stop using it`})]}),t.kind===`data`&&(0,Z.jsx)(Ht,{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 qt=/^[a-f0-9]{16}$/,Jt=`forgeqe.tosca.assistant`;function Yt(){try{let e=localStorage.getItem(Jt)||``;return qt.test(e)?e:``}catch{return``}}function Xt(e){try{e?localStorage.setItem(Jt,e):localStorage.removeItem(Jt)}catch{}}var Zt=[/\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],Qt=e=>e.replace(/^.*\//,``).replace(/\.tsu$/i,``);function $t(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:m,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:O,title:`${Qt(t)} to Selenium`,hint:`One export, in Java, with page objects`,text:`Migrate ${Qt(t)} to Selenium in Java, with page objects`}),t&&r.push({icon:ie,title:`${Qt(t)} to Cypress`,hint:`Into a folder of its own`,text:`Migrate ${Qt(t)} to Cypress in TypeScript, into e2e/tosca`}),r.push({icon:x,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 en({view:e,sid:t,onSid:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),f=(0,X.useRef)(null);(0,X.useEffect)(()=>{t&&r?.id!==t&&F.view(t).then(i,()=>{n(``),Xt(``)})},[t]),(0,X.useEffect)(()=>{if(!r?.thinking&&!r?.checking)return;let e=setTimeout(()=>F.view(r.id).then(i,e=>c(e.message)),1200);return()=>clearTimeout(e)},[r]);let p=r?.messages.length??0;(0,X.useEffect)(()=>{p&&f.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[p,r?.thinking]);let m=e=>{o(e),setTimeout(()=>document.getElementById(`tosca-agent-box`)?.focus(),0)},h=async e=>{u(!0),c(``);try{let r=await e();return i(r),r.id!==t&&(n(r.id),Xt(r.id)),!0}catch(e){return c(e.message),!1}finally{u(!1)}},g=async e=>{!e.trim()||l||r?.thinking||(Zt.some(t=>t.test(e))?(o(``),c(`That looks like a token or a password, so it was not sent and the box was cleared. Use the token field of the clone question: it keeps it in your credential store.`)):await h(()=>r?F.say(r.id,e):F.start(e))&&o(``))},_=()=>{r&&F.end(r.id).catch(()=>{}),i(null),o(``),c(``),n(``),Xt(``)},v=()=>r?.prefill&&(location.hash=z(`tosca`,`new`,r.id)),y=!r,b=l||!!r?.thinking;return(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-agent`,"aria-labelledby":`tab-agent`,className:`mx-auto flex w-full max-w-[1080px] flex-auto flex-col gap-6`,children:[y?(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[880px] flex-col items-center gap-4 pt-2 text-center short:gap-3 short:pt-0`,children:[(0,Z.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-full bg-accent-soft`,children:(0,Z.jsx)(se,{name:ye.tosca,px:24})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:`What do you want to migrate from Tosca?`}),(0,Z.jsx)(`p`,{className:`m-0 max-w-[62ch] text-[14.5px] 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,Z.jsx)(on,{view:e,onGit:()=>m(`Clone the Tosca exports from https://`)}),(0,Z.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:$t(e).map(e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>m(e.text),className:`flex cursor-pointer items-start gap-3 rounded-[12px] card border px-3 py-2.5 text-left hover:border-line-strong hover:bg-surface-muted`,children:[(0,Z.jsx)(B,{icon:e.icon,size:18,className:`mt-0.5 text-accent-fg`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-[14px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:e.hint})]})]},e.title))}),(0,Z.jsxs)(`a`,{href:z(`tosca`,`new`),className:`inline-flex items-center gap-1.5 text-[13px]`,children:[(0,Z.jsx)(d,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]}):(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Z.jsxs)(`section`,{"aria-label":`Conversation with the Tosca assistant`,className:`flex min-w-0 flex-col gap-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] text-muted`,children:r.model?`Worked out by ForgeQE's model from what you said and what your project has.`:`Worked out by ForgeQE's rules: no model is set up.`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:_,disabled:l,children:`New conversation`})]}),(0,Z.jsxs)(`ol`,{"aria-live":`polite`,className:`m-0 flex list-none flex-col gap-5 p-0`,children:[r.messages.map((e,t)=>(0,Z.jsx)(`li`,{className:`fade-quick`,children:e.role===`person`?(0,Z.jsx)(Ee,{text:e.text}):(0,Z.jsx)(tn,{text:e.text})},t)),r.thinking&&(0,Z.jsx)(`li`,{className:`fade-quick`,children:(0,Z.jsx)(tn,{text:r.working===`cloning`?`Cloning the repository and looking for Tosca exports…`:`Reading what you said…`,working:r.working===`cloning`?`cloning`:`reading`})})]}),!r.thinking&&r.question?.id===`clone`&&r.clone&&(0,Z.jsx)(rn,{c:r.clone,disabled:l,onToken:e=>h(()=>F.token(r.id,e)),onPick:e=>void h(()=>F.pick(r.id,`clone`,[e]))},`clone-${p}`),!r.thinking&&r.question&&r.question.id!==`clone`&&r.question.options.length>0&&(0,Z.jsx)(nn,{q:r.question,disabled:l,onPick:e=>void h(()=>F.pick(r.id,r.question.id,e)).then(()=>document.getElementById(`tosca-agent-box`)?.focus())},`${r.question.id}-${p}`),!r.thinking&&r.prefill&&(0,Z.jsxs)(`div`,{className:`fade-quick flex flex-wrap items-center gap-3 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[14px] text-ink`,children:r.question?`The wizard can open now; the rest is optional.`:`Everything is ready.`}),(0,Z.jsxs)(N,{variant:`primary`,onClick:v,children:[`Open the prefilled wizard`,(0,Z.jsx)(ee,{"aria-hidden":`true`})]})]}),(0,Z.jsx)(`div`,{ref:f})]}),(0,Z.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Z.jsx)(an,{v:r})})]}),(0,Z.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-auto flex flex-col bg-gradient-to-t from-bg from-85% to-transparent pt-5 pb-4`,children:[s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 bg-bg pb-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),(0,Z.jsx)(je,{id:`tosca-agent-box`,label:`Tell the Tosca assistant`,value:a,onChange:e=>{o(e),c(``)},onSend:()=>void g(a),busy:l,disabled:b,placeholder:y?`Migrate checkout.tsu to Playwright in TypeScript, on QA…`:`Answer, or change anything you said…`})]})]})}function tn({text:e,working:t}){return(0,Z.jsxs)(`div`,{className:`flex max-w-[72ch] items-start gap-3`,children:[(0,Z.jsx)(ce,{state:t?`working`:`idle`,px:28,label:t?`The Tosca assistant is ${t}`:`Tosca assistant`,className:`mt-0.5 flex-none`}),(0,Z.jsx)(`p`,{className:M(`m-0 text-[15px] leading-relaxed whitespace-pre-line [overflow-wrap:anywhere]`,t?`text-muted`:`text-ink-2`),children:e})]})}function nn({q:e,disabled:t,onPick:n}){let[r,i]=(0,X.useState)([]);return(0,Z.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.multi?(0,Z.jsx)(G,{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,Z.jsxs)(N,{size:`sm`,variant:e.id===`skip`?`ghost`:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.label,e.hint&&(0,Z.jsx)(`span`,{className:`text-[11.5px] font-normal text-muted`,children:e.hint})]},e.id))}),e.multi&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[e.options.some(e=>!e.action)&&(0,Z.jsxs)(N,{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,Z.jsxs)(N,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.id===`git`&&(0,Z.jsx)(l,{"aria-hidden":`true`}),e.label]},e.id)),e.typed&&e.options.some(e=>!e.action)&&(0,Z.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`Or type the names below.`})]})]})}function rn({c:e,disabled:t,onToken:n,onPick:r}){let[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(``),d=[...new Set([...e.credentials,...e.tokenVar?[e.tokenVar]:[]])].sort(),f=async()=>{if(i){s(!0),u(``);try{await oe.saveSecrets({[i.name]:i.value}),a(null),await n(i.name)}catch(e){u(e.message)}finally{s(!1)}}},p=t||o;return(0,Z.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Z.jsxs)(`legend`,{className:`sr-only`,children:[`Clone `,e.url]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Z.jsxs)(`label`,{htmlFor:`tsa-token`,className:`flex flex-col gap-1 text-[12px] font-medium text-muted`,children:[`Access token`,(0,Z.jsxs)(W,{id:`tsa-token`,size:`sm`,value:e.tokenVar??``,disabled:p,onChange:e=>void n(e.target.value),className:`min-w-[220px]`,children:[(0,Z.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),d.map(t=>(0,Z.jsxs)(`option`,{value:t,children:[t,t===e.tokenVar&&!e.tokenSaved?` (not saved yet)`:``]},t))]})]}),!i&&(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>a({name:e.tokenVar&&!e.tokenSaved?e.tokenVar:e.suggested,value:``}),children:`Add a token`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>void n(e.tokenVar??``),children:`Check again`})]}),!i&&(0,Z.jsxs)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:[`Or save it in`,` `,(0,Z.jsx)(`a`,{href:z(`settings`,`repo-tokens`),target:`_blank`,rel:`noopener`,children:`Settings › Secrets › Repository tokens`}),`, then press Check again.`]}),i&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-3`,children:[(0,Z.jsxs)(`label`,{htmlFor:`tsa-token-name`,className:`flex flex-col gap-1 text-[12px] font-medium text-muted`,children:[`Name`,(0,Z.jsx)(I,{id:`tsa-token-name`,size:`sm`,value:i.name,spellCheck:!1,maxLength:64,onChange:e=>a({...i,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})]}),(0,Z.jsxs)(`label`,{htmlFor:`tsa-token-value`,className:`flex flex-col gap-1 text-[12px] font-medium text-muted`,children:[`Token`,(0,Z.jsx)(I,{id:`tsa-token-value`,size:`sm`,type:`password`,autoComplete:`off`,value:i.value,onChange:e=>a({...i,value:e.target.value}),className:`w-[260px] max-w-full`})]}),(0,Z.jsx)(N,{size:`sm`,disabled:p||!i.name||!i.value,onClick:()=>void f(),children:o?`Saving…`:`Save`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>a(null),children:`Cancel`}),(0,Z.jsx)(`span`,{className:`w-full text-[12.5px] text-muted`,children:`Kept in ForgeQE's credential store, never in the chat, the address or this page. Give it read access to the repository only.`})]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(N,{size:`sm`,variant:`primary`,disabled:p||!(!e.tokenVar||e.tokenSaved),onClick:()=>r(`yes`),children:[(0,Z.jsx)(l,{"aria-hidden":`true`}),`Clone it`]}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>r(`no`),children:`No`}),(0,Z.jsx)(`span`,{className:`text-[12.5px] 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 an({v:e}){let t=(e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-line-soft py-3.5 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:e}),(0,Z.jsx)(`div`,{className:`text-sm [overflow-wrap:anywhere]`,children:t})]}),n=(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`}),r=e.have;return(0,Z.jsxs)(`aside`,{"aria-label":`What the assistant has so far`,className:`flex flex-col rounded-[14px] card border p-5`,children:[t(r.exports.length>1?`Exports (${r.exports.length})`:`Export`,r.exports.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:[r.exports.slice(0,6).map(e=>(0,Z.jsx)(`li`,{className:`font-mono text-[12.5px]`,children:e},e)),r.exports.length>6&&(0,Z.jsxs)(`li`,{className:`text-[12.5px] text-muted`,children:[`and `,r.exports.length-6,` more`]})]}):n),t(`Target`,r.targetId?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Le,{framework:r.targetId.split(`-`)[0],language:r.targetId.split(`-`).slice(1).join(`-`)}),r.target]}):n),t(`Tests start at`,r.start||(0,Z.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`})),r.needs.map(e=>(0,Z.jsx)(X.Fragment,{children:t(e.need===`database`?`Database`:e.need===`mobile`?`Mobile app`:`Desktop app`,e.picked?(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:e.picked}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`}))},e.need)),t(`Folder`,r.into?(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:r.into}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`tosca-<target>`})),t(`Saved secrets`,r.uses.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:r.uses.map(e=>(0,Z.jsxs)(`li`,{className:`font-mono text-[12.5px]`,children:[e.variable,` uses `,e.secret]},e.variable))}):(0,Z.jsx)(`span`,{className:`text-muted`,children:e.checking?`Reading which variables the tests need…`:`None`})),t(`Instructions`,r.instructions?(0,Z.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:r.instructions}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}function on({view:e,onGit:t}){let n=`inline-flex min-h-7 items-center gap-1 rounded-full border px-2.5 no-underline`,r=e.clones.reduce((e,t)=>e+t.exports.length,0);return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-1.5 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`mr-1 text-muted`,children:`Exports`}),e.exports.slice(0,5).map(e=>(0,Z.jsxs)(`span`,{className:M(n,`border-transparent bg-surface-strong text-ink-2`),children:[(0,Z.jsx)(ae,{size:12,"aria-hidden":`true`}),Qt(e.path)]},e.path)),e.clones.map(e=>(0,Z.jsxs)(`span`,{className:M(n,`border-transparent bg-surface-strong text-ink-2`),children:[(0,Z.jsx)(l,{size:12,"aria-hidden":`true`}),e.label.replace(/^.*\//,``).replace(/\.git$/,``)]},e.id)),(0,Z.jsxs)(`button`,{type:`button`,onClick:t,className:M(n,`cursor-pointer border-dashed border-line-strong bg-transparent text-muted hover:text-ink`),children:[(0,Z.jsx)(l,{size:12,"aria-hidden":`true`}),`Clone a git repository`]}),(0,Z.jsx)(`span`,{className:`ml-1 text-muted`,children:e.exports.length+r?`${e.exports.length+r} found`:`none in this project yet`})]})}var sn=[`Export`,`Target`,`Instructions`,`Review`],cn=[`The Tosca export and its test cases`,`Framework and language`,`Your rules, optional`,`Check and start`],ln=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],un={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function dn({at:e,reached:t,onGo:n}){return(0,Z.jsx)(`nav`,{"aria-label":`Steps`,children:(0,Z.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:sn.map((r,i)=>{let a=i<=t,o=i===e,c=i<t&&!o;return(0,Z.jsxs)(`li`,{className:M(`flex items-center gap-2`,i<sn.length-1&&`flex-1`),children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:!a,"aria-current":o?`step`:void 0,onClick:()=>n(i),"aria-label":r,"data-tip":cn[i],className:M(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,a&&!o?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:M(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums`,c?`bg-pass text-white`:o?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:c?(0,Z.jsx)(s,{size:13,strokeWidth:3}):i+1}),(0,Z.jsx)(`span`,{className:M(o?`font-medium text-ink`:a?`text-ink-2`:`text-muted`,!o&&`hidden @xl:inline`),children:r})]}),i<sn.length-1&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,Z.jsx)(`span`,{className:M(`block h-full rounded-full bg-pass transition-[width] duration-500`,i<t?`w-full`:`w-0`)})})]},r)})})})}function fn({id:e,label:t,help:n,children:r}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function pn({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,Z.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-3 border-t border-line-soft bg-bg py-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Z.jsxs)(N,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Z.jsx)(S,{"aria-hidden":`true`}),`Back`]}),(0,Z.jsx)(N,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function mn({on:e,onPick:t,logo:n,title:r,sub:i,label:a,multi:o}){return(0,Z.jsxs)(`button`,{type:`button`,role:o?`checkbox`:`radio`,"aria-checked":e,"aria-label":a,onClick:t,className:M(`flex min-h-[72px] min-w-0 cursor-pointer items-center gap-3 rounded-[12px] border px-3.5 py-3 text-left transition-colors`,e?`border-accent bg-accent-soft ring-1 ring-accent`:`border-line-soft bg-bg hover:border-line hover:bg-surface-muted`),children:[(0,Z.jsx)(`span`,{className:`inline-flex size-9 flex-none items-center justify-center rounded-[10px] bg-surface-muted`,children:n}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-ink`,children:r}),i&&(0,Z.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:i})]})]})}var hn=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function gn({s:e}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.project||e.file}),(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[Y(e.test_cases.length,`test case`),` · `,Y(e.pages.length,`module`),` · `,Y(e.totals.steps,`step`),` · `,Y(e.totals.asserts,`check`)]}),e.suites.length>0&&(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[`· `,Y(e.suites.length,`execution list`)]}),e.totals.unsupported>0&&(0,Z.jsxs)(`span`,{className:`text-warn`,children:[`· `,e.totals.unsupported===1?`1 step value cannot`:`${e.totals.unsupported} step values cannot`,` be converted`]}),e.duplicates?(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[`· `,Y(e.duplicates,`test case`),` in more than one export, converted once`]}):null]})}var $=e=>`${e.workspace||``}\u0000${e.file}`;function _n({busy:e,onClone:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``);return(0,Z.jsxs)(`form`,{className:`flex flex-col gap-3 rounded-[12px] card border px-4 py-3`,onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim(),i.trim(),o.trim())},children:[(0,Z.jsx)(fn,{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,Z.jsx)(I,{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,Z.jsxs)(`div`,{className:`grid gap-3 @xl:grid-cols-2`,children:[(0,Z.jsx)(fn,{id:`tsc-git-branch`,label:`Branch`,help:`The default branch when empty.`,children:(0,Z.jsx)(I,{id:`tsc-git-branch`,value:i,spellCheck:!1,maxLength:200,placeholder:`main`,onChange:e=>a(e.target.value)})}),(0,Z.jsx)(fn,{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,Z.jsx)(I,{id:`tsc-git-token`,value:o,spellCheck:!1,maxLength:80,placeholder:`GITHUB_TOKEN`,onChange:e=>s(e.target.value)})})]}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(N,{type:`submit`,disabled:e||!n.trim(),children:e?`Cloning…`:`Clone it`})})]})}function vn({view:e,onView:t,picked:n,setPicked:r,found:i,setFound:a,only:o,setOnly:s}){let[c,l]=(0,X.useState)(i?`tsc-cases`:`tsc-exports`),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(e.clones.length>0&&e.exports.length===0),[v,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(``),C=new Set(n.map($)),T=[...e.exports.map(e=>({p:{file:e.path},bytes:e.bytes,from:`This project`})),...e.clones.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})`:``}`})))],E=async(e,t)=>{if(r(e),a(null),S(``),e.length){p(!0);try{let t=await P.inspectSources(e);a(t),s(new Set(t.test_cases.filter(et).map(e=>e.id))),l(`tsc-cases`)}catch(e){t&&r(t),S(e.message)}finally{p(!1)}}},D=e=>{a(null),S(``),r(t=>t.some(t=>$(t)===$(e))?t.filter(t=>$(t)!==$(e)):[...t,e])},k=T.length>0&&T.every(e=>C.has($(e.p))),ee=async(e,n,r)=>{h(!0),S(``);try{t?.(await P.clone(e,n||void 0,r||void 0))}catch(e){S(e.message)}finally{h(!1)}},te=async e=>{S(``),b(``);try{t?.(await P.removeClone(e)),r(t=>t.filter(t=>t.workspace!==e)),a(null)}catch(e){S(e.message)}},ne=e=>{let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(t)},re=e=>et(e),A=i?i.test_cases.filter(re):[],j=x&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:x});return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(he,{label:`Export`,tabs:[{id:`tsc-exports`,label:n.length?`Exports · ${n.length} picked`:`Exports`},{id:`tsc-cases`,label:i?`Test cases · ${o.size} of ${i.test_cases.length}`:`Test cases`}],current:c,onPick:e=>{e===`tsc-cases`&&!i?n.length?E(n):S(`Pick at least one export first.`):l(e)}}),c===`tsc-exports`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-tsc-exports`,"aria-labelledby":`tab-tsc-exports`,className:`pane-swap flex flex-col gap-5`,children:[T.length>0?(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(ve,{label:`Tosca exports`,placeholder:`Find an export`,height:`min(44vh, 400px)`,tools:(0,Z.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(J,{checked:k,onCheckedChange:e=>{a(null),S(``),r(e?T.map(e=>e.p):[])}}),`Pick all `,T.length]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(K,`w-10`),children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Z.jsx)(`th`,{className:K,children:`Export`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @xl:table-cell`),children:`Folder`}),(0,Z.jsx)(`th`,{className:K,children:`From`}),(0,Z.jsx)(`th`,{className:be,children:`Size`})]}),children:T.map(e=>{let t=$(e.p),n=e.p.file.slice(e.p.file.lastIndexOf(`/`)+1);return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(J,{"aria-label":`Pick ${e.p.file}${e.p.workspace?` of ${e.from}`:``}`,checked:C.has(t),onCheckedChange:()=>D(e.p)})}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(O,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n})]})}),(0,Z.jsx)(`td`,{className:M(q,`hidden font-mono text-[12px] text-muted @xl:table-cell`),children:e.p.file.includes(`/`)?e.p.file.slice(0,e.p.file.lastIndexOf(`/`)):`.`}),(0,Z.jsx)(`td`,{className:M(q,`text-ink-2`),children:e.from}),(0,Z.jsx)(`td`,{className:xe,children:hn(e.bytes)})]},t)})})}):(0,Z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`No Tosca export (.tsu) in this project yet. Export the test cases from Tosca Commander and put the files inside the project, for example `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:`tosca/checkout.tsu`}),`, or clone the repository that holds them below.`]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsx)(N,{variant:`primary`,disabled:f||!n.length,onClick:()=>void E(n),children:f?`Reading…`:n.length>1?`Read ${n.length} exports`:`Read the export`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:n.length?n.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.`:`Tick one or more exports.`})]}),f&&!x&&(0,Z.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Z.jsxs)(`span`,{children:[`Reading `,n.length===1?`the export`:`${n.length} exports`,`…`]})}),j,(0,Z.jsx)(fn,{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,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(I,{id:`tsc-path`,value:u,spellCheck:!1,maxLength:300,placeholder:`tosca/checkout.tsu or tosca/`,onChange:e=>d(e.target.value),className:`min-w-0 flex-[1_1_300px]`}),(0,Z.jsxs)(N,{disabled:f||!u.trim(),onClick:()=>void E([...n.filter(e=>$(e)!==$({file:u.trim()})),{file:u.trim()}],n),"data-tip":`Add the export at this path and read it`,children:[(0,Z.jsx)(w,{"aria-hidden":`true`}),`Add`]})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":g,onClick:()=>_(!g),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:M(`transition-transform`,g&&`rotate-180`)}),`From a git repository`,e.clones.length?` (${e.clones.length} cloned)`:``]}),g&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.clones.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.clones.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.label,(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.branch?`${e.branch} · `:``,e.commit?`@${e.commit} · `:``,Y(e.exports.length,`export`),` · cloned `,new Date(e.createdAt).toLocaleDateString()]})]}),v===e.id?(0,Z.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,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>void te(e.id),children:`Remove it`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>b(``),children:`Keep it`})]}):(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,"aria-label":`Remove the copy of ${e.label}`,onClick:()=>b(e.id),children:`Remove`})]},e.id))}),(0,Z.jsx)(_n,{busy:m,onClone:(e,t,n)=>void ee(e,t,n)})]})]})]}):(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-tsc-cases`,"aria-labelledby":`tab-tsc-cases`,className:`pane-swap flex flex-col gap-5`,children:[j,!i&&!f&&(0,Z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Pick exports and read them first.`}),f&&(0,Z.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Z.jsx)(`span`,{children:`Reading…`})}),i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px] text-ink-2`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[`From `,n.length===1?(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:n[0].file}):Y(n.length,`export`)]}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>l(`tsc-exports`),children:`Change exports`})]}),(0,Z.jsx)(gn,{s:i}),i.coverage&&(0,Z.jsx)(Bt,{coverage:i.coverage,names:new Map(i.test_cases.map(e=>[e.id,e.name])),file:`${n.length===1?n[0].file.replace(/^.*\//,``).replace(/\.tsu$/i,``):`tosca-exports`}-coverage.csv`,folded:!0}),(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(ve,{label:`Test cases to convert`,placeholder:`Find a test case`,height:`min(52vh, 520px)`,tools:(0,Z.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(J,{checked:A.length>0&&A.every(e=>o.has(e.id)),onCheckedChange:e=>s(new Set(e?A.map(e=>e.id):[]))}),`Pick all `,A.length,` test cases ForgeQE can convert`]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,Z.jsx)(`th`,{className:M(`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Folder`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Steps · checks`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Kind`})]}),children:i.test_cases.map(e=>{let t=re(e);return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:`px-3 py-2`,children:(0,Z.jsx)(J,{"aria-label":`Pick ${e.name}`,disabled:!t,checked:t&&o.has(e.id),onCheckedChange:()=>ne(e.id)})}),(0,Z.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:M(`font-medium [overflow-wrap:anywhere]`,t?`text-ink`:`text-muted`),children:e.name}),(e.unsupported>0||e.suites.length>0)&&(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.unsupported?`${e.unsupported} not convertible`:``,e.unsupported&&e.suites.length?` · `:``,e.suites.length?`in ${e.suites.join(`, `)}`:``]})]}),(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`hidden text-muted @2xl:table-cell [overflow-wrap:anywhere]`),children:e.folders.join(` / `)||`–`}),(0,Z.jsxs)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:[e.steps,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.asserts]})]}),(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`whitespace-nowrap`),children:(0,Z.jsx)(L,{tone:t?`neutral`:`warn`,children:t?Je(e):`${$e[e.route]||e.route}: later`})})]},e.id)})})}),i.env.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Environment variables`}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[i.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`. Their values are never in the export; you set them before the tests run.`]})]})]})]})]})}function yn({view:e,to:t,setTo:n,fw:r,setFw:i,into:a,setInto:o,attr:s,setAttr:c}){let l=e=>e.split(`-`)[0],u=e=>e.split(`-`).slice(1).join(`-`),d=[...new Map(e.targets.map(e=>[l(e.id),e.framework])).entries()],f=r||(t?l(t):``),p=e.targets.filter(e=>l(e.id)===f);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Framework`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:d.map(([e,t])=>{let r=Re[e];return(0,Z.jsx)(mn,{on:f===e,onPick:()=>{e!==f&&(i(e),n(``))},logo:r?(0,Z.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:t,sub:un[e],label:t},e)})})]}),(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Language`}),!f&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick a framework first.`}),f&&!t&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick its language.`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`pane-swap grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:p.map(e=>{let r=Ie[u(e.id)];return(0,Z.jsx)(mn,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Z.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,label:e.language},e.id)})},f)]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Z.jsx)(fn,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,Z.jsx)(I,{id:`tsc-into`,value:a,spellCheck:!1,maxLength:300,placeholder:t?`tosca-${t}`:`Named after the target`,onChange:e=>o(e.target.value)})}),(0,Z.jsx)(fn,{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,Z.jsx)(I,{id:`tsc-attr`,value:s,spellCheck:!1,maxLength:40,placeholder:`data-automation-id`,onChange:e=>c(e.target.value.replace(/[^A-Za-z0-9_-]/g,``))})})]})]})}function bn({view:e,picked:t,found:n,only:r,to:i,instructions:a}){let o=e.targets.find(e=>e.id===i),s=(e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-line-soft py-3.5 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:e}),(0,Z.jsx)(`div`,{className:`text-sm`,children:t})]});return(0,Z.jsxs)(`aside`,{"aria-label":`Summary`,className:`flex flex-col rounded-[14px] card border p-5`,children:[s(t.length>1?`Exports (${t.length})`:`Export`,t.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:[t.slice(0,6).map(t=>(0,Z.jsxs)(`li`,{className:`font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:[t.workspace?`${e.clones.find(e=>e.id===t.workspace)?.label.replace(/^.*\//,``)||`git`}: `:``,t.file]},$(t))),t.length>6&&(0,Z.jsxs)(`li`,{className:`text-[12.5px] text-muted`,children:[`and `,t.length-6,` more`]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`})),s(`Test cases`,n?(0,Z.jsxs)(`span`,{children:[r.size,` of `,n.test_cases.length,` picked`]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`})),s(`Target`,o?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Le,{framework:o.id.split(`-`)[0],language:o.id.split(`-`).slice(1).join(`-`)}),o.title]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`})),s(`Instructions`,a.trim()?(0,Z.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:a.trim()}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}function xn({view:e,onView:n,review:i,onStart:a,from:o}){let[s,l]=(0,X.useState)(0),[u,d]=(0,X.useState)(0),[f,p]=(0,X.useState)([]),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(new Set),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(``),[w,T]=(0,X.useState)(``),[E,D]=(0,X.useState)(``),[O,k]=(0,X.useState)(null),[te,ne]=(0,X.useState)(!1),[re,A]=(0,X.useState)(!1),[j,ie]=(0,X.useState)(!1),[ae,N]=(0,X.useState)(``),oe=[...g].sort().join(`,`);(0,X.useEffect)(()=>{k(null),ne(!1),d(e=>Math.min(e,2))},[f.map($).join(`|`),oe,v,S,w,E]);let[se,I]=(0,X.useState)(`next`),L=(0,X.useRef)(null),R=e=>{I(e<s?`back`:`next`),l(e);let t=L.current;t&&t.getBoundingClientRect().top<0&&t.scrollIntoView({block:`start`,behavior:`smooth`})},B=e=>{R(e),d(t=>Math.max(t,e)),N(``)},[V,H]=(0,X.useState)(o?`filling`:``);(0,X.useEffect)(()=>{if(!o)return;let e=!0;return(async()=>{ie(!0);try{let t=(await F.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;p(t.sources),x(t.to.split(`-`)[0]),y(t.to),C(t.into??``),D(t.instructions??``);let n=await P.inspectSources(t.sources);if(!e)return;let r=n.test_cases.filter(et).map(e=>e.id);if(h(n),_(new Set(r)),!r.length)throw Error(`These exports hold no web or API test case to convert.`);let i=await P.plan({sources:t.sources,to:t.to,...t.into?{into:t.into}:{},...t.instructions?{instructions:t.instructions}:{}});(t.app||t.baseUrl)&&await P.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 P.answer(i.plan.id,{use:{name:e,secret:n}}).catch(()=>{});if((t.desktopApp||t.mobileApp||t.database)&&await P.answer(i.plan.id,{...t.desktopApp?{desktopApp:t.desktopApp}:{},...t.mobileApp?{mobileApp:t.mobileApp}:{},...t.database?{database:t.database}:{}}).catch(()=>{}),!e)return;k(i),d(3),R(3),H(`done`)}catch(t){if(!e)return;N(t.message),H(``)}finally{e&&ie(!1)}})(),()=>{e=!1}},[o]);let ce=async()=>{ie(!0),N(``);try{let e=!m||m.test_cases.filter(et).every(e=>g.has(e.id)),t=await P.plan({sources:f,to:v,...S.trim()?{into:S.trim()}:{},...e?{}:{only:[...g]},...E.trim()?{instructions:E.trim()}:{},...w?{testAttributes:[w]}:{}});k(t),B(3)}catch(e){let t=e.message;N(t);let n=S.trim().replace(/\\/g,`/`).replace(/\/+$/,``);n&&t.includes(n)&&R(1)}finally{ie(!1)}},U=O?.plan,W=U?.feasibility.findings.some(e=>e.level===`limit`),le=U?.feasibility.verdict===`blocked`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[o&&V&&(0,Z.jsxs)(`p`,{role:`status`,className:`fade-quick m-0 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-2.5 text-sm text-ink`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:V===`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,Z.jsx)(`a`,{href:z(`tosca`),className:`text-[13px]`,children:`Back to the assistant`})]}),(0,Z.jsx)(`div`,{ref:L,className:`scroll-mt-4`,children:(0,Z.jsx)(dn,{at:s,reached:u,onGo:e=>!j&&(e<3||O)&&R(e)})}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-step`,className:M(`flex min-w-0 flex-col gap-5`,se===`next`?`pane-next`:`pane-back`),children:[(0,Z.jsx)(`h2`,{id:`tsc-step`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:[`Which Tosca export?`,`What should the tests become?`,`Anything the agent should know?`,`Review and start`][s]}),ae&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:ae}),s===0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vn,{view:e,onView:n,picked:f,setPicked:p,found:m,setFound:h,only:g,setOnly:_}),(0,Z.jsx)(pn,{busy:j,next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>B(1),disabled:!m||!g.size,aside:m&&!g.size?(0,Z.jsx)(`span`,{className:`text-muted`,children:`Pick at least one web or API test case.`}):void 0})]}),s===1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(yn,{view:e,to:v,setTo:y,fw:b,setFw:x,into:S,setInto:C,attr:w,setAttr:T}),(0,Z.jsx)(pn,{busy:j,onBack:()=>R(0),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>B(2),disabled:!v})]}),s===2&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fn,{id:`tsc-instructions`,label:`Instructions (optional)`,help:`Style and structure for the new code. Every Tosca step and check is kept either way.`,children:(0,Z.jsx)(ue,{id:`tsc-instructions`,value:E,rows:6,maxLength:4e3,placeholder:`Page objects go in pages/, one class per Tosca module.`,onChange:e=>D(e.target.value)})}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:ln.map(e=>(0,Z.jsxs)(`button`,{type:`button`,disabled:E.includes(e),onClick:()=>D(E.trim()?`${E.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[8px] border-0 bg-surface-strong px-2.5 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Z.jsx)(r,{size:13,"aria-hidden":`true`}),e]},e))}),(0,Z.jsx)(pn,{busy:j,onBack:()=>R(1),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),j?`Checking…`:`Check`]}),onNext:()=>void ce(),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing is changed yet.`})})]}),s===3&&U&&(0,Z.jsxs)(Z.Fragment,{children:[i(U,te,ne,A),(0,Z.jsx)(pn,{busy:j,onBack:()=>R(2),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Start`]}),disabled:le||!re||W&&!te,onNext:()=>a(O,!!W&&te),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:le?`Change what is not possible first.`:re?W&&!te?`Accept the limits to start.`:`Runs in the background.`:`Answer what the tests need first.`})})]})]},s),(0,Z.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Z.jsx)(bn,{view:e,picked:f,found:m,only:g,to:v,instructions:E})})]})]})}function Sn({children:e,wide:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(Ce,{}),(0,Z.jsx)(`main`,{className:M(we,`@container flex-auto gap-5`,t?`max-w-[1480px]`:`max-w-[1180px]`),children:e})]})}function Cn({action:e}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(pe,{pixel:ye.tosca,size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Tosca`})]}),(0,Z.jsx)(Ne,{label:`Migration`,links:Pe,current:`tosca`}),(0,Z.jsx)(`span`,{className:`flex-1`}),e]})}function wn({planId:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{let t=!0;return n(null),i(!1),P.estimate(e).then(e=>t&&n(e),()=>t&&i(!0)),()=>{t=!1}},[e]),r?(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not known`}):t?t.files.setup+t.files.pages+t.files.tests?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{children:[`About `,Te(t.tokens.mid),` tokens`,t.cost?`, about ${me(t.cost.mid,t.cost.currency)}`:``,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`(`,Te(t.tokens.low),` to `,Te(t.tokens.high),t.cost?`, ${me(t.cost.low,t.cost.currency)} to ${me(t.cost.high,t.cost.currency)}`:``,`)`]})]}),(0,Z.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[t.model&&t.model!==`none`?`With ${t.model}. `:`No model is set up for the Tosca agent 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,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing left to write`}):(0,Z.jsx)(`span`,{role:`status`,className:`text-muted`,children:`Working it out…`})}function Tn({plan:e,accepted:t,onAccept:n,onReady:r}){let[i,a]=(0,X.useState)(null),o=(0,X.useMemo)(()=>new Map(e.cases.map(e=>[e.id,e.name])),[e]),s=e.feasibility.findings.filter(e=>e.level===`blocker`),c=e.feasibility.findings.filter(e=>e.level===`limit`),l=e.cases.filter(e=>e.included),u=e.units.filter(e=>e.kind===`page`).length,d=l.filter(e=>e.workflow).length;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid gap-x-6 gap-y-2.5 rounded-[14px] card border px-5 py-4 text-sm @xl:grid-cols-[auto_1fr]`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[`Tricentis Tosca`,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[e.sources&&e.sources.length>1?` · ${e.sources.length} exports`:(0,Z.jsxs)(Z.Fragment,{children:[` `,`· `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:e.source.file})]}),e.source.project?` · ${e.source.project}`:``]}),e.sources&&e.sources.length>1&&(0,Z.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-0.5 p-0`,children:e.sources.map((t,n)=>(0,Z.jsxs)(`li`,{className:`font-mono text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.label,(0,Z.jsxs)(`span`,{className:`font-sans text-muted`,children:[` · `,(e=>e?Y(e,`test case`):`its test cases are all in another export`)(e.cases.filter(e=>e.source===n).length)]})]},n))})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.target.dir]})]}),e.previous&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Since`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[(0,Z.jsx)(`a`,{href:z(`tosca`,e.previous.id),children:e.previous.id}),(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,Y(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,Z.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[l.length-d,` test`,l.length-d===1?``:`s`,d?`, ${d} desktop or mobile workflow${d===1?``:`s`}`:``,` of `,e.cases.length,` test case`,e.cases.length===1?``:`s`,`, `,u,` page object`,u===1?``:`s`]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Estimate`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:(0,Z.jsx)(wn,{planId:e.id})}),(e.suites||[]).length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Suites`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.suites.map(e=>`${e.name} (${Y(e.cases.length,`test`)})`).join(`, `),(0,Z.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[`Tosca's execution lists, as tags on the tests: `,e.suites.map(e=>`@${e.tag}`).join(`, `),`.`]})]})]}),e.env.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Environment variables`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Never in the export: you set them before the tests run.`})]})]}),e.instructions&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,Z.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]}),i&&(0,Z.jsx)(Bt,{coverage:i,names:o,file:`tosca-${e.id}-coverage.csv`}),s.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-blockers`,className:`flex flex-col gap-2 rounded-[14px] bg-fail-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`tsc-blockers`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-fail`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-5 text-sm text-ink`,children:s.map(e=>(0,Z.jsx)(`li`,{children:e.text},e.code))})]}),c.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-limits`,className:`flex flex-col gap-3 rounded-[14px] bg-warn-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`tsc-limits`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-warn`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1.5 pl-5 text-sm text-ink`,children:c.map(e=>(0,Z.jsx)(`li`,{children:e.text},e.code))}),n&&!s.length&&(0,Z.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm font-medium`,children:[(0,Z.jsx)(J,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,Z.jsx)(Kt,{planId:e.id,onReady:r,onCoverage:a}),(0,Z.jsx)(Fe,{title:`Test cases (${e.cases.length})`,children:(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(ve,{label:`Test cases of the plan`,placeholder:`Find a test case`,height:`min(48vh, 440px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:K,children:`Test case`}),(0,Z.jsx)(`th`,{className:K,children:`In the plan`}),(0,Z.jsx)(`th`,{className:M(be,`hidden @xl:table-cell`),children:`Steps · checks`}),(0,Z.jsx)(`th`,{className:K,children:`Kind`})]}),children:e.cases.map(e=>{let t=e.change;return(0,Z.jsxs)(`tr`,{className:_e,children:[(0,Z.jsx)(`td`,{className:M(q,`[overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,Z.jsxs)(`td`,{className:M(q,`text-ink-2`),children:[e.included?`Converted`:e.why?e.why[0].toUpperCase()+e.why.slice(1):`Left out`,t?(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:{same:`Unchanged: its test kept`,changed:`Changed in Tosca`,new:`New in Tosca`}[t]}):null]}),(0,Z.jsxs)(`td`,{className:M(xe,`hidden @xl:table-cell`),children:[e.steps,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.asserts]})]}),(0,Z.jsx)(`td`,{className:M(q,`whitespace-nowrap text-muted`),children:$e[e.route]||e.route})]},e.id)})})})}),(0,Z.jsx)(Fe,{title:`Files, in order (${e.units.length})`,children:(0,Z.jsx)(ve,{label:`Files, in order`,placeholder:`Find a file`,height:`min(40vh, 360px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(K,`w-24`),children:`Kind`}),(0,Z.jsx)(`th`,{className:K,children:`File`})]}),children:e.units.map(e=>(0,Z.jsxs)(`tr`,{className:_e,children:[(0,Z.jsx)(`td`,{className:M(q,`text-muted`),children:Xe(e)}),(0,Z.jsx)(`td`,{className:M(q,`font-mono text-[12px] [overflow-wrap:anywhere]`),children:e.target})]},e.id))})})]})}function En({d:e,onStarted:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(!1),l=e.plan.feasibility.findings.some(e=>e.level===`limit`),u=e.plan.feasibility.verdict===`blocked`,d=!!e.job?.running;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.job?.last&&!d&&(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Z.jsx)(Tn,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r,onReady:a}),!u&&!d&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(N,{variant:`primary`,disabled:!i||!e.confirmed&&l&&!n,onClick:()=>s(!0),"data-tip":`Start the conversion`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Start`]}),!i&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Answer what the tests need first.`})]}),o&&(0,Z.jsx)(st,{plan:e.plan,acceptLimits:l&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}function Dn(e){return e.result?.status===`running`?`running`:e.result?.status===`converted`?`done`:e.result?`review`:`planned`}function On(e){return e.result?Ge[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:qe[e.verdict]}var kn=e=>e.slice(e.lastIndexOf(`/`)+1);function An({view:e}){let[t,n]=(0,X.useState)(`all`),r=t=>t===`all`?e.plans.length:e.plans.filter(e=>Dn(e)===t).length,i=e.plans.filter(e=>t===`all`||Dn(e)===t),a=e=>location.hash=z(`tosca`,e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(He,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,Z.jsx)(He,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,Z.jsx)(He,{label:`Converted`,value:r(`done`),tone:r(`done`)?`text-pass`:void 0,onClick:()=>n(`done`),on:t===`done`}),(0,Z.jsx)(He,{label:`Needs review`,value:r(`review`),tone:r(`review`)?`text-warn`:void 0,onClick:()=>n(`review`),on:t===`review`})]}),(0,Z.jsx)(ve,{label:`Conversions`,placeholder:`Find a conversion`,empty:t===`all`?`No conversions.`:`None here.`,resetKey:t,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Conversion`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Tests`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Updated`})]}),children:i.map(e=>{let t=On(e),n=e.result?e.result.status===`converted`||e.result.endedAt?100:Math.min(99,Math.round(e.result.done/Math.max(1,e.units||e.tests+1)*95)):0;return(0,Z.jsxs)(`tr`,{onClick:()=>a(e.id),className:Se,children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`hidden flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:(0,Z.jsx)(Le,{framework:e.targetId.split(`-`)[0],language:e.targetId.split(`-`).slice(1).join(`-`),size:18})}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:[kn(e.file),` to `,e.target]}),(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.project?`${e.project} · `:``,e.into]})]})]})}),(0,Z.jsx)(`td`,{className:M(q,`w-[180px] text-[13px]`),children:e.result?.status===`running`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(We,{value:n,label:`${kn(e.file)} to ${e.target}: progress`}),(0,Z.jsxs)(`span`,{className:`w-9 flex-none text-right text-[12px] text-muted tabular-nums`,children:[n,`%`]})]}):e.result?(0,Z.jsxs)(`span`,{className:e.result.converted===e.tests?`text-pass`:`text-ink-2`,children:[e.result.converted,` of `,e.tests,` pass`]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,Z.jsx)(`td`,{className:M(q,`whitespace-nowrap`),children:(0,Z.jsx)(L,{tone:t.tone,children:t.label})}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`),children:Ae(e.result?.endedAt||e.result?.at||e.createdAt)})]},e.id)})})]})}function jn({sub:e}){let[t,n]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(Yt),u=(0,X.useCallback)(()=>{P.list().then(e=>{n(e),a(``)},e=>a(e.message))},[]);(0,X.useEffect)(u,[u,e]);let d=t?.plans.some(e=>e.result?.status===`running`);(0,X.useEffect)(()=>{if(!d||e&&e!==`conversions`)return;let t=setInterval(u,3e3);return()=>clearInterval(t)},[d,e,u]);let f=e?.match(/^(tsc-\d{8}-\d{6}-[0-9a-f]{4})\/report(?:\/([^/]+))?$/),p=e&&/^tsc-\d{8}-\d{6}-[0-9a-f]{4}$/.test(e)?e:f?.[1]||``,h=!!f,g;try{g=f?.[2]?R(f[2]):void 0}catch{}let _=()=>location.hash=z(`tosca`,`new`),v=!t&&!i&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),y=e?.match(/^new\/([a-f0-9]{16})$/)?.[1];if(e===`new`||y)return(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(Cn,{}),(0,Z.jsx)(Ze,{error:i}),v,t&&(0,Z.jsx)(xn,{view:t,onView:n,from:y,review:(e,t,n,r)=>(0,Z.jsx)(Tn,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>s({d:e,accept:t})},y||`new`),o&&(0,Z.jsx)(st,{plan:o.d.plan,acceptLimits:o.accept,onClose:()=>s(null),onStarted:e=>{s(null),location.hash=z(`tosca`,e.plan.id)}})]});if(p&&h)return(0,Z.jsxs)(Sn,{wide:!0,children:[(0,Z.jsx)(Cn,{}),(0,Z.jsx)(It,{id:p,caseId:g},p)]});if(p)return(0,Z.jsxs)(Sn,{wide:!0,children:[(0,Z.jsx)(Cn,{}),(0,Z.jsx)(Ze,{error:i}),v,t&&(0,Z.jsx)(Ct,{id:p,plan:(e,t)=>(0,Z.jsx)(En,{d:e,onStarted:t})},p)]});let b=e===`conversions`?`conversions`:`agent`;return(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(Cn,{action:b===`agent`?void 0:(0,Z.jsxs)(N,{variant:`primary`,disabled:!t,onClick:_,"data-tip":`New conversion`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`New`]})}),(0,Z.jsx)(Ze,{error:i}),(0,Z.jsx)(Me,{label:`Tosca`,className:`mb-0`,current:b,onPick:e=>location.hash=e===`agent`?z(`tosca`):z(`tosca`,`conversions`),tabs:[{id:`agent`,label:`Agent`},{id:`conversions`,label:`Conversions`,...t?{n:t.plans.length}:{}}]}),v,t&&b===`agent`&&(0,Z.jsx)(en,{view:t,sid:c,onSid:l}),t&&b===`conversions`&&(0,Z.jsx)(`div`,{role:`tabpanel`,id:`panel-conversions`,"aria-labelledby":`tab-conversions`,className:`flex flex-col gap-5`,children:t.plans.length?(0,Z.jsx)(An,{view:t}):(0,Z.jsx)(H,{icon:m,title:`No Tosca conversions yet`,action:(0,Z.jsxs)(N,{size:`sm`,onClick:()=>location.hash=z(`tosca`),"data-tip":`Start with the assistant`,children:[(0,Z.jsx)(k,{"aria-hidden":`true`}),`Assistant`]}),children:`Tell the assistant what to migrate, or pick a Tosca export (.tsu) and its framework yourself with New. Every Tosca step and check is kept, and nothing starts until you confirm.`})})]})}export{jn as Tosca};
@@ -1 +1 @@
1
- import{D as e,Ir as t,Nr as n,o as r}from"./line-icons-CQ-3V8ax.js";import{B as i,V as a,c as o,qt as s}from"./filters-mFECJpMB.js";import{Dt as c,Et as l,gt as u,r as d,t as f}from"./frame-CInX-4Bh.js";import{_ as p,g as m,h,v as g,y as _}from"./index-BCb4cUBF.js";var v=t(n(),1),y=s(),b={new:{label:`New`,tone:`running`},improved:{label:`Improved`,tone:`neutral`},fixed:{label:`Fixed`,tone:`pass`}};function x({change:t,id:n,first:a}){let[s,l]=(0,v.useState)(!1),u=p(t);return(0,y.jsxs)(`li`,{className:i(!a&&`border-t border-line-soft`),children:[(0,y.jsxs)(`button`,{type:`button`,"aria-expanded":s,"aria-controls":n,onClick:()=>l(!s),className:`flex min-h-11 w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-3 py-2.5 text-left text-sm text-ink hover:bg-surface-muted`,children:[(0,y.jsx)(o,{tone:b[t.kind].tone,icon:!1,className:`w-[76px] justify-center`,children:b[t.kind].label}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:t.title}),(0,y.jsx)(e,{size:16,"aria-hidden":`true`,className:i(`flex-none text-muted transition-transform duration-200`,s&&`rotate-90`)})]}),(0,y.jsx)(c,{open:s,id:n,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 pt-1 pb-3 sm:pl-[100px]`,children:[(0,y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:t.detail}),u&&(0,y.jsxs)(`a`,{href:u,className:`inline-flex items-center gap-1 self-start text-[13px] font-medium`,children:[`Open`,(0,y.jsx)(r,{size:13,"aria-hidden":`true`})]})]})})]})}function S({release:e}){let t=e===h;return(0,y.jsxs)(`li`,{className:`relative flex gap-4 pb-8`,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:i(`relative mt-1.5 size-[15px] flex-none rounded-full border-[3px] border-bg`,t?`bg-accent`:`bg-line`)}),(0,y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,y.jsxs)(`h3`,{className:`m-0 text-[15px] font-semibold`,children:[`ForgeQE `,e.version]}),t&&(0,y.jsx)(o,{tone:`running`,icon:!1,children:`Latest`}),(0,y.jsxs)(`span`,{className:`text-sm text-muted`,children:[(0,y.jsx)(`time`,{dateTime:e.date,children:_(e.date)}),` · `,a(e.changes.length,`change`)]})]}),(0,y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:e.summary}),(0,y.jsx)(`ul`,{className:`m-0 flex list-none flex-col overflow-hidden rounded-[12px] card border p-0`,children:e.changes.map((t,n)=>(0,y.jsx)(x,{change:t,first:n===0,id:`change-${e.version}-${n}`},n))})]})]})}function C({embedded:e=!1}={}){(0,v.useEffect)(g,[]);let t=m(),n=(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)(`div`,{className:`relative flex flex-col gap-2`,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-[60px] bottom-10 left-[7px] w-px bg-line`}),t.map(e=>(0,y.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,y.jsx)(`h2`,{className:`m-0 pl-[31px] text-[22px] font-semibold`,children:e.month}),(0,y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.releases.map(e=>(0,y.jsx)(S,{release:e},e.version))})]},e.month))]})});return e?(0,y.jsx)(`div`,{className:`flex flex-col gap-5`,children:n}):(0,y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,y.jsx)(d,{}),(0,y.jsxs)(`main`,{className:i(f,`flex-auto gap-5`),children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,y.jsx)(l,{pixel:u[`whats-new`],size:`lg`}),(0,y.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`What's new`})]}),(0,y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`What each release of ForgeQE added, improved and fixed. Pick a change to read more.`}),n]})]})}export{b as KIND,C as WhatsNew};
1
+ import{D as e,Ir as t,Nr as n,o as r}from"./line-icons-CQ-3V8ax.js";import{B as i,V as a,c as o,qt as s}from"./filters-mFECJpMB.js";import{Dt as c,Et as l,gt as u,r as d,t as f}from"./frame-DiKY0GWx.js";import{_ as p,g as m,h,v as g,y as _}from"./index-HjX2EOmp.js";var v=t(n(),1),y=s(),b={new:{label:`New`,tone:`running`},improved:{label:`Improved`,tone:`neutral`},fixed:{label:`Fixed`,tone:`pass`}};function x({change:t,id:n,first:a}){let[s,l]=(0,v.useState)(!1),u=p(t);return(0,y.jsxs)(`li`,{className:i(!a&&`border-t border-line-soft`),children:[(0,y.jsxs)(`button`,{type:`button`,"aria-expanded":s,"aria-controls":n,onClick:()=>l(!s),className:`flex min-h-11 w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-3 py-2.5 text-left text-sm text-ink hover:bg-surface-muted`,children:[(0,y.jsx)(o,{tone:b[t.kind].tone,icon:!1,className:`w-[76px] justify-center`,children:b[t.kind].label}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:t.title}),(0,y.jsx)(e,{size:16,"aria-hidden":`true`,className:i(`flex-none text-muted transition-transform duration-200`,s&&`rotate-90`)})]}),(0,y.jsx)(c,{open:s,id:n,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 pt-1 pb-3 sm:pl-[100px]`,children:[(0,y.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:t.detail}),u&&(0,y.jsxs)(`a`,{href:u,className:`inline-flex items-center gap-1 self-start text-[13px] font-medium`,children:[`Open`,(0,y.jsx)(r,{size:13,"aria-hidden":`true`})]})]})})]})}function S({release:e}){let t=e===h;return(0,y.jsxs)(`li`,{className:`relative flex gap-4 pb-8`,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:i(`relative mt-1.5 size-[15px] flex-none rounded-full border-[3px] border-bg`,t?`bg-accent`:`bg-line`)}),(0,y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,y.jsxs)(`h3`,{className:`m-0 text-[15px] font-semibold`,children:[`ForgeQE `,e.version]}),t&&(0,y.jsx)(o,{tone:`running`,icon:!1,children:`Latest`}),(0,y.jsxs)(`span`,{className:`text-sm text-muted`,children:[(0,y.jsx)(`time`,{dateTime:e.date,children:_(e.date)}),` · `,a(e.changes.length,`change`)]})]}),(0,y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:e.summary}),(0,y.jsx)(`ul`,{className:`m-0 flex list-none flex-col overflow-hidden rounded-[12px] card border p-0`,children:e.changes.map((t,n)=>(0,y.jsx)(x,{change:t,first:n===0,id:`change-${e.version}-${n}`},n))})]})]})}function C({embedded:e=!1}={}){(0,v.useEffect)(g,[]);let t=m(),n=(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)(`div`,{className:`relative flex flex-col gap-2`,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-[60px] bottom-10 left-[7px] w-px bg-line`}),t.map(e=>(0,y.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,y.jsx)(`h2`,{className:`m-0 pl-[31px] text-[22px] font-semibold`,children:e.month}),(0,y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.releases.map(e=>(0,y.jsx)(S,{release:e},e.version))})]},e.month))]})});return e?(0,y.jsx)(`div`,{className:`flex flex-col gap-5`,children:n}):(0,y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,y.jsx)(d,{}),(0,y.jsxs)(`main`,{className:i(f,`flex-auto gap-5`),children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,y.jsx)(l,{pixel:u[`whats-new`],size:`lg`}),(0,y.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`What's new`})]}),(0,y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`What each release of ForgeQE added, improved and fixed. Pick a change to read more.`}),n]})]})}export{b as KIND,C as WhatsNew};
@@ -1,3 +1,3 @@
1
- import{$n as e,Ir as t,Nr as n}from"./line-icons-CQ-3V8ax.js";import{B as r,R as i,V as a,c as o,i as s,n as c,qt as l,st as u,u as d,z as f}from"./filters-mFECJpMB.js";import{at as p,et as m,it as h,rt as g}from"./frame-CInX-4Bh.js";import"./index-BCb4cUBF.js";var _=t(n(),1),v=l(),y={test:[`Testing the connection`,`Tested the connection`,`waiting`],tables:[`Reading the tables`,`Read the tables`,`searching`],query:[`Running the query`,`Ran the query`,`working`],gen:[`Making a preview`,`Made a preview`,`writing`],files:[`Writing the files`,`Wrote the files`,`writing`],insert:[`Inserting test data`,`Inserted test data`,`working`],batches:[`Listing the batches`,`Listed the batches`,`searching`],clean:[`Removing a batch`,`Removed a batch`,`working`],request:[`Asking the DB agent for test data`,`Asked the DB agent for test data`,`thinking`],fetch:[`Fetching the request again`,`Fetched the request again`,`searching`],ask:[`Asking the DB agent`,`Asked the DB agent`,`thinking`],checks:[`Running the checks`,`Ran the checks`,`working`],map:[`Reading the schema`,`Read the schema`,`searching`],check:[`Checking the flows`,`Checked the flows`,`working`],trace:[`Following the record`,`Followed the record`,`searching`]};function b(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(!1),o=(0,_.useCallback)(()=>{u.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,_.useEffect)(o,[o]);let s=!!e?.job?.running;return(0,_.useEffect)(()=>{if(!s)return;let e=setInterval(o,1e3);return()=>clearInterval(e)},[s,o]),{view:e,error:n,busy:i||s,running:s,act:async(e,t)=>{a(!0),r(``);try{await u.run(e,t),o()}catch(e){r(e.message)}finally{a(!1)}},stop:()=>void u.stop().then(o),load:o,job:e?.job??null}}var x=e=>e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e);function S({file:e,onNote:t}){return(0,v.jsx)(`button`,{type:`button`,"data-tip":e,onClick:async()=>t(await d(e)),className:r(f({size:`sm`}),`font-mono text-[12px]`),children:e.split(/[\\/]/).pop()})}function C({children:e,label:t}){return(0,v.jsx)(`pre`,{"aria-label":t,className:`m-0 max-h-[320px] overflow-auto rounded-[12px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre text-ink-2`,children:e})}function w({job:t,onStop:n,words:r}){let[s,c,l]=(r??y)[t.kind]??[`Working`,`Done`,`working`],u=(0,_.useRef)(null);(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[t.lines.length]);let d=t.exitCode===0,f=!d&&(t.kind===`check`||t.kind===`trace`)&&t.result!==void 0&&!t.result.error;return(0,v.jsxs)(`section`,{"aria-label":t.running?s:c,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,v.jsxs)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:[t.running?s:c,t.target?(0,v.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,t.target]}):null]}),(0,v.jsx)(o,{tone:t.running?`running`:d?`pass`:t.exitCode===2||f?`warn`:`fail`,orb:l,children:t.running?`Working`:d?`Done`:f?`Some broken`:t.exitCode===2?`Not done`:`Failed`}),t.running&&(0,v.jsxs)(i,{variant:`danger`,onClick:n,children:[(0,v.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,v.jsxs)(`details`,{open:t.running||!d&&!t.result,children:[(0,v.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,a(t.lines.length,`line`),`)`]}),(0,v.jsx)(`code`,{className:`mt-2 block font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:t.command}),(0,v.jsx)(`pre`,{ref:u,className:`mt-2 max-h-[240px] overflow-auto rounded-[10px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:t.lines.join(`
1
+ import{$n as e,Ir as t,Nr as n}from"./line-icons-CQ-3V8ax.js";import{B as r,R as i,V as a,c as o,i as s,n as c,qt as l,st as u,u as d,z as f}from"./filters-mFECJpMB.js";import{at as p,et as m,it as h,rt as g}from"./frame-DiKY0GWx.js";import"./index-HjX2EOmp.js";var _=t(n(),1),v=l(),y={test:[`Testing the connection`,`Tested the connection`,`waiting`],tables:[`Reading the tables`,`Read the tables`,`searching`],query:[`Running the query`,`Ran the query`,`working`],gen:[`Making a preview`,`Made a preview`,`writing`],files:[`Writing the files`,`Wrote the files`,`writing`],insert:[`Inserting test data`,`Inserted test data`,`working`],batches:[`Listing the batches`,`Listed the batches`,`searching`],clean:[`Removing a batch`,`Removed a batch`,`working`],request:[`Asking the DB agent for test data`,`Asked the DB agent for test data`,`thinking`],fetch:[`Fetching the request again`,`Fetched the request again`,`searching`],ask:[`Asking the DB agent`,`Asked the DB agent`,`thinking`],checks:[`Running the checks`,`Ran the checks`,`working`],map:[`Reading the schema`,`Read the schema`,`searching`],check:[`Checking the flows`,`Checked the flows`,`working`],trace:[`Following the record`,`Followed the record`,`searching`]};function b(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(!1),o=(0,_.useCallback)(()=>{u.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,_.useEffect)(o,[o]);let s=!!e?.job?.running;return(0,_.useEffect)(()=>{if(!s)return;let e=setInterval(o,1e3);return()=>clearInterval(e)},[s,o]),{view:e,error:n,busy:i||s,running:s,act:async(e,t)=>{a(!0),r(``);try{await u.run(e,t),o()}catch(e){r(e.message)}finally{a(!1)}},stop:()=>void u.stop().then(o),load:o,job:e?.job??null}}var x=e=>e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e);function S({file:e,onNote:t}){return(0,v.jsx)(`button`,{type:`button`,"data-tip":e,onClick:async()=>t(await d(e)),className:r(f({size:`sm`}),`font-mono text-[12px]`),children:e.split(/[\\/]/).pop()})}function C({children:e,label:t}){return(0,v.jsx)(`pre`,{"aria-label":t,className:`m-0 max-h-[320px] overflow-auto rounded-[12px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre text-ink-2`,children:e})}function w({job:t,onStop:n,words:r}){let[s,c,l]=(r??y)[t.kind]??[`Working`,`Done`,`working`],u=(0,_.useRef)(null);(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[t.lines.length]);let d=t.exitCode===0,f=!d&&(t.kind===`check`||t.kind===`trace`)&&t.result!==void 0&&!t.result.error;return(0,v.jsxs)(`section`,{"aria-label":t.running?s:c,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,v.jsxs)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:[t.running?s:c,t.target?(0,v.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,t.target]}):null]}),(0,v.jsx)(o,{tone:t.running?`running`:d?`pass`:t.exitCode===2||f?`warn`:`fail`,orb:l,children:t.running?`Working`:d?`Done`:f?`Some broken`:t.exitCode===2?`Not done`:`Failed`}),t.running&&(0,v.jsxs)(i,{variant:`danger`,onClick:n,children:[(0,v.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,v.jsxs)(`details`,{open:t.running||!d&&!t.result,children:[(0,v.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,a(t.lines.length,`line`),`)`]}),(0,v.jsx)(`code`,{className:`mt-2 block font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:t.command}),(0,v.jsx)(`pre`,{ref:u,className:`mt-2 max-h-[240px] overflow-auto rounded-[10px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:t.lines.join(`
2
2
  `)||`Starting…`})]})]})}function T({text:e}){return(0,v.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e})}function E({columns:e,rows:t}){let n=e.map((e,n)=>t.length>0&&t.every(e=>e[n]===null||e[n]===void 0||typeof e[n]==`number`)&&t.some(e=>typeof e[n]==`number`));return(0,v.jsx)(m,{label:`Rows`,resetKey:t,head:e.map((e,t)=>(0,v.jsx)(`th`,{className:n[t]?h:g,children:e},e)),children:t.map((e,t)=>(0,v.jsx)(`tr`,{className:p,children:e.map((e,t)=>(0,v.jsx)(`td`,{"data-tip":x(e),className:r(`px-3 py-1.5 font-mono text-[12px]`,n[t]?`text-right whitespace-nowrap tabular-nums`:`max-w-[320px] truncate`,e==null&&`text-muted`),children:x(e)},t))},t))})}function D({r:e}){return(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(e.order||[]).map(t=>{let n=e.preview?.[t],r=n?.sample||[],i=r.length?Object.keys(r[0]):[];return(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsxs)(`span`,{className:`text-sm`,children:[(0,v.jsx)(`span`,{className:`font-medium`,children:t}),` · `,a(e.rows?.[t]??0,`row`),n?.database_fills?.length?(0,v.jsxs)(`span`,{className:`text-muted`,children:[` · the database fills `,n.database_fills.join(`, `)]}):null,e.masked?.[t]?.length?(0,v.jsxs)(`span`,{className:`text-muted`,children:[` · masked `,e.masked[t].join(`, `)]}):null]}),i.length>0&&(0,v.jsx)(E,{columns:i,rows:r.slice(0,3).map(e=>i.map(t=>e[t]))})]},t)}),(e.warnings||[]).map((e,t)=>(0,v.jsx)(`p`,{className:`m-0 text-[13px] text-warn`,children:e},t))]})}var O={query:`Existing rows`,generate:`New rows`};function k({r:e,onNote:t}){let n=Object.entries(e.rows||{});return(0,v.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(o,{tone:`pass`,children:O[e.kind||``]||`Answered`}),(0,v.jsxs)(`span`,{className:`min-w-0 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.database,e.why?` · ${e.why}`:``]})]}),n.map(([t,n])=>(0,v.jsx)(A,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsx)(`span`,{className:`text-sm font-medium`,children:`The query, as the database checked it`}),(0,v.jsx)(C,{label:`SQL`,children:e.sql})]}),e.script_preview&&e.script_preview.length>0&&(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script for these rows, not run`}),(0,v.jsx)(C,{label:`INSERT script`,children:e.script_preview.join(`
3
3
  `)})]}),e.files?.length?(0,v.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Kept`,e.files.map(e=>(0,v.jsx)(S,{file:e,onNote:t},e))]}):null,e.replay&&(0,v.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Tests and pipelines get the same data with `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2`,children:e.replay}),`, without a model.`]})]})}function A({title:e,rows:t,total:n}){let r=[...new Set(t.flatMap(e=>Object.keys(e)))];return(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsxs)(`span`,{className:`text-sm`,children:[(0,v.jsx)(`span`,{className:`font-medium`,children:e}),` · `,a(n,`row`),n>t.length?(0,v.jsxs)(`span`,{className:`text-muted`,children:[` · `,t.length,` shown`]}):null]}),r.length>0?(0,v.jsx)(E,{columns:r,rows:t.map(e=>r.map(t=>e[t]))}):(0,v.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No rows match.`})]})}function j({items:e,text:t,label:n,size:r=10,children:i}){let[a,o]=(0,_.useState)(``),[l,u]=(0,_.useState)(0),d=a.toLowerCase().split(/\s+/).filter(Boolean),f=d.length?e.filter(e=>d.every(n=>t(e).toLowerCase().includes(n))):e;(0,_.useEffect)(()=>u(0),[a,e.length]);let p=Math.min(l,Math.max(0,Math.ceil(f.length/r)-1));return(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.length>r&&(0,v.jsx)(s,{id:`find-${n.toLowerCase().replace(/\W+/g,`-`)}`,label:`Find in ${n.toLowerCase()}`,value:a,onChange:o,className:`flex-none`}),f.length?(0,v.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:f.slice(p*r,p*r+r).map(i)}):(0,v.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing matches.`}),f.length>r&&(0,v.jsx)(c,{page:p,size:r,total:f.length,onPage:u,label:`Pages of ${n.toLowerCase()}`})]})}export{w as a,T as c,x as d,b as f,D as i,E as l,C as n,O as o,S as r,j as s,k as t,A as u};
@@ -1 +1 @@
1
- import{Ir as e,Nr as t,T as n}from"./line-icons-CQ-3V8ax.js";import{B as r,qt as i}from"./filters-mFECJpMB.js";import{Dt as a}from"./frame-CInX-4Bh.js";var o=e(t(),1),s=i();function c({title:e,children:t,defaultOpen:i}){let[c,l]=(0,o.useState)(!!i),u=(0,o.useId)();return(0,s.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,s.jsxs)(`button`,{type:`button`,"aria-expanded":c,"aria-controls":u,onClick:()=>l(!c),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,s.jsx)(n,{size:15,"aria-hidden":`true`,className:r(`transition-transform`,c&&`rotate-180`)}),e]}),(0,s.jsx)(a,{open:c,id:u,children:t})]})}export{c as t};
1
+ import{Ir as e,Nr as t,T as n}from"./line-icons-CQ-3V8ax.js";import{B as r,qt as i}from"./filters-mFECJpMB.js";import{Dt as a}from"./frame-DiKY0GWx.js";var o=e(t(),1),s=i();function c({title:e,children:t,defaultOpen:i}){let[c,l]=(0,o.useState)(!!i),u=(0,o.useId)();return(0,s.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,s.jsxs)(`button`,{type:`button`,"aria-expanded":c,"aria-controls":u,onClick:()=>l(!c),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,s.jsx)(n,{size:15,"aria-hidden":`true`,className:r(`transition-transform`,c&&`rotate-180`)}),e]}),(0,s.jsx)(a,{open:c,id:u,children:t})]})}export{c as t};