@runfusion/fusion 0.77.0-beta.5 → 0.77.0-beta.7

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 (167) hide show
  1. package/dist/bin.js +42668 -39363
  2. package/dist/child-process-worker.js +7647 -4857
  3. package/dist/client/.vite/manifest.json +259 -322
  4. package/dist/client/assets/{AgentDetailView-CSK_Rnlk.js → AgentDetailView-C1eh_vXv.js} +4 -4
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-kG44Adcm.js → AgentPermissionPolicyEditor-CeKsO1LR.js} +2 -2
  6. package/dist/client/assets/{AgentsView-ClKwKWnU.js → AgentsView-BNe2ABOc.js} +4 -4
  7. package/dist/client/assets/CommandCenter-BuREM-G1.js +102 -0
  8. package/dist/client/assets/DevServerView-D0i1b-QO.js +1 -0
  9. package/dist/client/assets/DirectoryPicker-VOx91hQt.js +1 -0
  10. package/dist/client/assets/DocumentsView-CO5W_WVb.js +1 -0
  11. package/dist/client/assets/EvalsView-BqSINSrZ.js +1 -0
  12. package/dist/client/assets/ExperimentalAgentOnboardingModal-DEcFgONi.js +1 -0
  13. package/dist/client/assets/{GoalsView-ysh3X2x6.js → GoalsView-DZ57wXmJ.js} +1 -1
  14. package/dist/client/assets/{InsightsView-BbMjCu7J.js → InsightsView-DSWfXG7Q.js} +3 -3
  15. package/dist/client/assets/{MemoryView-B3IgA8Bx.js → MemoryView-BEX10uhl.js} +1 -1
  16. package/dist/client/assets/{PiExtensionsManager-CZlIw7C3.js → PiExtensionsManager-DcAmXXoR.js} +2 -2
  17. package/dist/client/assets/PluginManager-BU0omQUv.js +1 -0
  18. package/dist/client/assets/{PullRequestView-DhhsJV8I.js → PullRequestView-B-JL_8Kk.js} +2 -2
  19. package/dist/client/assets/{ReportModal-CQMn4i1y.js → ReportModal-DxggF_RH.js} +5 -5
  20. package/dist/client/assets/{ResearchView-CVwfs4l3.js → ResearchView-CnwTXfQO.js} +1 -1
  21. package/dist/client/assets/{SecretsView-CrJfHle9.js → SecretsView-BDvzsLFz.js} +1 -1
  22. package/dist/client/assets/SettingsModal-801eFQ9u.js +21 -0
  23. package/dist/client/assets/{SettingsModal-B6U5Umru.js → SettingsModal-BZHeQ3ED.js} +1 -1
  24. package/dist/client/assets/{SettingsTextareaRow-O7-u9uMC.js → SettingsTextareaRow-B0rTuelr.js} +1 -1
  25. package/dist/client/assets/SetupWizardModal-CoExPwIn.js +2 -0
  26. package/dist/client/assets/{SkillsView-CoWAjvWU.js → SkillsView-WVP25LPj.js} +1 -1
  27. package/dist/client/assets/WorkflowNodeEditor-pCMyKcnS.js +8 -0
  28. package/dist/client/assets/{agent-import-generation-BqDmtTur.js → agent-import-generation-M_hKtjgN.js} +1 -1
  29. package/dist/client/assets/{agentsOrgChartLayout-C4cLqlV6.js → agentsOrgChartLayout-DjvIMhFD.js} +1 -1
  30. package/dist/client/assets/{app-C_PTWuI1.js → app-BOvA34XN.js} +3 -3
  31. package/dist/client/assets/{app-BBSLJDbV.js → app-Bic4iWXQ.js} +3 -3
  32. package/dist/client/assets/{app-Bvr57EZQ.js → app-BlbH7Tir.js} +2 -2
  33. package/dist/client/assets/{app-DwvelD-n.js → app-C6TctczU.js} +3 -3
  34. package/dist/client/assets/{app-DRW5hIgr.js → app-D3qZmEIu.js} +3 -3
  35. package/dist/client/assets/{app-BKwOvuxE.js → app-DLnMkUt5.js} +2 -2
  36. package/dist/client/assets/{app-DKx18PHE.js → app-mNy0DeDM.js} +3 -3
  37. package/dist/client/assets/{architectureDiagram-3BPJPVTR-CdxcwdRe.js → architectureDiagram-3BPJPVTR-CkzEm8i9.js} +1 -1
  38. package/dist/client/assets/{blockDiagram-GPEHLZMM-CfQrRfHR.js → blockDiagram-GPEHLZMM-Dc-dUMjY.js} +1 -1
  39. package/dist/client/assets/{c4Diagram-AAUBKEIU-Cx7-2SOm.js → c4Diagram-AAUBKEIU-DnYjsrR0.js} +1 -1
  40. package/dist/client/assets/channel-CxQ40s_U.js +1 -0
  41. package/dist/client/assets/{chunk-2J33WTMH-D8jvgP3M.js → chunk-2J33WTMH-0E1GEFEr.js} +1 -1
  42. package/dist/client/assets/{chunk-4BX2VUAB-B5tBx_s_.js → chunk-4BX2VUAB-Dj5oZd51.js} +1 -1
  43. package/dist/client/assets/{chunk-55IACEB6-C-F-HQ5Z.js → chunk-55IACEB6-DfNT0s8E.js} +1 -1
  44. package/dist/client/assets/{chunk-727SXJPM-BP8Ln-8C.js → chunk-727SXJPM-BnFjhiIQ.js} +1 -1
  45. package/dist/client/assets/{chunk-AQP2D5EJ-DMnTmRmn.js → chunk-AQP2D5EJ-DR84wSqR.js} +1 -1
  46. package/dist/client/assets/{chunk-FMBD7UC4-D_YdfnNc.js → chunk-FMBD7UC4-IjByNOrR.js} +1 -1
  47. package/dist/client/assets/{chunk-ND2GUHAM-CULXyuXq.js → chunk-ND2GUHAM-By0q_jZm.js} +1 -1
  48. package/dist/client/assets/{chunk-QZHKN3VN-CT1BWEJL.js → chunk-QZHKN3VN-BELcl3N5.js} +1 -1
  49. package/dist/client/assets/classDiagram-4FO5ZUOK-C2ARdiRL.js +1 -0
  50. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-C2ARdiRL.js +1 -0
  51. package/dist/client/assets/{common-13IRj_PO.js → common-BsNuuNOe.js} +1 -1
  52. package/dist/client/assets/{common-BBynATth.js → common-CASsTuSW.js} +1 -1
  53. package/dist/client/assets/{common-BG-vw0tL.js → common-CfyFt5OG.js} +1 -1
  54. package/dist/client/assets/{common-DSo46rnH.js → common-DS98trLj.js} +1 -1
  55. package/dist/client/assets/common-DeoHWJCq.js +1 -0
  56. package/dist/client/assets/common-PpMdoH5r.js +1 -0
  57. package/dist/client/assets/{common-vpHuuvkd.js → common-cN--mrmm.js} +1 -1
  58. package/dist/client/assets/{cose-bilkent-S5V4N54A-M-3DXa6e.js → cose-bilkent-S5V4N54A-D4cCw9-_.js} +1 -1
  59. package/dist/client/assets/{dagre-BM42HDAG-Bsiqvroz.js → dagre-BM42HDAG-JJp5dVeY.js} +1 -1
  60. package/dist/client/assets/dashboard-view-6zPJm9zC.js +1 -0
  61. package/dist/client/assets/{dashboard-view-BEBh_Ei5.js → dashboard-view-Bl9CPhxE.js} +1 -1
  62. package/dist/client/assets/{dashboard-view-CnFFG3cW.js → dashboard-view-C5Nt8cvY.js} +1 -1
  63. package/dist/client/assets/{dashboard-view-DAHn20ph.js → dashboard-view-MAC_LHDX.js} +2 -2
  64. package/dist/client/assets/{diagram-2AECGRRQ-CZiHoXo5.js → diagram-2AECGRRQ-D4L7j_t_.js} +1 -1
  65. package/dist/client/assets/{diagram-5GNKFQAL-BoJVz4Or.js → diagram-5GNKFQAL-VAGFaXqG.js} +1 -1
  66. package/dist/client/assets/{diagram-KO2AKTUF-DivGQuAL.js → diagram-KO2AKTUF-hqXSggfW.js} +1 -1
  67. package/dist/client/assets/{diagram-LMA3HP47-DkMK7OJp.js → diagram-LMA3HP47-B3eAIuy8.js} +1 -1
  68. package/dist/client/assets/{diagram-OG6HWLK6-DFFvRcpW.js → diagram-OG6HWLK6-BGufp0RK.js} +1 -1
  69. package/dist/client/assets/{erDiagram-TEJ5UH35--217vrom.js → erDiagram-TEJ5UH35-DplXdx8w.js} +1 -1
  70. package/dist/client/assets/{flowDiagram-I6XJVG4X-CQgWO3xf.js → flowDiagram-I6XJVG4X-C1Ms2bko.js} +1 -1
  71. package/dist/client/assets/{folder-open-DR6cRcNR.js → folder-open-nMraSDXu.js} +1 -1
  72. package/dist/client/assets/{ganttDiagram-6RSMTGT7-BjDMUrS3.js → ganttDiagram-6RSMTGT7-DVgxMtXb.js} +1 -1
  73. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-gKUcDnln.js → gitGraphDiagram-PVQCEYII-DH2_n0J8.js} +1 -1
  74. package/dist/client/assets/index-BJc-A7eB.css +1 -0
  75. package/dist/client/assets/index-CBFPgFTp.js +2787 -0
  76. package/dist/client/assets/{infoDiagram-5YYISTIA-BA91T8S5.js → infoDiagram-5YYISTIA-DmZdWVcU.js} +1 -1
  77. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-0BY5xe-c.js → ishikawaDiagram-YF4QCWOH-DsEIHSXr.js} +1 -1
  78. package/dist/client/assets/{journeyDiagram-JHISSGLW-B_OwenbQ.js → journeyDiagram-JHISSGLW-CsfIWmu1.js} +1 -1
  79. package/dist/client/assets/{kanban-definition-UN3LZRKU-GLabUTKp.js → kanban-definition-UN3LZRKU-CQKqeZvc.js} +1 -1
  80. package/dist/client/assets/{mermaid.core-BXo4rxYI.js → mermaid.core-DkC_dr4-.js} +4 -4
  81. package/dist/client/assets/{mindmap-definition-RKZ34NQL-DZl6LPoE.js → mindmap-definition-RKZ34NQL-RnmE-NUe.js} +1 -1
  82. package/dist/client/assets/{pieDiagram-4H26LBE5-DtHq-4py.js → pieDiagram-4H26LBE5-DPu6FPc4.js} +1 -1
  83. package/dist/client/assets/{puzzle-OVm-I1L4.js → puzzle-DwhHOf32.js} +1 -1
  84. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-BdjXhd5d.js → quadrantDiagram-W4KKPZXB-CYbypO2p.js} +1 -1
  85. package/dist/client/assets/{requirementDiagram-4Y6WPE33-BoFVjELN.js → requirementDiagram-4Y6WPE33-DFk1vK_N.js} +1 -1
  86. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-B0qyJh-P.js → sankeyDiagram-5OEKKPKP-CkUY1Zzu.js} +1 -1
  87. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-ByY62Eqp.js → sequenceDiagram-3UESZ5HK-CFivaLOO.js} +1 -1
  88. package/dist/client/assets/{standing-instructions-template-BsnnRlwm.js → standing-instructions-template-BbqKGAC1.js} +2 -2
  89. package/dist/client/assets/{stateDiagram-AJRCARHV-CwJ-_Phi.js → stateDiagram-AJRCARHV-BPeD5PwG.js} +1 -1
  90. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-Cfvhq8mV.js → stateDiagram-v2-BHNVJYJU-DduiCPMb.js} +1 -1
  91. package/dist/client/assets/{timeline-definition-PNZ67QCA-Co8VfGN9.js → timeline-definition-PNZ67QCA-CGUNNVro.js} +1 -1
  92. package/dist/client/assets/{upload-CkqDbEeE.js → upload-BS96H1o7.js} +1 -1
  93. package/dist/client/assets/{users-B8DkpbXD.js → users--irrWoyU.js} +1 -1
  94. package/dist/client/assets/{vennDiagram-CIIHVFJN-XSJteQrL.js → vennDiagram-CIIHVFJN-CybTaJJH.js} +1 -1
  95. package/dist/client/assets/{wardley-L42UT6IY-Btc0FRfF.js → wardley-L42UT6IY-DSxaSCGi.js} +1 -1
  96. package/dist/client/assets/{wardleyDiagram-YWT4CUSO--IcDNmrf.js → wardleyDiagram-YWT4CUSO-YFb0AxNt.js} +1 -1
  97. package/dist/client/assets/{xychartDiagram-2RQKCTM6-CZW93G6X.js → xychartDiagram-2RQKCTM6-Cv6zlMJC.js} +1 -1
  98. package/dist/client/index.html +2 -2
  99. package/dist/client/version.json +1 -1
  100. package/dist/droid-cli/package.json +1 -1
  101. package/dist/extension.js +37513 -34387
  102. package/dist/migrations/0065_fn_149_review_convergence_stage.sql +3 -0
  103. package/dist/pi-claude-cli/package.json +1 -1
  104. package/dist/plugin-sdk/index.d.ts +66 -10
  105. package/dist/plugin-sdk/index.js +103 -33
  106. package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +158 -36
  107. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  108. package/dist/plugins/fusion-plugin-claude-runtime/bundled.js +103 -33
  109. package/dist/plugins/fusion-plugin-claude-runtime/package.json +1 -1
  110. package/dist/plugins/fusion-plugin-cli-printing-press/bundled.js +103 -33
  111. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  112. package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +103 -33
  113. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  114. package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +103 -33
  115. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  116. package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +103 -33
  117. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  118. package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +103 -33
  119. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  120. package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +103 -33
  121. package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
  122. package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +103 -33
  123. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  124. package/dist/plugins/fusion-plugin-linear-import/bundled.js +103 -33
  125. package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
  126. package/dist/plugins/fusion-plugin-omp-runtime/bundled.js +103 -33
  127. package/dist/plugins/fusion-plugin-omp-runtime/package.json +1 -1
  128. package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +103 -33
  129. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  130. package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +103 -33
  131. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  132. package/dist/plugins/fusion-plugin-quality/bundled.js +103 -33
  133. package/dist/plugins/fusion-plugin-quality/package.json +1 -1
  134. package/dist/plugins/fusion-plugin-reports/bundled.js +103 -33
  135. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  136. package/dist/plugins/fusion-plugin-roadmap/bundled.js +103 -33
  137. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  138. package/dist/plugins/fusion-plugin-todos/bundled.js +103 -33
  139. package/dist/plugins/fusion-plugin-todos/package.json +1 -1
  140. package/dist/plugins/fusion-plugin-whatsapp-chat/bundled.js +103 -33
  141. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  142. package/package.json +1 -1
  143. package/skill/fusion/references/engine-tools.md +5 -5
  144. package/dist/client/assets/ChatView-DS4XiCm_.css +0 -1
  145. package/dist/client/assets/ChatView-DoOqgkPX.js +0 -13
  146. package/dist/client/assets/CommandCenter-CJxvPbgn.js +0 -102
  147. package/dist/client/assets/DevServerView-C4nyLONX.js +0 -1
  148. package/dist/client/assets/DirectoryPicker-BIvXWIB5.js +0 -1
  149. package/dist/client/assets/DocumentsView-DH_aZysM.js +0 -1
  150. package/dist/client/assets/EvalsView-klRK-GJQ.js +0 -1
  151. package/dist/client/assets/ExperimentalAgentOnboardingModal-CgBmukIm.js +0 -1
  152. package/dist/client/assets/PluginManager-vy0YZ2Nx.js +0 -1
  153. package/dist/client/assets/SessionTerminal-2ZSXmOkG.css +0 -1
  154. package/dist/client/assets/SessionTerminal-BRI8W1-G.js +0 -2
  155. package/dist/client/assets/SettingsModal-h1A_aFqD.js +0 -21
  156. package/dist/client/assets/SetupWizardModal-nXfJp8cA.js +0 -2
  157. package/dist/client/assets/WorkflowNodeEditor-BFMM3RF_.js +0 -8
  158. package/dist/client/assets/channel-B4WN1jC_.js +0 -1
  159. package/dist/client/assets/classDiagram-4FO5ZUOK-CKE8RSOv.js +0 -1
  160. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CKE8RSOv.js +0 -1
  161. package/dist/client/assets/common-DbOCE-0i.js +0 -1
  162. package/dist/client/assets/common-DnXF4Jmj.js +0 -1
  163. package/dist/client/assets/dashboard-view-Bo_gFjdO.js +0 -1
  164. package/dist/client/assets/index-Dki2LBAp.css +0 -1
  165. package/dist/client/assets/index-oxnX59eO.js +0 -2774
  166. package/dist/client/assets/shield-alert-CDy69fl7.js +0 -6
  167. package/dist/client/assets/useDiscoveredSkillsCache-BHUasRiZ.js +0 -1
