@straiffi/archon 1.8.6 → 1.8.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 (169) hide show
  1. package/dist/client/assets/ActivityView--4X_m6mR.js +1 -0
  2. package/dist/client/assets/GitHubActionsDialog-DZ1lHM01.js +1 -0
  3. package/dist/client/assets/RepositoryGraphDialog-B--YlQcV.js +1 -0
  4. package/dist/client/assets/VerificationDialog-BIWPtBg3.js +4 -0
  5. package/dist/client/assets/{arc-D2Nn9xIj.js → arc-C83vRtlz.js} +1 -1
  6. package/dist/client/assets/architecture-7EHR7CIX-Dm8H7N6Z.js +1 -0
  7. package/dist/client/assets/{architectureDiagram-3BPJPVTR-BH5LLK54.js → architectureDiagram-3BPJPVTR-CY5xTOZJ.js} +1 -1
  8. package/dist/client/assets/{blockDiagram-GPEHLZMM-xOxShPwZ.js → blockDiagram-GPEHLZMM-DkMi7gMh.js} +1 -1
  9. package/dist/client/assets/{c4Diagram-AAUBKEIU-BXMrXnKR.js → c4Diagram-AAUBKEIU-ZZxXBBU4.js} +1 -1
  10. package/dist/client/assets/channel-b2AN-U3x.js +1 -0
  11. package/dist/client/assets/{chunk-2J33WTMH-BdDEtNMz.js → chunk-2J33WTMH-C9PiKMs-.js} +1 -1
  12. package/dist/client/assets/{chunk-3OPIFGDE-PtSkTtIU.js → chunk-3OPIFGDE-B81aUmvi.js} +1 -1
  13. package/dist/client/assets/{chunk-4BX2VUAB-CtLS8D71.js → chunk-4BX2VUAB-C5pU9ApX.js} +1 -1
  14. package/dist/client/assets/{chunk-4EGX6M5U-Btnm0QNe.js → chunk-4EGX6M5U-CAjWPjND.js} +1 -1
  15. package/dist/client/assets/{chunk-55IACEB6-74CcJaub.js → chunk-55IACEB6-DhO4-AG4.js} +1 -1
  16. package/dist/client/assets/{chunk-5DO6E6H7-WLZ8L4ko.js → chunk-5DO6E6H7-BDKA-zHS.js} +1 -1
  17. package/dist/client/assets/{chunk-5ZQYHXKU-D5PYP24m.js → chunk-5ZQYHXKU-Bk2Owm90.js} +1 -1
  18. package/dist/client/assets/{chunk-727SXJPM-gDX0xZh1.js → chunk-727SXJPM-Bx-79aJk.js} +1 -1
  19. package/dist/client/assets/{chunk-AQP2D5EJ-Bat82lQQ.js → chunk-AQP2D5EJ-GQNXYOf0.js} +1 -1
  20. package/dist/client/assets/{chunk-BR22UD5L-Cou5beGe.js → chunk-BR22UD5L-12D2GWh4.js} +1 -1
  21. package/dist/client/assets/{chunk-BSJP7CBP-DJ57XcV5.js → chunk-BSJP7CBP-DMi77e84.js} +1 -1
  22. package/dist/client/assets/{chunk-CSCIHK7Q-D3sau006.js → chunk-CSCIHK7Q-BV22j6vn.js} +2 -2
  23. package/dist/client/assets/{chunk-FHYWG6QK-Ba10e2kj.js → chunk-FHYWG6QK-BhSajKiB.js} +1 -1
  24. package/dist/client/assets/{chunk-FMBD7UC4-CEo2wZMx.js → chunk-FMBD7UC4-Drmlc0wM.js} +1 -1
  25. package/dist/client/assets/{chunk-KSCS5N6A-CqEcB7Dr.js → chunk-KSCS5N6A-C9LlcbWv.js} +1 -1
  26. package/dist/client/assets/{chunk-L5ZTLDWV-TRTuwXsF.js → chunk-L5ZTLDWV-D8PJqJnh.js} +1 -1
  27. package/dist/client/assets/{chunk-LZXEDZCA-DdpNmv37.js → chunk-LZXEDZCA-DcbPPozR.js} +2 -2
  28. package/dist/client/assets/{chunk-MPE355IW-MqEt-J8G.js → chunk-MPE355IW-Cw8YmjTC.js} +1 -1
  29. package/dist/client/assets/{chunk-MZUSXYTE-DdNi9lhx.js → chunk-MZUSXYTE-jvxRCZ7x.js} +1 -1
  30. package/dist/client/assets/{chunk-N66VUXT2-CjemTW4E.js → chunk-N66VUXT2-00i4y0yD.js} +1 -1
  31. package/dist/client/assets/{chunk-ND2GUHAM-BCUL9zWr.js → chunk-ND2GUHAM-NV-_2KqZ.js} +1 -1
  32. package/dist/client/assets/{chunk-NZK2D7GU-BAxuwE_2.js → chunk-NZK2D7GU-CbqA26gb.js} +1 -1
  33. package/dist/client/assets/{chunk-O5CBEL6O-Cttpc9yf.js → chunk-O5CBEL6O-B0DMN44B.js} +1 -1
  34. package/dist/client/assets/{chunk-PUPMXCY4-ZvwTw0To.js → chunk-PUPMXCY4-DfWourL7.js} +1 -1
  35. package/dist/client/assets/chunk-QZHKN3VN-CtbsU1Bj.js +1 -0
  36. package/dist/client/assets/{chunk-UIBZB4QT-BTY9be9s.js → chunk-UIBZB4QT-v-a5ZfN6.js} +1 -1
  37. package/dist/client/assets/{chunk-WCWK7LTN-Db1n3n3-.js → chunk-WCWK7LTN-CtYzhvvb.js} +1 -1
  38. package/dist/client/assets/chunk-WU5MYG2G-CYpcnwf9.js +1 -0
  39. package/dist/client/assets/{chunk-XPW4576I-DObFPxjB.js → chunk-XPW4576I-CvnAuXH2.js} +1 -1
  40. package/dist/client/assets/classDiagram-4FO5ZUOK-C0exS5oM.js +1 -0
  41. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DkB9dQZ1.js +1 -0
  42. package/dist/client/assets/{cose-bilkent-S5V4N54A-MlOPiG6P.js → cose-bilkent-S5V4N54A-fchD-dH2.js} +1 -1
  43. package/dist/client/assets/{dagre-BM42HDAG-BTsZ2dQI.js → dagre-BM42HDAG-B5HD9fyK.js} +1 -1
  44. package/dist/client/assets/{dagre-BWNHuDdf.js → dagre-DSrzm-Gq.js} +1 -1
  45. package/dist/client/assets/{diagram-2AECGRRQ-afPu4kp4.js → diagram-2AECGRRQ-BCXvWFpM.js} +1 -1
  46. package/dist/client/assets/{diagram-5GNKFQAL-SixbJGPN.js → diagram-5GNKFQAL-CSpWGfAO.js} +1 -1
  47. package/dist/client/assets/{diagram-KO2AKTUF-Dk1670ag.js → diagram-KO2AKTUF-CFECGppT.js} +1 -1
  48. package/dist/client/assets/{diagram-LMA3HP47-BDNhjRaO.js → diagram-LMA3HP47-Dpb99QbZ.js} +1 -1
  49. package/dist/client/assets/{diagram-OG6HWLK6-BLowQCLY.js → diagram-OG6HWLK6-DJcTGnx0.js} +1 -1
  50. package/dist/client/assets/{erDiagram-TEJ5UH35-DAg9kUbm.js → erDiagram-TEJ5UH35-jWArJxNU.js} +1 -1
  51. package/dist/client/assets/eventmodeling-FCH6USID-BWhw0UJ8.js +1 -0
  52. package/dist/client/assets/{flowDiagram-I6XJVG4X-BsaPmiIS.js → flowDiagram-I6XJVG4X-DDF3P1hY.js} +1 -1
  53. package/dist/client/assets/{ganttDiagram-6RSMTGT7-DfF1TT-s.js → ganttDiagram-6RSMTGT7-Corwr_18.js} +1 -1
  54. package/dist/client/assets/gitGraph-WXDBUCRP-BSnxAa1J.js +1 -0
  55. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CEvTiN6n.js → gitGraphDiagram-PVQCEYII-WzlpszWn.js} +1 -1
  56. package/dist/client/assets/index-Bs5SQZhz.css +2 -0
  57. package/dist/client/assets/index-Dy-7h3lN.js +274 -0
  58. package/dist/client/assets/info-J43DQDTF-DcFwF1-h.js +1 -0
  59. package/dist/client/assets/{infoDiagram-5YYISTIA-CBjYYrzJ.js → infoDiagram-5YYISTIA-C0VwTwNC.js} +1 -1
  60. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-BuCkp1uL.js → ishikawaDiagram-YF4QCWOH-m9l3k2qX.js} +1 -1
  61. package/dist/client/assets/{journeyDiagram-JHISSGLW-DkUPCxT5.js → journeyDiagram-JHISSGLW-DMhT8HTW.js} +1 -1
  62. package/dist/client/assets/{kanban-definition-UN3LZRKU-CXwNZ0Fa.js → kanban-definition-UN3LZRKU-C2ZkcOi0.js} +1 -1
  63. package/dist/client/assets/{line-CRTZgJXA.js → line-gKkUdUWR.js} +1 -1
  64. package/dist/client/assets/{linear-DT4rSZvy.js → linear-BOwW57yX.js} +1 -1
  65. package/dist/client/assets/{mermaid-parser.core-NTByLn30.js → mermaid-parser.core-DdBfJWbP.js} +2 -2
  66. package/dist/client/assets/{mermaid.core-DszsB_Gl.js → mermaid.core-DXnhq-eu.js} +3 -3
  67. package/dist/client/assets/{mindmap-definition-RKZ34NQL-DCrqCcPX.js → mindmap-definition-RKZ34NQL-B0gX4aJy.js} +1 -1
  68. package/dist/client/assets/{ordinal-k--hYEme.js → ordinal-CZ33lFpK.js} +1 -1
  69. package/dist/client/assets/packet-YPE3B663-1VZiO_9r.js +1 -0
  70. package/dist/client/assets/pie-LRSECV5Y-BX1-tQCu.js +1 -0
  71. package/dist/client/assets/{pieDiagram-4H26LBE5-CbHeTKto.js → pieDiagram-4H26LBE5-BHYdLmpx.js} +1 -1
  72. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-Ptpkh0Dc.js → quadrantDiagram-W4KKPZXB-C-H-yQwU.js} +1 -1
  73. package/dist/client/assets/radar-GUYGQ44K-B2HRrCR4.js +1 -0
  74. package/dist/client/assets/{requirementDiagram-4Y6WPE33-73PM-Ae5.js → requirementDiagram-4Y6WPE33-DY_pSCFy.js} +1 -1
  75. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-B7RCxzNy.js → sankeyDiagram-5OEKKPKP-CC61HRGf.js} +1 -1
  76. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DGXfHCo0.js → sequenceDiagram-3UESZ5HK-B8fXWNxw.js} +1 -1
  77. package/dist/client/assets/{stateDiagram-AJRCARHV-Cl0_SVL3.js → stateDiagram-AJRCARHV-C_VYKsXW.js} +1 -1
  78. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-Ctk1r914.js +1 -0
  79. package/dist/client/assets/{timeline-definition-PNZ67QCA-Cufq-wYg.js → timeline-definition-PNZ67QCA-0fB4PIIX.js} +1 -1
  80. package/dist/client/assets/treeView-BLDUP644-CDfUVbUi.js +1 -0
  81. package/dist/client/assets/treemap-LRROVOQU-DUWqu8sK.js +1 -0
  82. package/dist/client/assets/{vennDiagram-CIIHVFJN-ROVZhhP-.js → vennDiagram-CIIHVFJN-CfpVF7Aa.js} +1 -1
  83. package/dist/client/assets/wardley-L42UT6IY-BEFuPUCy.js +1 -0
  84. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DlHRfLPH.js → wardleyDiagram-YWT4CUSO-CgdK4FcC.js} +1 -1
  85. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DW-KpRbf.js → xychartDiagram-2RQKCTM6-BEfatQYR.js} +1 -1
  86. package/dist/client/index.html +2 -2
  87. package/dist/server/db.js +399 -0
  88. package/dist/server/db.js.map +1 -1
  89. package/dist/server/index.js +106 -46
  90. package/dist/server/index.js.map +1 -1
  91. package/dist/server/lib/agent.js +9 -6
  92. package/dist/server/lib/agent.js.map +1 -1
  93. package/dist/server/lib/checkWorkspaceIdentity.js +2 -206
  94. package/dist/server/lib/checkWorkspaceIdentity.js.map +1 -1
  95. package/dist/server/lib/executionReconciliation.js +73 -0
  96. package/dist/server/lib/executionReconciliation.js.map +1 -1
  97. package/dist/server/lib/git.js +302 -11
  98. package/dist/server/lib/git.js.map +1 -1
  99. package/dist/server/lib/integrations/github.js +145 -66
  100. package/dist/server/lib/integrations/github.js.map +1 -1
  101. package/dist/server/lib/integrations/importedIssueImages.js +10 -15
  102. package/dist/server/lib/integrations/importedIssueImages.js.map +1 -1
  103. package/dist/server/lib/postBuildChecks.js +20 -12
  104. package/dist/server/lib/postBuildChecks.js.map +1 -1
  105. package/dist/server/lib/repositoryGraphAnalyzer.js +392 -0
  106. package/dist/server/lib/repositoryGraphAnalyzer.js.map +1 -0
  107. package/dist/server/lib/repositoryGraphGitHistory.js +371 -0
  108. package/dist/server/lib/repositoryGraphGitHistory.js.map +1 -0
  109. package/dist/server/lib/repositoryGraphIdentity.js +134 -0
  110. package/dist/server/lib/repositoryGraphIdentity.js.map +1 -0
  111. package/dist/server/lib/repositoryGraphManifest.js +386 -0
  112. package/dist/server/lib/repositoryGraphManifest.js.map +1 -0
  113. package/dist/server/lib/repositoryGraphQueries.js +370 -0
  114. package/dist/server/lib/repositoryGraphQueries.js.map +1 -0
  115. package/dist/server/lib/repositoryGraphRetention.js +104 -0
  116. package/dist/server/lib/repositoryGraphRetention.js.map +1 -0
  117. package/dist/server/lib/repositoryGraphRoutes.js +145 -0
  118. package/dist/server/lib/repositoryGraphRoutes.js.map +1 -0
  119. package/dist/server/lib/repositoryGraphScan.js +370 -0
  120. package/dist/server/lib/repositoryGraphScan.js.map +1 -0
  121. package/dist/server/lib/repositoryGraphStore.js +352 -0
  122. package/dist/server/lib/repositoryGraphStore.js.map +1 -0
  123. package/dist/server/lib/repositoryGraphTargets.js +30 -0
  124. package/dist/server/lib/repositoryGraphTargets.js.map +1 -0
  125. package/dist/server/lib/repositoryGraphTypeScript.js +288 -0
  126. package/dist/server/lib/repositoryGraphTypeScript.js.map +1 -0
  127. package/dist/server/lib/terminal.js +25 -1
  128. package/dist/server/lib/terminal.js.map +1 -1
  129. package/dist/server/lib/types.js +1 -0
  130. package/dist/server/lib/types.js.map +1 -1
  131. package/dist/server/lib/workspaceIdentity.js +433 -0
  132. package/dist/server/lib/workspaceIdentity.js.map +1 -0
  133. package/dist/server/workers/plan.js +9 -7
  134. package/dist/server/workers/plan.js.map +1 -1
  135. package/dist/server/workers/repositoryGraphAnalyzer.js +282 -0
  136. package/dist/server/workers/repositoryGraphAnalyzer.js.map +1 -0
  137. package/package.json +2 -1
  138. package/dist/client/assets/ActivityView-DDeEQgbm.js +0 -1
  139. package/dist/client/assets/GitHubActionsDialog-DH-B_LR3.js +0 -1
  140. package/dist/client/assets/VerificationDialog-x43F7tbo.js +0 -4
  141. package/dist/client/assets/architecture-7EHR7CIX-C-4Cp4ml.js +0 -1
  142. package/dist/client/assets/channel-C0dk5Jiy.js +0 -1
  143. package/dist/client/assets/chunk-QZHKN3VN-LI_RZca2.js +0 -1
  144. package/dist/client/assets/chunk-WU5MYG2G-620NtSlY.js +0 -1
  145. package/dist/client/assets/classDiagram-4FO5ZUOK-C5ptkk7I.js +0 -1
  146. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BFuXUVOx.js +0 -1
  147. package/dist/client/assets/eventmodeling-FCH6USID-Dqb6QKoI.js +0 -1
  148. package/dist/client/assets/gitGraph-WXDBUCRP-DYEsqh93.js +0 -1
  149. package/dist/client/assets/index-B5TSPCJr.css +0 -2
  150. package/dist/client/assets/index-DV0vl670.js +0 -274
  151. package/dist/client/assets/info-J43DQDTF-CfjXFZai.js +0 -1
  152. package/dist/client/assets/packet-YPE3B663-Dv0HkRHU.js +0 -1
  153. package/dist/client/assets/pie-LRSECV5Y-S5zPzZFN.js +0 -1
  154. package/dist/client/assets/radar-GUYGQ44K-B7psLv22.js +0 -1
  155. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-CqzC1yAT.js +0 -1
  156. package/dist/client/assets/treeView-BLDUP644-B8H0kT67.js +0 -1
  157. package/dist/client/assets/treemap-LRROVOQU-DPLhFHnh.js +0 -1
  158. package/dist/client/assets/wardley-L42UT6IY-B5-Vb08V.js +0 -1
  159. /package/dist/client/assets/{array-BNor45A1.js → array-B2f2amhX.js} +0 -0
  160. /package/dist/client/assets/{chunk-NNHCCRGN-CZB-V-Gv.js → chunk-NNHCCRGN-DgKrp8T-.js} +0 -0
  161. /package/dist/client/assets/{cytoscape.esm-B2lJcMSI.js → cytoscape.esm-BInZCgaJ.js} +0 -0
  162. /package/dist/client/assets/{defaultLocale-DPzUsThw.js → defaultLocale-sPXJ5urm.js} +0 -0
  163. /package/dist/client/assets/{dist-CERhmQhR.js → dist-DfHDMDTt.js} +0 -0
  164. /package/dist/client/assets/{graphlib-BHOW-eWz.js → graphlib-DacNv4Jd.js} +0 -0
  165. /package/dist/client/assets/{init-C0L3woqb.js → init-BVCnG1lj.js} +0 -0
  166. /package/dist/client/assets/{katex-CpjQsUQe.js → katex-BlkrXOwm.js} +0 -0
  167. /package/dist/client/assets/{path-sMK4d_s9.js → path-Bw5AvBNC.js} +0 -0
  168. /package/dist/client/assets/{rough.esm-BoTisKeL.js → rough.esm-DeLgKbOI.js} +0 -0
  169. /package/dist/client/assets/{src-BRjoYtUW.js → src-CFGsdLiG.js} +0 -0
