specrails-desktop 2.19.0 → 2.20.0

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 (252) hide show
  1. package/client/dist/assets/ActivityFeedPage-BgLjSsDn.js +1 -0
  2. package/client/dist/assets/AgentBrowserCapture-R87DoreG.js +1 -0
  3. package/client/dist/assets/AgentModeCodePane-CO8F0ttc.js +2 -0
  4. package/client/dist/assets/AgentModeJobsPane-BecN3lwS.js +1 -0
  5. package/client/dist/assets/AgentsPage-_-Q9plMs.js +86 -0
  6. package/client/dist/assets/AnalyticsPage-Cqh5IGaF.js +1 -0
  7. package/client/dist/assets/{BarChart-HPiao--v.js → BarChart-DZlxRF5i.js} +1 -1
  8. package/client/dist/assets/CodePage-4eiDoOBX.js +2 -0
  9. package/client/dist/assets/{DesktopAnalyticsPage-B2RBxIvj.js → DesktopAnalyticsPage-DyiCeq0h.js} +1 -1
  10. package/client/dist/assets/{DocsDialog-BJDvUEGj.js → DocsDialog-CDZv0FMK.js} +2 -2
  11. package/client/dist/assets/DocsPage-BmwaXyUf.js +11 -0
  12. package/client/dist/assets/{ExportDropdown-CYMcbLTD.js → ExportDropdown-CWafyruY.js} +1 -1
  13. package/client/dist/assets/IntegrationsPage-CY2jfpeW.js +3 -0
  14. package/client/dist/assets/JobDetailPage-p0lsbXRg.js +1 -0
  15. package/client/dist/assets/JobsPage-GeKC3ckC.js +1 -0
  16. package/client/dist/assets/LogViewer-Cz7jzyU2.js +16 -0
  17. package/client/dist/assets/LoopBuilderPage-C_vv7AW2.js +7 -0
  18. package/client/dist/assets/LoopsPage-CettzySP.js +1 -0
  19. package/client/dist/assets/ProjectSettingsDialog-Xw30FTul.js +1 -0
  20. package/client/dist/assets/agent-B7GdHP3Z.js +1 -0
  21. package/client/dist/assets/agent-BHmcgoJf.js +1 -0
  22. package/client/dist/assets/agent-BdY_fii4.js +1 -0
  23. package/client/dist/assets/agent-C32FOi9v.js +1 -0
  24. package/client/dist/assets/agent-CiFQxoaZ2.js +1 -0
  25. package/client/dist/assets/agent-CtAag7V6.js +1 -0
  26. package/client/dist/assets/agent-DE4Mp1fY2.js +1 -0
  27. package/client/dist/assets/agent-DK8qovyG2.js +1 -0
  28. package/client/dist/assets/{dist-js-ClEfL6Bo.js → dist-js-DoZ1SVEs.js} +1 -1
  29. package/client/dist/assets/{dist-js-b2_z7zAi.js → dist-js-zlcAXgob.js} +1 -1
  30. package/client/dist/assets/index-5mbwBNQ-.css +2 -0
  31. package/client/dist/assets/index-CG4z4_Mq.js +152 -0
  32. package/client/dist/assets/{lib-CfphudAm.js → lib-zJbG81CY.js} +2 -2
  33. package/client/dist/assets/nav-BAsYcqdw2.js +1 -0
  34. package/client/dist/assets/nav-BRrNlZkr.js +1 -0
  35. package/client/dist/assets/nav-Bqhyfbcj2.js +1 -0
  36. package/client/dist/assets/nav-CQb9y1km.js +1 -0
  37. package/client/dist/assets/nav-Cibp2KWF.js +1 -0
  38. package/client/dist/assets/nav-CzKzuwH8.js +1 -0
  39. package/client/dist/assets/nav-Danf5sRf2.js +1 -0
  40. package/client/dist/assets/nav-DtTnF9xd.js +1 -0
  41. package/client/dist/assets/{settings-DmyDpuzu.js → settings-BPq9nCJm.js} +1 -1
  42. package/client/dist/assets/{settings-DaXhxNug2.js → settings-BWHGtmU12.js} +1 -1
  43. package/client/dist/assets/{settings-MjYVJvDE.js → settings-C-m3yEZ2.js} +1 -1
  44. package/client/dist/assets/settings-CY8udi0e.js +1 -0
  45. package/client/dist/assets/{settings-CfOWHPzc2.js → settings-DZj7Uqy32.js} +1 -1
  46. package/client/dist/assets/{settings-CX29QcQW.js → settings-VgCsjaYf.js} +1 -1
  47. package/client/dist/assets/{settings-DwPRLcxr2.js → settings-r8Qq2Gzp2.js} +1 -1
  48. package/client/dist/assets/{settings-BOZBX-Vq.js → settings-zZr7NzuB.js} +1 -1
  49. package/client/dist/assets/{upload-Ox9jUq1X.js → upload-Cm4KWhcE.js} +1 -1
  50. package/client/dist/assets/{value-BeQVX5gN.js → value-m3Q84dDF.js} +1 -1
  51. package/client/dist/index.html +5 -5
  52. package/package.json +1 -1
  53. package/server/dist/agent-chat-manager.js +117 -13
  54. package/server/dist/agent-chat-router.js +7 -2
  55. package/server/dist/agent-operator-prompt.js +4 -2
  56. package/server/dist/file-provenance.js +9 -6
  57. package/server/dist/project-git.js +147 -0
  58. package/server/dist/project-router-git.js +43 -0
  59. package/server/dist/project-router.js +2 -0
  60. package/client/dist/assets/ActivityFeedPage-C0_k6n5T.js +0 -1
  61. package/client/dist/assets/AgentBrowserCapture-NHUCEnTh.js +0 -1
  62. package/client/dist/assets/AgentModeCodePane-jddXrhPY.js +0 -2
  63. package/client/dist/assets/AgentsPage-BPjf6bId.js +0 -86
  64. package/client/dist/assets/AnalyticsPage-BaJjj5mO.js +0 -1
  65. package/client/dist/assets/CodePage-CAD4KfkC.js +0 -2
  66. package/client/dist/assets/DocsPage-B6H-DBs8.js +0 -11
  67. package/client/dist/assets/IntegrationsPage-Dx_UpQVk.js +0 -3
  68. package/client/dist/assets/JobDetailPage-BlTnsRAN.js +0 -16
  69. package/client/dist/assets/JobsPage-EB0PbXOk.js +0 -1
  70. package/client/dist/assets/LoopBuilderPage-DfWfhhJY.js +0 -7
  71. package/client/dist/assets/LoopsPage-DCVATTv5.js +0 -1
  72. package/client/dist/assets/agent-B5Ycau5M.js +0 -1
  73. package/client/dist/assets/agent-BEz08l4_2.js +0 -1
  74. package/client/dist/assets/agent-BIX51CEA.js +0 -1
  75. package/client/dist/assets/agent-Bc9Kwf65.js +0 -1
  76. package/client/dist/assets/agent-BiM7puyn.js +0 -1
  77. package/client/dist/assets/agent-C0kYSv3m2.js +0 -1
  78. package/client/dist/assets/agent-CCzWlfqs.js +0 -1
  79. package/client/dist/assets/agent-DiCSo31C.js +0 -1
  80. package/client/dist/assets/index-9yNUBwEi.css +0 -2
  81. package/client/dist/assets/index-BeujshsU.js +0 -152
  82. package/client/dist/assets/nav--1ErXZrS.js +0 -1
  83. package/client/dist/assets/nav-18nqSJ8h.js +0 -1
  84. package/client/dist/assets/nav-BuonHb17.js +0 -1
  85. package/client/dist/assets/nav-C-sCoOLY2.js +0 -1
  86. package/client/dist/assets/nav-ClXz_3Ic2.js +0 -1
  87. package/client/dist/assets/nav-CtqgSQeE2.js +0 -1
  88. package/client/dist/assets/nav-S3YvCaVv.js +0 -1
  89. package/client/dist/assets/nav-czg8NkN-.js +0 -1
  90. package/client/dist/assets/settings-zJFdTzKE.js +0 -1
  91. /package/client/dist/assets/{activity-C5SeKbom.js → activity-B_71BWg3.js} +0 -0
  92. /package/client/dist/assets/{activity-DLdwUYv7.js → activity-BpTTj_PH.js} +0 -0
  93. /package/client/dist/assets/{activity-BlvN5rhP.js → activity-Ch-wbr0C2.js} +0 -0
  94. /package/client/dist/assets/{activity-DVuiy8TI2.js → activity-D0rfjQzT2.js} +0 -0
  95. /package/client/dist/assets/{activity-DIJexk6v2.js → activity-D2e62vbV2.js} +0 -0
  96. /package/client/dist/assets/{activity-Dsf3J7iW.js → activity-DHv2V5Oi.js} +0 -0
  97. /package/client/dist/assets/{activity-DOKV_Wyf.js → activity-DemHQS7l.js} +0 -0
  98. /package/client/dist/assets/{addspec-CXfEOrD42.js → addspec-B6Ns8KU02.js} +0 -0
  99. /package/client/dist/assets/{addspec-D28kw9ow2.js → addspec-CrEm6Fzr2.js} +0 -0
  100. /package/client/dist/assets/{addspec-BXV6sx5l.js → addspec-D6L4ZteP.js} +0 -0
  101. /package/client/dist/assets/{addspec-DC1tgsFG.js → addspec-Dio-H5z0.js} +0 -0
  102. /package/client/dist/assets/{addspec-DcHALPEp.js → addspec-l_zU5gla.js} +0 -0
  103. /package/client/dist/assets/{addspec-CS895X6A.js → addspec-qGyH7MHy2.js} +0 -0
  104. /package/client/dist/assets/{addspec-D39EEg02.js → addspec-xwRX_Pnf.js} +0 -0
  105. /package/client/dist/assets/{agents-CsDEv4Fj.js → agents-CHgCudUV.js} +0 -0
  106. /package/client/dist/assets/{agents-z0kA-y0Q.js → agents-CnaPeSyw.js} +0 -0
  107. /package/client/dist/assets/{agents-BXDCFJQa.js → agents-DuhLEaQ_.js} +0 -0
  108. /package/client/dist/assets/{agents-BFrHy5d-2.js → agents-Dumx4JiM2.js} +0 -0
  109. /package/client/dist/assets/{agents-BFy2Kq_k2.js → agents-OzxCLVW1.js} +0 -0
  110. /package/client/dist/assets/{agents-CTdwacTO.js → agents-Xh-zYHUx2.js} +0 -0
  111. /package/client/dist/assets/{agents-BySH0Gvw.js → agents-hv3sqmPm2.js} +0 -0
  112. /package/client/dist/assets/{agentstudio-CSZo7p8K.js → agentstudio-BIxikDf_.js} +0 -0
  113. /package/client/dist/assets/{agentstudio-B8H2H4Db2.js → agentstudio-Bo91kfUd2.js} +0 -0
  114. /package/client/dist/assets/{agentstudio-B9zthaTJ.js → agentstudio-Bz8cP8_c.js} +0 -0
  115. /package/client/dist/assets/{agentstudio-BDMpU01s.js → agentstudio-CCthUdzR.js} +0 -0
  116. /package/client/dist/assets/{agentstudio-CdD6J23W.js → agentstudio-CcH8Ckql2.js} +0 -0
  117. /package/client/dist/assets/{agentstudio-D80fZu_M2.js → agentstudio-DARgYg5Z2.js} +0 -0
  118. /package/client/dist/assets/{agentstudio-EuKglkaF2.js → agentstudio-VJOa_NVO.js} +0 -0
  119. /package/client/dist/assets/{aiedit-B_VOTUo42.js → aiedit-5ZXN4cep2.js} +0 -0
  120. /package/client/dist/assets/{aiedit-DX3BBpXF.js → aiedit-7B2dvCv-.js} +0 -0
  121. /package/client/dist/assets/{aiedit-TON-4N9S.js → aiedit-B7gAJZVC.js} +0 -0
  122. /package/client/dist/assets/{aiedit-ybQmdsST.js → aiedit-D92V-kUW.js} +0 -0
  123. /package/client/dist/assets/{aiedit-D59sPapq2.js → aiedit-D9ualLVJ.js} +0 -0
  124. /package/client/dist/assets/{aiedit-Cxoe_0wv.js → aiedit-h48tJU0V2.js} +0 -0
  125. /package/client/dist/assets/{aiedit-GYOYWCHJ2.js → aiedit-xkA_mR2a2.js} +0 -0
  126. /package/client/dist/assets/{analytics-DGOoMkaZ.js → analytics-BBAfeB1o.js} +0 -0
  127. /package/client/dist/assets/{analytics-B2jjXLCP2.js → analytics-BM1R5CEp2.js} +0 -0
  128. /package/client/dist/assets/{analytics-BotqRU_R.js → analytics-BjLruoYS.js} +0 -0
  129. /package/client/dist/assets/{analytics-CqMJQb7N.js → analytics-CKwh2zUr.js} +0 -0
  130. /package/client/dist/assets/{analytics-DL7uwNAI2.js → analytics-CpcjUkV72.js} +0 -0
  131. /package/client/dist/assets/{analytics-Ck3vl2Qo2.js → analytics-DbXHdSlk2.js} +0 -0
  132. /package/client/dist/assets/{analytics-BTkXLTfa.js → analytics-Djzr1xUQ.js} +0 -0
  133. /package/client/dist/assets/{attachments-7w-BR2V2.js → attachments-Bnbyj2PN.js} +0 -0
  134. /package/client/dist/assets/{attachments-D0fGlFve.js → attachments-C-gyrCOb.js} +0 -0
  135. /package/client/dist/assets/{attachments-Cbh4AwjP.js → attachments-C11tOKZ_.js} +0 -0
  136. /package/client/dist/assets/{attachments-BcE7kZG-2.js → attachments-CIeLa8l12.js} +0 -0
  137. /package/client/dist/assets/{attachments-B5QX1Xfa2.js → attachments-Cxrs0pyL2.js} +0 -0
  138. /package/client/dist/assets/{attachments-BsJJXFzT.js → attachments-DslHfa-L.js} +0 -0
  139. /package/client/dist/assets/{attachments-D3DJpd3e2.js → attachments-TTPsc0a52.js} +0 -0
  140. /package/client/dist/assets/{browser-CmWGMRGf2.js → browser-BKP6hqQC2.js} +0 -0
  141. /package/client/dist/assets/{browser-CaV3BJNY2.js → browser-BTivfZKE2.js} +0 -0
  142. /package/client/dist/assets/{browser-BOxg0p3n.js → browser-DEEO-OSi.js} +0 -0
  143. /package/client/dist/assets/{browser-D6wbpBOL2.js → browser-DlKLfT612.js} +0 -0
  144. /package/client/dist/assets/{browser-dsgDU1HB.js → browser-DlSXtfu5.js} +0 -0
  145. /package/client/dist/assets/{browser-BSh8xUWV.js → browser-INCUyduh.js} +0 -0
  146. /package/client/dist/assets/{browser-9GR11iTi.js → browser-bpO3onlS.js} +0 -0
  147. /package/client/dist/assets/{chat-CYHUUW0p2.js → chat-5mdg_YIc2.js} +0 -0
  148. /package/client/dist/assets/{chat-CAo0jCnj2.js → chat-BGax2nV62.js} +0 -0
  149. /package/client/dist/assets/{chat-DhpcWjOf.js → chat-BpYxnkr4.js} +0 -0
  150. /package/client/dist/assets/{chat-cFG-UfRA2.js → chat-BvHrebKC2.js} +0 -0
  151. /package/client/dist/assets/{chat-B90iLDI4.js → chat-CZyiLJvQ.js} +0 -0
  152. /package/client/dist/assets/{chat-CW54IP3u.js → chat-DKYP7NnC.js} +0 -0
  153. /package/client/dist/assets/{chat-D1PXX_p2.js → chat-wkTIy9rX.js} +0 -0
  154. /package/client/dist/assets/{code-B5UrmjaE2.js → code-BFxE1Yt62.js} +0 -0
  155. /package/client/dist/assets/{code-B1aOMCVV.js → code-BefYOm5Q.js} +0 -0
  156. /package/client/dist/assets/{code-DZKjfzBN.js → code-BkXpJt99.js} +0 -0
  157. /package/client/dist/assets/{code-CjBHU0nw.js → code-C6Sq7_t8.js} +0 -0
  158. /package/client/dist/assets/{code--qUk_yn-.js → code-CGj3w-2N.js} +0 -0
  159. /package/client/dist/assets/{code-D7GLAjrz2.js → code-Dfsxc9o82.js} +0 -0
  160. /package/client/dist/assets/{code-Cjv4_HkK2.js → code-Y5urks5s2.js} +0 -0
  161. /package/client/dist/assets/{commands-oB9q2vy_2.js → commands-Bb7MnPqn2.js} +0 -0
  162. /package/client/dist/assets/{commands-MqNuGGO4.js → commands-CQkdthjF.js} +0 -0
  163. /package/client/dist/assets/{commands-BCx1uDIE.js → commands-C_7zZwJf.js} +0 -0
  164. /package/client/dist/assets/{commands-Bhw9Hqsa2.js → commands-DBc5llLi2.js} +0 -0
  165. /package/client/dist/assets/{commands-B9XaopQC.js → commands-D_6B8lfU.js} +0 -0
  166. /package/client/dist/assets/{commands-DuaQT-it.js → commands-DhZNhSbl.js} +0 -0
  167. /package/client/dist/assets/{commands-D0RnooQF2.js → commands-uz_uKT242.js} +0 -0
  168. /package/client/dist/assets/{common-wEB9RBdf.js → common-Bb64s3Bm.js} +0 -0
  169. /package/client/dist/assets/{common-BXzqeuiC2.js → common-C8ZD5upH2.js} +0 -0
  170. /package/client/dist/assets/{common-C-jaOdxz2.js → common-CeQUwuHt2.js} +0 -0
  171. /package/client/dist/assets/{common-BaJ6MF7T.js → common-DPxotRK9.js} +0 -0
  172. /package/client/dist/assets/{common-DPGR3Tfo.js → common-KbQuTSGg.js} +0 -0
  173. /package/client/dist/assets/{common-CRd-Ge5u2.js → common-QjVnq9XP2.js} +0 -0
  174. /package/client/dist/assets/{common-CKjy-R8-.js → common-k5MTOHpn.js} +0 -0
  175. /package/client/dist/assets/{dashboard-CcEpALV_.js → dashboard-B8032psZ.js} +0 -0
  176. /package/client/dist/assets/{dashboard-DxEPkALo2.js → dashboard-BHGKtxty2.js} +0 -0
  177. /package/client/dist/assets/{dashboard-MgDVmaYS2.js → dashboard-CXnoUgN22.js} +0 -0
  178. /package/client/dist/assets/{dashboard-CfltY66K.js → dashboard-Ccyxqy7d.js} +0 -0
  179. /package/client/dist/assets/{dashboard-DLeC5ziO.js → dashboard-Dc5ZAgMN.js} +0 -0
  180. /package/client/dist/assets/{dashboard-Bl2_Yjs6.js → dashboard-JMY8ueD3.js} +0 -0
  181. /package/client/dist/assets/{dashboard-C_vS9RaM2.js → dashboard-tkWr1aHD2.js} +0 -0
  182. /package/client/dist/assets/{explore-OZhWV0Eb2.js → explore-BHEhNekP2.js} +0 -0
  183. /package/client/dist/assets/{explore-D-htKul_.js → explore-CWlAXx0f2.js} +0 -0
  184. /package/client/dist/assets/{explore-Dvp-5qOw2.js → explore-DAsroA482.js} +0 -0
  185. /package/client/dist/assets/{explore-IS8VyaSZ.js → explore-DG1CtYqT.js} +0 -0
  186. /package/client/dist/assets/{explore-FaKfWCr72.js → explore-DMSGAnhK.js} +0 -0
  187. /package/client/dist/assets/{explore-B_79NLR5.js → explore-DaXiW9-6.js} +0 -0
  188. /package/client/dist/assets/{explore-D5b2jgvR.js → explore-UwHHj2ux.js} +0 -0
  189. /package/client/dist/assets/{format-command-CHImQv6W.js → format-command-BHymDa4r.js} +0 -0
  190. /package/client/dist/assets/{integrations-B97cGWfo2.js → integrations-B-JVE1_D.js} +0 -0
  191. /package/client/dist/assets/{integrations-C3Ma3GdM.js → integrations-BAujIDoE.js} +0 -0
  192. /package/client/dist/assets/{integrations-Bp3leAh3.js → integrations-CAF21FbQ.js} +0 -0
  193. /package/client/dist/assets/{integrations-Du_0rDfi2.js → integrations-CHCgning2.js} +0 -0
  194. /package/client/dist/assets/{integrations-C5MUA-0-.js → integrations-CtsOpq2D2.js} +0 -0
  195. /package/client/dist/assets/{integrations-CiQbCn_W.js → integrations-DS5FFMes.js} +0 -0
  196. /package/client/dist/assets/{integrations-t4X5UVcx2.js → integrations-axZN4--n2.js} +0 -0
  197. /package/client/dist/assets/{jira-D6IDTIsc2.js → jira-BcZzX9122.js} +0 -0
  198. /package/client/dist/assets/{jira-DdEKW9Pu.js → jira-CTYs7LA12.js} +0 -0
  199. /package/client/dist/assets/{jira-BzFvFn7t2.js → jira-D2nN39e92.js} +0 -0
  200. /package/client/dist/assets/{jira-BCHx9zUF.js → jira-DJxmIkyr.js} +0 -0
  201. /package/client/dist/assets/{jira-DSZ5xFRl.js → jira-IhC1ROIc.js} +0 -0
  202. /package/client/dist/assets/{jira-BqXyykbt2.js → jira-Iw575fN8.js} +0 -0
  203. /package/client/dist/assets/{jira-B1XaR6fj.js → jira-kbWZY7jH.js} +0 -0
  204. /package/client/dist/assets/{jobs-CeOcGHd_2.js → jobs-Bvh_HiRo2.js} +0 -0
  205. /package/client/dist/assets/{jobs-BgHEgCWk2.js → jobs-BzYX5VLd.js} +0 -0
  206. /package/client/dist/assets/{jobs-CU-khJTt.js → jobs-DTfaTfzQ2.js} +0 -0
  207. /package/client/dist/assets/{jobs-Ct5v2p6T.js → jobs-DrPyq5J2.js} +0 -0
  208. /package/client/dist/assets/{jobs-m7L0K9uC2.js → jobs-Dty7cCdI2.js} +0 -0
  209. /package/client/dist/assets/{jobs-Ce0SE81t.js → jobs-Dv8MP-eE.js} +0 -0
  210. /package/client/dist/assets/{jobs-BX9dP3Qn.js → jobs-DvkAoA8D.js} +0 -0
  211. /package/client/dist/assets/{loops-BlrQiK122.js → loops-BR4FmOv12.js} +0 -0
  212. /package/client/dist/assets/{loops-DuuWQWTI.js → loops-BgX_uudn.js} +0 -0
  213. /package/client/dist/assets/{loops-KOTryzk5.js → loops-Bpl2j2LP.js} +0 -0
  214. /package/client/dist/assets/{loops-Bs0ectZ32.js → loops-DW8hSMdS2.js} +0 -0
  215. /package/client/dist/assets/{loops-CLZV8HHY2.js → loops-Q2muu8hW2.js} +0 -0
  216. /package/client/dist/assets/{loops-t1mUZtf0.js → loops-Y3FQsUCh.js} +0 -0
  217. /package/client/dist/assets/{loops-BEUiCzEI.js → loops-q7CNDvfK.js} +0 -0
  218. /package/client/dist/assets/{mcp-CXy61khH.js → mcp-B8omp_Cd.js} +0 -0
  219. /package/client/dist/assets/{mcp-_DUUXTHB2.js → mcp-B_nWlxZa2.js} +0 -0
  220. /package/client/dist/assets/{mcp-dlOyUQQy2.js → mcp-Cb2jtHP72.js} +0 -0
  221. /package/client/dist/assets/{mcp-4QbfLPa4.js → mcp-DPqm2C8-.js} +0 -0
  222. /package/client/dist/assets/{mcp-NlLc9T8u2.js → mcp-DTCCrYHz2.js} +0 -0
  223. /package/client/dist/assets/{mcp-zqSVP7nA.js → mcp-D_oPS6Zc.js} +0 -0
  224. /package/client/dist/assets/{mcp-CmOBPDjE.js → mcp-DytBbASZ.js} +0 -0
  225. /package/client/dist/assets/{setup-BxVydxbl2.js → setup-CNMdCHHt2.js} +0 -0
  226. /package/client/dist/assets/{setup-BmXfxlzA2.js → setup-Cag4XrbL2.js} +0 -0
  227. /package/client/dist/assets/{setup-DIRZ1Lf-.js → setup-D9IHGoWU.js} +0 -0
  228. /package/client/dist/assets/{setup-Dx13pESZ.js → setup-Dg6Ba3JT.js} +0 -0
  229. /package/client/dist/assets/{setup-Z01j3st4.js → setup-DyK36RIW.js} +0 -0
  230. /package/client/dist/assets/{setup-SLAi4xxQ2.js → setup-aTlGxuwi2.js} +0 -0
  231. /package/client/dist/assets/{setup-DwbKSnKQ.js → setup-kWsoAeHQ.js} +0 -0
  232. /package/client/dist/assets/{specs-BYSOlQRw2.js → specs-BFSUPa122.js} +0 -0
  233. /package/client/dist/assets/{specs-BWQ-0EXt2.js → specs-BMzip1WY2.js} +0 -0
  234. /package/client/dist/assets/{specs-d-zU7_3Q.js → specs-C-mtLcXw.js} +0 -0
  235. /package/client/dist/assets/{specs-CkP0B28v2.js → specs-CAzpvADd2.js} +0 -0
  236. /package/client/dist/assets/{specs-57pue7UQ.js → specs-CyRIw_IR.js} +0 -0
  237. /package/client/dist/assets/{specs-nM5Cpcqe.js → specs-DMm7gB_l.js} +0 -0
  238. /package/client/dist/assets/{specs-RSYuLgF4.js → specs-DuottM0Z.js} +0 -0
  239. /package/client/dist/assets/{terminal-D3RTuBwy.js → terminal-58ReNaya.js} +0 -0
  240. /package/client/dist/assets/{terminal-Adi3W-GZ2.js → terminal-CDiOAmBd2.js} +0 -0
  241. /package/client/dist/assets/{terminal-DOuNm2BI.js → terminal-CJN-mQMc.js} +0 -0
  242. /package/client/dist/assets/{terminal-C8KlD61D.js → terminal-CYB4TiAd.js} +0 -0
  243. /package/client/dist/assets/{terminal-BA6FCZna2.js → terminal-DTQ_dPqi2.js} +0 -0
  244. /package/client/dist/assets/{terminal-BCIUSkrg.js → terminal-DawP8xNL.js} +0 -0
  245. /package/client/dist/assets/{terminal-DCkOEjSj2.js → terminal-DsaDTq5N2.js} +0 -0
  246. /package/client/dist/assets/{tickets-Bsyv_znj.js → tickets-CNvIilmP.js} +0 -0
  247. /package/client/dist/assets/{tickets-C_UPra_1.js → tickets-CujsZvkf.js} +0 -0
  248. /package/client/dist/assets/{tickets-B2q36GlQ2.js → tickets-DBfFePwk2.js} +0 -0
  249. /package/client/dist/assets/{tickets-DiUA3rXq.js → tickets-Da15iaRw.js} +0 -0
  250. /package/client/dist/assets/{tickets-DDjU7UfE2.js → tickets-Df6pee-O2.js} +0 -0
  251. /package/client/dist/assets/{tickets-DR4ZrPMf.js → tickets-DoRTUYRT.js} +0 -0
  252. /package/client/dist/assets/{tickets-D72LbUtU2.js → tickets-DvohTziT2.js} +0 -0
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor.main-G3Sl9C67.js","assets/chunk-BNv3lrIs.js","assets/preload-helper-DSXbuxSR.js","assets/editor.api2-T7u8kQWG.js","assets/editor-Br_kD0ds.css","assets/workers-CXcXtO3b.js","assets/monaco.contribution-PUeaZk8T.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./chunk-BNv3lrIs.js";import{t}from"./preload-helper-DSXbuxSR.js";import{At as n,C as r,Dn as i,Dt as a,Fn as o,H as s,Ht as c,In as l,J as u,Mn as d,Mt as f,On as p,Ot as m,Pn as h,Pt as g,Qt as _,S as v,Tt as y,U as b,Ut as x,Wt as S,X as C,ct as w,d as T,en as ee,fn as te,jt as E,mn as D,pn as O,s as k,tn as A}from"./index-BeujshsU.js";var j=_(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),M=_(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),N=e(l(),1),P=e(o(),1);function F(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function I(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function ne(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var re=(e,t)=>Math.abs(e-t)<1.01,ie=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},L,R=()=>{if(L!==void 0)return L;if(typeof navigator>`u`)return L=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return L=!0;let e=navigator.maxTouchPoints;return L=navigator.platform===`MacIntel`&&e!==void 0&&e>0},z=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},ae=e=>e,oe=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},B=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(z(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(z(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},V={passive:!0},se=typeof window>`u`?!0:`onscrollend`in window,H=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&se,o=0,s=a?null:ie(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,V),a&&r.addEventListener(`scrollend`,u,V),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},U=(e,t)=>H(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),ce=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},W=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},le=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ae,rangeExtractor:oe,onChange:()=>{},measureElement:ce,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}this.options=t},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=I(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!R()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,V),e.addEventListener(`touchend`,n,V),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=I(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=I(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{let c=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let l=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=this.options.gap,a=e*2,o=this._flatMeasurements;if(!o||o.length<a){let e=new Float64Array(a);o&&l>0&&e.set(o.subarray(0,l*2)),o=e,this._flatMeasurements=o}let s;if(l===0)s=t+n;else{let e=l-1;s=o[e*2]+o[e*2+1]+i}for(let t=l;t<e;t++){let e=r(t),n=c.get(e),a=typeof n==`number`?n:this.options.estimateSize(t);o[t*2]=s,o[t*2+1]=a,s+=a+i}let u=F(e,o,r);return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,l),d=Array(a).fill(void 0);for(let e=0;e<l;e++){let t=u[e];t&&(d[t.lane]=e)}for(let i=l;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,l,f=o===`estimate`||c.has(e);if(a!==void 0&&this.options.lanes>1){s=a;let e=d[s],r=e===void 0?void 0:u[e];l=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?u[i-1]:this.getFurthestMeasurement(u,i);l=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,s)}let p=c.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=l+m;u[i]={index:i,start:l,size:m,end:h,key:e,lane:s},d[s]=i}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=I(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?de({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:r===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=I(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);o!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!==`backward`:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this))&&(R()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=o:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0})),(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,this.notify(!1))},this.getVirtualItems=I(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return ne(t[ue(0,t.length-1,r?e=>n[e*2]:e=>ne(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&re(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},ue=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function de({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:i}){let a=e.length-1,o=i?e=>i[e*2]:t=>e[t].start,s=i?e=>i[e*2]+i[e*2+1]:t=>e[t].end;if(e.length<=r)return{startIndex:0,endIndex:a};let c=ue(0,a,o,n),l=c;if(r===1)for(;l<a&&s(l)<n+t;)l++;else if(r>1){let i=Array(r).fill(0);for(;l<a&&i.some(e=>e<n+t);){let t=e[l];i[t.lane]=t.end,l++}let o=Array(r).fill(n+t);for(;c>=0&&o.some(e=>e>=n);){let t=e[c];o[t.lane]=t.start,c--}c=Math.max(0,c-c%r),l=Math.min(a,l+(r-1-l%r))}return{startIndex:c,endIndex:l}}var fe=typeof document<`u`?N.useLayoutEffect:N.useEffect;function G({useFlushSync:e=!0,...t}){let n=N.useReducer(e=>e+1,0)[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,P.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=N.useState(()=>new le(r));return i.setOptions(r),fe(()=>i._didMount(),[]),fe(()=>i._willUpdate()),i}function pe(e){return G({observeElementRect:B,observeElementOffset:U,scrollToFn:W,...e})}var K=O(),q=e=>`specrails-desktop:code-tree-filter:${e}`,J=e=>`specrails-desktop:code-tree-collapsed:${e}`;function Y(e){return e.split(`/`).length-1}function me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function he(e){return e?e.length>10?e.slice(0,10):e:null}function ge(e){return e===`created`?`added`:e===`modified`?`changed`:e===`deleted`?`deleted`:null}function _e(e,t){if(t.size===0)return!1;let n=e.split(`/`);for(let e=1;e<n.length;e++)if(t.has(n.slice(0,e).join(`/`)))return!0;return!1}function ve({onOpenFile:e,selectedPath:t,filterJobId:n,filterTicketId:r}){let{t:i}=p(`code`),{activeProjectId:o}=ee(),{openTicketDetail:s}=T(),{registerHandler:c,unregisterHandler:l}=te(),[d,f]=(0,N.useState)(()=>{if(!o)return`touched-by-ai`;try{let e=localStorage.getItem(q(o));if(e===`all`||e===`touched-by-ai`)return e}catch{}return`touched-by-ai`});(0,N.useEffect)(()=>{if(o)try{localStorage.setItem(q(o),d)}catch{}},[d,o]);let[h,g]=(0,N.useState)(()=>{if(!o)return new Set;try{let e=localStorage.getItem(J(o));if(!e)return new Set;let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>typeof e==`string`))}catch{}return new Set});(0,N.useEffect)(()=>{if(o)try{localStorage.setItem(J(o),JSON.stringify([...h]))}catch{}},[h,o]);let _=(0,N.useCallback)(e=>{g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,N.useCallback)(()=>{g(new Set)},[]),{data:b,refresh:C,isFirstLoad:w}=A({namespace:`code-tree:${d}:${d===`touched-by-ai`?`${n??`all-jobs`}:${r??`all-specs`}`:`all`}`,projectId:o,initialValue:[],fetcher:(0,N.useCallback)(async()=>{let e=[],t=null;for(let i=0;i<100;i+=1){let i=new URLSearchParams({withProvenance:`1`,filter:d});d===`touched-by-ai`&&n&&i.set(`jobId`,n),d===`touched-by-ai`&&typeof r==`number`&&i.set(`ticketId`,String(r)),t&&i.set(`cursor`,t);let a=await fetch(`${D()}/code/tree?${i.toString()}`);if(!a.ok)break;let o=await a.json().catch(()=>({}));if(Array.isArray(o.entries)&&e.push(...o.entries),!o.nextCursor)break;t=o.nextCursor}return e},[d,n,r])}),E=(0,N.useRef)(o);(0,N.useEffect)(()=>{E.current=o},[o]),(0,N.useEffect)(()=>{if(!o)return;let e=`code-tree-${o}`;return c(e,e=>{let t=e;t.projectId===E.current&&t.type===`file.provenance_updated`&&C()}),()=>l(e)},[o,c,l,C]);let O=(0,N.useRef)(null),k=(0,N.useMemo)(()=>(b??[]).filter(e=>!_e(e.path,h)),[b,h]),M=(0,N.useCallback)(()=>{g(new Set((b??[]).filter(e=>e.kind===`dir`).map(e=>e.path)))},[b]),P=pe({count:k.length,getScrollElement:()=>O.current,estimateSize:()=>28,overscan:12,initialRect:{width:320,height:600},observeElementRect:(e,t)=>{let n=e.scrollElement;if(!n)return()=>{};let r=()=>{let e=n.getBoundingClientRect(),r=e.height||n.clientHeight||600;t({width:e.width||n.clientWidth||320,height:r})};if(r(),typeof ResizeObserver<`u`){let e=new ResizeObserver(r);return e.observe(n),()=>e.disconnect()}return()=>{}}}),F=k.length===0,I=(0,N.useMemo)(()=>(b??[]).filter(e=>e.kind===`file`).length,[b]);return(0,K.jsxs)(`div`,{className:`flex flex-col h-full`,"data-testid":`file-tree`,children:[(0,K.jsxs)(`div`,{className:`px-2 py-2 border-b border-border text-xs space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>f(`touched-by-ai`),className:u(`px-2 py-1 rounded-md transition-colors`,d===`touched-by-ai`?`bg-accent-primary/20 text-accent-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),"aria-pressed":d===`touched-by-ai`,children:i(n?`tree.jobFiles`:r?`tree.specFiles`:`tree.touchedByAi`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>f(`all`),className:u(`px-2 py-1 rounded-md transition-colors`,d===`all`?`bg-accent-primary/20 text-accent-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),"aria-pressed":d===`all`,children:i(`tree.allFiles`)}),(0,K.jsx)(`div`,{className:`flex-1`}),(0,K.jsx)(`button`,{type:`button`,onClick:M,title:i(`tree.collapseAll`),className:`px-1.5 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,"aria-label":i(`tree.collapseAll`),children:(0,K.jsx)(x,{className:`w-3.5 h-3.5`})}),(0,K.jsx)(`button`,{type:`button`,onClick:v,title:i(`tree.expandAll`),className:`px-1.5 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,"aria-label":i(`tree.expandAll`),children:(0,K.jsx)(S,{className:`w-3.5 h-3.5`})})]}),d===`touched-by-ai`&&I>0&&(0,K.jsx)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-muted-foreground`,children:(0,K.jsx)(`span`,{children:i(`tree.touchedCount`,{count:I})})})]}),F&&w?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center px-4 text-center`,"data-testid":`file-tree-loading`,children:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground animate-pulse`,children:i(`tree.loadingFiles`)})}):F&&d===`touched-by-ai`?(0,K.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center px-4 text-center gap-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`tree.emptyTouched`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>f(`all`),className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary/20 text-accent-primary hover:bg-accent-primary/30`,children:i(`tree.showAllFiles`)})]}):F?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-muted-foreground px-4 text-center`,children:i(`tree.noFiles`)}):(0,K.jsx)(`div`,{ref:O,className:`flex-1 overflow-auto`,"data-testid":`file-tree-scroller`,children:(0,K.jsx)(`div`,{style:{height:P.getTotalSize(),position:`relative`,width:`100%`},children:P.getVirtualItems().map(n=>{let r=k[n.index],o=Y(r.path)*12,c=r.kind===`file`&&r.path===t,l=r.provenance?.createdByTicketId,d=r.provenance?.modifiedByTicketIds??[],f=r.provenance?.latest??null,p=he(f?.jobId),g=ge(f?.kind),v=r.kind===`dir`,b=v&&h.has(r.path),C=r.provenance?.touchedFileCount??0;return(0,K.jsxs)(`div`,{style:{position:`absolute`,top:0,left:0,transform:`translateY(${n.start}px)`,height:n.size,width:`100%`},className:u(`flex items-center gap-2 px-2 text-xs cursor-pointer hover:bg-muted/50`,c&&`bg-muted text-foreground`),onClick:()=>{v?_(r.path):e(r.path)},role:`button`,tabIndex:0,"aria-expanded":v?!b:void 0,"data-testid":`file-tree-row-${r.path}`,children:[(0,K.jsxs)(`span`,{style:{paddingLeft:o},className:`flex items-center gap-1 min-w-0 flex-1`,children:[v?(0,K.jsxs)(K.Fragment,{children:[b?(0,K.jsx)(x,{className:`w-3 h-3 text-muted-foreground flex-shrink-0`}):(0,K.jsx)(S,{className:`w-3 h-3 text-muted-foreground flex-shrink-0`}),b?(0,K.jsx)(a,{className:`w-3.5 h-3.5 text-accent-info flex-shrink-0`}):(0,K.jsx)(m,{className:`w-3.5 h-3.5 text-accent-info flex-shrink-0`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`w-3 flex-shrink-0`}),(0,K.jsx)(j,{className:`w-3.5 h-3.5 text-muted-foreground flex-shrink-0`})]}),(0,K.jsx)(`span`,{className:`truncate ml-0.5`,children:me(r.path)})]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1 flex-shrink-0`,children:[v&&C>0&&(0,K.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted/60 text-muted-foreground`,title:i(`tree.folderTouched`,{count:C}),children:C}),!v&&g&&(0,K.jsx)(`span`,{className:u(`text-[10px] px-1.5 py-0.5 rounded`,f?.kind===`created`&&`bg-accent-success/15 text-accent-success`,f?.kind===`modified`&&`bg-accent-info/15 text-accent-info`,f?.kind===`deleted`&&`bg-destructive/15 text-destructive`),title:f?.kind===`created`?i(`tree.latestTitleCreated`):f?.kind===`deleted`?i(`tree.latestTitleDeleted`):i(`tree.latestTitleModified`),children:i(`action.${g}`)}),!v&&p&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-muted/60 text-muted-foreground font-mono`,title:i(`tree.jobTitle`,{jobId:f?.jobId??``}),children:[(0,K.jsx)(y,{className:`h-3 w-3`}),p]}),!v&&typeof l==`number`&&(0,K.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s(l)},className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success`,"data-testid":`provenance-chip-created-${l}`,title:i(`tree.createdBySpec`,{id:l}),children:[`#`,l]}),!v&&d.slice(0,2).map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(e)},className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info`,"data-testid":`provenance-chip-modified-${e}`,title:i(`tree.modifiedBySpec`,{id:e}),children:[`#`,e]},e))]})]},r.path)})})})]})}function ye(e){return new Worker(`/assets/editor.worker-Bd9IXS8d.js`,{name:e?.name})}function be(e){return new Worker(`/assets/json.worker-DzV-CpCQ.js`,{name:e?.name})}function xe(e){return new Worker(`/assets/css.worker-Wv5dxAWO.js`,{name:e?.name})}function Se(e){return new Worker(`/assets/html.worker-CQP8QQsS.js`,{name:e?.name})}function Ce(e){return new Worker(`/assets/ts.worker-METxwbDZ.js`,{name:e?.name})}var we=!1;function Te(e){let t=e.trim().match(/^hsl\(\s*([-\d.]+)[\s,]+([\d.]+)%[\s,]+([\d.]+)%\s*\)$/i);return t?[parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])]:null}function X(e,t=`#1e1e1e`){if(e.startsWith(`#`))return e;let n=Te(e);if(!n)return t;let[r,i,a]=n,o=i/100,s=a/100,c=(1-Math.abs(2*s-1))*o,l=(r%360+360)%360/60,u=c*(1-Math.abs(l%2-1)),d=0,f=0,p=0;l<1?(d=c,f=u):l<2?(d=u,f=c):l<3?(f=c,p=u):l<4?(f=u,p=c):l<5?(d=u,p=c):(d=c,p=u);let m=s-c/2,h=e=>Math.round((e+m)*255).toString(16).padStart(2,`0`);return`#${h(d)}${h(f)}${h(p)}`}function Ee(e){return`specrails-${e}`}function De(e,t){let n=Ee(t.id),r=t.xterm,i=X(r.background),a=X(r.foreground),o=X(r.brightBlack),s=X(r.magenta),c=X(r.yellow),l=X(r.cyan),u=X(r.blue),d=X(r.green),f=X(r.brightBlack),p=X(r.brightCyan),m=X(r.red),h=X(r.selectionBackground);return e.editor.defineTheme(n,{base:t.scheme===`light`?`vs`:`vs-dark`,inherit:!0,rules:[{token:``,foreground:a.slice(1)},{token:`comment`,foreground:f.slice(1),fontStyle:`italic`},{token:`keyword`,foreground:s.slice(1)},{token:`string`,foreground:c.slice(1)},{token:`number`,foreground:l.slice(1)},{token:`constant`,foreground:p.slice(1)},{token:`constant.numeric`,foreground:l.slice(1)},{token:`type`,foreground:d.slice(1)},{token:`type.identifier`,foreground:d.slice(1)},{token:`identifier`,foreground:a.slice(1)},{token:`function`,foreground:u.slice(1)},{token:`tag`,foreground:m.slice(1)},{token:`attribute.name`,foreground:p.slice(1)},{token:`attribute.value`,foreground:c.slice(1)},{token:`delimiter`,foreground:o.slice(1)},{token:`operator`,foreground:o.slice(1)}],colors:{"editor.background":i,"editor.foreground":a,"editorLineNumber.foreground":o,"editorLineNumber.activeForeground":a,"editorCursor.foreground":X(r.cursor),"editor.selectionBackground":h,"editor.inactiveSelectionBackground":h,"editor.lineHighlightBackground":X(r.black),"editor.lineHighlightBorder":X(r.black),"editorGutter.background":i,"editorWhitespace.foreground":o,"editorIndentGuide.background1":X(r.black),"editorIndentGuide.activeBackground1":o,"scrollbarSlider.background":`${o}55`,"scrollbarSlider.hoverBackground":`${o}88`,"scrollbarSlider.activeBackground":`${o}bb`,"minimap.background":i}}),n}function Oe(){we||=(self.MonacoEnvironment={getWorker(e,t){switch(t){case`json`:return new be;case`css`:case`scss`:case`less`:return new xe;case`html`:case`handlebars`:case`razor`:return new Se;case`typescript`:case`javascript`:return new Ce;default:return new ye}}},!0)}function ke({content:e,language:n,readOnly:r,onChange:i}){let{t:a}=p(`code`),o=k(),s=(0,N.useRef)(null),c=(0,N.useRef)(null),l=(0,N.useRef)(null),[u,d]=(0,N.useState)(!1),f=(0,N.useRef)(e),m=(0,N.useRef)(n),h=(0,N.useRef)(o),g=(0,N.useRef)(r),_=(0,N.useRef)(i);return(0,N.useEffect)(()=>{f.current=e},[e]),(0,N.useEffect)(()=>{m.current=n},[n]),(0,N.useEffect)(()=>{h.current=o},[o]),(0,N.useEffect)(()=>{g.current=r},[r]),(0,N.useEffect)(()=>{_.current=i},[i]),(0,N.useEffect)(()=>{let e=!1;return Oe(),t(()=>import(`./editor.main-G3Sl9C67.js`).then(t=>{if(e||!s.current)return;l.current=t;let n=De(t,h.current),r=t.editor.create(s.current,{value:f.current,language:m.current,readOnly:g.current,theme:n,minimap:{enabled:!1},lineNumbers:`on`,scrollBeyondLastLine:!1,automaticLayout:!0,fontSize:13});r.onDidChangeModelContent(()=>{_.current?.(r.getValue())}),c.current=r}),__vite__mapDeps([0,1,2,3,4,5,6])).catch(()=>{e||d(!0)}),()=>{e=!0,c.current?.dispose?.(),c.current=null}},[]),(0,N.useEffect)(()=>{let t=c.current;t&&t.getValue?.()!==e&&t.setValue?.(e)},[e]),(0,N.useEffect)(()=>{c.current?.updateOptions?.({readOnly:r})},[r]),(0,N.useEffect)(()=>{let e=l.current,t=c.current;if(!e||!t)return;let r=t.getModel?.();r&&e.editor.setModelLanguage(r,n)},[n]),(0,N.useEffect)(()=>{let e=l.current;if(!e)return;let t=De(e,o);e.editor.setTheme(t)},[o]),u?(0,K.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center gap-2 text-sm text-muted-foreground`,"data-testid":`monaco-load-error`,children:[(0,K.jsx)(`span`,{children:a(`monaco.loadFailed`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`rounded-md bg-accent-primary/15 px-3 py-1 text-xs text-accent-primary hover:bg-accent-primary/25`,children:a(`monaco.reload`)})]}):(0,K.jsx)(`div`,{ref:s,className:`w-full h-full`,"data-testid":`monaco-host`})}var Ae=(0,N.lazy)(async()=>({default:ke}));function je({content:e,language:t,readOnly:n=!0,onChange:r}){let{t:i}=p(`code`);return(0,K.jsx)(N.Suspense,{fallback:(0,K.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-sm text-muted-foreground animate-pulse`,children:i(`monaco.loadingEditor`)}),children:(0,K.jsx)(Ae,{content:e,language:t,readOnly:n,onChange:r})})}function Me(e,t){if(!e)return null;let n=Date.parse(e);if(Number.isNaN(n))return null;let r=Math.round((n-Date.now())/1e3),i=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),a=Math.abs(r);return a<60?i.format(r,`second`):a<3600?i.format(Math.round(r/60),`minute`):a<86400?i.format(Math.round(r/3600),`hour`):i.format(Math.round(r/86400),`day`)}function Ne({path:e,summary:t,stale:n,regenerating:r,generateDisabledReason:i,onCollapse:a}){let{t:o,i18n:s}=p(`code`),{openTicketDetail:l}=T();if(!t)return(0,K.jsx)(`div`,{className:`border-b border-border px-4 py-3 bg-surface`,"data-testid":`summary-header-empty`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0`,children:[(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:e}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i?o(`summary.unavailable`,{reason:i}):o(`summary.empty`)})]}),a&&(0,K.jsxs)(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,K.jsx)(c,{className:`h-3.5 w-3.5`}),o(`summary.hide`)]})]})});let d=Me(t.generatedAt,s.language),f=t.triggeredBy?.ticketId,m=t.triggeredBy?.modifiedTicketIds??[];return(0,K.jsx)(`div`,{className:`border-b border-border px-4 py-3 bg-surface`,"data-testid":`summary-header`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:e}),n&&(0,K.jsx)(`span`,{className:u(`text-[10px] px-1.5 py-0.5 rounded bg-accent-warning/20 text-accent-warning font-medium`),"data-testid":`summary-stale-badge`,children:o(`summary.stale`)}),r&&(0,K.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-accent-primary animate-pulse`,"aria-hidden":!0})]}),(0,K.jsx)(`p`,{className:`text-sm text-foreground mt-1`,children:t.summary}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mt-2 flex-wrap`,children:[typeof f==`number`&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(f),className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success`,children:[`#`,f]}),m.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(e),className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info`,children:[`#`,e]},e)),d&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:d})]})]}),a&&(0,K.jsxs)(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,K.jsx)(c,{className:`h-3.5 w-3.5`}),o(`summary.hide`)]})]})})}function Pe({content:e}){return(0,K.jsx)(r,{remarkPlugins:[v],children:e})}function Fe(e,t){return t===`markdown`||t===`md`?!0:/\.(md|mdx|markdown)$/i.test(e)}var Z=180,Ie=120,Le=240;function Re(e){return e?`specrails-desktop:code-summary-collapsed:${e}`:null}function ze(e){return e?`specrails-desktop:code-history-height:${e}`:null}function Be(e){return e?`specrails-desktop:code-history-collapsed:${e}`:null}function Ve(e){let t=ze(e);if(!t)return Z;try{let e=localStorage.getItem(t),n=e?Number(e):NaN;return Number.isFinite(n)&&n>0?n:Z}catch{return Z}}function He(e,t){let n=ze(e);if(n)try{localStorage.setItem(n,String(Math.round(t)))}catch{}}function Ue(e){let t=Re(e);if(!t)return!1;try{return localStorage.getItem(t)===`true`}catch{return!1}}function We(e,t){let n=Re(e);if(n)try{localStorage.setItem(n,t?`true`:`false`)}catch{}}function Ge(e){let t=Be(e);if(!t)return!1;try{return localStorage.getItem(t)===`true`}catch{return!1}}function Ke(e,t){let n=Be(e);if(n)try{localStorage.setItem(n,t?`true`:`false`)}catch{}}function qe(e,t){let n=Math.max(Ie,t-Le);return Math.min(Math.max(e,Ie),n)}function Je({relPath:e,onFilterJob:t,onSummaryActionChange:n,onCopyPathActionChange:r}){let{t:a}=p(`code`),{activeProjectId:o}=ee(),{openTicketDetail:l}=T(),{registerHandler:u,unregisterHandler:d}=te(),f=b({allowMove:!1}),m=(0,N.useRef)(null),[h,g]=(0,N.useState)(null),[_,v]=(0,N.useState)(!0),[y,x]=(0,N.useState)(!1),[C,w]=(0,N.useState)(!1),[E,O]=(0,N.useState)(()=>Ue(o)),[k,A]=(0,N.useState)(()=>Ve(o)),[j,M]=(0,N.useState)(()=>Ge(o)),P=(0,N.useRef)(o);(0,N.useEffect)(()=>{P.current=o},[o]);let F=(0,N.useRef)(e);(0,N.useEffect)(()=>{F.current=e},[e]),(0,N.useEffect)(()=>{let e=m.current?.clientHeight||window.innerHeight;O(Ue(o)),A(qe(Ve(o),e)),M(Ge(o))},[o]);let I=(0,N.useCallback)(e=>{let t=e.clientY,n=k,r=m.current?.clientHeight||window.innerHeight,i=e.currentTarget;try{i.setPointerCapture(e.pointerId)}catch{}function a(e){A(qe(n+(t-e.clientY),r))}function s(){window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),A(e=>{let t=qe(e,r);return He(o,t),t})}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},[o,k]),ne=(0,N.useCallback)(()=>{let e=qe(Z,m.current?.clientHeight||window.innerHeight);A(e),He(o,e)},[o]),re=(0,N.useCallback)(()=>{O(e=>{let t=!e;return We(o,t),t})},[o]),ie=(0,N.useCallback)(()=>{M(e=>{let t=!e;return Ke(o,t),t})},[o]);(0,N.useEffect)(()=>{x(!1),w(!1),V(`preview`),H(!1)},[e]);let L=(0,N.useRef)(0),R=(0,N.useCallback)(async()=>{let t=++L.current;v(!0);try{let n=await fetch(`${D()}/code/file?path=${encodeURIComponent(e)}`);if(t!==L.current)return;if(!n.ok){g(null);return}let r=await n.json();if(t!==L.current)return;g(r)}catch{t===L.current&&g(null)}finally{t===L.current&&v(!1)}},[e,o]);(0,N.useEffect)(()=>{R()},[R]),(0,N.useEffect)(()=>{if(!o)return;let e=`code-file-${o}`;return u(e,e=>{let t=e;t.projectId===P.current&&(t.type===`file.summary_updated`&&t.path===F.current?(x(!1),R()):t.type===`file.summary_failed`&&t.path===F.current?(i.error(t.reason??a(`summary.generationFailed`)),x(!1)):t.type===`file.summary_skipped`&&t.path===F.current&&(t.reason&&i(a(`summary.skipped`,{reason:t.reason})),x(!1)))}),()=>d(e)},[o,u,d,R,a]);let z=(0,N.useCallback)(async t=>{x(!0);try{let n=await fetch(`${D()}/code/file/regenerate-summary?path=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({overrideBudget:t})}),r=await n.json().catch(()=>({}));if(!n.ok){x(!1);let e=typeof r.skipped==`string`?r.skipped:null;i.error(e?a(`summary.skipped`,{reason:e}):a(`summary.generationFailed`));return}if(r.skipped===`budget`){x(!1),w(!0);return}if(r.skipped){x(!1),i(a(`summary.skipped`,{reason:r.skipped}));return}await R(),x(!1)}catch{x(!1),i.error(a(`summary.generationFailed`))}},[R,e,a]),ae=(0,N.useCallback)(async()=>{let t=h?.absolutePath??e;try{await navigator.clipboard?.writeText(t),i.success(a(`viewer.pathCopied`))}catch{i.error(a(`viewer.copyPathFailed`))}},[h,e,a]),oe=(0,N.useMemo)(()=>Fe(e,h?.language),[e,h?.language]),[B,V]=(0,N.useState)(`preview`),[se,H]=(0,N.useState)(!1),[U,ce]=(0,N.useState)(``),[W,le]=(0,N.useState)(!1),ue=h?.content!==void 0&&!h.binary&&!h.tooLarge&&h.reason!==`not-found`,de=(0,N.useCallback)(()=>{ce(h?.content??``),V(`raw`),H(!0)},[h]),fe=(0,N.useCallback)(async()=>{le(!0);try{let t=await fetch(`${D()}/code/file`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e,content:U})});if(!t.ok){let e=await t.json().catch(()=>({}));i.error(e.error??a(`viewer.saveFailed`));return}i.success(a(`viewer.saved`)),H(!1),R()}catch{i.error(a(`viewer.saveFailed`))}finally{le(!1)}},[e,U,a,R]),G=h?.summary??null,pe=!!h?.summaryStale,q=h?.provenance??[],J=h?.reason===`not-found`,Y=J?a(`summary.reason.missing`):h?.binary?a(`summary.reason.binary`):h?.tooLarge?a(`summary.reason.tooLarge`):null;return(0,N.useEffect)(()=>{if(n){if(_&&!h){n(null);return}return n({hasSummary:!!G,regenerating:y,disabledReason:Y,onClick:()=>z(!1)}),()=>n(null)}},[h,z,_,n,y,G,Y]),(0,N.useEffect)(()=>{if(r){if(_&&!h){r(null);return}return r({onClick:ae}),()=>r(null)}},[ae,h,_,r]),_&&!h?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted-foreground animate-pulse`,children:a(`viewer.loadingFile`)}):(0,K.jsxs)(`div`,{ref:m,className:`flex flex-col h-full`,"data-testid":`file-viewer`,children:[E?(0,K.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center justify-between border-b border-border bg-surface px-4`,"data-testid":`summary-header-collapsed`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e}),(0,K.jsxs)(`button`,{type:`button`,onClick:re,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,K.jsx)(S,{className:`h-3.5 w-3.5`}),a(`viewer.showSummary`)]})]}):(0,K.jsx)(Ne,{path:e,summary:G,stale:pe,regenerating:y,generateDisabledReason:Y,onCollapse:re}),(0,K.jsxs)(`div`,{className:`px-4 py-1 border-b border-border flex items-center justify-between gap-3`,children:[(0,K.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:oe&&h?.content!==void 0&&!h.binary&&!h.tooLarge&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px]`,role:`group`,"aria-label":a(`viewer.markdownViewMode`),children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>V(`preview`),"aria-pressed":B===`preview`,className:B===`preview`?`px-2 py-1 rounded-md bg-accent-primary/20 text-accent-primary`:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,children:a(`viewer.preview`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>V(`raw`),"aria-pressed":B===`raw`,className:B===`raw`?`px-2 py-1 rounded-md bg-accent-primary/20 text-accent-primary`:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,children:a(`viewer.raw`)})]})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] shrink-0`,children:[ue&&!se&&(0,K.jsx)(`button`,{type:`button`,onClick:de,className:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,children:a(`viewer.edit`)}),se&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>H(!1),disabled:W,className:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 disabled:opacity-50`,children:a(`actions.cancel`,{ns:`common`})}),(0,K.jsx)(`button`,{type:`button`,onClick:fe,disabled:W,className:`px-2 py-1 rounded-md bg-accent-primary/20 text-accent-primary hover:bg-accent-primary/30 disabled:opacity-50`,children:a(W?`viewer.saving`:`viewer.save`)})]})]})]}),(0,K.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:J?(0,K.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,"data-testid":`file-missing`,children:a(`viewer.missingFile`)}):h?.binary?(0,K.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,"data-testid":`file-binary`,children:a(`viewer.binaryFile`)}):h?.tooLarge?(0,K.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,"data-testid":`file-too-large`,children:a(`viewer.tooLarge`,{size:Math.round((h.sizeBytes??0)/1024/1024)})}):h?.content===void 0?(0,K.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,children:a(`viewer.noContent`)}):se?(0,K.jsx)(je,{content:U,language:h.language??`plaintext`,readOnly:!1,onChange:ce}):oe&&B===`preview`?(0,K.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4 prose prose-invert prose-sm max-w-none prose-p:my-2 prose-headings:mt-4 prose-headings:mb-2 prose-pre:bg-muted/40 prose-pre:rounded-md prose-code:before:content-none prose-code:after:content-none`,"data-testid":`markdown-preview`,children:(0,K.jsx)(Pe,{content:h.content})}):(0,K.jsx)(je,{content:h.content,language:h.language??`plaintext`})}),q.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a(`history.resize`),onPointerDown:j?void 0:I,onDoubleClick:j?void 0:ne,className:j?`flex h-8 shrink-0 items-center justify-between border-t border-border bg-card/35 px-4`:`flex h-8 shrink-0 cursor-row-resize items-center justify-between border-y border-border/40 bg-card/35 px-4 hover:bg-accent-primary/10`,title:j?void 0:a(`resizer.hint`),"data-testid":`code-history-resizer`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground`,children:a(`history.title`,{count:q.length})}),(0,K.jsxs)(`button`,{type:`button`,onPointerDown:e=>e.stopPropagation(),onClick:ie,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[j?(0,K.jsx)(c,{className:`h-3.5 w-3.5`}):(0,K.jsx)(S,{className:`h-3.5 w-3.5`}),a(j?`history.show`:`history.hide`)]})]}),!j&&(0,K.jsx)(Ye,{rows:q,onOpenTicket:l,onFilterJob:t,height:k})]}),C&&(0,K.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,role:`dialog`,"aria-modal":`true`,"data-testid":`budget-prompt`,onClick:f.guardBackdrop(()=>w(!1)),children:[(0,K.jsxs)(`div`,{ref:f.panelRef,onClick:e=>e.stopPropagation(),className:`bg-card border border-border rounded-lg p-4 w-80 flex flex-col gap-3`,style:f.panelStyle,children:[(0,K.jsx)(`p`,{className:`text-sm text-foreground`,children:a(`viewer.budgetPrompt`)}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>w(!1),className:`text-xs px-3 py-1.5 rounded-md text-muted-foreground hover:text-foreground`,children:a(`common:actions.cancel`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{w(!1),z(!0)},className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white`,children:a(`common:actions.confirm`)})]})]}),(0,K.jsx)(s,{handles:f.resizeHandles})]})]})}function Ye({rows:e,onOpenTicket:t,onFilterJob:r,height:i}){let{t:a}=p(`code`),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)({});if(e.length===0)return null;async function u(e,t){if(o===t){s(null);return}if(s(t),!(!e.jobId||c[t])){l(e=>({...e,[t]:`loading`}));try{let n=new URLSearchParams({jobId:e.jobId,path:e.path}),r=await fetch(`${D()}/code/diff?${n.toString()}`);if(r.status===404){l(e=>({...e,[t]:`missing`}));return}if(!r.ok)throw Error(`diff failed`);let i=await r.json();l(e=>({...e,[t]:{patch:i.patch??``,truncated:i.truncated===!0}}))}catch{l(e=>({...e,[t]:`missing`}))}}}return(0,K.jsx)(`div`,{className:`shrink-0 border-t border-border bg-card/40 px-4 py-3 overflow-hidden`,style:{height:i},"data-testid":`file-provenance-timeline`,children:(0,K.jsx)(`div`,{className:`h-full overflow-auto space-y-1`,children:e.map((e,i)=>{let s=e.kind===`created`?E:e.kind===`deleted`?f:n,l=e.jobId?e.jobId.length>12?e.jobId.slice(0,12):e.jobId:a(`history.unknownJob`),d=`${e.jobId??`job`}:${e.path}:${e.at}:${i}`,p=c[d];return(0,K.jsxs)(`div`,{className:`rounded-md hover:bg-muted/40`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-[minmax(72px,auto)_minmax(0,1fr)_auto] items-center gap-2 text-xs px-2 py-1.5`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 min-w-0`,children:[(0,K.jsx)(s,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,K.jsx)(`span`,{className:`capitalize`,children:a(`kind.${e.kind}`)})]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 min-w-0 text-muted-foreground`,children:[(0,K.jsx)(y,{className:`h-3.5 w-3.5 shrink-0`}),e.jobId&&r?(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(e.jobId),className:`font-mono truncate hover:text-foreground`,title:a(`history.filterByJob`,{jobId:e.jobId}),children:l}):(0,K.jsx)(`span`,{className:`font-mono truncate`,title:e.jobId??void 0,children:l}),e.jobId&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>u(e,d),className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground`,children:a(`history.diff`)}),typeof e.ticketId==`number`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(e.ticketId),className:`shrink-0 rounded bg-accent-primary/15 px-1.5 py-0.5 text-[10px] text-accent-primary hover:bg-accent-primary/25`,title:a(`history.openSpec`,{ticketId:e.ticketId}),children:a(`history.specChip`,{ticketId:e.ticketId})})]}),(0,K.jsx)(`time`,{className:`text-[11px] text-muted-foreground`,dateTime:new Date(e.at).toISOString(),children:new Date(e.at).toLocaleString()})]}),o===d&&(0,K.jsx)(`div`,{className:`px-2 pb-2`,children:p===`loading`?(0,K.jsx)(`div`,{className:`rounded-md bg-muted/35 px-2 py-2 text-[11px] text-muted-foreground`,children:a(`history.loadingDiff`)}):p===`missing`||!p?(0,K.jsx)(`div`,{className:`rounded-md bg-muted/35 px-2 py-2 text-[11px] text-muted-foreground`,children:a(`history.diffUnavailable`)}):(0,K.jsxs)(`pre`,{className:`max-h-72 overflow-auto rounded-md bg-muted/50 px-2 py-2 font-mono text-[11px] leading-relaxed text-foreground/85`,children:[p.patch,p.truncated?`\n${a(`history.diffTruncated`)}`:``]})})]},d)})})})}var Q=320,Xe=240,Ze=520;function Qe(e){return e?`specrails-desktop:code-tree-width:${e}`:null}function $e(e){let t=Qe(e);if(!t)return Q;try{let e=localStorage.getItem(t),n=e?Number(e):NaN;return Number.isFinite(n)&&n>0?n:Q}catch{return Q}}function et(e,t){let n=Qe(e);if(n)try{localStorage.setItem(n,String(Math.round(t)))}catch{}}function $(e,t){let n=Math.max(Xe,t-Ze);return Math.min(Math.max(e,Xe),n)}function tt({embedded:e=!1,initialPath:t=null,onSelectedPathChange:n}={}){let{t:r}=p(`code`),{activeProjectId:i}=ee(),[a]=h(),o=d(),s=(0,N.useRef)(null),[c,l]=(0,N.useState)(e?t:a.get(`path`)),u=(0,N.useCallback)(e=>{l(e),n?.(e)},[n]),[f,m]=(0,N.useState)(null),[g,_]=(0,N.useState)(null),[v,y]=(0,N.useState)(()=>$e(i)),[b,x]=(0,N.useState)(null),[S,C]=(0,N.useState)(null),w=e?b:a.get(`jobId`),T=(0,N.useMemo)(()=>{if(e)return S;let t=a.get(`ticketId`);if(!t)return null;let n=Number(t);return Number.isInteger(n)&&n>0?n:null},[e,S,a]),[te,E]=(0,N.useState)(T==null?``:String(T));(0,N.useEffect)(()=>{if(e)return;let t=a.get(`path`);t!==c&&l(t)},[a,e]),(0,N.useEffect)(()=>{E(T==null?``:String(T))},[T]),(0,N.useEffect)(()=>{let e=s.current?.clientWidth||window.innerWidth;y($($e(i),e))},[i]),(0,N.useEffect)(()=>{let e=s.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;typeof t==`number`&&y(e=>$(e,t))});return t.observe(e),()=>t.disconnect()},[]);let D=(0,N.useCallback)(e=>{let t=e.clientX,n=v,r=s.current?.clientWidth||window.innerWidth,a=e.currentTarget;try{a.setPointerCapture(e.pointerId)}catch{}function o(e){y($(n+(e.clientX-t),r))}function c(){window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),y(e=>{let t=$(e,r);return et(i,t),t})}window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[i,v]),O=(0,N.useCallback)(()=>{let e=$(Q,s.current?.clientWidth||window.innerWidth);y(e),et(i,e)},[i]),k=(0,N.useCallback)(t=>{if(u(t),e)return;let n=new URLSearchParams(a);n.set(`path`,t),o({pathname:`/code`,search:`?${n.toString()}`},{replace:!0})},[e,o,a,u]),A=(0,N.useCallback)(t=>{if(e){x(t),C(null);return}let n=new URLSearchParams(a);n.set(`jobId`,t),n.delete(`ticketId`),o({pathname:`/code`,search:`?${n.toString()}`},{replace:!0})},[e,o,a]),j=(0,N.useCallback)(()=>{if(e){x(null),C(null);return}let t=new URLSearchParams(a);t.delete(`jobId`),t.delete(`ticketId`),o({pathname:`/code`,search:t.toString()?`?${t.toString()}`:``},{replace:!0})},[e,o,a]),M=(0,N.useCallback)(t=>{let n=Number(t.trim());if(!Number.isInteger(n)||n<=0){j();return}if(e){C(n),x(null);return}let r=new URLSearchParams(a);r.set(`ticketId`,String(n)),r.delete(`jobId`),o({pathname:`/code`,search:`?${r.toString()}`},{replace:!0})},[j,e,o,a]);return(0,K.jsxs)(`div`,{ref:s,className:`flex h-full w-full`,"data-testid":`code-page`,children:[(0,K.jsx)(`aside`,{className:`overflow-hidden flex flex-col shrink-0`,style:{width:v},children:(0,K.jsx)(ve,{onOpenFile:k,selectedPath:c,filterJobId:w,filterTicketId:T},i??`no-project`)}),(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":r(`page.resizeFileTree`),onPointerDown:D,onDoubleClick:O,className:`relative w-1.5 shrink-0 cursor-col-resize select-none touch-none border-x border-border/40 hover:bg-accent-primary/20 focus-visible:outline-none focus-visible:bg-accent-primary/30`,title:r(`resizer.hint`),"data-testid":`code-tree-resizer`}),(0,K.jsxs)(`main`,{className:`flex-1 overflow-hidden flex flex-col`,children:[(0,K.jsx)(nt,{jobId:w,ticketId:T,ticketInput:te,onTicketInputChange:E,onApplyTicket:M,onClear:j,summaryAction:f,copyPathAction:g}),(w||T)&&(0,K.jsx)(rt,{jobId:w,ticketId:T,onOpenFile:k}),c?(0,K.jsx)(Je,{relPath:c,onFilterJob:A,onSummaryActionChange:m,onCopyPathActionChange:_}):(0,K.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,children:r(`page.selectFile`)})]})]})}function nt({jobId:e,ticketId:t,ticketInput:n,onTicketInputChange:r,onApplyTicket:i,onClear:a,summaryAction:o,copyPathAction:s}){let{t:c}=p(`code`),l=t?`spec`:e?`job-context`:`all`;return(0,K.jsx)(`div`,{className:`border-b border-border bg-background/80 px-4 py-2`,"data-testid":`code-provenance-toolbar`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,K.jsx)(M,{className:`h-3.5 w-3.5`}),c(`toolbar.scope`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:a,"aria-pressed":l===`all`,className:l===`all`?`rounded-md bg-accent-primary/20 px-2 py-1 text-xs text-accent-primary`:`rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:c(`toolbar.allAi`)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border/70 bg-card/40 px-1 py-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(n),"aria-pressed":l===`spec`,className:l===`spec`?`rounded bg-accent-success/20 px-2 py-0.5 text-xs text-accent-success`:`rounded px-2 py-0.5 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:c(`toolbar.spec`)}),(0,K.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i(n)},placeholder:c(`toolbar.ticketIdPlaceholder`),inputMode:`numeric`,className:`h-6 w-20 bg-transparent px-1 font-mono text-xs outline-none placeholder:text-muted-foreground/60`})]}),(0,K.jsx)(`div`,{className:`flex-1`}),s&&(0,K.jsx)(`button`,{type:`button`,onClick:s.onClick,className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:c(`toolbar.copyFilePath`)}),o&&(0,K.jsxs)(`button`,{type:`button`,onClick:o.onClick,disabled:o.regenerating||!!o.disabledReason,"aria-label":o.hasSummary?c(`toolbar.regenerateSummary`):c(`toolbar.generateSummary`),className:`inline-flex items-center gap-1.5 rounded-md bg-accent-primary/15 px-2.5 py-1 text-xs text-accent-primary hover:bg-accent-primary/25 disabled:opacity-50`,title:o.disabledReason?c(`toolbar.summaryUnavailable`,{reason:o.disabledReason}):void 0,children:[(0,K.jsx)(w,{className:o.regenerating?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),o.hasSummary?o.regenerating?c(`toolbar.regenerating`):c(`toolbar.regenerateSummary`):o.regenerating?c(`toolbar.generating`):c(`toolbar.generateSummary`)]}),l===`job-context`&&(0,K.jsx)(`span`,{className:`rounded-md bg-accent-info/15 px-2 py-1 text-xs text-accent-info`,children:c(`toolbar.jobContext`)}),(e||t)&&(0,K.jsxs)(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,K.jsx)(C,{className:`h-3.5 w-3.5`}),c(`toolbar.clear`)]})]})})}function rt({jobId:e,ticketId:t,onOpenFile:n}){let{t:r}=p(`code`),[i,a]=(0,N.useState)(null);(0,N.useEffect)(()=>{let n=!1,r=new URLSearchParams;return e&&r.set(`jobId`,e),t&&r.set(`ticketId`,String(t)),fetch(`${D()}/code/provenance?${r.toString()}`).then(e=>e.ok?e.json():[]).then(e=>{n||a(Array.isArray(e)?e:[])}).catch(()=>{n||a([])}),()=>{n=!0}},[e,t]);let o=(0,N.useMemo)(()=>{let e=i??[];return{created:e.filter(e=>e.kind===`created`),modified:e.filter(e=>e.kind===`modified`),deleted:e.filter(e=>e.kind===`deleted`)}},[i]),s=i?.length??0;return(0,K.jsx)(`section`,{className:`border-b border-border bg-card/35 px-4 py-3`,"data-testid":`provenance-result-panel`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold truncate`,children:e?r(`provenancePanel.jobTitle`,{jobId:e}):r(`provenancePanel.specTitle`,{ticketId:t})}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:r(`provenancePanel.touchedFiles`,{count:s})})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,K.jsx)(it,{label:r(`action.added`),rows:o.created,icon:`created`,onOpenFile:n}),(0,K.jsx)(it,{label:r(`action.changed`),rows:o.modified,icon:`modified`,onOpenFile:n}),(0,K.jsx)(it,{label:r(`action.deleted`),rows:o.deleted,icon:`deleted`,onOpenFile:n})]})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-1 shrink-0`,children:e&&(0,K.jsxs)(`a`,{href:`/jobs/${encodeURIComponent(e)}`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,K.jsx)(g,{className:`h-3.5 w-3.5`}),r(`provenancePanel.log`)]})})]})})}function it({label:e,rows:t,icon:r,onOpenFile:i}){return(0,K.jsxs)(`details`,{className:`group min-w-[180px] max-w-[320px]`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1.5 rounded-md bg-muted/35 px-2 py-1 text-xs hover:bg-muted/55`,children:[(0,K.jsx)(r===`created`?E:r===`deleted`?f:n,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,K.jsx)(`span`,{children:e}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:t.length})]}),t.length>0&&(0,K.jsx)(`div`,{className:`mt-1 max-h-28 overflow-auto rounded-md border border-border/60 bg-background/60 p-1`,children:t.map((e,t)=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(e.path),className:`block w-full truncate rounded px-1.5 py-1 text-left font-mono text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,title:e.path,children:e.path},`${e.path}-${e.jobId??`job`}-${e.at}-${t}`))})]})}export{tt as default};
@@ -1,11 +0,0 @@
1
- import{a as e}from"./chunk-BNv3lrIs.js";import{At as t,C as n,In as r,J as i,Kt as a,Mn as o,Nn as s,On as c,S as l,Ut as u,jn as d,pn as f,yt as p}from"./index-BeujshsU.js";import{t as m}from"./lib-CfphudAm.js";import{t as h}from"./atom-one-dark-BrRN8wBy.js";var g=e(r(),1),_=f();function v({categories:e,activeCategory:n,activeSlug:r}){let{t:o}=c(`integrations`);return(0,_.jsxs)(`nav`,{className:`w-56 flex-shrink-0 border-r border-border overflow-y-auto py-4 px-3 space-y-4`,children:[(0,_.jsxs)(d,{to:`/docs`,className:i(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,!n&&!r?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,_.jsx)(a,{className:`w-3.5 h-3.5 shrink-0`}),(0,_.jsx)(`span`,{className:`truncate`,children:o(`docs.title`)})]}),e.map(e=>(0,_.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,_.jsxs)(`div`,{className:`px-2.5 mb-1 flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e.name}),e.docs.length>0&&(0,_.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground/60 bg-muted/40 rounded px-1 py-0.5 leading-none`,children:e.docs.length})]}),e.docs.length===0?(0,_.jsx)(`p`,{className:`px-2.5 text-xs text-muted-foreground italic`,children:o(`docs.sidebarEmpty`)}):(0,_.jsx)(`ul`,{className:`space-y-0.5`,children:e.docs.map(a=>{let o=n===e.slug&&r===a.slug;return(0,_.jsx)(`li`,{children:(0,_.jsxs)(d,{to:`/docs/${e.slug}/${a.slug}`,title:a.title,className:i(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,o?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,_.jsx)(t,{className:`w-3.5 h-3.5 shrink-0`}),(0,_.jsx)(`span`,{className:`truncate`,children:a.title})]})},a.slug)})})]},e.slug))]})}function y({categories:e}){let{t:n}=c(`integrations`),r=e.reduce((e,t)=>e+t.docs.length,0),i=e.filter(e=>e.docs.length>0).length;return(0,_.jsxs)(`div`,{className:`max-w-2xl mx-auto py-8 px-6 space-y-5`,children:[(0,_.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,_.jsx)(a,{className:`w-4 h-4`}),n(`docs.title`)]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r===0?n(`docs.indexEmpty`):n(`docs.summary`,{documents:n(`docs.documentCount`,{count:r}),categories:n(`docs.categoryCount`,{count:i})})})]}),e.map(e=>(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsx)(`h2`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e.name}),e.docs.length===0?(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground italic pl-2`,children:n(`docs.categoryEmpty`)}):(0,_.jsx)(`ul`,{className:`space-y-2`,children:e.docs.map(n=>(0,_.jsx)(`li`,{children:(0,_.jsxs)(d,{to:`/docs/${e.slug}/${n.slug}`,className:`flex items-center gap-3 p-2.5 rounded-md border border-border transition-colors hover:bg-muted/40 group`,children:[(0,_.jsx)(t,{className:`w-3.5 h-3.5 text-muted-foreground flex-shrink-0`}),(0,_.jsx)(`span`,{className:`text-xs font-medium text-foreground truncate`,children:n.title}),(0,_.jsx)(u,{className:`w-3 h-3 text-muted-foreground ml-auto md:opacity-0 md:group-hover:opacity-100 transition-opacity`})]})},n.slug))})]},e.slug))]})}var b=(0,g.memo)(function({content:e,currentCategory:t,onNavigateDoc:r}){return(0,_.jsx)(n,{remarkPlugins:[l],rehypePlugins:[m],components:{a({href:e,children:n,...i}){return(0,_.jsx)(`a`,{href:e,onClick:n=>{if(!e)return;if(/^[a-z][a-z0-9+.-]*:/i.test(e)){n.preventDefault(),window.open(e,`_blank`,`noopener,noreferrer`);return}if(e.startsWith(`#`))return;n.preventDefault();let i=h(e,t);i&&r(i.category,i.slug)},...i,children:n})}},children:e})});function x({category:e,slug:t,lang:n,scrollContainerRef:r}){let{t:i}=c(`integrations`),[a,s]=(0,g.useState)(null),[l,u]=(0,g.useState)(null),d=(0,g.useRef)(0),f=o();return(0,g.useEffect)(()=>{let a=++d.current;u(null),fetch(`/api/docs/${e}/${t}?lang=${encodeURIComponent(n)}`).then(async e=>{if(e.status===404){f(`/docs`,{replace:!0});return}if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{a===d.current&&e&&(s(e),r.current&&(r.current.scrollTop=0))}).catch(e=>{a===d.current&&u(e instanceof Error?e.message:i(`docs.loadError`))})},[e,t,n,f,r]),!a&&!l?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,_.jsx)(p,{className:`w-4 h-4 animate-spin text-muted-foreground`})}):l&&!a?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,_.jsx)(`p`,{className:`text-sm text-destructive`,children:l})}):a?(0,_.jsx)(`article`,{className:`max-w-2xl mx-auto py-8 px-6`,children:(0,_.jsx)(`div`,{className:`prose prose-sm max-w-none
2
- prose-headings:text-foreground prose-headings:font-bold
3
- prose-p:text-foreground/90
4
- prose-a:text-accent-primary prose-a:no-underline hover:prose-a:underline
5
- prose-strong:text-foreground
6
- prose-code:text-accent-info prose-code:bg-card prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-xs
7
- prose-pre:bg-card prose-pre:border prose-pre:border-border prose-pre:rounded-md prose-pre:p-0 prose-pre:overflow-x-auto
8
- prose-blockquote:border-l-accent-primary prose-blockquote:text-muted-foreground
9
- prose-hr:border-border
10
- prose-th:text-foreground prose-td:text-foreground/90
11
- prose-li:text-foreground/90`,children:(0,_.jsx)(b,{content:a.content,currentCategory:a.category,onNavigateDoc:(e,t)=>f(`/docs/${e}/${t}`)})})}):null}function S(){let{category:e,slug:t}=s(),{i18n:n}=c(`integrations`),r=n.language||`en`,[i,a]=(0,g.useState)(null),[o,l]=(0,g.useState)(!0),u=(0,g.useRef)(null);(0,g.useEffect)(()=>{fetch(`/api/docs?lang=${encodeURIComponent(r)}`).then(e=>e.json()).then(e=>a(e)).catch(()=>a({categories:[]})).finally(()=>l(!1))},[r]);let d=!!(e&&t);return(0,_.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[o?(0,_.jsx)(`div`,{className:`w-56 flex-shrink-0 border-r border-border flex items-center justify-center`,children:(0,_.jsx)(p,{className:`w-3.5 h-3.5 animate-spin text-muted-foreground`})}):(0,_.jsx)(v,{categories:i?.categories??[],activeCategory:e,activeSlug:t}),(0,_.jsx)(`main`,{ref:u,className:`flex-1 overflow-y-auto`,children:d&&e&&t?(0,_.jsx)(x,{category:e,slug:t,lang:r,scrollContainerRef:u}):i&&(0,_.jsx)(y,{categories:i.categories})})]})}export{S as default};
@@ -1,3 +0,0 @@
1
- import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,$t as n,An as r,B as i,Bt as a,Dn as o,F as s,Ft as c,H as l,I as u,In as d,L as f,On as p,P as m,Q as h,U as g,V as _,dt as v,en as y,fn as b,i as x,mn as S,pn as C,pt as w,q as T,tn as E,yt as D,zt as O}from"./index-BeujshsU.js";var k=e(d(),1),A=C(),j=[`todo`,`in_progress`,`done`,`cancelled`],M={todo:`todo`,in_progress:`inProgress`,done:`done`,cancelled:`cancelled`};function N({state:e,onChanged:t}){let{t:n}=p(`jira`),r=e.connection,[i,a]=(0,k.useState)(r.enabled),[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)([]),[h,g]=(0,k.useState)([]),[_,v]=(0,k.useState)(r.discardStatus??``),[y,b]=(0,k.useState)(r.statusMap??{}),x=e.outbox??{pending:0,inflight:0,done:0,dead:0},S=(0,k.useCallback)(async()=>{try{let{ops:e}=await m.listOutbox(`dead`);f(e)}catch{f([])}},[]);(0,k.useEffect)(()=>{S()},[S]),(0,k.useEffect)(()=>{let e=!1;return m.listStatuses().then(({statuses:t})=>{e||g(t)}).catch(()=>{e||g([])}),()=>{e=!0}},[]);async function C(e){let r=_;v(e);try{await m.patchConnection({discardStatus:e||null}),t()}catch(e){v(r),o.error(F(e,n))}}async function w(e,r){let i=y,a={...y,[e]:r||void 0};b(a);let s=Object.fromEntries(Object.entries(a).filter(([,e])=>e));try{await m.patchConnection({statusMap:Object.keys(s).length?s:null}),t()}catch(e){b(i),o.error(F(e,n))}}async function E(){let e=!i;a(e),u(!0);try{await m.setEnabled(e)}catch(t){a(!e),o.error(F(t,n))}finally{u(!1)}}async function D(){c(!0);try{let e=await m.syncNow();o.success(n(`status.syncedToast`,{count:e.upserted}))}catch(e){o.error(F(e,n))}finally{c(!1)}}async function O(){if(window.confirm(n(`status.disconnectConfirm`))){u(!0);try{await m.disconnect(),o.success(n(`status.disconnectedToast`)),t()}catch(e){o.error(F(e,n))}finally{u(!1)}}}async function N(e){try{await m.retryOutbox(e),await S()}catch(e){o.error(F(e,n))}}let I=x.pending+x.inflight;return(0,A.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:n(`status.connected`,{key:r.jiraProjectKey})}),(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r.baseUrl,` · `,r.deployment===`cloud`?n(`review.cloud`):n(`review.dc`)]})]}),(0,A.jsx)(`a`,{href:`${r.baseUrl}/browse/${r.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:n(`badge.openInJira`)})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:n(`status.enabledLabel`)}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(i?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,A.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":i,"aria-label":n(`status.enabledLabel`),disabled:l,onClick:E,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${i?`bg-accent-success`:`bg-input`}`,children:(0,A.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${i?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,A.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:n(`wizard.step3Title`)}),(0,A.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:n(`mapping.intro`)}),(0,A.jsx)(`div`,{className:`space-y-2`,children:j.map(e=>(0,A.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`mapping.${M[e]}`)}),(0,A.jsxs)(`select`,{value:y[e]??``,onChange:t=>void w(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,A.jsx)(`option`,{value:``,children:n(`mapping.auto`)}),h.map(e=>(0,A.jsx)(`option`,{value:e.name,children:e.name},e.id)),y[e]&&!h.some(t=>t.name===y[e])&&(0,A.jsx)(`option`,{value:y[e],children:y[e]})]})]},e))})]}),(0,A.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:n(`discard.configLabel`)}),(0,A.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:n(`discard.configHelp`)}),(0,A.jsxs)(`select`,{value:_,onChange:e=>void C(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,A.jsx)(`option`,{value:``,children:n(`discard.configNone`)}),h.map(e=>(0,A.jsx)(`option`,{value:e.name,children:e.name},e.id)),_&&!h.some(e=>e.name===_)&&(0,A.jsx)(`option`,{value:_,children:_})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(T,{variant:`outline`,size:`sm`,onClick:D,disabled:s,children:n(s?`status.syncing`:`status.syncNow`)}),(0,A.jsx)(T,{variant:`ghost`,size:`sm`,onClick:O,disabled:l,className:`text-destructive`,children:n(`status.disconnect`)})]}),(0,A.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:n(`outbox.title`)}),x.dead>0?(0,A.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:n(`outbox.dead`,{count:x.dead})}):I>0?(0,A.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`outbox.pending`,{count:I})}):(0,A.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`outbox.allSynced`)}),d.length>0&&(0,A.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`outbox.deadHelp`)}),d.map(e=>(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,A.jsxs)(`span`,{className:`truncate text-xs`,children:[P(e,n),` · `,e.deadReason??e.lastError??``]}),(0,A.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>N(e.id),children:n(`outbox.retry`)})]},e.id))]})]})]})}function P(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function F(e,t){return e instanceof Error?e.message:t(`errors.generic`)}function I({activeProjectId:e}){let{t}=p(`integrations`),[n,r]=(0,k.useState)(null),[o,c]=(0,k.useState)(!0),[l,d]=(0,k.useState)(!1),[h,g]=(0,k.useState)(!1),v=(0,k.useCallback)(async()=>{try{r(await m.getConnection())}catch{r({connected:!1})}finally{c(!1)}},[]);if((0,k.useEffect)(()=>{!s||!e||(c(!0),v())},[e,v]),!s)return null;let y=!!(n?.connected&&n.connection);return(0,A.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 flex flex-col gap-3 h-full`,"data-testid":`jira-integration-card`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(`div`,{className:`grid place-items-center w-9 h-9 rounded-md bg-accent-info/15 text-accent-info shrink-0`,children:(0,A.jsx)(w,{className:`w-4 h-4`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold`,children:t(`jiraCard.title`)}),y&&(0,A.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success flex items-center gap-1`,"data-testid":`jira-connected-badge`,children:[(0,A.jsx)(a,{className:`w-3 h-3`}),` `,t(`jiraCard.connected`)]})]}),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:t(`jiraCard.category`)})]})]}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:y&&n?.connection?t(`jiraCard.connectedDescription`,{key:n.connection.jiraProjectKey}):t(`jiraCard.description`)}),(0,A.jsxs)(`ul`,{className:`text-xs space-y-1 list-disc pl-4 text-foreground/80`,children:[(0,A.jsx)(`li`,{children:t(`jiraCard.bullet1`)}),(0,A.jsx)(`li`,{children:t(`jiraCard.bullet2`)}),(0,A.jsx)(`li`,{children:t(`jiraCard.bullet3`)})]}),(0,A.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`jiraCard.requires`)}),(0,A.jsx)(`div`,{className:`mt-auto pt-2 flex items-center justify-end gap-2`,children:o?(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`…`}):y?(0,A.jsx)(`button`,{type:`button`,onClick:()=>g(!0),"data-testid":`jira-manage-btn`,className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-muted/30 inline-flex items-center gap-1.5`,children:t(`jiraCard.manage`)}):(0,A.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),"data-testid":`jira-connect-btn`,className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white hover:opacity-90 inline-flex items-center gap-1.5`,children:[(0,A.jsx)(w,{className:`w-3.5 h-3.5`}),t(`jiraCard.connect`)]})}),(0,A.jsx)(u,{open:l,onOpenChange:d,children:(0,A.jsxs)(f,{className:`max-w-lg`,children:[(0,A.jsx)(i,{children:(0,A.jsx)(_,{children:t(`jiraCard.modalTitle`)})}),(0,A.jsx)(x,{onConnected:()=>{d(!1),v()},onSkip:()=>d(!1)})]})}),(0,A.jsx)(u,{open:h,onOpenChange:g,children:(0,A.jsxs)(f,{className:`max-w-lg`,children:[(0,A.jsx)(i,{children:(0,A.jsx)(_,{children:t(`jiraCard.manageTitle`)})}),n?.connected&&n.connection&&(0,A.jsx)(N,{state:n,onChanged:()=>{v().then(()=>g(!1))}})]})})]})}function L(){let{t:e}=p(`integrations`),{activeProjectId:t,projects:r}=y(),i=r.find(e=>e.id===t),a=i?n(i).includes(`claude`):!0,{registerHandler:o,unregisterHandler:c}=b(),l=(0,k.useRef)(t);(0,k.useEffect)(()=>{l.current=t},[t]);let[u,d]=(0,k.useState)(null),[f,m]=(0,k.useState)(null),{data:g,isLoading:_,isFirstLoad:x,refresh:C}=E({namespace:`plugins`,projectId:t,initialValue:[],fetcher:(0,k.useCallback)(async()=>{let e=await fetch(`${S()}/plugins`);if(!e.ok)throw Error(`HTTP ${e.status}`);return(await e.json()).plugins??[]},[])});(0,k.useEffect)(()=>(o(`integrations-page`,e=>{let t=e;t.type&&(t.projectId&&t.projectId!==l.current||t.type.startsWith(`plugin.`)&&C())}),()=>c(`integrations-page`)),[o,c,C]),(0,k.useEffect)(()=>{d(!_&&!g?`Failed to load plugins`:null)},[_,g]);let w=(0,k.useMemo)(()=>(g??[]).filter(e=>e.status!==`orphan`),[g]),T=(0,k.useMemo)(()=>(g??[]).filter(e=>e.status===`orphan`),[g]);return t?(0,A.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,A.jsxs)(`div`,{className:`flex-shrink-0 border-b border-border px-6 pt-4 pb-3 flex items-center gap-2`,children:[(0,A.jsx)(v,{className:`w-4 h-4 text-accent-primary`}),(0,A.jsxs)(`div`,{className:`flex-1`,children:[(0,A.jsx)(`h1`,{className:`text-lg font-semibold`,children:e(`page.title`)}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`page.subtitle`)})]})]}),(0,A.jsx)(`div`,{className:`flex-1 overflow-auto p-6`,children:x&&_?(0,A.jsx)(q,{}):u&&a?(0,A.jsx)(J,{onRetry:C}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[(0,A.jsx)(I,{activeProjectId:t}),a&&w.map(e=>(0,A.jsx)(R,{plugin:e,isInstalling:f===e.name,onInstall:()=>m(e.name),onCloseInstall:()=>{m(null),C()}},e.name))]}),a&&T.length>0&&(0,A.jsxs)(`div`,{className:`mt-10`,children:[(0,A.jsxs)(`h2`,{className:`text-sm font-semibold text-muted-foreground mb-3 flex items-center gap-2`,children:[(0,A.jsx)(h,{className:`w-3.5 h-3.5`}),` `,e(`page.deprecated`)]}),(0,A.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:T.map(e=>(0,A.jsx)(U,{plugin:e,onRemoved:C},e.name))})]}),!s&&(!a||w.length===0)&&(0,A.jsx)(Y,{})]})})]}):(0,A.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground text-sm`,children:e(`page.selectProject`)})}function R({plugin:e,isInstalling:n,onInstall:i,onCloseInstall:o}){let{t:s}=p(`integrations`),[l,u]=(0,k.useState)(!1);return(0,A.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 flex flex-col gap-3 h-full`,children:[(0,A.jsx)(`div`,{className:`flex items-start gap-2`,children:(0,A.jsxs)(`div`,{className:`flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),(0,A.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:[`v`,e.version]}),e.status===`installed`&&(0,A.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success flex items-center gap-1`,children:[(0,A.jsx)(a,{className:`w-3 h-3`}),` `,s(`card.statusActive`)]}),e.status===`deactivated`&&(0,A.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1`,children:[(0,A.jsx)(O,{className:`w-3 h-3`}),` `,s(`card.statusDeactivated`)]}),e.status===`degraded`&&(0,A.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-warning/20 text-accent-warning flex items-center gap-1`,children:[(0,A.jsx)(h,{className:`w-3 h-3`}),` `,s(`card.statusDegraded`)]}),e.updateAvailable&&(0,A.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-info/20 text-accent-info flex items-center gap-1`,children:[(0,A.jsx)(c,{className:`w-3 h-3`}),` `,s(`card.updateAvailable`)]})]}),e.category&&(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:e.category})]})}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:e.description}),e.whatItDoes.length>0&&(0,A.jsx)(`ul`,{className:`text-xs space-y-1 list-disc pl-4 text-foreground/80`,children:e.whatItDoes.map((e,t)=>(0,A.jsx)(`li`,{children:e},t))}),e.requirements.length>0&&(0,A.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:s(`card.requires`,{list:e.requirements.map(e=>`${e.name}${e.minVersion?` ≥ ${e.minVersion}`:``}`).join(`, `)})}),e.healthReason&&e.status===`degraded`&&(0,A.jsx)(`div`,{className:`text-[11px] text-accent-warning`,children:e.healthReason}),e.status===`deactivated`&&(0,A.jsx)(`div`,{className:`text-[11px] text-muted-foreground leading-relaxed`,children:(0,A.jsx)(r,{t:s,i18nKey:`card.deactivatedHint`,components:{strong:(0,A.jsx)(`strong`,{})}})}),e.marketplaceConflicts&&e.marketplaceConflicts.length>0&&(0,A.jsx)(H,{pluginName:e.name,conflicts:e.marketplaceConflicts}),e.marketplaceCachedButDisabled&&e.marketplaceCachedButDisabled.length>0&&(0,A.jsx)(B,{keys:e.marketplaceCachedButDisabled}),e.updateAvailable&&(0,A.jsx)(V,{pluginName:e.name}),(0,A.jsx)(`div`,{className:`mt-auto pt-2 flex items-center justify-end gap-2`,children:e.status===`not-installed`?(0,A.jsx)(`button`,{type:`button`,onClick:i,className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white hover:opacity-90`,children:s(`card.install`)}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(z,{pluginName:e.name,active:e.status===`installed`}),(0,A.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-destructive/10 hover:text-destructive flex items-center gap-1.5`,children:[(0,A.jsx)(t,{className:`w-3 h-3`}),` `,s(`card.uninstall`)]})]})}),n&&(0,A.jsx)(W,{pluginName:e.name,onClose:o}),l&&(0,A.jsx)(G,{pluginName:e.name,onClose:()=>u(!1),onUninstalled:()=>{u(!1)}})]})}function z({pluginName:e,active:t}){let{t:n}=p(`integrations`),[r,i]=(0,k.useState)(!1),[a,o]=(0,k.useState)(null);return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,A.jsx)(`button`,{type:`button`,disabled:r,onClick:async()=>{i(!0),o(null);try{let n=`${S()}/plugins/${e}/${t?`deactivate`:`activate`}`,r=await fetch(n,{method:`POST`});if(!r.ok)throw Error((await r.json()).error??`HTTP ${r.status}`)}catch(e){o(e.message)}finally{i(!1)}},role:`switch`,"aria-checked":t,className:`relative inline-flex items-center h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${t?`bg-accent-success`:`bg-muted`}`,title:n(t?`toggle.titleActive`:`toggle.titleDeactivated`),children:(0,A.jsx)(`span`,{className:`inline-block h-4 w-4 rounded-full bg-white shadow transition-transform ${t?`translate-x-4`:`translate-x-0.5`}`})}),(0,A.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:n(t?`card.statusActive`:`common:states.off`)}),a&&(0,A.jsx)(`span`,{className:`text-[10px] text-destructive`,children:a})]})}function B({keys:e}){let{t}=p(`integrations`);return(0,A.jsxs)(`div`,{className:`text-[11px] rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-2 leading-relaxed space-y-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,A.jsx)(h,{className:`w-3 h-3 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,A.jsx)(`span`,{children:(0,A.jsx)(r,{t,i18nKey:`cachedNotice.body`,components:{strong:(0,A.jsx)(`strong`,{}),code:(0,A.jsx)(`code`,{className:`bg-muted px-1 rounded`})}})})]}),(0,A.jsx)(`div`,{className:`pl-5 space-y-0.5`,children:e.map(e=>(0,A.jsxs)(`pre`,{className:`text-[10px] bg-muted/40 rounded px-1.5 py-0.5 inline-block font-mono`,children:[`/plugin uninstall `,e]},e))}),(0,A.jsx)(`div`,{className:`pl-5 text-[10px] text-muted-foreground`,children:t(`cachedNotice.runInstruction`)})]})}function V({pluginName:e}){let{t}=p(`integrations`),[n,i]=(0,k.useState)(!1),[a,o]=(0,k.useState)(null);return(0,A.jsxs)(`div`,{className:`text-[11px] rounded-md border border-accent-info/30 bg-accent-info/5 p-2 leading-relaxed space-y-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,A.jsx)(c,{className:`w-3 h-3 text-accent-info mt-0.5 flex-shrink-0`}),(0,A.jsx)(`span`,{children:(0,A.jsx)(r,{t,i18nKey:`update.body`,components:{code:(0,A.jsx)(`code`,{className:`bg-muted px-1 rounded`})}})})]}),(0,A.jsxs)(`button`,{type:`button`,disabled:n,onClick:async()=>{i(!0),o(null);try{let t=await fetch(`${S()}/plugins/${e}/update`,{method:`POST`});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`)}catch(e){o(e.message)}finally{i(!1)}},className:`text-[10px] px-2 py-0.5 rounded border border-accent-info/40 hover:bg-accent-info/10 disabled:opacity-50 flex items-center gap-1`,children:[n&&(0,A.jsx)(D,{className:`w-2.5 h-2.5 animate-spin`}),(0,A.jsx)(r,{t,i18nKey:`update.button`,components:{code:(0,A.jsx)(`code`,{})}})]}),a&&(0,A.jsx)(`div`,{className:`text-destructive text-[10px]`,children:a})]})}function H({pluginName:e,conflicts:t}){let{t:n}=p(`integrations`),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(null),c=async e=>{a(e),s(null);try{let t=await fetch(`${S()}/plugins/_marketplace/disable`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e})});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`)}catch(e){s(e.message)}finally{a(null)}};return(0,A.jsxs)(`div`,{className:`text-[11px] rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-2 leading-relaxed space-y-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,A.jsx)(h,{className:`w-3 h-3 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,A.jsx)(`span`,{children:(0,A.jsx)(r,{t:n,i18nKey:`conflict.body`,values:{name:e},components:{strong:(0,A.jsx)(`strong`,{})}})})]}),(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,children:t.map(e=>(0,A.jsxs)(`button`,{type:`button`,disabled:i===e,onClick:()=>c(e),className:`text-[10px] px-2 py-0.5 rounded border border-yellow-500/40 aurora-light:border-accent-warning/40 hover:bg-yellow-500/10 aurora-light:hover:bg-accent-warning/10 disabled:opacity-50 flex items-center gap-1`,children:[i===e&&(0,A.jsx)(D,{className:`w-2.5 h-2.5 animate-spin`}),(0,A.jsx)(r,{t:n,i18nKey:`conflict.disableButton`,values:{key:e},components:{code:(0,A.jsx)(`code`,{})}})]},e))}),o&&(0,A.jsx)(`div`,{className:`text-destructive`,children:o})]})}function U({plugin:e,onRemoved:n}){let{t:r}=p(`integrations`),[i,a]=(0,k.useState)(!1);return(0,A.jsxs)(`div`,{className:`rounded-lg border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-4 flex flex-col gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),(0,A.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-yellow-500/20 aurora-light:bg-accent-warning/15 text-yellow-500 aurora-light:text-accent-warning`,children:r(`orphan.badge`)})]}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),(0,A.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,A.jsxs)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0);try{await fetch(`${S()}/plugins/${e.name}`,{method:`DELETE`}),n()}finally{a(!1)}},className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-destructive/10 hover:text-destructive flex items-center gap-1.5`,children:[(0,A.jsx)(t,{className:`w-3 h-3`}),` `,r(`orphan.removeButton`)]})})]})}function W({pluginName:e,onClose:t}){let{t:n}=p(`integrations`),[r,i]=(0,k.useState)(null),[o,s]=(0,k.useState)(null),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(null),[m,g]=(0,k.useState)([]),[_,v]=(0,k.useState)(null),[y,x]=(0,k.useState)([]),{registerHandler:C,unregisterHandler:w}=b(),T=(0,k.useCallback)(()=>{i(null),s(null),fetch(`${S()}/plugins/${e}/preview-install`).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>i(e)).catch(e=>s(e.message))},[e]);(0,k.useEffect)(()=>{T()},[T]),(0,k.useEffect)(()=>(C(`install-${e}`,t=>{let n=t;if(n.type===`plugin.install_progress`&&n.name===e&&n.line&&g(e=>[...e,n.line]),n.type===`plugin.prereq_install_progress`&&n.line&&x(e=>[...e,n.line]),n.type===`plugin.prereq_installed`){v(null);let e=n.reason;e&&x(t=>[...t,`► ${e}`]),n.ok&&T()}}),()=>w(`install-${e}`)),[e,C,w,T]);let E=async e=>{v(e),x([n(`installDialog.installingPrereq`,{name:e})]);try{await fetch(`${S()}/plugins/_prerequisites/${e}/install`,{method:`POST`})}catch(e){x(t=>[...t,n(`installDialog.prereqStartFailed`,{message:e.message})]),v(null)}},j=(r?.requirements??[]).every(e=>e.installed&&e.executable&&e.meetsMinimum);return(0,A.jsxs)(K,{onClose:t,title:n(`installDialog.title`,{name:e}),children:[o&&(0,A.jsx)(`div`,{className:`text-xs text-destructive`,children:o}),!r&&!o&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,A.jsx)(D,{className:`w-3 h-3 animate-spin`}),` `,n(`installDialog.computingChanges`)]}),r&&(0,A.jsxs)(A.Fragment,{children:[r.platformNote&&(0,A.jsxs)(`div`,{className:`flex items-start gap-2 p-2.5 rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 text-[11px] leading-relaxed`,children:[(0,A.jsx)(h,{className:`w-3.5 h-3.5 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,A.jsx)(`span`,{children:r.platformNote})]}),(0,A.jsxs)(`section`,{children:[(0,A.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:n(`installDialog.filesHeading`)}),(0,A.jsx)(`ul`,{className:`text-xs space-y-0.5 font-mono`,children:r.files.map((e,t)=>(0,A.jsxs)(`li`,{className:e.op===`create`?`text-accent-success`:`text-accent-info`,children:[e.op===`create`?`+ `:`~ `,e.path,e.summary&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e.summary]})]},t))})]}),r.requirements.length>0&&(0,A.jsxs)(`section`,{children:[(0,A.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:n(`installDialog.prerequisites`)}),(0,A.jsx)(`ul`,{className:`text-xs space-y-1`,children:r.requirements.map(e=>{let t=e.installed&&e.executable&&e.meetsMinimum,r=e.name===`uv`;return(0,A.jsxs)(`li`,{className:`flex items-center gap-2`,children:[t?(0,A.jsx)(a,{className:`w-3 h-3 text-accent-success`}):(0,A.jsx)(O,{className:`w-3 h-3 text-accent-warning`}),(0,A.jsxs)(`span`,{children:[e.name,e.minVersion?` ≥ ${e.minVersion}`:``]}),e.version&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.version,`)`]}),!t&&r&&(0,A.jsxs)(`button`,{type:`button`,disabled:_===e.name,onClick:()=>E(e.name),className:`ml-auto text-[10px] px-2 py-0.5 rounded border border-border hover:bg-muted disabled:opacity-50 flex items-center gap-1`,children:[_===e.name&&(0,A.jsx)(D,{className:`w-2.5 h-2.5 animate-spin`}),n(`installDialog.autoInstall`)]})]},e.name)})}),y.length>0&&(0,A.jsx)(`pre`,{className:`mt-2 text-[11px] bg-muted/40 rounded p-2 max-h-24 overflow-auto font-mono`,children:y.join(`
2
- `)})]}),m.length>0&&(0,A.jsxs)(`section`,{children:[(0,A.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:n(`installDialog.progress`)}),(0,A.jsx)(`pre`,{className:`text-[11px] bg-muted/40 rounded p-2 max-h-32 overflow-auto font-mono`,children:m.join(`
3
- `)})]}),d&&(0,A.jsx)(`div`,{className:`text-xs text-destructive`,children:d})]}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs px-3 py-1.5 rounded-md border border-border`,children:n(`common:actions.cancel`)}),(0,A.jsxs)(`button`,{type:`button`,disabled:!r||!j||l,onClick:async()=>{u(!0),f(null);try{let n=await fetch(`${S()}/plugins/${e}/install`,{method:`POST`});if(!n.ok)throw Error((await n.json()).error??`HTTP ${n.status}`);setTimeout(t,1500)}catch(e){f(e.message)}finally{u(!1)}},className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white disabled:opacity-50 flex items-center gap-1.5`,children:[l?(0,A.jsx)(D,{className:`w-3 h-3 animate-spin`}):(0,A.jsx)(c,{className:`w-3 h-3`}),n(`card.install`)]})]})]})}function G({pluginName:e,onClose:t,onUninstalled:n}){let{t:i}=p(`integrations`),[a,o]=(0,k.useState)(!1),[s,c]=(0,k.useState)(null);return(0,A.jsxs)(K,{onClose:t,title:i(`uninstallDialog.title`,{name:e}),children:[(0,A.jsx)(`p`,{className:`text-xs`,children:(0,A.jsx)(r,{t:i,i18nKey:`uninstallDialog.body`,components:{code:(0,A.jsx)(`code`,{})}})}),s&&(0,A.jsx)(`div`,{className:`text-xs text-destructive`,children:s}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs px-3 py-1.5 rounded-md border border-border`,children:i(`common:actions.cancel`)}),(0,A.jsxs)(`button`,{type:`button`,disabled:a,onClick:async()=>{o(!0);try{let t=await fetch(`${S()}/plugins/${e}`,{method:`DELETE`});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`);n()}catch(e){c(e.message)}finally{o(!1)}},className:`text-xs px-3 py-1.5 rounded-md bg-destructive text-white disabled:opacity-50 flex items-center gap-1.5`,children:[a&&(0,A.jsx)(D,{className:`w-3 h-3 animate-spin`}),i(`card.uninstall`)]})]})]})}function K({title:e,onClose:t,children:n}){let{panelRef:r,panelStyle:i,headerHandleProps:a,resizeHandles:o,isFloating:s,guardBackdrop:c}=g();return(0,A.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,role:`dialog`,tabIndex:-1,onClick:c(t),children:[(0,A.jsxs)(`div`,{ref:r,className:`bg-card border border-border rounded-lg shadow-xl w-full max-w-md p-5 flex flex-col gap-3`,onClick:e=>e.stopPropagation(),style:i,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold ${s?`cursor-grab active:cursor-grabbing`:``}`,...a,children:e}),n]}),(0,A.jsx)(l,{handles:o})]})}function q(){return(0,A.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:Array.from({length:3},(e,t)=>(0,A.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-4 h-40 animate-pulse`},t))})}function J({onRetry:e}){let{t}=p(`integrations`);return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-3 text-sm text-muted-foreground`,children:[(0,A.jsx)(h,{className:`w-5 h-5 text-destructive`}),(0,A.jsx)(`p`,{children:t(`page.loadError`)}),(0,A.jsx)(`button`,{type:`button`,onClick:e,className:`text-xs px-3 py-1.5 rounded-md border border-border`,children:t(`common:actions.retry`)})]})}function Y(){let{t:e}=p(`integrations`);return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 text-sm text-muted-foreground`,children:[(0,A.jsx)(v,{className:`w-6 h-6`}),(0,A.jsx)(`p`,{children:e(`page.empty`)})]})}export{L as default};
@@ -1,16 +0,0 @@
1
- import{a as e}from"./chunk-BNv3lrIs.js";import{A as t,Bt as n,C as r,Dn as i,Ft as a,Ht as o,In as s,It as c,J as l,K as u,Mn as d,N as f,Nn as p,On as m,Qt as h,Rt as g,S as _,St as v,Ut as y,Wt as b,at as x,c as S,d as C,en as ee,f as w,fn as te,h as T,j as E,jn as D,lt as O,m as k,mn as A,nn as ne,ot as j,pn as M,q as N,rn as P,yt as F,zt as I}from"./index-BeujshsU.js";import{t as L}from"./lib-CfphudAm.js";import{t as re}from"./format-command-CHImQv6W.js";var R=h(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),z=e(s(),1),B=M();function ie({phases:e,phaseDefinitions:n}){return n.length===0?null:(0,B.jsx)(`div`,{className:`flex items-center`,children:n.map((r,i)=>{let a=e[r.key]??`idle`,o=i<n.length-1?e[n[i+1].key]??`idle`:null;return(0,B.jsxs)(`div`,{className:`flex items-center`,children:[(0,B.jsxs)(t,{children:[(0,B.jsx)(f,{asChild:!0,children:(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,B.jsx)(ae,{state:a}),(0,B.jsx)(`span`,{className:l(`text-xs font-medium transition-colors`,a===`running`?`text-blue-400 aurora-light:text-accent-info`:a===`done`?`text-emerald-400 aurora-light:text-accent-success`:a===`error`?`text-red-400 aurora-light:text-destructive`:`text-muted-foreground/40`),children:r.label})]})}),(0,B.jsxs)(E,{side:`bottom`,className:`max-w-[200px]`,children:[(0,B.jsx)(`p`,{className:`font-medium`,children:r.label}),(0,B.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:r.description})]})]}),o!==null&&(0,B.jsx)(`div`,{className:l(`h-px w-12 -mt-5 shrink-0 transition-all duration-300`,o===`done`||a===`done`?`bg-emerald-500/30 aurora-light:bg-accent-success/40`:o===`running`?`bg-blue-400/40 aurora-light:bg-accent-info/40`:`bg-border/30`)})]},r.key)})})}function ae({state:e}){return(0,B.jsxs)(`div`,{className:l(`flex items-center justify-center w-10 h-10 rounded-full transition-all duration-300`,e===`running`?`bg-blue-500/10 aurora-light:bg-accent-info/10 ring-1 ring-blue-400/30 aurora-light:ring-accent-info/30 animate-pulse`:e===`done`?`bg-emerald-500/10 aurora-light:bg-accent-success/10`:e===`error`?`bg-red-500/10 aurora-light:bg-destructive/10`:`bg-muted/20`),children:[e===`running`&&(0,B.jsx)(F,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,B.jsx)(n,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,B.jsx)(I,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,B.jsx)(g,{className:`w-6 h-6 text-muted-foreground/20`})]})}function oe(e,t){let n=(typeof t==`number`?t:new Date(t).getTime())-new Date(e).getTime();if(!Number.isFinite(n)||n<0)return`—`;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function V(e){let t=new Set;for(let n of e)if(n.event_type===`log`)try{let e=(JSON.parse(n.payload).line??``).match(/(?:Writing|Editing|Created?|Updated?)\s+(?:file:\s*)?([\w./\-]+\.\w+)/i);e&&t.add(e[1])}catch{}return Array.from(t).slice(0,20)}var H={steps:0,actionKey:``,actionArg:``,lastSeenIdx:0};function se(e,t){if(t.type===`reset`)return H;if(t.type===`consume`){let{events:n}=t,r=e.lastSeenIdx>n.length?n.length:e.lastSeenIdx;if(n.length<=r)return r===e.lastSeenIdx?e:{...e,lastSeenIdx:r};let{steps:i,actionKey:a,actionArg:o}=e;for(let e=r;e<n.length;e++){let t=T(n[e]);t.step&&(i+=t.stepCount??1),t.actionKey&&(a=t.actionKey,o=t.actionArg??``)}return{steps:i,actionKey:a,actionArg:o,lastSeenIdx:n.length}}return e}function ce({job:e,events:t,defaultOpen:r=!0,pipelineTotals:i,phases:a,phaseDefinitions:o}){let{t:s}=m(`jobs`),[c,u]=(0,z.useState)(r),d=(0,z.useMemo)(()=>V(t),[t]),f=e.status===`running`,p=e.status===`completed`,[h,g]=(0,z.useState)(()=>Date.now());(0,z.useEffect)(()=>{if(!f)return;let e=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(e)},[f]);let[_,v]=(0,z.useReducer)(se,H),y=(0,z.useRef)(e.id);(0,z.useEffect)(()=>{y.current!==e.id&&(y.current=e.id,v({type:`reset`})),v({type:`consume`,events:t})},[e.id,t]);let[x,S]=(0,z.useState)(!0);(0,z.useEffect)(()=>{if(!f)return;S(!0);let e=window.setTimeout(()=>S(!1),8e3);return()=>window.clearTimeout(e)},[f,e.id]);let C=e.finished_at?oe(e.started_at,e.finished_at):f?oe(e.started_at,h):`—`,ee=!!e.total_cost_usd_estimated,w=e.total_cost_usd==null?null:`${ee?`~`:``}$${e.total_cost_usd.toFixed(4)}`,te=e.num_turns==null?null:String(e.num_turns),T=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0),E=T==null?null:`${(T/1e3).toFixed(1)}k`,D=(0,z.useMemo)(()=>!a||!o?null:o.find(e=>a[e.key]===`running`)?.label??null,[a,o]),O=f&&_.steps===0?`connecting`:_.actionKey||`thinking`,A=k.has(O)&&_.actionArg!==``,ne=k.has(O)&&!A?`working`:O,j=A?s(`statusPanel.activity.${ne}`,{arg:_.actionArg}):s(`statusPanel.activity.${ne}`),M=D??(f&&_.steps===0?s(`statusPanel.activity.starting`):null),N=_.steps>0?s(`statusPanel.steps`,{count:_.steps}):null,P=s(f?`statusPanel.inProgress`:p?`statusPanel.completed`:`statusPanel.failed`),L=f?`border-accent-info/20 bg-accent-info/5`:p?`border-emerald-500/20 aurora-light:border-accent-success/30 bg-emerald-500/5 aurora-light:bg-accent-success/5`:`border-red-500/20 aurora-light:border-destructive/30 bg-red-500/5 aurora-light:bg-destructive/5`,re=f?F:p?n:I,R=f?`w-4 h-4 text-accent-info shrink-0 animate-spin`:p?`w-4 h-4 text-emerald-400 aurora-light:text-accent-success shrink-0`:`w-4 h-4 text-red-400 aurora-light:text-destructive shrink-0`;return(0,B.jsxs)(`div`,{className:l(`mx-4 my-2 rounded-xl border transition-colors duration-500`,L),children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>u(!c),className:`w-full flex items-center gap-3 px-4 py-3`,children:[(0,B.jsx)(re,{className:R,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`text-sm font-semibold flex-1 text-left`,children:P}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`tabular-nums`,children:C}),f?N&&(0,B.jsx)(`span`,{className:`tabular-nums`,children:N}):(0,B.jsxs)(B.Fragment,{children:[w&&(0,B.jsx)(`span`,{className:`tabular-nums text-yellow-400 aurora-light:text-accent-warning`,children:w}),d.length>0&&(0,B.jsx)(`span`,{children:s(`statusPanel.filesCount`,{count:d.length})})]})]}),(0,B.jsx)(b,{className:l(`w-4 h-4 text-muted-foreground/40 transition-transform duration-150 shrink-0`,c&&`rotate-180`)})]}),c&&(0,B.jsx)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/20`,children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneInProgress`)}),(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 sm:items-stretch`,children:[(0,B.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 sm:w-44 shrink-0`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[s(`statusPanel.duration`),(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,title:s(`statusPanel.liveTooltip`),"aria-label":s(`statusPanel.liveTooltip`)})]}),(0,B.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-accent-info`,children:C})]}),(0,B.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 bg-muted/10 rounded-lg px-3 py-2 min-w-0`,children:[(0,B.jsx)(F,{className:`w-3.5 h-3.5 text-accent-info shrink-0 animate-spin`,"aria-hidden":`true`}),M&&(0,B.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info shrink-0`,children:M}),(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground truncate flex-1 min-w-0`,children:j}),N&&(0,B.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/60 tabular-nums shrink-0`,children:[`· `,N]})]})]}),x&&(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground/40 leading-snug`,children:s(`statusPanel.explainer`)}),(0,B.jsx)(`p`,{className:`pt-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider border-t border-accent-info/10 mt-1`,children:s(`statusPanel.zoneFinalPending`)}),(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,B.jsx)(G,{label:s(`statusPanel.cost`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.costTooltip`)}),(0,B.jsx)(G,{label:s(`statusPanel.turns`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)}),(0,B.jsx)(G,{label:s(`statusPanel.tokens`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneFinal`)}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,B.jsx)(U,{label:s(`statusPanel.duration`),value:C}),(0,B.jsx)(W,{label:s(`statusPanel.cost`),value:w,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:s(`statusPanel.notAvailable`)}),(0,B.jsx)(W,{label:s(`statusPanel.turns`),value:te,naCaption:s(`statusPanel.notAvailable`)}),(0,B.jsx)(W,{label:s(`statusPanel.tokens`),value:E,naCaption:s(`statusPanel.notAvailable`)})]}),i&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.pipelineTotal`,{count:i.jobCount})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,B.jsx)(U,{label:s(`statusPanel.totalCost`),value:`$${i.totalCostUsd.toFixed(4)}`,valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,B.jsx)(U,{label:s(`statusPanel.totalTokens`),value:`${((i.totalTokensIn+i.totalTokensOut+i.totalTokensCacheRead+i.totalTokensCacheCreate)/1e3).toFixed(1)}k`})]})]}),d.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.filesModified`)}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.map(e=>(0,B.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/30 px-2 py-0.5 rounded text-cyan-400/80 aurora-light:text-accent-info`,children:e},e))})]})]})})]})}function U({label:e,value:t,valueClass:n}){return(0,B.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,B.jsx)(`p`,{className:l(`text-sm font-semibold tabular-nums mt-0.5`,n),children:t})]})}function W({label:e,value:t,valueClass:n,naCaption:r}){return(0,B.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,B.jsx)(`p`,{className:l(`text-sm font-semibold tabular-nums mt-0.5`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:r})]})}function G({label:e,caption:t,tooltip:n}){return(0,B.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 ring-1 ring-accent-info/10`,title:n,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[e,(0,B.jsx)(R,{className:`w-2.5 h-2.5 text-muted-foreground/30`,"aria-hidden":`true`})]}),(0,B.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-muted-foreground/40`,children:`—`}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:t})]})}var K=4;function le({tickets:e,onTicketClick:t}){let{t:n}=m(`jobs`),[r,i]=(0,z.useState)(!1);if(e.length===0)return null;let a=e.length>=K&&!r?e.slice(0,1):e,s=e.length-a.length;return(0,B.jsxs)(`div`,{className:`rounded-xl border border-border/40 bg-card/40 px-4 py-3 space-y-1.5`,children:[a.map(e=>(0,B.jsx)(q,{ticket:e,onClick:()=>t(e.id)},e.id)),s>0&&(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[n(`ticketHeader.showMore`,{count:s}),(0,B.jsx)(b,{className:`w-3 h-3`})]}),r&&e.length>=K&&(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(!1),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[n(`ticketHeader.showLess`),(0,B.jsx)(o,{className:`w-3 h-3`})]})]})}function q({ticket:e,onClick:t}){let{t:n}=m(`jobs`),r=e.title==null,i=`inline-flex items-center px-1.5 py-0.5 rounded-md text-[11px] font-mono tabular-nums shrink-0`;return r?(0,B.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,B.jsx)(`span`,{className:l(i,`text-muted-foreground bg-muted/20 select-none`),title:n(`ticketHeader.deletedTooltip`),children:n(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 min-w-0 w-full text-left group`,title:e.title??void 0,children:[(0,B.jsxs)(`span`,{className:l(i,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,B.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}function J(e){let t=e.trimStart();return!!(/^#{1,6}\s/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/^\|.+\|/.test(t)||t.startsWith("```")||t.startsWith(`> `)||/\*\*[^*]+\*\*/.test(e)||/`[^`]+`/.test(e)||/\[.+\]\(.+\)/.test(e)||/^(-{3,}|_{3,}|\*{3,})$/.test(t)||/^- \[[ x]\]\s/.test(t))}function ue(e,t){let n=`${e.id??t}`,r=e.timestamp;if(e.event_type===`log`)try{let t=JSON.parse(e.payload).line??``;return t.trim()?t.startsWith(`▸`)||t.match(/^(architect|developer|reviewer|ship|analyst)\s*:/i)?{id:n,content:t,type:`phase`,timestamp:r}:e.source===`stderr`?{id:n,content:t,type:`stderr`,timestamp:r}:J(t)?{id:n,content:t,type:`assistant`,timestamp:r}:{id:n,content:t,type:`plain`,timestamp:r}:null}catch{return null}if(e.event_type!==`log`&&e.event_type!==`result`)return null;if(e.event_type===`result`)try{let t=JSON.parse(e.payload),i=[];return t.duration_ms&&i.push(`${(t.duration_ms/1e3).toFixed(1)}s`),t.total_cost_usd&&i.push(`$${t.total_cost_usd.toFixed(4)}`),t.num_turns&&i.push(P.t(`jobs:logViewer.turns`,{count:t.num_turns})),{id:n,content:`▸ ${P.t(`jobs:logViewer.completed`)}${i.length?` — ${i.join(` · `)}`:``}`,type:`result`,timestamp:r}}catch{return null}return null}function de(e){let t=`none`,n=[];for(let r of e){let e=r.type;if(e!==`plain`&&e!==`log`){t=`none`,n.push(r);continue}let i=r.content;i.startsWith(`--- `)?(t=`saw_minus`,n.push({...r,type:`diff-meta`})):t===`saw_minus`&&i.startsWith(`+++ `)?(t=`active`,n.push({...r,type:`diff-meta`})):t===`active`&&i.startsWith(`@@ `)?n.push({...r,type:`diff-hunk`}):t===`active`&&i.startsWith(`+`)&&!i.startsWith(`+++`)?n.push({...r,type:`diff-add`}):t===`active`&&i.startsWith(`-`)&&!i.startsWith(`---`)?n.push({...r,type:`diff-remove`}):(t===`active`&&(i.startsWith(` `)||i===``)||(t=`none`),n.push(r))}return n}function Y(e){let t=[{key:`__preamble__`,header:null,lines:[]}];for(let n of e)n.type===`phase`?t.push({key:n.id,header:n,lines:[]}):t[t.length-1].lines.push(n);return t.filter(e=>e.header!==null||e.lines.length>0)}function fe({events:e,isLoading:t}){let{t:n,i18n:r}=m(`jobs`),[a,o]=(0,z.useState)(``),[s,l]=(0,z.useState)(!0),[u,d]=(0,z.useState)(new Set),f=(0,z.useRef)(null),p=(0,z.useRef)(null),{processedLines:h,groups:g,totalLines:_}=(0,z.useMemo)(()=>{let t=e.map((e,t)=>ue(e,t)).filter(e=>e!==null),n=[];for(let e of t){let t=n.length>0?n[n.length-1]:null;e.type===`assistant`&&t?.type===`assistant`?t.content+=`
2
- `+e.content:n.push({...e})}let r=de(n);return{processedLines:r,groups:Y(r),totalLines:r.length}},[e,r.language]),v=(0,z.useMemo)(()=>{if(!a)return _;let e=a.toLowerCase();return h.filter(t=>t.content.toLowerCase().includes(e)).length},[a,h,_]),y=(0,z.useCallback)(()=>{let e=p.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,z.useEffect)(()=>{s&&y()},[e.length,s,y]);function x(){let e=p.current;e&&l(e.scrollHeight-e.scrollTop-e.clientHeight<50)}function C(e){d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return t?(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`logViewer.loading`)})}):_===0?(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`logViewer.empty`)})}):(0,B.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-2 border-b border-border flex items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,B.jsx)(j,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,B.jsx)(S,{placeholder:n(`logViewer.filterPlaceholder`),value:a,onChange:e=>o(e.target.value),className:`pl-7 h-7`})]}),(0,B.jsx)(N,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:()=>{let e=h.map(e=>e.content).join(`
3
- `);navigator.clipboard.writeText(e).then(()=>{i.success(n(`logViewer.copySuccess`))}).catch(()=>{i.error(n(`logViewer.copyFailed`))})},children:(0,B.jsx)(c,{className:`w-3.5 h-3.5`})}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:n(`logViewer.lineCount`,{filtered:v,total:_})})]}),(0,B.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto p-2 text-xs relative`,onScroll:x,children:[g.map(e=>(0,B.jsx)(X,{group:e,filter:a,collapsed:u.has(e.key),onToggle:()=>C(e.key)},e.key)),(0,B.jsx)(`div`,{ref:f})]}),!s&&(0,B.jsxs)(N,{size:`sm`,variant:`secondary`,onClick:()=>{l(!0),y()},className:`absolute bottom-16 right-6 h-7 gap-1 shadow-lg`,children:[(0,B.jsx)(b,{className:`w-3 h-3`}),n(`logViewer.jumpToBottom`)]})]})}var X=(0,z.memo)(function({group:e,filter:t,collapsed:n,onToggle:r}){let{t:i}=m(`jobs`),a=t?e.lines.filter(e=>e.content.toLowerCase().includes(t.toLowerCase())):e.lines;if(e.header===null)return a.length===0?null:(0,B.jsx)(`div`,{children:a.map((e,t)=>(0,B.jsx)(Q,{line:e,even:t%2==0},e.id))});let o=e.header.content;return(0,B.jsxs)(`div`,{className:`mt-3 rounded-md overflow-hidden border border-border/20`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:r,className:l(`flex items-center gap-2 w-full text-left px-3 py-2`,`bg-primary/5 border-b border-primary/20`,`hover:bg-primary/10 transition-colors duration-150 cursor-pointer`),children:[(0,B.jsx)(y,{className:l(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,B.jsx)(`span`,{className:`flex-1 text-[12px] font-semibold text-foreground leading-none`,children:o}),e.header.timestamp&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 font-mono tabular-nums shrink-0`,children:new Date(e.header.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:i(`logViewer.phaseLines`,{count:e.lines.length})})]}),!n&&(0,B.jsx)(`div`,{className:`bg-muted/5`,children:a.length===0?(0,B.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:i(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):a.map((e,t)=>(0,B.jsx)(Q,{line:e,even:t%2==0},e.id))})]})}),Z=[L],Q=(0,z.memo)(function({line:e,even:t}){let n=e.type===`assistant`,i=e.type===`diff-add`,a=e.type===`diff-remove`,o=e.type===`diff-meta`,s=e.type===`diff-hunk`;return(0,B.jsxs)(`div`,{className:l(`flex items-start gap-2 group px-2 py-0.5 rounded-sm`,!(i||a||o||s)&&(t?`bg-muted/20`:`bg-transparent`),e.type===`result`&&`bg-emerald-500/5 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/40 aurora-light:border-accent-success/40 mt-2 py-2`,i&&`bg-emerald-500/8 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/50 aurora-light:border-accent-success/50`,a&&`bg-red-500/8 aurora-light:bg-destructive/10 border-l-2 border-red-500/50 aurora-light:border-destructive/50`,o&&`bg-accent-primary/5 border-l-2 border-accent-primary/30`,s&&`bg-accent-info/5 border-l-2 border-accent-info/30`),children:[e.timestamp&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0 mt-0.5 w-[52px] font-mono tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),n?(0,B.jsx)(`div`,{className:`flex-1 min-w-0 prose prose-invert prose-xs max-w-none
4
- prose-p:my-1 prose-p:leading-relaxed
5
- prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold
6
- prose-ul:my-1 prose-ol:my-1 prose-li:my-0
7
- prose-code:text-cyan-300 prose-code:text-[11px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded
8
- prose-pre:my-1 prose-pre:bg-muted/30 prose-pre:rounded-md prose-pre:p-2 prose-pre:text-[11px]
9
- prose-strong:text-foreground prose-em:text-foreground/70
10
- prose-a:text-blue-400 prose-a:no-underline hover:prose-a:underline
11
- prose-table:my-2 prose-table:text-[11px]
12
- prose-thead:border-border prose-thead:bg-muted/30
13
- prose-th:px-3 prose-th:py-1.5 prose-th:text-left prose-th:font-semibold prose-th:text-foreground/90
14
- prose-td:px-3 prose-td:py-1.5 prose-td:border-border
15
- prose-tr:border-border
16
- text-foreground/80`,children:(0,B.jsx)(r,{remarkPlugins:[_],rehypePlugins:Z,children:e.content})}):(0,B.jsx)(`span`,{className:l(`flex-1 break-all leading-relaxed whitespace-pre-wrap font-mono`,e.type===`tool-use`&&`text-cyan-400/80 aurora-light:text-accent-info text-[11px]`,e.type===`stderr`&&`text-orange-400 aurora-light:text-accent-warning`,e.type===`result`&&`text-emerald-400 aurora-light:text-accent-success font-medium`,e.type===`log`&&`text-foreground/60`,e.type===`plain`&&`text-foreground/70`,e.type===`tool-result`&&`text-muted-foreground/50`,i&&`text-emerald-400 aurora-light:text-accent-success`,a&&`text-red-400 aurora-light:text-destructive`,o&&`text-accent-primary/80`,s&&`text-accent-info/80`),children:e.content})]})}),pe={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.completed`,tooltipKey:`statusTooltip.completed`},failed:{variant:`failed`,labelKey:`statusLabel.failed`,tooltipKey:`statusTooltip.failed`},canceled:{variant:`canceled`,labelKey:`statusLabel.canceled`,tooltipKey:`statusTooltip.canceled`},queued:{variant:`queued`,labelKey:`statusLabel.queued`,tooltipKey:`statusTooltip.queued`}};function $(){let{t:e}=m(`jobs`),{id:r}=p(),{activeProjectId:o,projects:s}=ee(),c=s.find(e=>e.id===o)?.provider,h=d(),{openTicketDetail:g}=C(),[_,b]=(0,z.useState)(null),[S,T]=(0,z.useState)([]),[k,j]=(0,z.useState)([]),[M,P]=(0,z.useState)({}),[I,L]=(0,z.useState)([]),[R,ae]=(0,z.useState)(!0),[oe,V]=(0,z.useState)(!1),[H,se]=(0,z.useState)(null),[U,W]=(0,z.useState)(!1),[G,K]=(0,z.useState)(``),[q,J]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!r)return;let e=new AbortController;b(null),T([]),j([]),P({}),ae(!0),V(!1);async function t(){try{let t=await fetch(`${A()}/jobs/${r}`,{signal:e.signal});if(t.status===404){V(!0);return}if(!t.ok)throw Error(`Failed to fetch job`);let n=await t.json();b(n.job),T(n.events)}catch(e){if(e.name===`AbortError`)return;V(!0)}finally{e.signal.aborted||ae(!1)}}return t(),()=>e.abort()},[r,o]),(0,z.useEffect)(()=>{if(!_?.pipeline_id){L([]);return}let e=_.pipeline_id;fetch(`${A()}/pipelines/${e}`).then(e=>e.ok?e.json():null).then(e=>{e?.jobs&&L(e.jobs)}).catch(()=>{})},[_?.pipeline_id,_?.status]);let Y=(0,z.useRef)(o);Y.current=o;let X=(0,z.useRef)([]),Z=(0,z.useRef)(null),Q=(0,z.useCallback)(()=>{Z.current=null;let e=X.current;e.length!==0&&(X.current=[],T(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]),$=(0,z.useCallback)(e=>{let t=X.current;t.push(e),t.length>1e4&&(X.current=t.slice(-8e3)),Z.current||=requestAnimationFrame(Q)},[Q]);(0,z.useEffect)(()=>()=>{Z.current&&cancelAnimationFrame(Z.current)},[]);let me=(0,z.useCallback)(e=>{let t=e;if(!(Y.current&&t.projectId&&t.projectId!==Y.current)){if(t.type===`init`){let e=t.phaseDefinitions??[];j(e);let n={};for(let r of e)n[r.key]=t.phases?.[r.key]??`idle`;P(n)}else if(t.type===`event`&&t.jobId===r)$({id:Date.now(),job_id:r??``,seq:t.seq??0,event_type:t.event_type,source:t.source,payload:t.payload,timestamp:t.timestamp});else if(t.type===`log`&&t.processId===r)$({id:Date.now(),job_id:r??``,seq:0,event_type:`log`,source:t.source,payload:JSON.stringify({line:t.line}),timestamp:t.timestamp});else if(t.type===`job.turn_user`&&t.jobId===r)W(!0);else if(t.type===`job.turn_done`&&t.jobId===r)se(t.totals),W(!1);else if(t.type===`job.finalized`&&t.jobId===r){W(!1),J(!1);let e=t.totals;e&&se(e),fetch(`${A()}/jobs/${r}`).then(e=>e.json()).then(e=>b(e.job)).catch(()=>{})}else if(t.type===`phase`){let e=t.phase,n=t.state;P(t=>({...t,[e]:n}))}else if(t.type===`queue`){let e=t.jobs?.find(e=>e.id===r);if(e){let t=e.status;b(e=>e&&{...e,status:t}),(t===`completed`||t===`failed`||t===`canceled`)&&fetch(`${A()}/jobs/${r}`).then(e=>e.json()).then(e=>b(e.job)).catch(()=>{})}}}},[r,$]),{registerHandler:he,unregisterHandler:ge}=te();(0,z.useEffect)(()=>(he(`job-detail-${r}`,me),()=>ge(`job-detail-${r}`)),[r,me,he,ge]),(0,z.useEffect)(()=>{if(!r||!_||_.status!==`running`||_.hasTelemetry)return;let e=setInterval(()=>{fetch(`${A()}/jobs/${r}`).then(e=>e.ok?e.json():null).then(e=>{e?.job?.hasTelemetry&&b(e=>e&&{...e,hasTelemetry:!0})}).catch(()=>{})},8e3);return()=>clearInterval(e)},[r,_?.status,_?.hasTelemetry]);async function _e(){if(r)try{let t=await fetch(`${A()}/jobs/${r}`,{method:`DELETE`});if(t.ok)(await t.json()).status===`deleted`?(i.success(e(`detail.toast.jobDeleted`)),h(`/jobs`)):i.success(e(`detail.toast.cancelSignalSent`),{description:e(`detail.toast.cancelSignalSentDescription`)});else{let n=await t.json();i.error(e(`detail.toast.failed`),{description:n.error})}}catch{i.error(e(`detail.toast.networkError`))}}async function ve(){if(!(!r||q)){J(!0);try{let t=await fetch(`${A()}/jobs/${r}/finalize`,{method:`POST`});if(t.ok)i.success(e(`detail.toast.finalizeScheduled`));else{let n=await t.json().catch(()=>({}));i.error(e(`detail.toast.finalizeFailed`),{description:n.error}),J(!1)}}catch{i.error(e(`detail.toast.networkError`)),J(!1)}}}async function ye(){let t=G.trim();if(!(!r||!t||ue)){de(!0);try{let n=await fetch(`${A()}/jobs/${r}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t})});if(n.ok)K(``);else{let t=await n.json().catch(()=>({}));i.error(e(`detail.toast.sendFailed`),{description:t.error})}}catch{i.error(e(`detail.toast.networkError`))}finally{de(!1)}}}async function be(){if(_)try{let t=await fetch(`${A()}/jobs/${_.id}/diagnostic`);if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`detail.toast.exportFailedHttp`,{status:t.status}))}let n=await t.blob(),r=URL.createObjectURL(n),i=new Date().toISOString().slice(0,10),a=document.createElement(`a`);a.href=r,a.download=`specrails-diagnostic-${_.id}-${i}.zip`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}catch(t){i.error(e(`detail.toast.exportFailed`),{description:t.message})}}async function xe(){if(_)try{let t=await fetch(`${A()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:_.command})}),n=await t.json();if(!t.ok)throw Error(n.error??e(`detail.toast.spawnFailed`));i.success(e(`detail.toast.jobRequeued`)),h(`/jobs/${n.jobId}`)}catch(e){i.error(e.message)}}if(R)return(0,B.jsx)(`div`,{className:`max-w-5xl mx-auto px-4 py-6`,children:(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`div`,{className:`h-4 w-48 bg-muted/30 rounded animate-pulse`}),(0,B.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-64 bg-muted/30 rounded-lg animate-pulse`})]})});if(oe||!_)return(0,B.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-6 flex flex-col items-center gap-3 mt-12`,children:[(0,B.jsx)(`p`,{className:`text-lg font-semibold`,children:e(`detail.notFound`)}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`detail.notFoundDescription`,{id:r})}),(0,B.jsx)(N,{asChild:!0,variant:`outline`,size:`sm`,children:(0,B.jsxs)(D,{to:`/`,children:[(0,B.jsx)(v,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.backToDashboard`)]})})]});let Se=pe[_.status]??pe.queued,Ce=_.status===`running`,we=_.status===`completed`||_.status===`failed`,Te=!!_.interactive,Ee=Te&&Ce,De=(_.tickets?.length??0)>0,Oe=I.length>1?{totalCostUsd:I.reduce((e,t)=>e+(t.total_cost_usd??0),0),totalTokensIn:I.reduce((e,t)=>e+(t.tokens_in??0),0),totalTokensOut:I.reduce((e,t)=>e+(t.tokens_out??0),0),totalTokensCacheRead:I.reduce((e,t)=>e+(t.tokens_cache_read??0),0),totalTokensCacheCreate:I.reduce((e,t)=>e+(t.tokens_cache_create??0),0),jobCount:I.length}:null;return(0,B.jsxs)(`div`,{"data-job-detail-surface":!0,className:`flex flex-col h-full max-w-5xl mx-auto w-full`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-4 border-b border-border space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(D,{to:`/`,className:`hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,B.jsx)(v,{className:`w-3 h-3`}),e(`detail.breadcrumbDashboard`)]}),(0,B.jsx)(y,{className:`w-3 h-3`}),(0,B.jsx)(`span`,{className:`text-foreground font-mono`,children:e(`detail.breadcrumbJob`,{id:r?.slice(0,8)})})]}),De&&(0,B.jsx)(le,{tickets:_.tickets??[],onTicketClick:g}),(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsxs)(t,{children:[(0,B.jsx)(f,{asChild:!0,children:(0,B.jsx)(`div`,{children:(0,B.jsx)(u,{variant:Se.variant,children:e(Se.labelKey)})})}),(0,B.jsx)(E,{children:e(Se.tooltipKey)})]}),(0,B.jsx)(`code`,{className:l(`font-mono text-foreground/90 truncate`,De?`text-xs text-muted-foreground`:`text-sm`),children:re(_.command,c)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,B.jsx)(`span`,{children:_.started_at?e(`detail.startedAgo`,{timeAgo:w(new Date(_.started_at),{addSuffix:!0,locale:ne()})}):e(`detail.queuedWaiting`)}),_.model&&(0,B.jsx)(`span`,{className:`text-muted-foreground/40`,children:_.model})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[_.hasTelemetry&&(0,B.jsxs)(t,{children:[(0,B.jsx)(f,{asChild:!0,children:(0,B.jsxs)(N,{variant:`outline`,size:`sm`,className:`h-7`,onClick:be,"aria-label":e(`detail.exportDiagnosticAria`),children:[(0,B.jsx)(a,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.exportDiagnostic`)]})}),(0,B.jsx)(E,{children:e(`detail.exportDiagnosticTooltip`)})]}),we&&(0,B.jsxs)(t,{children:[(0,B.jsx)(f,{asChild:!0,children:(0,B.jsxs)(N,{variant:`outline`,size:`sm`,onClick:xe,className:`h-7`,children:[(0,B.jsx)(O,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.reExecute`)]})}),(0,B.jsx)(E,{children:e(`detail.reExecuteTooltip`)})]}),Ee&&(0,B.jsxs)(t,{children:[(0,B.jsx)(f,{asChild:!0,children:(0,B.jsxs)(N,{variant:`outline`,size:`sm`,onClick:ve,disabled:q,className:`h-7 border-accent-success/40 text-accent-success hover:bg-accent-success/10`,children:[(0,B.jsx)(n,{className:`w-3.5 h-3.5 mr-1.5`}),e(q?`detail.finalizing`:`detail.finalizeJob`)]})}),(0,B.jsx)(E,{children:e(`detail.finalizeJobTooltip`)})]}),Ce&&(0,B.jsxs)(t,{children:[(0,B.jsx)(f,{asChild:!0,children:(0,B.jsx)(N,{variant:`outline`,size:`sm`,onClick:_e,className:`h-7 border-destructive/30 text-destructive hover:bg-destructive/10`,children:e(Te?`detail.cancelInteractive`:`detail.cancelJob`)})}),(0,B.jsx)(E,{children:e(`detail.cancelJobTooltip`)})]})]})]}),(0,B.jsx)(ie,{phases:M,phaseDefinitions:k})]}),(_.status===`running`||_.status===`completed`||_.status===`failed`)&&(0,B.jsx)(ce,{job:_,events:S,defaultOpen:_.status===`completed`||_.status===`running`,pipelineTotals:Oe??void 0,phases:M,phaseDefinitions:k}),(0,B.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:(0,B.jsx)(fe,{events:S})}),Ee&&(0,B.jsxs)(`div`,{className:`shrink-0 border-t border-border/40 bg-surface/40 px-3 py-2 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[U&&(0,B.jsx)(F,{className:`w-3 h-3 animate-spin`}),e(U?`detail.interactive.working`:`detail.interactive.ready`)]}),H&&(0,B.jsx)(`span`,{className:`tabular-nums`,children:e(`detail.interactive.liveTotals`,{turns:H.num_turns,cost:H.total_cost_usd.toFixed(4)})})]}),(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsx)(`textarea`,{value:G,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye())},rows:2,placeholder:e(`detail.interactive.placeholder`),"aria-label":e(`detail.interactive.placeholder`),className:`flex-1 resize-none rounded-md border border-border/50 bg-background px-2.5 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-ring`}),(0,B.jsxs)(N,{size:`sm`,onClick:()=>void ye(),disabled:ue||!G.trim(),className:`h-9 shrink-0`,children:[(0,B.jsx)(x,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.interactive.send`)]})]})]})]})}export{$ as default};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,A as n,B as r,Bt as i,C as a,Dn as o,H as s,I as c,In as l,K as u,L as d,Lt as f,Mn as p,N as m,On as h,Qt as g,R as _,S as v,U as y,V as b,X as x,bt as S,en as ee,f as C,j as w,mn as T,nn as te,pn as ne,q as E,t as D,tn as O,z as re,zt as k}from"./index-BeujshsU.js";import{t as A}from"./ExportDropdown-CYMcbLTD.js";import{t as ie}from"./format-command-CHImQv6W.js";var ae=g(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),j=e(l(),1),M=ne();function N(e){if(e==null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function P(e){return e==null?`—`:e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function F(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function I({label:e,a:t,b:n,highlight:r}){return(0,M.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 py-2 border-b border-border/20 last:border-0 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,M.jsx)(`span`,{className:`font-mono text-right ${r===`a`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:t}),(0,M.jsx)(`span`,{className:`font-mono text-right ${r===`b`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:n})]})}function L(e,t,n=!0){return e==null||t==null||e===t?null:n?e<t?`a`:`b`:e>t?`a`:`b`}function oe({jobIds:e,onClose:t}){let{t:n}=h(`jobs`),[r,a]=(0,j.useState)(null),[o,c]=(0,j.useState)(!0),[l,u]=(0,j.useState)(null),{panelRef:d,panelStyle:f,headerHandleProps:p,resizeHandles:m,isFloating:g,guardBackdrop:_}=y();(0,j.useEffect)(()=>{let t=new AbortController;return fetch(`${T()}/jobs/compare?jobIds=${e.join(`,`)}`,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{a(e),c(!1)}).catch(e=>{e.name!==`AbortError`&&(u(e.message),c(!1))}),()=>t.abort()},[e]);function v(e,t){return(0,M.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-medium uppercase tracking-wider`,children:n(`comparison.jobN`,{n:t+1})}),(0,M.jsx)(`code`,{className:`text-[10px] text-foreground/70 block truncate max-w-[160px] mx-auto`,children:e.command}),(0,M.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-[10px]`,children:[e.status===`completed`?(0,M.jsx)(i,{className:`w-3 h-3 text-emerald-400 aurora-light:text-accent-success`}):(0,M.jsx)(k,{className:`w-3 h-3 text-rose-400 aurora-light:text-destructive`}),(0,M.jsx)(`span`,{className:`capitalize text-muted-foreground`,children:n(`statusLabel.${e.status}`,{defaultValue:e.status})})]}),(0,M.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-mono`,children:e.id.slice(0,8)})]})}return(0,M.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:_(t),children:[(0,M.jsxs)(`div`,{ref:d,className:`w-full max-w-lg rounded-xl border border-border/30 bg-popover p-5 shadow-xl space-y-4 mx-4`,onClick:e=>e.stopPropagation(),style:f,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between ${g?`cursor-grab active:cursor-grabbing`:``}`,...p,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`comparison.title`)}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,M.jsx)(x,{className:`w-4 h-4`})})]}),o&&(0,M.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,M.jsx)(`div`,{className:`h-8 bg-muted/20 rounded animate-pulse`},e))}),l&&(0,M.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive`,children:n(`comparison.loadFailed`,{error:l})}),r&&(()=>{let[e,t]=r.jobs,i=L(e.durationMs,t.durationMs,!0),a=L(e.totalCostUsd,t.totalCostUsd,!0),o=L(e.tokensOut==null?null:e.tokensOut,t.tokensOut==null?null:t.tokensOut,!0);return(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 pb-3 border-b border-border/30 mb-1`,children:[(0,M.jsx)(`div`,{}),v(e,0),v(t,1)]}),(0,M.jsx)(I,{label:n(`comparison.duration`),a:N(e.durationMs),b:N(t.durationMs),highlight:i}),(0,M.jsx)(I,{label:n(`comparison.cost`),a:P(e.totalCostUsd),b:P(t.totalCostUsd),highlight:a}),(0,M.jsx)(I,{label:n(`comparison.tokensOut`),a:F(e.tokensOut),b:F(t.tokensOut),highlight:o}),(0,M.jsx)(I,{label:n(`comparison.tokensIn`),a:F(e.tokensIn),b:F(t.tokensIn),highlight:null}),(0,M.jsx)(I,{label:n(`comparison.cacheRead`),a:F(e.tokensCacheRead),b:F(t.tokensCacheRead),highlight:null}),(0,M.jsx)(I,{label:n(`comparison.model`),a:e.model??`—`,b:t.model??`—`,highlight:null}),(0,M.jsx)(I,{label:n(`comparison.phasesDone`),a:e.phasesCompleted.length>0?e.phasesCompleted.join(`, `):`—`,b:t.phasesCompleted.length>0?t.phasesCompleted.join(`, `):`—`,highlight:null})]})})(),r&&(0,M.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center`,children:n(`comparison.betterValueHint`)})]}),(0,M.jsx)(s,{handles:m})]})}var se={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.done`,tooltipKey:`statusTooltip.completed`},failed:{variant:`failed`,labelKey:`statusLabel.failed`,tooltipKey:`statusTooltip.failed`},canceled:{variant:`canceled`,labelKey:`statusLabel.canceled`,tooltipKey:`statusTooltip.canceled`},queued:{variant:`queued`,labelKey:`statusLabel.queued`,tooltipKey:`statusTooltip.queuedToRun`},zombie_terminated:{variant:`failed`,labelKey:`statusLabel.zombie`,tooltipKey:`statusTooltip.zombie`},skipped:{variant:`warning`,labelKey:`statusLabel.skipped`,tooltipKey:`statusTooltip.skipped`}},ce=[`running`,`completed`,`failed`,`canceled`,`zombie_terminated`,`queued`,`skipped`],R={critical:{className:`bg-red-500/15 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive border-red-500/30 aurora-light:border-destructive/30`,labelKey:`recent.priority.critical`},high:{className:`bg-orange-500/15 aurora-light:bg-accent-warning/10 text-orange-400 aurora-light:text-accent-warning border-orange-500/30 aurora-light:border-accent-warning/30`,labelKey:`recent.priority.high`},normal:{className:``,labelKey:`recent.priority.normal`},low:{className:`bg-gray-500/15 aurora-light:bg-muted text-gray-400 aurora-light:text-muted-foreground border-gray-500/30 aurora-light:border-border`,labelKey:`recent.priority.low`}};function le(e){return e==null||e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function ue(e,t){if(!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();if(n<0)return null;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function de(e){return e==null||e===0?null:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function fe(e){try{return C(new Date(e),{addSuffix:!0,locale:te()})}catch{return e}}function z(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r).getTime()}function B(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r+1).getTime()-1}function V(e,t,n){if(!t&&!n)return!0;let r=new Date(e).getTime();return Number.isNaN(r)?!0:!(t&&r<z(t)||n&&r>B(n))}var H=10;function U({jobs:e,isLoading:i,onJobsCleared:a,onProposalClick:l,onProposalDelete:g}){let{t:v}=h(`jobs`),x=p(),{activeProjectId:C,projects:te}=ee(),ne=te.find(e=>e.id===C)?.provider,[D,O]=(0,j.useState)(null),[k,A]=(0,j.useState)(``),[N,P]=(0,j.useState)(``),[F,I]=(0,j.useState)(!1),[L,U]=(0,j.useState)(``),[W,pe]=(0,j.useState)(``),[me,he]=(0,j.useState)(!1),[G,K]=(0,j.useState)(null),[q,ge]=(0,j.useState)(H),[J,_e]=(0,j.useState)(!1),[Y,X]=(0,j.useState)([]),[ve,Z]=(0,j.useState)(null),{panelRef:ye,panelStyle:be,headerHandleProps:xe,resizeHandles:Se,isFloating:Ce,guardBackdrop:we}=y();(0,j.useEffect)(()=>{ge(H)},[e.length]);function Te(){_e(e=>!e),X([])}function Ee(e){X(t=>{if(t.includes(e))return t.filter(t=>t!==e);if(t.length>=2)return t;let n=[...t,e];return n.length===2&&Z(n),n})}let Q=e.filter(e=>D&&e.status!==D?!1:V(e.started_at,k,N)),De=e.filter(e=>V(e.started_at,L,W)).length;async function $(e){he(!0);try{let t={};e===`range`&&(L&&(t.from=new Date(z(L)).toISOString()),W&&(t.to=new Date(B(W)).toISOString()));let n=await fetch(`${T()}/jobs`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(n.ok){let e=await n.json();o.success(v(`recent.toast.cleared`,{count:e.deleted})),I(!1),U(``),pe(``),a?.()}else o.error(v(`recent.toast.clearFailed`))}catch{o.error(v(`recent.toast.networkError`))}finally{he(!1)}}return i?(0,M.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[0,1,2].map(e=>(0,M.jsx)(`div`,{className:`h-9 bg-muted/30 rounded-md animate-pulse`},e))}):e.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border/40 bg-card/50 p-8 text-center space-y-2`,children:[(0,M.jsx)(f,{className:`w-8 h-8 text-muted-foreground/30 mx-auto`}),(0,M.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:v(`recent.emptyTitle`)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:v(`recent.emptyDescription`)})]}):(0,M.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>O(null),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${D===null?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:v(`recent.filterAll`,{count:e.length})}),ce.map(t=>{let n=e.filter(e=>e.status===t).length;return n===0?null:(0,M.jsx)(`button`,{type:`button`,onClick:()=>O(D===t?null:t),className:`px-2 py-0.5 rounded text-[10px] font-medium capitalize transition-colors ${D===t?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:v(`recent.filterStatus`,{status:v(`statusName.${t}`),count:n})},t)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`input`,{type:`date`,value:k,onChange:e=>A(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:v(`recent.fromDate`)}),(0,M.jsx)(`input`,{type:`date`,value:N,onChange:e=>P(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:v(`recent.toDate`)}),(k||N)&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>{A(``),P(``)},className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:v(`recent.clear`)}),(0,M.jsxs)(n,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(E,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 transition-colors ${J?`text-foreground bg-accent`:`text-muted-foreground hover:text-foreground`}`,onClick:Te,children:(0,M.jsx)(ae,{className:`w-3.5 h-3.5`})})}),(0,M.jsx)(w,{children:v(J?`recent.exitCompareMode`:`recent.compareTwoJobs`)})]}),(0,M.jsxs)(n,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(E,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>I(!0),children:(0,M.jsx)(t,{className:`w-3.5 h-3.5`})})}),(0,M.jsx)(w,{children:v(`recent.clearJobs`)})]})]})]}),J&&(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-accent/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,M.jsxs)(`span`,{children:[Y.length===0&&v(`recent.selectTwoToCompare`),Y.length===1&&v(`recent.selectOneMore`),Y.length===2&&v(`recent.readyToCompare`)]}),Y.length===2&&(0,M.jsx)(`button`,{type:`button`,className:`text-[10px] font-medium text-foreground hover:underline`,onClick:()=>Z(Y),children:v(`recent.compareAction`)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:[(0,M.jsx)(`span`,{className:`w-14`,children:v(`recent.colStatus`)}),(0,M.jsx)(`span`,{className:`flex-1 min-w-0`,children:v(`recent.colCommand`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,M.jsx)(`span`,{className:`w-14 text-right`,children:v(`recent.colDuration`)}),(0,M.jsx)(`span`,{className:`w-12 text-right`,children:v(`recent.colTokens`)}),(0,M.jsx)(`span`,{className:`w-12 text-right`,children:v(`recent.colCost`)}),(0,M.jsx)(`span`,{className:`w-20 text-right`,children:v(`recent.colStarted`)})]})]}),(0,M.jsx)(`div`,{className:`space-y-0.5`,children:Q.slice(0,q).map(e=>{let r=se[e.status]??se.queued,i=le(e.total_cost_usd),a=ue(e.started_at,e.finished_at),o=de((e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0)||null),s=e.id.startsWith(`proposal:`),c=s?e.id.replace(`proposal:`,``):null,d=Y.includes(e.id),f=J&&!s&&Y.length===2&&!d;return(0,M.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex items-center gap-3 px-3 py-2 rounded-md transition-colors cursor-pointer group ${d?`bg-accent/70 ring-1 ring-border`:f?`opacity-40 cursor-not-allowed`:`hover:bg-accent/50`}`,onClick:()=>{if(J&&!s){Ee(e.id);return}s&&c?l?.(c):x(`/jobs/${e.id}`)},children:[(0,M.jsxs)(n,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(`div`,{children:(0,M.jsx)(u,{variant:r.variant,children:v(r.labelKey)})})}),(0,M.jsx)(w,{children:v(r.tooltipKey)})]}),e.priority&&e.priority!==`normal`&&(0,M.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border ${R[e.priority].className}`,children:v(R[e.priority].labelKey)}),e.profile_name&&(0,M.jsxs)(n,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border border-accent-primary/40 bg-accent-primary/10 text-accent-primary/90`,children:e.profile_name})}),(0,M.jsx)(w,{children:v(`recent.profileTooltip`,{name:e.profile_name})})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-0`,children:[e.pipeline_id&&(0,M.jsxs)(n,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(S,{className:`w-3 h-3 text-accent-primary/60 shrink-0`})}),(0,M.jsxs)(w,{children:[v(`recent.pipelinePart`),e.depends_on_job_id&&` ${v(`recent.pipelineDependsOn`)}`,e.skip_reason&&` — ${e.skip_reason}`]})]}),(0,M.jsx)(`code`,{className:`text-xs text-foreground/80 truncate`,children:ie(e.command,ne)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground shrink-0`,children:[(0,M.jsx)(`span`,{className:`w-14 text-right`,children:a??`—`}),(0,M.jsx)(`span`,{className:`w-12 text-right`,children:o?`${o}`:`—`}),(0,M.jsx)(`span`,{className:`w-12 text-right`,children:i??`—`}),(0,M.jsx)(`span`,{className:`w-20 text-right`,children:fe(e.started_at)}),s&&c&&(0,M.jsx)(`button`,{type:`button`,className:`w-4 h-4 md:opacity-0 md:group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all`,onClick:e=>{e.stopPropagation(),K(c)},title:v(`recent.deleteProposal`),children:(0,M.jsx)(t,{className:`w-3 h-3`})})]})]},e.id)})}),Q.length>q&&(0,M.jsx)(`div`,{className:`pt-1 text-center`,children:(0,M.jsx)(`button`,{type:`button`,onClick:()=>ge(e=>e+H),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors px-3 py-1 rounded hover:bg-accent/50`,children:v(`recent.loadMore`,{count:Q.length-q})})}),F&&(0,M.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:we(()=>I(!1)),children:[(0,M.jsxs)(`div`,{ref:ye,className:`w-80 rounded-xl border border-border/30 bg-popover p-4 shadow-lg space-y-4`,onClick:e=>e.stopPropagation(),style:be,children:[(0,M.jsxs)(`div`,{...xe,className:Ce?`cursor-grab active:cursor-grabbing`:void 0,children:[(0,M.jsx)(`h3`,{className:`text-sm font-semibold`,children:v(`recent.clearModal.title`)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:v(`recent.clearModal.jobsInHistory`,{count:e.length})})]}),(0,M.jsx)(E,{variant:`destructive`,size:`sm`,className:`w-full`,disabled:me,onClick:()=>$(`all`),children:v(`recent.clearModal.clearAll`,{count:e.length})}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(`recent.clearModal.orByRange`)}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(`input`,{type:`date`,value:L,onChange:e=>U(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:v(`recent.clearModal.fromPlaceholder`)}),(0,M.jsx)(`input`,{type:`date`,value:W,onChange:e=>pe(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:v(`recent.clearModal.toPlaceholder`)})]}),(0,M.jsx)(E,{variant:`outline`,size:`sm`,className:`w-full`,disabled:me||!L&&!W,onClick:()=>$(`range`),children:L||W?v(`recent.clearModal.clearInRange`,{count:De}):v(`recent.clearModal.clearRange`)})]}),(0,M.jsx)(E,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>I(!1),children:v(`common:actions.cancel`)})]}),(0,M.jsx)(s,{handles:Se})]}),(0,M.jsx)(c,{open:G!==null,onOpenChange:e=>!e&&K(null),children:(0,M.jsxs)(d,{className:`max-w-sm`,children:[(0,M.jsxs)(r,{children:[(0,M.jsx)(b,{children:v(`recent.deleteProposalConfirm.title`)}),(0,M.jsx)(_,{children:v(`recent.deleteProposalConfirm.description`)})]}),(0,M.jsxs)(re,{children:[(0,M.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>K(null),children:v(`common:actions.cancel`)}),(0,M.jsx)(E,{variant:`destructive`,size:`sm`,onClick:()=>{G&&g?.(G),K(null)},children:v(`common:actions.delete`)})]})]})}),ve&&(0,M.jsx)(oe,{jobIds:ve,onClose:()=>{Z(null),X([]),_e(!1)}})]})}function W(){let{t:e}=h(`jobs`),{activeProjectId:t}=ee(),{recentJobs:n}=D(t),{data:i,isFirstLoad:s,refresh:l}=O({namespace:`jobs`,projectId:t,initialValue:n,fetcher:async()=>{let e=await fetch(`${T()}/jobs?limit=10`);return e.ok?(await e.json()).jobs:[]},pollInterval:1e4}),{data:f}=O({namespace:`proposals`,projectId:t,initialValue:[],fetcher:async()=>{let e=await fetch(`${T()}/propose?limit=10`);return e.ok?(await e.json()).proposals:[]},pollInterval:1e4}),p={input:`queued`,exploring:`running`,review:`running`,refining:`running`,creating_issue:`running`,created:`completed`,cancelled:`canceled`},m=f.map(e=>({id:`proposal:${e.id}`,command:`/specrails:propose-feature ${e.idea.length>60?e.idea.slice(0,57)+`...`:e.idea}`,started_at:e.created_at,status:p[e.status]??`queued`})),g=[...i,...m].sort((e,t)=>new Date(t.started_at).getTime()-new Date(e.started_at).getTime()),[_,y]=(0,j.useState)(null),x=(0,j.useCallback)(async e=>{try{let t=await fetch(`${T()}/propose/${e}`);if(!t.ok)return;y((await t.json()).proposal)}catch{}},[]),S=(0,j.useCallback)(async t=>{try{(await fetch(`${T()}/propose/${t}`,{method:`DELETE`})).ok&&(o.success(e(`page.proposalDeleted`)),l())}catch{}},[l,e]);return(0,M.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`page.title`)}),(0,M.jsx)(A,{baseUrl:`${T()}/jobs/export`,label:e(`page.exportJobs`)})]}),(0,M.jsx)(U,{jobs:g,isLoading:s,onJobsCleared:l,onProposalClick:x,onProposalDelete:S}),(0,M.jsx)(c,{open:_!==null,onOpenChange:e=>!e&&y(null),children:(0,M.jsx)(d,{className:`max-w-3xl glass-card`,children:_&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(r,{children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(b,{className:`flex-1 min-w-0`,children:e(`page.proposal.title`)}),(0,M.jsx)(u,{variant:_.status===`created`?`success`:_.status===`cancelled`?`destructive`:`secondary`,children:_.status})]})}),(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted/20 rounded px-2 py-1 italic`,children:_.idea}),_.result_markdown?(0,M.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto rounded-lg px-3 py-2 text-xs bg-muted/40`,children:(0,M.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none prose-p:my-1 prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded text-foreground/80`,children:(0,M.jsx)(a,{remarkPlugins:[v],children:_.result_markdown})})}):(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:e(`page.proposal.noContent`)}),_.issue_url&&(0,M.jsxs)(`div`,{className:`text-xs`,children:[e(`page.proposal.githubIssue`),` `,(0,M.jsx)(`a`,{href:_.issue_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:_.issue_url})]}),(0,M.jsxs)(re,{children:[(0,M.jsx)(E,{variant:`destructive`,size:`sm`,onClick:()=>{S(_.id),y(null)},children:e(`common:actions.delete`)}),(0,M.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>y(null),children:e(`common:actions.close`)})]})]})})})]})}export{W as default};