@@ -1,21 +1,21 @@
1
- import{r as n,j as e,b as se}from"./vendor-react-SZ_qB27O.js";import{c as z,dm as re,e9 as Q,af as le,C as X,ea as oe,eb as ne,z as ce,b5 as ie,bH as he,ec as A,ed as ue,ee as Y}from"./index-oxnX59eO.js";import{u as _}from"./vendor-i18n-Duky4gdQ.js";/**
1
+ import{r as n,j as e,b as se}from"./vendor-react-SZ_qB27O.js";import{c as T,da as re,dd as Q,U as le,C as X,de as oe,df as ne,q as ce,aT as ie,bt as he,dg as A,dh as de,di as Y}from"./index-CBFPgFTp.js";import{u as _}from"./vendor-i18n-Duky4gdQ.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const de=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],me=z("bug",de);/**
6
+ */const ue=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],me=T("bug",ue);/**
7
7
  * @license lucide-react v1.7.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const pe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],be=z("life-buoy",pe);/**
11
+ */const pe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],be=T("life-buoy",pe);/**
12
12
  * @license lucide-react v1.7.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const we=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ve=z("moon",we);/**
16
+ */const we=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ve=T("moon",we);/**
17
17
  * @license lucide-react v1.7.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const fe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ye=z("sun",fe);async function G(s,u){const l=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!l.ok)throw new Error((await l.json().catch(()=>({error:l.statusText}))).error??l.statusText);return l.json()}function ge(s){return G("/api/report/draft",s)}function Ne(s){return G("/api/report/file",s)}function xe(s){return G("/api/report/help",{question:s})}async function ke(s){const u=new FormData;u.append("screenshot",s,"report-screenshot.png");const l=await fetch("/api/report/attachment",{method:"POST",body:u});if(!l.ok)throw new Error((await l.json().catch(()=>({error:l.statusText}))).error??l.statusText);return l.json()}async function Me(){const s=await fetch("/api/report/discussion-categories");if(!s.ok)throw new Error((await s.json().catch(()=>({error:s.statusText}))).error??s.statusText);return s.json()}function $e(s){const u=new URLSearchParams(s.search),l=s.hash.match(/^#\/tasks\/([^/?#]+)/),r=l?.[1]?decodeURIComponent(l[1]):u.get("taskId")??void 0,d=u.get("agentId")??void 0;return r||d?{taskId:r,agentId:d}:void 0}const J=[{value:"light",label:"Light",icon:ye},{value:"dark",label:"Dark",icon:ve},{value:"system",label:"System",icon:re}],V=[{value:"default",label:"Fusion Legacy",className:"theme-swatch-default"},{value:"ocean",label:"Ocean",className:"theme-swatch-ocean"},{value:"forest",label:"Forest",className:"theme-swatch-forest"},{value:"sunset",label:"Sunset",className:"theme-swatch-sunset"},{value:"zen",label:"Zen",className:"theme-swatch-zen"},{value:"berry",label:"Berry",className:"theme-swatch-berry"},{value:"high-contrast",label:"High Contrast",className:"theme-swatch-high-contrast"},{value:"industrial",label:"Industrial",className:"theme-swatch-industrial"},{value:"monochrome",label:"Mono",className:"theme-swatch-monochrome"},{value:"slate",label:"Slate",className:"theme-swatch-slate"},{value:"ash",label:"Ash",className:"theme-swatch-ash"},{value:"air",label:"Air",className:"theme-swatch-air"},{value:"graphite",label:"Graphite",className:"theme-swatch-graphite"},{value:"silver",label:"Silver",className:"theme-swatch-silver"},{value:"solarized",label:"Solarized",className:"theme-swatch-solarized"},{value:"factory",label:"Factory",className:"theme-swatch-factory"},{value:"factory-mono",label:"Factory Mono",className:"theme-swatch-factory-mono"},{value:"ayu",label:"Ayu",className:"theme-swatch-ayu"},{value:"one-dark",label:"One Dark",className:"theme-swatch-one-dark"},{value:"nord",label:"Nord",className:"theme-swatch-nord"},{value:"dracula",label:"Dracula",className:"theme-swatch-dracula"},{value:"gruvbox",label:"Gruvbox",className:"theme-swatch-gruvbox"},{value:"tokyo-night",label:"Tokyo Night",className:"theme-swatch-tokyo-night"},{value:"catppuccin-mocha",label:"Catppuccin Mocha",className:"theme-swatch-catppuccin-mocha"},{value:"github-dark",label:"GitHub Dark",className:"theme-swatch-github-dark"},{value:"everforest",label:"Everforest",className:"theme-swatch-everforest"},{value:"rose-pine",label:"Rosé Pine",className:"theme-swatch-rose-pine"},{value:"kanagawa",label:"Kanagawa",className:"theme-swatch-kanagawa"},{value:"night-owl",label:"Night Owl",className:"theme-swatch-night-owl"},{value:"palenight",label:"Palenight",className:"theme-swatch-palenight"},{value:"monokai-pro",label:"Monokai Pro",className:"theme-swatch-monokai-pro"},{value:"slime",label:"Slime",className:"theme-swatch-slime"},{value:"brutalist",label:"Brutalist",className:"theme-swatch-brutalist"},{value:"neon-city",label:"Neon City",className:"theme-swatch-neon-city"},{value:"parchment",label:"Parchment",className:"theme-swatch-parchment"},{value:"medieval",label:"Medieval",className:"theme-swatch-medieval"},{value:"terminal",label:"Terminal",className:"theme-swatch-terminal"},{value:"glass",label:"Glass",className:"theme-swatch-glass"},{value:"glass-silver",label:"Glass Silver",className:"theme-swatch-glass-silver"},{value:"horizon",label:"Horizon",className:"theme-swatch-horizon"},{value:"vitesse",label:"Vitesse",className:"theme-swatch-vitesse"},{value:"outrun",label:"Outrun",className:"theme-swatch-outrun"},{value:"snazzy",label:"Snazzy",className:"theme-swatch-snazzy"},{value:"porple",label:"Porple",className:"theme-swatch-porple"},{value:"espresso",label:"Espresso",className:"theme-swatch-espresso"},{value:"mars",label:"Mars",className:"theme-swatch-mars"},{value:"poimandres",label:"Poimandres",className:"theme-swatch-poimandres"},{value:"ember",label:"Ember",className:"theme-swatch-ember"},{value:"rust",label:"Rust",className:"theme-swatch-rust"},{value:"copper",label:"Copper",className:"theme-swatch-copper"},{value:"foundry",label:"Foundry",className:"theme-swatch-foundry"},{value:"carbon",label:"Carbon",className:"theme-swatch-carbon"},{value:"sandstone",label:"Sandstone",className:"theme-swatch-sandstone"},{value:"lagoon",label:"Lagoon",className:"theme-swatch-lagoon"},{value:"frost",label:"Frost",className:"theme-swatch-frost"},{value:"lavender",label:"Lavender",className:"theme-swatch-lavender"},{value:"neon-bloom",label:"Neon Bloom",className:"theme-swatch-neon-bloom"},{value:"sepia",label:"Sepia",className:"theme-swatch-sepia"},{value:"cobalt",label:"Cobalt",className:"theme-swatch-cobalt"},{value:"clay",label:"Clay",className:"theme-swatch-clay"},{value:"moss",label:"Moss",className:"theme-swatch-moss"},{value:"aurora",label:"Aurora",className:"theme-swatch-aurora"},{value:"calm",label:"Calm",className:"theme-swatch-calm"},{value:"dawn",label:"Dawn",className:"theme-swatch-dawn"},{value:"sage",label:"Sage",className:"theme-swatch-sage"},{value:"midnight",label:"Midnight",className:"theme-swatch-midnight"},{value:"velvet",label:"Velvet",className:"theme-swatch-velvet"},{value:"factory-dark",label:"Factory Dark",className:"theme-swatch-factory-dark"},{value:"factory-light",label:"Factory Light",className:"theme-swatch-factory-light"},{value:"shadcn",label:"Shadcn",className:"theme-swatch-shadcn"},{value:"shadcn-ember",label:"Shadcn Ember (Default)",className:"theme-swatch-shadcn-ember"},{value:"shadcn-custom",label:"Shadcn Custom",className:"theme-swatch-shadcn-custom"},{value:"shadcn-blue",label:"Shadcn Blue",className:"theme-swatch-shadcn-blue"},{value:"shadcn-green",label:"Shadcn Green",className:"theme-swatch-shadcn-green"},{value:"shadcn-red",label:"Shadcn Red",className:"theme-swatch-shadcn-red"},{value:"shadcn-purple",label:"Shadcn Purple",className:"theme-swatch-shadcn-purple"},{value:"shadcn-pink",label:"Shadcn Pink",className:"theme-swatch-shadcn-pink"},{value:"shadcn-orange",label:"Shadcn Orange",className:"theme-swatch-shadcn-orange"},{value:"shadcn-yellow",label:"Shadcn Yellow",className:"theme-swatch-shadcn-yellow"},{value:"shadcn-mono",label:"Shadcn Mono",className:"theme-swatch-shadcn-mono"},{value:"shadcn-mono-red",label:"Shadcn Mono Red",className:"theme-swatch-shadcn-mono-red"},{value:"shadcn-mono-blue",label:"Shadcn Mono Blue",className:"theme-swatch-shadcn-mono-blue"},{value:"shadcn-mono-green",label:"Shadcn Mono Green",className:"theme-swatch-shadcn-mono-green"},{value:"shadcn-mono-purple",label:"Shadcn Mono Purple",className:"theme-swatch-shadcn-mono-purple"},{value:"shadcn-mono-pink",label:"Shadcn Mono Pink",className:"theme-swatch-shadcn-mono-pink"},{value:"shadcn-mono-orange",label:"Shadcn Mono Orange",className:"theme-swatch-shadcn-mono-orange"},{value:"shadcn-mono-yellow",label:"Shadcn Mono Yellow",className:"theme-swatch-shadcn-mono-yellow"},{value:"shadcn-black",label:"Shadcn Black",className:"theme-swatch-shadcn-black"},{value:"shadcn-gray",label:"Shadcn Gray",className:"theme-swatch-shadcn-gray"},{value:"shadcn-gray-blue",label:"Shadcn Gray Blue",className:"theme-swatch-shadcn-gray-blue"}];function je(s){const u=s.trim();if(/^#[\da-f]{6}$/i.test(u))return u;if(/^#[\da-f]{3}$/i.test(u)){const[,l,r,d]=u;return`#${l}${l}${r}${r}${d}${d}`}return"#000000"}function Ce({value:s={},onChange:u,resolvedThemeMode:l="dark"}){const{t:r}=_("app"),[d,j]=n.useState(!1),t=n.useId(),w=n.useMemo(()=>Q(s),[s]),h=(o,v)=>{u(Q({...w,[o]:v}))},m=d?r("theme.shadcnCustom.collapse","Collapse custom colors"):r("theme.shadcnCustom.show","Show custom colors"),i=d?le:X;return e.jsxs("section",{className:"shadcn-color-picker card","data-testid":"shadcn-color-picker","aria-labelledby":"shadcn-color-picker-title",children:[e.jsxs("div",{className:"shadcn-color-picker-header",children:[e.jsxs("div",{className:"shadcn-color-picker-heading",children:[e.jsx("h3",{id:"shadcn-color-picker-title",className:"shadcn-color-picker-title",children:r("theme.shadcnCustom.title","Custom shadcn colors")}),e.jsx("p",{className:"shadcn-color-picker-description",children:r("theme.shadcnCustom.description","Override shadcn design tokens with hex colors. Blank tokens use the theme defaults.")})]}),e.jsx("button",{type:"button",className:"btn btn-icon btn-sm shadcn-color-picker-toggle","aria-expanded":d,"aria-controls":t,"aria-label":m,title:m,onClick:()=>j(o=>!o),children:e.jsx(i,{size:16,"aria-hidden":"true"})})]}),d?e.jsxs("div",{id:t,className:"shadcn-color-picker-controls-panel","data-testid":"shadcn-color-picker-controls",children:[e.jsx("div",{className:"shadcn-color-picker-actions",children:e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>u({}),children:r("theme.shadcnCustom.reset","Reset custom colors")})}),e.jsx("div",{className:"shadcn-color-picker-grid",children:oe.map(o=>{const v=ne(o,l),g=w[o.cssVar]??v,y=`shadcn-color-${o.cssVar.replace(/^--/,"").replace(/[^a-z0-9]+/gi,"-")}`;return e.jsxs("div",{className:"shadcn-color-picker-row","data-testid":`shadcn-color-${o.cssVar}`,children:[e.jsxs("label",{className:"shadcn-color-picker-label",htmlFor:y,children:[e.jsx("span",{children:r(`theme.shadcnCustom.token.${o.cssVar}`,o.label)}),e.jsx("code",{children:o.cssVar})]}),e.jsxs("div",{className:"shadcn-color-picker-controls",children:[e.jsx("input",{"aria-label":r("theme.shadcnCustom.colorInput","Pick {{label}} color",{label:o.label}),className:"shadcn-color-picker-native",type:"color",value:je(g),onChange:k=>h(o.cssVar,k.currentTarget.value)}),e.jsx("input",{id:y,"aria-label":r("theme.shadcnCustom.hexInput","{{label}} hex color",{label:o.label}),className:"input shadcn-color-picker-hex",type:"text",inputMode:"text",spellCheck:!1,value:g,onChange:k=>h(o.cssVar,k.currentTarget.value)})]})]},o.cssVar)})})]}):null]})}function Se(s){return V.find(u=>u.value===s)??V[0]}function Z(s){return s.trim().normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase()}function O({className:s}){return e.jsxs("span",{className:`theme-option-swatch ${s}`,"aria-hidden":"true",children:[e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-1"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-2"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-3"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-4"})]})}function Le({colorTheme:s,onColorThemeChange:u,themeMode:l,shadcnCustomColors:r={},resolvedThemeMode:d=l==="light"?"light":"dark",onThemeModeChange:j,onShadcnCustomColorsChange:t=()=>{},triggerVariant:w="compact"}){const{t:h}=_("app"),[m,i]=n.useState(!1),[o,v]=n.useState(""),[g,y]=n.useState(s),[k,S]=n.useState(null),I=n.useRef(null),D=n.useRef(null),E=n.useRef(!1),N=n.useRef([]),M=n.useMemo(()=>Se(s),[s]),T=l==="system"?d:l,$=J.find(a=>a.value===T)?.icon,c=l==="system"?h("theme.system","System"):h(`theme.${l}`,l?`${l.charAt(0).toUpperCase()}${l.slice(1)}`:"Dark"),b=h(`theme.colorTheme.${M.value}`,M.label),R=`${h("theme.currentTheme","Current theme")} ${c} / ${b}`,H="theme-dropdown-listbox",B=n.useMemo(()=>V.map(a=>({...a,displayLabel:h(`theme.colorTheme.${a.value}`,a.label)})),[h]),U=Z(o),p=n.useMemo(()=>B.filter(a=>Z(a.displayLabel).includes(U)),[U,B]),W=p.findIndex(a=>a.value===g),L=()=>{i(!1),v(""),y(s),S(null),E.current=!1,N.current=[]};n.useEffect(()=>{if(!m)return;const a=f=>{I.current&&!I.current.contains(f.target)&&L()};return document.addEventListener("pointerdown",a),()=>document.removeEventListener("pointerdown",a)},[m,s]),n.useEffect(()=>{m&&(p.some(a=>a.value===g)||y(p[0]?.value??null))},[g,p,m]),n.useEffect(()=>{if(m){if(k==="pointer"&&E.current)D.current?.focus(),E.current=!1;else if(k==="keyboard"){const a=p.findIndex(f=>f.value===g);N.current[a]?.focus()}}},[g,p,m,k]);const K=a=>{u(a),L()},q=(a,f)=>{if(a==="pointer")E.current=!0,y(s);else{const F=p.some(C=>C.value===s),x=f==="ArrowUp"?p.at(-1)?.value??null:f==="ArrowDown"?p[0]?.value??null:F?s:p[0]?.value??null;y(x)}S(a),i(!0)},ee=a=>{(a.key==="ArrowDown"||a.key==="ArrowUp"||a.key==="Enter"||a.key===" ")&&(a.preventDefault(),q("keyboard",a.key))},ae=a=>{if(a.key==="Escape"){a.preventDefault(),L();return}if(a.key!=="ArrowDown"&&a.key!=="ArrowUp")return;const f=a.key==="ArrowUp"?p.length-1:Math.max(0,W);f<0||!p[f]||(a.preventDefault(),y(p[f].value),N.current[f]?.focus())},te=(a,f,F)=>{if(a.key==="Escape"){a.preventDefault(),L();return}if(a.key==="ArrowDown"||a.key==="ArrowUp"){a.preventDefault();const x=a.key==="ArrowDown"?1:-1,C=(f+x+p.length)%p.length;y(p[C]?.value??null),N.current[C]?.focus();return}if(a.key==="Home"){a.preventDefault(),y(p[0]?.value??null),N.current[0]?.focus();return}if(a.key==="End"){a.preventDefault();const x=p.length-1;y(p[x]?.value??null),N.current[x]?.focus();return}(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),K(F))};return e.jsxs("div",{className:`theme-dropdown${w==="current-row"?" theme-dropdown--current-row":""}${m?" open":""}`,ref:I,children:[e.jsxs("button",{type:"button",className:`theme-dropdown-trigger btn${w==="current-row"?" theme-dropdown-trigger--current-row":""}`,"aria-label":w==="current-row"?R:void 0,"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?H:void 0,onClick:()=>m?L():q("pointer"),onKeyDown:ee,children:[w==="current-row"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"theme-dropdown-current-row-icon","aria-hidden":"true",children:$?e.jsx($,{size:20}):null}),e.jsxs("span",{className:"theme-dropdown-current-row-info",children:[e.jsx("span",{className:"theme-dropdown-current-row-label",children:h("theme.currentTheme","Current theme")}),e.jsxs("span",{className:"theme-dropdown-current-row-value",children:[c," / ",b]})]}),e.jsx(O,{className:M.className})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{className:M.className}),e.jsx("span",{className:"theme-dropdown-trigger-label",children:b})]}),e.jsx(X,{size:16,"aria-hidden":"true"})]}),l&&j?e.jsx("div",{className:"theme-dropdown-modes",role:"radiogroup","aria-label":h("theme.modeLabel","Theme mode"),children:J.map(({value:a,label:f,icon:F})=>e.jsxs("button",{type:"button",className:`theme-dropdown-mode-btn btn btn-sm${l===a?" active":""}`,"aria-pressed":l===a,onClick:()=>j(a),title:h(`theme.${a}Mode`,`${f} mode`),children:[e.jsx(F,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:h(`theme.${a}`,f)})]},a))}):null,s==="shadcn-custom"?e.jsx(Ce,{value:r,onChange:t,resolvedThemeMode:d}):null,m?e.jsxs("div",{className:"theme-dropdown-popover",role:"presentation",children:[e.jsxs("label",{className:"theme-dropdown-filter",children:[e.jsx("span",{className:"sr-only",children:h("theme.filterColorThemes","Filter color themes")}),e.jsx("input",{ref:D,type:"search",className:"input",value:o,placeholder:h("theme.filterColorThemesPlaceholder","Filter color themes"),"aria-label":h("theme.filterColorThemes","Filter color themes"),onChange:a=>v(a.target.value),onKeyDown:ae})]}),p.length?e.jsx("div",{id:H,className:"theme-dropdown-list",role:"listbox","aria-label":h("theme.colorThemeLabel","Color theme"),children:p.map(({value:a,displayLabel:f,className:F},x)=>{const C=s===a;return e.jsxs("button",{ref:P=>{N.current[x]=P},type:"button",className:`theme-dropdown-option${C?" active":""}`,role:"option","aria-selected":C,tabIndex:x===W?0:-1,onClick:()=>K(a),onKeyDown:P=>te(P,x,a),children:[e.jsx(O,{className:F}),e.jsx("span",{className:"theme-dropdown-option-label",children:f}),C?e.jsx(ce,{size:16,"aria-hidden":"true"}):null]},a)})}):e.jsx("p",{className:"theme-dropdown-no-results",children:h("theme.noColorThemes","No color themes found")})]}):null]})}const De=[{type:"bug",label:"Report bug",Icon:me},{type:"feedback",label:"Send feedback",Icon:ie},{type:"idea",label:"Share idea",Icon:he},{type:"help",label:"Get help",Icon:be}];function ze({onSelect:s}){const{t:u}=_("app"),[l,r]=n.useState(!1),[d,j]=n.useState(),t=n.useRef(null),w=n.useRef(null),h=n.useCallback(()=>{const i=t.current?.getBoundingClientRect();i&&j({top:i.bottom,left:i.left,right:window.innerWidth-i.right})},[]);n.useEffect(()=>{if(!l)return;h();const i=()=>h();return window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[l,h]),n.useEffect(()=>{if(!l)return;const i=v=>{const g=v.target;t.current?.contains(g)||w.current?.contains(g)||r(!1)},o=v=>{v.key==="Escape"&&(r(!1),t.current?.focus())};return document.addEventListener("mousedown",i),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",o)}},[l]);const m=l&&d&&typeof document<"u"?se.createPortal(e.jsx("div",{ref:w,className:"report-action-menu__list report-action-menu__list--portal",role:"menu",style:{top:d.top,left:d.left,right:d.right},children:De.map(({type:i,label:o,Icon:v})=>e.jsxs("button",{className:"report-action-menu__item",type:"button",role:"menuitem",onClick:()=>{r(!1),s(i)},children:[e.jsx(v,{"aria-hidden":"true"}),u(`report.actions.${i}`,o)]},i))}),document.body):null;return e.jsxs("div",{className:"report-action-menu",children:[e.jsx("button",{ref:t,className:"btn btn-secondary",type:"button","aria-haspopup":"menu","aria-expanded":l,onClick:()=>r(i=>!i),children:u("report.menu","Report")}),m]})}const Ee={bug:"What went wrong?",feedback:"What would you like to share?",idea:"What would you like Fusion to do?",help:"What would you like help with?"};function _e({actionType:s,onClose:u,contextRefs:l}){const{t:r}=_("app"),[d,j]=n.useState(""),[t,w]=n.useState(),[h,m]=n.useState(!1),[i,o]=n.useState(),[v,g]=n.useState(!1),[y,k]=n.useState(),[S,I]=n.useState(),[D,E]=n.useState(!1),N=n.useRef(0),M=async c=>{m(!0),o(void 0);try{const b=await ue();if(!b)throw new Error("Screen capture was unavailable or denied.");const{artifactId:R}=await ke(b);if(N.current!==c)return;I(R)}catch(b){if(N.current!==c)return;g(!1),o(b instanceof Error?b.message:"We could not capture the current screen.")}finally{N.current===c&&m(!1)}},T=async()=>{if(d.trim()){if(v&&(!S||!D)){o("Capture and confirm local screenshot retention before continuing, or turn attachment off.");return}m(!0),o(void 0);try{if(Y("report"),s==="help"){const c=await xe(d);if(c.answered){w({kind:"help",answer:c.answer});return}}w(await ge({actionType:s,targetType:y,userPrompt:d,contextRefs:l,activityTrace:A(),screenshotArtifactId:v&&D?S:void 0}))}catch{o("We could not prepare your report. Check your connection and try again.")}finally{m(!1)}}},$=async(c,b,R)=>{if(t?.report){m(!0),o(void 0);try{Y("report"),w(await Ne({actionType:s,targetType:y,report:t.report,endorseIssueNumber:c,endorseDiscussionId:b,endorseRoadmapIssueNumber:R,activityTrace:A(),screenshotArtifactId:v&&D?S:void 0}))}catch{o("We could not send your report. Your draft is still here; try again.")}finally{m(!1)}}};return e.jsx("div",{className:"report-modal-backdrop",role:"presentation",children:e.jsxs("section",{className:"card report-modal",role:"dialog","aria-modal":"true","aria-label":`${s} report`,children:[e.jsx("button",{className:"btn-icon report-modal__close",type:"button","aria-label":r("report.close","Close report"),onClick:u,children:"×"}),i&&e.jsx("p",{className:"report-modal__error",role:"alert",children:i}),!t&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:s[0].toUpperCase()+s.slice(1)}),e.jsx("label",{htmlFor:"report-prompt",children:Ee[s]}),e.jsx("textarea",{id:"report-prompt",className:"input",value:d,onChange:c=>j(c.target.value),maxLength:4e3}),e.jsxs("label",{className:"report-modal__screenshot-option",children:[e.jsx("input",{type:"checkbox",checked:v,onChange:c=>{const b=c.target.checked,R=++N.current;g(b),I(void 0),E(!1),b?M(R):m(!1)}})," ",r("report.storeScreenshot","Store a screenshot locally")]}),v&&e.jsx("div",{className:"report-modal__screenshot-preview",children:S?e.jsxs("label",{className:"report-modal__screenshot-option",children:[e.jsx("input",{type:"checkbox",checked:D,onChange:c=>E(c.target.checked)})," ",r("report.confirmScreenshotRetention","I confirm Fusion may retain this screenshot locally for this report.")]}):e.jsx("p",{children:r("report.capturingScreenshot","Capturing and storing locally…")})}),e.jsx("label",{htmlFor:"report-target",children:r("report.targetLabel","Filing target")}),e.jsxs("select",{id:"report-target",className:"input",value:y??"",onChange:c=>k(c.target.value||void 0),children:[e.jsx("option",{value:"",children:r("report.targetInherit","Use configured action target")}),e.jsx("option",{value:"issue",children:r("report.targetIssue","GitHub Issue")}),e.jsx("option",{value:"discussion",children:r("report.targetDiscussion","GitHub Discussion")})]}),e.jsxs("details",{className:"report-modal__activity-trace",children:[e.jsx("summary",{children:r("report.activityTrace","Activity trace to send")}),e.jsx("ul",{children:A().map((c,b)=>e.jsx("li",{children:c},`${c}-${b}`))})]}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:!d.trim()||h,onClick:()=>void T(),children:i?"Retry":"Continue"})]}),t?.kind==="draft-ready"&&t.report&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:r("report.review","Review your report")}),e.jsx("label",{htmlFor:"report-review-prompt",children:r("report.summary","Report summary")}),e.jsx("textarea",{id:"report-review-prompt",className:"input",value:t.report.userPrompt,onChange:c=>{const b=c.target.value;w({...t,report:{...t.report,userPrompt:b}})}}),e.jsx("label",{htmlFor:"report-review-body",children:r("report.structured","Structured report")}),e.jsx("textarea",{id:"report-review-body",className:"input",value:t.report.body??"",onChange:c=>w({...t,report:{...t.report,body:c.target.value}})}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:h,onClick:()=>void $(),children:r("report.file","File report")})]}),t?.kind==="duplicate-found"&&t.issue&&t.report&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t.issue.roadmap?r("report.roadmapDuplicate.title","Already on the roadmap — add your data point?"):r("report.duplicateReview","Review data point for a similar open issue")}),e.jsx("a",{href:t.issue.url,target:"_blank",rel:"noreferrer",children:t.issue.title}),e.jsx("label",{htmlFor:"report-duplicate-prompt",children:r("report.summary","Report summary")}),e.jsx("textarea",{id:"report-duplicate-prompt",className:"input",value:t.report.userPrompt,onChange:c=>{const b=c.target.value;w({...t,report:{...t.report,userPrompt:b}})}}),e.jsx("label",{htmlFor:"report-duplicate-body",children:r("report.structuredDataPoint","Structured data point")}),e.jsx("textarea",{id:"report-duplicate-body",className:"input",value:t.report.body??"",onChange:c=>w({...t,report:{...t.report,body:c.target.value}})}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:h,onClick:()=>void $(t.issue.discussionId||t.issue.roadmap?void 0:t.issue.number,t.issue.discussionId,t.issue.roadmap?t.issue.number:void 0),children:r("report.confirmDataPoint","Confirm and add data point")})]}),(t?.kind==="filed"||t?.kind==="endorsed")&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t.kind==="filed"&&t.destination==="issue"?"Report filed as an Issue":"Report sent"}),e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",children:r("report.viewGitHub","View on GitHub")}),t.report?.body&&e.jsxs(e.Fragment,{children:[e.jsx("label",{htmlFor:"filed-report",children:r("report.final","Final report")}),e.jsx("textarea",{id:"filed-report",className:"input",value:t.report.body,readOnly:!0})]})]}),t?.kind==="help"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:r("report.suggestedHelp","Suggested help")}),e.jsx("p",{children:t.answer?.summary??t.answer?.content})]}),t?.kind==="unavailable"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"alert",children:t.message}),e.jsx("button",{className:"btn btn-secondary",type:"button",onClick:()=>{w(void 0),o(void 0)},children:r("report.returnToPrompt","Return to prompt")})]})]})})}export{me as B,ze as R,J as T,Le as a,_e as b,Me as l,$e as r};
21
+ */const fe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ye=T("sun",fe);async function G(s,d){const l=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!l.ok)throw new Error((await l.json().catch(()=>({error:l.statusText}))).error??l.statusText);return l.json()}function ge(s){return G("/api/report/draft",s)}function Ne(s){return G("/api/report/file",s)}function xe(s){return G("/api/report/help",{question:s})}async function ke(s){const d=new FormData;d.append("screenshot",s,"report-screenshot.png");const l=await fetch("/api/report/attachment",{method:"POST",body:d});if(!l.ok)throw new Error((await l.json().catch(()=>({error:l.statusText}))).error??l.statusText);return l.json()}async function Me(){const s=await fetch("/api/report/discussion-categories");if(!s.ok)throw new Error((await s.json().catch(()=>({error:s.statusText}))).error??s.statusText);return s.json()}function $e(s){const d=new URLSearchParams(s.search),l=s.hash.match(/^#\/tasks\/([^/?#]+)/),r=l?.[1]?decodeURIComponent(l[1]):d.get("taskId")??void 0,u=d.get("agentId")??void 0;return r||u?{taskId:r,agentId:u}:void 0}const J=[{value:"light",label:"Light",icon:ye},{value:"dark",label:"Dark",icon:ve},{value:"system",label:"System",icon:re}],V=[{value:"default",label:"Fusion Legacy",className:"theme-swatch-default"},{value:"ocean",label:"Ocean",className:"theme-swatch-ocean"},{value:"forest",label:"Forest",className:"theme-swatch-forest"},{value:"sunset",label:"Sunset",className:"theme-swatch-sunset"},{value:"zen",label:"Zen",className:"theme-swatch-zen"},{value:"berry",label:"Berry",className:"theme-swatch-berry"},{value:"high-contrast",label:"High Contrast",className:"theme-swatch-high-contrast"},{value:"industrial",label:"Industrial",className:"theme-swatch-industrial"},{value:"monochrome",label:"Mono",className:"theme-swatch-monochrome"},{value:"slate",label:"Slate",className:"theme-swatch-slate"},{value:"ash",label:"Ash",className:"theme-swatch-ash"},{value:"air",label:"Air",className:"theme-swatch-air"},{value:"graphite",label:"Graphite",className:"theme-swatch-graphite"},{value:"silver",label:"Silver",className:"theme-swatch-silver"},{value:"solarized",label:"Solarized",className:"theme-swatch-solarized"},{value:"factory",label:"Factory",className:"theme-swatch-factory"},{value:"factory-mono",label:"Factory Mono",className:"theme-swatch-factory-mono"},{value:"ayu",label:"Ayu",className:"theme-swatch-ayu"},{value:"one-dark",label:"One Dark",className:"theme-swatch-one-dark"},{value:"nord",label:"Nord",className:"theme-swatch-nord"},{value:"dracula",label:"Dracula",className:"theme-swatch-dracula"},{value:"gruvbox",label:"Gruvbox",className:"theme-swatch-gruvbox"},{value:"tokyo-night",label:"Tokyo Night",className:"theme-swatch-tokyo-night"},{value:"catppuccin-mocha",label:"Catppuccin Mocha",className:"theme-swatch-catppuccin-mocha"},{value:"github-dark",label:"GitHub Dark",className:"theme-swatch-github-dark"},{value:"everforest",label:"Everforest",className:"theme-swatch-everforest"},{value:"rose-pine",label:"Rosé Pine",className:"theme-swatch-rose-pine"},{value:"kanagawa",label:"Kanagawa",className:"theme-swatch-kanagawa"},{value:"night-owl",label:"Night Owl",className:"theme-swatch-night-owl"},{value:"palenight",label:"Palenight",className:"theme-swatch-palenight"},{value:"monokai-pro",label:"Monokai Pro",className:"theme-swatch-monokai-pro"},{value:"slime",label:"Slime",className:"theme-swatch-slime"},{value:"brutalist",label:"Brutalist",className:"theme-swatch-brutalist"},{value:"neon-city",label:"Neon City",className:"theme-swatch-neon-city"},{value:"parchment",label:"Parchment",className:"theme-swatch-parchment"},{value:"medieval",label:"Medieval",className:"theme-swatch-medieval"},{value:"terminal",label:"Terminal",className:"theme-swatch-terminal"},{value:"glass",label:"Glass",className:"theme-swatch-glass"},{value:"glass-silver",label:"Glass Silver",className:"theme-swatch-glass-silver"},{value:"horizon",label:"Horizon",className:"theme-swatch-horizon"},{value:"vitesse",label:"Vitesse",className:"theme-swatch-vitesse"},{value:"outrun",label:"Outrun",className:"theme-swatch-outrun"},{value:"snazzy",label:"Snazzy",className:"theme-swatch-snazzy"},{value:"porple",label:"Porple",className:"theme-swatch-porple"},{value:"espresso",label:"Espresso",className:"theme-swatch-espresso"},{value:"mars",label:"Mars",className:"theme-swatch-mars"},{value:"poimandres",label:"Poimandres",className:"theme-swatch-poimandres"},{value:"ember",label:"Ember",className:"theme-swatch-ember"},{value:"rust",label:"Rust",className:"theme-swatch-rust"},{value:"copper",label:"Copper",className:"theme-swatch-copper"},{value:"foundry",label:"Foundry",className:"theme-swatch-foundry"},{value:"carbon",label:"Carbon",className:"theme-swatch-carbon"},{value:"sandstone",label:"Sandstone",className:"theme-swatch-sandstone"},{value:"lagoon",label:"Lagoon",className:"theme-swatch-lagoon"},{value:"frost",label:"Frost",className:"theme-swatch-frost"},{value:"lavender",label:"Lavender",className:"theme-swatch-lavender"},{value:"neon-bloom",label:"Neon Bloom",className:"theme-swatch-neon-bloom"},{value:"sepia",label:"Sepia",className:"theme-swatch-sepia"},{value:"cobalt",label:"Cobalt",className:"theme-swatch-cobalt"},{value:"clay",label:"Clay",className:"theme-swatch-clay"},{value:"moss",label:"Moss",className:"theme-swatch-moss"},{value:"aurora",label:"Aurora",className:"theme-swatch-aurora"},{value:"calm",label:"Calm",className:"theme-swatch-calm"},{value:"dawn",label:"Dawn",className:"theme-swatch-dawn"},{value:"sage",label:"Sage",className:"theme-swatch-sage"},{value:"midnight",label:"Midnight",className:"theme-swatch-midnight"},{value:"velvet",label:"Velvet",className:"theme-swatch-velvet"},{value:"factory-dark",label:"Factory Dark",className:"theme-swatch-factory-dark"},{value:"factory-light",label:"Factory Light",className:"theme-swatch-factory-light"},{value:"shadcn",label:"Shadcn",className:"theme-swatch-shadcn"},{value:"shadcn-ember",label:"Shadcn Ember (Default)",className:"theme-swatch-shadcn-ember"},{value:"shadcn-custom",label:"Shadcn Custom",className:"theme-swatch-shadcn-custom"},{value:"shadcn-blue",label:"Shadcn Blue",className:"theme-swatch-shadcn-blue"},{value:"shadcn-green",label:"Shadcn Green",className:"theme-swatch-shadcn-green"},{value:"shadcn-red",label:"Shadcn Red",className:"theme-swatch-shadcn-red"},{value:"shadcn-purple",label:"Shadcn Purple",className:"theme-swatch-shadcn-purple"},{value:"shadcn-pink",label:"Shadcn Pink",className:"theme-swatch-shadcn-pink"},{value:"shadcn-orange",label:"Shadcn Orange",className:"theme-swatch-shadcn-orange"},{value:"shadcn-yellow",label:"Shadcn Yellow",className:"theme-swatch-shadcn-yellow"},{value:"shadcn-mono",label:"Shadcn Mono",className:"theme-swatch-shadcn-mono"},{value:"shadcn-mono-red",label:"Shadcn Mono Red",className:"theme-swatch-shadcn-mono-red"},{value:"shadcn-mono-blue",label:"Shadcn Mono Blue",className:"theme-swatch-shadcn-mono-blue"},{value:"shadcn-mono-green",label:"Shadcn Mono Green",className:"theme-swatch-shadcn-mono-green"},{value:"shadcn-mono-purple",label:"Shadcn Mono Purple",className:"theme-swatch-shadcn-mono-purple"},{value:"shadcn-mono-pink",label:"Shadcn Mono Pink",className:"theme-swatch-shadcn-mono-pink"},{value:"shadcn-mono-orange",label:"Shadcn Mono Orange",className:"theme-swatch-shadcn-mono-orange"},{value:"shadcn-mono-yellow",label:"Shadcn Mono Yellow",className:"theme-swatch-shadcn-mono-yellow"},{value:"shadcn-black",label:"Shadcn Black",className:"theme-swatch-shadcn-black"},{value:"shadcn-gray",label:"Shadcn Gray",className:"theme-swatch-shadcn-gray"},{value:"shadcn-gray-blue",label:"Shadcn Gray Blue",className:"theme-swatch-shadcn-gray-blue"}];function je(s){const d=s.trim();if(/^#[\da-f]{6}$/i.test(d))return d;if(/^#[\da-f]{3}$/i.test(d)){const[,l,r,u]=d;return`#${l}${l}${r}${r}${u}${u}`}return"#000000"}function Ce({value:s={},onChange:d,resolvedThemeMode:l="dark"}){const{t:r}=_("app"),[u,j]=n.useState(!1),t=n.useId(),w=n.useMemo(()=>Q(s),[s]),h=(o,v)=>{d(Q({...w,[o]:v}))},m=u?r("theme.shadcnCustom.collapse","Collapse custom colors"):r("theme.shadcnCustom.show","Show custom colors"),i=u?le:X;return e.jsxs("section",{className:"shadcn-color-picker card","data-testid":"shadcn-color-picker","aria-labelledby":"shadcn-color-picker-title",children:[e.jsxs("div",{className:"shadcn-color-picker-header",children:[e.jsxs("div",{className:"shadcn-color-picker-heading",children:[e.jsx("h3",{id:"shadcn-color-picker-title",className:"shadcn-color-picker-title",children:r("theme.shadcnCustom.title","Custom shadcn colors")}),e.jsx("p",{className:"shadcn-color-picker-description",children:r("theme.shadcnCustom.description","Override shadcn design tokens with hex colors. Blank tokens use the theme defaults.")})]}),e.jsx("button",{type:"button",className:"btn btn-icon btn-sm shadcn-color-picker-toggle","aria-expanded":u,"aria-controls":t,"aria-label":m,title:m,onClick:()=>j(o=>!o),children:e.jsx(i,{size:16,"aria-hidden":"true"})})]}),u?e.jsxs("div",{id:t,className:"shadcn-color-picker-controls-panel","data-testid":"shadcn-color-picker-controls",children:[e.jsx("div",{className:"shadcn-color-picker-actions",children:e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>d({}),children:r("theme.shadcnCustom.reset","Reset custom colors")})}),e.jsx("div",{className:"shadcn-color-picker-grid",children:oe.map(o=>{const v=ne(o,l),g=w[o.cssVar]??v,y=`shadcn-color-${o.cssVar.replace(/^--/,"").replace(/[^a-z0-9]+/gi,"-")}`;return e.jsxs("div",{className:"shadcn-color-picker-row","data-testid":`shadcn-color-${o.cssVar}`,children:[e.jsxs("label",{className:"shadcn-color-picker-label",htmlFor:y,children:[e.jsx("span",{children:r(`theme.shadcnCustom.token.${o.cssVar}`,o.label)}),e.jsx("code",{children:o.cssVar})]}),e.jsxs("div",{className:"shadcn-color-picker-controls",children:[e.jsx("input",{"aria-label":r("theme.shadcnCustom.colorInput","Pick {{label}} color",{label:o.label}),className:"shadcn-color-picker-native",type:"color",value:je(g),onChange:k=>h(o.cssVar,k.currentTarget.value)}),e.jsx("input",{id:y,"aria-label":r("theme.shadcnCustom.hexInput","{{label}} hex color",{label:o.label}),className:"input shadcn-color-picker-hex",type:"text",inputMode:"text",spellCheck:!1,value:g,onChange:k=>h(o.cssVar,k.currentTarget.value)})]})]},o.cssVar)})})]}):null]})}function Se(s){return V.find(d=>d.value===s)??V[0]}function Z(s){return s.trim().normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase()}function O({className:s}){return e.jsxs("span",{className:`theme-option-swatch ${s}`,"aria-hidden":"true",children:[e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-1"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-2"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-3"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-4"})]})}function Le({colorTheme:s,onColorThemeChange:d,themeMode:l,shadcnCustomColors:r={},resolvedThemeMode:u=l==="light"?"light":"dark",onThemeModeChange:j,onShadcnCustomColorsChange:t=()=>{},triggerVariant:w="compact"}){const{t:h}=_("app"),[m,i]=n.useState(!1),[o,v]=n.useState(""),[g,y]=n.useState(s),[k,S]=n.useState(null),I=n.useRef(null),D=n.useRef(null),E=n.useRef(!1),N=n.useRef([]),M=n.useMemo(()=>Se(s),[s]),z=l==="system"?u:l,$=J.find(a=>a.value===z)?.icon,c=l==="system"?h("theme.system","System"):h(`theme.${l}`,l?`${l.charAt(0).toUpperCase()}${l.slice(1)}`:"Dark"),b=h(`theme.colorTheme.${M.value}`,M.label),R=`${h("theme.currentTheme","Current theme")} ${c} / ${b}`,H="theme-dropdown-listbox",B=n.useMemo(()=>V.map(a=>({...a,displayLabel:h(`theme.colorTheme.${a.value}`,a.label)})),[h]),U=Z(o),p=n.useMemo(()=>B.filter(a=>Z(a.displayLabel).includes(U)),[U,B]),W=p.findIndex(a=>a.value===g),L=()=>{i(!1),v(""),y(s),S(null),E.current=!1,N.current=[]};n.useEffect(()=>{if(!m)return;const a=f=>{I.current&&!I.current.contains(f.target)&&L()};return document.addEventListener("pointerdown",a),()=>document.removeEventListener("pointerdown",a)},[m,s]),n.useEffect(()=>{m&&(p.some(a=>a.value===g)||y(p[0]?.value??null))},[g,p,m]),n.useEffect(()=>{if(m){if(k==="pointer"&&E.current)D.current?.focus(),E.current=!1;else if(k==="keyboard"){const a=p.findIndex(f=>f.value===g);N.current[a]?.focus()}}},[g,p,m,k]);const q=a=>{d(a),L()},K=(a,f)=>{if(a==="pointer")E.current=!0,y(s);else{const F=p.some(C=>C.value===s),x=f==="ArrowUp"?p.at(-1)?.value??null:f==="ArrowDown"?p[0]?.value??null:F?s:p[0]?.value??null;y(x)}S(a),i(!0)},ee=a=>{(a.key==="ArrowDown"||a.key==="ArrowUp"||a.key==="Enter"||a.key===" ")&&(a.preventDefault(),K("keyboard",a.key))},ae=a=>{if(a.key==="Escape"){a.preventDefault(),L();return}if(a.key!=="ArrowDown"&&a.key!=="ArrowUp")return;const f=a.key==="ArrowUp"?p.length-1:Math.max(0,W);f<0||!p[f]||(a.preventDefault(),y(p[f].value),N.current[f]?.focus())},te=(a,f,F)=>{if(a.key==="Escape"){a.preventDefault(),L();return}if(a.key==="ArrowDown"||a.key==="ArrowUp"){a.preventDefault();const x=a.key==="ArrowDown"?1:-1,C=(f+x+p.length)%p.length;y(p[C]?.value??null),N.current[C]?.focus();return}if(a.key==="Home"){a.preventDefault(),y(p[0]?.value??null),N.current[0]?.focus();return}if(a.key==="End"){a.preventDefault();const x=p.length-1;y(p[x]?.value??null),N.current[x]?.focus();return}(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),q(F))};return e.jsxs("div",{className:`theme-dropdown${w==="current-row"?" theme-dropdown--current-row":""}${m?" open":""}`,ref:I,children:[e.jsxs("button",{type:"button",className:`theme-dropdown-trigger btn${w==="current-row"?" theme-dropdown-trigger--current-row":""}`,"aria-label":w==="current-row"?R:void 0,"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?H:void 0,onClick:()=>m?L():K("pointer"),onKeyDown:ee,children:[w==="current-row"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"theme-dropdown-current-row-icon","aria-hidden":"true",children:$?e.jsx($,{size:20}):null}),e.jsxs("span",{className:"theme-dropdown-current-row-info",children:[e.jsx("span",{className:"theme-dropdown-current-row-label",children:h("theme.currentTheme","Current theme")}),e.jsxs("span",{className:"theme-dropdown-current-row-value",children:[c," / ",b]})]}),e.jsx(O,{className:M.className})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{className:M.className}),e.jsx("span",{className:"theme-dropdown-trigger-label",children:b})]}),e.jsx(X,{size:16,"aria-hidden":"true"})]}),l&&j?e.jsx("div",{className:"theme-dropdown-modes",role:"radiogroup","aria-label":h("theme.modeLabel","Theme mode"),children:J.map(({value:a,label:f,icon:F})=>e.jsxs("button",{type:"button",className:`theme-dropdown-mode-btn btn btn-sm${l===a?" active":""}`,"aria-pressed":l===a,onClick:()=>j(a),title:h(`theme.${a}Mode`,`${f} mode`),children:[e.jsx(F,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:h(`theme.${a}`,f)})]},a))}):null,s==="shadcn-custom"?e.jsx(Ce,{value:r,onChange:t,resolvedThemeMode:u}):null,m?e.jsxs("div",{className:"theme-dropdown-popover",role:"presentation",children:[e.jsxs("label",{className:"theme-dropdown-filter",children:[e.jsx("span",{className:"sr-only",children:h("theme.filterColorThemes","Filter color themes")}),e.jsx("input",{ref:D,type:"search",className:"input",value:o,placeholder:h("theme.filterColorThemesPlaceholder","Filter color themes"),"aria-label":h("theme.filterColorThemes","Filter color themes"),onChange:a=>v(a.target.value),onKeyDown:ae})]}),p.length?e.jsx("div",{id:H,className:"theme-dropdown-list",role:"listbox","aria-label":h("theme.colorThemeLabel","Color theme"),children:p.map(({value:a,displayLabel:f,className:F},x)=>{const C=s===a;return e.jsxs("button",{ref:P=>{N.current[x]=P},type:"button",className:`theme-dropdown-option${C?" active":""}`,role:"option","aria-selected":C,tabIndex:x===W?0:-1,onClick:()=>q(a),onKeyDown:P=>te(P,x,a),children:[e.jsx(O,{className:F}),e.jsx("span",{className:"theme-dropdown-option-label",children:f}),C?e.jsx(ce,{size:16,"aria-hidden":"true"}):null]},a)})}):e.jsx("p",{className:"theme-dropdown-no-results",children:h("theme.noColorThemes","No color themes found")})]}):null]})}const De=[{type:"bug",label:"Report bug",Icon:me},{type:"feedback",label:"Send feedback",Icon:ie},{type:"idea",label:"Share idea",Icon:he},{type:"help",label:"Get help",Icon:be}];function Te({onSelect:s}){const{t:d}=_("app"),[l,r]=n.useState(!1),[u,j]=n.useState(),t=n.useRef(null),w=n.useRef(null),h=n.useCallback(()=>{const i=t.current?.getBoundingClientRect();i&&j({top:i.bottom,left:i.left,right:window.innerWidth-i.right})},[]);n.useEffect(()=>{if(!l)return;h();const i=()=>h();return window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[l,h]),n.useEffect(()=>{if(!l)return;const i=v=>{const g=v.target;t.current?.contains(g)||w.current?.contains(g)||r(!1)},o=v=>{v.key==="Escape"&&(r(!1),t.current?.focus())};return document.addEventListener("mousedown",i),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",o)}},[l]);const m=l&&u&&typeof document<"u"?se.createPortal(e.jsx("div",{ref:w,className:"report-action-menu__list report-action-menu__list--portal",role:"menu",style:{top:u.top,left:u.left,right:u.right},children:De.map(({type:i,label:o,Icon:v})=>e.jsxs("button",{className:"report-action-menu__item",type:"button",role:"menuitem",onClick:()=>{r(!1),s(i)},children:[e.jsx(v,{"aria-hidden":"true"}),d(`report.actions.${i}`,o)]},i))}),document.body):null;return e.jsxs("div",{className:"report-action-menu",children:[e.jsx("button",{ref:t,className:"btn btn-secondary",type:"button","aria-haspopup":"menu","aria-expanded":l,onClick:()=>r(i=>!i),children:d("report.menu","Report")}),m]})}const Ee={bug:"What went wrong?",feedback:"What would you like to share?",idea:"What would you like Fusion to do?",help:"What would you like help with?"};function _e({actionType:s,onClose:d,contextRefs:l}){const{t:r}=_("app"),[u,j]=n.useState(""),[t,w]=n.useState(),[h,m]=n.useState(!1),[i,o]=n.useState(),[v,g]=n.useState(!1),[y,k]=n.useState(),[S,I]=n.useState(),[D,E]=n.useState(!1),N=n.useRef(0),M=async c=>{m(!0),o(void 0);try{const b=await de();if(!b)throw new Error("Screen capture was unavailable or denied.");const{artifactId:R}=await ke(b);if(N.current!==c)return;I(R)}catch(b){if(N.current!==c)return;g(!1),o(b instanceof Error?b.message:"We could not capture the current screen.")}finally{N.current===c&&m(!1)}},z=async()=>{if(u.trim()){if(v&&(!S||!D)){o("Capture and confirm local screenshot retention before continuing, or turn attachment off.");return}m(!0),o(void 0);try{if(Y("report"),s==="help"){const c=await xe(u);if(c.answered){w({kind:"help",answer:c.answer});return}}w(await ge({actionType:s,targetType:y,userPrompt:u,contextRefs:l,activityTrace:A(),screenshotArtifactId:v&&D?S:void 0}))}catch{o("We could not prepare your report. Check your connection and try again.")}finally{m(!1)}}},$=async(c,b,R)=>{if(t?.report){m(!0),o(void 0);try{Y("report"),w(await Ne({actionType:s,targetType:y,report:t.report,endorseIssueNumber:c,endorseDiscussionId:b,endorseRoadmapIssueNumber:R,activityTrace:A(),screenshotArtifactId:v&&D?S:void 0}))}catch{o("We could not send your report. Your draft is still here; try again.")}finally{m(!1)}}};return e.jsx("div",{className:"report-modal-backdrop",role:"presentation",children:e.jsxs("section",{className:"card report-modal",role:"dialog","aria-modal":"true","aria-label":`${s} report`,children:[e.jsx("button",{className:"btn-icon report-modal__close",type:"button","aria-label":r("report.close","Close report"),onClick:d,children:"×"}),i&&e.jsx("p",{className:"report-modal__error",role:"alert",children:i}),!t&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:s[0].toUpperCase()+s.slice(1)}),e.jsx("label",{htmlFor:"report-prompt",children:Ee[s]}),e.jsx("textarea",{id:"report-prompt",className:"input",value:u,onChange:c=>j(c.target.value),maxLength:4e3}),e.jsxs("label",{className:"report-modal__screenshot-option",children:[e.jsx("input",{type:"checkbox",checked:v,onChange:c=>{const b=c.target.checked,R=++N.current;g(b),I(void 0),E(!1),b?M(R):m(!1)}})," ",r("report.storeScreenshot","Store a screenshot locally")]}),v&&e.jsx("div",{className:"report-modal__screenshot-preview",children:S?e.jsxs("label",{className:"report-modal__screenshot-option",children:[e.jsx("input",{type:"checkbox",checked:D,onChange:c=>E(c.target.checked)})," ",r("report.confirmScreenshotRetention","I confirm Fusion may retain this screenshot locally for this report.")]}):e.jsx("p",{children:r("report.capturingScreenshot","Capturing and storing locally…")})}),e.jsx("label",{htmlFor:"report-target",children:r("report.targetLabel","Filing target")}),e.jsxs("select",{id:"report-target",className:"input",value:y??"",onChange:c=>k(c.target.value||void 0),children:[e.jsx("option",{value:"",children:r("report.targetInherit","Use configured action target")}),e.jsx("option",{value:"issue",children:r("report.targetIssue","GitHub Issue")}),e.jsx("option",{value:"discussion",children:r("report.targetDiscussion","GitHub Discussion")})]}),e.jsxs("details",{className:"report-modal__activity-trace",children:[e.jsx("summary",{children:r("report.activityTrace","Activity trace to send")}),e.jsx("ul",{children:A().map((c,b)=>e.jsx("li",{children:c},`${c}-${b}`))})]}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:!u.trim()||h,onClick:()=>void z(),children:i?"Retry":"Continue"})]}),t?.kind==="draft-ready"&&t.report&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:r("report.review","Review your report")}),e.jsx("label",{htmlFor:"report-review-prompt",children:r("report.summary","Report summary")}),e.jsx("textarea",{id:"report-review-prompt",className:"input",value:t.report.userPrompt,onChange:c=>{const b=c.target.value;w({...t,report:{...t.report,userPrompt:b}})}}),e.jsx("label",{htmlFor:"report-review-body",children:r("report.structured","Structured report")}),e.jsx("textarea",{id:"report-review-body",className:"input",value:t.report.body??"",onChange:c=>w({...t,report:{...t.report,body:c.target.value}})}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:h,onClick:()=>void $(),children:r("report.file","File report")})]}),t?.kind==="duplicate-found"&&t.issue&&t.report&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t.issue.roadmap?r("report.roadmapDuplicate.title","Already on the roadmap — add your data point?"):r("report.duplicateReview","Review data point for a similar open issue")}),e.jsx("a",{href:t.issue.url,target:"_blank",rel:"noreferrer",children:t.issue.title}),e.jsx("label",{htmlFor:"report-duplicate-prompt",children:r("report.summary","Report summary")}),e.jsx("textarea",{id:"report-duplicate-prompt",className:"input",value:t.report.userPrompt,onChange:c=>{const b=c.target.value;w({...t,report:{...t.report,userPrompt:b}})}}),e.jsx("label",{htmlFor:"report-duplicate-body",children:r("report.structuredDataPoint","Structured data point")}),e.jsx("textarea",{id:"report-duplicate-body",className:"input",value:t.report.body??"",onChange:c=>w({...t,report:{...t.report,body:c.target.value}})}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:h,onClick:()=>void $(t.issue.discussionId||t.issue.roadmap?void 0:t.issue.number,t.issue.discussionId,t.issue.roadmap?t.issue.number:void 0),children:r("report.confirmDataPoint","Confirm and add data point")})]}),(t?.kind==="filed"||t?.kind==="endorsed")&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t.kind==="filed"&&t.destination==="issue"?"Report filed as an Issue":"Report sent"}),e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",children:r("report.viewGitHub","View on GitHub")}),t.report?.body&&e.jsxs(e.Fragment,{children:[e.jsx("label",{htmlFor:"filed-report",children:r("report.final","Final report")}),e.jsx("textarea",{id:"filed-report",className:"input",value:t.report.body,readOnly:!0})]})]}),t?.kind==="help"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:r("report.suggestedHelp","Suggested help")}),e.jsx("p",{children:t.answer?.summary??t.answer?.content})]}),t?.kind==="unavailable"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"alert",children:t.message}),e.jsx("button",{className:"btn btn-secondary",type:"button",onClick:()=>{w(void 0),o(void 0)},children:r("report.returnToPrompt","Return to prompt")})]})]})})}export{me as B,Te as R,J as T,Le as a,_e as b,Me as l,$e as r};
@@ -1,2 +1,2 @@
1
- import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{r as Q,e as ue,S as he,cL as me,c_ as Se,b as ce,c$ as _e,bj as je,d0 as Y,aZ as we,d1 as ke,d2 as Ne,d3 as Ce,d4 as Ee,d5 as Ae,d6 as Te,d7 as Pe,cP as Le,d8 as Fe,d9 as Ie,da as Me,db as De,a_ as He,al as qe,V as Ue,aJ as pe,L as Oe,aK as Ve}from"./index-oxnX59eO.js";import{u as fe}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";const $e="builtin",X={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ie(a){const n=a?.researchGlobalDefaults,l=a?.researchSettings;return{enabled:l?.enabled??a?.researchEnabled??a?.researchGlobalEnabled??!0,searchProvider:l?.searchProvider??n?.searchProvider??a?.researchGlobalWebSearchProvider??$e,synthesisProvider:l?.synthesisProvider??n?.synthesisProvider,synthesisModelId:l?.synthesisModelId??n?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:l?.enabledSources?.pageFetch??n?.enabledSources?.pageFetch??X.pageFetch,github:l?.enabledSources?.github??n?.enabledSources?.github??X.github,localDocs:l?.enabledSources?.localDocs??n?.enabledSources?.localDocs??X.localDocs,llmSynthesis:l?.enabledSources?.llmSynthesis??n?.enabledSources?.llmSynthesis??X.llmSynthesis},limits:{maxConcurrentRuns:l?.limits?.maxConcurrentRuns??a?.researchMaxConcurrentRuns??a?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:l?.limits?.maxSourcesPerRun??n?.maxSourcesPerRun??a?.researchMaxSourcesPerRun??a?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:l?.limits?.maxDurationMs??a?.researchDefaultTimeout??a?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:l?.limits?.requestTimeoutMs??a?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:n?.defaultExportFormat??"markdown"}}function be(a){const n=typeof a.id=="string"?a.id.trim():"";if(n)return n;const l=f=>f.trim().replace(/\s+/g," ").toLowerCase(),m=[l(a.heading??""),l(a.content??""),...[...a.sources??[]].map(l).filter(Boolean).sort()].join(`
1
+ import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{ab as Q,ac as ue,ad as he,cy as me,cN as Se,ah as ce,cO as _e,b5 as je,cP as Y,aK as we,cQ as ke,cR as Ne,cS as Ce,cT as Ee,cU as Ae,cV as Te,cW as Pe,cC as Le,cX as Fe,cY as Ie,cZ as Me,c_ as De,aL as He,a1 as qe,V as Ue,au as pe,L as Oe,av as Ve}from"./index-CBFPgFTp.js";import{u as fe}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";const $e="builtin",X={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ie(a){const n=a?.researchGlobalDefaults,l=a?.researchSettings;return{enabled:l?.enabled??a?.researchEnabled??a?.researchGlobalEnabled??!0,searchProvider:l?.searchProvider??n?.searchProvider??a?.researchGlobalWebSearchProvider??$e,synthesisProvider:l?.synthesisProvider??n?.synthesisProvider,synthesisModelId:l?.synthesisModelId??n?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:l?.enabledSources?.pageFetch??n?.enabledSources?.pageFetch??X.pageFetch,github:l?.enabledSources?.github??n?.enabledSources?.github??X.github,localDocs:l?.enabledSources?.localDocs??n?.enabledSources?.localDocs??X.localDocs,llmSynthesis:l?.enabledSources?.llmSynthesis??n?.enabledSources?.llmSynthesis??X.llmSynthesis},limits:{maxConcurrentRuns:l?.limits?.maxConcurrentRuns??a?.researchMaxConcurrentRuns??a?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:l?.limits?.maxSourcesPerRun??n?.maxSourcesPerRun??a?.researchMaxSourcesPerRun??a?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:l?.limits?.maxDurationMs??a?.researchDefaultTimeout??a?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:l?.limits?.requestTimeoutMs??a?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:n?.defaultExportFormat??"markdown"}}function be(a){const n=typeof a.id=="string"?a.id.trim():"";if(n)return n;const l=f=>f.trim().replace(/\s+/g," ").toLowerCase(),m=[l(a.heading??""),l(a.content??""),...[...a.sources??[]].map(l).filter(Boolean).sort()].join(`
2
2
  `);let s=2166136261;for(let f=0;f<m.length;f+=1)s^=m.charCodeAt(f),s=Math.imul(s,16777619);return`finding-${(s>>>0).toString(16).padStart(8,"0")}`}const Ge=300,Be=4e3,We=["queued","running","cancelling","retry_waiting"];function le(a,n){if(a instanceof Le){const l=a;return{message:a.message,status:a.status,code:l.researchCode??"INTERNAL_ERROR",setupHint:l.setupHint,retryable:l.retryable}}return a instanceof Error?{message:a.message,code:"INTERNAL_ERROR"}:{message:n,code:"INTERNAL_ERROR"}}function ze(a){if(!a)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const n=We.includes(a.status),l=a.status==="queued"||a.status==="running",m=a.lifecycle?.retryable,s=a.status==="failed"||a.status==="timed_out",f=!!(s&&m);let x;return!l&&n?x="Run is already transitioning":!l&&a.status==="completed"?x="Completed runs cannot be cancelled":!l&&a.status==="cancelled"?x="Run is already cancelled":!l&&a.status==="retry_exhausted"?x="Retry attempts exhausted":!l&&a.status==="failed"?x="Failed runs cannot be cancelled":!l&&a.status==="timed_out"&&(x="Timed out runs cannot be cancelled"),!f&&s&&m===!1&&(x=a.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:l,retryable:f,isTransitioning:n,blockingReason:x}}function Ke(a){const n=a?.projectId,l=n??"",m=`${he.RESEARCH_RUNS_PREFIX}${l}`,s=`${he.RESEARCH_SELECTED_ID_PREFIX}${l}`,f=Q(m,{maxAgeMs:ue}),x=Q(s,{maxAgeMs:me}),r=c.useRef(Array.isArray(f)&&f.length>0),[D,M]=c.useState(()=>Array.isArray(f)?f:[]),[h,A]=c.useState(x??null),[P,w]=c.useState(null),[O,H]=c.useState({available:!0}),[V,L]=c.useState(!(Array.isArray(f)&&f.length>0)),[G,q]=c.useState(null),[B,k]=c.useState(null),[N,F]=c.useState(""),_=c.useRef(0),R=c.useRef(0),C=c.useRef(n);c.useEffect(()=>{C.current!==n&&(C.current=n,R.current++);const o=Q(m,{maxAgeMs:ue}),d=Q(s,{maxAgeMs:me}),p=Array.isArray(o)&&o.length>0;M(Array.isArray(o)?o:[]),A(d??null),w(null),L(!p),r.current=p},[n,m,s]);const S=c.useCallback(async(o=N)=>{const d=++_.current,p=n;r.current||L(!0),q(null),k(null);try{const y=await Se({q:o||void 0,limit:100},p);if(d!==_.current||p!==n)return;M(y.runs),ce(m,y.runs,{maxBytes:5e5}),r.current=!0,H(y.availability),h&&!y.runs.some(g=>g.id===h)&&(A(null),ce(s,null,{maxBytes:5e5}),w(null))}catch(y){if(d!==_.current||p!==n)return;const g=le(y,"Failed to load research runs");q(g.message),k(g)}finally{d===_.current&&L(!1)}},[n,m,N,s,h]),i=c.useCallback(async o=>{const d=await _e(o,n);return w(d.run),H(d.availability),d.run},[n]);c.useEffect(()=>{r.current||L(!0);const o=window.setTimeout(()=>{S(N)},Ge);return()=>window.clearTimeout(o)},[S,N]),c.useEffect(()=>{if(!h){w(null);return}i(h)},[i,h]),c.useEffect(()=>{const o=R.current,d=()=>R.current!==o,p=n?`?projectId=${encodeURIComponent(n)}`:"";let y=!0;const g=()=>{!y||d()||(S(),h&&i(h))},j=`/api/events${p}`,$=je(j,{events:{"research:run:created":g,"research:run:updated":g,"research:run:completed":g,"research:run:failed":g,"research:run:cancelled":g},onReconnect:()=>{Y({view:"useResearch",trigger:"sse-reconnect",projectId:n,replayAttempted:!1,sseChannel:j}),g()}});return Y({view:"useResearch",trigger:"sse-open",projectId:n,replayAttempted:!1,sseChannel:j}),()=>{y=!1,$()}},[n,S,h,i]);const E=c.useCallback(()=>{S(),h&&i(h)},[S,h,i]);we(E,Be);const T=c.useCallback(o=>{A(o),ce(s,o,{maxBytes:5e5})},[s]);return{runs:D,selectedRun:P,selectedRunId:h,setSelectedRunId:T,availability:O,loading:V,error:G,searchQuery:N,setSearchQuery:F,refresh:S,createRun:o=>Pe(o,n),cancelRun:async o=>{try{k(null);const d=await Te(o,n);return h===o&&w(d.run),await S(),d}catch(d){const p=le(d,"Failed to cancel run");throw k(p),p}},retryRun:async o=>{try{k(null);const d=await Ae(o,n);return h===o&&w(d.run),await S(),d}catch(d){const p=le(d,"Failed to retry run");throw k(p),p}},exportRun:(o,d)=>Ee(o,d,n),createTaskFromRun:(o,d,p,y,g,j)=>Ce(o,{title:d,findingId:p,description:y,priority:g,attachExport:j},n),attachRunToTask:(o,d,p,y)=>Ne(o,{taskId:d,findingId:p,attachExport:y},n),promoteFinding:(o,d)=>ke(o,d,n),uiError:B,runActionState:ze(P),statusCounts:D.reduce((o,d)=>(o[d.status]+=1,o),{queued:0,running:0,cancelling:0,retry_waiting:0,completed:0,failed:0,cancelled:0,timed_out:0,retry_exhausted:0})}}function Qe({open:a,mode:n,run:l,finding:m,projectId:s,onClose:f,onConfirm:x}){const{t:r}=fe("app");Fe(a);const[D,M]=c.useState(!1),[h,A]=c.useState(""),[P,w]=c.useState(""),[O,H]=c.useState("normal"),[V,L]=c.useState(""),[G,q]=c.useState([]),[B,k]=c.useState(!1),[N,F]=c.useState(!1),{boardWorkflows:_}=Ie({projectId:s}),R=c.useMemo(()=>{const i=new Map;for(const E of _?.workflows??[])for(const T of E.columns)i.has(T.id)||i.set(T.id,T.flags);return E=>Me(i.get(E),E)},[_]),C=c.useMemo(()=>{const i=(m.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${m.heading||r("research.defaultFindingHeading","Research finding")} — ${i}`.trim()},[m.content,m.heading,r]);c.useEffect(()=>{a&&(M(!1),A(`Research: ${m.heading||l.title}`),w(C),H("normal"),L(""))},[a,n,m.heading,C,l.title]),c.useEffect(()=>{if(!a||n!=="enrich")return;let i=!1;return q([]),k(!0),De(50,0,s).then(E=>{i||q(E.filter(T=>!R(T.column)))}).finally(()=>{i||k(!1)}),()=>{i=!0}},[a,n,s,R]);const S=V.trim();return a?e.jsx("div",{className:"modal-overlay open",role:"presentation",onClick:f,children:e.jsxs("div",{className:"modal modal-lg research-task-action-modal",role:"dialog","aria-modal":"true",onClick:i=>i.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:n==="create"?r("research.createTaskTitle","Create task from finding"):r("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":r("actions.close","Close"),onClick:f,children:"×"})]}),e.jsxs("div",{className:"research-task-action-modal__body",children:[e.jsxs("div",{className:"card research-task-action-modal__preview",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.runLabel","Run:")," "]})," ",l.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.findingLabel","Finding:")," "]})," ",m.id,m.heading?` — ${m.heading}`:""]}),e.jsx("p",{children:C||r("research.noPreview","No preview available.")})]}),n==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.titleLabel","Title"),e.jsx("input",{className:"input",value:h,onChange:i=>A(i.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.descriptionLabel","Description"),e.jsx("textarea",{className:"input research-task-action-modal__textarea",value:P,onChange:i=>w(i.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:O,onChange:i=>H(i.target.value),children:[e.jsx("option",{value:"low",children:r("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:r("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:r("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:r("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:V,placeholder:B?r("research.loadingTasks","Loading tasks…"):r("research.enterTaskId","Enter task ID"),onChange:i=>L(i.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:G.map(i=>e.jsx("option",{value:i.id,children:i.title},i.id))})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:D,onChange:i=>M(i.target.checked)}),e.jsx("span",{children:r("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:f,children:r("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:N||n==="enrich"&&!S,onClick:()=>{F(!0),x({taskId:n==="enrich"?S:void 0,title:n==="create"?h.trim():void 0,description:n==="create"?P.trim():void 0,priority:n==="create"?O:void 0,attachExport:D}).finally(()=>F(!1))},children:n==="create"?r("research.createTaskButton","Create Task"):r("research.enrichTaskButton","Enrich Task")})]})]})}):null}const Xe=["web-search","page-fetch","github","local-docs","llm-synthesis"],Ye={"web-search":"webSearch","page-fetch":"pageFetch",github:"github","local-docs":"localDocs","llm-synthesis":"llmSynthesis"};function Je(a){return{"web-search":a("research.providerWebSearch","Web Search"),"page-fetch":a("research.providerPageFetch","Page Fetch"),github:a("research.providerGitHub","GitHub"),"local-docs":a("research.providerLocalDocs","Local Docs"),"llm-synthesis":a("research.providerLlmSynthesis","LLM Synthesis")}}let oe=!1;function cs({projectId:a,addToast:n,onOpenSettings:l,readinessVersion:m=0}){const{t:s}=fe("app"),f=Je(s);c.useEffect(()=>(Y({view:"ResearchView",trigger:oe?"route-active":"remount",projectId:a,replayAttempted:!1}),oe=!1,()=>{oe=!0,Y({view:"ResearchView",trigger:"route-inactive",projectId:a,replayAttempted:!1})}),[a]);const{runs:x,selectedRun:r,selectedRunId:D,setSelectedRunId:M,availability:h,loading:A,error:P,searchQuery:w,setSearchQuery:O,createRun:H,cancelRun:V,retryRun:L,exportRun:G,createTaskFromRun:q,attachRunToTask:B,promoteFinding:k,statusCounts:N,refresh:F,uiError:_,runActionState:R}=Ke({projectId:a}),[C,S]=c.useState(""),[i,E]=c.useState(()=>ie(void 0)),[T,o]=c.useState([]),[d,p]=c.useState(!1),[y,g]=c.useState([]),[j,$]=c.useState(null),[U,K]=c.useState(null),[J,ve]=c.useState(""),Z=h.supportedProviders??Xe,ee=i.searchProvider,se=t=>t==="web-search"?!0:i.enabledSources[Ye[t]];c.useEffect(()=>{const t=Z.filter(u=>se(u));g(u=>{const b=u.filter(v=>t.includes(v));return b.length>0?b:t})},[i.enabledSources,Z]),c.useEffect(()=>{let t=!1;return Promise.all([He(a),qe().catch(()=>({providers:[]}))]).then(([u,b])=>{t||(E(ie(u)),o(b.providers.filter(v=>v.type==="api_key").map(v=>({id:v.id,authenticated:v.authenticated}))))}).catch(()=>{t||E(ie(void 0))}),()=>{t=!0}},[a,m]);const xe=c.useMemo(()=>r?r.status:s("research.noRunSelected","No run selected"),[r,s]),ye=c.useMemo(()=>r?r.status==="queued"||r.status==="retry_waiting"?"status-dot status-dot--pending":r.status==="running"?"status-dot status-dot--connecting":r.status==="completed"?"status-dot status-dot--online":r.status==="failed"||r.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[r]),re=h.supportedExportFormats??["markdown","json","html"],te=c.useMemo(()=>new Map(T.map(t=>[t.id,t.authenticated])),[T]),ae=c.useMemo(()=>{const t=new Set;return i.enabledSources.webSearch&&ee&&t.add(ee),i.enabledSources.llmSynthesis&&i.synthesisProvider&&t.add(i.synthesisProvider),[...t].filter(u=>te.has(u))},[i.enabledSources.llmSynthesis,i.enabledSources.webSearch,i.synthesisProvider,ee,te]).find(t=>te.get(t)!==!0),W=c.useMemo(()=>h.available?i.enabled?ae?{reason:s("research.missingApiKey","Missing API key for {{provider}}.",{provider:ae}),details:s("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:s("research.disabled","Research is disabled for this project."),details:s("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??s("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,i.enabled,ae,s]),z=async(t,u,b)=>{$(t);try{await u(),n?.(b,"success"),await F()}catch(v){n?.(v instanceof Error?v.message:s("research.actionFailed","Action failed"),"error")}finally{$(null)}},ne=async t=>{if(r){$(`export-${t}`);try{const u=await G(r.id,t),b=new Blob([u.content],{type:"text/plain;charset=utf-8"}),v=URL.createObjectURL(b),I=document.createElement("a");I.href=v,I.download=u.filename,document.body.appendChild(I),I.click(),I.remove(),URL.revokeObjectURL(v),n?.(s("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){n?.(u instanceof Error?u.message:s("research.exportFailed","Export failed"),"error")}finally{$(null)}}},ge=async()=>{if(C.trim()){p(!0);try{const t=y.filter(b=>se(b));if(t.length===0){p(!1),n?.(s("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await H({query:C.trim(),providers:t});M(u.run.id),S(""),n?.(s("research.runCreated","Research run created"),"success"),await F()}catch(t){n?.(t instanceof Error?t.message:s("research.createRunFailed","Failed to create run"),"error")}finally{p(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":s("research.viewLabel","Research view"),children:[e.jsx(Ue,{icon:pe,title:s("research.title","Research"),actions:e.jsx("button",{className:"btn",type:"button",onClick:()=>void F(),children:s("actions.refresh","Refresh")})}),e.jsx("p",{className:"research-view__subtitle",children:s("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")}),W?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:W.reason}),W.details&&e.jsx("p",{children:W.details}),e.jsx("p",{children:s("research.currentDefaults","Current defaults: provider {{provider}}, max sources {{maxSources}}",{provider:i.searchProvider??s("research.notSet","(not set)"),maxSources:i.limits.maxSourcesPerRun})}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void F(),children:s("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>l?.(W.settingsSection),children:s("actions.openSettings","Open Settings")})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"research-view__layout",children:[e.jsx("aside",{className:"research-view__sidebar card",children:e.jsxs("div",{className:"research-view__sidebar-content",children:[e.jsxs("div",{className:"research-view__form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"research-query",children:s("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:C,onChange:t=>S(t.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Z.map(t=>{const u=se(t),b=t==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:b||y.includes(t),disabled:b||!u,onChange:()=>{b||!u||g(v=>v.includes(t)?v.filter(I=>I!==t):[...v,t])}}),e.jsxs("span",{children:[f[t]??t,b?e.jsx("span",{className:"research-view__provider-lock",children:s("research.alwaysOn","Always on")}):null]})]},t)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!C.trim()||d,onClick:()=>void ge(),children:[d?e.jsx(Oe,{className:"animate-spin",size:14}):null,s("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:s("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(pe,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:s("research.searchRunsPlaceholder","Search runs"),value:w,onChange:t=>O(t.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:x.map(t=>e.jsxs("button",{type:"button",className:`research-view__history-item card${D===t.id?" research-view__history-item--active":""}`,onClick:()=>M(t.id),children:[e.jsx("span",{className:"card-id",children:t.id}),e.jsx("span",{children:t.title})]},t.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[A&&e.jsx("p",{"data-testid":"research-state-loading",children:e.jsx(Ve,{label:s("research.loadingRuns","Loading research runs…")})}),!A&&P&&e.jsx("p",{"data-testid":"research-state-error",children:P}),!A&&!P&&x.length===0&&e.jsx("p",{"data-testid":"research-state-empty",children:s("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[r&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:ye}),e.jsx("strong",{children:xe})]}),e.jsx("h3",{className:"research-view__run-title",children:r.title}),e.jsx("p",{className:"research-view__run-query",children:r.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:r.results?.summary??s("research.noSummaryYet","No summary yet.")}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",title:R.cancelable?void 0:R.blockingReason,disabled:j==="cancel"||j==="retry"||!R.cancelable,onClick:()=>void z("cancel",()=>V(r.id),s("research.runCancelled","Run cancelled")),children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:R.retryable?void 0:R.blockingReason,disabled:j==="cancel"||j==="retry"||!R.retryable,onClick:()=>void z("retry",()=>L(r.id),s("research.runRetried","Run retried")),children:s("actions.retry","Retry")}),re.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-markdown",onClick:()=>void ne("markdown"),children:s("research.exportMd","Export MD")}),re.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-json",onClick:()=>void ne("json"),children:s("research.exportJson","Export JSON")}),re.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-html",onClick:()=>void ne("html"),children:s("research.exportHtml","Export HTML")})]}),r.error&&e.jsx("p",{className:"research-view__error",children:r.error}),_&&e.jsxs("div",{className:"form-error",role:"alert",children:[e.jsx("p",{children:_.message}),_.setupHint&&e.jsx("p",{children:_.setupHint}),_.code==="MISSING_CREDENTIALS"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>l?.("authentication"),children:s("research.openAuthSettings","Open Authentication Settings")}),_.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>l?.("research-project"),children:s("research.openResearchSettings","Open Research Settings")})]}),R.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:R.blockingReason}),Array.isArray(r.results?.findings)&&r.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:r.results.findings.map(t=>{const u=be(t);return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:t.heading}),e.jsx("p",{children:t.content}),e.jsxs("div",{className:"research-view__actions research-view__finding-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",type:"button",onClick:()=>K({mode:"create",findingId:u}),children:s("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>K({mode:"enrich",findingId:u}),children:s("research.enrichTask","Enrich Task")}),e.jsx("input",{className:"input","aria-label":s("research.destinationSlice","Destination slice ID"),value:J,onChange:b=>ve(b.target.value),placeholder:s("research.destinationSlice","Destination slice ID")}),e.jsx("button",{className:"btn btn-sm",type:"button",disabled:r.status!=="completed"||!J.trim()||j===`promote-${u}`,onClick:()=>void z(`promote-${u}`,()=>k(r.id,{findingId:u,sliceId:J.trim()}),s("research.findingPromoted","Finding promoted to roadmap")),children:s("research.promoteFinding","Promote to roadmap")})]})]},u)})}),Array.isArray(r.results?.citations)&&r.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:r.results.citations.map(t=>e.jsx("li",{children:e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:t})},t))}),r.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:s("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:r.events.map(t=>e.jsx("li",{children:t.message},t.id))})]})]}),!r&&x.length>0&&e.jsx("p",{children:s("research.selectRunToViewDetails","Select a run to view details.")}),e.jsxs("div",{className:"research-view__stats",children:[e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:N.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:N.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:N.failed})]})]})]})]})]})}),r&&U&&(()=>{const t=r.results?.findings?.findIndex(b=>be(b)===U.findingId)??-1,u=t>=0?r.results.findings[t]:null;return u?e.jsx(Qe,{open:!0,mode:U.mode,run:r,finding:{id:U.findingId,heading:u.heading,content:u.content},projectId:a,onClose:()=>K(null),onConfirm:async({taskId:b,title:v,description:I,priority:Re,attachExport:de})=>{U.mode==="create"?await z("create-task",()=>q(r.id,v,U.findingId,I,Re,de),s("research.taskCreatedFromResearch","Task created from research")):b&&await z("attach-task",()=>B(r.id,b,U.findingId,de),s("research.taskEnrichedFromResearch","Task enriched from research")),K(null)}}):null})()]})}export{cs as ResearchView};