@@ -0,0 +1 @@
1
+ import{i as e,pt as t}from"./index-Dy-7h3lN.js";var n=t(),r=({projectId:t,onClose:r,onNavigateToLifecycleSource:i,initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c})=>t?(0,n.jsx)(e,{projectId:t,scope:{type:`project`},initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c,onClose:r,onNavigateToLifecycleSource:i}):null;export{r as ActivityView};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{C as t,D as n,E as r,F as i,G as a,H as o,I as s,K as c,N as l,S as u,T as d,U as f,V as p,W as m,X as h,Y as g,Z as _,bt as v,d as y,dt as ee,ft as te,gt as b,lt as ne,mt as x,pt as S,ut as re,w as C,x as w}from"./index-Dy-7h3lN.js";var T=e(v(),1),E=S(),D=`https://docs.github.com/en/actions`,ie=5e3,O=(e,t)=>u.t(`common:githubActions.${e}`,t),k=e=>O(`status.${e}`),A=e=>e?O(`conclusion.${e}`):null,j=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`||e.conclusion===`timed_out`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e.conclusion===`cancelled`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e.status===`queued`?`border-violet-400/40 bg-violet-500/10 text-violet-200`:`border-border/70 bg-background/60 text-muted-foreground`,M=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`?`border-rose-400/30 bg-rose-500/10 text-rose-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border/70 bg-background/60 text-muted-foreground`,N=e=>{let t=e.run_started_at??e.created_at,n=e.updated_at;if(!t||!n)return null;let r=Date.parse(t),i=Date.parse(n);if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return null;let a=i-r;if(a<1e3)return`${a} ms`;let o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60;return s>0?`${s}h ${c}m ${l}s`:c>0?`${c}m ${l}s`:`${(a/1e3).toFixed(a>=1e4?0:1)} s`},P=e=>e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status),F=e=>{let t={};for(let n of e){if(n.type===`boolean`){t[n.name]=n.default===!0;continue}typeof n.default==`string`&&n.default!==``&&(t[n.name]=n.default)}return t},ae=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let a=e.state===`active`,o=t?.dispatchable??!0,c=a&&o&&!t?.isLoading,l=e.path.split(`/`).pop();return(0,E.jsxs)(`div`,{className:_(`flex flex-col gap-3 rounded-2xl border px-4 py-3 transition-colors`,n?`border-sky-400/45 bg-sky-500/10`:`border-border/60 bg-background/20 hover:bg-accent/20`),children:[(0,E.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,E.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:l}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,a?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:O(a?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,E.jsxs)(h,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!c,"aria-label":O(`workflows.runAriaLabel`,{name:e.name}),title:!o&&t?O(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(i,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:O(`actions.run`)})]})]})]})},I=({workflow:e,inputsState:n,refValue:r,onRefChange:a,values:c,onValueChange:l,isDispatching:u,onDispatch:d,onCancel:f})=>{let m=n.inputs.filter(e=>e.required&&!L(c[e.name],e)),g=n.dispatchable&&!n.isLoading&&!n.error&&r.trim()!==``&&m.length===0&&!u;return(0,E.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`inputs.title`)}),(0,E.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":O(`actions.cancel`),onClick:f,children:(0,E.jsx)(t,{className:`h-4 w-4`})})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(p,{htmlFor:`github-actions-ref`,children:O(`inputs.refLabel`)}),(0,E.jsx)(o,{id:`github-actions-ref`,type:`text`,value:r,onChange:e=>{a(e.target.value)},placeholder:O(`inputs.refPlaceholder`),"aria-label":O(`inputs.refAriaLabel`)})]}),n.isLoading&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`inputs.loading`)})]}),n.error&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:n.error}),!n.dispatchable&&!n.isLoading&&!n.error&&(0,E.jsx)(`p`,{className:`text-xs text-amber-200`,children:O(`inputs.notDispatchable`)}),n.inputs.map(e=>(0,E.jsx)(R,{input:e,value:c[e.name],onChange:t=>{l(e.name,t)}},e.name)),m.length>0&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:O(`inputs.requiredValidationError`)}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(h,{type:`button`,variant:`ghost`,onClick:f,disabled:u,children:O(`actions.cancel`)}),(0,E.jsxs)(h,{type:`button`,variant:`success`,onClick:d,disabled:!g,children:[u?(0,E.jsx)(s,{className:`h-4 w-4 animate-spin`}):(0,E.jsx)(i,{className:`h-4 w-4`}),(0,E.jsx)(`span`,{children:O(`actions.dispatch`)})]})]})]})},L=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,R=({input:e,value:t,onChange:n})=>{let r=`github-actions-input-${e.name}`;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(p,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{children:e.name}),e.required&&(0,E.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:O(`inputs.requiredLabel`)})]}),e.description&&(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),z(e,r,t,n)]})},z=(e,t,n,r)=>{if(e.type===`boolean`){let i=typeof n==`boolean`?n:e.default===!0;return(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(y,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(i?`inputs.booleanYes`:`inputs.booleanNo`)})]})}if(e.type===`choice`){let i=e.options??[],a=typeof n==`string`?n:typeof e.default==`string`?e.default:``;return(0,E.jsxs)(`select`,{id:t,className:`h-9 w-full rounded-lg border border-border/70 bg-background/60 px-3 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,value:a,onChange:e=>{r(e.target.value)},children:[a===``&&(0,E.jsx)(`option`,{value:``,children:O(`inputs.selectPlaceholder`)}),i.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]})}return(0,E.jsx)(o,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},B=({job:e})=>e.steps.length===0?null:(0,E.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,M(t)),children:t.status===`completed`?A(t.conclusion)??O(`status.completed`):k(t.status)}),(0,E.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),V=({run:e})=>{let t=N(e),n=P(e);return(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,j(e)),children:n})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,E.jsxs)(`a`,{href:e.html_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-sky-200 hover:text-sky-100`,children:[O(`actions.openOnGithub`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,E.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,E.jsxs)(`div`,{className:`mt-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,j(e)),children:e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status)}),(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,E.jsx)(B,{job:e})]},e.id))]})},H=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??O(`runs.trackingState.${e.state}`);return(0,E.jsxs)(`div`,{className:_(`flex items-start gap-2 rounded-2xl border px-4 py-3`,t?`border-border/60 bg-background/20`:`border-red-400/25 bg-red-500/8`),children:[t&&(0,E.jsx)(s,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:_(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,E.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??O(`runs.unknownRef`)})]})]})},U=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||(e.updated_at??``)>=(t.updated_at??``))&&n.set(e.id,e)}return[...n.values()]},W=(e,t)=>{let n=new Map(e.map(e=>[e.execution_run_id,e]));for(let e of t){let t=n.get(e.execution_run_id),r=t&&![`queued`,`waiting`,`running`].includes(t.execution_status),i=[`queued`,`waiting`,`running`].includes(e.execution_status);(!r||!i)&&n.set(e.execution_run_id,e)}return[...n.values()]},oe=(e,t,n)=>{let r=t.filter(e=>e.run===null),i=new Set(r.map(e=>e.tracking_key));return W(e.filter(e=>i.has(e.tracking_key)||n.get(e.tracking_key)?.run===null),r.filter(e=>!n.has(e.tracking_key)))},se=e=>({ref:e??`main`}),G=({projectId:e,defaultBranch:i,onClose:o})=>{let[u,p]=(0,T.useState)([]),[_,v]=(0,T.useState)(!0),[y,S]=(0,T.useState)(null),[w,k]=(0,T.useState)([]),[A,j]=(0,T.useState)([]),[M,N]=(0,T.useState)({}),[P,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(!1),[B]=(0,T.useState)(()=>se(i)),W=(0,T.useRef)({}),G=(0,T.useRef)({}),K=(0,T.useRef)(null),q=(0,T.useRef)(!1),J=(0,T.useRef)(0),Y=(0,T.useRef)(new Map),X=(0,T.useCallback)(async t=>{N(e=>{let n=e[t.id];return n?.isLoading?e:{...e,[t.id]:{inputs:n?.inputs??[],dispatchable:n?.dispatchable??!0,isLoading:!0,error:null}}});try{let n=await re(e,t.id,t.path);return N(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return N(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof x?e.message:O(`workflows.loadError`)}})),null}},[e]),Z=(0,T.useCallback)(async()=>{v(!0),S(null);try{let t=await te(e);p(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){S(e instanceof x?e.message:O(`workflows.loadError`))}finally{v(!1)}},[X,e]),Q=(0,T.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await ee(e,t);k(e=>U(e,r.runs)),j(e=>{let t=new Map([...Y.current.entries()].filter(([,e])=>e.revision>n).map(([e,t])=>[e,t.event]));return oe(e,r.tracked_runs??[],t)})}catch(e){b(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,T.useEffect)(()=>{Z()},[Z]),(0,T.useEffect)(()=>{let e=new AbortController,t=()=>{document.visibilityState===`visible`&&Q(e.signal)};t();let n=window.setInterval(t,ie),i=r(t);return()=>{e.abort(),window.clearInterval(n),i()}},[Q]);let ce=(0,T.useCallback)(async e=>{if(P?.workflow.id===e.id)return;K.current=e.id,L({workflow:e,ref:B.ref,values:{}});let t=M[e.id];if(t&&!t.isLoading&&!t.error){L(n=>!n||n.workflow.id!==e.id?n:{...n,values:F(t.inputs)});return}let n=await X(e);n&&L(t=>!t||t.workflow.id!==e.id?t:{...t,values:F(n.inputs)})},[B.ref,M,X,P]),le=(0,T.useCallback)(async()=>{if(!P)return;let t=M[P.workflow.id];if(!t||!t.dispatchable)return;z(!0);let n={};for(let e of t.inputs){let t=P.values[e.name];e.type===`boolean`?n[e.name]=typeof t==`boolean`?t:e.default===!0:typeof t==`string`&&t!==``?n[e.name]=t:typeof e.default==`string`&&e.default!==``&&(n[e.name]=e.default)}try{await ne(e,P.workflow.id,{ref:P.ref,workflowName:P.workflow.name,workflowUrl:P.workflow.url,inputs:n}),l.success(O(`messages.dispatched`)),L(null),Q()}catch(e){l.error(e instanceof x?e.message:O(`messages.dispatchError`))}finally{z(!1)}},[M,Q,e,P]);(0,T.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),j(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&k(e=>U(e,[t.run])))};return d.on(`github-actions:updated`,t),()=>{d.off(`github-actions:updated`,t)}},[e]),(0,T.useEffect)(()=>{let e=P?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[P?.workflow.id]);let $=(0,T.useMemo)(()=>[...w].sort((e,t)=>{let n=e.updated_at?Date.parse(e.updated_at):0;return(t.updated_at?Date.parse(t.updated_at):0)-n}),[w]);return(0,E.jsx)(f,{open:!0,onOpenChange:e=>{e||o()},children:(0,E.jsxs)(a,{showCloseButton:!1,overlayClassName:`bg-black/70`,className:`flex h-[calc(100vh-2rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl border border-[#2a2a38] bg-[#16161f] p-0 shadow-2xl sm:max-w-5xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,E.jsx)(g,{className:`sr-only`,children:O(`dialog.srTitle`)}),(0,E.jsx)(c,{className:`sr-only`,children:O(`dialog.srDescription`)}),(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-violet-200`,children:(0,E.jsx)(n,{className:`h-5 w-5`})}),(0,E.jsx)(`div`,{children:(0,E.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:O(`dialog.title`)})})]}),(0,E.jsx)(m,{asChild:!0,children:(0,E.jsx)(h,{type:`button`,"aria-label":O(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(t,{className:`h-4 w-4`})})})]}),(0,E.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,E.jsxs)(`aside`,{"aria-label":O(`workflows.ariaLabel`),className:`flex min-h-0 flex-col gap-3 overflow-y-auto border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`workflows.title`)}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:O(`actions.refresh`)})]}),_&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`workflows.loading`)})]}),y&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:y}),!_&&u.length===0&&!y&&(0,E.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:[(0,E.jsx)(`p`,{children:O(`workflows.empty`)}),(0,E.jsx)(`p`,{className:`mt-1`,children:O(`workflows.emptyHint`)}),(0,E.jsxs)(`a`,{href:D,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[O(`workflows.docsLink`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]}),(0,E.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>{let t=P?.workflow.id===e.id;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,E.jsx)(ae,{workflow:e,inputsState:M[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&P&&(0,E.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,E.jsx)(I,{workflow:e,inputsState:M[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:P.ref,onRefChange:e=>{L(t=>t&&{...t,ref:e})},values:P.values,onValueChange:(e,t)=>{L(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:R,onDispatch:()=>{le()},onCancel:()=>{L(null)}})})]},e.id)})})]}),(0,E.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`runs.title`)}),A.map(e=>(0,E.jsx)(H,{tracked:e},e.tracking_key)),$.map(e=>(0,E.jsx)(V,{run:e},e.id)),$.length===0&&A.length===0&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:O(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{B as t,G as n,H as r,I as i,J as a,K as ee,U as te,V as ne,X as o,Y as re,bt as ie,gt as s,ht as c,l as ae,mt as l,pt as u,q as oe,r as se,vt as d,yt as ce}from"./index-Dy-7h3lN.js";var f=e(ie(),1),p=e=>({target_kind:e.kind,...e.kind===`bundle`?{bundle_id:e.bundle_id}:{}}),m=(e,t)=>{let n=new URL(c(e));return n.searchParams.set(`target_kind`,t.kind),t.kind===`bundle`&&t.bundle_id&&n.searchParams.set(`bundle_id`,t.bundle_id),n},le=(e,t,n={})=>d(m(`/projects/${encodeURIComponent(e)}/repository-graph/status`,t).toString(),{signal:n.signal}),ue=(e,t,n={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans`),{method:`POST`,body:p(t),signal:n.signal}),de=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/cancel`),{method:`POST`,body:p(t),signal:r.signal}),fe=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/retry`),{method:`POST`,body:p(t),signal:r.signal}),pe=(e,t,n,r,i)=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/path-impact`,t);return a.searchParams.set(`scan_id`,n),a.searchParams.set(`path`,r),a.searchParams.set(`direction`,i.direction),a.searchParams.set(`depth`,`1`),a.searchParams.set(`limit`,String(i.limit??50)),d(a.toString(),{signal:i.signal})},me=(e,t,n,r,i={})=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/edges/${encodeURIComponent(r)}/explanation`,t);return a.searchParams.set(`scan_id`,n),d(a.toString(),{signal:i.signal})},h=u(),g=new Set([`pending`,`running`]),he=new Set([`failed`,`cancelled`,`interrupted`]),ge=e=>!(e instanceof l)||typeof e.data!=`object`||e.data===null||!(`reason`in e.data)?null:typeof e.data.reason==`string`?e.data.reason:null,_e=e=>e===`deterministic`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-500/30 bg-amber-500/10 text-amber-200`:`border-violet-500/30 bg-violet-500/10 text-violet-200`,ve=2e3,ye=600,_=12,be=e=>({kind:e.kind,bundle_id:e.kind===`bundle`?e.bundle_id:null,ticket_id:null}),xe=(e,n)=>{let r=n.trim();return!e||!r?[]:e.entries.filter(e=>e.status!==`deleted`).map(e=>({entry:e,score:t(r,[e.path])})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||e.entry.path.localeCompare(t.entry.path)).slice(0,_).map(e=>e.entry)},v=({projectId:e,target:t,targetLabel:ie,canRunOperations:c=!0,onClose:l})=>{let{t:u}=ce(`common`,{keyPrefix:`repositoryGraphDialog`}),d=ae(),[p,m]=(0,f.useState)(null),[_,v]=(0,f.useState)(!1),[Se,y]=(0,f.useState)(!0),[b,x]=(0,f.useState)(null),[S,Ce]=(0,f.useState)(!1),[C,we]=(0,f.useState)(``),[Te,w]=(0,f.useState)(null),[T,Ee]=(0,f.useState)(`combined`),[E,De]=(0,f.useState)(null),[Oe,ke]=(0,f.useState)(null),[Ae,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[je,M]=(0,f.useState)(0),[N,P]=(0,f.useState)({}),F=(0,f.useRef)(null),I=(0,f.useRef)(0),L=(0,f.useRef)(null),R=(0,f.useRef)(null),z=(0,f.useRef)(0),B=(0,f.useRef)(null),V=(0,f.useRef)(0),H=(0,f.useRef)(new Map),U=(0,f.useCallback)(e=>{m(t=>t&&t.scan.scan_sequence>e.scan.scan_sequence?t:e),v(!1)},[]),W=(0,f.useCallback)(async()=>{let n=I.current+1;I.current=n,F.current?.abort();let r=new AbortController;F.current=r,y(!0),x(null);try{let i=await le(e,t,{signal:r.signal});I.current===n&&!r.signal.aborted&&U(i)}catch(e){if(s(e)||r.signal.aborted||I.current!==n)return;ge(e)===`scan_not_found`?(m(null),v(!0)):(v(!1),x(u(`errors.status`)))}finally{I.current===n&&!r.signal.aborted&&y(!1)}},[U,e,u,t]);(0,f.useEffect)(()=>{W()},[W]);let G=p?.scan??null;(0,f.useEffect)(()=>{if(!G||!g.has(G.status))return;let e=window.setInterval(()=>void W(),ve);return()=>window.clearInterval(e)},[W,G]),(0,f.useEffect)(()=>{let n=n=>n.project_id===e&&n.target_kind===t.kind&&(t.kind!==`bundle`||n.target_bundle_id===t.bundle_id),r=e=>{n(e)&&W()},i=()=>{W()};return d.on(`repository-graph-scan:updated`,r),d.on(`connect`,i),()=>{d.off(`repository-graph-scan:updated`,r),d.off(`connect`,i)}},[W,e,d,t.bundle_id,t.kind]),(0,f.useEffect)(()=>()=>{F.current?.abort(),L.current?.abort(),R.current?.abort(),B.current?.abort(),H.current.forEach(e=>e.abort()),H.current.clear()},[]);let K=async e=>{L.current?.abort(),F.current?.abort();let t=I.current+1;I.current=t;let n=new AbortController;L.current=n,Ce(!0),x(null);try{let r=await e(n.signal);!n.signal.aborted&&I.current===t&&(U(r),y(!1))}catch(e){!s(e)&&!n.signal.aborted&&x(u(`errors.operation`))}finally{n.signal.aborted||Ce(!1)}},q=G?.id??null,J=G?.status===`completed`,Y=C.trim(),X=(0,f.useDeferredValue)(C),Z=(0,f.useMemo)(()=>xe(O,X),[X,O]),Me=O?.entries.find(e=>e.status!==`deleted`&&e.path===Y)?.path??null,Ne=Y.includes(`/`)||/(^|\/)[^/]+\.[^/]+$/.test(Y),Q=Te??Me??(Ne?Y:``),$=Z.length===0?0:Math.min(je,Z.length-1);(0,f.useEffect)(()=>{B.current?.abort();let n=V.current+1;if(V.current=n,k(null),j(!1),!q||!J)return;let r=new AbortController;return B.current=r,j(!0),se(e,be(t),r.signal).then(e=>{!r.signal.aborted&&V.current===n&&k(e)}).catch(e=>{s(e)||r.signal.aborted||V.current!==n||k(null)}).finally(()=>{!r.signal.aborted&&V.current===n&&j(!1)}),()=>r.abort()},[J,e,q,t,t.bundle_id,t.kind]),(0,f.useEffect)(()=>{R.current?.abort();let n=z.current+1;if(z.current=n,H.current.forEach(e=>e.abort()),H.current.clear(),De(null),ke(null),P({}),!q||!J||!Q){D(!1);return}let r=new AbortController;R.current=r,D(!0);let i=window.setTimeout(()=>{pe(e,t,q,Q,{direction:T,limit:50,signal:r.signal}).then(e=>{!r.signal.aborted&&z.current===n&&De(e)}).catch(e=>{s(e)||r.signal.aborted||z.current!==n||ke(ge(e)===`path_not_found`?u(`errors.pathNotFound`):u(`errors.impact`))}).finally(()=>{!r.signal.aborted&&z.current===n&&D(!1)})},ye);return()=>{window.clearTimeout(i),r.abort()}},[J,T,Q,e,q,u,t]);let Pe=e=>{we(e),w(e),M(0)},Fe=e=>{if(e.key===`ArrowDown`&&Z.length>0){e.preventDefault(),M(e=>Math.min(e+1,Z.length-1));return}if(e.key===`ArrowUp`&&Z.length>0){e.preventDefault(),M(e=>Math.max(e-1,0));return}if(e.key===`Enter`){let t=Z[$];if(t){e.preventDefault(),Pe(t.path);return}Y&&(Ne||!O)&&(e.preventDefault(),w(Y))}},Ie=(n,r)=>{if(!r.currentTarget.open||N[n]?.state===`loading`||N[n]?.state===`loaded`||!q)return;let i=new AbortController,a=z.current;H.current.set(n,i),P(e=>({...e,[n]:{state:`loading`}})),me(e,t,q,n,{signal:i.signal}).then(e=>{!i.signal.aborted&&z.current===a&&P(t=>({...t,[n]:{state:`loaded`,response:e}}))}).catch(e=>{!s(e)&&!i.signal.aborted&&z.current===a&&P(e=>({...e,[n]:{state:`error`}}))}).finally(()=>{H.current.get(n)===i&&H.current.delete(n)})},Le=G?G.status===`pending`?`queued`:G.status===`completed`&&p?.freshness.state===`stale`?`stale`:G.status===`completed`&&p?.freshness.state===`unavailable`?`completeUnverified`:G.status===`completed`&&p?.freshness.is_current||G.status===`completed`?`complete`:G.status:_?`neverScanned`:`unknown`,Re=u(G?`refreshScan`:`startScan`),ze=!!G||_,Be=E?.paths.filter(e=>e.depth>0)??[];return(0,h.jsx)(te,{open:!0,onOpenChange:e=>{e||l()},children:(0,h.jsxs)(n,{showCloseButton:!1,className:`h-[calc(100vh-2rem)] max-h-[720px] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-4xl`,children:[(0,h.jsx)(a,{className:`border-b border-border/70 px-5 py-4 pr-6 sm:px-6`,children:(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(re,{children:u(`title`)}),(0,h.jsx)(ee,{className:`mt-1 break-words`,children:u(`target`,{target:ie})})]}),(0,h.jsxs)(o,{type:`button`,disabled:!c||!ze||Se||S||!!b||!!(G&&g.has(G.status)),onClick:()=>{K(n=>ue(e,t,{signal:n}))},children:[S&&(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),Re]})]})}),(0,h.jsxs)(`div`,{"data-testid":`repository-graph-scroll-region`,className:`min-h-0 space-y-6 overflow-y-auto px-5 py-5 sm:px-6`,children:[(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-status-title`,className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h3`,{id:`repository-graph-status-title`,className:`font-heading text-sm font-semibold`,children:u(`status.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,"aria-live":`polite`,children:u(Se?`status.loading`:`status.${Le}`)})]}),G&&g.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>de(e,t,G.id,{signal:n}))},children:u(`cancelScan`)}),G&&G.execution_run_id&&he.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>fe(e,t,G.id,{signal:n}))},children:u(`retryScan`)})]}),b&&(0,h.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-sm text-destructive`,role:`alert`,children:[(0,h.jsx)(`span`,{children:b}),(0,h.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void W(),children:u(`retryLoad`)})]}),G&&(0,h.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.files`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.admitted_file_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.relationships`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.edge_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.diagnostics`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.diagnostic_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.analyzer`)}),(0,h.jsxs)(`dd`,{className:`mt-1 font-mono text-sm`,children:[`v`,p?.analyzer_version]})]})]}),p?.truncation.scan&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`truncatedScan`)}),p?.freshness.state===`unavailable`&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`freshnessUnavailable`)}),p&&p.diagnostic_summary.total_count>0&&(0,h.jsxs)(`details`,{className:`mt-4 rounded-lg border border-border/60 p-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:u(`diagnostics.show`,{count:p.diagnostic_summary.total_count})}),(0,h.jsx)(`ul`,{className:`mt-3 space-y-2`,children:p.diagnostic_summary.diagnostics.map((e,t)=>(0,h.jsxs)(`li`,{className:`text-xs leading-5 text-muted-foreground`,children:[(0,h.jsx)(`span`,{className:`font-medium text-foreground`,children:e.code}),e.path&&(0,h.jsxs)(`span`,{children:[` · `,e.path]}),(0,h.jsx)(`p`,{className:`break-words`,children:e.message})]},`${e.code}-${e.path??``}-${t}`))}),p.diagnostic_summary.truncated&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`diagnostics.truncated`)})]})]}),(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-relationship-title`,children:[(0,h.jsx)(`h3`,{id:`repository-graph-relationship-title`,className:`font-heading text-sm font-semibold`,children:u(`relationships.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u(`relationships.description`)}),(0,h.jsxs)(`div`,{className:`mt-4`,children:[(0,h.jsx)(ne,{htmlFor:`repository-graph-path`,children:u(`relationships.pathLabel`)}),(0,h.jsxs)(`div`,{className:`relative mt-2`,children:[(0,h.jsx)(r,{id:`repository-graph-path`,type:`search`,value:C,disabled:!J,onChange:e=>{we(e.target.value),w(null),M(0)},onKeyDown:Fe,placeholder:u(`relationships.pathPlaceholder`),"aria-autocomplete":`list`,"aria-controls":`repository-graph-path-suggestions`,"aria-activedescendant":Z.length>0?`repository-graph-path-suggestion-${$}`:void 0}),J&&X.trim()&&Te!==Y&&(A||O)&&(0,h.jsxs)(`div`,{id:`repository-graph-path-suggestions`,role:`listbox`,className:`absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-lg`,children:[A&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.suggestionsLoading`)}),!A&&O&&Z.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.noSuggestions`)}),Z.map((e,t)=>(0,h.jsx)(`button`,{id:`repository-graph-path-suggestion-${t}`,type:`button`,role:`option`,"aria-selected":t===$,className:`block w-full rounded-md px-3 py-2 text-left font-mono text-xs ${t===$?`bg-accent text-accent-foreground`:`text-foreground hover:bg-muted`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>Pe(e.path),children:e.path},e.path))]})]})]}),(0,h.jsxs)(`fieldset`,{className:`mt-4`,disabled:!J,children:[(0,h.jsx)(`legend`,{className:`text-sm font-medium`,children:u(`relationships.direction`)}),(0,h.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-4`,children:[`combined`,`incoming`,`outgoing`].map(e=>(0,h.jsxs)(ne,{className:`flex items-center gap-2 text-sm`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`repository-graph-direction`,checked:T===e,onChange:()=>Ee(e)}),u(`relationships.directions.${e}`)]},e))})]}),!J&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.unavailable`)}),Ae&&(0,h.jsxs)(`p`,{className:`mt-4 flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),u(`relationships.loading`)]}),Oe&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-destructive`,role:`alert`,children:Oe}),E?.truncation.query&&(0,h.jsx)(`p`,{className:`mt-4 text-xs text-amber-200`,children:u(`relationships.truncated`)}),E&&Be.length===0&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.empty`)}),Be.length>0&&(0,h.jsx)(`ul`,{className:`mt-4 space-y-3`,children:Be.map(e=>{let t=e.edge_ids[e.edge_ids.length-1],n=t?N[t]:void 0,r=n?.state===`loaded`?n.response.edge:null,i=r?.evidence_class??e.evidence_classes[e.evidence_classes.length-1]??`deterministic`;return(0,h.jsxs)(`li`,{className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsx)(`p`,{className:`break-words text-sm font-medium`,children:r?u(`relationships.kinds.${r.kind}`,{path:e.path}):e.path}),(0,h.jsx)(`span`,{className:`mt-2 inline-flex rounded-full border px-2 py-1 text-xs font-medium ${_e(i)}`,children:u(`evidence.${i}.label`)}),t&&(0,h.jsxs)(`details`,{className:`mt-3`,onToggle:e=>Ie(t,e),children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground`,children:u(`relationships.showEvidence`)}),(0,h.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:[n?.state===`loading`&&(0,h.jsx)(`p`,{children:u(`relationships.loadingEvidence`)}),n?.state===`error`&&(0,h.jsx)(`p`,{className:`text-destructive`,children:u(`errors.explanation`)}),r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:u(`evidence.${r.evidence_class}.description`)}),(0,h.jsx)(`p`,{className:`mt-1`,children:u(`relationships.explanations.${r.kind}`)}),r.detail?.type===`relationship_value`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.value`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.value})]}),r.detail?.type===`co_changes`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2 gap-y-1`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.changeCount`)}),(0,h.jsx)(`dd`,{children:r.detail.change_count.toLocaleString()}),r.detail.sampled_commit_ids.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.sampledCommits`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.sampled_commit_ids.join(`, `)})]}),r.detail.samples_truncated&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`sr-only`,children:u(`relationships.evidenceDetail.coverage`)}),(0,h.jsx)(`dd`,{className:`col-span-2 text-amber-200`,children:u(`relationships.evidenceDetail.samplesTruncated`)})]})]})]})]})]})]},`${e.node.id}-${t??``}`)})})]})]}),(0,h.jsx)(oe,{className:`border-t border-border/70 px-5 py-4 sm:px-6`,children:(0,h.jsx)(o,{type:`button`,variant:`outline`,onClick:l,children:u(`close`)})})]})})};export{v as RepositoryGraphDialog};
@@ -0,0 +1,4 @@
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,A as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as ee,X as v,Y as y,Z as b,_ as te,_t as x,a as S,at as C,b as w,bt as T,c as ne,ct as re,et as ie,f as ae,g as E,gt as oe,h as D,ht as O,it as k,j as se,k as ce,l as le,m as ue,mt as A,n as de,nt as fe,o as pe,ot as me,p as j,pt as he,q as ge,rt as _e,s as ve,st as ye,t as M,tt as be,v as N,vt as xe,x as P,y as F,yt as I,z as Se}from"./index-Dy-7h3lN.js";var L=e(T(),1),R=he(),Ce=({title:e,children:t,defaultOpen:n=!1})=>(0,R.jsxs)(N,{defaultOpen:n,className:`mt-5 rounded-2xl border border-border/70 bg-background/25`,children:[(0,R.jsx)(w,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"aria-label":e,className:`group flex w-full items-center gap-2 rounded-2xl px-4 py-3 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e}),(0,R.jsx)(Se,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,R.jsx)(F,{className:`border-t border-border/60 px-4 py-3`,children:t})]}),z=e=>{if(!e.file_path)return null;if(!e.start_line)return e.file_path;let t=`${e.start_line}${e.start_column?`:${e.start_column}`:``}`,n=e.end_line?`-${e.end_line}${e.end_column?`:${e.end_column}`:``}`:``;return`${e.file_path}:${t}${n}`},B=[`error`,`warning`,`info`,`unknown`],V=e=>{let t={error:0,warning:0,info:0,unknown:0};return e.forEach(e=>{t[e.severity]+=1}),t},H=({counts:e,totalCount:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),r=B.filter(t=>e[t]>0);return(0,R.jsxs)(`div`,{"aria-label":n(`severitySummaryLabel`),className:`mt-3 flex flex-wrap items-center gap-2`,children:[r.map(t=>(0,R.jsx)(`span`,{className:`rounded-full border border-border/70 bg-background/45 px-2 py-1 text-[11px] text-muted-foreground`,children:n(`severityCount`,{count:e[t],severity:n(`severity.${t}`)})},t)),t>0&&t!==r.reduce((t,n)=>t+e[n],0)&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`totalAvailable`,{count:t})})]})},U=({attempt:e,parser:t,repair:n,ticketRequired:r,selectedTicketId:i,onSelectedTicketChange:a})=>{let{t:o}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),s=e.currency??`unavailable`;return(0,R.jsxs)(N,{className:`mt-4 rounded-xl border border-border/60 bg-background/25`,children:[(0,R.jsx)(w,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"aria-label":o(`technicalDetails`),className:`group flex w-full items-center gap-2 rounded-xl px-3 py-2.5 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:o(`technicalDetails`)}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:o(`technicalDetailsHint`)}),(0,R.jsx)(Se,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,R.jsxs)(F,{className:`border-t border-border/60 px-3 py-3`,children:[(0,R.jsxs)(`dl`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`parser.${t.parser_kind}`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserStateLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`state.${t.status}`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserRetentionLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${t.retention_state}`)})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`outputRetentionLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${e.output_retention_state}`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`applicabilityLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`applicability`,{state:o(`applicabilityState.${s}`)})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`sourceLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 break-words text-foreground`,children:e.command_snapshot.name})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`destinationTitle`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`destination.${n.destination}`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-muted-foreground`,children:o(`destinationHint`)})]})]}),r&&n&&(0,R.jsxs)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,children:[o(`ticketLabel`),(0,R.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:`mt-1 h-10 w-full rounded-xl border border-border bg-card px-3 text-sm text-foreground`,children:[(0,R.jsx)(`option`,{value:``,children:o(`ticketPlaceholder`)}),n.candidate_tickets.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]})]})]})},W=({attempt:e,diagnostics:t,repair:n,selectedDiagnosticIds:r,selectedRawOutputAttemptRunIds:i,selectedAttemptRunIds:a,selectedTicketId:o,pending:s,activeRepair:c,onSelectedTicketChange:l,onToggleDiagnostic:u,onToggleRawOutput:d,onStartRepair:f,onStopRepair:p})=>{let{t:m}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),{t:h}=I(`common`,{keyPrefix:`checksDialog`});if(e.execution_status!==`failed`)return null;let g=t?.parser??null,_=t?.diagnostics??[],ee=V(_),y=c?.terminal_result===null,b=!!(n?.eligibility.eligible&&n.eligible_attempt_run_ids.includes(e.execution_run_id)&&g?.status===`complete`&&g.retention_state===`retained`),te=!!(n?.eligibility.eligible&&n.eligible_raw_output_attempt_run_ids.includes(e.execution_run_id)&&e.output_retention_state===`retained`&&e.retained_output),x=i.has(e.execution_run_id),S=r.size,C=S>=32,w=a.size>=8&&!a.has(e.execution_run_id),T=C?m(`diagnosticLimit`,{count:32}):w?m(`attemptLimit`,{count:8}):null,ne=!!(n?.accepts_ticket_id&&n.candidate_tickets.length>1),re=S+i.size,ie=re>0&&(!ne||o!==``),ae=n&&!n.eligibility.eligible?m(`disabled.${n.eligibility.reason}`):null,E=g&&t&&(g.status===`interrupted`||_.length===0&&[`unsupported`,`malformed`].includes(g.status))?g.status:null,oe=!!(g&&t&&_.length===0&&g.status===`complete`&&g.retention_state===`retained`&&g.diagnostic_count===0),D=!!(g&&t&&_.length===0&&g.status===`complete`&&g.retention_state===`retained`&&g.diagnostic_count>0),O=g?.diagnostic_count??_.length;return(0,R.jsxs)(`section`,{"aria-labelledby":`diagnostics-${e.execution_run_id}`,className:`mt-5 rounded-2xl border border-border/70 bg-background/25 p-4`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{id:`diagnostics-${e.execution_run_id}`,className:`text-sm font-semibold text-foreground`,children:m(`title`)}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:g&&g.status===`pending`?m(`loading`):g&&O>0?D||g.retention_state===`expired`?m(`totalAvailable`,{count:O}):m(`availableCount`,{count:O}):m(t?`noneAvailable`:`loading`)}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:m(`failureOutcome`,{outcome:e.outcome?h(`outcomeValue.${e.outcome}`):h(`status.${e.execution_status}`)})}),t&&_.length>0&&(0,R.jsx)(H,{counts:ee,totalCount:O})]})}),g?.retention_state===`expired`&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:m(`expired`)}),g?.truncated&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:m(`truncated`)}),E&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:m(`fallback.${E}`)}),oe&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:m(`noStructuredDiagnostics`)}),D&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:m(`structuredDetailsUnavailable`)}),te&&(0,R.jsxs)(`label`,{className:`mt-4 flex items-start gap-3 rounded-xl border border-amber-400/25 bg-amber-500/5 p-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,"aria-label":m(`rawOutputSelect`),checked:x,disabled:y||!x&&w,onChange:e=>d(e.target.checked)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:m(`rawOutputSelect`)}),(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:m(`rawOutputHint`)}),e.retained_start_offset>0&&(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-amber-200`,children:m(`rawOutputTruncated`)})]})]}),t&&_.length>0&&(0,R.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,R.jsx)(`legend`,{className:`text-xs font-medium text-muted-foreground`,children:m(`selectLegend`)}),(0,R.jsx)(`ul`,{className:`mt-2 space-y-2`,children:_.map(e=>{let t=z(e),n=r.has(e.id);return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:n,disabled:!b||y||!n&&T!==null,onChange:t=>u(e.id,t.target.checked)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`font-semibold uppercase text-foreground`,children:m(`severity.${e.severity}`)}),e.code&&(0,R.jsx)(`code`,{children:e.code})]}),(0,R.jsx)(`span`,{className:`mt-1 block break-words text-sm text-foreground`,children:e.message}),t&&(0,R.jsx)(`span`,{className:`mt-1 block break-all font-mono text-xs text-muted-foreground`,children:t})]})]})},e.id)})})]}),ae&&(0,R.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:ae}),T&&(0,R.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:T}),c&&(0,R.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,children:[(0,R.jsx)(`p`,{className:`font-medium text-sky-100`,children:m(c.terminal_result?`repairResult.${c.terminal_result}`:`repairRunning`)}),c.terminal_message&&(0,R.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:c.terminal_message})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m(`selectedEvidence`,{count:re})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(v,{type:`button`,size:`sm`,disabled:n?.eligibility.eligible!==!0||!ie||s||y,title:ae??void 0,onClick:f,children:s?m(`starting`):m(`repairSelectedEvidence`,{count:re})}),y&&(0,R.jsx)(v,{type:`button`,variant:`destructive`,size:`sm`,disabled:s,onClick:p,children:m(`stopRepair`)})]})]}),(0,R.jsx)(U,{attempt:e,parser:g,repair:n,ticketRequired:ne,selectedTicketId:o,onSelectedTicketChange:l})]})},G=({attempt:e})=>{let{t}=I(`common`,{keyPrefix:`checksDialog`}),n=e.retained_output?S(e.retained_output):``;return(0,R.jsxs)(Ce,{title:t(`rawOutput`),defaultOpen:!0,children:[e.output_retention_state===`expired`&&(0,R.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputExpired`)}),e.output_retention_state===`retained`&&!n&&(0,R.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputEmpty`)}),e.output_retention_state===`retained`&&n&&(0,R.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-xl border border-border bg-[#090b12] p-4 font-mono text-xs text-slate-200`,children:n}),e.retained_start_offset>0&&(0,R.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`outputTruncated`)})]})},K=({definition:e,policy:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog`});return(0,R.jsxs)(`article`,{"aria-labelledby":`configured-check-${e.id}`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{id:`configured-check-${e.id}`,className:`text-lg font-semibold text-foreground`,children:e.name}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n(`status.notRun`)})]})}),(0,R.jsx)(`p`,{className:`mt-4 rounded-xl border border-dashed border-border px-3 py-2 text-sm text-muted-foreground`,children:n(`notRunDescription`)}),(0,R.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`command`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`directory`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.cwd??n(`targetRoot`)})]}),t&&(0,R.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`policyLabel`)}),(0,R.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[n(t.required?`required`:`optional`),` · `,n(t.preReview?`preReview`:`finalOnly`)]})]})]})]})},we=({attempt:e,definition:t,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,onSelectedTicketChange:u,onToggleDiagnostic:d,onToggleRawOutput:f,onStartRepair:p,onStopRepair:m,policy:h})=>{let{t:g}=I(`common`,{keyPrefix:`checksDialog`}),{t:_}=I(`common`,{keyPrefix:`activityView`});return e?(0,R.jsxs)(`article`,{"aria-labelledby":`selected-check-${e.execution_run_id}`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{id:`selected-check-${e.execution_run_id}`,className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:g(`status.${e.execution_status}`)})]}),e.outcome&&(0,R.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:g(`outcomeValue.${e.outcome}`)})]}),(0,R.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:g(`command`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:g(`directory`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??g(`targetRoot`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:g(`outcome`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?g(`outcomeValue.${e.outcome}`):g(`status.${e.execution_status}`)})]}),e.currency&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:g(`currencyLabel`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:_(`currency.${e.currency}`)})]}),h&&(0,R.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:g(`policyLabel`)}),(0,R.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[g(h.required?`required`:`optional`),` · `,g(h.preReview?`preReview`:`finalOnly`)]})]})]}),e.execution_status===`failed`&&(0,R.jsx)(W,{attempt:e,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,onSelectedTicketChange:u,onToggleDiagnostic:d,onToggleRawOutput:f,onStartRepair:p,onStopRepair:m}),(0,R.jsx)(G,{attempt:e},e.execution_run_id)]}):t?(0,R.jsx)(K,{definition:t,policy:h}):(0,R.jsxs)(`section`,{"aria-labelledby":`selected-check-heading`,className:`rounded-2xl border border-dashed border-border p-6`,children:[(0,R.jsx)(`h2`,{id:`selected-check-heading`,className:`font-medium text-foreground`,children:g(`selectAttemptTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:g(`selectAttemptDescription`)})]})},q={current:`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`,stale:`border-amber-400/30 bg-amber-500/10 text-amber-200`,failed:`border-red-400/30 bg-red-500/10 text-red-200`,missing:`border-border bg-muted/40 text-muted-foreground`,interrupted:`border-orange-400/30 bg-orange-500/10 text-orange-200`,blocked:`border-amber-400/30 bg-amber-500/10 text-amber-200`},Te=(e,t)=>e.presentApplicability.appliesToCurrentState===!1?`stale`:t?t.execution_status===`interrupted`||t.execution_status===`cancelled`?`interrupted`:t.execution_status===`failed`?`failed`:t.currency===`stale`?`stale`:t.outcome&&t.outcome!==`passed`?`failed`:t.outcome===`passed`&&t.currency===`current`?`current`:e.decision===`blocked`?`blocked`:`current`:`missing`,Ee=e=>e===!0?`gateApplicability.overallCurrent`:e===!1?`gateApplicability.overallStale`:`gateApplicability.overallUnverifiable`,De=({evaluation:e})=>{let{t}=I(`common`,{keyPrefix:`checksDialog`}),n=e.presentApplicability.appliesToCurrentState===!1?`gateStale`:e.presentApplicability.appliesToCurrentState===null?`gateUnverifiable`:e.decision===`passed`?`gatePassed`:`gateBlocked`,r=e.reasonCodes[0],i=r?t(`gateReasonSummary`,{reason:t(`reason.${r}`)}):e.decision===`passed`?t(`gatePassedSummary`):t(`gateBlockedSummary`);return(0,R.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:t(`gateTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i})]}),(0,R.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2.5 py-1 text-xs font-medium`,e.decision===`passed`&&e.presentApplicability.appliesToCurrentState===!0?q.current:q.blocked),children:t(n)})]}),(0,R.jsx)(Ce,{title:t(`gateDetails`),children:(0,R.jsxs)(`div`,{className:`space-y-3 text-xs text-muted-foreground`,children:[(0,R.jsx)(`p`,{children:t(`gateScope`)}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,R.jsx)(`p`,{children:t(`gateBoundary.label`,{boundary:t(`gateBoundary.${e.boundaryKind}`)})}),(0,R.jsx)(`p`,{className:`break-all`,children:t(`gatePolicy`,{fingerprint:e.policy.fingerprint.slice(0,12)})}),(0,R.jsx)(`p`,{children:t(`gatePolicyStatus`,{status:t(e.policy.status===`valid`?`gatePolicyValid`:`gatePolicyInvalid`)})}),(0,R.jsx)(`p`,{className:`break-all`,children:e.sourceBatchRunId?t(`gateSourceBatch`,{batchId:e.sourceBatchRunId}):t(`gateNoBatch`)}),(0,R.jsx)(`p`,{className:`break-words`,children:t(`gateApplicability.label`,{workspace:t(`gateApplicability.${e.presentApplicability.workspace}`),policy:t(`gateApplicability.${e.presentApplicability.policy}`),overall:t(Ee(e.presentApplicability.appliesToCurrentState))})})]}),e.reasonCodes.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateReasonsTitle`)}),(0,R.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.reasonCodes.map(e=>(0,R.jsx)(`li`,{children:t(`reason.${e}`)},e))})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateEvidenceTitle`)}),(0,R.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.policy.definitions.map(n=>{let r=Te(e,e.evaluatedAttempts.find(e=>e.definition_id===n.id));return(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:n.name}),(0,R.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:n.command})]}),(0,R.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-1 text-xs`,q[r]),children:t(`evidence.${r}`)})]},n.id)})})]}),e.policy.status===`invalid`&&(0,R.jsx)(`p`,{className:`break-words text-amber-200`,children:e.policy.error})]})})]})},Oe=e=>e.execution_status===`completed`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.execution_status===`failed`||e.execution_status===`interrupted`?`border-red-400/30 bg-red-500/10 text-red-200`:e.execution_status===`running`||e.execution_status===`queued`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border bg-muted/40 text-muted-foreground`,ke=e=>e.execution_status===`completed`&&e.outcome&&e.outcome!==`passed`?`outcomeValue.${e.outcome}`:`status.${e.execution_status}`,Ae=(e,t,n,r)=>((t?.attempts.find(t=>t.attempt_run_id===e.execution_run_id))?.diagnostics.filter(e=>n.has(e.id)).length??0)+ +!!r.has(e.execution_run_id),je=({definitions:e,attempts:t,requiredDefinitionIds:n,preReviewDefinitionIds:r,selectedDefinitionIds:i,selectedCheckId:a,diagnostics:o,selectedDiagnosticIds:s,selectedRawOutputAttemptRunIds:c,onToggleDefinition:l,onSelectCheck:u})=>{let{t:d}=I(`common`,{keyPrefix:`checksDialog`}),f=new Set(n),p=new Set(r),m=new Set(e.map(e=>e.id)),h=[...e.map(e=>({definition:e,attempt:t.find(t=>t.definition_id===e.id),historical:!1})),...t.filter(e=>!m.has(e.definition_id)).map(e=>({definition:e.command_snapshot,attempt:e,historical:!0}))];return(0,R.jsxs)(`section`,{"aria-labelledby":`configured-checks-heading`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`header`,{className:`shrink-0 border-b border-border/60 px-4 py-4 sm:px-5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,R.jsx)(`h2`,{id:`configured-checks-heading`,className:`text-sm font-semibold text-foreground`,children:d(`configured`)}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`selectionHint`)})]}),(0,R.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,R.jsx)(`p`,{className:`font-medium text-foreground`,children:d(`policySummary.title`)}),(0,R.jsx)(`p`,{className:`mt-1`,children:d(`policySummary.counts`,{requiredCount:n.length,preReviewCount:r.length})})]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5 md:max-h-none md:py-5 max-md:max-h-[min(35vh,18rem)]`,children:(0,R.jsx)(`ul`,{"aria-label":d(`configured`),className:`space-y-2`,children:h.map(({definition:e,attempt:t,historical:n})=>{let r=a===e.id,m=t?Ae(t,o,s,c):0,h=f.has(e.id),g=p.has(e.id),_=`${d(`category.${e.category}`)} · ${d(h?`required`:`optional`)} · ${d(g?`preReview`:`finalOnly`)}`;return(0,R.jsx)(`li`,{className:`rounded-xl border border-border/60 bg-background/30 p-2.5`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[!n&&(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 shrink-0 accent-primary`,checked:i.has(e.id),"aria-label":d(`selectForRun`,{name:e.name}),onChange:t=>l(e.id,t.target.checked)}),t?(0,R.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(ke(t))}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name}),(0,R.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,Oe(t)),children:d(ke(t))})]}),(0,R.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_}),m>0&&(0,R.jsx)(`span`,{"data-evidence-selected":`true`,className:`mt-1.5 inline-flex rounded-full border border-amber-400/30 bg-amber-500/10 px-2 py-0.5 text-[11px] text-amber-200`,children:d(`evidenceSelected`,{count:m})})]}):(0,R.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(`status.notRun`)}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,R.jsx)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name})}),(0,R.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_})]})]})},t?.execution_run_id??e.id)})})})]})},Me=(e,t)=>{let n=new Set(t?.attempts.filter(e=>e.parser.status===`complete`&&e.parser.retention_state===`retained`&&e.diagnostics.length>0).map(e=>e.attempt_run_id)??[]);return e.find(e=>e.execution_status===`failed`&&n.has(e.execution_run_id))??e.find(e=>e.execution_status===`failed`)??e.find(e=>e.execution_status===`running`)??e[0]??null},Ne=new Set([`queued`,`running`,`waiting`]),Pe=75,Fe=32,Ie=64,Le=3,Re=32,ze=8,J=(e,t)=>e instanceof A?e.message:t,Be=e=>{let t=new Set(e.repair.eligibility.eligible?e.repair.eligible_attempt_run_ids:[]);return new Set(e.attempts.filter(e=>t.has(e.attempt_run_id)).flatMap(e=>e.diagnostics.map(e=>e.id)))},Ve=e=>new Set(e.repair.eligibility.eligible?e.repair.eligible_raw_output_attempt_run_ids:[]),He=({projectId:e,targetKind:n,targetBundleId:r,definitions:i,requiredDefinitionIds:a=[],preReviewDefinitionIds:o=[],gateEvaluationId:s=null,directBatchRunId:c=null,directAttemptRunId:l=null,onSelectionChange:u,onUnavailable:d,onStatusChange:f})=>{let{t:p}=I(`common`,{keyPrefix:`checksDialog`}),m=le(),[h,g]=(0,L.useState)(()=>new Set(i.map(e=>e.id))),[_,ee]=(0,L.useState)(null),[y,b]=(0,L.useState)(null),[te,x]=(0,L.useState)(null),[S,w]=(0,L.useState)(null),[T,ae]=(0,L.useState)(!0),[E,D]=(0,L.useState)(null),[O,se]=(0,L.useState)(null),[ce,ue]=(0,L.useState)(new Set),[de,j]=(0,L.useState)(new Set),[he,ge]=(0,L.useState)(``),[M,N]=(0,L.useState)(null),[xe,P]=(0,L.useState)(!1),[F,Se]=(0,L.useState)(0),[Ce,z]=(0,L.useState)(null),B=(0,L.useRef)(_),V=(0,L.useRef)(null),H=(0,L.useRef)(new Set),U=(0,L.useRef)(new Map),W=(0,L.useRef)(0),G=(0,L.useRef)(0),K=(0,L.useRef)(null),q=(0,L.useRef)(!1),Te=(0,L.useRef)(!0),Ee=(0,L.useRef)(null),Oe=(0,L.useRef)(`automatic`),ke=(0,L.useRef)(null),Ae=(0,L.useRef)(async()=>void 0),He=(0,L.useRef)(async()=>void 0),Ue=(0,L.useRef)(()=>void 0),We=(0,L.useRef)(0),Ge=(0,L.useRef)(O);B.current=_,Ge.current=O,Te.current=T||E!==null;let Y=(0,L.useCallback)((e,t)=>{Ee.current=e,Oe.current=t,x(e)},[]),Ke=(0,L.useCallback)(e=>{se(e),N(e.latest_repair?.source_batch_run_id===e.batch_run_id?e.latest_repair:null),ue(t=>{let n=Be(e);return new Set([...t].filter(e=>n.has(e)))}),j(t=>{let n=Ve(e);return new Set([...t].filter(e=>n.has(e)))}),ge(t=>e.repair.candidate_tickets.some(e=>e.id===t)?t:e.repair.candidate_tickets.length===1&&e.repair.accepts_ticket_id?e.repair.candidate_tickets[0].id:``);let t=B.current;Oe.current===`automatic`&&t?.batch.execution_run_id===e.batch_run_id&&Y(Me(t.attempts,e)?.execution_run_id??null,`automatic`)},[Y]),qe=(0,L.useCallback)(e=>{let t=U.current;if(!t.has(e.attempt_run_id)&&t.size>=Fe){let e=t.keys().next().value;e&&(t.delete(e),H.current.delete(e))}let n=t.get(e.attempt_run_id)??[];t.set(e.attempt_run_id,[...n.slice(-(Ie-1)),e])},[]),Je=(0,L.useCallback)((e,t,n=`route`)=>{let r=B.current?.batch.execution_run_id===e.batch.execution_run_id?B.current:null,i=!1,a=new Set(e.attempts.map(e=>e.execution_run_id));for(let e of U.current.keys())a.has(e)||(U.current.delete(e),H.current.delete(e));let o=e.attempts.map(e=>{let t=!1,n=r?.attempts.find(t=>t.execution_run_id===e.execution_run_id),a=n&&n.output_revision>e.output_revision?n:e,o=U.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let n=ve(pe(a),e);if(n.status===`refetch`){t=!0,i=!0;continue}n.status===`applied`&&(a={...a,output_revision:n.snapshot.revision,retained_start_offset:n.snapshot.retainedStartOffset,retained_end_offset:n.snapshot.totalByteCount,total_persisted_bytes:n.snapshot.totalByteCount,retained_output:n.snapshot.retainedText})}return t?H.current.add(e.execution_run_id):(H.current.delete(e.execution_run_id),U.current.delete(e.execution_run_id)),a}),s={...e,attempts:o};K.current=e.batch.execution_run_id,B.current=s,ee(s);let c=t?s.attempts.find(e=>e.execution_run_id===t):null,l=Ee.current,f=Oe.current,m=!!(l&&s.attempts.some(e=>e.execution_run_id===l)),h=Me(s.attempts,Ge.current?.batch_run_id===s.batch.execution_run_id?Ge.current:null),g=ke.current,_=!!(g&&g.batchRunId===s.batch.execution_run_id&&g.attemptRunId===t),v=!!(g&&g.previousBatchRunId===s.batch.execution_run_id&&g.previousAttemptRunId===t);if(n===`reset`)Y(h?.execution_run_id??null,`automatic`);else if(t)if(c)if(_)Y(c.execution_run_id,`manual`);else if(v&&f===`manual`)Y(m?l:h?.execution_run_id??null,m?`manual`:`automatic`);else{let e=f!==`external`||l!==c.execution_run_id;Y(c.execution_run_id,`external`),e&&u?.(s.batch.execution_run_id,c.execution_run_id)}else _||v?f===`manual`&&m?Y(l,`manual`):Y(h?.execution_run_id??null,`automatic`):(Y(t,`external`),d?.());else n===`preserve`?f===`external`&&l?m?Y(l,`external`):(Y(l,`external`),d?.()):f===`manual`&&m?Y(l,`manual`):Y(f===`automatic`&&m?l:h?.execution_run_id??null,`automatic`):f===`manual`&&m?Y(l,`manual`):Y(h?.execution_run_id??null,`automatic`);i?Ue.current(e.batch.execution_run_id):We.current=0,q.current&&!V.current&&(q.current=!1,V.current=setTimeout(()=>{V.current=null,He.current().catch(e=>z(J(e,p(`errors.load`))))},Pe))},[u,d,p,Y]),X=(0,L.useCallback)(async(n,r)=>{let i=++W.current,a=await t(e,n,r);if(i!==W.current||a.batch.execution_run_id!==n||K.current!==null&&K.current!==n){a.batch.execution_run_id!==n&&d?.();return}Je(a,n===c?l:null)},[l,c,Je,d,e]);Ae.current=X,Ue.current=(0,L.useCallback)(e=>{if(V.current)return;if(We.current>=Le){We.current=0,H.current.clear(),U.current.clear();return}let t=Pe*2**We.current;V.current=setTimeout(()=>{V.current=null,We.current+=1,Ae.current(e).catch(t=>{z(J(t,p(`errors.load`))),H.current.size>0&&Ue.current(e)})},t)},[p]);let Z=(0,L.useCallback)(async t=>{let i=++W.current,a=null;do{let o=await _e(e,{limit:50,cursor:a,signal:t});if(i!==W.current)return;let s=o.items.find(e=>e.check_batch?.details?.target_kind===n&&e.check_batch.details.target_bundle_id===(n===`bundle`?r:null));if(s){K.current=s.run.id,await X(s.run.id,t);return}a=o.next_cursor}while(a);!t?.aborted&&i===W.current&&(K.current=null,B.current=null,ee(null),Y(null,`automatic`))},[X,e,r,n,Y]),Ye=(0,L.useCallback)(async()=>{if(s||c){let e=K.current;e&&await X(e);return}await Z()},[c,s,X,Z]);He.current=Ye;let Xe=(0,L.useCallback)(e=>{V.current||=setTimeout(()=>{V.current=null,X(e).catch(e=>z(J(e,p(`errors.load`))))},Pe)},[X,p]);(0,L.useEffect)(()=>{let t=new AbortController;return ae(!0),z(null),(async()=>{if(c){if(b(null),l){let n=await ne(e,l,t.signal);if(n.run.kind!==`check_attempt`||n.details.kind!==`check_attempt`||!n.details.available||!n.details.attempt||n.details.attempt.batch_run_id!==c){d?.();return}}K.current=c,await X(c,t.signal);return}if(!s){b(null),await Z(t.signal);return}let n=await be(e,s,t.signal);if(b(n),n.sourceBatchRunId){K.current=n.sourceBatchRunId,await X(n.sourceBatchRunId,t.signal);return}K.current=null,B.current=null,ee(null),Y(null,`automatic`)})().catch(e=>{oe(e)||(e instanceof A&&e.status===404&&d?.(),z(J(e,p(`errors.load`))))}).finally(()=>{t.signal.aborted||(ae(!1),Te.current=!1,q.current&&!V.current&&(q.current=!1,V.current=setTimeout(()=>{V.current=null,He.current().catch(e=>z(J(e,p(`errors.load`))))},Pe)))}),()=>t.abort()},[l,c,s,X,Z,d,e,p,Y]),(0,L.useEffect)(()=>{let t=_?.batch.execution_run_id;if(!t){G.current+=1,se(null),ue(new Set),j(new Set),ge(``),N(null);return}Ge.current?.batch_run_id!==t&&(se(null),ue(new Set),j(new Set),ge(``),N(null));let n=++G.current,r=new AbortController;return ie(e,t,r.signal).then(e=>{n===G.current&&e.batch_run_id===t&&K.current===t&&Ke(e)}).catch(e=>{oe(e)||z(J(e,p(`errors.diagnostics`)))}),()=>r.abort()},[_?.batch.execution_run_id,F,Ke,e,p]),(0,L.useEffect)(()=>{let t=t=>{if(t.project_id!==e)return;let n=K.current;if(n!==null&&t.batch_run_id!==n)return;let r=B.current;if(!r||H.current.has(t.attempt_run_id)){qe(t),r&&H.current.has(t.attempt_run_id)&&Ue.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){qe(t),Xe(r.batch.execution_run_id);return}let a=r.attempts[i],o=ve(pe(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){H.current.add(t.attempt_run_id),qe(t),Ue.current(r.batch.execution_run_id);return}let s=[...r.attempts];s[i]={...a,output_revision:o.snapshot.revision,retained_start_offset:o.snapshot.retainedStartOffset,retained_end_offset:o.snapshot.totalByteCount,total_persisted_bytes:o.snapshot.totalByteCount,retained_output:o.snapshot.retainedText};let c={...r,attempts:s};B.current=c,ee(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(Te.current){q.current=!0;return}let n=B.current,r=t.execution_run_id??t.id;if(Se(e=>e+1),M&&r===M.execution_run_id&&M.source_batch_run_id===K.current&&fe(e,M.execution_run_id).then(N).catch(()=>void 0),n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){W.current+=1,Xe(n.batch.execution_run_id);return}q.current=!0,!Te.current&&!V.current&&(q.current=!1,V.current=setTimeout(()=>{V.current=null,He.current().catch(e=>z(J(e,p(`errors.load`))))},Pe))},r=()=>{Se(e=>e+1),Ye().catch(e=>z(J(e,p(`errors.load`))))};return m.on(`check-attempt:output`,t),m.on(`execution-run:updated`,n),m.on(`lifecycle-event:created`,n),m.on(`connect`,r),()=>{m.off(`check-attempt:output`,t),m.off(`execution-run:updated`,n),m.off(`lifecycle-event:created`,n),m.off(`connect`,r)}},[M,qe,e,Ye,Xe,m,p]),(0,L.useEffect)(()=>()=>{V.current&&clearTimeout(V.current),H.current.clear(),U.current.clear()},[]);let Ze=(e,t)=>{W.current+=1,K.current=e.batch.execution_run_id,Je(e,null,t)},Qe=async(e,t)=>{W.current+=1,Te.current=!0,D(e),z(null);try{let n=await t();e!==`stop`&&(ke.current=null),Ze(n,e===`stop`?`preserve`:`reset`),e!==`stop`&&u?.(n.batch.execution_run_id,void 0)}catch(t){z(J(t,p(`errors.${e}`))),t instanceof A&&t.status===409&&await Ye().catch(()=>void 0)}finally{D(null),Te.current=T,q.current&&!V.current&&(q.current=!1,V.current=setTimeout(()=>{V.current=null,He.current().catch(e=>z(J(e,p(`errors.load`))))},Pe))}},$e=_?Ne.has(_.batch.execution_status):!1,et=_?$e?`running`:_.batch.execution_status===`completed`?`finished`:_.batch.execution_status===`cancelled`||_.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,tt=_?.batch.execution_run_id??null,Q=O?.batch_run_id===tt?O:null,nt=M?.source_batch_run_id===tt?M:null,rt=Q?Be(Q):new Set,it=Q?Ve(Q):new Set,at=new Set([...ce].filter(e=>rt.has(e))),ot=new Set([...de].filter(e=>it.has(e))),st=[...h],ct=_?.attempts.filter(e=>e.execution_status!==`completed`).length??0,lt=async()=>{let t=[...at],n=[...ot];if(!(!Q||!tt||K.current!==tt||Q.repair.eligibility.eligible!==!0||nt?.terminal_result===null||t.length===0&&n.length===0)){P(!0),z(null);try{let r=await me(e,t,n,Q.repair.accepts_ticket_id?Q.repair.candidate_tickets.some(e=>e.id===he)?he:Q.repair.candidate_tickets[0]?.id||null:null);N(r.source_batch_run_id===tt?r:null)}catch(t){if(z(J(t,p(`errors.repair`))),t instanceof A&&t.status===409&&_){let t=_.batch.execution_run_id,n=++G.current;ie(e,t).then(e=>{n===G.current&&e.batch_run_id===t&&K.current===t&&Ke(e)}).catch(()=>void 0)}}finally{P(!1)}}},ut=async()=>{if(nt){P(!0),z(null);try{N(await re(e,nt.execution_run_id))}catch(e){z(J(e,p(`errors.repairStop`)))}finally{P(!1)}}},dt=new Set([...Q?.attempts.filter(e=>e.diagnostics.some(e=>at.has(e.id))).map(e=>e.attempt_run_id)??[],...ot]),ft=(e,t,n)=>{ue(r=>{let i=new Set(r);if(!n)return i.delete(t),i;if(i.size>=Re||!Q||!rt.has(t))return r;let a=new Set(Q.attempts.filter(e=>e.diagnostics.some(e=>i.has(e.id))).map(e=>e.attempt_run_id)??[]);return!a.has(e)&&a.size>=ze?r:(i.add(t),i)})},pt=(e,t)=>{j(n=>{let r=new Set(n);return t?!dt.has(e)&&dt.size>=ze||!it.has(e)?n:(r.add(e),r):(r.delete(e),r)})},mt=(e,t)=>{g(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},ht=e=>{_&&(w(null),ke.current={batchRunId:_.batch.execution_run_id,attemptRunId:e,previousBatchRunId:c===_.batch.execution_run_id?c:null,previousAttemptRunId:c===_.batch.execution_run_id?l:null},Y(e,`manual`),u?.(_.batch.execution_run_id,e))},gt=e=>{let t=_?.attempts.find(t=>t.definition_id===e);if(t){ht(t.execution_run_id);return}w(e)},$=S?_?.attempts.find(e=>e.definition_id===S)??null:_?.attempts.find(e=>e.execution_run_id===te)??null,_t=$?.command_snapshot??i.find(e=>e.id===S)??null,vt=S??$?.definition_id??null,yt=_t?{required:a.includes(_t.id),preReview:o.includes(_t.id)}:null;return(0,L.useEffect)(()=>{f?.(et)},[et,f]),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Ce&&(0,R.jsx)(`p`,{role:`alert`,className:`mx-4 mt-3 rounded-xl border border-red-400/25 bg-red-500/10 px-3 py-2 text-sm text-red-200 sm:mx-6`,children:Ce}),(0,R.jsxs)(`div`,{role:`toolbar`,"aria-label":p(`runActions`),className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-y border-border/70 bg-background/30 px-4 py-3 sm:px-6`,children:[(0,R.jsx)(`div`,{className:`min-w-0`,children:(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:p(`runActions`)})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(v,{type:`button`,size:`sm`,disabled:st.length===0||$e||E!==null,onClick:()=>void Qe(`run`,()=>C(e,{targetKind:n,targetBundleId:r,definitionIds:st})),children:p(E===`run`?`starting`:`runSelected`)}),_&&$e&&(0,R.jsx)(v,{type:`button`,variant:`destructive`,size:`sm`,disabled:E!==null,onClick:()=>void Qe(`stop`,()=>ye(e,_.batch.execution_run_id)),children:p(E===`stop`?`stopping`:`stop`)}),_&&!$e&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(v,{type:`button`,variant:`outline`,size:`xs`,disabled:E!==null,onClick:()=>void Qe(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`all`})),children:p(`rerunAll`)}),(0,R.jsx)(v,{type:`button`,variant:`outline`,size:`xs`,disabled:E!==null||ct===0,onClick:()=>void Qe(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`failed_only`})),children:p(`rerunFailed`)})]})]})]}),(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(0,auto)_minmax(0,1fr)] overflow-hidden md:grid-cols-[19rem_minmax(0,1fr)] md:grid-rows-1`,children:[(0,R.jsx)(`aside`,{className:`flex min-h-0 flex-col border-b border-border/70 md:border-r md:border-b-0`,children:(0,R.jsx)(je,{definitions:i,attempts:_?.attempts??[],requiredDefinitionIds:a,preReviewDefinitionIds:o,selectedDefinitionIds:h,selectedCheckId:vt,diagnostics:Q,selectedDiagnosticIds:at,selectedRawOutputAttemptRunIds:ot,onToggleDefinition:mt,onSelectCheck:gt})}),(0,R.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[s&&!y&&T&&(0,R.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:p(`gateLoading`)}),y&&(0,R.jsx)(De,{evaluation:y}),T&&(0,R.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:p(`loading`)}),!T&&!_&&!_t&&(0,R.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,R.jsx)(`h2`,{className:`font-medium text-foreground`,children:p(`emptyTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:p(`emptyDescription`)})]}),_&&(0,R.jsx)(R.Fragment,{children:(0,R.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:p(`status.${_.batch.execution_status}`)}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:p(`summary`,{passed:_.batch.passed_count,failed:_.batch.failed_count,running:_.batch.running_count,queued:_.batch.queued_count})}),_.batch.stop_requested&&(0,R.jsx)(`span`,{className:`text-xs text-amber-200`,children:p(`stopRequested`)})]})}),(_||_t)&&(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(we,{attempt:$,definition:_t,diagnostics:Q?.attempts.find(e=>e.attempt_run_id===$?.execution_run_id)??null,repair:Q?.repair??null,selectedDiagnosticIds:at,selectedRawOutputAttemptRunIds:ot,selectedAttemptRunIds:dt,selectedTicketId:he,pending:xe,activeRepair:nt,policy:yt,onSelectedTicketChange:ge,onToggleDiagnostic:(e,t)=>$&&ft($.execution_run_id,e,t),onToggleRawOutput:e=>$&&pt($.execution_run_id,e),onStartRepair:()=>void lt(),onStopRepair:()=>void ut()})})]})]})]})},Ue=(e,t)=>xe(O(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),We=(e,t)=>xe(O(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),Ge=(e,t={})=>xe(O(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),Y=(e,t)=>xe(O(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),Ke=e=>xe(O(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),qe=e=>x(O(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),Je=256*1024,X=24,Z=(e,t)=>g.t(`common:testsDialog.${e}`,t),Ye=(e,t)=>{let n=`${e}${t}`;return n.length<=Je?n:n.slice(-Je)},Xe=(e,t)=>e?e.run_id&&t.run_id&&e.run_id!==t.run_id?e.status===`running`||t.status!==`running`?e:t:e.status!==`idle`&&e.status!==`running`&&t.status===`running`?e:e.run_id===t.run_id&&e.output.length>t.output.length?{...t,output:e.output,output_truncated:e.output_truncated||t.output_truncated}:t:t,Ze=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=X,Qe=e=>{e.scrollTop=e.scrollHeight},$e=(e,t=!1)=>{Qe(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{Qe(e),t&&(r=window.requestAnimationFrame(()=>{Qe(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},et=e=>e===`running`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e===`passed`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e===`failed`||e===`error`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e===`stopped`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`,tt=e=>{if(e==null)return null;if(e<1e3)return`${e} ms`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${(e/1e3).toFixed(e>=1e4?0:1)} s`},Q=e=>{let t=e.split(`/`);return t[t.length-1]||e},nt=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),rt=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),it=(e,t)=>{let n=nt(t);return n.length===0?e:e.flatMap(e=>{let t=Q(e.path);if(rt(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>rt(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},at=e=>Z(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ot=e=>e?.selection?e.selection.kind===`all`?Z(`selection.allTests`):e.selection.kind===`case`?e.selection.name:Q(e.selection.path):Z(`selection.noRunYet`),st=e=>/(^|\s)(?:FAIL|✗)(\s|$)|\b(?:failed|error|stderr|Expected:|Received:)\b/i.test(e)?`failure`:/(^|\s)(?:PASS|✓)(\s|$)|\bpassed\b/i.test(e)?`success`:/\b(?:WARN|warning|skipped|todo|pending)\b/i.test(e)?`warning`:`default`,ct=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,lt=(e,t)=>e===t?!0:e.length===t.length?e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.name===r.name&&e.command===r.command&&e.cwd===r.cwd&&e.runner===r.runner}):!1,ut=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,dt=({line:e,tone:t})=>(0,R.jsx)(`div`,{"data-tone":t,className:b(`whitespace-pre-wrap break-words`,ct(t)),children:e===``?` `:e}),ft=(0,L.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,R.jsxs)(`button`,{type:`button`,"aria-label":Z(`caseRow.runAriaLabel`,{name:r}),title:r,className:b(`flex w-full min-w-0 items-center gap-2.5 rounded-xl px-2.5 py-1.5 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,e?`cursor-pointer hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,n&&`bg-sky-500/10`),disabled:!e,onClick:()=>{i(t,r)},children:[(0,R.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,R.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));ft.displayName=`TestCaseRow`;var pt=(0,L.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:o,onRunFile:s,onToggleFile:c})=>{let l=e===`file`&&n===i.path,d=e===`case`&&n===i.path;return(0,R.jsx)(N,{open:a,onOpenChange:e=>{c(i.path,e)},children:(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(w,{asChild:!0,children:(0,R.jsx)(v,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":Z(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(Se,{className:b(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,R.jsx)(`button`,{type:`button`,"aria-label":Z(`fileRow.runAriaLabel`,{path:i.path}),className:b(`min-w-0 flex-1 rounded-xl border border-border/60 bg-background/20 px-2.5 py-2 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,r?`cursor-pointer hover:border-sky-400/35 hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,(l||d)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{s(i.path)},children:(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,R.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-sky-200`,children:(0,R.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:Q(i.path)}),(0,R.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:Z(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,R.jsx)(F,{children:(0,R.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,R.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:Z(`fileRow.noNamedTests`)}):(0,R.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let s=e===`case`&&n===i.path&&t===a.name;return(0,R.jsx)(ft,{canRunGranular:r,filePath:i.path,isActive:s,name:a.name,onRunCase:o},a.id)})})})})]})})});pt.displayName=`DiscoveryFileRow`;var mt=(0,L.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,availableCommands:a,canRunGranular:c,discovery:l,expandedFiles:u,fullSuiteOnlyNotice:f,isLoading:p,selectedCommandId:m,selectedCommandName:h,sessionError:g,sessionStatus:_,shouldShowCommandSelector:ee,onRunCase:y,onRunFile:te,onSelectCommand:x,onToggleFile:S})=>{let[C,w]=(0,L.useState)(``),T=(0,L.useMemo)(()=>it(l,C),[l,C]),ne=(0,L.useMemo)(()=>T.reduce((e,t)=>e+t.cases.length,0),[T]),re=nt(C).length>0;return(0,R.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[ee&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:Z(`scope.label`)}),(0,R.jsxs)(ce,{children:[(0,R.jsx)(d,{asChild:!0,children:(0,R.jsxs)(v,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":Z(`scope.selectedCommandAriaLabel`),disabled:a.length===0||_===`running`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:h??Z(`scope.selectTestScope`)}),(0,R.jsx)(Se,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,R.jsx)(n,{align:`start`,className:`w-72`,children:a.map(e=>(0,R.jsx)(se,{className:b(m===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{x(e.id)},children:(0,R.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),f&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:f}),(l.length>0||C.length>0)&&(0,R.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,R.jsx)(o,{type:`search`,value:C,onChange:e=>{w(e.target.value)},placeholder:Z(`filter.placeholder`),"aria-label":Z(`filter.ariaLabel`),className:`pr-10`}),C.length>0&&(0,R.jsx)(v,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Z(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{w(``)},children:(0,R.jsx)(r,{className:`size-4`})})]}),!a.length&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:Z(`discovery.noCommands`)}),g&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:g}),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`min-w-0`,children:(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[Z(`discovery.fileCount`,{count:T.length}),`, `,Z(`discovery.caseCount`,{count:ne})]})}),p&&(0,R.jsx)(s,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:l.length===0&&!p?(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilesDetected`)}):T.length===0?(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilterMatches`)}):T.map(n=>(0,R.jsx)(pt,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,canRunGranular:c,file:n,isExpanded:re||(u[n.path]??!1),onRunCase:y,onRunFile:te,onToggleFile:S},n.path))})]})]})})});mt.displayName=`DiscoveryPane`;var ht=(0,L.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,L.useMemo)(()=>t?S(t).replace(/\r\n/g,`
2
+ `).replace(/\r/g,`
3
+ `).split(`
4
+ `).map(e=>({line:e,tone:st(e)})):[],[t]);return(0,R.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,R.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,R.jsx)(P,{variant:`outline`,className:b(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,et(i)),children:at(i)}),a&&(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,R.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,R.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:tt(e)}),n&&(0,R.jsx)(P,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:Z(`output.trimmed`)})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,R.jsx)(`div`,{ref:o,"aria-label":Z(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:s,children:(0,R.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:c.length>0?c.map((e,t)=>(0,R.jsx)(dt,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,R.jsx)(`div`,{className:`text-slate-200`,children:Z(`output.empty`)})})})})]})})});ht.displayName=`OutputPane`;var gt=(0,L.forwardRef)(({testCommands:e,onStatusChange:t,onTargetLabelChange:n,onClose:r,...o},s)=>{let u=o.scope,d=o.projectId,f=o.scope===`ticket`?o.ticketId:null,h=o.scope===`project`?o.targetKind:null,g=o.scope===`project`?o.targetBundleId:null,[b,te]=(0,L.useState)(e),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)([]),[T,ne]=(0,L.useState)(``),[re,ie]=(0,L.useState)({}),[E,oe]=(0,L.useState)(!0),[D,O]=(0,L.useState)(!1),[k,se]=(0,L.useState)(!1),[ce,le]=(0,L.useState)(null),[ue,fe]=(0,L.useState)(!1),[pe,me]=(0,L.useState)(!1),j=(0,L.useRef)(null),he=(0,L.useRef)(!1),_e=(0,L.useRef)(null),ve=(0,L.useRef)(!0),ye=(0,L.useRef)(null),M=(0,L.useRef)(null),be=x?.selection?.kind??null,N=x?.selection?.kind===`all`?null:x?.selection?.path??null,xe=x?.selection?.kind===`case`?x.selection.name:null,P=x?.id??null,F=x?.status??null,I=(0,L.useMemo)(()=>b.find(e=>e.id===T)??null,[b,T]),Se=(0,L.useMemo)(()=>{if(x?.summary?.failed_count==null&&x?.summary?.passed_count==null&&x?.summary?.failed_file_count==null&&x?.summary?.passed_file_count==null)return null;let e=x?.summary?.failed_count==null&&x?.summary?.passed_count==null;return{failed:F===`failed`&&x?.summary?.failed_count==null&&x?.summary?.failed_file_count!=null||e?{count:x?.summary?.failed_file_count??0,label:Z(`summaryCounts.filesFailed`)}:{count:x?.summary?.failed_count??0,label:Z(`summaryCounts.failed`)},passed:e?{count:x?.summary?.passed_file_count??0,label:Z(`summaryCounts.filesPassed`)}:{count:x?.summary?.passed_count??x?.summary?.passed_file_count??0,label:Z(`summaryCounts.passed`)}}},[x?.summary?.failed_count,x?.summary?.passed_count,x?.summary?.failed_file_count,x?.summary?.passed_file_count,F]),Ce=I?.runner===`unknown`?Z(`scope.fullSuiteOnlyNotice`):null,z=!!(I&&x?.status!==`running`&&!D&&!k),B=z,V=z&&pe,H=b.length>1,{runs:U}=de(d),W=x?.run_id?U.find(e=>e.id===x.run_id)??null:null;(0,L.useEffect)(()=>{T||b.length===0||ne(b[0]?.id??``)},[b,T]),(0,L.useEffect)(()=>{e.length>0&&te(t=>lt(t,e)?t:e)},[e]),(0,L.useEffect)(()=>{if(b.length>0||!d)return;let e=new AbortController;return m(e.signal).then(e=>{let t=e.find(e=>e.id===d);t&&te(e=>{let n=ae(t);return lt(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[b.length,d]),(0,L.useEffect)(()=>{let e=e=>{!e||e.id!==j.current||S(t=>Xe(t,e))},t=e=>{!e||e.session_id!==j.current||S(t=>!t||t.id!==e.session_id||e.run_id&&t.run_id&&e.run_id!==t.run_id?t:{...t,output:Ye(t.output,e.chunk),output_truncated:e.output_truncated})};return _.on(`test-session:updated`,e),_.on(`test-session:output`,t),()=>{_.off(`test-session:updated`,e),_.off(`test-session:output`,t)}},[]),(0,L.useEffect)(()=>{let e=_e.current;if(!e){ye.current=x?.output??null,M.current=x?.status??null;return}let t=ye.current!==(x?.output??null),n=M.current!==`running`&&x?.status===`running`,r=M.current===`running`&&x?.status!==`running`;if(n&&(ve.current=!0),n||t&&x?.status===`running`&&ve.current||r&&ve.current){let t=$e(e,r);return ye.current=x?.output??null,M.current=x?.status??null,t}ye.current=x?.output??null,M.current=x?.status??null},[x?.output,x?.status]),(0,L.useEffect)(()=>{let e=!1;return(async()=>{try{let t;if(u===`project`){if(!d)return;t=await Ue(d,{target_kind:h??`repo_root`,target_bundle_id:g??null})}else t=await We(f??``,d);if(e){qe(t.id).catch(()=>{});return}j.current=t.id,S(t)}catch(t){e||le(t instanceof A?t.message:Z(`messages.loadRunnerError`))}finally{!e&&j.current==null&&oe(!1)}})(),()=>{e=!0}},[d,u,g,h,f]),(0,L.useEffect)(()=>{W&&S(e=>{if(!e||e.run_id!==W.id)return e;let t=W.status===`completed`?`passed`:W.status===`failed`?`failed`:W.status===`cancelled`||W.status===`interrupted`?`stopped`:`running`;return e.status===t&&e.error===(W.failure?.message??e.error)?e:{...e,status:t,error:W.failure?.message??e.error,started_at:W.started_at??e.started_at,completed_at:W.completed_at??e.completed_at}})},[W]),(0,L.useEffect)(()=>{if(!x?.id){me(!1);return}if(b.length>0&&!T){me(!1);return}let e=new AbortController,t=!1;return oe(!0),me(!1),Ge(x.id,{commandId:T||null,signal:e.signal}).then(e=>{t||(w(e.files),me(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||le(n instanceof A?n.message:Z(`messages.discoverError`))}).finally(()=>{t||oe(!1)}),()=>{t=!0,e.abort()}},[b.length,T,x?.id]),(0,L.useEffect)(()=>()=>{let e=j.current;!e||he.current||(he.current=!0,qe(e).catch(()=>{}))},[]);let G=(0,L.useCallback)(async e=>{if(!(!P||F===`running`||!I||D||k)){le(null),O(!0);try{let t=await Y(P,{command_id:I.id,selection:e});S(e=>Xe(e,t))}catch(e){le(e instanceof A?e.message:Z(`messages.startError`))}finally{O(!1)}}},[D,k,I,P,F]),K=(0,L.useCallback)(async()=>{if(!(!P||F!==`running`||k)){le(null),se(!0);try{let e=await Ke(P);S(t=>Xe(t,e))}catch(e){le(e instanceof A?e.message:Z(`messages.stopError`))}finally{se(!1)}}},[k,P,F]),we=(0,L.useCallback)(()=>{let e=j.current;if(!e||he.current){r();return}he.current=!0,r(),qe(e).catch(()=>{})},[r]),q=(0,L.useCallback)(()=>{if(F===`running`){fe(!0);return}we()},[we,F]);(0,L.useImperativeHandle)(s,()=>({requestClose:q}),[q]),(0,L.useEffect)(()=>{t?.(F===`running`?`running`:F===`passed`?`finished`:F===`failed`||F===`error`?`error`:F===`stopped`?`interrupted`:`inactive`)},[t,F]),(0,L.useEffect)(()=>{x?.target_label&&n?.(x.target_label)},[n,x?.target_label]);let Te=(0,L.useCallback)(()=>{let e=_e.current;e&&(ve.current=Ze(e))},[]),Ee=(0,L.useCallback)(e=>{ne(e)},[]),De=(0,L.useCallback)((e,t)=>{ie(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Oe=(0,L.useCallback)(e=>{G({kind:`file`,path:e})},[G]),ke=(0,L.useCallback)((e,t)=>{G({kind:`case`,path:e,name:t})},[G]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,"data-testid":`tests-panel-layout`,children:[(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-0 lg:grid-cols-[22rem_minmax(0,1fr)] lg:grid-rows-1`,children:[(0,R.jsx)(mt,{activeSelectionKind:be,activeSelectionName:xe,activeSelectionPath:N,availableCommands:b,canRunGranular:V,discovery:C,expandedFiles:re,fullSuiteOnlyNotice:Ce,isLoading:E,selectedCommandId:T,selectedCommandName:I?.name??null,sessionError:ce,sessionStatus:F,shouldShowCommandSelector:H,onRunCase:ke,onRunFile:Oe,onSelectCommand:Ee,onToggleFile:De}),(0,R.jsx)(ht,{durationMs:x?.duration_ms??null,output:x?.output??``,outputTruncated:x?.output_truncated??!1,selectionLabel:ot(x),status:F,summaryCounts:Se,viewportRef:_e,onScroll:Te})]}),(0,R.jsx)(ge,{className:`shrink-0 border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,R.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:x?.status===`running`?(0,R.jsxs)(v,{type:`button`,variant:`destructive`,className:ut,onClick:()=>{K()},disabled:k,children:[(0,R.jsx)(p,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:Z(`actions.stop`)})]}):(0,R.jsxs)(v,{type:`button`,variant:`success`,className:ut,disabled:!B,onClick:()=>{G({kind:`all`})},children:[(0,R.jsx)(i,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:Z(`actions.run`)})]})})})]}),(0,R.jsx)(ee,{open:ue,onOpenChange:fe,children:(0,R.jsxs)(a,{showCloseButton:!1,overlayClassName:`z-[60] bg-black/60`,className:`z-[60] max-w-md rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,R.jsxs)(c,{children:[(0,R.jsx)(y,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:Z(`closeConfirmation.title`)}),(0,R.jsx)(l,{className:`text-sm text-foreground whitespace-pre-line`,children:Z(`closeConfirmation.description`)})]}),(0,R.jsxs)(ge,{className:`sm:flex-row sm:justify-end`,children:[(0,R.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>fe(!1),children:Z(`closeConfirmation.keepRunning`)}),(0,R.jsx)(v,{type:`button`,variant:`destructive`,onClick:()=>{fe(!1),we()},children:Z(`closeConfirmation.stopAndClose`)})]})]})})]})});gt.displayName=`TestsPanel`;var $=`archon.verification-tab`,_t=()=>{try{let e=window.localStorage.getItem($);return e===`checks`||e===`tests`?e:null}catch{return null}},vt=e=>{try{window.localStorage.setItem($,e)}catch{}},yt=({targetLabel:e,definitions:t,requiredDefinitionIds:n=[],preReviewDefinitionIds:i=[],checksTarget:o,testsTarget:s,onClose:c,onOpenActivity:u,requestedInitialTab:d,directBatchRunId:p,directAttemptRunId:m,onCheckSelectionChange:g,onUnavailable:_})=>{let{t:b}=I(`common`,{keyPrefix:`verificationDialog`}),x=j(t),S=o!==null&&(t.length>0||!!o.gateEvaluationId||!!p),C=s!==null&&x.length>0,[w,T]=(0,L.useState)(()=>{if(d===`checks`&&S||d===`tests`&&C)return d;let e=_t();return e===`checks`&&S||e===`tests`&&C?e:S?`checks`:`tests`}),[ne,re]=(0,L.useState)(`inactive`),[ie,ae]=(0,L.useState)(`inactive`),oe=(0,L.useRef)(null),O=(0,L.useRef)(null);(0,L.useEffect)(()=>{(w===`checks`&&!S||w===`tests`&&!C)&&T(S?`checks`:`tests`)},[w,S,C]);let k=e=>{if(O.current=e??null,s){let e=oe.current;if(e){e.requestClose();return}}(e??c)()},se=()=>{let e=O.current??c;O.current=null,e()};return(0,R.jsx)(ee,{open:!0,onOpenChange:e=>{e||k()},children:(0,R.jsxs)(a,{showCloseButton:!1,className:`flex h-[calc(100vh-1rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl p-0 sm:h-[calc(100vh-2rem)] sm:max-w-7xl`,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.stopPropagation(),children:[(0,R.jsx)(y,{className:`sr-only`,children:b(`title`)}),(0,R.jsx)(l,{className:`sr-only`,children:b(`description`)}),(0,R.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-border/70 px-4 py-4 sm:px-6`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 gap-3`,children:[(0,R.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border bg-background/60 text-sky-200`,children:(0,R.jsx)(h,{className:`size-5`})}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:b(`title`)}),(0,R.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:e})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,R.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>k(u),children:b(`openActivity`)}),(0,R.jsx)(v,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b(`close`),onClick:()=>k(),children:(0,R.jsx)(r,{className:`size-4`})})]})]}),(0,R.jsxs)(ue,{value:w,onValueChange:e=>{e!==`checks`&&e!==`tests`||(T(e),vt(e))},className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-3 sm:px-6`,children:[(0,R.jsxs)(E,{"aria-label":b(`tabsAriaLabel`),children:[S&&(0,R.jsxs)(te,{value:`checks`,className:`gap-2`,children:[(0,R.jsx)(h,{className:`size-4`}),(0,R.jsx)(`span`,{children:b(`tabs.checks.label`)}),(0,R.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":b(`status.checks.${ne}`),children:(0,R.jsx)(f,{state:ne})})]}),C&&(0,R.jsxs)(te,{value:`tests`,className:`gap-2`,children:[(0,R.jsx)(M,{className:`size-4`}),(0,R.jsx)(`span`,{children:b(`tabs.tests.label`)}),(0,R.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":b(`status.tests.${ie}`),children:(0,R.jsx)(f,{state:ie})})]})]}),(0,R.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:b(`tabs.${w}.description`)})]}),S&&o&&(0,R.jsx)(D,{value:`checks`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,R.jsx)(He,{...o,definitions:t,requiredDefinitionIds:n,preReviewDefinitionIds:i,directBatchRunId:p,directAttemptRunId:m,onSelectionChange:w===`checks`?g:void 0,onUnavailable:_,onStatusChange:re})}),s&&x.length>0&&(0,R.jsx)(D,{value:`tests`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,R.jsx)(gt,{ref:oe,...s,testCommands:x,onStatusChange:ae,onClose:se})})]})]})})};export{yt as VerificationDialog};
@@ -1 +1 @@
1
- import{n as e,t}from"./path-sMK4d_s9.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-CERhmQhR.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
1
+ import{n as e,t}from"./path-Bw5AvBNC.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-DfHDMDTt.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
@@ -0,0 +1 @@
1
+ import"./chunk-NNHCCRGN-DgKrp8T-.js";import{n as e}from"./chunk-4EGX6M5U-CAjWPjND.js";export{e as createArchitectureServices};