@@ -1 +1 @@
1
- import{r as t,j as e}from"./vendor-react-SZ_qB27O.js";import{w as A,V as we,x as ke,R as ce,P as Re,E as ne,y as le,z as Le,B as Te,D as Ae,F as Me,C as De,k as Ve,G as qe}from"./index-oxnX59eO.js";import{u as Ke}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";const Oe="__sync_passphrase__",G={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},d={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Fe={...d,className:"secrets-action-icon spin"},Ge=({addToast:p,projectId:l})=>{const{t:a}=Ke("app"),[J,Y]=t.useState([]),[oe,U]=t.useState(),[Q,W]=t.useState(!0),[X,M]=t.useState(null),[ie,D]=t.useState(),[Z,b]=t.useState(null),[h,V]=t.useState(null),[de,x]=t.useState(!1),[ue,C]=t.useState(null),[c,i]=t.useState(G),[q,E]=t.useState(!1),[ee,f]=t.useState({}),[pe,K]=t.useState(null),[m,se]=t.useState(!1),[he,ae]=t.useState(),[me,O]=t.useState(!1),[w,F]=t.useState(""),[B,_]=t.useState(""),[ye,$]=t.useState(!1),[H,xe]=t.useState(!1),v=t.useRef(new Map),I=t.useRef(new Map),j=t.useRef(0),k=t.useRef(0),o=t.useRef(l);o.current!==l&&(o.current=l,j.current+=1,k.current+=1);const y=t.useCallback(s=>A(s,l),[l]),u=t.useCallback(async(s,r)=>{const n=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!n.ok){const g=await n.json().catch(()=>({error:"Request failed"}));throw new Error(String(g?.error??"Request failed"))}if(n.status!==204)return n.json()},[]),S=t.useCallback(async()=>{const s=l;if(o.current!==s)return;const r=++j.current;W(!0),M(null),D(void 0);try{const n=await u(y("/api/secrets"));r===j.current&&o.current===s&&(Y(n.secrets),U(s))}catch(n){r===j.current&&o.current===s&&(M(n instanceof Error?n.message:String(n)),D(s))}finally{r===j.current&&o.current===s&&W(!1)}},[l,y,u]),R=t.useCallback(async()=>{const s=l;if(o.current!==s)return;const r=++k.current;try{const n=await u(y("/api/secrets/sync-passphrase"));r===k.current&&o.current===s&&(se(!!n.configured),ae(s))}catch(n){r===k.current&&o.current===s&&p?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:n instanceof Error?n.message:String(n)}),"error")}},[p,l,y,u,a]);t.useEffect(()=>(Y([]),U(void 0),f({}),K(null),se(!1),ae(void 0),M(null),D(void 0),b(null),V(null),x(!1),E(!1),C(null),O(!1),F(""),_(""),$(!1),S(),R(),()=>{v.current.forEach(s=>clearTimeout(s)),I.current.forEach(s=>clearTimeout(s))}),[S,R,l]);const z=()=>{O(!1),F(""),_("")},ve=async(s,r)=>{await u(A("/api/secrets/sync-passphrase",r),{method:"PUT",body:JSON.stringify({passphrase:s})})},be=async()=>{const s=l;$(!0);try{if(await ve(w,s),o.current!==s)return;p?.(m?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),z(),await R()}catch(r){o.current===s&&p?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}finally{o.current===s&&$(!1)}},fe=async()=>{if(!window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))return;const r=l;try{if(await u(A("/api/secrets/sync-passphrase",r),{method:"DELETE"}),o.current!==r)return;p?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await R()}catch(n){o.current===r&&p?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:n instanceof Error?n.message:String(n)}),"error")}},je=()=>{V(null),i(G),x(!0),E(!1),b(null)},Se=s=>{V(s),i({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),x(!0),E(!1),b(null)},ge=async()=>{const s=l;b(null);try{if(h){const r={key:c.key,description:c.description||null,accessPolicy:c.accessPolicy,envExportable:c.envExportable,envExportKey:c.envExportable&&c.envExportKey||null};c.value&&(r.value=c.value),await u(y(`/api/secrets/${h.scope}/${h.id}`),{method:"PATCH",body:JSON.stringify(r)})}else await u(y("/api/secrets"),{method:"POST",body:JSON.stringify({scope:c.scope,key:c.key,value:c.value,description:c.description||null,accessPolicy:c.accessPolicy,envExportable:c.envExportable,envExportKey:c.envExportable&&c.envExportKey||null})});if(o.current!==s)return;x(!1),i(G),await S()}catch(r){o.current===s&&b(r instanceof Error?r.message:String(r))}},Ne=s=>{const r=v.current.get(s.id);r&&(clearTimeout(r),v.current.delete(s.id)),f(n=>({...n,[s.id]:null}))},Pe=async s=>{const r=l,n=await u(y(`/api/secrets/${s.scope}/${s.id}/reveal`),{method:"POST"});if(o.current!==r)return;f(P=>({...P,[s.id]:n.value})),p?.(a("secrets.revealed","Revealed"),"success");const g=setTimeout(()=>{f(P=>({...P,[s.id]:null})),v.current.delete(s.id)},3e4),N=v.current.get(s.id);N&&clearTimeout(N),v.current.set(s.id,g)},Ce=async s=>{const r=ee[s.id];if(!r)return;if(!await qe(r)){p?.(a("secrets.copyFailed","Failed to copy secret"),"error");return}K(s.id),p?.(a("secrets.copied","Copied"),"success");const g=setTimeout(()=>{K(null),f(P=>({...P,[s.id]:null}))},1500),N=I.current.get(s.id);N&&clearTimeout(N),I.current.set(s.id,g)},Ee=async s=>{const r=l;await u(A(`/api/secrets/${s.scope}/${s.id}`,r),{method:"DELETE"}),o.current===r&&(C(null),await S())},L=oe===l,T=he===l,re=t.useMemo(()=>[...L?J:[]].filter(s=>!(s.scope==="global"&&s.key===Oe)).sort((s,r)=>s.key.localeCompare(r.key)),[J,L]),te=w.length>0&&w===B;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(we,{icon:ke,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void S(),children:[e.jsx(ce,{...d})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:je,children:[e.jsx(Re,{...d})," ",a("secrets.addSecret","Add Secret")]})]})}),X&&ie===l?e.jsx("div",{className:"form-error",children:X}):null,Q||!L?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(ce,{...Fe})," ",a("secrets.loading","Loading…")]}):null,!Q&&L&&re.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:re.map(s=>{const r=ee[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){Ne(s);return}Pe(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(ne,{...d}):e.jsx(le,{...d})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void Ce(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:pe===s.id?e.jsx(Le,{...d}):e.jsx(Te,{...d})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>Se(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(Ae,{...d})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>C(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(Me,{...d})})]}),ue===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void Ee(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>C(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":H,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>xe(s=>!s),children:[H?e.jsx(De,{size:16,"aria-hidden":"true"}):e.jsx(Ve,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),H?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${T&&m?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",T&&m?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>O(!0),children:T&&m?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),T&&m?e.jsx("button",{className:"btn btn-danger",onClick:()=>void fe(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),me?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":m?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:m?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:z,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:w,onChange:s=>F(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:B,onChange:s=>_(s.target.value)})]}),!te&&B.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:z,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void be(),disabled:!te||ye,children:m?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,de?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":h?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:h?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>x(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:c.key,onChange:s=>i(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:q?"text":"password",autoComplete:"off",spellCheck:!1,value:c.value,onChange:s=>i(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>E(s=>!s),"aria-label":q?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:q?e.jsx(ne,{...d}):e.jsx(le,{...d})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:c.description,onChange:s=>i(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:c.scope==="project",onChange:()=>i(s=>({...s,scope:"project"})),disabled:!!h})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:c.scope==="global",onChange:()=>i(s=>({...s,scope:"global"})),disabled:!!h})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:c.accessPolicy,onChange:s=>i(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:c.envExportable,onChange:s=>i(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),c.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:c.envExportKey,onChange:s=>i(r=>({...r,envExportKey:s.target.value}))})]}):null,Z?e.jsx("div",{className:"form-error",children:Z}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>x(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ge(),children:h?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Ge as SecretsView};
1
+ import{r as t,j as e}from"./vendor-react-SZ_qB27O.js";import{w as A,V as we,o as ke,R as ce,P as Re,E as ne,p as le,q as Le,u as Te,v as Ae,x as Me,C as qe,g as De,y as Ve}from"./index-CBFPgFTp.js";import{u as Ke}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";const Oe="__sync_passphrase__",Y={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},d={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Fe={...d,className:"secrets-action-icon spin"},Ye=({addToast:p,projectId:l})=>{const{t:a}=Ke("app"),[z,G]=t.useState([]),[oe,U]=t.useState(),[Q,W]=t.useState(!0),[X,M]=t.useState(null),[ie,q]=t.useState(),[Z,b]=t.useState(null),[h,D]=t.useState(null),[de,x]=t.useState(!1),[ue,C]=t.useState(null),[c,i]=t.useState(Y),[V,E]=t.useState(!1),[ee,f]=t.useState({}),[pe,K]=t.useState(null),[m,se]=t.useState(!1),[he,ae]=t.useState(),[me,O]=t.useState(!1),[w,F]=t.useState(""),[_,B]=t.useState(""),[ye,$]=t.useState(!1),[H,xe]=t.useState(!1),v=t.useRef(new Map),I=t.useRef(new Map),j=t.useRef(0),k=t.useRef(0),o=t.useRef(l);o.current!==l&&(o.current=l,j.current+=1,k.current+=1);const y=t.useCallback(s=>A(s,l),[l]),u=t.useCallback(async(s,r)=>{const n=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!n.ok){const g=await n.json().catch(()=>({error:"Request failed"}));throw new Error(String(g?.error??"Request failed"))}if(n.status!==204)return n.json()},[]),S=t.useCallback(async()=>{const s=l;if(o.current!==s)return;const r=++j.current;W(!0),M(null),q(void 0);try{const n=await u(y("/api/secrets"));r===j.current&&o.current===s&&(G(n.secrets),U(s))}catch(n){r===j.current&&o.current===s&&(M(n instanceof Error?n.message:String(n)),q(s))}finally{r===j.current&&o.current===s&&W(!1)}},[l,y,u]),R=t.useCallback(async()=>{const s=l;if(o.current!==s)return;const r=++k.current;try{const n=await u(y("/api/secrets/sync-passphrase"));r===k.current&&o.current===s&&(se(!!n.configured),ae(s))}catch(n){r===k.current&&o.current===s&&p?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:n instanceof Error?n.message:String(n)}),"error")}},[p,l,y,u,a]);t.useEffect(()=>(G([]),U(void 0),f({}),K(null),se(!1),ae(void 0),M(null),q(void 0),b(null),D(null),x(!1),E(!1),C(null),O(!1),F(""),B(""),$(!1),S(),R(),()=>{v.current.forEach(s=>clearTimeout(s)),I.current.forEach(s=>clearTimeout(s))}),[S,R,l]);const J=()=>{O(!1),F(""),B("")},ve=async(s,r)=>{await u(A("/api/secrets/sync-passphrase",r),{method:"PUT",body:JSON.stringify({passphrase:s})})},be=async()=>{const s=l;$(!0);try{if(await ve(w,s),o.current!==s)return;p?.(m?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),J(),await R()}catch(r){o.current===s&&p?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}finally{o.current===s&&$(!1)}},fe=async()=>{if(!window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))return;const r=l;try{if(await u(A("/api/secrets/sync-passphrase",r),{method:"DELETE"}),o.current!==r)return;p?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await R()}catch(n){o.current===r&&p?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:n instanceof Error?n.message:String(n)}),"error")}},je=()=>{D(null),i(Y),x(!0),E(!1),b(null)},Se=s=>{D(s),i({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),x(!0),E(!1),b(null)},ge=async()=>{const s=l;b(null);try{if(h){const r={key:c.key,description:c.description||null,accessPolicy:c.accessPolicy,envExportable:c.envExportable,envExportKey:c.envExportable&&c.envExportKey||null};c.value&&(r.value=c.value),await u(y(`/api/secrets/${h.scope}/${h.id}`),{method:"PATCH",body:JSON.stringify(r)})}else await u(y("/api/secrets"),{method:"POST",body:JSON.stringify({scope:c.scope,key:c.key,value:c.value,description:c.description||null,accessPolicy:c.accessPolicy,envExportable:c.envExportable,envExportKey:c.envExportable&&c.envExportKey||null})});if(o.current!==s)return;x(!1),i(Y),await S()}catch(r){o.current===s&&b(r instanceof Error?r.message:String(r))}},Ne=s=>{const r=v.current.get(s.id);r&&(clearTimeout(r),v.current.delete(s.id)),f(n=>({...n,[s.id]:null}))},Pe=async s=>{const r=l,n=await u(y(`/api/secrets/${s.scope}/${s.id}/reveal`),{method:"POST"});if(o.current!==r)return;f(P=>({...P,[s.id]:n.value})),p?.(a("secrets.revealed","Revealed"),"success");const g=setTimeout(()=>{f(P=>({...P,[s.id]:null})),v.current.delete(s.id)},3e4),N=v.current.get(s.id);N&&clearTimeout(N),v.current.set(s.id,g)},Ce=async s=>{const r=ee[s.id];if(!r)return;if(!await Ve(r)){p?.(a("secrets.copyFailed","Failed to copy secret"),"error");return}K(s.id),p?.(a("secrets.copied","Copied"),"success");const g=setTimeout(()=>{K(null),f(P=>({...P,[s.id]:null}))},1500),N=I.current.get(s.id);N&&clearTimeout(N),I.current.set(s.id,g)},Ee=async s=>{const r=l;await u(A(`/api/secrets/${s.scope}/${s.id}`,r),{method:"DELETE"}),o.current===r&&(C(null),await S())},L=oe===l,T=he===l,re=t.useMemo(()=>[...L?z:[]].filter(s=>!(s.scope==="global"&&s.key===Oe)).sort((s,r)=>s.key.localeCompare(r.key)),[z,L]),te=w.length>0&&w===_;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(we,{icon:ke,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void S(),children:[e.jsx(ce,{...d})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:je,children:[e.jsx(Re,{...d})," ",a("secrets.addSecret","Add Secret")]})]})}),X&&ie===l?e.jsx("div",{className:"form-error",children:X}):null,Q||!L?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(ce,{...Fe})," ",a("secrets.loading","Loading…")]}):null,!Q&&L&&re.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:re.map(s=>{const r=ee[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){Ne(s);return}Pe(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(ne,{...d}):e.jsx(le,{...d})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void Ce(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:pe===s.id?e.jsx(Le,{...d}):e.jsx(Te,{...d})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>Se(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(Ae,{...d})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>C(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(Me,{...d})})]}),ue===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void Ee(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>C(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":H,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>xe(s=>!s),children:[H?e.jsx(qe,{size:16,"aria-hidden":"true"}):e.jsx(De,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),H?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${T&&m?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",T&&m?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>O(!0),children:T&&m?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),T&&m?e.jsx("button",{className:"btn btn-danger",onClick:()=>void fe(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),me?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":m?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:m?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:J,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:w,onChange:s=>F(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:_,onChange:s=>B(s.target.value)})]}),!te&&_.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:J,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void be(),disabled:!te||ye,children:m?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,de?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":h?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:h?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>x(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:c.key,onChange:s=>i(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:V?"text":"password",autoComplete:"off",spellCheck:!1,value:c.value,onChange:s=>i(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>E(s=>!s),"aria-label":V?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:V?e.jsx(ne,{...d}):e.jsx(le,{...d})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:c.description,onChange:s=>i(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:c.scope==="project",onChange:()=>i(s=>({...s,scope:"project"})),disabled:!!h})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:c.scope==="global",onChange:()=>i(s=>({...s,scope:"global"})),disabled:!!h})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:c.accessPolicy,onChange:s=>i(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:c.envExportable,onChange:s=>i(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),c.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:c.envExportKey,onChange:s=>i(r=>({...r,envExportKey:s.target.value}))})]}):null,Z?e.jsx("div",{className:"form-error",children:Z}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>x(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ge(),children:h?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Ye as SecretsView};