@shawnstack/quickforge 1.7.4 → 1.7.6

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 (258) hide show
  1. package/dist/assets/AgentProfilesPage-Dl5Peqov.js +1 -0
  2. package/dist/assets/ChatPanelHost-D3987TUJ.js +307 -0
  3. package/dist/assets/CloudAccountSettingsPage-BG5Nn3bq.js +1 -0
  4. package/dist/assets/PluginsPage-BDKYfLna.js +1 -0
  5. package/dist/assets/ScheduledTasksPage--GAki3lB.js +2 -0
  6. package/dist/assets/SettingsWorkspacePage-DSy66Tuw.js +1696 -0
  7. package/dist/assets/ShareLinksSettingsPage-BQQMsvJo.js +1 -0
  8. package/dist/assets/SharedConversationPage-B9BUVCri.js +1 -0
  9. package/dist/assets/TerminalDock-CT1nYo7P.js +2 -0
  10. package/dist/assets/WorkspaceInspector-BnfDLf9a.js +36 -0
  11. package/dist/assets/{abnfDiagram-VRR7QNED-Dy7veffk.js → abnfDiagram-VRR7QNED-CMhVoYUh.js} +1 -1
  12. package/dist/assets/{arc-Bo3p2lGy.js → arc-w21O0TLn.js} +1 -1
  13. package/dist/assets/architecture-TIHT7OUA-DMwFMHxq.js +1 -0
  14. package/dist/assets/{architectureDiagram-ZJ3FMSHR-Cwx8qOvu.js → architectureDiagram-ZJ3FMSHR-C52qL6Hg.js} +1 -1
  15. package/dist/assets/{blockDiagram-677ZJIJ3-BiuaAOFa.js → blockDiagram-677ZJIJ3-CM3XbLol.js} +1 -1
  16. package/dist/assets/{c4Diagram-LMCZKHZV-BTcGfhK2.js → c4Diagram-LMCZKHZV-D7Bh1ui1.js} +1 -1
  17. package/dist/assets/channel-Duu1CuH9.js +1 -0
  18. package/dist/assets/chunk-2Q5K7J3B-B6rHWc4S.js +1 -0
  19. package/dist/assets/{chunk-32BRIVSS-B9PuF_RF.js → chunk-32BRIVSS-xgrtbT8e.js} +1 -1
  20. package/dist/assets/{chunk-52WLFC77-3zGItfIM.js → chunk-52WLFC77-CDbaHw80.js} +1 -1
  21. package/dist/assets/{chunk-5FCAYU7R-DQ66qlmt.js → chunk-5FCAYU7R-CcSvVbPc.js} +1 -1
  22. package/dist/assets/{chunk-5HE753X5-CLqTO-VF.js → chunk-5HE753X5-erFpzzgx.js} +1 -1
  23. package/dist/assets/{chunk-5JV3BV7I-Csxv1jr6.js → chunk-5JV3BV7I-rEhN9F6G.js} +1 -1
  24. package/dist/assets/{chunk-5TONJI2A-BCQttpBr.js → chunk-5TONJI2A-D8L-QTwD.js} +1 -1
  25. package/dist/assets/{chunk-5VM5RSS4-DEWJGSTb.js → chunk-5VM5RSS4-CjlfMBbM.js} +1 -1
  26. package/dist/assets/{chunk-7BUUIJ7U-DNorm9MM.js → chunk-7BUUIJ7U-CCcsI9XE.js} +1 -1
  27. package/dist/assets/{chunk-BIQX33UG-DgvY_BOT.js → chunk-BIQX33UG-FSqFbmb3.js} +1 -1
  28. package/dist/assets/{chunk-C7G6YPKG-DMvn9IPs.js → chunk-C7G6YPKG-ZMLUvfLy.js} +1 -1
  29. package/dist/assets/{chunk-CQNSW5MT-Dq2duUgr.js → chunk-CQNSW5MT-DZuBpk25.js} +1 -1
  30. package/dist/assets/{chunk-CYSBUYHQ-BovYyc4Y.js → chunk-CYSBUYHQ-CB26wsG0.js} +1 -1
  31. package/dist/assets/{chunk-EMLP6XTP-BMDOpuYN.js → chunk-EMLP6XTP-BbsM8oRw.js} +1 -1
  32. package/dist/assets/{chunk-EX3LRPZG-6eP2UPOf.js → chunk-EX3LRPZG-BcQhaqt7.js} +1 -1
  33. package/dist/assets/{chunk-FWX5IMBZ-D4q-wTSy.js → chunk-FWX5IMBZ-DrnrdrSu.js} +2 -2
  34. package/dist/assets/{chunk-HOUHSVGY-XjIcuzH7.js → chunk-HOUHSVGY-tdc-Z9eW.js} +1 -1
  35. package/dist/assets/{chunk-ICXQ74PX-YBXbanq9.js → chunk-ICXQ74PX-Cd7igVGt.js} +1 -1
  36. package/dist/assets/{chunk-JG7HCLWE-CcN3uNXF.js → chunk-JG7HCLWE-iXXGW8nf.js} +1 -1
  37. package/dist/assets/{chunk-JWPE2WC7-Cwg6AUAt.js → chunk-JWPE2WC7-BZ87mXEv.js} +1 -1
  38. package/dist/assets/{chunk-MOJQB5TN-NNspcGIU.js → chunk-MOJQB5TN-CLTjV5ov.js} +1 -1
  39. package/dist/assets/{chunk-MOZMSUNE-pMJ_jMos.js → chunk-MOZMSUNE-B3SCBrRH.js} +1 -1
  40. package/dist/assets/{chunk-OGEWGWER-CJy-3Ldv.js → chunk-OGEWGWER-TgvkXkFX.js} +1 -1
  41. package/dist/assets/{chunk-OSBZ3O6U-D7cLHHOA.js → chunk-OSBZ3O6U-B9E2E5v1.js} +1 -1
  42. package/dist/assets/{chunk-PUDLZKDR-D5YBi1Pi.js → chunk-PUDLZKDR-C5GMVYup.js} +1 -1
  43. package/dist/assets/{chunk-Q4XR5HBZ-DYmqQdIf.js → chunk-Q4XR5HBZ-fo5-HsqY.js} +1 -1
  44. package/dist/assets/{chunk-QBLGF6JB-Bfcx00X0.js → chunk-QBLGF6JB-Dwfg8sKc.js} +1 -1
  45. package/dist/assets/{chunk-R7FJI6CG-oXzadpZY.js → chunk-R7FJI6CG-DpBrv4ni.js} +1 -1
  46. package/dist/assets/{chunk-RYQCIY6F-Dt3-8yUh.js → chunk-RYQCIY6F-DzzmTl11.js} +1 -1
  47. package/dist/assets/{chunk-U6XO7XAA-B55eSvpx.js → chunk-U6XO7XAA-Dw6aviKa.js} +1 -1
  48. package/dist/assets/{chunk-V7JOEXUC-Btk4JwCt.js → chunk-V7JOEXUC-CEDazV6w.js} +1 -1
  49. package/dist/assets/chunk-VAUOI2AC-CWYjg8zE.js +1 -0
  50. package/dist/assets/{chunk-VR4S4FIN-DgaSiVOY.js → chunk-VR4S4FIN-C_-eEj-9.js} +1 -1
  51. package/dist/assets/{chunk-WYO6CB5R-rRDZ_Tta.js → chunk-WYO6CB5R-NF-MsJJR.js} +3 -3
  52. package/dist/assets/chunk-XXDRQBXY-DzTwx8ZH.js +1 -0
  53. package/dist/assets/{chunk-YOTPTUD7-BnFxj5o4.js → chunk-YOTPTUD7-DqzqtdII.js} +1 -1
  54. package/dist/assets/{chunk-ZGVPDNZ5-CrnlPlmJ.js → chunk-ZGVPDNZ5-CRrAYi4g.js} +1 -1
  55. package/dist/assets/{chunk-ZIRB5QZD-BYTiATIH.js → chunk-ZIRB5QZD-Dc1s5bLM.js} +1 -1
  56. package/dist/assets/classDiagram-OUVF2IWQ-Cc63fLWP.js +1 -0
  57. package/dist/assets/classDiagram-v2-EOCWNBFH-CoXU0qT6.js +1 -0
  58. package/dist/assets/{cose-bilkent-JH36ORCC-BORKJRwF.js → cose-bilkent-JH36ORCC-cL247pHg.js} +1 -1
  59. package/dist/assets/cynefin-VYW2F7L2-C8yCvH_o.js +1 -0
  60. package/dist/assets/{cynefinDiagram-TSTJHNR4-BXKeaSl8.js → cynefinDiagram-TSTJHNR4-D4sZ7LYI.js} +1 -1
  61. package/dist/assets/{dagre-CrA0XVwJ.js → dagre-DmHb3Ctt.js} +1 -1
  62. package/dist/assets/{dagre-VKFMJZFB-ouq_lA1a.js → dagre-VKFMJZFB-BlsnSh-Q.js} +1 -1
  63. package/dist/assets/{diagram-FQU43EPY-BxR5kUiQ.js → diagram-FQU43EPY-DW1yQiRO.js} +1 -1
  64. package/dist/assets/{diagram-G47NLZAW-DWonk1sL.js → diagram-G47NLZAW-BTUAsFjb.js} +1 -1
  65. package/dist/assets/{diagram-NH7WQ7WH-fmV_wV5e.js → diagram-NH7WQ7WH-BcaomqSd.js} +1 -1
  66. package/dist/assets/{diagram-OA4YK3LP-DvOSRRiV.js → diagram-OA4YK3LP-DDLX7Xwr.js} +1 -1
  67. package/dist/assets/{diagram-WEI45ONY-Bp-xb3uS.js → diagram-WEI45ONY-CIave0An.js} +1 -1
  68. package/dist/assets/{dist-DLKC_odd.js → dist-yDHbi5ux.js} +1 -1
  69. package/dist/assets/{ebnfDiagram-CCIWWBDH-BTlnwneA.js → ebnfDiagram-CCIWWBDH-Cr1Y6lPu.js} +1 -1
  70. package/dist/assets/{erDiagram-Q63AITRT-C3fFWGCm.js → erDiagram-Q63AITRT-D3EgiVVH.js} +1 -1
  71. package/dist/assets/{esm-oa69b5u4.js → esm-sdsK6gaB.js} +2 -2
  72. package/dist/assets/eventmodeling-45OFAUF4-DO1vRTM0.js +1 -0
  73. package/dist/assets/flowDiagram-23GEKE2U-BS7KXcqn.js +1 -0
  74. package/dist/assets/{ganttDiagram-NO4QXBWP-DzAiojNi.js → ganttDiagram-NO4QXBWP-B0oyDIqK.js} +1 -1
  75. package/dist/assets/gitGraph-TEB2WS4Q-m5F5ef09.js +1 -0
  76. package/dist/assets/{gitGraphDiagram-IHSO6WYX-Cv57oNEA.js → gitGraphDiagram-IHSO6WYX-uQtr6IqK.js} +1 -1
  77. package/dist/assets/icons-2D18YbSI.js +1 -0
  78. package/dist/assets/index-1ei6nhs-.css +3 -0
  79. package/dist/assets/index-BivLuZvX.js +65 -0
  80. package/dist/assets/info-DKCQHKI2-CZxPlQJ0.js +1 -0
  81. package/dist/assets/{infoDiagram-FWYZ7A6U-B5Z_O3Ro.js → infoDiagram-FWYZ7A6U-B_GzlLIM.js} +1 -1
  82. package/dist/assets/{ishikawaDiagram-FXEZZL3T-CKTK_TKV.js → ishikawaDiagram-FXEZZL3T-CKQIsSdU.js} +1 -1
  83. package/dist/assets/{journeyDiagram-5HDEW3XC-Cm9k4ywW.js → journeyDiagram-5HDEW3XC-DrrvzZL1.js} +1 -1
  84. package/dist/assets/{kanban-definition-HUTT4EX6-DzNteLwx.js → kanban-definition-HUTT4EX6-CJQRTdXz.js} +1 -1
  85. package/dist/assets/{line-BG78c_WJ.js → line-B4DxX7tC.js} +1 -1
  86. package/dist/assets/{linear-1X20_EGu.js → linear-U-nKUhyW.js} +1 -1
  87. package/dist/assets/{map-CCI8WZkS.js → map-BneTM-ri.js} +1 -1
  88. package/dist/assets/{mcp-servers-dialog-GXXD9K0U.js → mcp-servers-dialog-BEV4_TXC.js} +2 -2
  89. package/dist/assets/{mermaid-parser.core-Bb8HI_OS.js → mermaid-parser.core-BlKWrEdZ.js} +2 -2
  90. package/dist/assets/{mermaid-renderer-PIaNiXAz.js → mermaid-renderer-jEbqFaTe.js} +2 -2
  91. package/dist/assets/{mermaid.core-DUHOIwL5.js → mermaid.core-DWpShXCs.js} +3 -3
  92. package/dist/assets/{mindmap-definition-LN4V7U3C-Tnbszo7b.js → mindmap-definition-LN4V7U3C-CEVwZD78.js} +1 -1
  93. package/dist/assets/{logger-8REuLPGK.js → model-display-label-C6-0eDxF.js} +1 -1
  94. package/dist/assets/model-identity-CgA6_Pbm.js +1 -0
  95. package/dist/assets/model-reference-o41fJ6jQ.js +1 -0
  96. package/dist/assets/{monaco-BVtCspYZ.js → monaco-DvXErxp2.js} +1 -1
  97. package/dist/assets/{ordinal-v4prQcuq.js → ordinal-B2r5L1v4.js} +1 -1
  98. package/dist/assets/{otel-D1LswXpM.js → otel-BFnphzjt.js} +1 -1
  99. package/dist/assets/packet-7NZHBO7P-zIioIZVN.js +1 -0
  100. package/dist/assets/{pegDiagram-2B236MQR-CX824Kd0.js → pegDiagram-2B236MQR-CBLkBdnQ.js} +1 -1
  101. package/dist/assets/{pi-ai-DAJlO9ZB.js → pi-ai-Cr2ee4a0.js} +2 -2
  102. package/dist/assets/{pi-web-ui-B-RJSxjR.js → pi-web-ui-DV5jKjSg.js} +1 -1
  103. package/dist/assets/pie-RZYD4A2V-GGWijBvB.js +1 -0
  104. package/dist/assets/{pieDiagram-ENE6RG2P-BT04VWPQ.js → pieDiagram-ENE6RG2P-8tCnwtWS.js} +1 -1
  105. package/dist/assets/{quadrantDiagram-ABIIQ3AL-BvOZxkBr.js → quadrantDiagram-ABIIQ3AL-CWd28cHF.js} +1 -1
  106. package/dist/assets/radar-I7S5WNFK-yvwFH3RV.js +1 -0
  107. package/dist/assets/railroad-3IZDKUUU-BVadlswB.js +1 -0
  108. package/dist/assets/railroad-abnf-AHOZXSZD-B7R-p_2-.js +1 -0
  109. package/dist/assets/railroad-ebnf-EBAXGLYW-BnbJxPug.js +1 -0
  110. package/dist/assets/railroad-peg-LSFZ7HO6-Ci3DcEuQ.js +1 -0
  111. package/dist/assets/{railroadDiagram-RFXS5EU6-DnTU--BV.js → railroadDiagram-RFXS5EU6-CI4ouOBs.js} +1 -1
  112. package/dist/assets/{react-vendor-eWH0QhNU.js → react-vendor-3UaA-C9W.js} +1 -1
  113. package/dist/assets/{requirementDiagram-TGXJPOKE--MZX_yEv.js → requirementDiagram-TGXJPOKE-DtFz7sw4.js} +1 -1
  114. package/dist/assets/{sankeyDiagram-HTMAVEWB-SEZkHhYn.js → sankeyDiagram-HTMAVEWB--VeOwwk9.js} +1 -1
  115. package/dist/assets/{sequenceDiagram-DBY2YBRQ-BhC2OHiz.js → sequenceDiagram-DBY2YBRQ-B8AHk5Oe.js} +1 -1
  116. package/dist/assets/{sizeCapture-X5ZJPWSS-Ci5LeToV.js → sizeCapture-X5ZJPWSS-vV_ArM8D.js} +1 -1
  117. package/dist/assets/{skills-dialog-DDh1h8eH.js → skills-dialog-BTJ7mzk_.js} +3 -3
  118. package/dist/assets/{src-CovulcRC.js → src-PYsDme0X.js} +1 -1
  119. package/dist/assets/{stateDiagram-2N3HPSRC-DKK5tFT4.js → stateDiagram-2N3HPSRC-etXnJ8X8.js} +1 -1
  120. package/dist/assets/stateDiagram-v2-6OUMAXLB-Dms3pICj.js +1 -0
  121. package/dist/assets/{swimlanes-5IMT3BWC-DxxGCk67.js → swimlanes-5IMT3BWC-pabIKAmn.js} +2 -2
  122. package/dist/assets/swimlanesDiagram-G3AALYLV-B14aWjv6.js +8 -0
  123. package/dist/assets/{timeline-definition-FHXFAJF6-BPXB3Sue.js → timeline-definition-FHXFAJF6-C55MKm3L.js} +1 -1
  124. package/dist/assets/treeView-QDETBFTQ-Cru9B2zv.js +1 -0
  125. package/dist/assets/treemap-6X3UGDF4-DNOVHFaJ.js +1 -0
  126. package/dist/assets/{vennDiagram-L72KCM5P-CxcBCKye.js → vennDiagram-L72KCM5P-CgNf1Q9W.js} +1 -1
  127. package/dist/assets/wardley-OPB4EBWU-E3m1BOJQ.js +1 -0
  128. package/dist/assets/{wardleyDiagram-EHGQE667-DEL6Yes5.js → wardleyDiagram-EHGQE667-Drt5ytec.js} +1 -1
  129. package/dist/assets/{web-RgX7H-OH.js → web-B5qgZJRv.js} +1 -1
  130. package/dist/assets/{xychartDiagram-FW5EYKEG-N8cPbcjC.js → xychartDiagram-FW5EYKEG-hhoEo_Ar.js} +1 -1
  131. package/dist/index.html +11 -10
  132. package/dist/sw.js +17 -0
  133. package/package.json +4 -1
  134. package/plugins/{openai-documents → documents}/plugin.json +2 -2
  135. package/plugins/{openai-presentations → presentations}/plugin.json +2 -2
  136. package/plugins/{openai-spreadsheets → spreadsheets}/plugin.json +2 -2
  137. package/runtime-assets/agent/darwin-arm64/qf-agent +0 -0
  138. package/runtime-assets/agent/darwin-x64/qf-agent +0 -0
  139. package/runtime-assets/agent/linux-arm64/qf-agent +0 -0
  140. package/runtime-assets/agent/linux-x64/qf-agent +0 -0
  141. package/runtime-assets/agent/win32-x64/qf-agent.exe +0 -0
  142. package/server/access-policy.mjs +11 -0
  143. package/server/acp/server.mjs +36 -26
  144. package/server/agent-manager.mjs +474 -71
  145. package/server/agent-profile-files.mjs +8 -4
  146. package/server/agent-profile-schema.mjs +47 -23
  147. package/server/agent-profiles.mjs +28 -9
  148. package/server/ai-http-logger.mjs +98 -12
  149. package/server/auto-compaction.mjs +35 -8
  150. package/server/cloud/chat-idempotency-store.mjs +96 -0
  151. package/server/cloud/client.mjs +99 -0
  152. package/server/cloud/config.mjs +54 -0
  153. package/server/cloud/credential-store.mjs +200 -0
  154. package/server/cloud/identity.mjs +312 -0
  155. package/server/cloud/index.mjs +7 -0
  156. package/server/cloud/models.mjs +80 -0
  157. package/server/cloud/qf-agent-process.mjs +571 -0
  158. package/server/cloud/runtime.mjs +135 -0
  159. package/server/cloud/service-config.mjs +81 -0
  160. package/server/index.mjs +124 -48
  161. package/server/mcp/registry.mjs +8 -7
  162. package/server/message-converters.mjs +40 -19
  163. package/server/model-catalog.mjs +269 -0
  164. package/server/opencode-acp-agent.mjs +1151 -0
  165. package/server/plugins/registry.mjs +29 -5
  166. package/server/public-api.mjs +11 -5
  167. package/server/routes/agent-profiles.mjs +46 -9
  168. package/server/routes/agent.mjs +60 -11
  169. package/server/routes/backup.mjs +8 -1
  170. package/server/routes/cloud.mjs +246 -0
  171. package/server/routes/models.mjs +7 -1
  172. package/server/routes/scheduled-tasks.mjs +38 -8
  173. package/server/routes/shared-conversation.mjs +62 -58
  174. package/server/routes/shares.mjs +75 -1
  175. package/server/routes/storage.mjs +9 -1
  176. package/server/routes/system.mjs +7 -4
  177. package/server/routes/workspace.mjs +6 -4
  178. package/server/share-store.mjs +168 -13
  179. package/server/skills.mjs +30 -3
  180. package/server/storage.mjs +7 -1
  181. package/server/subagents.mjs +3 -3
  182. package/server/tools/definitions.mjs +1 -1
  183. package/server/tools/index.mjs +2 -2
  184. package/server/utils/network.mjs +9 -0
  185. package/server/utils/process-tree.mjs +78 -0
  186. package/server/utils/response.mjs +8 -1
  187. package/skills/skill-creator/LICENSE.txt +202 -0
  188. package/skills/skill-creator/SKILL.md +485 -0
  189. package/skills/skill-creator/UPSTREAM.md +6 -0
  190. package/skills/skill-creator/agents/analyzer.md +274 -0
  191. package/skills/skill-creator/agents/comparator.md +202 -0
  192. package/skills/skill-creator/agents/grader.md +223 -0
  193. package/skills/skill-creator/assets/eval_review.html +146 -0
  194. package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  195. package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  196. package/skills/skill-creator/references/schemas.md +430 -0
  197. package/skills/skill-creator/scripts/__init__.py +0 -0
  198. package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  199. package/skills/skill-creator/scripts/generate_report.py +326 -0
  200. package/skills/skill-creator/scripts/improve_description.py +247 -0
  201. package/skills/skill-creator/scripts/package_skill.py +136 -0
  202. package/skills/skill-creator/scripts/quick_validate.py +103 -0
  203. package/skills/skill-creator/scripts/run_eval.py +310 -0
  204. package/skills/skill-creator/scripts/run_loop.py +328 -0
  205. package/skills/skill-creator/scripts/utils.py +47 -0
  206. package/dist/assets/AgentProfilesPage-B84w-r9S.js +0 -1
  207. package/dist/assets/ChatPanelHost-CyO8fEoj.js +0 -288
  208. package/dist/assets/PluginsPage-D2862wul.js +0 -1
  209. package/dist/assets/ScheduledTasksPage-GqbiJDPX.js +0 -2
  210. package/dist/assets/SettingsWorkspacePage-B53_eDf2.js +0 -1628
  211. package/dist/assets/SharedConversationPage-Cw2QFnbC.js +0 -1
  212. package/dist/assets/TerminalDock-Dgg-_ZmU.js +0 -2
  213. package/dist/assets/WorkspaceInspector-3uLiu6Bv.js +0 -13
  214. package/dist/assets/architecture-TIHT7OUA-7FQo5GbP.js +0 -1
  215. package/dist/assets/channel-DToA8d-4.js +0 -1
  216. package/dist/assets/chunk-2Q5K7J3B-D_Wxpk-T.js +0 -1
  217. package/dist/assets/chunk-VAUOI2AC-CIZseNLi.js +0 -1
  218. package/dist/assets/chunk-XXDRQBXY-Do-XYxat.js +0 -1
  219. package/dist/assets/classDiagram-OUVF2IWQ-Bu24Sy-k.js +0 -1
  220. package/dist/assets/classDiagram-v2-EOCWNBFH-DKhh5HSW.js +0 -1
  221. package/dist/assets/cynefin-VYW2F7L2-oyiAgYC4.js +0 -1
  222. package/dist/assets/eventmodeling-45OFAUF4-YB_0MefX.js +0 -1
  223. package/dist/assets/flowDiagram-23GEKE2U-Bc73xdBd.js +0 -1
  224. package/dist/assets/gitGraph-TEB2WS4Q-Bvp27L0n.js +0 -1
  225. package/dist/assets/icons-cTkqD_Gi.js +0 -1
  226. package/dist/assets/index-B48prgLL.js +0 -65
  227. package/dist/assets/index-DQhwHHer.css +0 -3
  228. package/dist/assets/info-DKCQHKI2-BsLOivgq.js +0 -1
  229. package/dist/assets/packet-7NZHBO7P-BKQkXRtk.js +0 -1
  230. package/dist/assets/pie-RZYD4A2V-BTiTN5Ge.js +0 -1
  231. package/dist/assets/radar-I7S5WNFK-BU-oVjKM.js +0 -1
  232. package/dist/assets/railroad-3IZDKUUU-7H2hxNbL.js +0 -1
  233. package/dist/assets/railroad-abnf-AHOZXSZD-Mx6wf6XQ.js +0 -1
  234. package/dist/assets/railroad-ebnf-EBAXGLYW-BgXSKhYy.js +0 -1
  235. package/dist/assets/railroad-peg-LSFZ7HO6-DTEl2rAC.js +0 -1
  236. package/dist/assets/stateDiagram-v2-6OUMAXLB-D8x3mkni.js +0 -1
  237. package/dist/assets/swimlanesDiagram-G3AALYLV-C4nOBNp8.js +0 -8
  238. package/dist/assets/treeView-QDETBFTQ-DOE6NSdf.js +0 -1
  239. package/dist/assets/treemap-6X3UGDF4-Ca7QD_b4.js +0 -1
  240. package/dist/assets/wardley-OPB4EBWU-D9O4RKRm.js +0 -1
  241. /package/dist/assets/{array-DqLCdDFv.js → array-B9UHiPd-.js} +0 -0
  242. /package/dist/assets/{chunk-KEIR6QF5-s7Qq-R3i.js → chunk-KEIR6QF5-jrz1pRUS.js} +0 -0
  243. /package/dist/assets/{chunk-Y2CYZVJY-BgISNSiw.js → chunk-Y2CYZVJY-D6N-CrJv.js} +0 -0
  244. /package/dist/assets/{cytoscape.esm-iekjSZ2n.js → cytoscape.esm-DyfqweF2.js} +0 -0
  245. /package/dist/assets/{defaultLocale-CrJzLgRD.js → defaultLocale-5eAKkKJC.js} +0 -0
  246. /package/dist/assets/{dist-zzfqk5hx.js → dist-CLg13NtV.js} +0 -0
  247. /package/dist/assets/{graphlib-CIz_CfxW.js → graphlib-DJkmx0Cq.js} +0 -0
  248. /package/dist/assets/{init-C0r9Gk5G.js → init-DlZdxViB.js} +0 -0
  249. /package/dist/assets/{path-DIKpVbHL.js → path-6uRLdFF7.js} +0 -0
  250. /package/dist/assets/{plugin-api-C8hMT5W6.js → plugin-api-Uu2xAB4d.js} +0 -0
  251. /package/dist/assets/{rough.esm-BMOtDaaS.js → rough.esm-Bud4g4fh.js} +0 -0
  252. /package/dist/assets/{xterm-BFzZ1FH4.js → xterm-Bm_IbozX.js} +0 -0
  253. /package/plugins/{openai-documents → documents}/commands/document.md +0 -0
  254. /package/plugins/{openai-documents → documents}/skills/documents/SKILL.md +0 -0
  255. /package/plugins/{openai-presentations → presentations}/commands/presentation.md +0 -0
  256. /package/plugins/{openai-presentations → presentations}/skills/presentations/SKILL.md +0 -0
  257. /package/plugins/{openai-spreadsheets → spreadsheets}/commands/spreadsheet.md +0 -0
  258. /package/plugins/{openai-spreadsheets → spreadsheets}/skills/spreadsheets/SKILL.md +0 -0
@@ -1,65 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-oa69b5u4.js","assets/pi-ai-DAJlO9ZB.js","assets/rolldown-runtime-DWdDZTNf.js","assets/dist-DLKC_odd.js","assets/ChatPanelHost-CyO8fEoj.js","assets/pi-web-ui-B-RJSxjR.js","assets/lit-vendor-DvaQX_UQ.js","assets/icons-cTkqD_Gi.js","assets/react-vendor-eWH0QhNU.js","assets/plugin-api-C8hMT5W6.js","assets/logger-8REuLPGK.js","assets/mermaid-renderer-PIaNiXAz.js","assets/SharedConversationPage-Cw2QFnbC.js","assets/WorkspaceInspector-3uLiu6Bv.js","assets/monaco-BVtCspYZ.js","assets/TerminalDock-Dgg-_ZmU.js","assets/xterm-BFzZ1FH4.js","assets/xterm-BrP-ENHg.css","assets/SettingsWorkspacePage-B53_eDf2.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{B as t,C as n,Ct as r,D as i,Dt as a,F as o,Ft as s,G as c,H as l,I as u,It as d,J as f,K as p,Mt as m,O as h,Ot as g,P as _,Pt as v,S as y,St as b,T as x,Tt as S,V as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,b as ee,bt as A,c as j,d as M,dt as N,et as P,f as te,ft as ne,h as F,ht as I,i as L,it as R,jt as re,k as ie,l as z,lt as ae,m as oe,n as se,o as ce,p as le,pt as ue,q as de,s as fe,st as pe,vt as me,w as he,wt as ge,x as _e,xt as ve,yt as ye,z as be}from"./icons-cTkqD_Gi.js";import{i as xe,n as Se,r as Ce,t as we}from"./react-vendor-eWH0QhNU.js";import{t as Te}from"./dist-DLKC_odd.js";import{f as Ee,p as De,u as Oe}from"./lit-vendor-DvaQX_UQ.js";import{n as ke,r as Ae,t as je}from"./css-utils-31qzCXsk.js";import{C as Me,D as Ne,E as Pe,S as Fe,T as Ie,b as Le,d as Re,f as ze,p as Be,u as Ve,w as He}from"./pi-web-ui-B-RJSxjR.js";import{J as Ue,U as We,W as Ge}from"./pi-ai-DAJlO9ZB.js";import{t as B}from"./logger-8REuLPGK.js";import{t as Ke}from"./skills-dialog-DDh1h8eH.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var V=e(d(),1),qe=Ce(),Je=`language`,Ye=[`en`,`zh`],Xe={en:{language:`Language`,displayLanguage:`Display language`,languageDescription:`Choose the display language for 速构 QuickForge. The page will reload to apply the change.`,simplifiedChinese:`Simplified Chinese`,english:`English`,apply:`Apply`,noLanguageChange:`The selected language is already active.`,newChat:`New chat`,startNewChat:`Start new chat`,newChatEmptyTitle:`What do you want to get done today?`,chooseProject:`Select project`,searchProjects:`Search projects`,newProject:`Add project`,createBlankProject:`Add project`,useExistingFolder:`Select project directory`,useNoProject:`No project`,noMatchingProjects:`No matching projects`,loadingChatWorkspace:`Loading chat workspace...`,loadingConversation:`Loading conversation...`,localServiceUnavailableTitle:`Local QuickForge service unavailable`,localServiceUnavailableDescription:`QuickForge requires the local service for storage. Start QuickForge with npm run dev or the quickforge command, then reload this page.`,project:`Project`,projects:`Projects`,loadingProject:`Loading project...`,addProject:`Add project`,noProjects:`No projects yet.`,expandProject:`Expand project`,collapseProject:`Collapse project`,expandAllProjects:`Expand all projects`,collapseAllProjects:`Collapse all projects`,dragToReorder:`Drag to reorder`,newProjectChat:`New project chat`,projectChat:`Project chat`,normalChat:`Chat`,conversations:`Conversations`,pinnedConversations:`Pinned`,noConversations:`No conversations`,filterSort:`Filter and sort`,sidebarView:`View`,sidebarViewByProject:`By project`,sidebarViewTimeline:`Timeline`,sortBy:`Sort by`,sortByUpdatedAt:`Updated time`,sortByCreatedAt:`Created time`,filter:`Filter`,selecting:`Selecting...`,chooseFolder:`Choose folder`,selectProjectDirectory:`Select project directory`,selectProjectDirectoryDescription:`Browse local folders or paste a path, then choose the folder to add it as a project.`,quickAccess:`Quick access`,path:`Path`,go:`Go`,parentDirectory:`Parent directory`,noFolders:`No folders in this directory.`,selectThisFolder:`Select this folder`,folderPickerPathPlaceholder:`Enter or paste a folder path`,filesystemRootsFailed:`Failed to load filesystem roots.`,directoryLoadFailed:`Failed to load directory.`,noSavedConversations:`No saved conversations yet.`,rename:`Rename`,renameSession:`Rename conversation`,sessionName:`Conversation name`,deleteProject:`Delete project`,deleteProjectConfirm:`Are you sure you want to delete project "{name}"? Its conversations will be kept.`,deleteSession:`Delete session`,deleteSessionConfirm:`Are you sure you want to delete this conversation? This cannot be undone.`,deleteSessionFailed:`Failed to delete conversation.`,archiveSession:`Archive conversation`,confirmArchive:`Archive`,archivedConversations:`Archived conversations`,archivedConversationsDescription:`Archived conversations are hidden from the sidebar. Restore them here or delete them permanently.`,searchArchivedConversations:`Search archived conversations`,noArchivedConversations:`No archived conversations yet.`,archivedAt:`Archived at`,lastModified:`Last modified`,restoreSession:`Restore`,restoreSessionFailed:`Failed to restore conversation.`,sessionRestored:`Conversation restored.`,sessionNotFound:`Conversation not found.`,deletePermanently:`Delete`,deleteAll:`Delete all`,deleteArchivedSessionConfirm:`Permanently delete "{title}"? This cannot be undone.`,deleteAllArchivedSessionsConfirm:`Permanently delete all archived conversations? This cannot be undone.`,archivedSessionDeleted:`Archived conversation deleted.`,archivedSessionsDeleted:`Archived conversations deleted.`,allProjects:`All projects`,unknownProject:`Unknown project`,conversationCount:`{count} conversations`,confirm:`Confirm`,confirmDelete:`Delete`,settings:`Settings`,toggleSidebar:`Toggle sidebar`,failedToSelectProjectDirectory:`Failed to select project directory.`,projectSwitchFailed:`Failed to switch to the project for this conversation. Workspace tools were not started.`,copy:`Copy`,copied:`Copied`,svgDisplayMode:`SVG display mode`,svgPreviewMode:`Preview`,svgSourceMode:`Source`,svgEnlargePreview:`Click to enlarge SVG preview`,copySvgSource:`Copy SVG source`,downloadSvg:`Download SVG`,mermaidPreviewLabel:`Mermaid diagram preview`,mermaidEnlargePreview:`Click to enlarge Mermaid diagram`,copyMermaidSource:`Copy Mermaid source`,downloadMermaidSvg:`Download Mermaid SVG`,mermaidRendering:`Rendering Mermaid diagram...`,mermaidRenderFailed:`Could not render this Mermaid diagram. Source is shown instead.`,rollback:`Rollback`,retry:`Retry`,reloadPage:`Reload page`,fork:`Fork`,forkConversation:`Fork conversation from here`,yoloEnabledTitle:`Workspace access enabled: local tools can use this project`,yoloDisabledTitle:`Workspace access locked: local tools are blocked`,agentAccessMenuLabel:`Agent access mode`,agentAccessDefaultLabel:`Default permissions`,agentAccessFullLabel:`Full access`,agentAccessDefaultTitle:`Default permissions: work inside the current repository; ask before actions that may affect the system.`,agentAccessFullTitle:`Full access: developer-level authorization; tools can run automatically within the configured workspace boundaries.`,agentAccessModeSyncFailed:`Failed to sync Agent access mode.`,planModeLabel:`Plan`,planModeEnabledTitle:`Plan mode enabled: send the next message as /plan. Click to remove. Shortcut: Shift+Tab`,planModeDisabledTitle:`Plan mode: send the next message as /plan. Shortcut: Shift+Tab`,composerPlaceholder:`Describe what you want to do`,assistantWaitingThinking:`Thinking`,assistantWaitingOrganizing:`Organizing the answer`,assistantWaitingContinuing:`This may take a little longer`,assistantWaitingAriaLabel:`Assistant is preparing a response`,customCommandsHint:`Custom commands`,customCommandsEmptyHint:`No project commands yet.`,customCommandsListDescription:`List project custom commands`,customCommandsNewDescription:`Create a project custom command`,initCommandDescription:`Generate or update a concise AGENTS.md contributor guide for the current repository.`,planCommandDescription:`Create a plan first; this turn cannot edit files or run commands.`,reviewCommandDescription:`Review pending code changes before commit; this turn cannot edit files.`,summaryCommandDescription:`Create a new chat with this conversation summarized to reduce context usage.`,compactCommandDescription:`Compact this conversation context in place using the same rolling summary as auto-compaction.`,clearCommandDescription:`Clear the current chat history and context without calling the model.`,helpCommandDescription:`Show all available commands and their usage.`,yoloBlockedReason:`Local tool {name} was blocked by the current Agent permission mode. Switch to Full access or approve the tool call when prompted.`,globalToolBlockedReason:`Local tool {name} was blocked because this is a normal chat with no project attached. Start or open a project chat to use workspace tools.`,noActiveProjectToolBlockedReason:`Local tool {name} was blocked because there is no active project. Add or select a project to use workspace tools.`,generationStillRunning:`Generation is still running. Stop it or wait until it finishes before rolling back.`,noConversationTurnToRollback:`There is no conversation turn to roll back.`,rollbackConfirmTitle:`Confirm rollback?`,rollbackConfirm:`Roll back to before this message? This message and all following conversation history will be removed, and the message content will be restored to the composer.`,sharedRollbackConfirmTitle:`Confirm shared conversation rollback?`,sharedRollbackConfirm:`This will directly modify the sharer's original conversation. This message and all following conversation history will be removed, and the message content will be restored to the composer.`,confirmRollback:`Confirm rollback`,rollingBack:`Rolling back...`,rollbackFailed:`Rollback failed.`,retryFailed:`Retry failed.`,copyFailed:`Copy failed. Please check clipboard permissions.`,errorBoundaryTitle:`Something went wrong`,errorBoundaryUnexpected:`An unexpected error occurred.`,errorBoundaryTryAgain:`Try again`,execute:`Run`,addCustomModelFirst:`Please add a custom model in Settings and make sure the model ID is filled in before saving.`,modelSetupRequired:`Please add a model before starting a new chat.`,modelSetupTitle:`No model configured yet`,modelSetupDescription:`Add an OpenAI-Compatible or Anthropic-compatible model to start chatting. QuickForge will only use models that you configure.`,modelSetupSupports:`Supports LiteLLM, OpenRouter, DeepSeek, Qwen, Zhipu, Ollama, and most /v1/chat/completions services.`,modelSetupLocalStorage:`Providers, model IDs, and API keys are stored locally by the QuickForge service on this machine.`,modelSetupAddModel:`Add model`,modelSetupUseLiteLlmExample:`Use LiteLLM example`,firstUseGuideTitle:`Start with a safe workflow`,firstUseGuideDescription:`Add a project, ask QuickForge to understand it, and use /plan before granting local tool access for code changes.`,firstUseGuideStepModel:`Confirm the model you want to use.`,firstUseGuideStepProject:`Add a local project so AI can use workspace context.`,firstUseGuideStepPlan:`Use /plan first; that turn cannot edit files or run commands.`,firstUseGuideConfigureModel:`Configure model`,firstUseGuideAddProject:`Add project`,firstUseGuideUsePrompt:`Try example prompt`,firstUseGuideCopyPrompt:`Copy /plan example`,firstUseGuideDismiss:`Got it`,firstUseGuideProjectPrompt:`/plan Read this project and explain its structure, run commands, and main risks. Do not modify files yet.`,firstUseGuideGeneralPrompt:`/plan Break this request into implementation steps and risks first. Do not modify files yet.`,defaultOptions:`General`,defaultOptionsDescription:`Configure language, default model, thinking level, tool display, and context management for new chats and scheduled tasks.`,memory:`Memory`,memoryDescription:`Let QuickForge remember useful preferences and habits across chats and projects.`,globalMemory:`Global memory`,globalMemoryDescription:`When enabled, QuickForge uses existing memory and can proactively remember durable preferences, habits, background, workflows, and goals that may help in future conversations.`,globalMemoryInfo:`Memory is stored locally and shared by all chats and projects. QuickForge avoids temporary task details, uncertain inferences, and sensitive credentials. Turn memory off to stop future reads and writes while keeping the existing file.`,memoryFile:`Memory file`,memoryFileDescription:`Saved as a readable Markdown file in the local QuickForge data directory.`,memoryCurrentSessionNote:`Changes are loaded by running chats before their next message. Turning memory off stops future reads and writes while keeping the existing file.`,memoryEnabledSaved:`Global memory enabled.`,memoryDisabledSaved:`Global memory disabled. Existing memory was kept.`,memoryContent:`Memory content`,memoryContentDescription:`View or edit the complete free-form Markdown document. Content and formatting are saved exactly as written.`,memoryContentDisabledDescription:`Turn global memory on to edit and save this file. Existing content remains available after reloading.`,memoryReload:`Reload`,memorySave:`Save memory`,memoryReloaded:`Memory reloaded.`,memoryContentSaved:`Global memory saved.`,memoryContentEmpty:`Global user memory is empty.`,defaultModel:`Default model`,defaultModelDescription:`Used by new chats and scheduled tasks unless overridden.`,defaultThinkingLevel:`Default thinking level`,defaultThinkingLevelDescription:`Choose the default reasoning effort for supported models.`,toolDisplay:`Tool display`,toolDisplayModeDescription:`Compact shows summaries with details collapsed. Detailed shows full parameters and details with tool calls expanded.`,toolDisplayCompact:`Compact`,toolDisplayDetailed:`Detailed`,showContextUsage:`Show context usage`,showContextUsageDescription:`Show the context usage ring and details next to the model selector.`,fontSize:`Font size`,fontSizeDescription:`Adjust interface and conversation text size.`,fontSizeRangeDescription:`Drag to preview immediately; release to save.`,appearance:`Appearance`,appearanceDescription:`Customize the interface theme and font size.`,theme:`Theme`,themeDescription:`Switch between light and dark. Changes apply instantly.`,lightTheme:`Light`,darkTheme:`Dark`,appearanceSaved:`Appearance saved`,interfaceFontSize:`Interface font size`,messageFontSize:`Conversation font size`,messageFontSizeNote:`Applies to the main text in chat messages.`,fontSizeSaved:`Font size saved`,toolDetailsHidden:`Tool details are hidden in compact mode. Switch Tool display to Detailed in Settings to view full parameters.`,toolArgsSummary:`Arguments summary`,saveDefaultOptions:`Save defaults`,saving:`Saving...`,defaultOptionsSaved:`Default options saved`,networkConnection:`Network connection`,networkProxyMode:`Proxy mode`,networkProxyDirect:`Direct`,networkProxySystem:`Follow system`,networkProxyManual:`Manual proxy`,networkProxyPac:`PAC URL`,networkProxyDescription:`Controls supported external HTTP requests made by QuickForge. Localhost always connects directly. Follow system reads the operating-system proxy configuration, including PAC/WPAD when supported. Custom PAC URLs are supported by Desktop only.`,networkProxyAddress:`Proxy address`,networkProxyAddressDescription:`Enter an HTTP or HTTPS proxy URL with a port. Paths, query strings, fragments, and proxy credentials are not supported.`,networkProxyAddressRequired:`Enter a proxy address before saving.`,networkProxyAddressInvalid:`Enter a valid HTTP or HTTPS proxy address.`,networkProxyAddressProtocolError:`Only HTTP and HTTPS proxy addresses are supported.`,networkProxyAddressPortError:`The proxy address must include a host and port.`,networkProxyAddressCredentialsError:`Proxy credentials are not supported in the address.`,networkProxyAddressPathError:`The proxy address cannot contain a path, query string, or fragment.`,networkProxyPacUrl:`PAC URL`,networkProxyPacUrlDescription:`Enter an HTTP or HTTPS URL for a PAC script. Paths and query strings are supported; credentials and fragments are not.`,networkProxyPacUrlRequired:`Enter a PAC URL before saving.`,networkProxyPacUrlInvalid:`Enter a valid HTTP or HTTPS PAC URL.`,networkProxyPacUrlProtocolError:`Only HTTP and HTTPS PAC URLs are supported.`,networkProxyPacUrlHostError:`The PAC URL must include a host.`,networkProxyPacUrlCredentialsError:`Credentials are not supported in the PAC URL.`,networkProxyPacUrlFragmentError:`The PAC URL cannot contain a fragment.`,networkProxyPacUnsupported:`Custom PAC URLs are supported only by the Desktop runtime.`,networkProxySave:`Save proxy`,networkProxyRefresh:`Reload system proxy`,networkProxyRefreshDescription:`Reload the current operating-system proxy configuration and close existing network connections.`,networkProxyStatus:`Source: {source}; runtime: {runtime}.`,networkProxyUnsupported:`The operating-system proxy is not supported by this runtime.`,networkProxyLoadFailed:`Unable to load the current proxy configuration. Proxy controls are disabled.`,networkProxySaved:`Network proxy setting saved`,networkProxyRefreshed:`System proxy reloaded`,contextManagement:`Context Management`,contextUsageTitle:`Context usage`,contextUsageAriaLabel:`Context usage: {percent}%. Show details`,contextUsageTotal:`{used} / {limit} tokens`,contextUsageInputLabel:`Input / context`,contextUsageReservedOutputLabel:`Reserved output`,contextUsageSystemPromptLabel:`System prompt`,contextUsageToolsSchemaLabel:`Tools schema`,contextUsageMessagesLabel:`Messages`,contextUsageSourceServerShort:`Server calculated`,contextUsageSourceLocalShort:`Local estimate`,contextUsageScopeCompactedShort:`Compacted model context`,contextUsageScopeFullShort:`Full model context`,contextUsageUsed:`Context used: {percent}% ({used} / {limit} tokens)`,contextUsageInput:`Input/context: {tokens} ({source})`,contextUsageSourceProvider:`provider context`,contextUsageSourceMixed:`provider/local mixed context`,contextUsageSourceEstimated:`estimated context`,contextUsageLocalEstimate:`Local estimate: {tokens}`,contextUsageSystemPrompt:` System prompt: {tokens}`,contextUsageToolsSchema:` Tools schema: {tokens}`,contextUsageMessages:` Messages: {tokens}`,contextUsageProviderBaseline:` Provider usage baseline: {tokens}`,contextUsageTrailingMessages:` Trailing messages after usage: {tokens}`,contextUsageReservedOutput:`Reserved output: {tokens}`,contextUsageServerCalculated:`Source: server calculated via pi-agent-core/pi-ai`,contextUsageScopeCompacted:`Scope: compacted model context, not full visible chat history`,contextUsageScopeFull:`Scope: full model context`,contextUsageEffectiveMessages:`Messages: {effective} effective / {visible} visible`,contextUsageProviderTokens:`Provider context tokens: {tokens}`,autoCompactEnabled:`Automatically compact context`,autoCompactRequireConfirmation:`Ask before compacting automatically`,autoCompactRequireConfirmationDescription:`Ask for approval before QuickForge summarizes older history.`,autoCompactTriggerNote:`Checks run before each model request. Lower the threshold or reduce the model Context Window to test triggering.`,autoCompactThresholdPercent:`Compact when context reaches (%)`,autoCompactThresholdDescription:`Percentage of the model context window that triggers compaction.`,autoCompactKeepRecentTurns:`Keep recent user turns`,autoCompactKeepRecentTurnsDescription:`Recent turns stay in full detail after older context is summarized.`,autoCompactDescription:`When the estimated next request reaches the configured share of the model context window, QuickForge summarizes older history and continues the current task. This uses one extra model call.`,autoCompactHistoryPreserved:`The full chat history remains visible; only the context sent to the model is compacted.`,autoArchiveEnabled:`Automatically archive old conversations`,autoArchiveTriggerNote:`Conversations not updated for more than 30 days are moved to Archived conversations.`,autoArchiveDescription:`Archived conversations are not deleted. Turning this off only stops future automatic archiving; existing archived conversations can still be viewed and restored.`,autoArchiveSaved:`Automatic archive setting saved`,thinkingLevel:`Thinking level`,thinkingOff:`Off`,thinkingLow:`Low`,thinkingMedium:`Medium`,thinkingHigh:`High`,thinkingXHigh:`XHigh`,currentConfiguration:`Current configuration`,thinkingSupported:`Thinking`,thinkingNotSupported:`This model does not support thinking levels.`,thinkingRequiresReasoningModel:`Thinking levels require a reasoning / thinking model.`,customModels:`Custom Models`,customModelsTitle:`Custom models`,customModelsDescription:`Only use custom OpenAI-Compatible models that you configure.`,addModel:`Add model`,editModel:`Edit model`,delete:`Delete`,editCustomModel:`Edit custom model`,addCustomModel:`Add custom model`,providerName:`Provider name`,providerNamePlaceholder:`e.g., LiteLLM`,protocolType:`Protocol type`,protocolHelp:`Use OpenAI Compatible for LiteLLM, OpenRouter, and most /v1/chat/completions services. Use Anthropic Messages only for the direct Anthropic API.`,apiKey:`API Key`,apiKeyPlaceholder:`Leave empty if not required`,showApiKey:`Show API Key`,hideApiKey:`Hide API Key`,customHeaders:`Custom Headers JSON`,customHeadersPlaceholder:`{
3
- "X-Custom-Header": "value"
4
- }`,customHeadersHelp:`Optional provider-level HTTP headers. Must be a JSON object with string values. Headers are saved locally with this model configuration.`,invalidHeadersJson:`Custom headers must be a valid JSON object with string key-value pairs.`,modelId:`Model ID`,modelIdPlaceholder:`e.g., anthropic/claude-sonnet-4`,contextWindow:`Context Window`,maxTokens:`Max Tokens`,reasoningModel:`Reasoning / Thinking model (DeepSeek V4, Qwen, etc.)`,imageInputModel:`Image input / vision model`,imageInputModelHelp:`Enable only when the model documentation confirms image input support. When disabled, attached images are omitted before the request is sent so non-vision models do not fail.`,providerProtocol:`Protocol`,model:`Model`,reasoning:`Reasoning`,noModelAdded:`No model added`,modelsCount:`{count} model(s)`,modelIndex:`Model #{index}`,modelsList:`Models`,atLeastOneModel:`At least one model is required.`,duplicateModelId:`Duplicate model IDs are not allowed.`,cancel:`Cancel`,save:`Save`,yes:`Yes`,no:`No`,loading:`Loading...`,noCustomModels:`No custom models yet. Click "Add model".`,fillProviderBaseUrlModel:`Please fill in provider name and Base URL.`,saveCustomModelFailed:`Failed to save custom model.`,confirmDeleteProvider:`Delete {name}?`,deleteFailed:`Delete failed.`,selectCustomModel:`Select custom model`,close:`Close`,back:`Back`,more:`More`,searchModels:`Search models...`,searchSettings:`Search settings...`,noSettingsResults:`No matching settings found`,noMatchingCustomModels:`No matching custom models`,presets:`Quick templates`,presetOpenai:`OpenAI`,presetDeepseek:`DeepSeek`,presetGlm:`Zhipu GLM`,presetOllama:`Local Ollama`,presetLitellm:`LiteLLM Proxy`,presetCustom:`Custom`,providerAdvanced:`Advanced options`,expandModel:`Adjust context window, max tokens, reasoning, image input`,addHeader:`Add header`,headerName:`Header name`,headerValue:`Value`,removeHeader:`Remove header`,testConnection:`Test connection`,testingConnection:`Testing...`,connectionOk:`Connection OK`,connectionFailed:`Connection failed`,testRequiresFields:`Fill in Base URL and at least one model ID.`,readFile:`Read File`,manageGlobalMemory:`Manage Memory`,searchFiles:`Search Files`,writeFile:`Write File`,editFile:`Edit File`,runCommand:`Run Command`,presentFiles:`Present Files`,generateImage:`Generate Image`,generatingImage:`Generating image...`,generatedImageAlt:`Generated image {index}`,openGeneratedImage:`Open generated image`,downloadGeneratedImage:`Download generated image`,executeInTerminal:`Run in terminal`,confirmExecuteCommandTitle:`Run command in terminal?`,confirmExecuteMultipleCommands:`This will run multiple lines in your local terminal. Continue?`,confirmExecuteDangerousCommand:`This command may modify your system, publish packages, push code, or run a remote script. Continue?`,terminalCommandExecuteFailed:`Failed to run command in terminal.`,runSubagent:`Run subagent`,subagentGeneral:`General`,subagentExplore:`Explore`,subagentRunning:`{name} running`,subagentCompleted:`{name} completed`,subagentFailed:`{name} failed`,subagentTask:`Task`,subagentContext:`Context`,subagentExpectedOutput:`Expected output`,subagentResult:`Result`,subagentToolCalls:`Tool calls`,subagentToolApprovalWaiting:`{source} requests approval: {toolName}`,toolApprovalSourceSubagent:`Source: {source} subagent`,activateSkill:`Activate Skill`,readSkillResource:`Read Skill Resource`,yoloModeSyncFailed:`Failed to sync Agent access mode. The previous state has been restored.`,toolApprovalFailed:`Failed to submit tool approval. Please try again.`,toolApprovalSubmitting:`Submitting...`,terminateCommand:`Terminate`,terminateCommandTitle:`Terminate this running command`,commandTerminateRequested:`Terminating...`,running:`Running`,done:`Done`,error:`Error`,taskCompleted:`Task completed`,taskError:`Task error`,systemNotifications:`System notifications`,systemNotificationsDescription:`Show a browser or Android notification when a chat or scheduled task finishes while QuickForge is running in the background.`,systemNotificationsPermissionGranted:`Permission granted on this device. Foreground activity continues to use in-app messages only.`,systemNotificationsPermissionPrompt:`Permission has not been requested on this device.`,systemNotificationsPermissionDenied:`Permission was denied on this device.`,systemNotificationsUnsupported:`System notifications are not supported in this environment.`,systemNotificationsDeniedHelp:`Notification permission was denied. Allow it in the browser site settings or Android app settings, then try again.`,systemNotificationsEnabled:`System notifications enabled on this device.`,systemNotificationsDisabled:`System notifications disabled on this device.`,systemNotificationsTest:`Send test`,systemNotificationTestTitle:`QuickForge notification test`,systemNotificationTestFailed:`The test notification could not be displayed. Check the system permission and try again.`,systemNotificationOpenDetails:`Tap to open QuickForge for details.`,called:`Called`,input:`Input`,output:`Output`,details:`Details`,scheduledTasks:`Scheduled Tasks`,scheduledTasksDescription:`Tasks are saved in the local backend service and run by the cron expression parsed by AI.`,createTask:`Create task`,editTask:`Edit`,cancelEditTask:`Cancel edit`,saveTask:`Save task`,taskScheduleDescriptionLabel:`Schedule description`,taskScheduleDescriptionPlaceholder:`e.g., Every day at 9 AM, send this to AI: generate my daily sales report.`,quickAiParseTask:`AI parses this description into a cron expression. The system stores and runs by cron.`,taskTitleLabel:`Task name`,taskTitlePlaceholder:`e.g., Daily work summary`,promptContentLabel:`AI will send this content`,promptContentPlaceholder:`Write the exact content that should be sent to AI when this task runs.`,taskEnabledSwitch:`Enable this task`,taskInstructionPlaceholder:`e.g., Generate a daily sales report at 9 AM every day`,aiParseTask:`AI Parse`,confirmCreate:`Confirm create`,taskList:`Task list`,noScheduledTasks:`No scheduled tasks yet. Enter a natural language instruction above to create one.`,taskEnabled:`Enabled`,taskRunning:`Running`,taskPaused:`Paused`,taskFinished:`Completed`,taskFailed:`Failed`,executeNow:`Run now`,enable:`Enable`,pauseTask:`Pause`,deleteTask:`Delete`,recentExecutions:`Recent executions`,executionSuccess:`Success`,executionRunning:`Running`,nextExecution:`Next`,lastExecution:`Last`,noModelAvailable:`No models available`,noProjectBound:`No project`,aiParsed:`AI parsed, please confirm`,taskName:`Task name`,executionRule:`Execution rule`,nextExecutionTime:`Next execution`,taskProject:`Project`,taskThinkingLevel:`Thinking`,aiInstruction:`AI instruction`,taskModel:`Model`,taskThinking:`Thinking`,taskProjectLabel:`Project`,taskExecutionMode:`Execution mode`,taskExecutionModeSerial:`Serial`,taskExecutionModeParallel:`Parallel`,taskExecutionModeHelp:`This only controls whether the same task may overlap. Different scheduled tasks still run in parallel.`,tasksCount:`{total} tasks, {enabled} enabled`,confirmDeleteTask:`Are you sure you want to delete this scheduled task? This cannot be undone.`,waitingForResult:`Waiting for result`,autoRun:`Auto`,manualRun:`Manual test`,runInputContent:`Sent to AI`,runAiResult:`AI result`,runDuration:`Duration: `,taskListTab:`Task list`,executionHistoryTab:`Execution history`,agentsTab:`Agents`,agentsDescription:`Create reusable Agent Profiles for scheduled tasks and run_subagent delegation.`,createAgent:`Create agent`,editAgent:`Edit agent`,builtinAgent:`Built-in`,builtinAgentReadonly:`Built-in agents are read-only in this version.`,builtinAgentModelSettings:`Model settings`,builtinAgentModelOnly:`This built-in Agent is system-managed. Only its model can be changed.`,readonlyAgentDescription:`This Agent is loaded from a read-only source and cannot be edited here.`,enabledAsSubagent:`Enabled as subagent`,enableAsSubagent:`Enable as subagent`,disableAsSubagent:`Disable as subagent`,noDescription:`No description.`,maxRuntimeMs:`Max runtime: `,maxToolCalls:`Max tool calls: `,defaultAgent:`Default Agent`,executionAgent:`Execution Agent: `,agentName:`Agent name`,agentLabel:`Display name`,agentLabelPlaceholder:`e.g., Code Review Agent`,agentDescription:`Description`,agentSystemPrompt:`System prompt`,agentModelMode:`Model mode`,agentModelInherit:`Inherit parent model`,agentModelFixed:`Use fixed model`,agentFixedModel:`Fixed model`,agentThinkingLevel:`Thinking level`,agentThinkingInherit:`Inherit caller setting`,agentThinkingDescription:`When the runtime model does not support reasoning, this automatically falls back to Off.`,agentThinkingUnsupported:`The selected fixed model does not support reasoning, so thinking is Off.`,allowedTools:`Allowed tools`,agentSourcePath:`Source path`,highRiskTool:`High risk`,confirmDeleteAgent:`Are you sure you want to delete this custom agent? Scheduled tasks using it will fall back to the default agent.`,aiFillAgent:`AI fill`,aiFillAgentDescription:`Describe the agent you want. AI will only fill agent name, display name, description, and system prompt.`,aiFillAgentPlaceholder:`e.g., Create a read-only code review agent focused on architecture, bugs, and test coverage.`,aiFillAgentLoading:`Generating...`,aiFillAgentNoModel:`Please configure a default model first.`,aiFillAgentFailed:`AI fill failed. Please check model configuration and API key, then try again.`,aiFillAgentInputRequired:`Please describe the agent you want to create.`,taskContent:`Task content`,viewDetails:`View details`,moreActions:`More actions`,historyFilters:`Filters`,allTasks:`All tasks`,allStatuses:`All statuses`,allTriggers:`All triggers`,triggerType:`Trigger`,keyword:`Keyword`,keywordPlaceholder:`Search input, result, or error`,startTime:`Start time`,endTime:`End time`,query:`Search`,reset:`Reset`,previousPage:`Previous`,nextPage:`Next`,pageSize:`{size} / page`,paginationSummary:`Page {page} / {pages}, {total} total`,noExecutionHistory:`No execution history yet.`,viewConversation:`View conversation`,createdAt:`Created at`,status:`Status`,search:`Search`,searchDialog:`Search conversations...`,noSearchResults:`No matching conversations found`,searchHint:`Enter keywords to search loaded conversations`,scheduledTasksLabel:`Scheduled Tasks`,skills:`Skills`,mcp:`MCP`,mcpServers:`MCP Servers`,plugins:`Plugins`,pluginMentionHeader:`Plugins`,composerAddMenu:`Add`,composerAddAttachment:`Attachment`,composerAddPlugins:`Plugins`,composerAddBack:`Back`,pluginOpenaiDocumentsName:`Documents`,pluginOpenaiDocumentsDescription:`Create and edit document artifacts`,pluginOpenaiSpreadsheetsName:`Spreadsheets`,pluginOpenaiSpreadsheetsDescription:`Create, analyze, and structure spreadsheet files`,pluginOpenaiPresentationsName:`Presentations`,pluginOpenaiPresentationsDescription:`Create and edit presentations`,pluginsDescription:`Manage local QuickForge plugins. This first version supports manifest-based plugins that contribute Agent tools.`,pluginsReload:`Reload plugins`,loadingPlugins:`Loading plugins...`,noPlugins:`No plugins found`,noPluginsDescription:`Place a plugin folder with plugin.json under one of these search paths, then reload.`,pluginsCount:`{total} plugins, {enabled} enabled`,pluginToolsCount:`{count} tools`,pluginPermissionsCount:`{count} permissions`,pluginDetails:`Plugin details`,pluginVersion:`Version`,pluginStatusLoaded:`Loaded`,pluginStatusDisabled:`Disabled`,pluginStatusError:`Error`,pluginTools:`Tools`,pluginPermissions:`Declared permissions`,pluginNoTools:`No tools declared.`,pluginNoPermissions:`No permissions declared.`,pluginTrustedNotice:`Plugins are local trusted Node.js code in this MVP; permissions are displayed for review and future enforcement.`,pluginDiscoveryErrors:`Plugin discovery errors`,enablePlugin:`Enable`,disablePlugin:`Disable`,pluginsLoadFailed:`Failed to load plugins.`,pluginsSaveFailed:`Failed to update plugin.`,manageMcpServers:`Manage MCP servers`,mcpNoServersDescription:`No MCP servers configured yet. Click "Add server" or paste an mcpServers JSON on the right.`,mcpConfiguredServers:`Configured servers`,mcpAddServer:`Add server`,mcpEditServer:`Edit server`,mcpServerName:`Server name`,mcpCommand:`Command`,mcpTransport:`Transport`,mcpUrl:`URL`,mcpArgs:`Arguments, one per line`,mcpCwd:`Working directory`,mcpEnv:`Environment variables, KEY=value per line`,mcpToolsCount:`{count} tools`,mcpLoadFailed:`Failed to load MCP servers.`,mcpSaveFailed:`Failed to save MCP server.`,mcpDeleteFailed:`Failed to delete MCP server.`,mcpReconnectFailed:`Failed to reconnect MCP server.`,mcpDeleteConfirm:`Delete MCP server "{name}"?`,mcpImportConfig:`Import MCP JSON`,mcpImportConfigDescription:"Paste an MCP JSON configuration in mcpServers format. QuickForge supports stdio, HTTP, and SSE transports. For remote servers, headers are accepted and resolved from backend environment variables when using ${...}.",mcpUseExample:`Use example`,mcpImportUpdate:`Import / update`,mcpReplaceAll:`Replace all`,mcpReplaceConfirm:`This will remove MCP servers that are not included in the JSON. Continue?`,mcpInvalidJson:`MCP configuration must be valid JSON.`,mcpInvalidConfigJson:`MCP configuration must contain a mcpServers object.`,mcpEmptyConfigJson:`mcpServers cannot be empty.`,mcpInvalidServerName:`Invalid MCP server name: {name}. Use lowercase letters, numbers, and hyphens only.`,mcpInvalidServerConfig:`MCP server "{name}" must be an object.`,mcpInvalidTransport:`MCP server "{name}" transport must be stdio, http, or sse.`,mcpMissingCommand:`MCP server "{name}" requires command for stdio transport.`,mcpMissingUrl:`MCP server "{name}" requires url for HTTP/SSE transport.`,mcpArgsMustBeArray:`MCP server "{name}" args must be an array.`,mcpEnvMustBeObject:`MCP server "{name}" env must be an object.`,mcpHeadersMustBeObject:`MCP server "{name}" headers must be an object.`,mcpHeaders:`Headers, KEY=value per line`,mcpReconnectServer:`Reconnect`,mcpMoreTools:`+{count}`,mcpNamePlaceholder:`e.g. my-server`,mcpUrlPlaceholder:`https://example.com/mcp`,mcpCommandPlaceholder:`e.g. npx`,mcpTabServer:`Server`,mcpTabJson:`JSON`,optional:`Optional`,globalSkills:`Global Skills`,projectSkills:`Project Skills`,help:`Help`,projectCommands:`Project Commands`,projectCommandsDescription:`Configure extra Markdown slash-command directories for the current project. QuickForge also reads user-level commands from ~/.quickforge/commands/ (shared across all projects), then project directories .claude/commands, .opencode/commands, .ai/commands, and these configured directories in order. Later duplicate command names override earlier ones.`,projectCommandsProjectDescription:`Choose the project whose command directories should be configured.`,selectProjectForCommands:`Please select or add a project before configuring project commands.`,commandDirectory:`Command directory`,commandDirectories:`Command directories`,commandDirectoriesDescription:`Add one directory per line. Relative paths are resolved from the selected project root.`,commandDirectoryPlaceholder:`.claude/commands
5
- .opencode/commands
6
- D:\\shared\\ai-commands`,commandDirectoryHelp:`One directory per line. Supports relative paths and absolute paths. Relative paths are resolved from the current project root. Leave empty to use the built-in compatible command directories only.`,commandDirectoryExamples:`Examples`,commandDirectoryExamplesDescription:`Common compatible directories are still discovered automatically.`,projectCommandsSaved:`Project command settings saved.`,loadedCommands:`Loaded commands ({count})`,loadedCommandsDescription:`Commands discovered from user-level, compatible, and configured directories for this project.`,noCommandsLoaded:`No commands loaded yet. Add a directory above or create a command to get started.`,openCommandDir:`Open command directory`,createCommand:`New command`,projectCommandsActions:`Actions`,projectCommandsActionsDescription:`Save configured directories before reloading discovered commands.`,newCommandPrompt:`Enter a command name (lowercase letters, numbers, hyphens):`,commandCreated:`Command created: {name}`,commandAlreadyExists:`Command already exists: {name}`,invalidCommandName:`Invalid command name. Use lowercase letters, numbers, and hyphens.`,manageSkills:`Manage skills`,manageGlobalSkills:`Manage global skills`,manageProjectSkills:`Manage project skills`,openFolder:`Open folder`,fileManager:`File Manager`,openWorkspace:`Open workspace`,chooseWorkspaceOpenTarget:`Choose workspace open target`,openInExplorer:`Open in Explorer`,openInExplorerFailed:`Failed to open the project folder.`,openInVSCode:`Open in VS Code`,openInVSCodeFailed:`Failed to open the project in VS Code. Make sure the VS Code command-line tool is installed.`,openInIDEA:`Open in IntelliJ IDEA`,openInIDEAFailed:`Failed to open the project in IntelliJ IDEA. Make sure IntelliJ IDEA is installed or the idea command-line tool is available.`,moreOptions:`More options`,gitBranchMenu:`Git branch menu`,searchBranches:`Search branches`,uncommittedChanges:`Uncommitted changes:`,filesCount:`{count} file(s)`,noBranchesFound:`No branches found`,currentBranch:`Current`,createBranchTitle:`Create and checkout new branch`,createBranchDescription:`Enter a new branch name. QuickForge will create it from the current HEAD and check it out.`,createBranchPlaceholder:`feature/my-branch`,createAndCheckoutBranch:`Create and checkout`,createAndCheckoutBranchEllipsis:`Create and checkout new branch...`,gitGraph:`Git Graph`,gitBranchesFailed:`Failed to load branches.`,gitCheckoutFailed:`Failed to switch branch.`,gitBranchSwitched:`Branch switched`,gitBranchCreated:`Branch created`,gitToolsTitle:`Git Tools`,togglePinnedSummary:`Toggle pinned summary`,environmentInfo:`Environment info`,gitToolsCollapse:`Collapse Git tools`,gitToolsChanges:`Changes`,gitToolsCommitOrPush:`Commit or push`,gitCommitMessagePlaceholder:`Commit message`,gitGenerateCommitMessage:`Generate commit message`,gitGenerateCommitMessageFailed:`Failed to generate commit message.`,gitIncludeUnstagedChanges:`Include all unstaged changes`,gitIncludeUnstagedWarning:`All modified, untracked, and deleted files will be added to this commit.`,gitCommitFilesSummary:`{selected} of {total} files`,gitFileNotIncluded:`Not included`,gitCommitMessageRequired:`Enter or generate a commit message first.`,gitNoStagedChanges:`There are no staged changes to commit.`,gitDetachedHeadBlocked:`Switch to a branch before committing or pushing.`,gitCommitSucceededPushFailed:`Commit succeeded, but push failed.`,gitRetryPush:`Retry push`,gitRefreshingStatus:`Refreshing Git status…`,gitStatusRefreshFailed:`Failed to refresh Git status.`,gitCommitOnly:`Commit`,gitCommitAndPush:`Commit and push`,gitPushOnly:`Push`,gitCommitNoProject:`No project is selected.`,gitCommitNoModel:`Please configure a default model first.`,gitCommitConflictsBlocked:`Resolve conflicts before committing.`,gitOperationFailed:`Git operation failed.`,gitOperationCompleted:`Git operation completed`,gitGraphFailed:`Failed to load Git graph.`,noGitCommits:`No commits found.`,refresh:`Refresh`,graphColumn:`Graph`,description:`Description`,date:`Date`,author:`Author`,commit:`Commit`,pinSession:`Pin conversation`,unpinSession:`Unpin conversation`,shareSession:`Share conversation`,selectProjectForSkills:`Please select or add a project before managing skills.`,skillsDescription:`Select reusable Agent Skills enabled for project "{project}". QuickForge discloses only name/description in the prompt; full SKILL.md instructions are loaded on demand with activate_skill.`,globalSkillsDescription:`Select reusable Agent Skills enabled globally for QuickForge. New chats receive only the skill catalog; full SKILL.md instructions load on demand with activate_skill.`,projectSkillsDescription:`Select project Agent Skills for "{project}". Project skills override global skills with the same name; new project chats receive only the catalog and load full instructions on demand.`,searchSkills:`Search skills...`,availableSkills:`Available skills`,selectedSkillsCount:`{count} selected`,noMatchingSkills:`No matching skills found`,skillSearchPaths:`Search paths`,failedToLoadSkills:`Failed to load skills.`,failedToSaveSkills:`Failed to save skills.`,readSkill:`Read skill`,readSkillContent:`Read skill content`,backToSkillList:`Back to skill list`,failedToReadSkill:`Failed to read skill content.`,noSkillContent:`This skill has no readable content.`,requestFailed:`Request failed`,backupRestore:`Backup & Restore`,backupRestoreDescription:`Export or restore QuickForge settings, providers, and scheduled tasks. Local project lists and conversation history are not included. Imports create a safety backup before writing data.`,exportData:`Export data`,exportDataDescription:`Choose the settings data to include in a portable JSON backup.`,selectExportSections:`Select data to export`,selectExportSectionsDescription:`All settings data is selected by default. Turn off anything you do not want in this backup.`,conversationBackupExcluded:`Conversation history and local project lists are not part of settings backup and will not be exported here.`,selectAtLeastOneExportSection:`Select at least one data section to export.`,includeApiKeys:`Include API keys`,includeApiKeysDescription:`Saved provider API keys.`,backupExportSecretsConfirm:`This backup will contain API keys. Continue?`,exportBackup:`Export backup`,exportBackupDescription:`Download the selected data as a timestamped JSON file.`,backupExported:`Backup exported.`,backupExportFailed:`Backup export failed.`,importData:`Import data`,importDataDescription:`Restore core settings from a previously exported JSON backup. Conversation history in older full backups is ignored by this settings import flow.`,importBackup:`Import backup`,backupInspectTitle:`Backup preview`,backupInspectDescription:`Review metadata and choose what to restore before writing local data.`,backupInspectExportedAt:`Exported at`,backupInspectVersion:`Version`,backupInspectScope:`Scope`,backupInspectSecrets:`Contains API keys`,backupInspectSections:`Sections`,backupInspectFailed:`Backup inspection failed.`,backupInvalidSections:`The following invalid sections were skipped:`,backupInspected:`Backup inspected. Choose what to restore below.`,backupInspectedWithIgnoredConversations:`Backup inspected. Conversation history in this older backup was ignored; choose the settings data to restore below.`,selectRestoreSections:`Select data to restore`,restoreMode:`Restore mode`,restoreModeDescription:`Choose how imported data should be applied to local data.`,restoreModeReplace:`Replace`,restoreModeReplaceDescription:`Replace local data in the selected sections entirely with the backup. Existing local data will be overwritten.`,restoreModeMerge:`Merge`,restoreModeMergeDescription:`Merge backup data into local. On conflict the backup wins; local-only entries are preserved.`,backupImportActions:`Import actions`,backupImportActionsDescription:`Import the selected sections or cancel this backup preview.`,confirmImportSelected:`Import selected data`,selectAtLeastOneRestoreSection:`Select at least one data section to restore.`,restoreSettings:`Settings`,restoreSettingsDescription:`App preferences such as language and default options.`,restoreMcp:`MCP servers`,restoreMcpDescription:`Global MCP server definitions and their enable/disable state.`,restoreProviderKeys:`API keys`,restoreProviderKeysDescription:`Saved provider API keys.`,restoreCustomProviders:`Custom providers and models`,restoreCustomProvidersDescription:`Custom model providers, endpoints, model IDs, and related configuration.`,restoreScheduledTasks:`Scheduled tasks`,restoreScheduledTasksDescription:`Saved scheduled AI tasks.`,restoreConversations:`Conversations`,restoreConversationsDescription:`Conversation history and metadata. This is restored as one consistent unit.`,backupImportConfirm:`A safety backup will be created before importing. Continue?`,backupImportReplaceConfirm:`Replace local data in the selected sections with this backup? A safety backup will be created first.`,backupImportMergeConfirm:`Merge the selected backup data into local data? A safety backup will be created first.`,backupImported:`Backup imported. The app will reload.`,backupImportFailed:`Backup import failed.`,backupFileTooLarge:`This backup file is larger than {size}MB. Current settings import is intended for core settings; export a core settings backup or reduce conversation history before importing.`,backupStringTooLarge:`This backup is too large to process in the current browser-based import flow. Use a core settings backup, or reduce/exclude conversation history.`,backupSafetyBackupPath:`Safety backup saved at`,about:`About`,desktopUpdate:`Desktop releases`,desktopExit:`Exit`,aboutQuickForge:`About QuickForge`,aboutQuickForgeDescription:`View version and project links.`,projectInfo:`Project information`,packageName:`Package`,packageNameDescription:`The installed QuickForge package name.`,currentVersion:`Current version`,currentVersionDescription:`The version currently running on this machine.`,latestVersion:`Latest version`,latestVersionDescription:`The newest version returned by the update check.`,github:`GitHub`,githubDescription:`Open the project repository and release notes.`,checkUpdate:`Check for updates`,checkingUpdate:`Checking...`,checkUpdateDescription:`Check npm for the latest QuickForge Runtime release. This does not update the Electron Desktop shell.`,desktopUpdates:`Desktop updates`,desktopUpdatesDescription:`Download the latest desktop app.`,desktopUpdateFrequencyDescription:`Desktop updates open the download page.`,desktopUpdateHint:`Opened the download page.`,openDesktopReleases:`Download latest version`,runtimeUpdates:`Updates`,runtimeUpdatesDescription:`Check for a newer version.`,updateChannel:`Channel`,runtimeUpdateChannel:`Runtime (npm)`,checkRuntimeUpdate:`Check for updates`,updateAvailableMessage:`A new version is available: {current} → {latest}.`,localVersionNewerMessage:`You are using a newer local version: {current}.`,alreadyLatestVersion:`QuickForge is up to date ({version}).`,updateNow:`Update now`,updateRuntimeNow:`Update now`,updatingQuickForge:`Updating...`,updateStarted:`Update started. QuickForge will restart automatically.`,updateRestarted:`Update completed. Reloading...`,updateRestartTimeout:`Update is taking longer than expected. Please try again later.`,updateCompleted:`Update completed. Please restart QuickForge.`,updateFailed:`Update failed.`,updateCheckFailed:`Failed to check for updates.`,updateCommand:`Command`,updateLog:`Update log`,updateLogDescription:`Log file for the current update attempt.`,updateLogFile:`Log: {path}`,updateConfirm:`QuickForge will update and restart. Running tasks will be interrupted. Continue?`,updateFrequencySection:`Auto-check updates`,updateFrequencyDescription:`Show a reminder when a new version is available.`,frequencyStartup:`On every startup`,frequencyDaily:`Once a day`,frequencyWeekly:`Once a week`,frequencyOff:`Off`,lastCheckedAt:`Last checked: {time}`,lastCheckedNever:`Not checked yet`,newVersionAvailable:`New version {version} available`,newVersionAvailableSub:`Current {current} · click to view`,updateLater:`Later`,backendService:`Backend Service`,backendServiceDescription:`Restart the local QuickForge backend service. Running generations will be interrupted and the page will reconnect automatically.`,backendServiceStatus:`Service status`,restartBackendService:`Restart backend service`,restartBackendServiceDescription:`Use this when the local backend is stuck or after changing environment-level service settings.`,restartBackendConfirm:`Restart the backend service now? Running generations will be interrupted and the page will reconnect automatically.`,backendRestarting:`Backend is restarting...`,backendRestarted:`Backend restarted. Reloading...`,backendRestartFailed:`Backend restart failed.`,backendRestartTimeout:`Backend restart timed out. Please restart QuickForge manually.`,backendRestartUnsupported:`This launch mode does not support restarting from the UI. Please restart QuickForge manually.`,serviceMode:`Mode`,serviceModeDescription:`How the local QuickForge service is running.`,servicePid:`PID`,servicePidDescription:`Operating system process ID of the backend service.`,serviceStartedAt:`Started at`,serviceStartedAtDescription:`When this backend process was started.`,serviceDataDir:`Data directory`,serviceDataDirDescription:`Local directory used for settings, storage, logs, and cache.`,serviceWorkspace:`Workspace`,serviceWorkspaceDescription:`Workspace root used by the current service process.`,terminalShell:`Terminal shell`,terminalShellDescription:`QuickForge auto-detects common macOS, Windows, and Linux shells. Choose the default from the list, or use a custom command/path when it is missing. QUICKFORGE_TERMINAL_SHELL still takes priority.`,terminalShellAutoDetectedHint:`Detected entries are shown automatically for this computer.`,terminalShellDefault:`Default shell`,terminalShellCustomOption:`Custom command or path…`,terminalShellSaved:`Terminal shell setting saved. New terminal sessions will use it.`,terminalShellProfilesSaved:`Terminal shell profiles saved.`,terminalShellCommand:`Custom shell command or path`,terminalShellCustomDescription:`Add a shell only when it was not detected automatically.`,terminalShellCommandPlaceholder:`C:\\Program Files\\Git\\bin\\bash.exe`,terminalShellAdd:`Add`,terminalShellSetDefault:`Set as default`,terminalShellDefaultBadge:`Default`,terminalShellDetected:`Detected`,terminalShellNoDetected:`No shell was detected. Add a custom shell command or path below.`,terminalShellProfileRequired:`Enter a shell command or executable path before saving.`,terminalShellDeleteConfirm:`Delete terminal shell profile "{name}"?`,channels:`Channels`,channelsDescription:`Manage local communication channels that bridge external apps to QuickForge agents.`,channelsSecurityWarning:`Channel actions run local processes and are available only on this computer.`,channelsEmpty:`No channels are available yet.`,start:`Start`,stop:`Stop`,restart:`Restart`,channelWorkspace:`Launch workspace`,channelWorkspaceDescription:`Choose the workspace used when this channel starts. Use the default workspace for global, non-project chats.`,channelDefaultWorkspace:`Default workspace`,channelNoWorkspaces:`No workspace is available. Configure the default workspace before starting this channel.`,channelOpenLogs:`Open log folder`,channelOpeningLogs:`Opening log folder...`,channelOpenLogsFailed:`Failed to open the channel log folder.`,channelQrTitle:`Scan with WeChat`,channelQrDescription:`Use WeChat to scan the QR code shown below.`,channelStatusStopped:`Stopped`,channelStatusStarting:`Starting`,channelStatusWaitingScan:`Waiting for scan`,channelStatusRunning:`Running`,channelStatusStopping:`Stopping`,channelStatusError:`Error`,channelRestartConfirm:`Restart channel "{name}"?`,channelLogoutConfirm:`Log out channel "{name}"? You will need to scan again before using it.`,channelReloginConfirm:`Re-login channel "{name}"? The current process will stop and a new QR code will be generated.`,terminalNew:`New terminal`,rightPanelOpenTabsTitle:`Open tabs`,rightPanelOpenTabsDescription:`Choose a tab to open in the right panel.`,rightPanelAddTab:`Open tab`,rightPanelCloseOtherTabs:`Close other tabs`,rightPanelCloseAllTabs:`Close all tabs`,rightPanelFiles:`Files`,rightPanelReview:`Review`,rightPanelTerminal:`Terminal`,rightPanelBrowser:`Browser`,rightPanelFilesDesc:`Browse project files`,rightPanelReviewDesc:`Review Git changes`,rightPanelTerminalDesc:`Run terminal commands`,rightPanelBrowserDesc:`Preview web pages`,terminalNewWith:`New terminal with`,terminalNewWithProfile:`New terminal: {name}`,terminalSelectShell:`Choose shell for new terminal`,terminalCollapse:`Collapse terminal`,terminalFullscreen:`Fullscreen terminal`,terminalExitFullscreen:`Exit fullscreen`,terminalStarting:`Starting terminal...`,terminalUnavailable:`Terminal unavailable`,terminalNoSessions:`No terminal sessions`,terminalCreateFailed:`Failed to create terminal`,terminalCloseFailed:`Failed to close terminal`,terminalConnectionFailed:`Failed to connect to terminal.`,terminalConnectionTimedOut:`Terminal connection timed out.`,terminalConnectionClosedUnexpectedly:`Terminal connection closed unexpectedly.`,terminalSessionUnavailable:`The original terminal session has ended, possibly because the service restarted or the session expired. The process cannot be restored.`,terminalStartNew:`Start new terminal`,terminalConnecting:`Connecting to terminal...`,terminalReconnecting:`Reconnecting to terminal ({attempt}/{max})...`,terminalCloseSession:`Close {name}`,workspaceNoFilesToDisplay:`No files to display.`,workspaceNoWorkingTreeChanges:`No working tree changes.`,workspaceNoStagedChanges:`No staged changes.`,workspaceNoLastRunChanges:`No changed files matched the last run artifacts.`,workspaceRootPath:`Project root`,workspaceLoadingDiff:`Loading diff...`,workspaceNoDiffPreview:`No diff preview available.`,workspaceDiffTooLarge:`This diff is too large to preview inline.`,workspaceUnmodifiedLines:`{count} unmodified lines`,noProjectSelected:`No project selected`,workspacePanel:`Workspace`,workspaceExpandRightPanel:`Expand right panel`,workspaceCollapseRightPanel:`Collapse right panel`,workspaceOverview:`Overview`,workspaceFiles:`Workspace Files`,workspaceBrowser:`Browser`,workspaceChanges:`Changes`,workspaceCurrentArtifacts:`Review`,workspaceNoArtifacts:`No AI-produced files detected in this session yet.`,workspacePresentedArtifact:`Presented artifact`,workspaceInferredArtifact:`Inferred artifact`,workspaceCommands:`Commands`,workspaceCommandOutput:`Output`,workspaceCurrentBranch:`Current branch`,workspaceChangeCount:`changes`,workspaceNotGitRepository:`This project is not a Git repository.`,workspaceSelectProject:`Select a project to inspect its workspace.`,workspaceLoading:`Loading workspace...`,workspaceLoadFailed:`Failed to load workspace.`,workspaceFilterFiles:`Filter files by name or path`,workspaceOpenFileTitle:`Open a file`,workspaceOpenFileDescription:`Open a file from the workspace directory.`,workspaceOpenFileFailed:`Failed to open file.`,workspaceOpenDiffFailed:`Failed to open diff.`,workspaceViewDiff:`View diff`,refreshWorkspace:`Refresh workspace`,closeWorkspace:`Close workspace`,workspaceFullscreen:`Fullscreen workspace`,workspaceExitFullscreen:`Exit fullscreen`,workspaceStaged:`Staged`,workspaceUntracked:`Untracked`,workspaceConflicts:`Conflicts`,workspaceStagedChanges:`Staged Changes`,workspaceReview:`Review`,workspaceReviewFilter:`Review filter`,workspaceReviewFilterUnstaged:`Unstaged changes`,workspaceReviewFilterStaged:`Staged changes`,workspaceReviewFilterAllBranches:`All branch changes`,workspaceReviewFilterLastRun:`Last run changes`,workspaceRestoreFile:`Restore file`,workspaceStageFile:`Stage file`,workspaceUnstageFile:`Move back to unstaged`,workspaceOpenFileInNewTab:`Open file in new tab`,workspaceCannotOpenDeletedFile:`Deleted files cannot be opened directly.`,workspaceRestoreAll:`Restore all`,workspaceStageAll:`Stage all`,workspaceUnstageAll:`Unstage all`,workspaceRestoreConfirmTitle:`Discard changes?`,workspaceRestoreFileConfirm:`Restore "{path}" and discard its local changes? This cannot be undone.`,workspaceRestoreAllConfirm:`Restore all listed changes and delete untracked files? This cannot be undone.`,workspaceStageFailed:`Failed to stage changes.`,workspaceUnstageFailed:`Failed to unstage changes.`,workspaceRestoreFailed:`Failed to restore changes.`,workspaceCommitMessage:`Commit msg`,workspaceReviewPrompt:`Please review the current workspace changes and generate a concise summary, risk assessment, verification plan, and a suggested commit message.
7
-
8
- Changed files:
9
- {list}`,workspaceCommitMessagePrompt:`Please generate a concise Conventional Commit message for the current Git changes. Include a one-line subject and an optional short body if useful.
10
-
11
- Changed files:
12
- {list}`,unknown:`Unknown`,webPreview:`Web Preview`,artifactPreview:`Artifacts`,artifactPreviewFiles:`Show artifact files`,artifactPreviewEmpty:`No artifact files to preview.`,artifactPreviewLoadFailed:`Failed to load artifact preview.`,artifactPreviewUnsupported:`Preview unavailable for this file`,artifactPreviewUnsupportedDescription:`This file type cannot be displayed in the browser preview. Open it in a supported app or use the Reader when available.`,previewChecking:`Checking preview...`,previewErrorNotFoundTitle:`File not found`,previewErrorNotFoundDescription:`The file may have been deleted, moved, or renamed. Check the path and try again.`,previewErrorTooLargeTitle:`File is too large to preview`,previewErrorTooLargeDescription:`This file exceeds the browser preview size limit. Open it with another application.`,previewErrorPermissionTitle:`Unable to access this file`,previewErrorPermissionDescription:`The path is restricted or QuickForge does not have permission to read it.`,previewErrorServiceTitle:`Preview service unavailable`,previewErrorServiceDescription:`QuickForge could not prepare this preview. Check the local service and try again.`,previewErrorUnknownTitle:`Unable to preview this file`,previewErrorUnknownDescription:`An unexpected error occurred while preparing the preview. You can retry or inspect the details below.`,previewErrorDetails:`Error details`,previewErrorStatusCode:`Status code`,previewErrorCode:`Error code`,previewErrorFilePath:`File path`,previewErrorRawMessage:`Original error`,artifactPreviewViewSource:`View source`,artifactPreviewPin:`Pin artifact tools`,artifactPreviewUnpin:`Unpin artifact tools`,artifacts:`Artifacts`,previewArtifact:`Preview artifact`,previewUrl:`Preview URL`,previewUrlPlaceholder:`Enter URL`,openPreview:`Open`,refreshPreview:`Refresh preview`,openInBrowser:`Open in browser`,zoom:`Zoom`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetZoom:`Reset zoom`,invalidPreviewUrl:`Please enter a valid http:// or https:// URL.`,noPreviewUrlTitle:`Start browsing`,noPreviewUrlDescription:`Enter a URL to open a page.`,workspaceStatusAdded:`Added`,workspaceStatusDeleted:`Deleted`,workspaceStatusRenamed:`Renamed`,workspaceStatusUntracked:`Untracked`,workspaceStatusConflict:`Conflict`,workspaceStatusModified:`Modified`,copyPath:`Copy path`,copyContent:`Copy content`,copyFileContent:`Copy file content`,copyDiffContent:`Copy diff content`,readerMoreActions:`More file actions`,readerOpen:`Open`,enableWordWrap:`Enable word wrap`,showFileNavigation:`Show file navigation`,hideFileNavigation:`Hide file navigation`,askAiAboutThis:`Ask AI about this`,readerFileMarkdownPrompt:"Please read the Markdown document `{path}` in the current workspace. Summarize its purpose, key sections, important instructions, outdated or risky parts, and suggest concise improvements.",readerFilePrompt:"Please inspect `{path}` in the current workspace and explain its role, important implementation details, and any risks or improvement opportunities.",readerDiffPrompt:"Please review the working-tree changes in `{path}`. Summarize what changed, point out possible bugs or regressions, and suggest focused verification steps.",openingReader:`Opening...`,markdownPreview:`Preview`,markdownSource:`Source`,viewMarkdownSource:`View source`,returnToMarkdownPreview:`Back to preview`,lanAccess:`LAN Access`,lanAccessDescription:`Allow trusted devices on the same LAN to access the full QuickForge app after entering a password.`,lanAccessRiskWarning:`High risk: LAN devices that pass this password can access your conversations, projects, and available tools. Enable only on trusted networks.`,lanAccessStatus:`LAN access status`,lanAccessEnabled:`Full LAN access`,lanAccessEnabledDescription:`Whether full access from LAN devices is currently enabled.`,lanAccessPassword:`Access password`,lanAccessPasswordStatusDescription:`Password status for LAN sign-in.`,lanAccessActiveDevices:`Signed-in devices ({count})`,lanAccessActiveDevicesDescription:`LAN devices that still have access. The same device may appear more than once when using different browsers.`,lanAccessBrowser:`Browser`,lanAccessUnknownDevice:`LAN device`,lanAccessUnknownAddress:`Unknown address`,lanAccessSignedInAt:`Signed in {time}`,lanAccessExpiresAt:`Expires {time}`,lanAccessNoActiveDevices:`No LAN devices are currently signed in.`,lanAccessRevokeDevice:`Sign out`,lanAccessRevokeDeviceConfirm:`Sign out {device}? This session will need the LAN password again.`,lanAccessDeviceRevoked:`The selected LAN session has been signed out.`,lanAccessUrls:`LAN URLs`,lanAccessUrlsDescription:`Open one of these addresses from another trusted device on this network.`,lanAccessAllowFull:`Allow LAN devices to access full QuickForge`,lanAccessAllowFullDescription:`Enable only on trusted networks; authenticated LAN devices can use the full app.`,lanAccessPasswordPlaceholder:`At least 8 characters`,lanAccessPasswordPlaceholderConfigured:`Leave empty to keep current password`,showPassword:`Show password`,hidePassword:`Hide password`,lanAccessSessionTtl:`Login validity`,lanAccessSessionTtlDescription:`How long a LAN device stays signed in after entering the password.`,lanAccessActions:`Actions`,lanAccessActionsDescription:`Save access settings or sign out all LAN devices.`,lanAccessRevokeAll:`Sign out all LAN devices`,lanAccessRevokeAllConfirm:`Sign out all unlocked LAN devices now?`,lanAccessEnableConfirm:`Enable full LAN access? Only continue on a trusted network.`,lanAccessPasswordRequired:`Set an access password before enabling LAN access.`,lanAccessPasswordTooShort:`The access password must be at least 8 characters.`,lanAccessSaved:`LAN access settings saved.`,lanAccessRevoked:`All LAN devices have been signed out.`,enabled:`Enabled`,disabled:`Disabled`,configured:`Configured`,notConfigured:`Not configured`,generatePassword:`Generate password`,hour:`hour`,hours:`hours`,days:`days`,toolApprovalWaiting:`Waiting for approval: {toolName}`,autoCompactApprovalWaiting:`Context reached {percent}% of the {threshold}% threshold. Compact now?`,autoCompactApprovalPreview:`QuickForge will summarize older history and continue with the summary plus the latest {keepRecentTurns} user turn(s). Full chat history remains visible.`,autoCompactFailed:`Automatic context compaction failed; continuing with the current history.`,contextCompactedTimelineLabel:`Earlier context is summarized for the model`,contextCompactedLabel:`Compressed context`,contextCompactedTooltip:`This chat is using a summarized context for model requests while keeping the full history visible.`,contextCompactedViewSummary:`View summary`,contextCompactedHideSummary:`Hide summary`,contextCompactedSummaryTitle:`Summary used by the model`,contextCompactedCopySummary:`Copy summary`,toolApprovalAccept:`✓ Accept`,toolApprovalReject:`✗ Reject`,toolApprovalTimeout:`Timeout`,toolApprovalTruncated:`... (truncated)`,processed:`Processed`,processing:`Processing`,processExecuted:`Executed`,processExecuting:`Executing`,processGroupToolsCalled:`{count} tool calls`,processGroupCommandsRan:`{count} commands`,processGroupFilesEdited:`Edited {count} files`,processFailed:`Failed`,processAborted:`Aborted`,processDurationSeconds:`{seconds}s`,processDurationMinutesSeconds:`{minutes}m {seconds}s`,processThinking:`Thinking process`,processCommandsRan:`Ran {count} commands`,processFilesEdited:`Edited {count} files`,processToolsCalled:`Called {count} tools`,processToolsFailedCount:`{count} failed`,expandProcess:`Expand processing details`,collapseProcess:`Collapse processing details`,expandProcessTools:`Expand tool activity`,collapseProcessTools:`Collapse tool activity`,relativeMinuteShort:`{count}m`,relativeHourShort:`{count}h`,relativeDayShort:`{count}d`,relativeWeekShort:`{count}w`,relativeYearShort:`{count}y`},zh:{language:`语言`,displayLanguage:`界面语言`,languageDescription:`选择速构 QuickForge 的界面显示语言。切换后页面会刷新以应用到所有组件。`,simplifiedChinese:`简体中文`,english:`English`,apply:`应用`,noLanguageChange:`当前已经是所选语言。`,newChat:`新建对话`,startNewChat:`新对话`,newChatEmptyTitle:`今天想推进什么?`,chooseProject:`选择项目`,searchProjects:`搜索项目`,newProject:`添加项目`,createBlankProject:`添加项目`,useExistingFolder:`选择项目目录`,useNoProject:`无项目`,noMatchingProjects:`没有匹配的项目`,loadingChatWorkspace:`正在加载聊天工作区...`,loadingConversation:`正在加载对话...`,localServiceUnavailableTitle:`QuickForge 本地服务不可用`,localServiceUnavailableDescription:`QuickForge 需要通过本地服务进行存储。请使用 npm run dev 或 quickforge 命令启动后刷新此页面。`,project:`项目`,projects:`项目`,loadingProject:`正在加载项目...`,addProject:`添加项目`,noProjects:`暂无项目。`,expandProject:`展开项目`,collapseProject:`折叠项目`,expandAllProjects:`展开所有项目`,collapseAllProjects:`折叠所有项目`,dragToReorder:`拖拽排序`,newProjectChat:`新建项目对话`,projectChat:`项目对话`,normalChat:`普通对话`,conversations:`对话`,pinnedConversations:`置顶`,noConversations:`暂无对话`,filterSort:`筛选与排序`,sidebarView:`视图`,sidebarViewByProject:`按项目`,sidebarViewTimeline:`时间线`,sortBy:`排序方式`,sortByUpdatedAt:`更新时间`,sortByCreatedAt:`创建时间`,filter:`筛选`,selecting:`选择中...`,chooseFolder:`选择文件夹`,selectProjectDirectory:`选择项目目录`,selectProjectDirectoryDescription:`浏览本地文件夹或粘贴路径,然后选择一个文件夹作为项目。`,quickAccess:`快捷入口`,path:`路径`,go:`前往`,parentDirectory:`上级目录`,noFolders:`该目录下没有文件夹。`,selectThisFolder:`选择此文件夹`,folderPickerPathPlaceholder:`输入或粘贴文件夹路径`,filesystemRootsFailed:`加载文件系统入口失败。`,directoryLoadFailed:`加载目录失败。`,noSavedConversations:`暂无保存的对话。`,deleteProject:`删除项目`,deleteProjectConfirm:`确定要删除项目「{name}」吗?该项目的对话记录将保留。`,deleteSession:`删除会话`,deleteSessionConfirm:`确定要删除该对话吗?删除后不可恢复。`,deleteSessionFailed:`删除对话失败。`,archiveSession:`归档对话`,confirmArchive:`确认归档`,archivedConversations:`已归档对话`,archivedConversationsDescription:`已归档的对话会从侧边栏隐藏,你可以在这里恢复或永久删除。`,searchArchivedConversations:`搜索已归档对话`,noArchivedConversations:`暂无已归档对话。`,archivedAt:`归档时间`,lastModified:`最后更新`,restoreSession:`恢复`,restoreSessionFailed:`恢复对话失败。`,sessionRestored:`对话已恢复。`,sessionNotFound:`未找到该对话。`,deletePermanently:`删除`,deleteAll:`全部删除`,deleteArchivedSessionConfirm:`确定要永久删除「{title}」吗?此操作不可恢复。`,deleteAllArchivedSessionsConfirm:`确定要永久删除所有已归档对话吗?此操作不可恢复。`,archivedSessionDeleted:`已归档对话已删除。`,archivedSessionsDeleted:`已归档对话已删除。`,allProjects:`所有项目`,unknownProject:`未知项目`,conversationCount:`{count} 个对话`,confirm:`确认`,confirmDelete:`确认删除`,rename:`重命名`,renameSession:`重命名对话`,sessionName:`对话名称`,settings:`设置`,toggleSidebar:`切换侧边栏`,failedToSelectProjectDirectory:`选择项目目录失败。`,projectSwitchFailed:`切换到该对话绑定的项目失败,工作区工具未启动。`,copy:`复制`,copied:`已复制`,svgDisplayMode:`SVG 显示模式`,svgPreviewMode:`预览`,svgSourceMode:`源码`,svgEnlargePreview:`点击放大 SVG 预览`,copySvgSource:`复制 SVG 源码`,downloadSvg:`下载 SVG`,mermaidPreviewLabel:`Mermaid 图表预览`,mermaidEnlargePreview:`点击放大 Mermaid 图表`,copyMermaidSource:`复制 Mermaid 源码`,downloadMermaidSvg:`下载 Mermaid SVG`,mermaidRendering:`正在渲染 Mermaid 图表...`,mermaidRenderFailed:`无法渲染此 Mermaid 图表,已保留源码。`,rollback:`回滚`,retry:`重试`,reloadPage:`刷新页面`,fork:`分支`,forkConversation:`从此处分支新对话`,yoloEnabledTitle:`工作区授权已开启:本地工具可使用当前项目`,yoloDisabledTitle:`工作区授权已锁定:本地工具已阻止`,agentAccessMenuLabel:`Agent 权限模式`,agentAccessDefaultLabel:`默认权限`,agentAccessFullLabel:`完全访问权限`,agentAccessDefaultTitle:`默认权限:仅在当前代码仓库内工作,可能影响系统的操作需要确认。`,agentAccessFullTitle:`完全访问权限:等同开发者授权,工具可在既有工作区边界内自动执行。`,agentAccessModeSyncFailed:`同步 Agent 权限模式失败。`,planModeLabel:`计划`,planModeEnabledTitle:`计划模式已开启:下一条消息会按 /plan 发送。点击可移除。快捷键:Shift+Tab`,planModeDisabledTitle:`计划模式:下一条消息按 /plan 发送。快捷键:Shift+Tab`,composerPlaceholder:`描述你想做的事`,assistantWaitingThinking:`正在思考`,assistantWaitingOrganizing:`正在整理答案`,assistantWaitingContinuing:`内容较多,正在继续处理`,assistantWaitingAriaLabel:`AI 正在准备回复`,customCommandsHint:`自定义指令`,customCommandsEmptyHint:`还没有项目指令。`,customCommandsListDescription:`列出项目自定义指令`,customCommandsNewDescription:`创建项目自定义指令`,initCommandDescription:`为当前仓库生成或更新简洁的 AGENTS.md 贡献者指南。`,planCommandDescription:`先生成计划;本轮禁止编辑文件或运行命令。`,reviewCommandDescription:`提交前自检待提交代码;本轮禁止编辑文件。`,summaryCommandDescription:`基于当前对话创建总结后的新对话,减少上下文占用。`,compactCommandDescription:`在当前对话内压缩上下文,使用与自动压缩一致的滚动摘要。`,clearCommandDescription:`清除当前对话历史和上下文,不调用模型。`,helpCommandDescription:`显示所有可用命令及其用法。`,yoloBlockedReason:`本地工具 {name} 已被当前 Agent 权限模式阻止。请切换到完全访问权限,或在弹出审批时确认该工具调用。`,globalToolBlockedReason:`本地工具 {name} 已被阻止,因为这是未绑定项目的普通对话。请新建或打开项目对话后使用工作区工具。`,noActiveProjectToolBlockedReason:`本地工具 {name} 已被阻止,因为当前没有激活项目。请添加或选择项目后再使用工作区工具。`,generationStillRunning:`生成仍在进行中。请停止生成或等待完成后再回滚。`,noConversationTurnToRollback:`没有可回滚的对话轮次。`,rollbackConfirmTitle:`确认回滚?`,rollbackConfirm:`确定回滚到这条消息之前吗?该消息及其之后的对话记录会被移除,消息内容会恢复到输入框。`,sharedRollbackConfirmTitle:`确认回滚分享对话?`,sharedRollbackConfirm:`该操作会直接影响分享者本机中的原始对话。该消息及其之后的对话记录会被移除,消息内容会恢复到输入框。`,confirmRollback:`确认回滚`,rollingBack:`回滚中...`,rollbackFailed:`回滚失败。`,retryFailed:`重试失败。`,copyFailed:`复制失败,请检查剪贴板权限。`,errorBoundaryTitle:`出错了`,errorBoundaryUnexpected:`发生了意外错误。`,errorBoundaryTryAgain:`重试`,execute:`执行`,addCustomModelFirst:`请先在设置里添加自定义模型,并确保填写了模型 ID 后保存。`,modelSetupRequired:`请先添加模型后再新建对话。`,modelSetupTitle:`还没有配置模型`,modelSetupDescription:`添加一个 OpenAI-Compatible 或 Anthropic 兼容模型后即可开始对话。QuickForge 只会使用你自己配置的模型。`,modelSetupSupports:`支持 LiteLLM、OpenRouter、DeepSeek、通义千问、智谱、Ollama,以及大多数 /v1/chat/completions 服务。`,modelSetupLocalStorage:`提供商、模型 ID 和 API Key 会由本机 QuickForge 本地服务保存。`,modelSetupAddModel:`添加模型`,modelSetupUseLiteLlmExample:`使用 LiteLLM 示例配置`,firstUseGuideTitle:`从安全工作流开始`,firstUseGuideDescription:`添加项目后,先让 QuickForge 理解项目;涉及代码修改时,建议先用 /plan 生成计划,再授权本地工具执行。`,firstUseGuideStepModel:`确认要使用的模型配置。`,firstUseGuideStepProject:`添加本地项目,让 AI 使用工作区上下文。`,firstUseGuideStepPlan:`先使用 /plan;该轮不会编辑文件或运行命令。`,firstUseGuideConfigureModel:`配置模型`,firstUseGuideAddProject:`添加项目`,firstUseGuideUsePrompt:`试用示例提示词`,firstUseGuideCopyPrompt:`复制 /plan 示例`,firstUseGuideDismiss:`我知道了`,firstUseGuideProjectPrompt:`/plan 阅读这个项目,说明项目结构、运行方式和主要风险。先不要修改文件。`,firstUseGuideGeneralPrompt:`/plan 先把这个需求拆成实现步骤和风险点。暂时不要修改文件。`,defaultOptions:`常规`,defaultOptionsDescription:`配置界面语言,以及新建对话和定时任务默认使用的模型、思考等级、工具展示和上下文管理。`,memory:`记忆`,memoryDescription:`让 QuickForge 跨对话和项目记住有用的偏好与习惯。`,globalMemory:`全局记忆`,globalMemoryDescription:`开启后,QuickForge 会使用已有记忆,并可从对话中主动记住对未来有帮助的长期偏好、习惯、背景、工作方式和目标。`,globalMemoryInfo:`记忆保存在本机,并由所有对话和项目共享。QuickForge 会避开临时任务细节、不确定推断和敏感凭据。关闭记忆后停止后续读取和写入,但保留已有文件。`,memoryFile:`记忆文件`,memoryFileDescription:`以可读的 Markdown 文件保存在本机 QuickForge 数据目录中。`,memoryCurrentSessionNote:`修改会在运行中对话发送下一条消息前加载。关闭后停止后续读取和写入,但保留已有文件。`,memoryEnabledSaved:`全局记忆已开启。`,memoryDisabledSaved:`全局记忆已关闭,已有记忆已保留。`,memoryContent:`记忆内容`,memoryContentDescription:`查看或编辑完整的自由 Markdown 文档,内容和格式会按原文保存。`,memoryContentDisabledDescription:`开启全局记忆后才能编辑和保存。关闭时仍可重新加载查看已有内容。`,memoryReload:`重新加载`,memorySave:`保存记忆`,memoryReloaded:`记忆已重新加载。`,memoryContentSaved:`全局记忆已保存。`,memoryContentEmpty:`全局用户记忆为空。`,defaultModel:`默认模型`,defaultModelDescription:`新建对话和定时任务默认使用的模型,可在具体场景中覆盖。`,defaultThinkingLevel:`默认思考等级`,defaultThinkingLevelDescription:`为支持 reasoning 的模型选择默认思考强度。`,toolDisplay:`Tool 显示模式`,toolDisplayModeDescription:`简洁模式显示摘要并默认收起详情;详细模式显示完整参数和 details,并默认展开 Tool 调用。`,toolDisplayCompact:`简洁`,toolDisplayDetailed:`详细`,showContextUsage:`显示上下文用量`,showContextUsageDescription:`在模型选择器旁显示上下文用量圆环及详情。`,fontSize:`字号`,fontSizeDescription:`调整界面和对话文字大小。`,fontSizeRangeDescription:`拖动时即时预览,松开后保存。`,appearance:`外观`,appearanceDescription:`自定义界面的主题和字号。`,theme:`主题`,themeDescription:`在浅色和深色之间切换,即时生效。`,lightTheme:`浅色`,darkTheme:`深色`,appearanceSaved:`外观已保存`,interfaceFontSize:`界面字号`,messageFontSize:`对话字号`,messageFontSizeNote:`应用到聊天消息里的主要正文。`,fontSizeSaved:`字号已保存`,toolDetailsHidden:`简洁模式已隐藏 Tool 详细信息。可在设置中将“Tool 显示模式”切换为“详细”查看完整参数。`,toolArgsSummary:`参数摘要`,saveDefaultOptions:`保存默认选项`,saving:`保存中...`,defaultOptionsSaved:`默认选项已保存`,networkConnection:`网络连接`,networkProxyMode:`代理模式`,networkProxyDirect:`直连`,networkProxySystem:`跟随系统`,networkProxyManual:`手动代理`,networkProxyPac:`PAC 地址`,networkProxyDescription:`控制 QuickForge 自身受支持的外部 HTTP 请求,本地地址始终直连。“跟随系统”会读取操作系统代理配置,并在系统支持时处理 PAC/WPAD。自定义 PAC 地址仅 Desktop 运行环境支持。`,networkProxyAddress:`代理地址`,networkProxyAddressDescription:`填写包含端口的 HTTP 或 HTTPS 代理地址。不支持路径、查询参数、片段和代理账号密码。`,networkProxyAddressRequired:`请先填写代理地址。`,networkProxyAddressInvalid:`请输入有效的 HTTP 或 HTTPS 代理地址。`,networkProxyAddressProtocolError:`仅支持 HTTP 和 HTTPS 代理地址。`,networkProxyAddressPortError:`代理地址必须包含主机和端口。`,networkProxyAddressCredentialsError:`代理地址暂不支持账号密码。`,networkProxyAddressPathError:`代理地址不能包含路径、查询参数或片段。`,networkProxyPacUrl:`PAC 地址`,networkProxyPacUrlDescription:`填写 PAC 脚本的 HTTP 或 HTTPS 地址。支持路径和查询参数,不支持账号密码和片段。`,networkProxyPacUrlRequired:`请先填写 PAC 地址。`,networkProxyPacUrlInvalid:`请输入有效的 HTTP 或 HTTPS PAC 地址。`,networkProxyPacUrlProtocolError:`PAC 地址仅支持 HTTP 和 HTTPS。`,networkProxyPacUrlHostError:`PAC 地址必须包含主机。`,networkProxyPacUrlCredentialsError:`PAC 地址不支持账号密码。`,networkProxyPacUrlFragmentError:`PAC 地址不能包含片段。`,networkProxyPacUnsupported:`自定义 PAC 地址仅 Desktop 运行环境支持。`,networkProxySave:`保存代理`,networkProxyRefresh:`重新读取系统代理`,networkProxyRefreshDescription:`重新读取操作系统当前代理配置,并关闭已有网络连接。`,networkProxyStatus:`来源:{source};运行环境:{runtime}。`,networkProxyUnsupported:`当前运行环境不支持读取操作系统代理。`,networkProxyLoadFailed:`无法读取当前代理配置,代理控件已禁用。`,networkProxySaved:`网络代理设置已保存`,networkProxyRefreshed:`已重新读取系统代理`,contextManagement:`上下文管理`,contextUsageTitle:`上下文用量`,contextUsageAriaLabel:`上下文已使用 {percent}%,查看详情`,contextUsageTotal:`{used} / {limit} tokens`,contextUsageInputLabel:`输入 / 上下文`,contextUsageReservedOutputLabel:`预留输出`,contextUsageSystemPromptLabel:`系统提示词`,contextUsageToolsSchemaLabel:`工具定义`,contextUsageMessagesLabel:`消息`,contextUsageSourceServerShort:`服务端计算`,contextUsageSourceLocalShort:`本地估算`,contextUsageScopeCompactedShort:`压缩后模型上下文`,contextUsageScopeFullShort:`完整模型上下文`,contextUsageUsed:`上下文已使用:{percent}%({used} / {limit} tokens)`,contextUsageInput:`输入/上下文:{tokens}({source})`,contextUsageSourceProvider:`提供商上下文`,contextUsageSourceMixed:`提供商/本地混合上下文`,contextUsageSourceEstimated:`本地估算上下文`,contextUsageLocalEstimate:`本地估算:{tokens}`,contextUsageSystemPrompt:` 系统提示词:{tokens}`,contextUsageToolsSchema:` 工具定义:{tokens}`,contextUsageMessages:` 消息:{tokens}`,contextUsageProviderBaseline:` 提供商用量基线:{tokens}`,contextUsageTrailingMessages:` 用量基线后的消息:{tokens}`,contextUsageReservedOutput:`预留输出:{tokens}`,contextUsageServerCalculated:`数据来源:服务端通过 pi-agent-core/pi-ai 计算`,contextUsageScopeCompacted:`统计范围:模型压缩后的上下文,不是界面中可见的完整聊天历史`,contextUsageScopeFull:`统计范围:完整模型上下文`,contextUsageEffectiveMessages:`消息:{effective} 条有效 / {visible} 条可见`,contextUsageProviderTokens:`提供商上下文 Token:{tokens}`,autoCompactEnabled:`自动压缩上下文`,autoCompactRequireConfirmation:`自动压缩前先询问确认`,autoCompactRequireConfirmationDescription:`在 QuickForge 总结较早历史前先请求确认。`,autoCompactTriggerNote:`系统会在每次请求模型前检查。测试时可降低阈值,或调小模型 Context Window。`,autoCompactThresholdPercent:`上下文达到多少百分比时压缩`,autoCompactThresholdDescription:`触发压缩的模型上下文窗口占比。`,autoCompactKeepRecentTurns:`保留最近用户回合数`,autoCompactKeepRecentTurnsDescription:`较早上下文总结后,最近回合仍保留完整内容。`,autoCompactDescription:`当预计下一次请求达到模型上下文窗口的指定比例时,QuickForge 会总结较早历史并继续当前任务。该过程会额外消耗一次模型调用。`,autoCompactHistoryPreserved:`完整聊天历史仍会保留在界面中;只有发送给模型的上下文会被压缩。`,autoArchiveEnabled:`自动归档历史对话`,autoArchiveTriggerNote:`最后更新超过 30 天的对话会移入“已归档对话”。`,autoArchiveDescription:`归档不会删除对话。关闭后只停止后续自动归档,已有归档仍可查看和恢复。`,autoArchiveSaved:`自动归档设置已保存`,thinkingLevel:`思考等级`,thinkingOff:`关`,thinkingLow:`低`,thinkingMedium:`中`,thinkingHigh:`高`,thinkingXHigh:`超高`,currentConfiguration:`当前配置`,thinkingSupported:`支持思考`,thinkingNotSupported:`该模型不支持思考等级。`,thinkingRequiresReasoningModel:`思考等级需要推理/思考模型。`,customModels:`自定义模型`,customModelsTitle:`自定义模型`,customModelsDescription:`只使用你配置的自定义 OpenAI-Compatible 模型。`,addModel:`添加模型`,editModel:`编辑模型`,delete:`删除`,editCustomModel:`编辑自定义模型`,addCustomModel:`添加自定义模型`,providerName:`提供商名称`,providerNamePlaceholder:`例如:LiteLLM`,protocolType:`协议类型`,protocolHelp:`LiteLLM、OpenRouter、大多数 /v1/chat/completions 服务请选择 OpenAI Compatible;直连 Anthropic API 才选 Anthropic Messages。`,apiKey:`API Key`,apiKeyPlaceholder:`没有可以留空`,showApiKey:`查看 API Key`,hideApiKey:`隐藏 API Key`,customHeaders:`自定义 Headers JSON`,customHeadersPlaceholder:`{
13
- "X-Custom-Header": "value"
14
- }`,customHeadersHelp:`可选的提供商级 HTTP Headers。必须是值为字符串的 JSON 对象,会随模型配置保存在本地。`,invalidHeadersJson:`自定义 Headers 必须是有效 JSON 对象,并且键和值都必须是字符串。`,modelId:`模型 ID`,modelIdPlaceholder:`例如:anthropic/claude-sonnet-4`,contextWindow:`Context Window`,maxTokens:`Max Tokens`,reasoningModel:`推理/思考模型(DeepSeek V4、Qwen 等)`,imageInputModel:`图片输入 / 视觉模型`,imageInputModelHelp:`仅在模型文档确认支持图片输入时开启。关闭后,请求发送前会省略附件图片,避免非视觉模型报错。`,providerProtocol:`协议`,model:`模型`,reasoning:`推理`,noModelAdded:`未添加模型`,modelsCount:`{count} 个模型`,modelIndex:`模型 #{index}`,modelsList:`模型列表`,atLeastOneModel:`至少需要一个模型。`,duplicateModelId:`模型 ID 不能重复。`,cancel:`取消`,save:`保存`,yes:`是`,no:`否`,loading:`加载中...`,noCustomModels:`还没有自定义模型,请点击"添加模型"。`,fillProviderBaseUrlModel:`请填写提供商名称和 Base URL。`,saveCustomModelFailed:`保存自定义模型失败。`,confirmDeleteProvider:`确定删除 {name} 吗?`,deleteFailed:`删除失败。`,selectCustomModel:`选择自定义模型`,close:`关闭`,back:`返回`,more:`更多`,searchModels:`搜索模型...`,searchSettings:`搜索设置...`,noSettingsResults:`没有匹配的设置`,noMatchingCustomModels:`没有匹配的自定义模型`,presets:`快速模板`,presetOpenai:`OpenAI`,presetDeepseek:`DeepSeek`,presetGlm:`智谱 GLM`,presetOllama:`本地 Ollama`,presetLitellm:`LiteLLM 代理`,presetCustom:`自定义`,providerAdvanced:`高级选项`,expandModel:`调整上下文窗口、最大输出、推理、图片输入`,addHeader:`添加请求头`,headerName:`请求头名称`,headerValue:`值`,removeHeader:`移除请求头`,testConnection:`测试连接`,testingConnection:`测试中…`,connectionOk:`连接成功`,connectionFailed:`连接失败`,testRequiresFields:`请填写 Base URL 和至少一个模型 ID。`,readFile:`读取文件`,manageGlobalMemory:`管理记忆`,searchFiles:`搜索文件`,writeFile:`写入文件`,editFile:`编辑文件`,runCommand:`运行命令`,presentFiles:`展示文件`,generateImage:`生成图片`,generatingImage:`正在生成图片…`,generatedImageAlt:`生成的图片 {index}`,openGeneratedImage:`打开生成图片`,downloadGeneratedImage:`下载生成图片`,executeInTerminal:`在终端中执行`,confirmExecuteCommandTitle:`在终端中执行命令?`,confirmExecuteMultipleCommands:`即将在本地终端中执行多行命令,是否继续?`,confirmExecuteDangerousCommand:`该命令可能修改系统、发布包、推送代码或执行远程脚本,是否继续?`,terminalCommandExecuteFailed:`在终端中执行命令失败。`,runSubagent:`运行 subagent`,subagentGeneral:`General`,subagentExplore:`Explore`,subagentRunning:`{name} 运行中`,subagentCompleted:`{name} 已完成`,subagentFailed:`{name} 失败`,subagentTask:`任务`,subagentContext:`上下文`,subagentExpectedOutput:`期望输出`,subagentResult:`结果`,subagentToolCalls:`工具调用`,subagentToolApprovalWaiting:`{source} 请求审批:{toolName}`,toolApprovalSourceSubagent:`来源:{source} subagent`,activateSkill:`激活技能`,readSkillResource:`读取技能资源`,yoloModeSyncFailed:`同步 Agent 权限模式失败,已恢复为之前的状态。`,toolApprovalFailed:`提交工具审批失败,请重试。`,toolApprovalSubmitting:`提交中...`,terminateCommand:`终止`,terminateCommandTitle:`终止这个正在运行的命令`,commandTerminateRequested:`正在终止...`,running:`运行中`,done:`完成`,error:`错误`,taskCompleted:`对话任务完成`,taskError:`对话任务出错`,systemNotifications:`系统通知`,systemNotificationsDescription:`QuickForge 在后台运行时,对话或定时任务结束后显示浏览器或 Android 系统通知。`,systemNotificationsPermissionGranted:`当前设备已授权。应用处于前台时仍只显示页面内提示。`,systemNotificationsPermissionPrompt:`当前设备尚未请求通知权限。`,systemNotificationsPermissionDenied:`当前设备已拒绝通知权限。`,systemNotificationsUnsupported:`当前环境不支持系统通知。`,systemNotificationsDeniedHelp:`通知权限已被拒绝,请在浏览器网站设置或 Android 应用设置中允许后重试。`,systemNotificationsEnabled:`已在当前设备启用系统通知。`,systemNotificationsDisabled:`已在当前设备关闭系统通知。`,systemNotificationsTest:`发送测试`,systemNotificationTestTitle:`QuickForge 通知测试`,systemNotificationTestFailed:`无法显示测试通知,请检查系统权限后重试。`,systemNotificationOpenDetails:`点击打开 QuickForge 查看详情。`,called:`已调用`,input:`输入`,output:`输出`,details:`详情`,scheduledTasks:`定时任务`,scheduledTasksDescription:`任务保存在本地后台服务中,并按 AI 解析出的 cron 表达式执行。`,createTask:`创建任务`,editTask:`编辑`,cancelEditTask:`取消编辑`,saveTask:`保存任务`,taskScheduleDescriptionLabel:`定时描述`,taskScheduleDescriptionPlaceholder:`例如:每天早上 9 点,把这段内容发给 AI:帮我生成销售日报。`,quickAiParseTask:`AI 会把这段描述解析为 cron 表达式,系统只保存并按 cron 执行。`,taskTitleLabel:`任务名称`,taskTitlePlaceholder:`例如:每日工作总结`,promptContentLabel:`AI 将发送的内容`,promptContentPlaceholder:`填写到点后原样发送给 AI 的内容。`,taskEnabledSwitch:`启用这个任务`,taskInstructionPlaceholder:`例如:每天早上 9 点帮我生成销售日报`,aiParseTask:`AI 解析任务`,confirmCreate:`确认创建`,taskList:`任务列表`,noScheduledTasks:`还没有定时任务。先输入一句自然语言指令创建一个。`,taskEnabled:`启用中`,taskRunning:`执行中`,taskPaused:`已暂停`,taskFinished:`已完成`,taskFailed:`执行失败`,executeNow:`立即执行`,enable:`启用`,pauseTask:`暂停`,deleteTask:`删除`,recentExecutions:`最近执行记录`,executionSuccess:`成功`,executionRunning:`执行中`,nextExecution:`下一次:`,lastExecution:`上次:`,noModelAvailable:`暂无可用模型`,noProjectBound:`不绑定项目`,aiParsed:`AI 已解析,请确认`,taskName:`任务名称:`,executionRule:`执行规则:`,nextExecutionTime:`下一次执行:`,taskProject:`项目:`,taskThinkingLevel:`思考:`,aiInstruction:`AI 指令:`,taskModel:`模型`,taskThinking:`思考`,taskProjectLabel:`项目`,taskExecutionMode:`执行模式`,taskExecutionModeSerial:`串行`,taskExecutionModeParallel:`并行`,taskExecutionModeHelp:`该设置只控制同一个任务是否允许重叠执行;不同定时任务之间仍可并行执行。`,tasksCount:`共 {total} 个任务,{enabled} 个启用中`,confirmDeleteTask:`确定要删除这个定时任务吗?删除后不可恢复。`,waitingForResult:`等待结果`,autoRun:`自动执行`,manualRun:`手动测试`,runInputContent:`发送给 AI 的内容`,runAiResult:`AI 结果`,runDuration:`耗时:`,taskListTab:`任务列表`,executionHistoryTab:`执行历史`,agentsTab:`智能体`,agentsDescription:`创建可复用的智能体配置,用于定时任务和 run_subagent 委派。`,createAgent:`创建智能体`,editAgent:`编辑智能体`,builtinAgent:`内置`,builtinAgentReadonly:`内置智能体在当前版本中只读。`,builtinAgentModelSettings:`模型设置`,builtinAgentModelOnly:`该内置智能体由系统管理,仅允许修改使用的模型。`,readonlyAgentDescription:`该智能体来自只读来源,无法在此编辑。`,enabledAsSubagent:`允许作为 sub agent`,enableAsSubagent:`启用作为 sub agent`,disableAsSubagent:`禁用作为 sub agent`,noDescription:`暂无描述。`,maxRuntimeMs:`最大运行时间:`,maxToolCalls:`最大工具调用:`,defaultAgent:`默认智能体`,executionAgent:`执行智能体:`,agentName:`智能体名称`,agentLabel:`显示名称`,agentLabelPlaceholder:`例如:代码审查智能体`,agentDescription:`描述`,agentSystemPrompt:`系统提示词`,agentModelMode:`模型模式`,agentModelInherit:`继承主模型`,agentModelFixed:`使用固定模型`,agentFixedModel:`固定模型`,agentThinkingLevel:`思考等级`,agentThinkingInherit:`继承调用方设置`,agentThinkingDescription:`运行时模型不支持推理时,将自动降级为关闭。`,agentThinkingUnsupported:`所选固定模型不支持推理,思考等级将关闭。`,allowedTools:`可用工具`,agentSourcePath:`来源路径`,highRiskTool:`高风险`,confirmDeleteAgent:`确定删除这个自定义智能体吗?使用它的定时任务将回退到默认智能体。`,aiFillAgent:`AI 填充`,aiFillAgentDescription:`描述你想创建的智能体,AI 只会填充智能体名称、显示名称、描述和系统提示词。`,aiFillAgentPlaceholder:`例如:生成一个只读代码审查智能体,重点检查架构、潜在 bug 和测试覆盖。`,aiFillAgentLoading:`生成中...`,aiFillAgentNoModel:`请先配置默认模型。`,aiFillAgentFailed:`AI 填充失败,请检查模型配置和 API Key 后重试。`,aiFillAgentInputRequired:`请描述你想创建的智能体。`,taskContent:`任务内容`,viewDetails:`查看详情`,moreActions:`更多操作`,historyFilters:`筛选条件`,allTasks:`全部任务`,allStatuses:`全部状态`,allTriggers:`全部触发方式`,triggerType:`触发方式`,keyword:`关键词`,keywordPlaceholder:`搜索输入、结果或错误`,startTime:`开始时间`,endTime:`结束时间`,query:`查询`,reset:`重置`,previousPage:`上一页`,nextPage:`下一页`,pageSize:`每页 {size} 条`,paginationSummary:`第 {page} / {pages} 页,共 {total} 条`,noExecutionHistory:`暂无执行历史。`,viewConversation:`查看对话`,createdAt:`创建时间`,status:`状态`,search:`搜索`,searchDialog:`搜索对话记录...`,noSearchResults:`没有找到相关对话`,searchHint:`输入关键词搜索已加载的对话记录`,scheduledTasksLabel:`定时任务`,skills:`技能`,mcp:`MCP`,mcpServers:`MCP 服务`,plugins:`插件`,pluginMentionHeader:`插件`,composerAddMenu:`添加`,composerAddAttachment:`附件`,composerAddPlugins:`插件`,composerAddBack:`返回`,pluginOpenaiDocumentsName:`文档`,pluginOpenaiDocumentsDescription:`创建和编辑文档产物`,pluginOpenaiSpreadsheetsName:`表格`,pluginOpenaiSpreadsheetsDescription:`创建、分析和整理表格文件`,pluginOpenaiPresentationsName:`演示文稿`,pluginOpenaiPresentationsDescription:`创建和编辑演示文稿`,pluginsDescription:`管理本地 QuickForge 插件。当前首版支持通过 manifest 声明并贡献 Agent 工具的插件。`,pluginsReload:`重新加载插件`,loadingPlugins:`正在加载插件...`,noPlugins:`未发现插件`,noPluginsDescription:`将包含 plugin.json 的插件目录放到以下任一搜索路径,然后重新加载。`,pluginsCount:`共 {total} 个插件,{enabled} 个已启用`,pluginToolsCount:`{count} 个工具`,pluginPermissionsCount:`{count} 个权限`,pluginDetails:`插件详情`,pluginVersion:`版本`,pluginStatusLoaded:`已加载`,pluginStatusDisabled:`已停用`,pluginStatusError:`错误`,pluginTools:`工具`,pluginPermissions:`声明权限`,pluginNoTools:`未声明工具。`,pluginNoPermissions:`未声明权限。`,pluginTrustedNotice:`首版插件属于本地可信 Node.js 代码;权限目前用于展示和后续强校验。`,pluginDiscoveryErrors:`插件发现错误`,enablePlugin:`启用`,disablePlugin:`禁用`,pluginsLoadFailed:`加载插件失败。`,pluginsSaveFailed:`更新插件失败。`,manageMcpServers:`管理 MCP 服务`,mcpNoServersDescription:`还没有配置 MCP 服务。点击「添加服务」,或在右侧粘贴 mcpServers JSON 配置。`,mcpConfiguredServers:`已配置服务`,mcpAddServer:`添加服务`,mcpEditServer:`编辑服务`,mcpServerName:`服务名称`,mcpCommand:`命令`,mcpTransport:`传输方式`,mcpUrl:`URL`,mcpArgs:`参数,每行一个`,mcpCwd:`工作目录`,mcpEnv:`环境变量,每行 KEY=value`,mcpToolsCount:`{count} 个工具`,mcpLoadFailed:`加载 MCP 服务失败。`,mcpSaveFailed:`保存 MCP 服务失败。`,mcpDeleteFailed:`删除 MCP 服务失败。`,mcpReconnectFailed:`重新连接 MCP 服务失败。`,mcpDeleteConfirm:`确定删除 MCP 服务「{name}」吗?`,mcpImportConfig:`导入 MCP JSON`,mcpImportConfigDescription:"直接粘贴 mcpServers 格式的 MCP JSON 配置。QuickForge 支持 stdio、HTTP 和 SSE 传输;远程服务可使用 headers,并支持通过 ${...} 从后端进程环境变量读取。",mcpUseExample:`使用示例`,mcpImportUpdate:`导入 / 更新`,mcpReplaceAll:`替换全部`,mcpReplaceConfirm:`这会删除当前未包含在 JSON 中的 MCP 服务,确定继续吗?`,mcpInvalidJson:`MCP 配置必须是合法 JSON。`,mcpInvalidConfigJson:`MCP 配置必须包含 mcpServers 对象。`,mcpEmptyConfigJson:`mcpServers 不能为空。`,mcpInvalidServerName:`MCP 服务名称无效:{name}。请只使用小写字母、数字和连字符。`,mcpInvalidServerConfig:`MCP 服务「{name}」必须是对象。`,mcpInvalidTransport:`MCP 服务「{name}」的传输方式必须是 stdio、http 或 sse。`,mcpMissingCommand:`MCP 服务「{name}」使用 stdio 传输时必须提供 command。`,mcpMissingUrl:`MCP 服务「{name}」使用 HTTP/SSE 传输时必须提供 url。`,mcpArgsMustBeArray:`MCP 服务「{name}」的 args 必须是数组。`,mcpEnvMustBeObject:`MCP 服务「{name}」的 env 必须是对象。`,mcpHeadersMustBeObject:`MCP 服务「{name}」的 headers 必须是对象。`,mcpHeaders:`Headers,每行 KEY=value`,mcpReconnectServer:`重连`,mcpMoreTools:`+{count}`,mcpNamePlaceholder:`例如 my-server`,mcpUrlPlaceholder:`https://example.com/mcp`,mcpCommandPlaceholder:`例如 npx`,mcpTabServer:`服务`,mcpTabJson:`JSON`,optional:`可选`,globalSkills:`全局技能`,projectSkills:`项目技能`,help:`帮助`,projectCommands:`项目命令`,projectCommandsDescription:`为当前项目配置额外的 Markdown slash command 目录。QuickForge 还会读取用户级目录 ~/.quickforge/commands/(所有项目共享),然后依次读取项目目录 .claude/commands、.opencode/commands、.ai/commands 及此处的配置目录;同名 command 以后面的目录覆盖前面的目录。`,projectCommandsProjectDescription:`选择要配置命令目录的项目。`,selectProjectForCommands:`请先选择或添加一个项目,再配置项目命令。`,commandDirectory:`命令目录`,commandDirectories:`命令目录`,commandDirectoriesDescription:`一行添加一个目录。相对路径会基于所选项目根目录解析。`,commandDirectoryPlaceholder:`.claude/commands
15
- .opencode/commands
16
- D:\\shared\\ai-commands`,commandDirectoryHelp:`一行一个目录。支持相对路径和绝对路径。相对路径会基于当前项目根目录解析。留空则只使用内置兼容命令目录。`,commandDirectoryExamples:`示例`,commandDirectoryExamplesDescription:`常见兼容目录仍会自动发现。`,projectCommandsSaved:`项目命令设置已保存。`,loadedCommands:`已加载命令({count})`,loadedCommandsDescription:`从用户级、兼容目录和此项目配置目录中发现的命令。`,noCommandsLoaded:`暂未加载到任何命令。请在上方添加目录或新建命令后重试。`,openCommandDir:`打开命令目录`,createCommand:`新建命令`,projectCommandsActions:`操作`,projectCommandsActionsDescription:`保存配置目录后会重新加载已发现的命令。`,newCommandPrompt:`请输入命令名(小写字母、数字、连字符):`,commandCreated:`命令已创建:{name}`,commandAlreadyExists:`命令已存在:{name}`,invalidCommandName:`命令名无效,请使用小写字母、数字和连字符。`,manageSkills:`管理技能`,manageGlobalSkills:`管理全局技能`,manageProjectSkills:`管理项目技能`,openFolder:`打开文件夹`,fileManager:`资源管理器`,openWorkspace:`打开工作区`,chooseWorkspaceOpenTarget:`选择工作区打开方式`,openInExplorer:`在资源管理器打开`,openInExplorerFailed:`打开项目目录失败。`,openInVSCode:`在 VS Code 中打开`,openInVSCodeFailed:`在 VS Code 中打开项目失败,请确认已安装 VS Code 命令行工具。`,openInIDEA:`在 IntelliJ IDEA 中打开`,openInIDEAFailed:`在 IntelliJ IDEA 中打开项目失败,请确认已安装 IntelliJ IDEA 或 idea 命令行工具。`,moreOptions:`更多选项`,gitBranchMenu:`Git 分支菜单`,searchBranches:`搜索分支`,uncommittedChanges:`未提交的更改:`,filesCount:`{count} 个文件`,noBranchesFound:`没有匹配的分支`,currentBranch:`当前`,createBranchTitle:`创建并检出新分支`,createBranchDescription:`输入新分支名称,QuickForge 会从当前 HEAD 创建并检出该分支。`,createBranchPlaceholder:`feature/my-branch`,createAndCheckoutBranch:`创建并检出`,createAndCheckoutBranchEllipsis:`创建并检出新分支...`,gitGraph:`Git 图谱`,gitBranchesFailed:`加载分支失败。`,gitCheckoutFailed:`切换分支失败。`,gitBranchSwitched:`已切换分支`,gitBranchCreated:`已创建分支`,gitToolsTitle:`Git 工具`,togglePinnedSummary:`切换置顶摘要`,environmentInfo:`环境信息`,gitToolsCollapse:`收起 Git 工具`,gitToolsChanges:`更改`,gitToolsCommitOrPush:`提交或推送`,gitCommitMessagePlaceholder:`提交信息`,gitGenerateCommitMessage:`生成提交信息`,gitGenerateCommitMessageFailed:`生成提交信息失败。`,gitIncludeUnstagedChanges:`包含全部未暂存更改`,gitIncludeUnstagedWarning:`所有修改、未跟踪和删除的文件都会加入本次提交。`,gitCommitFilesSummary:`将提交 {selected}/{total} 个文件`,gitFileNotIncluded:`不提交`,gitCommitMessageRequired:`请先填写或生成提交信息。`,gitNoStagedChanges:`没有可提交的已暂存更改。`,gitDetachedHeadBlocked:`请先切换到一个分支,再提交或推送。`,gitCommitSucceededPushFailed:`本地提交成功,但推送失败。`,gitRetryPush:`重试推送`,gitRefreshingStatus:`正在刷新 Git 状态…`,gitStatusRefreshFailed:`刷新 Git 状态失败。`,gitCommitOnly:`提交`,gitCommitAndPush:`提交并推送`,gitPushOnly:`推送`,gitCommitNoProject:`当前没有选择项目。`,gitCommitNoModel:`请先配置默认模型。`,gitCommitConflictsBlocked:`请先解决冲突后再提交。`,gitOperationFailed:`Git 操作失败。`,gitOperationCompleted:`Git 操作已完成`,gitGraphFailed:`加载 Git 图谱失败。`,noGitCommits:`没有找到提交记录。`,refresh:`刷新`,graphColumn:`图`,description:`描述`,date:`日期`,author:`作者`,commit:`提交`,pinSession:`置顶对话`,unpinSession:`取消置顶`,shareSession:`分享对话`,selectProjectForSkills:`请先选择或添加一个项目,再管理技能。`,skillsDescription:`选择项目「{project}」启用的 Agent Skills。QuickForge 只在提示词中披露名称/描述;完整 SKILL.md 指令会在需要时通过 activate_skill 按需加载。`,globalSkillsDescription:`选择 QuickForge 全局启用的 Agent Skills。新对话只注入技能目录,完整 SKILL.md 指令会在需要时通过 activate_skill 按需加载。`,projectSkillsDescription:`选择项目「{project}」启用的 Agent Skills。同名项目技能会覆盖全局技能;新项目对话只注入技能目录,完整指令按需加载。`,searchSkills:`搜索技能...`,availableSkills:`可用技能`,selectedSkillsCount:`已选择 {count} 个`,noMatchingSkills:`没有匹配的技能`,skillSearchPaths:`搜索路径`,failedToLoadSkills:`加载技能失败。`,failedToSaveSkills:`保存技能失败。`,readSkill:`阅读技能`,readSkillContent:`阅读技能内容`,backToSkillList:`返回技能列表`,failedToReadSkill:`读取技能内容失败。`,noSkillContent:`该技能没有可阅读的内容。`,requestFailed:`请求失败`,backupRestore:`备份与恢复`,backupRestoreDescription:`导出或恢复 QuickForge 的设置、模型提供商和定时任务。本机项目列表及对话历史不包含在设置备份中,导入前会先创建安全备份。`,exportData:`导出数据`,exportDataDescription:`选择需要包含在 JSON 设置备份中的数据。`,selectExportSections:`选择导出内容`,selectExportSectionsDescription:`默认选中全部设置数据,可以关闭不需要导出的内容。`,conversationBackupExcluded:`对话历史和本机项目列表不属于设置备份,不会从这里导出。`,selectAtLeastOneExportSection:`请至少选择一个要导出的数据项。`,includeApiKeys:`包含 API Key`,includeApiKeysDescription:`已保存的模型提供商 API Key。`,backupExportSecretsConfirm:`此备份将包含 API Key,是否继续?`,exportBackup:`导出备份`,exportBackupDescription:`将所选数据下载为带时间戳的 JSON 文件。`,backupExported:`备份已导出。`,backupExportFailed:`导出备份失败。`,importData:`导入数据`,importDataDescription:`从之前导出的 JSON 备份中恢复核心设置。旧完整备份里的对话历史会被此设置导入流程忽略。`,importBackup:`导入备份`,backupInspectTitle:`备份预览`,backupInspectDescription:`写入本地数据前,先检查元数据并选择要恢复的内容。`,backupInspectExportedAt:`导出时间`,backupInspectVersion:`版本`,backupInspectScope:`范围`,backupInspectSecrets:`包含 API Key`,backupInspectSections:`数据项`,backupInspectFailed:`检查备份失败。`,backupInvalidSections:`以下格式异常的数据项已跳过:`,backupInspected:`备份已检查,请在下方选择要恢复的数据。`,backupInspectedWithIgnoredConversations:`备份已检查。这个旧备份中的对话历史已忽略,请在下方选择要恢复的设置数据。`,selectRestoreSections:`选择要恢复的数据`,restoreMode:`恢复模式`,restoreModeDescription:`选择导入数据如何应用到本地数据。`,restoreModeReplace:`替换`,restoreModeReplaceDescription:`用备份内容完全替换所选分区的本地数据,现有本地数据将被覆盖。`,restoreModeMerge:`合并`,restoreModeMergeDescription:`将备份内容合并到本地,冲突时以备份为准,本地独有的条目将被保留。`,backupImportActions:`导入操作`,backupImportActionsDescription:`导入所选数据项,或取消这次备份预览。`,confirmImportSelected:`导入所选数据`,selectAtLeastOneRestoreSection:`请至少选择一个要恢复的数据项。`,restoreSettings:`设置`,restoreSettingsDescription:`语言、默认选项等应用偏好设置。`,restoreMcp:`MCP 服务`,restoreMcpDescription:`全局 MCP 服务定义及其启用/停用状态。`,restoreProviderKeys:`API Key`,restoreProviderKeysDescription:`已保存的模型提供商 API Key。`,restoreCustomProviders:`自定义提供商和模型`,restoreCustomProvidersDescription:`自定义模型提供商、端点、模型 ID 及相关配置。`,restoreScheduledTasks:`定时任务`,restoreScheduledTasksDescription:`已保存的 AI 定时任务。`,restoreConversations:`对话`,restoreConversationsDescription:`对话历史和元数据。会作为一个一致的整体恢复。`,backupImportConfirm:`导入前会先创建安全备份,是否继续?`,backupImportReplaceConfirm:`确定用此备份替换所选数据项的本地数据吗?导入前会先创建安全备份。`,backupImportMergeConfirm:`确定将所选备份数据合并到本地吗?导入前会先创建安全备份。`,backupImported:`备份已导入,应用即将刷新。`,backupImportFailed:`导入备份失败。`,backupFileTooLarge:`该备份文件超过 {size}MB。当前设置导入主要用于核心设置迁移,请导出核心设置备份,或先减少/排除对话历史后再导入。`,backupStringTooLarge:`该备份过大,当前浏览器导入流程无法稳定处理。请使用核心设置备份,或减少/排除对话历史。`,backupSafetyBackupPath:`安全备份保存位置`,about:`关于`,desktopUpdate:`桌面版发布页`,desktopExit:`退出`,aboutQuickForge:`关于 QuickForge`,aboutQuickForgeDescription:`查看版本和项目链接。`,projectInfo:`项目信息`,packageName:`包名`,packageNameDescription:`当前安装的 QuickForge 包名称。`,currentVersion:`当前版本`,currentVersionDescription:`这台机器上正在运行的版本。`,latestVersion:`最新版本`,latestVersionDescription:`更新检查返回的最新版本。`,github:`GitHub`,githubDescription:`打开项目仓库和发布说明。`,checkUpdate:`检查更新`,checkingUpdate:`检查中...`,checkUpdateDescription:`从 npm 检查 QuickForge Runtime 最新版本。此操作不会更新 Electron 桌面壳。`,desktopUpdates:`桌面版更新`,desktopUpdatesDescription:`下载最新桌面版。`,desktopUpdateFrequencyDescription:`桌面版更新会打开下载页。`,desktopUpdateHint:`已打开下载页。`,openDesktopReleases:`下载最新版本`,runtimeUpdates:`更新`,runtimeUpdatesDescription:`检查是否有新版本。`,updateChannel:`通道`,runtimeUpdateChannel:`Runtime(npm)`,checkRuntimeUpdate:`检查更新`,updateAvailableMessage:`发现新版本:{current} → {latest}。`,localVersionNewerMessage:`你正在使用较新的本地版本:{current}。`,alreadyLatestVersion:`QuickForge 已是最新版本({version})。`,updateNow:`立即更新`,updateRuntimeNow:`立即更新`,updatingQuickForge:`正在更新...`,updateStarted:`更新已开始。QuickForge 会自动重启。`,updateRestarted:`更新完成,正在刷新页面...`,updateRestartTimeout:`更新时间超过预期,请稍后重试。`,updateCompleted:`更新完成,请重启 QuickForge。`,updateFailed:`更新失败。`,updateCheckFailed:`检查更新失败。`,updateCommand:`命令`,updateLog:`更新日志`,updateLogDescription:`当前更新操作的日志文件。`,updateLogFile:`日志:{path}`,updateConfirm:`QuickForge 将更新并重启。正在运行的任务会被中断。是否继续?`,updateFrequencySection:`自动检查更新`,updateFrequencyDescription:`发现新版本时显示提醒。`,frequencyStartup:`每次启动检查`,frequencyDaily:`每天一次`,frequencyWeekly:`每周一次`,frequencyOff:`关闭`,lastCheckedAt:`上次检查:{time}`,lastCheckedNever:`尚未检查`,newVersionAvailable:`发现新版本 {version}`,newVersionAvailableSub:`当前 {current} · 点击查看`,updateLater:`稍后`,backendService:`后端服务`,backendServiceDescription:`重启 QuickForge 本地后端服务。正在运行的生成会被中断,页面会自动重新连接。`,backendServiceStatus:`服务状态`,restartBackendService:`重启后端服务`,restartBackendServiceDescription:`当本地后端卡住,或调整了服务级环境配置后,可以在这里重启。`,restartBackendConfirm:`确定现在重启后端服务吗?正在运行的生成会被中断,页面会自动重新连接。`,backendRestarting:`后端正在重启...`,backendRestarted:`后端已重启,正在刷新页面...`,backendRestartFailed:`后端重启失败。`,backendRestartTimeout:`后端重启超时,请手动重启 QuickForge。`,backendRestartUnsupported:`当前启动方式不支持从界面重启,请手动重启 QuickForge。`,serviceMode:`模式`,serviceModeDescription:`QuickForge 本地服务当前的运行方式。`,servicePid:`PID`,servicePidDescription:`后端服务的操作系统进程 ID。`,serviceStartedAt:`启动时间`,serviceStartedAtDescription:`当前后端进程的启动时间。`,serviceDataDir:`数据目录`,serviceDataDirDescription:`保存设置、存储、日志和缓存的本地目录。`,serviceWorkspace:`工作区`,serviceWorkspaceDescription:`当前服务进程使用的工作区根目录。`,terminalShell:`终端 Shell`,terminalShellDescription:`QuickForge 会自动识别这台电脑上常见的 macOS、Windows 和 Linux Shell。请从列表中选择默认项;只有缺少时才需要使用自定义命令或路径。QUICKFORGE_TERMINAL_SHELL 仍会优先生效。`,terminalShellAutoDetectedHint:`已识别的条目会自动显示在列表中。`,terminalShellDefault:`默认 Shell`,terminalShellCustomOption:`自定义命令或路径…`,terminalShellSaved:`终端 Shell 设置已保存,新建终端会话会使用该设置。`,terminalShellProfilesSaved:`终端 Shell 配置已保存。`,terminalShellCommand:`自定义 Shell 命令或路径`,terminalShellCustomDescription:`只有自动识别不到时,才需要手动添加 Shell。`,terminalShellCommandPlaceholder:`C:\\Program Files\\Git\\bin\\bash.exe`,terminalShellAdd:`添加`,terminalShellSetDefault:`设为默认`,terminalShellDefaultBadge:`默认`,terminalShellDetected:`已识别`,terminalShellNoDetected:`未识别到可用 Shell,请在下方添加自定义 Shell 命令或路径。`,terminalShellProfileRequired:`保存前请输入 Shell 命令或可执行文件路径。`,terminalShellDeleteConfirm:`确定删除终端 Shell 配置“{name}”吗?`,channels:`渠道`,channelsDescription:`管理把外部应用接入 QuickForge Agent 的本地通信渠道。`,channelsSecurityWarning:`渠道操作会启动本地进程,仅可在本机使用。`,channelsEmpty:`暂无可用渠道。`,start:`启动`,stop:`停止`,restart:`重启`,channelWorkspace:`启动工作区`,channelWorkspaceDescription:`选择渠道启动时使用的工作区。使用默认工作区时,对应非项目的全局对话。`,channelDefaultWorkspace:`默认工作区`,channelNoWorkspaces:`当前没有可用工作区。请先配置默认工作区再启动此渠道。`,channelOpenLogs:`打开日志文件夹`,channelOpeningLogs:`正在打开日志文件夹…`,channelOpenLogsFailed:`无法打开渠道日志文件夹。`,channelQrTitle:`使用微信扫码`,channelQrDescription:`请用微信扫描下方二维码。`,channelStatusStopped:`已停止`,channelStatusStarting:`启动中`,channelStatusWaitingScan:`等待扫码`,channelStatusRunning:`运行中`,channelStatusStopping:`停止中`,channelStatusError:`出错`,channelRestartConfirm:`确定重启渠道“{name}”吗?`,channelLogoutConfirm:`确定退出渠道“{name}”的登录吗?再次使用前需要重新扫码。`,channelReloginConfirm:`确定重新登录渠道“{name}”吗?当前进程会停止,并生成新的二维码。`,terminalNew:`新建终端`,rightPanelOpenTabsTitle:`打开标签页`,rightPanelOpenTabsDescription:`选择要在右侧面板中打开的标签。`,rightPanelAddTab:`打开标签页`,rightPanelCloseOtherTabs:`关闭其他标签页`,rightPanelCloseAllTabs:`关闭全部标签页`,rightPanelFiles:`文件`,rightPanelReview:`审查`,rightPanelTerminal:`终端`,rightPanelBrowser:`浏览器`,rightPanelFilesDesc:`浏览项目文件结构`,rightPanelReviewDesc:`查看 Git 代码变更`,rightPanelTerminalDesc:`运行命令行操作`,rightPanelBrowserDesc:`预览网页效果`,terminalNewWith:`新建终端使用`,terminalNewWithProfile:`新建终端:{name}`,terminalSelectShell:`选择 Shell 新建终端`,terminalCollapse:`收起终端`,terminalFullscreen:`全屏终端`,terminalExitFullscreen:`退出全屏`,terminalStarting:`正在启动终端...`,terminalUnavailable:`终端不可用`,terminalNoSessions:`没有终端会话`,terminalCreateFailed:`创建终端失败`,terminalCloseFailed:`关闭终端失败`,terminalConnectionFailed:`连接终端失败。`,terminalConnectionTimedOut:`终端连接超时。`,terminalConnectionClosedUnexpectedly:`终端连接异常断开。`,terminalSessionUnavailable:`原终端会话已结束,可能是服务重启或会话过期,原进程无法恢复。`,terminalStartNew:`启动新终端`,terminalConnecting:`正在连接终端…`,terminalReconnecting:`正在重新连接终端({attempt}/{max})…`,terminalCloseSession:`关闭 {name}`,workspaceNoFilesToDisplay:`没有可显示的文件。`,workspaceNoWorkingTreeChanges:`工作区没有变更。`,workspaceNoStagedChanges:`没有已暂存变更。`,workspaceNoLastRunChanges:`上一轮产物没有命中 Git 变更文件。`,workspaceRootPath:`项目根目录`,workspaceLoadingDiff:`正在加载差异...`,workspaceNoDiffPreview:`没有可预览的差异。`,workspaceDiffTooLarge:`此差异过大,无法在列表中预览。`,workspaceUnmodifiedLines:`{count} 行未修改`,noProjectSelected:`未选择项目`,workspacePanel:`工作空间`,workspaceExpandRightPanel:`展开右侧边栏`,workspaceCollapseRightPanel:`关闭右侧边栏`,workspaceOverview:`概览`,workspaceFiles:`工作空间文件`,workspaceBrowser:`浏览器`,workspaceChanges:`变更`,workspaceCurrentArtifacts:`审查`,workspaceNoArtifacts:`当前 Session 尚未检测到 AI 产生的文件。`,workspacePresentedArtifact:`展示产物`,workspaceInferredArtifact:`推断产物`,workspaceCommands:`命令`,workspaceCommandOutput:`输出`,workspaceCurrentBranch:`当前分支`,workspaceChangeCount:`项变更`,workspaceNotGitRepository:`此项目不是 Git 仓库。`,workspaceSelectProject:`请选择一个项目来查看工作空间。`,workspaceLoading:`正在加载工作空间...`,workspaceLoadFailed:`加载工作空间失败。`,workspaceFilterFiles:`筛选文件`,workspaceOpenFileTitle:`打开文件`,workspaceOpenFileDescription:`从工作区目录打开文件`,workspaceOpenFileFailed:`打开文件失败。`,workspaceOpenDiffFailed:`打开 diff 失败。`,workspaceViewDiff:`查看 diff`,refreshWorkspace:`刷新工作空间`,closeWorkspace:`关闭工作空间`,workspaceFullscreen:`全屏工作空间`,workspaceExitFullscreen:`退出全屏`,workspaceStaged:`已暂存`,workspaceUntracked:`未跟踪`,workspaceConflicts:`冲突`,workspaceStagedChanges:`已暂存变更`,workspaceReview:`审查`,workspaceReviewFilter:`审查筛选`,workspaceReviewFilterUnstaged:`未暂存`,workspaceReviewFilterStaged:`已暂存`,workspaceReviewFilterAllBranches:`全部分支更改`,workspaceReviewFilterLastRun:`上一轮更改`,workspaceRestoreFile:`还原文件`,workspaceStageFile:`暂存文件`,workspaceUnstageFile:`退回到未暂存`,workspaceOpenFileInNewTab:`在新标签中打开文件`,workspaceCannotOpenDeletedFile:`已删除文件不能直接打开。`,workspaceRestoreAll:`还原全部`,workspaceStageAll:`暂存全部`,workspaceUnstageAll:`退回全部`,workspaceRestoreConfirmTitle:`丢弃更改?`,workspaceRestoreFileConfirm:`还原“{path}”并丢弃它的本地更改?此操作不可撤销。`,workspaceRestoreAllConfirm:`还原列表中的全部更改并删除未跟踪文件?此操作不可撤销。`,workspaceStageFailed:`暂存更改失败。`,workspaceUnstageFailed:`退回未暂存失败。`,workspaceRestoreFailed:`还原更改失败。`,workspaceCommitMessage:`提交信息`,workspaceReviewPrompt:`请审查当前工作空间的变更,并生成一份简要的总结、风险评估、验证计划以及建议的提交信息。
17
-
18
- 变更文件:
19
- {list}`,workspaceCommitMessagePrompt:`请为当前的 Git 变更生成一条简洁的 Conventional Commit 提交信息。包含一行标题,必要时可附带简短的正文。
20
-
21
- 变更文件:
22
- {list}`,unknown:`未知`,webPreview:`网页预览`,artifactPreview:`产物`,artifactPreviewFiles:`显示产物文件`,artifactPreviewEmpty:`没有可预览的产物文件。`,artifactPreviewLoadFailed:`加载产物预览失败。`,artifactPreviewUnsupported:`暂不支持预览此文件`,artifactPreviewUnsupportedDescription:`当前文件类型无法在浏览器中直接展示,请使用对应应用打开;如支持阅读模式,也可在 Reader 中查看。`,previewChecking:`正在检查预览…`,previewErrorNotFoundTitle:`找不到文件`,previewErrorNotFoundDescription:`文件可能已被删除、移动或重命名,请检查路径后重试。`,previewErrorTooLargeTitle:`文件过大,无法预览`,previewErrorTooLargeDescription:`该文件超过浏览器预览大小限制,请使用其他应用打开。`,previewErrorPermissionTitle:`无法访问此文件`,previewErrorPermissionDescription:`该路径受到限制,或 QuickForge 没有读取权限。`,previewErrorServiceTitle:`预览服务暂不可用`,previewErrorServiceDescription:`QuickForge 无法准备此预览,请检查本地服务后重试。`,previewErrorUnknownTitle:`无法预览此文件`,previewErrorUnknownDescription:`准备预览时发生未知错误,你可以重试或展开下方详情进行排查。`,previewErrorDetails:`错误详情`,previewErrorStatusCode:`状态码`,previewErrorCode:`错误代码`,previewErrorFilePath:`文件路径`,previewErrorRawMessage:`原始报错`,artifactPreviewViewSource:`查看源码`,artifactPreviewPin:`固定产物工具`,artifactPreviewUnpin:`取消固定产物工具`,artifacts:`产物`,previewArtifact:`预览产物`,previewUrl:`预览地址`,previewUrlPlaceholder:`输入 URL`,openPreview:`打开`,refreshPreview:`刷新预览`,openInBrowser:`在浏览器中打开`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,resetZoom:`重置缩放`,invalidPreviewUrl:`请输入有效的 http:// 或 https:// 地址。`,noPreviewUrlTitle:`开始浏览`,noPreviewUrlDescription:`输入 URL 以打开页面`,workspaceStatusAdded:`新增`,workspaceStatusDeleted:`删除`,workspaceStatusRenamed:`重命名`,workspaceStatusUntracked:`未跟踪`,workspaceStatusConflict:`冲突`,workspaceStatusModified:`修改`,copyPath:`复制路径`,copyContent:`复制内容`,copyFileContent:`复制文件内容`,copyDiffContent:`复制差异内容`,readerMoreActions:`更多文件操作`,readerOpen:`打开`,enableWordWrap:`启用自动换行`,showFileNavigation:`显示文件导航`,hideFileNavigation:`隐藏文件导航`,askAiAboutThis:`就此询问 AI`,readerFileMarkdownPrompt:"请阅读当前工作空间中的 Markdown 文档 `{path}`。总结其用途、关键章节、重要说明、过时或有风险的部分,并给出简洁的改进建议。",readerFilePrompt:"请检查当前工作空间中的 `{path}`,说明它的作用、重要的实现细节,以及任何风险或改进机会。",readerDiffPrompt:"请审查 `{path}` 的工作区变更。总结改了什么,指出可能的 bug 或回归,并给出有针对性的验证步骤。",openingReader:`打开中...`,markdownPreview:`预览`,markdownSource:`源码`,viewMarkdownSource:`查看源代码`,returnToMarkdownPreview:`返回预览`,lanAccess:`局域网访问`,lanAccessDescription:`允许同一局域网内可信设备在输入密码后访问完整 QuickForge。`,lanAccessRiskWarning:`高风险:通过密码的局域网设备可以访问你的对话、项目和可用工具。请只在可信网络中开启。`,lanAccessStatus:`局域网访问状态`,lanAccessEnabled:`完整局域网访问`,lanAccessEnabledDescription:`当前是否允许局域网设备完整访问 QuickForge。`,lanAccessPassword:`访问密码`,lanAccessPasswordStatusDescription:`局域网登录使用的密码状态。`,lanAccessActiveDevices:`已登录设备({count})`,lanAccessActiveDevicesDescription:`当前仍有访问权限、可以踢出的局域网设备;使用不同浏览器时,同一设备可能出现多次。`,lanAccessBrowser:`浏览器`,lanAccessUnknownDevice:`局域网设备`,lanAccessUnknownAddress:`未知地址`,lanAccessSignedInAt:`登录于 {time}`,lanAccessExpiresAt:`到期于 {time}`,lanAccessNoActiveDevices:`当前没有保持登录状态的局域网设备。`,lanAccessRevokeDevice:`踢出`,lanAccessRevokeDeviceConfirm:`确定踢出 {device} 吗?该会话需要重新输入局域网密码。`,lanAccessDeviceRevoked:`所选局域网会话已退出登录。`,lanAccessUrls:`局域网地址`,lanAccessUrlsDescription:`在同一可信网络的其他设备上打开这些地址访问。`,lanAccessAllowFull:`允许局域网设备访问完整 QuickForge`,lanAccessAllowFullDescription:`仅在可信网络开启;通过密码的局域网设备可使用完整应用。`,lanAccessPasswordPlaceholder:`至少 8 个字符`,lanAccessPasswordPlaceholderConfigured:`留空则保留当前密码`,showPassword:`显示密码`,hidePassword:`隐藏密码`,lanAccessSessionTtl:`登录有效期`,lanAccessSessionTtlDescription:`局域网设备输入密码后保持登录的时间。`,lanAccessActions:`操作`,lanAccessActionsDescription:`保存访问设置,或让所有局域网设备退出登录。`,lanAccessRevokeAll:`踢掉所有局域网设备`,lanAccessRevokeAllConfirm:`确定要让所有已解锁的局域网设备退出登录吗?`,lanAccessEnableConfirm:`确定开启完整局域网访问吗?请仅在可信网络中继续。`,lanAccessPasswordRequired:`开启局域网访问前请先设置访问密码。`,lanAccessPasswordTooShort:`访问密码至少需要 8 个字符。`,lanAccessSaved:`局域网访问设置已保存。`,lanAccessRevoked:`所有局域网设备已退出登录。`,enabled:`已开启`,disabled:`已关闭`,configured:`已设置`,notConfigured:`未设置`,generatePassword:`生成密码`,hour:`小时`,hours:`小时`,days:`天`,toolApprovalWaiting:`等待审批:{toolName}`,autoCompactApprovalWaiting:`上下文已达到 {percent}%(阈值 {threshold}%),是否现在压缩?`,autoCompactApprovalPreview:`QuickForge 会总结较早历史,并使用摘要加最近 {keepRecentTurns} 个用户回合继续任务。完整聊天历史仍会保留在界面中。`,autoCompactFailed:`自动上下文压缩失败,将继续使用当前历史。`,contextCompactedTimelineLabel:`较早上下文已整理为摘要供模型使用`,contextCompactedLabel:`已压缩上下文`,contextCompactedTooltip:`此对话的模型请求正在使用摘要上下文,完整聊天历史仍会保留在界面中。`,contextCompactedViewSummary:`查看摘要`,contextCompactedHideSummary:`收起摘要`,contextCompactedSummaryTitle:`模型正在使用的压缩摘要`,contextCompactedCopySummary:`复制摘要`,toolApprovalAccept:`✓ 允许`,toolApprovalReject:`✗ 拒绝`,toolApprovalTimeout:`超时时间`,toolApprovalTruncated:`...(内容已截断)`,processed:`已处理`,processing:`处理中`,processExecuted:`已执行`,processExecuting:`执行中`,processGroupToolsCalled:`{count} 个工具调用`,processGroupCommandsRan:`{count} 条命令`,processGroupFilesEdited:`编辑 {count} 个文件`,processFailed:`处理出错`,processAborted:`已中止`,processDurationSeconds:`{seconds}秒`,processDurationMinutesSeconds:`{minutes}分 {seconds}秒`,processThinking:`思考过程`,processCommandsRan:`运行了 {count} 个命令`,processFilesEdited:`编辑了 {count} 个文件`,processToolsCalled:`调用了 {count} 项工具`,processToolsFailedCount:`{count} 项失败`,expandProcess:`展开处理详情`,collapseProcess:`收起处理详情`,expandProcessTools:`展开工具执行记录`,collapseProcessTools:`收起工具执行记录`,relativeMinuteShort:`{count}分`,relativeHourShort:`{count}小时`,relativeDayShort:`{count}天`,relativeWeekShort:`{count}周`,relativeYearShort:`{count}年`}},Ze={...Me.en,"Configure API keys for LLM providers. Keys are stored locally in your browser.":`Configure API keys for LLM providers. Keys are stored by the local QuickForge service on this machine.`,"Settings are stored locally in your browser":`Settings are stored by the local QuickForge service on this machine`,"Storage Permission Required":`Local Service Required`,"This app needs persistent storage to save your conversations":`This app needs the local QuickForge service to save your conversations`,"Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.":`QuickForge saves data to local files through the local service on this machine so your chat history is preserved.`,"Your conversations will be saved locally in your browser":`Your conversations will be saved to local files by the local QuickForge service`,"Cloud LLM providers with predefined models. API keys are stored locally in your browser.":`Cloud LLM providers with predefined models. API keys are stored by the local QuickForge service on this machine.`},Qe={...Me.en,Free:`免费`,"Input Required":`需要输入`,Cancel:`取消`,Confirm:`确认`,"Select Model":`选择模型`,"Search models...":`搜索模型...`,Format:`格式`,Thinking:`思考`,Vision:`视觉`,You:`你`,Assistant:`助手`,"Thinking...":`正在思考...`,"Type your message...":`输入你的消息...`,"API Keys Configuration":`API Key 配置`,"Configure API keys for LLM providers. Keys are stored locally in your browser.":`配置 LLM 提供商的 API Key。密钥会由本机 QuickForge 本地服务保存。`,Configured:`已配置`,"Not configured":`未配置`,"✓ Valid":`✓ 有效`,"✗ Invalid":`✗ 无效`,"Testing...":`测试中...`,Update:`更新`,Test:`测试`,Remove:`移除`,Save:`保存`,"Update API key":`更新 API Key`,"Enter API key":`输入 API Key`,"Type a message...":`输入消息...`,"Failed to fetch file":`获取文件失败`,"Invalid source type":`无效的来源类型`,PDF:`PDF`,Document:`文档`,Presentation:`演示文稿`,Spreadsheet:`电子表格`,Text:`文本`,"Error loading file":`加载文件出错`,"No text content available":`没有可用的文本内容`,"Failed to load PDF":`加载 PDF 失败`,"Failed to load document":`加载文档失败`,"Failed to load spreadsheet":`加载电子表格失败`,"Error loading PDF":`加载 PDF 出错`,"Error loading document":`加载文档出错`,"Error loading spreadsheet":`加载电子表格出错`,"Preview not available for this file type.":`此文件类型不支持预览。`,"Click the download button above to view it on your computer.":`点击上方下载按钮在电脑上查看。`,"No content available":`没有可用内容`,"Failed to display text content":`显示文本内容失败`,"API keys are required to use AI models. Get your keys from the provider's website.":`使用 AI 模型需要 API Key。请从提供商网站获取。`,console:`控制台`,"Copy output":`复制输出`,"Copied!":`已复制!`,"Error:":`错误:`,"Request aborted":`请求已中止`,Call:`调用`,Result:`结果`,"(no result)":`(无结果)`,"Waiting for tool result…":`等待工具结果…`,"Call was aborted; no result.":`调用已中止,没有结果。`,"No session available":`没有可用会话`,"No session set":`未设置会话`,"Preparing tool parameters...":`正在准备工具参数...`,"(no output)":`(无输出)`,Input:`输入`,Output:`输出`,"Writing expression...":`正在写入表达式...`,"Waiting for expression...":`等待表达式...`,Calculating:`计算中`,"Getting current time in":`正在获取当前时间:`,"Getting current date and time":`正在获取当前日期和时间`,"Waiting for command...":`等待命令...`,"Writing command...":`正在写入命令...`,"Running command...":`正在运行命令...`,"Command failed:":`命令失败:`,"Enter Auth Token":`输入认证令牌`,"Please enter your auth token.":`请输入你的认证令牌。`,"Execution aborted":`执行已中止`,"Code parameter is required":`需要代码参数`,"Unknown error":`未知错误`,"Code executed successfully (no output)":`代码执行成功(无输出)`,"Execution failed":`执行失败`,"JavaScript REPL":`JavaScript REPL`,"JavaScript code to execute":`要执行的 JavaScript 代码`,"Writing JavaScript code...":`正在写入 JavaScript 代码...`,"Executing JavaScript":`正在执行 JavaScript`,"Preparing JavaScript...":`正在准备 JavaScript...`,"Preparing command...":`正在准备命令...`,"Preparing calculation...":`正在准备计算...`,"Preparing tool...":`正在准备工具...`,"Getting time...":`正在获取时间...`,"Processing artifact...":`正在处理产物...`,"Preparing artifact...":`正在准备产物...`,"Processing artifact":`正在处理产物`,"Processed artifact":`已处理产物`,"Creating artifact":`正在创建产物`,"Created artifact":`已创建产物`,"Updating artifact":`正在更新产物`,"Updated artifact":`已更新产物`,"Rewriting artifact":`正在重写产物`,"Rewrote artifact":`已重写产物`,"Getting artifact":`正在获取产物`,"Got artifact":`已获取产物`,"Deleting artifact":`正在删除产物`,"Deleted artifact":`已删除产物`,"Getting logs":`正在获取日志`,"Got logs":`已获取日志`,"An error occurred":`发生错误`,"Copy logs":`复制日志`,"Autoscroll enabled":`已启用自动滚动`,"Autoscroll disabled":`已关闭自动滚动`,Processing:`处理中`,Create:`创建`,Rewrite:`重写`,Get:`获取`,Delete:`删除`,"Get logs":`获取日志`,"Show artifacts":`显示产物`,"Close artifacts":`关闭产物`,Artifacts:`产物`,"Copy HTML":`复制 HTML`,"Download HTML":`下载 HTML`,"Reload HTML":`重新加载 HTML`,"Copy SVG":`复制 SVG`,"Download SVG":`下载 SVG`,"Copy Markdown":`复制 Markdown`,"Download Markdown":`下载 Markdown`,Download:`下载`,"No logs for {filename}":`{filename} 没有日志`,"API Keys Settings":`API Key 设置`,Settings:`设置`,"API Keys":`API Key`,"Settings are stored locally in your browser":`设置会由本机 QuickForge 本地服务保存`,Clear:`清除`,"API Key Required":`需要 API Key`,"Enter your API key for {provider}":`输入 {provider} 的 API Key`,Off:`关闭`,Minimal:`最小`,Low:`低`,Medium:`中`,High:`高`,"Storage Permission Required":`需要本地服务`,"This app needs persistent storage to save your conversations":`此应用需要 QuickForge 本地服务来保存你的对话`,"Why is this needed?":`为什么需要?`,"Without persistent storage, your browser may delete saved conversations when it needs disk space. Granting this permission ensures your chat history is preserved.":`QuickForge 会通过本机本地服务把数据保存到本地文件中,确保聊天历史可持久保留。`,"What this means:":`这意味着:`,"Your conversations will be saved locally in your browser":`你的对话会由本机 QuickForge 本地服务保存到本地文件`,"Data will not be deleted automatically to free up space":`数据不会被自动删除来释放空间`,"You can still manually clear data at any time":`你仍然可以随时手动清除数据`,"No data is sent to external servers":`不会向外部服务器发送数据`,"Continue Anyway":`仍然继续`,"Requesting...":`请求中...`,"Grant Permission":`授予权限`,Sessions:`会话`,"Load a previous conversation":`加载之前的对话`,"No sessions yet":`暂无会话`,"Delete this session?":`删除此会话?`,Today:`今天`,Yesterday:`昨天`,"{days} days ago":`{days} 天前`,messages:`条消息`,tokens:`tokens`,"Drop files here":`将文件拖到这里`,"Providers & Models":`提供商与模型`,"Cloud Providers":`云提供商`,"Cloud LLM providers with predefined models. API keys are stored locally in your browser.":`带有预定义模型的云 LLM 提供商。API Key 会由本机 QuickForge 本地服务保存。`,"Custom Providers":`自定义提供商`,"User-configured servers with auto-discovered or manually defined models.":`用户配置的服务器,支持自动发现或手动定义模型。`,"Add Provider":`添加提供商`,"No custom providers configured. Click 'Add Provider' to get started.":`尚未配置自定义提供商。点击"添加提供商"开始。`,Models:`模型`,"auto-discovered":`自动发现`,Refresh:`刷新`,Edit:`编辑`,"Are you sure you want to delete this provider?":`确定删除这个提供商吗?`,"Edit Provider":`编辑提供商`,"Provider Name":`提供商名称`,"e.g., My Ollama Server":`例如:我的 Ollama 服务`,"Provider Type":`提供商类型`,"Base URL":`Base URL`,"e.g., http://localhost:11434":`例如:http://localhost:11434`,"API Key (Optional)":`API Key(可选)`,"Leave empty if not required":`不需要可以留空`,"Test Connection":`测试连接`,Discovered:`已发现`,models:`个模型`,and:`以及`,more:`更多`,"For manual provider types, add models after saving the provider.":`手动提供商类型需要保存提供商后再添加模型。`,"Please fill in all required fields":`请填写所有必填项`,"Failed to save provider":`保存提供商失败`,"OpenAI Completions Compatible":`OpenAI Completions 兼容`,"OpenAI Responses Compatible":`OpenAI Responses 兼容`,"Anthropic Messages Compatible":`Anthropic Messages 兼容`,"Checking...":`检查中...`,Disconnected:`未连接`,"*":`*`,Copy:`复制`,"Copy code":`复制代码`,Close:`关闭`,Preview:`预览`,Code:`代码`,"Loading...":`加载中...`,"Select an option":`选择一个选项`,"Mode 1":`模式 1`,"Mode 2":`模式 2`,Required:`必填`,Optional:`可选`},$e=et();function et(){return typeof navigator<`u`&&navigator.language.toLowerCase().startsWith(`zh`)?`zh`:`en`}function tt(e){return typeof e==`string`&&Ye.includes(e)}function nt(e){typeof document>`u`||(document.documentElement.lang=e===`zh`?`zh-CN`:`en`,document.documentElement.dir=`ltr`)}function rt(e){let t=e===`zh`?Qe:Ze;for(let e of Object.keys(Me))Me[e]=t}function it(e){$e=e,rt(e),nt(e)}Me.zh=Qe,it($e);function at(){return $e}function H(e,t){let n=Xe[at()][e]??Xe.en[e];if(!t)return n;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,String(r));return n}function ot(){return at()===`zh`?`zh-CN`:`en-US`}async function st(e){let t=await e.settings.get(Je),n=tt(t)?t:et();return tt(t)||await e.settings.set(Je,n),it(n),n}async function U(e,t){return t===at()?!1:(await e.settings.set(Je,t),it(t),window.location.reload(),!0)}var ct=new Set([`off`,`low`,`medium`,`high`,`xhigh`]),lt=[{value:`off`,label:()=>Ne(`Off`)},{value:`low`,label:()=>Ne(`Low`)},{value:`medium`,label:()=>Ne(`Medium`)},{value:`high`,label:()=>Ne(`High`)},{value:`xhigh`,label:()=>at()===`zh`?`极高`:`XHigh`}];function ut(e){return typeof e==`string`&&ct.has(e)}function dt(e){return Array.from(e.querySelectorAll(`.flex.gap-2.items-center`)).find(e=>e.querySelector(`button[role="combobox"]`)||e.querySelector(`[data-quickforge-thinking-selector]`))}function ft(e,t){Ee(He({value:ut(t.thinkingLevel)?t.thinkingLevel:`off`,placeholder:Ne(`Off`),options:lt.map(e=>({value:e.value,label:e.label(),icon:Ie(Pe,`sm`)})),onChange:e=>{let n=ut(e)?e:`off`;t.thinkingLevel=n,t.onThinkingChange?.(n),t.requestUpdate?.()},width:`80px`,size:`sm`,variant:`ghost`,fitContent:!0}),e)}function pt(e){let t=e;ut(t.thinkingLevel)||(t.thinkingLevel=`off`,t.onThinkingChange?.(`off`));let n=dt(e);if(!n)return;let r=n.querySelector(`[data-quickforge-thinking-selector]`);if(r){ft(r,t);return}let i=n.querySelector(`button[role="combobox"]`);if(!i)return;i.style.display=`none`,i.setAttribute(`aria-hidden`,`true`);let a=document.createElement(`span`);a.dataset.quickforgeThinkingSelector=`true`,i.insertAdjacentElement(`afterend`,a),ft(a,t)}function mt(e={}){let{hideSelector:t=!1}=e,n=()=>{let e=customElements.get(`message-editor`);if(!e?.prototype.render||e.prototype.render.__quickforgePatched)return;let n=e.prototype.render;e.prototype.render=function(){let e=n.call(this);return queueMicrotask(()=>{if(t){let e=this;e.showThinkingSelector!==!1&&(e.showThinkingSelector=!1,e.requestUpdate?.());return}pt(this)}),e},e.prototype.render.__quickforgePatched=!0};if(customElements.get(`message-editor`)){n();return}customElements.whenDefined(`message-editor`).then(n).catch(()=>{})}function ht(e){return new Promise((t,n)=>{let r=document.createElement(`textarea`);r.value=e,r.style.position=`fixed`,r.style.left=`-9999px`,r.style.top=`-9999px`,r.style.opacity=`0`,document.body.append(r),r.select();try{document.execCommand(`copy`)?t():n(Error(`execCommand("copy") returned false`))}catch(e){n(e)}finally{r.remove()}})}function gt(){navigator.clipboard||Object.defineProperty(navigator,`clipboard`,{value:{writeText:ht,readText:()=>Promise.reject(Error(`Clipboard read is not available in non-secure contexts`)),read:()=>Promise.reject(Error(`Clipboard read is not available in non-secure contexts`)),write:()=>Promise.reject(Error(`Clipboard write is not available in non-secure contexts`))},configurable:!0,enumerable:!0,writable:!1})}var _t=`quickforge:mobile-server-url`,vt=`quickforge:mobile-server-settings:v1`,yt=`quickforgeMobile`,bt=`quickforge:mobile-shell`;function xt(e){let t=e.split(`.`).map(Number);return t.length!==4||t.some(e=>!Number.isInteger(e)||e<0||e>255)?!1:t[0]===100&&t[1]>=64&&t[1]<=127}function St(e){return e.toLowerCase().endsWith(`.ts.net`)}function Ct(e){let t=e.trim();if(!t)throw Error(`请输入 QuickForge 服务地址`);let n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`http://${t}`,r;try{r=new URL(n)}catch{throw Error(`服务地址格式不正确`)}if(r.protocol!==`http:`&&r.protocol!==`https:`)throw Error(`服务地址只支持 HTTP 或 HTTPS`);if(r.username||r.password)throw Error(`服务地址不能包含用户名或密码`);if(!St(r.hostname)&&!xt(r.hostname))throw Error(`该服务器地址不受支持`);if(r.pathname!==`/`||r.search||r.hash)throw Error(`请输入服务根地址,不要附加路径、参数或锚点`);return r.port||=`5176`,r.origin}function wt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)if(typeof n==`string`)try{let e=Ct(n);t.includes(e)||t.push(e)}catch{}return t}function Tt(e=window.localStorage){try{let t=e.getItem(vt);if(t!==null)try{let e=JSON.parse(t),n=wt(e?.urls),r=typeof e?.lastUsedUrl==`string`&&wt([e.lastUsedUrl])[0]||``;return{urls:n,lastUsedUrl:n.includes(r)?r:n[0]||``}}catch{}let n=e.getItem(_t),r=n&&wt([n])[0]||``;return r?{urls:[r],lastUsedUrl:r}:{urls:[],lastUsedUrl:``}}catch{return{urls:[],lastUsedUrl:``}}}function Et(e,t=window.localStorage){let n=wt(e.urls),r=wt([e.lastUsedUrl])[0]||``,i=n.includes(r)?r:n[0]||``;t.setItem(vt,JSON.stringify({urls:n,lastUsedUrl:i})),i?t.setItem(_t,i):t.removeItem(_t)}function Dt(e){let t=new URL(e);return t.searchParams.set(yt,`1`),t.toString()}function Ot(){return Te.isNativePlatform()&&location.hostname===`localhost`}function kt(){if(new URLSearchParams(location.search).get(yt)===`1`){try{window.sessionStorage.setItem(bt,`1`)}catch{}return!0}try{return window.sessionStorage.getItem(bt)===`1`}catch{return!1}}function At(){return![`localhost`,`127.0.0.1`,`::1`].includes(location.hostname)}function jt(){window.location.href=`https://localhost/?connect=1`}function W(...e){return Ae(ke(e))}var G=Se(),Mt=je(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3`,icon:`size-9`}},defaultVariants:{variant:`default`,size:`default`}}),K=V.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,G.jsx)(`button`,{className:W(Mt({variant:t,size:n,className:e})),ref:i,...r}));K.displayName=`Button`;var Nt=class extends V.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){B.error(`ErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null})};handleReload=()=>{window.location.reload()};render(){return this.state.error?this.props.fallback?this.props.fallback:(0,G.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-background p-6 text-foreground`,children:(0,G.jsxs)(`div`,{className:`max-w-md rounded-lg border border-border bg-background p-5 text-center`,children:[(0,G.jsx)(`h1`,{className:`text-base font-medium`,children:H(`errorBoundaryTitle`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground break-all`,children:this.state.error.message||H(`errorBoundaryUnexpected`)}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,G.jsx)(K,{variant:`outline`,size:`sm`,onClick:this.handleRetry,children:H(`errorBoundaryTryAgain`)}),(0,G.jsx)(K,{variant:`default`,size:`sm`,onClick:this.handleReload,children:H(`reloadPage`)})]})]})}):this.props.children}};async function Pt(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}function Ft({open:e,initialPath:n,disabled:r,onOpenChange:i,onSelect:a}){let o=(0,V.useRef)(null),[s,c]=(0,V.useState)([]),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)([]),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(``),C=async e=>{if(e.trim()){v(!0),S(``);try{let t=await Pt(await fetch(`/api/filesystem/directories?path=${encodeURIComponent(e.trim())}`));u(t.path),f(t.path),m(t.parent),g(Array.isArray(t.directories)?t.directories:[])}catch(e){S(e instanceof Error?e.message:H(`directoryLoadFailed`))}finally{v(!1)}}};return(0,V.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{v(!0),S(``);try{let e=await Pt(await fetch(`/api/filesystem/roots`));if(t)return;let r=Array.isArray(e.roots)?e.roots:[];c(r);let i=n||r[0]?.path||``;i&&await C(i)}catch(e){t||S(e instanceof Error?e.message:H(`filesystemRootsFailed`))}finally{t||v(!1)}})(),window.setTimeout(()=>o.current?.focus(),0),()=>{t=!0}},[n,e]),(0,V.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!y&&i(!1)};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[i,e,y]),e?(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onClick:e=>{e.target===e.currentTarget&&!y&&i(!1)},children:(0,G.jsxs)(`div`,{className:`flex max-h-[85vh] w-full max-w-2xl flex-col rounded-lg border border-border bg-background shadow-quickforge`,children:[(0,G.jsxs)(`div`,{className:`border-b border-border p-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:H(`selectProjectDirectory`)}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:H(`selectProjectDirectoryDescription`)})]}),(0,G.jsxs)(`div`,{className:`space-y-4 overflow-y-auto p-4`,children:[s.length>0?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:H(`quickAccess`)}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map(e=>(0,G.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>C(e.path),disabled:_||y,children:e.name},`${e.name}:${e.path}`))})]}):null,(0,G.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),C(d)},children:[(0,G.jsx)(`label`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,htmlFor:`project-path-input`,children:H(`path`)}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{id:`project-path-input`,ref:o,className:W(`min-w-0 flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-sm`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`),value:d,onChange:e=>f(e.target.value),placeholder:H(`folderPickerPathPlaceholder`),disabled:_||y}),(0,G.jsx)(K,{type:`submit`,variant:`outline`,disabled:_||y||!d.trim(),children:H(`go`)})]})]}),x?(0,G.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:x}):null,(0,G.jsxs)(`div`,{className:`rounded-md border border-border`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium`,title:l,children:l||H(`loading`)}),_?(0,G.jsx)(t,{className:`size-4 shrink-0 animate-spin text-muted-foreground`}):null]}),(0,G.jsxs)(`div`,{className:`max-h-80 overflow-y-auto p-1`,children:[p?(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-muted/28 disabled:opacity-50`,onClick:()=>C(p),disabled:_||y,children:[(0,G.jsx)(ve,{className:`size-4 text-muted-foreground`}),(0,G.jsx)(`span`,{children:H(`parentDirectory`)})]}):null,!_&&h.length===0?(0,G.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:H(`noFolders`)}):null,h.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm hover:bg-muted/28 disabled:opacity-50`,onClick:()=>C(e.path),disabled:_||y,title:e.path,children:[(0,G.jsx)(T,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))]})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border p-4`,children:[(0,G.jsx)(K,{type:`button`,variant:`outline`,onClick:()=>i(!1),disabled:y,children:H(`cancel`)}),(0,G.jsx)(K,{type:`button`,onClick:async()=>{let e=d.trim()||l;if(!(!e||y||r)){b(!0),S(``);try{await a(e),i(!1)}catch(e){S(e instanceof Error?e.message:H(`failedToSelectProjectDirectory`))}finally{b(!1)}}},disabled:_||y||r||!(d.trim()||l),children:H(y?`selecting`:`selectThisFolder`)})]})]})}):null}var It=`data:image/svg+xml,%3csvg%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_4363_9194)'%3e%3cpath%20d='M15.9476%205.81836L4.07215%205.8201C1.82284%205.8201%200%207.64352%200%209.89283V21.3994C0%2022.5881%200.519564%2023.718%201.42196%2024.4918L39.5828%2057.2016C40.3212%2057.8341%2041.2614%2058.182%2042.2336%2058.182H54.1091C56.3584%2058.182%2058.1818%2056.3586%2058.1818%2054.1093V42.6009C58.1818%2041.4123%2057.6623%2040.2824%2056.7599%2039.5085L18.599%206.7993C17.8607%206.16629%2016.9204%205.81894%2015.9476%205.81894V5.81836Z'%20fill='%23FF8100'/%3e%3cpath%20d='M14.5193%205.81836H4.07273C1.82342%205.81836%200%207.64178%200%209.89109V22.9837C0%2023.1763%200.0139636%2023.3689%200.0407273%2023.5597L5.31782%2060.5035C5.60465%2062.5101%207.32276%2064.0002%209.34982%2064.0002H25.0228C27.2727%2064.0002%2029.0961%2062.1762%2029.0956%2059.9263L29.0909%2041.3878C29.0909%2040.9503%2029.0205%2040.5157%2028.882%2040.1008L18.3825%208.60294C17.8281%206.9401%2016.2717%205.81836%2014.5187%205.81836H14.5193Z'%20fill='url(%23paint0_linear_4363_9194)'/%3e%3cpath%20d='M59.9275%200H25.9592C24.3301%200%2022.8575%200.971054%2022.2157%202.46807L6.14767%2039.9587C5.93065%2040.4655%205.81836%2041.0118%205.81836%2041.5633V59.9273C5.81836%2062.1766%207.64178%2064%209.89109%2064H27.8571C28.6617%2064%2029.4483%2063.7615%2030.118%2063.3146L62.1866%2041.9113C63.3189%2041.1561%2063.9984%2039.8848%2063.9984%2038.5239L64.0002%204.07273C64.0002%201.82342%2062.1768%200%2059.9275%200Z'%20fill='url(%23paint1_linear_4363_9194)'/%3e%3cpath%20d='M52%2012H12V52H52V12Z'%20fill='black'/%3e%3cpath%20d='M17.0001%2029.3856H19.9789V19.6144H17.0001V17H25.8391V19.6144H22.8603V29.3856H25.8391V32H17.0001V29.3856Z'%20fill='white'/%3e%3cpath%20d='M27.3391%2029.3002H29.4928C29.9282%2029.3002%2030.3161%2029.2074%2030.6553%2029.0218C30.9945%2028.8361%2031.2569%2028.5737%2031.4426%2028.2345C31.6282%2027.8953%2031.721%2027.508%2031.721%2027.072V17H34.646V27.2748C34.646%2028.1749%2034.4386%2028.984%2034.0243%2029.7019C33.6101%2030.4198%2033.0388%2030.9824%2032.31%2031.3892C31.5812%2031.7966%2030.7636%2032%2029.8566%2032H27.3391V29.3002Z'%20fill='white'/%3e%3cpath%20d='M33%2044H17V47H33V44Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_4363_9194'%20x1='-0.717383'%20y1='7.62141'%20x2='24.1455'%20y2='61.2476'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.1'%20stop-color='%23FC801D'/%3e%3cstop%20offset='0.59'%20stop-color='%23FE2857'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_4363_9194'%20x1='4.22243'%20y1='60.0186'%20x2='62.9273'%20y2='1.31316'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.21'%20stop-color='%23FE2857'/%3e%3cstop%20offset='0.7'%20stop-color='%23007EFF'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_4363_9194'%3e%3crect%20width='64'%20height='64'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,Lt=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20256%20256'%20role='img'%20aria-label='File%20Manager'%3e%3cdefs%3e%3clinearGradient%20id='folder-tab'%20x1='28'%20y1='42'%20x2='139'%20y2='99'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23EAA900'/%3e%3cstop%20offset='1'%20stop-color='%23FFD347'/%3e%3c/linearGradient%3e%3clinearGradient%20id='folder-front'%20x1='30'%20y1='86'%20x2='226'%20y2='213'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23FFD85A'/%3e%3cstop%20offset='0.58'%20stop-color='%23FFC32B'/%3e%3cstop%20offset='1'%20stop-color='%23F2A700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='folder-blue'%20x1='75'%20y1='139'%20x2='152'%20y2='207'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%2327A8F7'/%3e%3cstop%20offset='1'%20stop-color='%230068B7'/%3e%3c/linearGradient%3e%3cfilter%20id='folder-shadow'%20x='12'%20y='35'%20width='232'%20height='190'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeDropShadow%20dx='0'%20dy='4'%20stdDeviation='5'%20flood-color='%230F172A'%20flood-opacity='.18'/%3e%3c/filter%3e%3c/defs%3e%3cg%20filter='url(%23folder-shadow)'%3e%3cpath%20fill='url(%23folder-tab)'%20d='M25%2067.7C25%2055.2%2035.2%2045%2047.7%2045h50.8c7.7%200%2014.9%203.8%2019.1%2010.2l9.8%2014.6h80.9c12.5%200%2022.7%2010.2%2022.7%2022.7v15.2H25v-40Z'/%3e%3cpath%20fill='%23D89600'%20d='M25%2092h206v25H25z'%20opacity='.55'/%3e%3cpath%20fill='url(%23folder-front)'%20d='M25%2094.3h206v91C231%20198%20220.7%20208%20208.3%20208H47.7C35.2%20208%2025%20197.8%2025%20185.3v-91Z'/%3e%3cpath%20fill='%23FFE584'%20d='M35%20105h186v18H35z'%20opacity='.35'/%3e%3crect%20width='93'%20height='61'%20x='61'%20y='134'%20fill='url(%23folder-blue)'%20rx='8'/%3e%3cpath%20fill='%230B5FA9'%20d='M70%20151h75v8H70zm0%2018h60v8H70z'%20opacity='.95'/%3e%3cpath%20fill='%2372C7FF'%20d='M71%20143h72a5%205%200%200%201%205%205v2H66v-2a5%205%200%200%201%205-5Z'%20opacity='.55'/%3e%3c/g%3e%3c/svg%3e`,Rt=`/assets/vscode-C_7wk1WI.svg`,zt=`quickforge:project-open-target`;function Bt(){if(typeof window>`u`)return`vscode`;let e=window.localStorage.getItem(zt);return e===`explorer`||e===`idea`?e:`vscode`}function Vt({project:e,disabled:t,disabledTargets:n,targetDisabledLabel:i,onOpenInExplorer:a,onOpenInVSCode:o,onOpenInIDEA:s}){let[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(Bt),f=(0,V.useRef)(null),p=t||!e?.id,m=!!n?.[u],h=u===`explorer`?Lt:u===`idea`?It:Rt,g=m&&i?i:H(u===`explorer`?`openInExplorer`:u===`idea`?`openInIDEA`:`openInVSCode`);(0,V.useEffect)(()=>{if(!c)return;let e=e=>{f.current?.contains(e.target)||l(!1)},t=e=>{e.key===`Escape`&&l(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[c]);let _=e=>{d(e),window.localStorage.setItem(zt,e),l(!1)};return(0,G.jsxs)(`div`,{ref:f,className:`relative shrink-0`,children:[(0,G.jsxs)(`div`,{className:W(`inline-flex h-8 overflow-hidden rounded-xl border border-[color-mix(in_oklab,var(--border)_38%,transparent)] bg-background/90 text-foreground transition-colors`,c&&`border-[color-mix(in_oklab,var(--border)_50%,transparent)] bg-background`,p&&`opacity-50`),children:[(0,G.jsx)(`button`,{type:`button`,className:`flex h-full w-8 items-center justify-center bg-background/90 transition-colors hover:bg-muted/25 disabled:pointer-events-none`,disabled:p||m,onClick:()=>{if(e){if(u===`explorer`){a(e);return}if(u===`idea`){s(e);return}o(e)}},"aria-label":g,title:g,children:(0,G.jsx)(`img`,{src:h,alt:``,className:`size-4`,draggable:!1})}),(0,G.jsx)(`button`,{type:`button`,className:`flex h-full w-7 items-center justify-center border-l border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-muted/18 transition-colors hover:bg-muted/35 disabled:pointer-events-none`,disabled:p,onClick:()=>l(e=>!e),"aria-label":H(`chooseWorkspaceOpenTarget`),title:H(`chooseWorkspaceOpenTarget`),"aria-haspopup":`menu`,"aria-expanded":c,children:(0,G.jsx)(b,{className:W(`size-3.5 text-muted-foreground/85 transition-transform`,c&&`rotate-180 text-foreground/85`)})})]}),c&&e?(0,G.jsxs)(`div`,{className:`absolute right-0 top-10 z-50 w-52 overflow-hidden rounded-2xl border border-[color-mix(in_oklab,var(--border)_38%,transparent)] bg-popover py-1.5 text-popover-foreground shadow-quickforge`,role:`menu`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex h-10 w-full items-center gap-3 px-3 text-left text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground`,onClick:()=>_(`explorer`),role:`menuitem`,children:[(0,G.jsx)(`img`,{src:Lt,alt:``,className:`size-5 shrink-0`,draggable:!1}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:H(`fileManager`)}),u===`explorer`?(0,G.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground`}):null]}),(0,G.jsxs)(`button`,{type:`button`,className:`flex h-10 w-full items-center gap-3 px-3 text-left text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>_(`vscode`),disabled:!!n?.vscode,title:n?.vscode?i:void 0,role:`menuitem`,children:[(0,G.jsx)(`img`,{src:Rt,alt:``,className:`size-5 shrink-0`,draggable:!1}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`VS Code`}),u===`vscode`?(0,G.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground`}):null]}),(0,G.jsxs)(`button`,{type:`button`,className:`flex h-10 w-full items-center gap-3 px-3 text-left text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>_(`idea`),disabled:!!n?.idea,title:n?.idea?i:void 0,role:`menuitem`,children:[(0,G.jsx)(`img`,{src:It,alt:``,className:`size-5 shrink-0`,draggable:!1}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`IntelliJ IDEA`}),u===`idea`?(0,G.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground`}):null]})]}):null]})}var Ht=class extends Oe{static properties={label:{type:String}};_open=!1;_popover=null;_hoverTimer;createRenderRoot(){return this}_clearHoverTimer(){this._hoverTimer&&=(clearTimeout(this._hoverTimer),void 0)}_openPopover(){this._clearHoverTimer(),!this._open&&(this._open=!0,this._renderPopover(),this._updateTriggerAria())}_closePopover(){this._clearHoverTimer(),this._open&&(this._open=!1,this._removePopover(),this._updateTriggerAria())}_togglePopover(){this._clearHoverTimer(),this._open?this._closePopover():this._openPopover()}_updateTriggerAria(){this.querySelector(`.quickforge-info-tip-trigger`)?.setAttribute(`aria-expanded`,this._open?`true`:`false`)}_renderPopover(){if(this._removePopover(),!this.label)return;let e=this.querySelector(`.quickforge-info-tip-trigger`);if(!e)return;let t=document.createElement(`div`);t.className=`quickforge-info-tip-popover`,t.setAttribute(`role`,`tooltip`),t.textContent=this.label,document.body.appendChild(t),this._popover=t,this._positionPopover(e,t)}_positionPopover(e,t){let n=e.getBoundingClientRect(),{width:r,height:i}=t.getBoundingClientRect(),a=n.left;a+r>window.innerWidth-8&&(a=window.innerWidth-r-8),a<8&&(a=8);let o=n.bottom+6;if(o+i>window.innerHeight-8){let e=n.top-6-i;o=e>8?e:n.bottom+6}t.style.top=`${Math.round(o)}px`,t.style.left=`${Math.round(a)}px`}_removePopover(){this._popover&&=(this._popover.remove(),null)}_handleEnter=()=>{this._clearHoverTimer(),this._hoverTimer=setTimeout(()=>this._openPopover(),150)};_handleLeave=()=>{this._clearHoverTimer(),this._hoverTimer=setTimeout(()=>this._closePopover(),120)};_handleFocus=()=>{this._clearHoverTimer(),this._openPopover()};_handleOutsidePointerDown=e=>{if(!this._open)return;let t=e.target;t&&(this.contains(t)||this._popover?.contains(t))||this._closePopover()};_handleKeyDown=e=>{!this._open||e.key!==`Escape`||(e.preventDefault(),e.stopPropagation(),this._closePopover())};_handleScrollOrResize=()=>{if(!this._open)return;let e=this.querySelector(`.quickforge-info-tip-trigger`);e&&this._popover&&this._positionPopover(e,this._popover)};connectedCallback(){super.connectedCallback(),document.addEventListener(`pointerdown`,this._handleOutsidePointerDown,!0),document.addEventListener(`keydown`,this._handleKeyDown,!0),window.addEventListener(`scroll`,this._handleScrollOrResize,!0),window.addEventListener(`resize`,this._handleScrollOrResize)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`pointerdown`,this._handleOutsidePointerDown,!0),document.removeEventListener(`keydown`,this._handleKeyDown,!0),window.removeEventListener(`scroll`,this._handleScrollOrResize,!0),window.removeEventListener(`resize`,this._handleScrollOrResize),this._clearHoverTimer(),this._removePopover()}render(){return De`
23
- <span class="quickforge-info-tip">
24
- <button
25
- type="button"
26
- class="quickforge-info-tip-trigger"
27
- aria-label=${H(`help`)}
28
- aria-expanded="false"
29
- @mouseenter=${this._handleEnter}
30
- @mouseleave=${this._handleLeave}
31
- @focus=${this._handleFocus}
32
- @blur=${this._handleLeave}
33
- @click=${this._togglePopover}
34
- >
35
- <svg
36
- xmlns="http://www.w3.org/2000/svg"
37
- width="14"
38
- height="14"
39
- viewBox="0 0 24 24"
40
- fill="none"
41
- stroke="currentColor"
42
- stroke-width="2"
43
- stroke-linecap="round"
44
- stroke-linejoin="round"
45
- aria-hidden="true"
46
- >
47
- <circle cx="12" cy="12" r="10" />
48
- <path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
49
- <path d="M12 17h.01" />
50
- </svg>
51
- </button>
52
- </span>
53
- `}},Ut=`quickforge-info-tip`;customElements.get(Ut)||customElements.define(Ut,Ht);function Wt({label:e}){return(0,V.createElement)(`quickforge-info-tip`,{label:e})}var Gt=new Set;function Kt(e){return typeof e[Symbol.iterator]==`function`}var q=class{baseUrl;blockedStores;storeOverrides;fakeProviderKeys;constructor(e=``,t=Gt){this.baseUrl=e,Kt(t)?(this.blockedStores=new Set(t),this.storeOverrides={},this.fakeProviderKeys=new Set):(this.blockedStores=new Set(t.blockedStores??Gt),this.storeOverrides=t.storeOverrides??{},this.fakeProviderKeys=new Set(t.fakeProviderKeys??[]))}assertStoreAccess(e){if(this.blockedStores.has(e))throw Error(`This storage area is not available in the current page.`)}static async isAvailable(e=``){let t=new AbortController,n=window.setTimeout(()=>t.abort(),1e3);try{let n=await fetch(`${e}/api/health`,{method:`GET`,cache:`no-store`,signal:t.signal});return n.ok?(await n.json().catch(()=>null))?.ok===!0:!1}catch{return!1}finally{window.clearTimeout(n)}}path(...e){return`${this.baseUrl}/api/storage/${e.map(e=>encodeURIComponent(e)).join(`/`)}`}async request(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.body?{"content-type":`application/json`}:void 0,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`Local storage request failed: ${n.status}`);return r}async get(e,t){if(e===`provider-keys`&&this.fakeProviderKeys.has(t))return`shared-server-managed-key`;let n=this.storeOverrides[e];return n?.get?n.get(t):(this.assertStoreAccess(e),(await this.request(this.path(e,`key`,t))).value??null)}async set(e,t,n){this.assertStoreAccess(e),await this.request(this.path(e,`key`,t),{method:`PUT`,body:JSON.stringify({value:n})})}async delete(e,t){this.assertStoreAccess(e),await this.request(this.path(e,`key`,t),{method:`DELETE`})}async keys(e,t){if(e===`provider-keys`&&this.fakeProviderKeys.size>0)return[...this.fakeProviderKeys];let n=this.storeOverrides[e];if(n?.keys)return n.keys(t);this.assertStoreAccess(e);let r=t?`?prefix=${encodeURIComponent(t)}`:``;return(await this.request(`${this.path(e,`keys`)}${r}`)).keys}async getAllFromIndex(e,t,n=`asc`){return this.assertStoreAccess(e),(await this.request(`${this.path(e,`index`,t)}?direction=${encodeURIComponent(n)}`)).values}async fetchPaginatedFromIndex(e,t,n){this.assertStoreAccess(e);let r=new URLSearchParams;return r.set(`direction`,n.direction||`desc`),r.set(`limit`,String(n.limit)),r.set(`offset`,String(n.offset)),n.scope&&r.set(`scope`,n.scope),n.projectId&&r.set(`projectId`,n.projectId),n.archived&&r.set(`archived`,n.archived),n.pinned&&r.set(`pinned`,n.pinned),this.request(`${this.path(e,`index`,t)}?${r.toString()}`)}async clear(e){this.assertStoreAccess(e),await this.request(this.path(e),{method:`DELETE`})}async has(e,t){if(e===`provider-keys`&&this.fakeProviderKeys.has(t))return!0;let n=this.storeOverrides[e];return n?.has?n.has(t):(this.assertStoreAccess(e),(await this.request(this.path(e,`has`,t))).exists)}async transaction(e,t,n){for(let t of e)t===`provider-keys`&&this.fakeProviderKeys.size>0||this.storeOverrides[t]||this.assertStoreAccess(t);return n({get:(e,t)=>this.get(e,t),set:(e,t,n)=>this.set(e,t,n),delete:(e,t)=>this.delete(e,t)})}async getQuotaInfo(){return this.request(`${this.baseUrl}/api/storage/quota`)}async requestPersistence(){return!0}},qt=`quickforge:model-list-cache:v1`,Jt=1,Yt=600*1e3,Xt=null;function Zt(){if(Xt)return Xt;try{let e=globalThis.localStorage?.getItem(qt);if(!e)return null;let t=JSON.parse(e);return t.v!==Jt||!Array.isArray(t.models)?null:(Xt=t,t)}catch{return null}}function Qt(e=Yt){let t=Zt();return!t||Date.now()-t.cachedAt>e?null:t.models}function $t(){return Zt()?.models??null}function en(e){let t={v:Jt,cachedAt:Date.now(),models:e};Xt=t;try{globalThis.localStorage?.setItem(qt,JSON.stringify(t))}catch{}}function J(){Xt=null;try{globalThis.localStorage?.removeItem(qt)}catch{}}typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key===qt&&(Xt=null)});function Y(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`)crypto.getRandomValues(e);else for(let t=0;t<e.length;t+=1)e[t]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`));return`${t.slice(0,4).join(``)}-${t.slice(4,6).join(``)}-${t.slice(6,8).join(``)}-${t.slice(8,10).join(``)}-${t.slice(10).join(``)}`}function tn(e){return e===!0||e===`true`?`full-access`:`default`}function X(e,t=`default`){return e===`default`||e===`full-access`?e:e===!0||e===`true`?`full-access`:e===!1||e===`false`||t===e?`default`:X(t,`default`)}function nn(e){return e===`full-access`}function rn(e,t){let n=e===`New chat`?H(`newChat`):e,r=t?.trim();return r?`${r} · ${n}`:n}var an=`active-model`,Z=`agent-access-mode`,on=`agent-access-mode-project:`,sn=`yolo-mode`,cn=`yolo-mode-project:`,ln=`default-options`,un={id:`default-litellm-anthropic`,name:`LiteLLM Anthropic`,baseUrl:`http://localhost:4000/v1`,apiKey:``,modelId:`anthropic/claude-sonnet-4`,contextWindow:2e5,maxTokens:8192,supportsImages:!0};function dn(e,t,n=``){let r=e.toLowerCase(),i=t.toLowerCase(),a=n.toLowerCase();return r.includes(`deepseek-v4`)&&(a.includes(`deepseek`)||i.includes(`api.deepseek.com`)||i.includes(`deepseek.com`))}function fn(){return{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:`deepseek`}}var pn={low:`high`,medium:`high`,high:`high`,xhigh:`max`};function mn(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n.includes(`deepseek`)||r.includes(`api.deepseek.com`)||r.includes(`deepseek.com`)?`deepseek`:r.includes(`openrouter.ai`)?`openrouter`:n===`zai`||r.includes(`bigmodel.cn`)||r.includes(`z.ai`)?`zai`:`openai`}function hn(e){let t={...e.compat,...e.reasoning===!0&&e.compat?.supportsReasoningEffort===void 0?{supportsReasoningEffort:!0}:{},thinkingFormat:e.compat?.thinkingFormat??mn(e.provider,e.baseUrl)};return{...e,compat:t}}function gn(e){if(e.api!==`openai-completions`)return e;let t=hn(e);return dn(t.id,t.baseUrl,t.provider)?{...t,reasoning:!0,thinkingLevelMap:{...t.thinkingLevelMap,...pn},compat:{...t.compat,supportsReasoningEffort:!0,...fn()}}:t}function _n(e){let t=e.baseUrl.trim().replace(/\/$/,``),n=e.modelId.trim(),r=e.name.trim(),i=dn(n,t,r),a=e.reasoning===!0||i,o=e.supportsImages===!0?[`text`,`image`]:[`text`];return gn({id:n,name:`${n} (${r})`,api:`openai-completions`,provider:r,baseUrl:t,reasoning:a,input:o,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:Number(e.contextWindow)||un.contextWindow,maxTokens:Number(e.maxTokens)||un.maxTokens,thinkingLevelMap:i?pn:void 0,compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:a,supportsUsageInStreaming:!1,supportsStrictMode:!1,maxTokensField:`max_tokens`,...i?fn():{}}})}function vn(){return{settings:new Ve,providerKeys:new ze,sessions:new Re,customProviders:new Be}}function yn(e,t){e.settings.setBackend(t),e.providerKeys.setBackend(t),e.sessions.setBackend(t),e.customProviders.setBackend(t)}async function bn(e){if(!await q.isAvailable())throw Error(`QuickForge local service is unavailable.`);return new q(``,e)}async function xn(e={}){let t=vn(),n=await bn(e.blockedStores);yn(t,n);let r=new Le(t.settings,t.providerKeys,t.sessions,t.customProviders,n);return Fe(r),r}async function Sn(e,t){await e.settings.set(an,gn(t))}function Cn(e){return e?.reasoning?`medium`:`off`}function wn(e){return e===`off`||e===`low`||e===`medium`||e===`high`||e===`xhigh`}async function Tn(e,t){await e.settings.set(ln,{model:t.model?gn(t.model):void 0,thinkingLevel:wn(t.thinkingLevel)?t.thinkingLevel:void 0})}async function En(e){let t=await e.settings.get(ln);return!t||typeof t!=`object`?{}:{model:t.model?gn(t.model):void 0,thinkingLevel:wn(t.thinkingLevel)?t.thinkingLevel:void 0}}async function Dn(e){let t=await e.settings.get(an);return!t||typeof t!=`object`||!t.id||!t.provider||!t.api||!t.baseUrl?null:gn(t)}function On(e,t){return(e??``).trim().replace(/\/$/,``)===(t??``).trim().replace(/\/$/,``)}function kn(e,t){return e.id===t.id&&e.provider===t.provider&&e.api===t.api&&On(e.baseUrl,t.baseUrl)}function An(e){let t=e;return!!(t?.id&&t.provider&&t.api&&t.baseUrl)}function jn(e){return e.flatMap(e=>e.models??[]).filter(An).map(e=>gn(e))}async function Mn(e){return jn(await e.customProviders.getAll())}async function Nn(e){let t=await Mn(e);if(t.length===0)return null;let n=await Dn(e);if(n){let e=t.find(e=>kn(e,n));if(e)return e}return t[0]}function Pn(e,t){return e.customProviders.getAll().then(e=>{for(let n of e){let e=(n.models??[]).find(e=>e.id===t.id&&e.api===t.api&&e.provider===t.provider&&On(e.baseUrl,t.baseUrl));if(e)return e}})}async function Fn(e,t){try{let n=await Pn(e,t);if(n)return n.reasoning===!0?gn(n):n}catch(e){B.warn(`Failed to resolve configured model:`,e)}return gn(t)}async function In(e,t,n){let r=X(t),i=n?`${on}${n}`:Z;await e.settings.set(i,r);let a=n?`${cn}${n}`:sn;await e.settings.set(a,nn(r))}async function Ln(e,t){if(t){let n=`${on}${t}`,r=await e.settings.get(n);if(r!=null)return X(r);let i=`${cn}${t}`,a=await e.settings.get(i);if(a!=null)return X(a)}let n=await e.settings.get(Z);if(n!=null)return X(n);let r=await e.settings.get(sn);return r==null?(await In(e,`default`),`default`):X(r)}async function Rn(e,t,n){let r=t.id||Y(),i={id:r,name:t.name.trim(),type:`openai-completions`,baseUrl:n.baseUrl,apiKey:t.apiKey.trim()||void 0,models:[n]};return await e.customProviders.set(i),t.apiKey.trim()&&await e.providerKeys.set(n.provider,t.apiKey.trim()),J(),r}var zn=we();function Bn(e,t){let n=document.createElement(`template`);n.innerHTML=t;let r=n.content.firstElementChild;if(!r)return;let i=e.querySelector(`svg`);i?i.replaceWith(r):e.appendChild(r)}function Vn(e,t){let n=document.createElement(`template`);n.innerHTML=t;let r=Array.from(n.content.children);for(let t of Array.from(e.children))t.remove();for(let t of r)e.appendChild(t)}var Hn=()=>({text:``,attachments:[]}),Un=e=>e.text.length>0||(e.attachments?.length??0)>0;function Wn(e){try{return JSON.stringify(e)}catch{return``}}function Gn(e){let t=String(e||``);if(!t)return 0;let n=t.match(/[\u3400-\u9fff\uf900-\ufaff]/g)?.length??0,r=Math.max(0,t.length-n);return Math.ceil(n+r/3.5)}function Kn(e){return e?typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return Kn(e);let t=e;return t.type===`text`?typeof t.text==`string`?t.text:``:t.type===`thinking`?typeof t.thinking==`string`?t.thinking:``:t.type===`image`?`[image:${typeof t.mimeType==`string`?t.mimeType:`unknown`}]`:t.type===`toolCall`?`[toolCall:${typeof t.name==`string`?t.name:`unknown`}] ${Wn(t.arguments)}`:Wn(t)}).filter(Boolean).join(`
54
- `):typeof e==`object`?Wn(e):String(e):``}function qn(e){let t=[e.role??``,Kn(e.content)];return e.toolName&&t.push(e.toolName),e.toolCallId&&t.push(e.toolCallId),e.attachments!==void 0&&t.push(Wn(e.attachments)),Gn(t.filter(Boolean).join(`
55
- `))}function Jn(e,t,n=[]){return Gn(e)+t.reduce((e,t)=>e+qn(t),0)+Gn(Wn(n))}function Yn(e){if(typeof e.timestamp==`number`)return e.timestamp;if(typeof e.timestamp==`string`){let t=Date.parse(e.timestamp);return Number.isNaN(t)?0:t}return 0}function Xn(e){return e.role===`user`&&Kn(e.content).includes(`<compact_summary>`)}function Zn(e){let t=0;for(let n of e)Xn(n)&&(t=Math.max(t,Yn(n)));return t}function Qn(e,t,n,r=[],i){let a=Zn(t),o=t.reduce((e,t)=>{let n=t.usage;return t.role!==`assistant`||!n||a>0&&Yn(t)<=a?e:n},void 0),s=o?.input??o?.totalTokens??0,c=Jn(e,t,r),l=Number.isFinite(Number(s))&&Number(s)>0,u=l?Number(s):c,d=u,f=l?`provider`:`estimated`,p=Math.max(0,Number(i)||4096),m=d+p,h=n>0?Math.round(m/n*1e3)/10:0,g=Math.round(142-142*Math.min(100,Math.max(0,h))/100);return{contextWindow:n,usedTokens:d,totalTokens:m,inputTokens:u,estimatedInputTokens:c,knownInputTokens:l?Number(s):0,inputTokenSource:f,reservedOutputTokens:p,percent:h,color:`hsl(${g} 72% 45%)`}}function $n(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function er(e,t){return e===t?!0:!e||!t||e.gitBranch!==t.gitBranch?!1:!e.context||!t.context?e.context===t.context:e.context.percent===t.context.percent&&e.context.color===t.context.color&&e.context.label===t.context.label&&e.context.title===t.context.title}function tr(e){return`hsl(${Math.round(142-142*Math.min(100,Math.max(0,e))/100)} 72% 45%)`}function nr(e,t){let n=Number(e.inputTokens)||0,r=Math.max(0,Number(e.knownInputTokens??e.providerContextTokens)||0),i=Math.max(0,Number(e.estimatedInputTokens)||0),a=Math.max(0,Number(e.reservedOutputTokens)||0),o=Math.max(0,Number(e.totalTokens)||n+a),s=Number.isFinite(Number(e.percent))?Number(e.percent):0,c=e.inputTokenSource??(r>0?`provider`:`estimated`);return{contextWindow:Math.max(0,Number(e.contextWindow)||t),usedTokens:Math.max(0,Number(e.usedTokens)||n),totalTokens:o,inputTokens:n,estimatedInputTokens:i,knownInputTokens:r,inputTokenSource:c,reservedOutputTokens:a,percent:s,color:e.color||tr(s),isCompacted:e.isCompacted,compactedUpToIndex:e.compactedUpToIndex,originalMessageCount:e.originalMessageCount,effectiveMessageCount:e.effectiveMessageCount,breakdown:e.breakdown}}function rr(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function ir(e){let t=Math.max(0,Number(e)||0);return t>0?$n(t):null}function ar({usage:e,contextWindow:t,serverCalculated:n,compacted:r}){let i=e.inputTokenSource===`provider`?H(`contextUsageSourceProvider`):e.inputTokenSource===`mixed`?H(`contextUsageSourceMixed`):H(`contextUsageSourceEstimated`),a=[H(`contextUsageUsed`,{percent:e.percent,used:$n(e.totalTokens),limit:$n(t)}),H(`contextUsageInput`,{tokens:$n(e.inputTokens),source:i}),H(`contextUsageLocalEstimate`,{tokens:$n(e.estimatedInputTokens)})],o=e.breakdown;return o&&(a.push(H(`contextUsageSystemPrompt`,{tokens:ir(o.systemPromptTokens)??`0`}),H(`contextUsageToolsSchema`,{tokens:ir(o.toolsTokens)??`0`}),H(`contextUsageMessages`,{tokens:ir(o.messagesTokens)??`0`})),(o.providerUsageTokens||o.trailingTokens)&&a.push(H(`contextUsageProviderBaseline`,{tokens:ir(o.providerUsageTokens)??`0`}),H(`contextUsageTrailingMessages`,{tokens:ir(o.trailingTokens)??`0`}))),a.push(H(`contextUsageReservedOutput`,{tokens:$n(e.reservedOutputTokens)})),n&&a.push(H(`contextUsageServerCalculated`)),a.push(H(r?`contextUsageScopeCompacted`:`contextUsageScopeFull`)),r&&e.originalMessageCount!==void 0&&e.effectiveMessageCount!==void 0&&a.push(H(`contextUsageEffectiveMessages`,{effective:e.effectiveMessageCount,visible:e.originalMessageCount})),e.knownInputTokens&&e.knownInputTokens>0&&a.push(H(`contextUsageProviderTokens`,{tokens:$n(e.knownInputTokens)})),a.join(`
56
- `)}function or(){let e=null,t=null,n=null,r=``,i,a=null,o=()=>b(),s=()=>x(),c=()=>v(),l=()=>x(),u=t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),e?y():v())},d=t=>{t.preventDefault(),t.stopPropagation(),e?y():v()},f=()=>{a&&=(a.removeEventListener(`mouseenter`,o),a.removeEventListener(`mouseleave`,s),a.removeEventListener(`focus`,c),a.removeEventListener(`blur`,l),a.removeEventListener(`keydown`,u),a.removeEventListener(`click`,d),null)},p=()=>{i&&=(clearTimeout(i),void 0)},m=()=>{e?.remove(),e=null,t?.setAttribute(`aria-expanded`,`false`),t?.removeAttribute(`aria-describedby`)},h=()=>{if(!t||!e)return;let n=t.getBoundingClientRect(),{width:r,height:i}=e.getBoundingClientRect(),a=n.right-r;a=Math.min(Math.max(12,a),window.innerWidth-r-12);let o=n.top-8-i;o<12&&(o=n.bottom+8),e.style.left=`${Math.round(a)}px`,e.style.top=`${Math.round(o)}px`},g=(e,t,n,r=!1)=>{let i=document.createElement(`div`);i.className=r?`quickforge-context-usage-tip-row is-subtle`:`quickforge-context-usage-tip-row`;let a=document.createElement(`span`);a.textContent=t;let o=document.createElement(`span`);o.textContent=n,i.append(a,o),e.append(i)},_=()=>{if(m(),!t||!n)return;let{usage:r,contextWindow:i,serverCalculated:a,compacted:o}=n,s=document.createElement(`div`);s.className=`quickforge-context-usage-tip`,s.id=`quickforge-context-usage-tip`,s.setAttribute(`role`,`tooltip`);let c=document.createElement(`div`);c.className=`quickforge-context-usage-tip-header`;let l=document.createElement(`span`);l.textContent=H(`contextUsageTitle`);let u=document.createElement(`span`);u.className=`quickforge-context-usage-tip-percent`,u.style.color=r.color,u.textContent=`${r.percent}%`,c.append(l,u);let d=document.createElement(`div`);d.className=`quickforge-context-usage-tip-total`,d.textContent=H(`contextUsageTotal`,{used:$n(r.totalTokens),limit:$n(i)});let f=document.createElement(`div`);f.className=`quickforge-context-usage-tip-section`,g(f,H(`contextUsageInputLabel`),$n(r.inputTokens)),g(f,H(`contextUsageReservedOutputLabel`),$n(r.reservedOutputTokens)),s.append(c,d,f);let p=r.breakdown,_=[[H(`contextUsageSystemPromptLabel`),ir(p?.systemPromptTokens)],[H(`contextUsageToolsSchemaLabel`),ir(p?.toolsTokens)],[H(`contextUsageMessagesLabel`),ir(p?.messagesTokens)]].filter(e=>!!e[1]);if(_.length>0){let e=document.createElement(`div`);e.className=`quickforge-context-usage-tip-section quickforge-context-usage-tip-details`;for(let[t,n]of _)g(e,t,n,!0);s.append(e)}let v=document.createElement(`div`);v.className=`quickforge-context-usage-tip-meta`,v.textContent=`${H(a?`contextUsageSourceServerShort`:`contextUsageSourceLocalShort`)} · ${H(o?`contextUsageScopeCompactedShort`:`contextUsageScopeFullShort`)}`,s.append(v),document.body.append(s),e=s,t.setAttribute(`aria-expanded`,`true`),t.setAttribute(`aria-describedby`,s.id),h()},v=()=>{p(),_()},y=()=>{p(),m()},b=()=>{p(),i=setTimeout(v,150)},x=()=>{p(),i=setTimeout(y,120)},S=n=>{let r=n.target;r&&(t?.contains(r)||e?.contains(r))||y()},C=n=>{n.key!==`Escape`||!e||(n.preventDefault(),y(),t?.focus())},w=()=>{e&&h()};return document.addEventListener(`pointerdown`,S,!0),document.addEventListener(`keydown`,C,!0),window.addEventListener(`scroll`,w,!0),window.addEventListener(`resize`,w),{bind:(i,p)=>{let m=JSON.stringify(p),h=r!==m;n=p,r=m,t===i?e&&h&&_():(f(),t=i,a=i,i.tabIndex=0,i.setAttribute(`role`,`button`),i.setAttribute(`aria-haspopup`,`true`),i.setAttribute(`aria-expanded`,`false`),i.addEventListener(`mouseenter`,o),i.addEventListener(`mouseleave`,s),i.addEventListener(`focus`,c),i.addEventListener(`blur`,l),i.addEventListener(`keydown`,u),i.addEventListener(`click`,d))},close:y,cleanup:()=>{p(),m(),f(),document.removeEventListener(`pointerdown`,S,!0),document.removeEventListener(`keydown`,C,!0),window.removeEventListener(`scroll`,w,!0),window.removeEventListener(`resize`,w)}}}function sr(e,t){if(!t){e.removeAttribute(`role`),e.removeAttribute(`tabindex`),e.style.cursor=``;return}e.setAttribute(`role`,`button`),e.tabIndex=0,e.style.cursor=`pointer`,!e.dataset.quickforgeGitBranchBound&&(e.dataset.quickforgeGitBranchBound=`true`,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t()}),e.addEventListener(`keydown`,e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.stopPropagation(),t())}))}var cr=(0,zn.renderToStaticMarkup)((0,V.createElement)(de,{size:13,strokeWidth:2,"aria-hidden":!0,style:{flex:`0 0 auto`}}));function lr({panel:e,getSystemPrompt:t,getMessages:n,getContextWindow:r,getTools:i,getMaxTokens:a,getEffectiveMessages:o,getServerContextUsage:s,getIsCompacted:c,getGitBranch:l,onGitBranchClick:u,renderInline:d=!0,renderModelRing:f=!1,onDisplayChange:p}){let m=or(),h,g=e=>{er(h,e)||(h=e,p?.(e))};return{update:()=>{let p=r(),h=n(),_=s?.(),v=_?h:o?.()??h,y=e.querySelector(`.quickforge-context-usage`),b=e.querySelector(`.quickforge-context-usage-label`),x=e.querySelector(`.quickforge-git-branch-inline`),S=d?e.querySelector(`message-editor`)?.parentElement?.querySelector(`.ml-auto.items-center`):null,C=f?e.querySelector(`.quickforge-model-trigger`):null,w=C?.parentElement??null,T=l?.()?.trim()||void 0,E={gitBranch:T};if(!d)x?.remove(),b?.remove(),f||y?.remove();else if(T&&S){let e=`${cr}<span style="max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${rr(T)}</span>`,t=`Git branch: ${T}`;if(x)x.dataset.quickforgeGitBranch!==T&&(x.innerHTML=e,x.dataset.quickforgeGitBranch=T),x.title=t,x.setAttribute(`aria-label`,t),sr(x,u);else{let n=document.createElement(`span`);n.className=`quickforge-git-branch-inline`,n.dataset.quickforgeGitBranch=T,n.title=t,n.setAttribute(`aria-label`,t),n.innerHTML=e,n.style.cssText=[`display: inline-flex`,`align-items: center`,`gap: 0.25rem`,`max-width: 10rem`,`color: hsl(var(--muted-foreground))`,`font-size: 12px`,`line-height: 1`,`font-weight: 500`].join(`;`),sr(n,u),S.prepend(n)}}else x?.remove();if(!p)return m.close(),y?.remove(),b?.remove(),g(E),E;let D=v.length>0,O=_?nr(_,p):D?Qn(t(),v,p,i?.()??[],a?.()):{contextWindow:p,usedTokens:0,totalTokens:0,inputTokens:0,estimatedInputTokens:0,inputTokenSource:`estimated`,reservedOutputTokens:0,percent:0,color:`hsl(142 72% 45%)`},k=O.contextWindow||p,ee=!!O.isCompacted||(_?!!c?.():v!==h),A=ar({usage:O,contextWindow:k,serverCalculated:!!_,compacted:ee});if(E.context={percent:O.percent,color:O.color,label:`${O.percent}% · ${$n(O.totalTokens)} / ${$n(k)} tokens`,title:A},g(E),!d&&!f||f&&(!C||!w)||!f&&!S)return y?.remove(),b?.remove(),E;let j=Math.min(100,Math.max(0,O.percent)),M=`conic-gradient(${O.color} ${j*3.6}deg, color-mix(in oklab, var(--muted-foreground) 20%, transparent) 0deg)`,N=y??document.createElement(`span`);if(N.className=`quickforge-context-usage`,N.removeAttribute(`title`),N.setAttribute(`aria-label`,H(`contextUsageAriaLabel`,{percent:O.percent})),N.style.cssText=[`display: inline-flex`,`width: 14px`,`height: 14px`,`flex: 0 0 auto`,`border-radius: 9999px`,`background: ${M}`,`vertical-align: middle`,`mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0)`,`-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0)`].join(`;`),N.replaceChildren(),f&&C&&w)return b?.remove(),(N.parentElement!==w||N.nextElementSibling!==C)&&w.insertBefore(N,C),m.bind(N,{usage:O,contextWindow:k,serverCalculated:!!_,compacted:ee}),E;if(!S)return E;let P=N.nextElementSibling;return P?.classList.contains(`quickforge-context-usage-label`)||(P=document.createElement(`span`),P.className=`quickforge-context-usage-label`,P.style.cssText=`color: hsl(var(--muted-foreground)); font-size: 12px; line-height: 1;`),P.textContent=`${O.percent}%`,P.title=A,P.setAttribute(`aria-label`,A),y?N.nextElementSibling!==P&&N.after(P):(S.prepend(P),S.prepend(N)),E},cleanup:m.cleanup}}function ur({hasProject:e,onConfigureModel:t,onAddProject:n,onCopyExamplePrompt:r,onDismiss:i}){return(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/35 p-3 backdrop-blur-sm sm:p-6`,children:(0,G.jsx)(`div`,{className:`pointer-events-auto w-full max-w-4xl rounded-2xl border border-border bg-background/95 p-5 shadow-quickforge backdrop-blur-md sm:p-6`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`mt-0.5 flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary`,children:(0,G.jsx)(a,{className:`size-5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold text-foreground sm:text-lg`,children:H(`firstUseGuideTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-sm leading-6 text-muted-foreground`,children:H(`firstUseGuideDescription`)})]}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:`-mr-1 -mt-1 size-7 shrink-0`,onClick:i,"aria-label":H(`firstUseGuideDismiss`),children:(0,G.jsx)(se,{className:`size-4`})})]}),(0,G.jsxs)(`div`,{className:`mt-4 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2.5 rounded-xl border border-border/70 bg-muted/15 p-3`,children:[(0,G.jsx)(le,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,G.jsx)(`span`,{children:H(`firstUseGuideStepModel`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2.5 rounded-xl border border-border/70 bg-muted/15 p-3`,children:[(0,G.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,G.jsx)(`span`,{children:H(`firstUseGuideStepProject`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2.5 rounded-xl border border-border/70 bg-muted/15 p-3`,children:[(0,G.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,G.jsx)(`span`,{children:H(`firstUseGuideStepPlan`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2.5`,children:[(0,G.jsxs)(K,{size:`sm`,onClick:t,children:[(0,G.jsx)(le,{className:`size-4`}),H(`firstUseGuideConfigureModel`)]}),(0,G.jsxs)(K,{size:`sm`,variant:e?`outline`:`default`,onClick:n,children:[(0,G.jsx)(w,{className:`size-4`}),H(`firstUseGuideAddProject`)]}),(0,G.jsxs)(K,{size:`sm`,variant:`outline`,onClick:r,children:[(0,G.jsx)(_,{className:`size-4`}),H(`firstUseGuideCopyPrompt`)]}),(0,G.jsx)(K,{size:`sm`,variant:`ghost`,onClick:i,children:H(`firstUseGuideDismiss`)})]})]})]})})})}function dr({onAddModel:e,onUseExample:t}){return(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-xl rounded-xl border border-border bg-background p-6 text-center`,children:[(0,G.jsx)(`div`,{className:`mx-auto flex size-12 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,G.jsx)(a,{className:`size-6`})}),(0,G.jsx)(`h2`,{className:`mt-4 text-lg font-medium text-foreground`,children:H(`modelSetupTitle`)}),(0,G.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:H(`modelSetupDescription`)}),(0,G.jsxs)(`div`,{className:`mt-5 grid gap-3 rounded-xl border border-border bg-muted/20 p-4 text-left text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:H(`modelSetupSupports`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:H(`modelSetupLocalStorage`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex flex-col justify-center gap-3 sm:flex-row`,children:[(0,G.jsxs)(K,{onClick:e,className:`gap-2`,children:[(0,G.jsx)(y,{className:`size-4`}),H(`modelSetupAddModel`)]}),(0,G.jsx)(K,{variant:`outline`,onClick:t,children:H(`modelSetupUseLiteLlmExample`)})]})]})})}var fr=xe();function pr({projects:e,selectedProject:t,onSelectProject:n,onClearProject:i,onNewProject:a,className:o}){let s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(),g=t,_=g?.id,v=(0,V.useMemo)(()=>{let t=f.trim().toLowerCase();return t?e.filter(e=>{let n=e.name.toLowerCase(),r=e.path.toLowerCase();return n.includes(t)||r.includes(t)}):e},[e,f]),y=(0,V.useCallback)(()=>{let e=c.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(350,window.innerWidth-24);h({position:`fixed`,left:Math.min(Math.max(12,t.left),window.innerWidth-n-12),bottom:Math.max(12,window.innerHeight-t.top+10),width:n})},[]);(0,V.useEffect)(()=>{if(!u)return;y();let e=()=>y();return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[u,y]),(0,V.useEffect)(()=>{if(!u)return;let e=e=>{let t=e.target;!s.current?.contains(t)&&!l.current?.contains(t)&&d(!1)},t=e=>{e.key===`Escape`&&d(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[u]);let b=e=>{d(!1),n(e)},x=()=>{d(!1),a()},S={ref:c,role:`button`,tabIndex:0,onClick:(0,V.useCallback)(()=>{d(e=>!e)},[]),onKeyDown:(0,V.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d(e=>!e))},[]),"aria-haspopup":`menu`,"aria-expanded":u},C=u&&m?(0,G.jsxs)(`div`,{ref:l,className:`quickforge-project-picker-popover`,style:m,role:`menu`,children:[(0,G.jsxs)(`label`,{className:`quickforge-project-picker-search`,children:[(0,G.jsx)(D,{className:`size-4`,"aria-hidden":`true`}),(0,G.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:H(`searchProjects`),autoFocus:!0})]}),(0,G.jsx)(`div`,{className:`quickforge-project-picker-list`,children:v.length>0?v.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`quickforge-project-picker-item`,onClick:()=>b(e),role:`menuitem`,children:[(0,G.jsx)(T,{className:`size-4 quickforge-project-picker-item-leading`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name}),_===e.id?(0,G.jsx)(r,{className:`ml-auto size-4`,"aria-hidden":`true`}):null]},e.id)):(0,G.jsx)(`div`,{className:`quickforge-project-picker-empty`,children:H(`noMatchingProjects`)})}),(0,G.jsx)(`div`,{className:`quickforge-project-picker-separator`}),(0,G.jsxs)(`button`,{type:`button`,className:`quickforge-project-picker-item quickforge-project-picker-item-emphasis`,onClick:x,role:`menuitem`,children:[(0,G.jsx)(T,{className:`size-4 quickforge-project-picker-item-leading`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:H(`selectProjectDirectory`)})]})]}):null;return(0,G.jsxs)(`div`,{ref:s,className:W(`quickforge-empty-project-picker`,u?`quickforge-empty-project-picker-open`:void 0,o),children:[(0,G.jsx)(`div`,{className:`quickforge-empty-project-trigger`,children:_?(0,G.jsxs)(`span`,{className:`quickforge-empty-project-chip`,...S,children:[(0,G.jsxs)(`span`,{className:`quickforge-empty-project-chip-action`,children:[(0,G.jsx)(T,{className:`size-3.5 quickforge-empty-project-chip-folder`,"aria-hidden":`true`}),(0,G.jsx)(`button`,{type:`button`,className:`quickforge-empty-project-chip-clear`,onClick:e=>{e.stopPropagation(),d(!1),i()},"aria-label":H(`useNoProject`),title:H(`useNoProject`),children:(0,G.jsx)(se,{className:`size-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(`span`,{className:`truncate`,children:g?.name})]}):(0,G.jsxs)(`span`,{className:`quickforge-empty-project-pill`,...S,children:[(0,G.jsx)(T,{className:`size-4`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:H(`chooseProject`)})]})}),typeof document<`u`?(0,fr.createPortal)(C,document.body):null]})}function mr(){var e=[...arguments];return(0,V.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var hr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function gr(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function _r(e){return`nodeType`in e}function vr(e){return e?gr(e)?e:_r(e)?e.ownerDocument?.defaultView??window:window:window}function yr(e){let{Document:t}=vr(e);return e instanceof t}function br(e){return gr(e)?!1:e instanceof vr(e).HTMLElement}function xr(e){return e instanceof vr(e).SVGElement}function Sr(e){return e?gr(e)?e.document:_r(e)?yr(e)?e:br(e)||xr(e)?e.ownerDocument:document:document:document}var Cr=hr?V.useLayoutEffect:V.useEffect;function wr(e){let t=(0,V.useRef)(e);return Cr(()=>{t.current=e}),(0,V.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Tr(){let e=(0,V.useRef)(null);return[(0,V.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,V.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Er(e,t){t===void 0&&(t=[e]);let n=(0,V.useRef)(e);return Cr(()=>{n.current!==e&&(n.current=e)},t),n}function Dr(e,t){let n=(0,V.useRef)();return(0,V.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Q(e){let t=wr(e),n=(0,V.useRef)(null);return[n,(0,V.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Or(e){let t=(0,V.useRef)();return(0,V.useEffect)(()=>{t.current=e},[e]),t.current}var kr={};function Ar(e,t){return(0,V.useMemo)(()=>{if(t)return t;let n=kr[e]==null?0:kr[e]+1;return kr[e]=n,e+`-`+n},[e,t])}function jr(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Mr=jr(1),Nr=jr(-1);function Pr(e){return`clientX`in e&&`clientY`in e}function Fr(e){if(!e)return!1;let{KeyboardEvent:t}=vr(e.target);return t&&e instanceof t}function Ir(e){if(!e)return!1;let{TouchEvent:t}=vr(e.target);return t&&e instanceof t}function Lr(e){if(Ir(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Pr(e)?{x:e.clientX,y:e.clientY}:null}var Rr=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Rr.Translate.toString(e),Rr.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),zr=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Br(e){return e.matches(zr)?e:e.querySelector(zr)}var Vr={display:`none`};function Hr(e){let{id:t,value:n}=e;return V.createElement(`div`,{id:t,style:Vr},n)}function Ur(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return V.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Wr(){let[e,t]=(0,V.useState)(``);return{announce:(0,V.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Gr=(0,V.createContext)(null);function Kr(e){let t=(0,V.useContext)(Gr);(0,V.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function qr(){let[e]=(0,V.useState)(()=>new Set),t=(0,V.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,V.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Jr={draggable:`
57
- To pick up a draggable item, press the space bar.
58
- While dragging, use the arrow keys to move the item.
59
- Press space again to drop the item in its new position, or press escape to cancel.
60
- `},Yr={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Xr(e){let{announcements:t=Yr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Jr}=e,{announce:a,announcement:o}=Wr(),s=Ar(`DndLiveRegion`),[c,l]=(0,V.useState)(!1);if((0,V.useEffect)(()=>{l(!0)},[]),Kr((0,V.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=V.createElement(V.Fragment,null,V.createElement(Hr,{id:r,value:i.draggable}),V.createElement(Ur,{id:s,announcement:o}));return n?(0,fr.createPortal)(u,n):u}var Zr;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(Zr||={});function Qr(){}function $r(e,t){return(0,V.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function ei(){var e=[...arguments];return(0,V.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var ti=Object.freeze({x:0,y:0});function ni(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ri(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ii(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ai(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function oi(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var si=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=oi(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ni(oi(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ri)};function ci(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var li=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=ci(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ii)};function ui(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function di(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ti}function fi(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var pi=fi(1);function mi(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function hi(e,t,n){let r=mi(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var gi={ignoreTransform:!1};function _i(e,t){t===void 0&&(t=gi);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=vr(e).getComputedStyle(e);t&&(n=hi(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function vi(e){return _i(e,{ignoreTransform:!0})}function yi(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function bi(e,t){return t===void 0&&(t=vr(e).getComputedStyle(e)),t.position===`fixed`}function xi(e,t){t===void 0&&(t=vr(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Si(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(yr(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!br(i)||xr(i)||n.includes(i))return n;let a=vr(e).getComputedStyle(i);return i!==e&&xi(i,a)&&n.push(i),bi(i,a)?n:r(i.parentNode)}return e?r(e):n}function Ci(e){let[t]=Si(e,1);return t??null}function wi(e){return!hr||!e?null:gr(e)?e:_r(e)?yr(e)||e===Sr(e).scrollingElement?window:br(e)?e:null:null}function Ti(e){return gr(e)?e.scrollX:e.scrollLeft}function Ei(e){return gr(e)?e.scrollY:e.scrollTop}function Di(e){return{x:Ti(e),y:Ei(e)}}var Oi;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Oi||={});function ki(e){return!hr||!e?!1:e===document.scrollingElement}function Ai(e){let t={x:0,y:0},n=ki(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var ji={x:.2,y:.2};function Mi(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=ji);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ai(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Oi.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Oi.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Oi.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Oi.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ni(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Pi(e){return e.reduce((e,t)=>Mr(e,Di(t)),ti)}function Fi(e){return e.reduce((e,t)=>e+Ti(t),0)}function Ii(e){return e.reduce((e,t)=>e+Ei(t),0)}function Li(e,t){if(t===void 0&&(t=_i),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Ci(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ri=[[`x`,[`left`,`right`],Fi],[`y`,[`top`,`bottom`],Ii]],zi=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Si(t),r=Pi(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ri)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Bi=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Vi(e){let{EventTarget:t}=vr(e);return e instanceof t?e:Sr(e)}function Hi(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Ui;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Ui||={});function Wi(e){e.preventDefault()}function Gi(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var Ki={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},qi=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},Ji=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Bi(Sr(t)),this.windowListeners=new Bi(vr(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ui.Resize,this.handleCancel),this.windowListeners.add(Ui.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ui.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Li(n),t(ti)}handleKeyDown(e){if(Fr(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ki,coordinateGetter:a=qi,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:ti;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Nr(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Ai(n),p=Ni(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Mr(Nr(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ji.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ki,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Yi(e){return!!(e&&`distance`in e)}function Xi(e){return!!(e&&`delay`in e)}var Zi=class{constructor(e,t,n){n===void 0&&(n=Vi(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Sr(i),this.documentListeners=new Bi(this.document),this.listeners=new Bi(n),this.windowListeners=new Bi(vr(i)),this.initialCoordinates=Lr(r)??ti,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ui.Resize,this.handleCancel),this.windowListeners.add(Ui.DragStart,Wi),this.windowListeners.add(Ui.VisibilityChange,this.handleCancel),this.windowListeners.add(Ui.ContextMenu,Wi),this.documentListeners.add(Ui.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xi(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Yi(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ui.Click,Gi,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ui.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Lr(e)??ti,s=Nr(n,o);if(!t&&a){if(Yi(a)){if(a.tolerance!=null&&Hi(s,a.tolerance))return this.handleCancel();if(Hi(s,a.distance))return this.handleStart()}if(Xi(a)&&Hi(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Qi={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},$i=class extends Zi{constructor(e){let{event:t}=e,n=Sr(t.target);super(e,Qi,n)}};$i.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var ea={move:{name:`mousemove`},end:{name:`mouseup`}},ta;(function(e){e[e.RightClick=2]=`RightClick`})(ta||={});var na=class extends Zi{constructor(e){super(e,ea,Sr(e.event.target))}};na.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ta.RightClick?!1:(r?.({event:n}),!0)}}];var ra={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},ia=class extends Zi{constructor(e){super(e,ra)}static setup(){return window.addEventListener(ra.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ra.move.name,e)};function e(){}}};ia.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var aa;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(aa||={});var oa;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(oa||={});function sa(e){let{acceleration:t,activator:n=aa.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=oa.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=la({delta:d,disabled:!a}),[m,h]=Tr(),g=(0,V.useRef)({x:0,y:0}),_=(0,V.useRef)({x:0,y:0}),v=(0,V.useMemo)(()=>{switch(n){case aa.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case aa.DraggableRect:return i}},[n,i,c]),y=(0,V.useRef)(null),b=(0,V.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,V.useMemo)(()=>s===oa.TreeOrder?[...l].reverse():l,[s,l]);(0,V.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Mi(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var ca={x:{[Oi.Backward]:!1,[Oi.Forward]:!1},y:{[Oi.Backward]:!1,[Oi.Forward]:!1}};function la(e){let{delta:t,disabled:n}=e,r=Or(t);return Dr(e=>{if(n||!r||!e)return ca;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Oi.Backward]:e.x[Oi.Backward]||i.x===-1,[Oi.Forward]:e.x[Oi.Forward]||i.x===1},y:{[Oi.Backward]:e.y[Oi.Backward]||i.y===-1,[Oi.Forward]:e.y[Oi.Forward]||i.y===1}}},[n,t,r])}function ua(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Dr(e=>t==null?null:r??e??null,[r,t])}function da(e,t){return(0,V.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var fa;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(fa||={});var pa;(function(e){e.Optimized=`optimized`})(pa||={});var ma=new Map;function ha(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,V.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,V.useRef)(e),d=g(),f=Er(d),p=(0,V.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,V.useRef)(null),h=Dr(t=>{if(d&&!n)return ma;if(!t||t===ma||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new zi(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,V.useEffect)(()=>{u.current=e},[e]),(0,V.useEffect)(()=>{d||p()},[n,d]),(0,V.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,V.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case fa.Always:return!1;case fa.BeforeDragging:return n;default:return!n}}}function ga(e,t){return Dr(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function _a(e,t){return ga(e,t)}function va(e){let{callback:t,disabled:n}=e,r=wr(t),i=(0,V.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,V.useEffect)(()=>()=>i?.disconnect(),[i]),i}function ya(e){let{callback:t,disabled:n}=e,r=wr(t),i=(0,V.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,V.useEffect)(()=>()=>i?.disconnect(),[i]),i}function ba(e){return new zi(_i(e),e)}function xa(e,t,n){t===void 0&&(t=ba);let[r,i]=(0,V.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=va({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=ya({callback:a});return Cr(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Sa(e){return di(e,ga(e))}var Ca=[];function wa(e){let t=(0,V.useRef)(e),n=Dr(n=>e?n&&n!==Ca&&e&&t.current&&e.parentNode===t.current.parentNode?n:Si(e):Ca,[e]);return(0,V.useEffect)(()=>{t.current=e},[e]),n}function Ta(e){let[t,n]=(0,V.useState)(null),r=(0,V.useRef)(e),i=(0,V.useCallback)(e=>{let t=wi(e.target);t&&n(e=>e?(e.set(t,Di(t)),new Map(e)):null)},[]);return(0,V.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=wi(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Di(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{wi(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,V.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Mr(e,t),ti):Pi(e):ti,[e,t])}function Ea(e,t){t===void 0&&(t=[]);let n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{n.current=null},t),(0,V.useEffect)(()=>{let t=e!==ti;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Nr(e,n.current):ti}function Da(e){(0,V.useEffect)(()=>{if(!hr)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Oa(e,t){return(0,V.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function ka(e){return(0,V.useMemo)(()=>e?yi(e):null,[e])}var Aa=[];function ja(e,t){t===void 0&&(t=_i);let[n]=e,r=ka(n?vr(n):null),[i,a]=(0,V.useState)(Aa);function o(){a(()=>e.length?e.map(e=>ki(e)?r:new zi(t(e),e)):Aa)}let s=ya({callback:o});return Cr(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ma(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return br(t)?t:e}function Na(e){let{measure:t}=e,[n,r]=(0,V.useState)(null),i=ya({callback:(0,V.useCallback)(e=>{for(let{target:n}of e)if(br(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Q((0,V.useCallback)(e=>{let n=Ma(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,V.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Pa=[{sensor:$i,options:{}},{sensor:Ji,options:{}}],Fa={current:{}},Ia={draggable:{measure:vi},droppable:{measure:vi,strategy:fa.WhileDragging,frequency:pa.Optimized},dragOverlay:{measure:_i}},La=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Ra={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new La,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ia,measureDroppableContainers:Qr,windowRect:null,measuringScheduled:!1},za={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Qr,draggableNodes:new Map,over:null,measureDroppableContainers:Qr},Ba=(0,V.createContext)(za),Va=(0,V.createContext)(Ra);function Ha(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new La}}}function Ua(e,t){switch(t.type){case Zr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Zr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Zr.DragEnd:case Zr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zr.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new La(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Zr.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new La(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Zr.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new La(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Wa(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,V.useContext)(Ba),a=Or(r),o=Or(n?.id);return(0,V.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Fr(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Br(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Ga(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Ka(e){return(0,V.useMemo)(()=>({draggable:{...Ia.draggable,...e?.draggable},droppable:{...Ia.droppable,...e?.droppable},dragOverlay:{...Ia.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function qa(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,V.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Cr(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=di(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Ci(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Ja=(0,V.createContext)({...ti,scaleX:1,scaleY:1}),Ya;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Ya||={});var Xa=(0,V.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Pa,collisionDetection:o=li,measuring:s,modifiers:c,...l}=e,[u,d]=(0,V.useReducer)(Ua,void 0,Ha),[f,p]=qr(),[m,h]=(0,V.useState)(Ya.Uninitialized),g=m===Ya.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,V.useRef)({initial:null,translated:null}),C=(0,V.useMemo)(()=>_==null?null:{id:_,data:x?.data??Fa,rect:S},[_,x]),w=(0,V.useRef)(null),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),k=Er(l,Object.values(l)),ee=Ar(`DndDescribedBy`,t),A=(0,V.useMemo)(()=>b.getEnabled(),[b]),j=Ka(s),{droppableRects:M,measureDroppableContainers:N,measuringScheduled:P}=ha(A,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),te=ua(v,_),ne=(0,V.useMemo)(()=>D?Lr(D):null,[D]),F=ke(),I=_a(te,j.draggable.measure);qa({activeNode:_==null?null:v.get(_),config:F.layoutShiftCompensation,initialRect:I,measure:j.draggable.measure});let L=xa(te,j.draggable.measure,I),R=xa(te?te.parentElement:null),re=(0,V.useRef)({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=b.getNodeFor(re.current.over?.id),z=Na({measure:j.dragOverlay.measure}),ae=z.nodeRef.current??te,oe=g?z.rect??L:null,se=!!(z.nodeRef.current&&z.rect),ce=Sa(se?null:L),le=ka(ae?vr(ae):null),ue=wa(g?ie??te:null),de=ja(ue),fe=Ga(c,{transform:{x:y.x-ce.x,y:y.y-ce.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:L,containerNodeRect:R,draggingNodeRect:oe,over:re.current.over,overlayNodeRect:z.rect,scrollableAncestors:ue,scrollableAncestorRects:de,windowRect:le}),pe=ne?Mr(ne,y):null,me=Ta(ue),he=Ea(me),ge=Ea(me,[L]),_e=Mr(fe,he),ve=oe?pi(oe,fe):null,ye=C&&ve?o({active:C,collisionRect:ve,droppableRects:M,droppableContainers:A,pointerCoordinates:pe}):null,be=ai(ye,`id`),[xe,Se]=(0,V.useState)(null),Ce=ui(se?fe:Mr(fe,ge),xe?.rect??null,L),we=(0,V.useRef)(null),Te=(0,V.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;we.current=new n({active:w.current,activeNode:i,event:a,options:r,context:re,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,fr.unstable_batchedUpdates)(()=>{r?.(i),h(Ya.Initializing),d({type:Zr.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(we.current),O(a)})},onMove(e){d({type:Zr.DragMove,coordinates:e})},onEnd:o(Zr.DragEnd),onCancel:o(Zr.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=re.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Zr.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Zr.DragCancel)}w.current=null,(0,fr.unstable_batchedUpdates)(()=>{d({type:e}),h(Ya.Uninitialized),Se(null),E(null),O(null),we.current=null;let t=e===Zr.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ee=da(a,(0,V.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Te(n,t))},[v,Te]));Da(a),Cr(()=>{L&&m===Ya.Initializing&&h(Ya.Initialized)},[L,m]),(0,V.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=re.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:_e.x,y:_e.y},over:i};(0,fr.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[_e.x,_e.y]),(0,V.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=re.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,fr.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),Cr(()=>{re.current={activatorEvent:D,active:C,activeNode:te,collisionRect:ve,collisions:ye,droppableRects:M,draggableNodes:v,draggingNode:ae,draggingNodeRect:oe,droppableContainers:b,over:xe,scrollableAncestors:ue,scrollAdjustedTranslate:_e},S.current={initial:oe,translated:ve}},[C,te,ye,ve,v,ae,oe,M,b,xe,ue,_e]),sa({...F,delta:y,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:ue,scrollableAncestorRects:de});let De=(0,V.useMemo)(()=>({active:C,activeNode:te,activeNodeRect:L,activatorEvent:D,collisions:ye,containerNodeRect:R,dragOverlay:z,draggableNodes:v,droppableContainers:b,droppableRects:M,over:xe,measureDroppableContainers:N,scrollableAncestors:ue,scrollableAncestorRects:de,measuringConfiguration:j,measuringScheduled:P,windowRect:le}),[C,te,L,D,ye,R,z,v,b,M,xe,N,ue,de,j,P,le]),Oe=(0,V.useMemo)(()=>({activatorEvent:D,activators:Ee,active:C,activeNodeRect:L,ariaDescribedById:{draggable:ee},dispatch:d,draggableNodes:v,over:xe,measureDroppableContainers:N}),[D,Ee,C,L,d,ee,v,xe,N]);return V.createElement(Gr.Provider,{value:p},V.createElement(Ba.Provider,{value:Oe},V.createElement(Va.Provider,{value:De},V.createElement(Ja.Provider,{value:Ce},i)),V.createElement(Wa,{disabled:n?.restoreFocus===!1})),V.createElement(Xr,{...n,hiddenTextDescribedById:ee}));function ke(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Za=(0,V.createContext)(null),Qa=`button`,$a=`Draggable`;function eo(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ar($a),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,V.useContext)(Ba),{role:p=Qa,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,V.useContext)(g?Ja:Za),[v,y]=Q(),[b,x]=Q(),S=Oa(o,t),C=Er(n);return Cr(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,V.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Qa?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function to(){return(0,V.useContext)(Va)}var no=`Droppable`,ro={timeout:25};function io(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ar(no),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,V.useContext)(Ba),u=(0,V.useRef)({disabled:n}),d=(0,V.useRef)(!1),f=(0,V.useRef)(null),p=(0,V.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...ro,...i},_=Er(h??r),v=ya({callback:(0,V.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Q((0,V.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Er(t);return(0,V.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,V.useEffect)(()=>(s({type:Zr.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:Zr.UnregisterDroppable,key:a,id:r})),[r]),(0,V.useEffect)(()=>{n!==u.current.disabled&&(s({type:Zr.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function ao(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function oo(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function so(e){return e!==null&&e>=0}function co(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function lo(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var uo={scaleX:1,scaleY:1},fo=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=po(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...uo}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...uo}:a<r&&a>=i?{x:o.width+s,y:0,...uo}:{x:0,y:0,...uo}};function po(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var mo=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ao(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},ho={scaleX:1,scaleY:1},go=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...ho}:null}let s=_o(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...ho}:r<t&&r>=a?{x:0,y:o.height+s,...ho}:{x:0,y:0,...ho}};function _o(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var vo=`Sortable`,yo=V.createContext({activeIndex:-1,containerId:vo,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mo,disabled:{draggable:!1,droppable:!1}});function bo(e){let{children:t,id:n,items:r,strategy:i=mo,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=to(),d=Ar(vo,n),f=s.rect!==null,p=(0,V.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,V.useRef)(p),v=!co(p,_.current),y=g!==-1&&h===-1||v,b=lo(a);Cr(()=>{v&&m&&u(p)},[v,p,m,u]),(0,V.useEffect)(()=>{_.current=p},[p]);let x=(0,V.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:oo(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return V.createElement(yo.Provider,{value:x},t)}var xo=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ao(n,r,i).indexOf(t)},So=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Co={duration:200,easing:`ease`},wo=`transform`,To=Rr.Transition.toString({property:wo,duration:0,easing:`linear`}),Eo={roleDescription:`sortable`};function Do(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,V.useState)(null),s=(0,V.useRef)(n);return Cr(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=_i(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,V.useEffect)(()=>{a&&o(null)},[a]),a}function Oo(e){let{animateLayoutChanges:t=So,attributes:n,disabled:r,data:i,getNewIndex:a=xo,id:o,strategy:s,resizeObserverConfig:c,transition:l=Co}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,V.useContext)(yo),y=ko(r,p),b=u.indexOf(o),x=(0,V.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,V.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=io({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:ee,setNodeRef:A,listeners:j,isDragging:M,over:N,setActivatorNodeRef:P,transform:te}=eo({id:o,data:x,attributes:{...Eo,...n},disabled:y.draggable}),ne=mr(E,A),F=!!D,I=F&&!m&&so(f)&&so(g),L=!_&&M,R=I?(L&&I?te:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,re=so(f)&&so(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ie=D?.id,z=(0,V.useRef)({activeId:ie,items:u,newIndex:re,containerId:d}),ae=u!==z.current.items,oe=t({active:D,containerId:d,isDragging:M,isSorting:F,id:o,index:b,items:u,newIndex:z.current.newIndex,previousItems:z.current.items,previousContainerId:z.current.containerId,transition:l,wasDragging:z.current.activeId!=null}),se=Do({disabled:!oe,index:b,node:w,rect:C});return(0,V.useEffect)(()=>{F&&z.current.newIndex!==re&&(z.current.newIndex=re),d!==z.current.containerId&&(z.current.containerId=d),u!==z.current.items&&(z.current.items=u)},[F,re,d,u]),(0,V.useEffect)(()=>{if(ie===z.current.activeId)return;if(ie!=null&&z.current.activeId==null){z.current.activeId=ie;return}let e=setTimeout(()=>{z.current.activeId=ie},50);return()=>clearTimeout(e)},[ie]),{active:D,activeIndex:f,attributes:ee,data:x,rect:C,index:b,newIndex:re,items:u,isOver:T,isSorting:F,isDragging:M,listeners:j,node:w,overIndex:g,over:N,setNodeRef:ne,setActivatorNodeRef:P,setDroppableNodeRef:E,setDraggableNodeRef:A,transform:se??R,transition:ce()};function ce(){if(se||ae&&z.current.newIndex===b)return To;if(!(L&&!Fr(O)||!l)&&(F||oe))return Rr.Transition.toString({...l,property:wo})}}function ko(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}$.Down,$.Right,$.Up,$.Left;function Ao(e){let t=e.parentElement;for(;t;){let e=window.getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function jo(e,t){let n=(0,V.useRef)(null),r=(0,V.useRef)(e);(0,V.useEffect)(()=>{r.current=e},[e]);let i=(0,V.useCallback)(e=>{n.current=e},[]);return(0,V.useEffect)(()=>{let e=n.current;if(!e||!t)return;let i=Ao(e),a=new IntersectionObserver(e=>{e[0]?.isIntersecting&&r.current()},{root:i,rootMargin:`100px`,threshold:0});return a.observe(e),()=>a.disconnect()},[t]),i}var Mo=60*1e3,No=60*Mo,Po=24*No,Fo=7*Po,Io=365*Po,Lo=360,Ro=300,zo=192,Bo=120,Vo=224,Ho=244,Uo=320,Wo=320,Go=520,Ko=.5;function qo(){return typeof window>`u`?Go:Math.max(Wo,Math.min(Go,window.innerWidth*Ko))}function Jo(e){return Math.min(qo(),Math.max(Wo,e))}function Yo(e){if(!e)return``;let t=new Date(e).getTime();if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);return n<No?H(`relativeMinuteShort`,{count:Math.max(1,Math.floor(n/Mo))}):n<Po?H(`relativeHourShort`,{count:Math.floor(n/No)}):n<Fo?H(`relativeDayShort`,{count:Math.floor(n/Po)}):n<Io?H(`relativeWeekShort`,{count:Math.floor(n/Fo)}):H(`relativeYearShort`,{count:Math.floor(n/Io)})}function Xo(e){if(!e)return!1;let t=e.trim();return!t||t===`undefined`||t===`null`||t===`false`?!1:!Number.isNaN(Date.parse(t))}function Zo({onLoadMore:e,enabled:n}){let r=jo(e,n);return n?(0,G.jsx)(`div`,{ref:r,className:`flex items-center justify-center py-1`,children:(0,G.jsx)(t,{className:`size-3 animate-spin text-muted-foreground/45`})}):null}function Qo({id:e,children:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=Oo({id:e});return(0,G.jsx)(`div`,{ref:i,style:{transform:Rr.Translate.toString(a),transition:s?void 0:o},className:W(s&&`relative z-50 opacity-40`),children:t({listeners:r,attributes:n})})}var $o=(0,V.memo)(function({sidebarOpen:e,variant:i=`desktop`,projectsCollapsed:s,pinnedCollapsed:c,conversationsCollapsed:l,projects:u,expandedProjectIds:d,activeProject:p,currentSessionId:m,loadingSessionId:_,sessionViewMode:b,sessionSortMode:x,globalSessions:C,pinnedSessions:w,pinnedHasMore:O,pinnedLoading:ee,sessionsForProject:j,projectTimelineSessions:M,projectTimelineHasMore:N,projectTimelineLoading:P,globalHasMore:te,globalLoading:I,onLoadMoreGlobal:L,onLoadMorePinned:re,projectHasMore:ae,projectLoading:se,projectLoaded:ce,onLoadMoreProject:le,onLoadMoreProjectTimeline:fe,sessionTaskStatus:pe,selectingProject:he,onTogglePinnedCollapsed:ve,onToggleProjectsCollapsed:be,onToggleConversationsCollapsed:xe,onToggleProjectExpanded:Se,onToggleAllProjectsExpanded:Ce,onReorderProjects:we,onSelectProjectDirectory:Te,onStartNewProjectChat:Ee,onOpenGlobalSkills:De,onOpenAgents:Oe,onOpenScheduledTasks:ke,onOpenProjectSkills:Ae,onOpenProjectInExplorer:je,onDeleteProject:Me,onLoadSession:Ne,onSessionViewModeChange:Pe,onSessionSortModeChange:Fe,onTogglePinSession:Ie,onDeleteSession:Le,onStartNewGlobalChat:Re,onOpenSettings:ze,currentServerUrl:Be,onOpenServer:Ve,onOpenUpdate:He,onDismissUpdate:Ue,updateAvailable:We,latestVersion:Ge,currentVersion:B,onToggleSidebar:Ke,currentSessionHoverInfo:qe}){let Je=`hover:bg-[var(--quickforge-sidebar-hover-bg)]`,Ye=`quickforge-sidebar-section-header group mb-1 flex w-full items-center gap-1 rounded-lg px-2 py-1 text-sm font-[350] leading-5 text-muted-foreground/50 transition-colors ${Je}`,Xe=`quickforge-sidebar-section-toggle flex min-w-0 flex-1 items-center gap-1 text-left transition-colors`,Ze=`quickforge-sidebar-section-icon size-4 shrink-0 text-current opacity-0 transition-[transform,opacity] duration-200 ease-out group-hover:opacity-100 group-focus-within:opacity-100 motion-reduce:transition-none`,Qe=`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,$e=`grid-rows-[1fr] opacity-100`,et=`pointer-events-none grid-rows-[0fr] opacity-0`,tt=`min-h-0 overflow-hidden`,nt=`group relative flex items-center gap-2 overflow-hidden rounded-lg py-1.5 text-left transition-[background-color,color,box-shadow] duration-160 ease-out ${e?`px-2`:`justify-center px-0`} `,rt=`group relative flex items-center gap-2 overflow-hidden py-1.5 text-left transition-[background-color,color,box-shadow] duration-160 ease-out ${e?`px-2`:`justify-center px-0`}`,it=`bg-[var(--quickforge-sidebar-hover-bg)] text-foreground/84 shadow-[0_8px_22px_-20px_rgb(15_23_42_/_0.32)]`,at=`text-foreground/80 ${Je}`,ot=`text-muted-foreground/68 ${Je} hover:text-foreground/80`,st=`text-muted-foreground/70 ${Je} hover:text-foreground/82`,U=`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground/55 transition-colors group-hover:text-foreground/70`,ct=`size-7 shrink-0 rounded-full text-muted-foreground/55 transition-[background-color,color,box-shadow,opacity] duration-160 ease-out ${Je} hover:text-foreground/85 `,lt=`quickforge-sidebar-section-icon ${ct} pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100`,ut=`pointer-events-none absolute inset-y-0 right-1 z-20 flex items-center gap-px rounded-r-lg bg-gradient-to-l from-[var(--quickforge-sidebar-hover-bg)] via-[var(--quickforge-sidebar-hover-bg)]/95 to-transparent pl-4 opacity-0 transition-opacity duration-160`,dt=`${ut} group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100`,ft=`${ut} group-hover:pointer-events-auto group-hover:opacity-100`,pt=`size-6 shrink-0 rounded-full text-muted-foreground/55 transition-[background-color,color,box-shadow] duration-160 ease-out ${Je} hover:text-foreground/85 `,mt=`truncate text-sm font-[350] leading-5`,ht=`flex min-w-0 flex-1 items-center gap-2 text-left`,gt=`flex min-w-0 flex-1 items-center gap-1 truncate`,_t=e=>_===e?(0,G.jsx)(t,{className:`size-3 shrink-0 animate-spin text-muted-foreground/55`,"aria-hidden":`true`}):null,vt=`relative z-10 inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground/55 transition-opacity duration-160 transition-colors ${Je} hover:text-foreground/85`,yt=`group-hover:pointer-events-none group-hover:opacity-0 group-focus-within:pointer-events-none group-focus-within:opacity-0`,bt=`font-[350] text-foreground/84`,xt=`quickforge-sidebar-session-time shrink-0 text-[11px] leading-4 transition-opacity duration-160`,St=`px-3 pb-1 pt-2 text-xs font-[350] leading-4 text-muted-foreground/50`,Ct=`flex w-full items-center gap-3 whitespace-nowrap rounded-xl px-3 py-2.5 text-left text-sm text-foreground/86 transition-colors hover:bg-muted/45`,wt=`mt-2 flex items-center gap-2 text-sm leading-5 text-muted-foreground/72`,Tt=i===`mobile`,[Et,Dt]=(0,V.useState)(!1),[Ot,kt]=(0,V.useState)(``),[At,jt]=(0,V.useState)(null),[Mt,Nt]=(0,V.useState)(null),[Pt,Ft]=(0,V.useState)(!1),[It,Lt]=(0,V.useState)(null),[Rt,zt]=(0,V.useState)(null),[Bt,Vt]=(0,V.useState)(null),[Ht,Ut]=(0,V.useState)(null),[Wt,Gt]=(0,V.useState)(null),[Kt,q]=(0,V.useState)(null),[qt,Jt]=(0,V.useState)(null),[Yt,Xt]=(0,V.useState)(!1),[Zt,Qt]=(0,V.useState)(Uo),[$t,en]=(0,V.useState)(!1),J=(0,V.useRef)(null),Y=(0,V.useRef)(null),tn=(0,V.useRef)(null),X=(0,V.useRef)(null),nn=(0,V.useRef)(null),an=(0,V.useRef)(null),Z=(0,V.useRef)(null),on=ei($r($i,{activationConstraint:{distance:6}})),sn=(0,V.useCallback)(e=>({...e.transform,x:0}),[]),cn=(0,V.useMemo)(()=>u.map(e=>e.id),[u]),ln=(0,V.useMemo)(()=>u.find(e=>e.id===At),[At,u]),un=(0,V.useMemo)(()=>new Map(u.map(e=>[e.id,e.name])),[u]),dn=(0,V.useMemo)(()=>{let e=new Set;return M.filter(t=>e.has(t.id)?!1:(e.add(t.id),!0)).map(e=>({session:e,projectName:e.projectId?un.get(e.projectId)??H(`unknownProject`):H(`unknownProject`)}))},[un,M]),fn=(0,V.useMemo)(()=>w.filter(e=>Xo(e.pinnedAt)).map(e=>({session:e,sourceName:e.scope===`project`?e.projectId?un.get(e.projectId)??H(`unknownProject`):H(`unknownProject`):H(`normalChat`)})),[w,un]),pn=(0,V.useCallback)(()=>{Xt(!0),jt(null),Nt(null),Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),Jt(null)},[]),mn=(0,V.useCallback)(()=>{Xt(!1)},[]),hn=(0,V.useCallback)(e=>{mn();let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=cn.indexOf(t.id),i=cn.indexOf(n.id);if(r===-1||i===-1)return;let a=[...cn];a.splice(r,1),a.splice(i,0,t.id),we(a)},[mn,cn,we]),gn=(0,V.useRef)(null),_n=(0,V.useMemo)(()=>{let e=fn.map(({session:e,sourceName:t})=>({session:e,projectName:t})),t=u.flatMap(e=>j(e.id).map(t=>({session:t,projectName:e.name}))),n=M.map(e=>({session:e,projectName:e.projectId?un.get(e.projectId)??H(`unknownProject`):H(`unknownProject`)})),r=C.map(e=>({session:e,projectName:``})),i=new Set;return[...e,...t,...n,...r].filter(({session:e})=>i.has(e.id)?!1:(i.add(e.id),!0))},[C,fn,un,M,u,j]),vn=Ot.trim()?_n.filter(({session:e,projectName:t})=>`${rn(e.title,e.channelName)} ${t}`.toLowerCase().includes(Ot.trim().toLowerCase())).slice(0,8):[],yn=()=>{Dt(!0),window.setTimeout(()=>gn.current?.focus(),0)},bn=e=>{Ne(e),Dt(!1),kt(``)},xn=()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},Sn=(e,t)=>{if(Tt)return;let n=e.currentTarget.getBoundingClientRect(),r=Math.max(8,Math.min(n.right+8,window.innerWidth-392)),i=n.top+n.height/2;xn(),Z.current=window.setTimeout(()=>{Z.current=null,Jt({sessionId:t,x:r,y:i})},Ro)},Cn=e=>{xn(),Jt(t=>t?.sessionId===e?null:t)},wn=(e,t)=>{e.stopPropagation();let n=e.currentTarget.getBoundingClientRect();zt(null),jt(e=>e===t?(Nt(null),null):(Nt({x:Math.max(8,Math.min(n.right-zo,window.innerWidth-zo-8)),y:Math.max(8,Math.min(n.bottom+4,window.innerHeight-Bo-8))}),t))},Tn=e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();jt(null),Nt(null),Ft(e=>e?(Lt(null),!1):(Lt({x:Math.max(8,Math.min(t.right-Vo,window.innerWidth-Vo-8)),y:Math.max(8,Math.min(t.bottom+6,window.innerHeight-Ho-8))}),!0))},En=(0,V.useCallback)(()=>{Ft(!1),Lt(null)},[]),Dn=e=>{Pe(e),En()},On=e=>{Fe(e),En()},kn=(0,V.useCallback)(()=>{jt(null),Nt(null),zt(null)},[]),An=(e,t)=>{e.stopPropagation(),zt(t)},jn=(e,t)=>{e.stopPropagation(),jt(null),Nt(null),Vt(t),an.current!==null&&window.clearTimeout(an.current),an.current=window.setTimeout(()=>{an.current=null,zt(e=>e===t?null:e),Promise.resolve(Me(t)).catch(()=>{Vt(e=>e===t?null:e)})},Lo)},Mn=(e,t)=>{e.currentTarget.blur(),Ut(t),Ie(t)},Nn=(e,t)=>{e.stopPropagation(),e.currentTarget.blur(),Gt(t)},Pn=(e,t)=>{e.stopPropagation(),q(t),Cn(t),nn.current!==null&&window.clearTimeout(nn.current),nn.current=window.setTimeout(()=>{nn.current=null,Gt(e=>e===t?null:e),Promise.resolve(Le(t)).catch(()=>{q(e=>e===t?null:e)})},Lo)},Fn=(0,V.useCallback)(()=>{let e=X.current;e&&(document.body.style.cursor=e.cursor,document.body.style.userSelect=e.userSelect,X.current=null)},[]),In=(0,V.useCallback)(e=>{if(Y.current=null,tn.current!==null&&(window.cancelAnimationFrame(tn.current),tn.current=null),typeof e==`number`){let t=Jo(e);J.current&&(J.current.style.width=`${t}px`),Qt(t)}Fn(),en(!1)},[Fn]);function Ln(e){let t=J.current?.getBoundingClientRect().width??Zt;Y.current={startX:e.clientX,startWidth:t,currentWidth:t},X.current={cursor:document.body.style.cursor,userSelect:document.body.style.userSelect},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,en(!0),e.preventDefault(),e.stopPropagation();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}function Rn(e){let t=Y.current;!t||!J.current||(t.currentWidth=Jo(t.startWidth+e.clientX-t.startX),tn.current===null&&(tn.current=window.requestAnimationFrame(()=>{tn.current=null;let e=Y.current;!e||!J.current||(J.current.style.width=`${e.currentWidth}px`)})))}function zn(e){let t=Y.current?.currentWidth;In(t);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}function Bn(){In(Uo)}return(0,V.useEffect)(()=>()=>{nn.current!==null&&window.clearTimeout(nn.current),an.current!==null&&window.clearTimeout(an.current),Z.current!==null&&window.clearTimeout(Z.current),tn.current!==null&&window.cancelAnimationFrame(tn.current),Y.current=null,Fn()},[Fn]),(0,V.useEffect)(()=>{if(!Tt&&e)return;let t=window.requestAnimationFrame(()=>In());return()=>window.cancelAnimationFrame(t)},[In,Tt,e]),(0,V.useEffect)(()=>{if(Tt)return;let e=()=>{In(Jo(Y.current?.currentWidth??Zt))};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[In,Tt,Zt]),(0,V.useEffect)(()=>{if(At)return window.addEventListener(`click`,kn),window.addEventListener(`blur`,kn),window.addEventListener(`resize`,kn),()=>{window.removeEventListener(`click`,kn),window.removeEventListener(`blur`,kn),window.removeEventListener(`resize`,kn)}},[At,kn]),(0,V.useEffect)(()=>{if(Pt)return window.addEventListener(`click`,En),window.addEventListener(`blur`,En),window.addEventListener(`resize`,En),()=>{window.removeEventListener(`click`,En),window.removeEventListener(`blur`,En),window.removeEventListener(`resize`,En)}},[Pt,En]),(0,G.jsxs)(`aside`,{ref:J,className:W(`relative z-10 min-h-0 shrink-0 overflow-hidden border-r-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-[var(--quickforge-sidebar-bg)] transition-[width] duration-200 ease-out motion-reduce:transition-none`,Tt?`flex h-full w-80 max-w-[85vw] flex-col`:`hidden md:flex md:flex-col`,!Tt&&!e?`w-14`:void 0,$t&&`transition-none`),style:!Tt&&e?{width:Zt,minWidth:Wo,maxWidth:`min(${Go}px, ${Ko*100}vw)`}:void 0,children:[!Tt&&e?(0,G.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":Wo,"aria-valuemax":qo(),"aria-valuenow":Math.round(Zt),className:W(`group absolute inset-y-0 right-0 z-30 w-2 cursor-col-resize touch-none bg-transparent transition-colors hover:bg-border/20`,$t&&`bg-border/25`),onDoubleClick:Bn,onPointerDown:Ln,onPointerMove:Rn,onPointerUp:zn,onPointerCancel:zn,children:(0,G.jsx)(`span`,{className:W(`absolute inset-y-0 right-0 w-px bg-border/70 opacity-0 transition-opacity`,$t?`opacity-100`:`group-hover:opacity-100`)})}):null,(0,G.jsxs)(`div`,{className:`shrink-0 px-3 pt-3 pb-1`,children:[(0,G.jsx)(`div`,{className:W(nt,`w-full`),children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(`img`,{src:`/favicon.svg`,alt:``,"aria-hidden":`true`,className:`size-5`})}),(0,G.jsx)(`button`,{type:`button`,className:W(ct,`ml-auto inline-flex items-center justify-center`),onClick:Ke,"aria-label":H(`toggleSidebar`),title:H(`toggleSidebar`),children:(0,G.jsx)(h,{className:`size-4`})})]}):(0,G.jsxs)(`button`,{type:`button`,className:W(ct,`group/toggle relative inline-flex items-center justify-center`),onClick:Ke,"aria-label":H(`toggleSidebar`),title:H(`toggleSidebar`),children:[(0,G.jsx)(`img`,{src:`/favicon.svg`,alt:``,"aria-hidden":`true`,className:`size-5 transition-opacity duration-160 group-hover/toggle:opacity-0 group-focus-visible/toggle:opacity-0`}),(0,G.jsx)(ie,{className:`absolute size-4 opacity-0 transition-opacity duration-160 group-hover/toggle:opacity-100 group-focus-visible/toggle:opacity-100`})]})}),(0,G.jsxs)(`button`,{type:`button`,className:W(nt,`mt-4 w-full`,ot),onClick:Re,"aria-label":H(`startNewChat`),title:H(`startNewChat`),children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(o,{className:`size-4`})}),e?(0,G.jsx)(`span`,{className:mt,children:H(`startNewChat`)}):null]}),(0,G.jsxs)(`button`,{type:`button`,className:W(nt,`w-full`,ot),onClick:yn,"aria-label":H(`search`),children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(D,{className:`size-4`})}),e?(0,G.jsx)(`span`,{className:mt,children:H(`search`)}):null]}),(0,G.jsxs)(`button`,{type:`button`,className:W(nt,`w-full`,ot),onClick:ke,"aria-label":H(`scheduledTasks`),title:H(`scheduledTasks`),children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(S,{className:`size-4`})}),e?(0,G.jsx)(`span`,{className:mt,children:H(`scheduledTasks`)}):null]}),(0,G.jsxs)(`button`,{type:`button`,className:W(nt,`w-full`,ot),onClick:De,"aria-label":H(`manageGlobalSkills`),title:H(`manageGlobalSkills`),children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(g,{className:`size-4`})}),e?(0,G.jsx)(`span`,{className:mt,children:H(`skills`)}):null]}),(0,G.jsxs)(`button`,{type:`button`,className:W(nt,`w-full`,ot),onClick:Oe,"aria-label":H(`agentsTab`),title:H(`agentsTab`),children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(a,{className:`size-4`})}),e?(0,G.jsx)(`span`,{className:mt,children:H(`agentsTab`)}):null]})]}),e?(0,G.jsxs)(G.Fragment,{children:[fn.length>0||ee?(0,G.jsxs)(`div`,{className:`shrink-0 px-3 pb-1 max-h-[28%] flex flex-col min-h-0 overflow-hidden`,children:[(0,G.jsx)(`div`,{className:Ye,children:(0,G.jsxs)(`button`,{type:`button`,className:Xe,onClick:ve,"aria-expanded":!c,children:[(0,G.jsx)(`span`,{className:`truncate`,children:H(`pinnedConversations`)}),(0,G.jsx)(A,{className:W(Ze,!c&&`rotate-90`)})]})}),(0,G.jsx)(`div`,{className:W(Qe,`flex-1 min-h-0`,c?et:$e),children:(0,G.jsx)(`div`,{className:tt,children:(0,G.jsx)(`div`,{className:`h-full overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`space-y-0.5`,children:fn.length===0?(0,G.jsxs)(`div`,{className:`flex items-center px-3 py-3 text-xs text-muted-foreground/55`,children:[(0,G.jsx)(t,{className:`mr-1.5 size-3 animate-spin`}),H(`loadingChatWorkspace`)]}):(0,G.jsxs)(G.Fragment,{children:[fn.map(({session:e})=>{let t=m===e.id,r=Ht===e.id,i=Kt===e.id;return(0,G.jsx)(`div`,{className:W(`grid transition-[grid-template-rows,opacity,transform] duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`,i?`grid-rows-[0fr] -translate-x-1 opacity-0`:`grid-rows-[1fr] translate-x-0 opacity-100`),children:(0,G.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,G.jsxs)(`div`,{className:W(nt,t?it:st,i&&`pointer-events-none scale-[0.98] opacity-0 duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`),onMouseEnter:t=>Sn(t,e.id),onMouseLeave:()=>{Ut(t=>t===e.id?null:t),i||Gt(t=>t===e.id?null:t),Cn(e.id)},children:[(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-busy":_===e.id,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>Ne(e.id),onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),Ne(e.id))},children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:gt,children:[_t(e.id),pe(e)===`running`?(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-emerald-500`}):null,(0,G.jsx)(`span`,{className:W(mt,t&&bt),children:rn(e.title,e.channelName)})]})}),(0,G.jsx)(`button`,{type:`button`,className:W(vt,!r&&yt),onClick:t=>{t.stopPropagation(),Ie(e.id)},"aria-label":H(`unpinSession`),title:H(`unpinSession`),children:(0,G.jsx)(n,{className:`size-3`})}),(0,G.jsx)(`span`,{className:W(xt,!r&&yt),children:Yo(e.pinnedAt)})]}),(0,G.jsx)(`div`,{className:W(dt,r&&`hidden`),children:Wt===e.id?(0,G.jsx)(K,{variant:`destructive`,size:`sm`,className:`h-6 rounded-full px-2 text-xs`,onClick:t=>Pn(t,e.id),"aria-label":H(`confirmArchive`),title:H(`confirmArchive`),children:H(`confirm`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Mn(t,e.id),"aria-label":H(`unpinSession`),children:(0,G.jsx)(n,{className:`size-3.5`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Nn(t,e.id),"aria-label":H(`archiveSession`),children:(0,G.jsx)(v,{className:`size-3.5`})})]})})]})})},e.id)}),(0,G.jsx)(Zo,{onLoadMore:re,enabled:O&&!ee})]})})})})})]}):null,(0,G.jsx)(`div`,{className:`shrink-0 px-3 max-h-[55%] flex flex-col min-h-0 overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`mb-0.5 flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{className:Ye,children:[(0,G.jsxs)(`button`,{type:`button`,className:Xe,onClick:be,"aria-expanded":!s,children:[(0,G.jsx)(`span`,{className:`truncate`,children:H(`projects`)}),(0,G.jsx)(A,{className:W(Ze,!s&&`rotate-90`)})]}),u.length>0&&(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:lt,onClick:Tn,"aria-label":H(`filterSort`),title:H(`filterSort`),"aria-haspopup":`menu`,"aria-expanded":Pt,children:(0,G.jsx)(z,{className:`size-4`})}),u.length>0&&(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:lt,onClick:Ce,"aria-label":d.size===u.length?H(`collapseAllProjects`):H(`expandAllProjects`),children:d.size===u.length?(0,G.jsx)(ye,{className:`size-4`}):(0,G.jsx)(me,{className:`size-4`})}),Te?(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:lt,onClick:Te,disabled:he,"aria-label":H(`addProject`),children:(0,G.jsx)(y,{className:`size-4`})}):null]}),(0,G.jsx)(`div`,{className:W(Qe,`flex-1 min-h-0`,s?et:$e),children:(0,G.jsx)(`div`,{className:tt,children:(0,G.jsx)(`div`,{className:`h-full overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`space-y-0.5`,children:u.length===0?(0,G.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground/55`,children:H(`noProjects`)}):b===`timeline`?dn.length===0?P?(0,G.jsxs)(`div`,{className:`flex items-center px-3 py-3 text-xs text-muted-foreground/55`,children:[(0,G.jsx)(t,{className:`mr-1.5 size-3 animate-spin`}),H(`loadingChatWorkspace`)]}):(0,G.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground/55`,children:H(`noConversations`)}):(0,G.jsxs)(G.Fragment,{children:[dn.map(({session:e})=>{let t=m===e.id,r=Ht===e.id,i=Kt===e.id,a=x===`createdAt`?e.createdAt:e.lastModified;return(0,G.jsx)(`div`,{className:W(`grid transition-[grid-template-rows,opacity,transform] duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`,i?`grid-rows-[0fr] -translate-x-1 opacity-0`:`grid-rows-[1fr] translate-x-0 opacity-100`),children:(0,G.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,G.jsxs)(`div`,{className:W(nt,t?it:st,i&&`pointer-events-none scale-[0.98] opacity-0 duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`),onMouseEnter:t=>Sn(t,e.id),onMouseLeave:()=>{Ut(t=>t===e.id?null:t),i||Gt(t=>t===e.id?null:t),Cn(e.id)},children:[(0,G.jsxs)(`button`,{className:`flex min-w-0 flex-1 items-center gap-2 text-left`,type:`button`,"aria-busy":_===e.id,onClick:()=>Ne(e.id),children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:gt,children:[_t(e.id),pe(e)===`running`?(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-emerald-500`}):null,(0,G.jsx)(`span`,{className:W(mt,t&&bt),children:rn(e.title,e.channelName)})]})}),e.pinnedAt?(0,G.jsx)(`button`,{type:`button`,className:W(vt,!r&&yt),onClick:t=>{t.stopPropagation(),Ie(e.id)},"aria-label":H(`unpinSession`),title:H(`unpinSession`),children:(0,G.jsx)(n,{className:`size-3`})}):null,(0,G.jsx)(`span`,{className:W(xt,!r&&yt),children:Yo(a)})]}),(0,G.jsx)(`div`,{className:W(dt,r&&`hidden`),children:Wt===e.id?(0,G.jsx)(K,{variant:`destructive`,size:`sm`,className:`h-6 rounded-full px-2 text-xs`,onClick:t=>Pn(t,e.id),"aria-label":H(`confirmArchive`),title:H(`confirmArchive`),children:H(`confirm`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Mn(t,e.id),"aria-label":e.pinnedAt?H(`unpinSession`):H(`pinSession`),children:(0,G.jsx)(n,{className:`size-3.5`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Nn(t,e.id),"aria-label":H(`archiveSession`),children:(0,G.jsx)(v,{className:`size-3.5`})})]})})]})})},e.id)}),(0,G.jsx)(Zo,{onLoadMore:fe,enabled:N&&!P})]}):(0,G.jsx)(Xa,{sensors:on,collisionDetection:si,onDragStart:pn,onDragEnd:hn,onDragCancel:mn,measuring:{droppable:{strategy:fa.Always}},modifiers:[sn],children:(0,G.jsx)(bo,{items:cn,strategy:go,children:u.map(e=>{let r=j(e.id),i=!Yt&&d.has(e.id),a=p?.id===e.id,s=ce(e.id),c=At===e.id,l=Bt===e.id;return(0,G.jsx)(Qo,{id:e.id,children:({listeners:u,attributes:d})=>(0,G.jsx)(`div`,{className:W(`grid transition-[grid-template-rows,opacity,transform] duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`,l?`grid-rows-[0fr] -translate-x-1 opacity-0`:`grid-rows-[1fr] translate-x-0 opacity-100`),children:(0,G.jsxs)(`div`,{className:`min-h-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:W(nt,a?at:ot,c&&`z-20 overflow-visible`,l&&`pointer-events-none scale-[0.98] opacity-0 duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`),style:{touchAction:`none`},...u,...d,children:[(0,G.jsx)(`button`,{type:`button`,className:U,onClick:()=>Se(e.id),"aria-label":H(i?`collapseProject`:`expandProject`),children:i?(0,G.jsx)(E,{className:`size-4`}):(0,G.jsx)(T,{className:`size-4`})}),(0,G.jsx)(`button`,{className:`flex min-w-0 flex-1 items-center text-left`,type:`button`,title:e.path,onClick:()=>Se(e.id),children:(0,G.jsx)(`span`,{className:W(mt,a&&`font-[350] text-foreground/80`),children:e.name})}),(0,G.jsxs)(`div`,{className:ft,children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>wn(t,e.id),"aria-label":H(`moreOptions`),"aria-expanded":c,children:(0,G.jsx)(R,{className:`size-4`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:()=>Ee(e),"aria-label":H(`newProjectChat`),children:(0,G.jsx)(o,{className:`size-4`})})]})]}),(0,G.jsx)(`div`,{className:W(Qe,Yt&&`transition-none`,i?$e:et),children:(0,G.jsx)(`div`,{className:tt,children:(0,G.jsx)(`div`,{className:`mt-0.5 space-y-0.5 pl-8 max-h-[35vh] overflow-y-auto`,children:r.length===0&&!s||r.length===0&&se(e.id)?(0,G.jsxs)(`div`,{className:`flex items-center px-2 py-1.5 text-xs text-muted-foreground/55`,children:[(0,G.jsx)(t,{className:`mr-1.5 size-3 animate-spin`}),H(`loadingChatWorkspace`)]}):r.length===0&&!ae(e.id)?(0,G.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-muted-foreground/55`,children:H(`noConversations`)}):(0,G.jsxs)(G.Fragment,{children:[r.map(e=>{let t=m===e.id,r=Ht===e.id,i=Kt===e.id;return(0,G.jsx)(`div`,{className:W(`grid transition-[grid-template-rows,opacity,transform] duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`,i?`grid-rows-[0fr] -translate-x-1 opacity-0`:`grid-rows-[1fr] translate-x-0 opacity-100`),children:(0,G.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,G.jsxs)(`div`,{className:W(nt,`gap-1`,t?it:st,i&&`pointer-events-none scale-[0.98] opacity-0 duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`),onMouseEnter:t=>Sn(t,e.id),onMouseLeave:()=>{Ut(t=>t===e.id?null:t),i||Gt(t=>t===e.id?null:t),Cn(e.id)},children:[(0,G.jsxs)(`button`,{className:ht,type:`button`,"aria-busy":_===e.id,onClick:()=>Ne(e.id),children:[(0,G.jsxs)(`div`,{className:gt,children:[_t(e.id),pe(e)===`running`?(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-emerald-500`}):null,(0,G.jsx)(`span`,{className:W(mt,t&&bt),children:rn(e.title,e.channelName)})]}),e.pinnedAt?(0,G.jsx)(`button`,{type:`button`,className:W(vt,!r&&yt),onClick:t=>{t.stopPropagation(),Ie(e.id)},"aria-label":H(`unpinSession`),title:H(`unpinSession`),children:(0,G.jsx)(n,{className:`size-3`})}):null,(0,G.jsx)(`span`,{className:W(xt,!r&&yt),children:Yo(x===`createdAt`?e.createdAt:e.lastModified)})]}),(0,G.jsx)(`div`,{className:W(dt,r&&`hidden`),children:Wt===e.id?(0,G.jsx)(K,{variant:`destructive`,size:`sm`,className:`h-6 rounded-full px-2 text-xs`,onClick:t=>Pn(t,e.id),"aria-label":H(`confirmArchive`),title:H(`confirmArchive`),children:H(`confirm`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Mn(t,e.id),"aria-label":e.pinnedAt?H(`unpinSession`):H(`pinSession`),children:(0,G.jsx)(n,{className:`size-3.5`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Nn(t,e.id),"aria-label":H(`archiveSession`),children:(0,G.jsx)(v,{className:`size-3.5`})})]})})]})})},e.id)}),(0,G.jsx)(Zo,{onLoadMore:()=>le(e.id),enabled:ae(e.id)&&!se(e.id)})]})})})})]})})},e.id)})})})})})})})]})}),(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col px-3 pb-3`,children:[(0,G.jsxs)(`div`,{className:Ye,children:[(0,G.jsxs)(`button`,{type:`button`,className:Xe,onClick:xe,"aria-expanded":!l,children:[(0,G.jsx)(`span`,{className:`truncate`,children:H(`conversations`)}),(0,G.jsx)(A,{className:W(Ze,!l&&`rotate-90`)})]}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:W(ct,`quickforge-sidebar-section-icon`),onClick:Re,"aria-label":H(`newChat`),children:(0,G.jsx)(o,{className:`size-4`})})]}),(0,G.jsx)(`div`,{className:W(Qe,`flex-1 min-h-0`,l?et:$e),children:(0,G.jsx)(`div`,{className:tt,children:(0,G.jsx)(`div`,{className:`h-full overflow-y-auto`,children:C.length===0&&!te?(0,G.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground/55`,children:H(`noSavedConversations`)}):(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[C.map(e=>{let t=m===e.id,r=Ht===e.id,i=Kt===e.id;return(0,G.jsx)(`div`,{className:W(`grid transition-[grid-template-rows,opacity,transform] duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`,i?`grid-rows-[0fr] -translate-x-1 opacity-0`:`grid-rows-[1fr] translate-x-0 opacity-100`),children:(0,G.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,G.jsxs)(`div`,{className:W(nt,t?it:st,i&&`pointer-events-none scale-[0.98] opacity-0 duration-[360ms] ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none`),onMouseEnter:t=>Sn(t,e.id),onMouseLeave:()=>{Ut(t=>t===e.id?null:t),i||Gt(t=>t===e.id?null:t),Cn(e.id)},children:[(0,G.jsxs)(`button`,{className:ht,type:`button`,"aria-busy":_===e.id,onClick:()=>Ne(e.id),children:[(0,G.jsxs)(`div`,{className:gt,children:[_t(e.id),pe(e)===`running`?(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-emerald-500`}):null,(0,G.jsx)(`span`,{className:W(mt,t&&bt),children:rn(e.title,e.channelName)})]}),e.pinnedAt?(0,G.jsx)(`button`,{type:`button`,className:W(vt,!r&&yt),onClick:t=>{t.stopPropagation(),Ie(e.id)},"aria-label":H(`unpinSession`),title:H(`unpinSession`),children:(0,G.jsx)(n,{className:`size-3`})}):null,(0,G.jsx)(`span`,{className:W(xt,!r&&yt),children:Yo(x===`createdAt`?e.createdAt:e.lastModified)})]}),(0,G.jsx)(`div`,{className:W(dt,r&&`hidden`),children:Wt===e.id?(0,G.jsx)(K,{variant:`destructive`,size:`sm`,className:`h-6 rounded-full px-2 text-xs`,onClick:t=>Pn(t,e.id),"aria-label":H(`confirmArchive`),title:H(`confirmArchive`),children:H(`confirm`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Mn(t,e.id),"aria-label":e.pinnedAt?H(`unpinSession`):H(`pinSession`),children:(0,G.jsx)(n,{className:`size-3.5`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:pt,onClick:t=>Nn(t,e.id),"aria-label":H(`archiveSession`),children:(0,G.jsx)(v,{className:`size-4`})})]})})]})})},e.id)}),(0,G.jsx)(Zo,{onLoadMore:L,enabled:te&&!I})]})})})})]})]}):null,(0,G.jsxs)(`div`,{className:`mt-auto shrink-0 border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-3 py-3`,children:[We&&Ge?(0,G.jsxs)(`button`,{type:`button`,className:W(rt,`relative mb-2 w-full border border-primary/30 bg-primary/5 text-primary hover:bg-primary/10`),onClick:He,"aria-label":H(`newVersionAvailable`,{version:Ge}),title:H(`newVersionAvailable`,{version:Ge}),children:[(0,G.jsx)(`span`,{className:W(U,`text-primary/80`),children:(0,G.jsx)(ne,{className:`size-4`})}),e?(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-xs font-medium leading-tight`,children:H(`newVersionAvailable`,{version:Ge})}),B?(0,G.jsx)(`span`,{className:`block truncate text-[11px] leading-tight text-primary/70`,children:H(`newVersionAvailableSub`,{current:B})}):null]}):null,e&&Ue?(0,G.jsx)(`span`,{className:`shrink-0 rounded-full px-1.5 py-0.5 text-[11px] text-primary/60 transition-colors hover:bg-primary/15 hover:text-primary`,role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),Ue()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),Ue())},children:H(`updateLater`)}):null,e?null:(0,G.jsx)(`span`,{className:`absolute right-1 top-1 size-2 rounded-full bg-primary`})]}):null,Be&&Ve?(0,G.jsxs)(`button`,{type:`button`,className:W(rt,`min-h-9 w-full shrink-0 rounded-lg`,ot),onClick:Ve,"aria-label":Be,title:Be,children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(F,{className:`size-4`})}),e?(0,G.jsx)(`span`,{className:W(mt,`min-w-0 flex-1`),children:Be}):null]}):null,(0,G.jsxs)(`button`,{type:`button`,className:W(rt,`min-h-9 w-full shrink-0 rounded-lg`,ot),onClick:ze,"aria-label":H(`settings`),title:H(`settings`),children:[(0,G.jsx)(`span`,{className:U,children:(0,G.jsx)(oe,{className:`size-4`})}),e?(0,G.jsx)(`span`,{className:mt,children:H(`settings`)}):null]})]}),qt?(()=>{let e=_n.find(e=>e.session.id===qt.sessionId)?.session;if(!e)return null;let t=qe?.sessionId===e.id;return(0,G.jsxs)(`div`,{className:`pointer-events-none fixed z-50 w-[min(24rem,calc(100vw-1rem))] max-w-sm rounded-2xl border border-border bg-popover px-4 py-3 text-left shadow-quickforge`,style:{left:qt.x,top:qt.y,transform:`translateY(-50%)`},children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium leading-5 text-foreground/92`,children:rn(e.title,e.channelName)}),t&&qe?.gitBranch?(0,G.jsxs)(`div`,{className:wt,children:[(0,G.jsx)(de,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,G.jsx)(`span`,{className:`truncate`,children:qe.gitBranch})]}):null,t&&qe?.context?(0,G.jsxs)(`div`,{className:wt,title:qe.context.title,children:[(0,G.jsx)(f,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,G.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:qe.context.color}}),(0,G.jsx)(`span`,{className:`truncate`,children:qe.context.label})]}):null]})})():null,Pt&&It?(0,fr.createPortal)((0,G.jsxs)(`div`,{className:`fixed z-50 overflow-hidden rounded-2xl border border-border bg-background p-1.5 shadow-quickforge`,style:{left:It.x,top:It.y,width:Vo},role:`menu`,"aria-label":H(`filterSort`),onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`div`,{className:St,children:H(`sidebarView`)}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":b===`project`,className:Ct,onClick:()=>Dn(`project`),children:[(0,G.jsx)(T,{className:`size-4 shrink-0 text-muted-foreground/70`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:H(`sidebarViewByProject`)}),b===`project`?(0,G.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground/70`}):(0,G.jsx)(`span`,{className:`size-4 shrink-0`})]}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":b===`timeline`,className:Ct,onClick:()=>Dn(`timeline`),children:[(0,G.jsx)(ue,{className:`size-4 shrink-0 text-muted-foreground/70`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:H(`sidebarViewTimeline`)}),b===`timeline`?(0,G.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground/70`}):(0,G.jsx)(`span`,{className:`size-4 shrink-0`})]}),(0,G.jsx)(`div`,{className:`my-1 border-t`,style:{borderColor:`color-mix(in oklab, var(--muted-foreground) 50%, transparent)`}}),(0,G.jsx)(`div`,{className:St,children:H(`sortBy`)}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":x===`updatedAt`,className:Ct,onClick:()=>On(`updatedAt`),children:[(0,G.jsx)(ue,{className:`size-4 shrink-0 text-muted-foreground/70`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:H(`sortByUpdatedAt`)}),x===`updatedAt`?(0,G.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground/70`}):(0,G.jsx)(`span`,{className:`size-4 shrink-0`})]}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":x===`createdAt`,className:Ct,onClick:()=>On(`createdAt`),children:[(0,G.jsx)(ge,{className:`size-4 shrink-0 text-muted-foreground/70`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:H(`sortByCreatedAt`)}),x===`createdAt`?(0,G.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground/70`}):(0,G.jsx)(`span`,{className:`size-4 shrink-0`})]})]}),document.body):null,ln&&Mt?(0,fr.createPortal)((0,G.jsxs)(`div`,{className:`fixed z-50 min-w-48 overflow-hidden rounded-lg border border-border bg-background p-1 shadow-quickforge`,style:{left:Mt.x,top:Mt.y},onClick:e=>e.stopPropagation(),children:[je?(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 whitespace-nowrap rounded-md px-2 py-1.5 text-left text-sm text-foreground/86 transition-colors hover:bg-muted`,title:H(`openInExplorer`),"aria-label":H(`openInExplorer`),onClick:()=>{kn(),je(ln)},children:[(0,G.jsx)(E,{className:`size-4 shrink-0 text-muted-foreground/70`}),(0,G.jsx)(`span`,{children:H(`openFolder`)})]}):null,(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 whitespace-nowrap rounded-md px-2 py-1.5 text-left text-sm text-foreground/86 transition-colors hover:bg-muted`,onClick:()=>{kn(),Ae(ln)},children:[(0,G.jsx)(_e,{className:`size-4 shrink-0 text-muted-foreground/70`}),(0,G.jsx)(`span`,{children:H(`manageProjectSkills`)})]}),Rt===ln.id?(0,G.jsx)(`button`,{type:`button`,className:`flex w-full items-center justify-center gap-2 whitespace-nowrap rounded-md bg-destructive px-2 py-1.5 text-left text-sm font-medium text-destructive-foreground transition-colors hover:bg-destructive/90`,"aria-label":H(`confirmDelete`),onClick:e=>jn(e,ln.id),children:(0,G.jsx)(`span`,{children:H(`confirm`)})}):(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 whitespace-nowrap rounded-md px-2 py-1.5 text-left text-sm text-destructive transition-colors hover:bg-destructive/10`,"aria-label":H(`deleteProject`),onClick:e=>An(e,ln.id),children:[(0,G.jsx)(k,{className:`size-4 shrink-0`}),(0,G.jsx)(`span`,{children:H(`deleteProject`)})]})]}),document.body):null,Et?(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center bg-background/50 px-4 pt-[12vh] backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,onMouseDown:()=>Dt(!1),children:(0,G.jsxs)(`div`,{className:`w-full max-w-xl rounded-2xl border border-border bg-popover p-3 shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-input bg-background px-3 py-2`,children:[(0,G.jsx)(D,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,G.jsx)(`input`,{ref:gn,value:Ot,onChange:e=>kt(e.target.value),onKeyDown:e=>{e.key===`Escape`&&Dt(!1)},placeholder:H(`searchDialog`),className:`min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/45`})]}),(0,G.jsx)(`div`,{className:`mt-2 max-h-[50vh] overflow-y-auto`,children:Ot.trim()?vn.length>0?vn.map(({session:e,projectName:t})=>(0,G.jsxs)(`button`,{type:`button`,"aria-busy":_===e.id,className:`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left transition-colors hover:bg-muted/28`,onClick:()=>bn(e.id),children:[_t(e.id),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-sm text-foreground/90`,children:rn(e.title,e.channelName)}),(0,G.jsxs)(`span`,{className:`block truncate text-[11px] text-muted-foreground/55`,children:[t||H(`normalChat`),` · `,Yo(e.lastModified)]})]})]},e.id)):(0,G.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground/55`,children:H(`noSearchResults`)}):(0,G.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground/55`,children:H(`searchHint`)})})]})}):null]})}),es=`quickforge:api-cache:v1:`,ts=1,ns=256*1024,rs=new Map;function is(e){return`${es}${e}`}function as(e,t){return e!=null&&Date.now()-e.cachedAt<=t}function os(e){try{let t=globalThis.localStorage?.getItem(is(e));if(!t)return null;let n=JSON.parse(t);return n.v===ts?n:null}catch{return null}}function ss(e,t){let n=rs.get(e);if(as(n,t))return n.value;n&&rs.delete(e);let r=os(e);if(!as(r,t)){if(r)try{globalThis.localStorage?.removeItem(is(e))}catch{}return null}return rs.set(e,r),r.value}function cs(e,t){let n={v:ts,cachedAt:Date.now(),value:t};rs.set(e,n);try{let t=JSON.stringify(n);t.length<=ns&&globalThis.localStorage?.setItem(is(e),t)}catch{}}function ls(e){let t=t=>typeof e==`string`?t===e:e.test(t);for(let e of[...rs.keys()])if(t(e)){rs.delete(e);try{globalThis.localStorage?.removeItem(is(e))}catch{}}}typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key&&e.key.startsWith(es)&&rs.delete(e.key.slice(24))});var us=`quickforge:expanded-project-ids:v1`;function ds(){try{return globalThis.localStorage}catch{return}}function fs(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)typeof n==`string`&&n.length>0&&t.push(n);return t}function ps(){let e=ds();if(!e)return new Set;try{let t=e.getItem(us);return t?new Set(fs(JSON.parse(t))):new Set}catch{return new Set}}function ms(e){let t=ds();if(t)try{let n=[...new Set(Array.from(e).filter(e=>typeof e==`string`&&e.length>0))];t.setItem(us,JSON.stringify(n))}catch{}}function hs(e,t){let n=new Set(t),r=new Set;for(let t of e)n.has(t)&&r.add(t);return r}var gs=`/api/project`,_s=15*1e3;function vs(){let[e,t]=(0,V.useState)(),[n,r]=(0,V.useState)([]),[i,a]=(0,V.useState)(),[o,s]=(0,V.useState)(()=>ps()),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1);(0,V.useEffect)(()=>{ms(o)},[o]);let f=(0,V.useCallback)(e=>{t(e.project),r(Array.isArray(e.projects)?e.projects:[]),a(typeof e.defaultWorkspaceRoot==`string`&&e.defaultWorkspaceRoot?{id:`default`,name:`workspace`,path:e.defaultWorkspaceRoot,lastOpenedAt:``}:void 0),s(t=>hs(t,(Array.isArray(e.projects)?e.projects:[]).map(e=>e.id)))},[]);return{activeProject:e,projects:n,defaultWorkspace:i,expandedProjectIds:o,selectingProject:c,projectPickerOpen:u,loadProject:(0,V.useCallback)(async(e=!1)=>{try{if(!e){let e=ss(gs,_s);if(e){f(e);return}}let t=await fetch(`/api/project`);if(!t.ok)return;let n=await t.json();cs(gs,n),f(n)}catch(e){B.error(`Failed to load project:`,e)}},[f]),switchActiveProject:(0,V.useCallback)(async e=>{let n=await fetch(`/api/project/active`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e})}),i=await n.json().catch(()=>null);if(!n.ok)throw Error(i?.error||`Project switch failed with HTTP ${n.status}`);return t(i.project),r(Array.isArray(i.projects)?i.projects:[]),s(new Set([e])),ls(gs),i.project},[]),handleSelectProjectPath:(0,V.useCallback)(async e=>{l(!0);try{let n=await fetch(`/api/project/path`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e})}),i=await n.json().catch(()=>null);if(!n.ok)throw Error(i?.error||`Project selection failed with HTTP ${n.status}`);i?.project&&(t(i.project),r(Array.isArray(i.projects)?i.projects:[]),ls(gs),s(e=>hs(e,(Array.isArray(i.projects)?i.projects:[]).map(e=>e.id))))}catch(e){throw B.error(`Failed to select project:`,e),e}finally{l(!1)}},[]),selectProjectDirectory:(0,V.useCallback)(()=>{d(!0)},[]),setProjectPickerOpen:d,toggleProjectExpanded:(0,V.useCallback)(e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),toggleAllProjectsExpanded:(0,V.useCallback)(()=>{s(e=>e.size===n.length&&n.length>0?new Set:new Set(n.map(e=>e.id)))},[n]),reorderProjects:(0,V.useCallback)(async e=>{r(t=>{let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){let e=n.get(t);e&&(r.push(e),n.delete(t))}return r});try{let t=await fetch(`/api/project/reorder`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({orderedIds:e})}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||`Reorder failed with HTTP ${t.status}`);Array.isArray(n?.projects)&&r(n.projects),ls(gs)}catch(e){B.error(`Failed to reorder projects:`,e)}},[]),setActiveProject:t,setProjects:r,setExpandedProjectIds:s}}function ys(){let[e,t]=(0,V.useState)(`default`);return{agentAccessMode:e,setAgentAccessMode:t,initialize:(0,V.useCallback)(async e=>{let n=await Ln(e);return t(n),n},[])}}var bs=`quickforge-sync`;function xs(e){let t=(0,V.useRef)(e);(0,V.useEffect)(()=>{t.current=e});let n=(0,V.useRef)(Y()),r=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(typeof BroadcastChannel<`u`)try{let e=new BroadcastChannel(bs);r.current=e;let i=e=>{let r=e.data;if(!(!r||r.sourceTabId===n.current))switch(r.type){case`sessions-changed`:t.current.onSessionsChanged();break;case`projects-changed`:t.current.onProjectsChanged();break;case`settings-changed`:t.current.onSettingsChanged();break}};return e.addEventListener(`message`,i),()=>{e.removeEventListener(`message`,i),e.close()}}catch{r.current=null}},[]),(0,V.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&(t.current.onSessionsChanged(),t.current.onProjectsChanged())};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[]);let i=(0,V.useCallback)(e=>{let t={type:e,sourceTabId:n.current,timestamp:Date.now()};r.current?.postMessage(t)},[]);return{notifySessionsChanged:(0,V.useCallback)(()=>i(`sessions-changed`),[i]),notifyProjectsChanged:(0,V.useCallback)(()=>i(`projects-changed`),[i]),notifySettingsChanged:(0,V.useCallback)(()=>i(`settings-changed`),[i])}}function Ss(e){return e===`assistant`||e===`user`||e===`user-with-attachments`}function Cs(e,t){let n=t.toolCallId;if(t.role===`toolResult`&&typeof n==`string`){let r=e.findIndex(e=>e.role===`toolResult`&&e.toolCallId===n);if(r>=0){let n=e.slice();return n[r]=t,n}return[...e,t]}if(Ss(t.role)){let n=t.timestamp;if(n!==void 0){let r=e.findIndex(e=>e.role===t.role&&e.timestamp===n);if(r>=0){let n=e.slice();return n[r]=t,n}}}let r=e.slice(),i=r.length-1;return i>=0&&r[i]?.role===t.role?r[i]=t:r.push(t),r}function ws(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function Ts(e){if(!ws(e))return;let t=e.quickforgeTiming;if(!ws(t))return;let n=typeof t.startedAt==`number`?t.startedAt:void 0,r=typeof t.finishedAt==`number`?t.finishedAt:void 0,i=typeof t.durationMs==`number`?t.durationMs:void 0;if(!(n===void 0&&r===void 0&&i===void 0))return{startedAt:n,finishedAt:r,durationMs:i}}function Es(e,t){return ws(e)?{...e,quickforgeTiming:t}:{quickforgeTiming:t}}function Ds(e,t){let n=e.quickforgeTiming??Ts(e.partialResult?.details)??{startedAt:Date.now()};return{...e,partialResult:e.partialResult??{content:[],details:{quickforgeTiming:n,sessionId:t,toolCallId:e.toolCallId}}}}function Os(e,t,n){if(!t.toolCallId||!t.toolName)return e;let r=n?t.partialResult:t.result;if(!r)return e;let i=Ts(r.details)??t.quickforgeTiming;if(!i){let n=e.findIndex(e=>e.role===`toolResult`&&e.toolCallId===t.toolCallId);n>=0&&(i=Ts(e[n].details))}let a=i?Es(r.details,i):r.details,o=ws(a)?{...a,sessionId:a.sessionId??t.sessionId,toolCallId:a.toolCallId??t.toolCallId}:a;return Cs(e,{role:`toolResult`,toolCallId:t.toolCallId,toolName:t.toolName,content:r.content??[],details:o,isError:n?!1:t.isError,timestamp:Date.now()})}function ks(){return``}var As=5e3,js=15e3,Ms=1e4,Ns=3e4;async function Ps(e,t,n={}){let r=new AbortController,i=n.signal,a=()=>r.abort(i?.reason);i?.aborted?a():i?.addEventListener(`abort`,a,{once:!0});let o=setTimeout(()=>r.abort(),t);try{let t=await fetch(e,{...n,signal:r.signal});return{response:t,body:await t.json().catch(()=>void 0)}}finally{clearTimeout(o),i?.removeEventListener(`abort`,a)}}var Fs=new class{eventSource=null;handlersBySession=new Map;baseUrl=``;reconnectTimer=null;reconnectDelay=1e3;directBaseUrl=ks();fallbackBaseUrl=``;subscribe(e,t,n){this.fallbackBaseUrl=t;let r=this.directBaseUrl||this.fallbackBaseUrl;(!this.eventSource||this.baseUrl!==r)&&(this.disconnect(),this.baseUrl=r,this.connect());let i=this.handlersBySession.get(e);return i||(i=new Set,this.handlersBySession.set(e,i)),i.add(n),()=>{let t=this.handlersBySession.get(e);t?.delete(n),t?.size===0&&this.handlersBySession.delete(e),this.handlersBySession.size===0&&this.globalHandlers.size===0&&this.disconnect()}}globalHandlers=new Set;subscribeAll(e,t){this.fallbackBaseUrl=e;let n=this.directBaseUrl||this.fallbackBaseUrl;return(!this.eventSource||this.baseUrl!==n)&&(this.disconnect(),this.baseUrl=n,this.connect()),this.globalHandlers.add(t),()=>{this.globalHandlers.delete(t),this.handlersBySession.size===0&&this.globalHandlers.size===0&&this.disconnect()}}connect(){let e=`${this.baseUrl}/api/agents/events`;this.eventSource=new EventSource(e),this.eventSource.onopen=()=>{this.reconnectDelay=1e3};let t=[`state`,`agent_start`,`agent_end`,`message_start`,`message_end`,`turn_start`,`turn_end`,`message_update`,`tool_execution_start`,`tool_execution_update`,`tool_execution_end`,`error`,`session_created`,`title_updated`,`session_forked`,`scheduled_task_notification`,`scheduled_task_started`,`tool_approval_required`,`auto_compact_threshold_reached`,`auto_compact_approval_required`,`auto_compact_completed`,`auto_compact_failed`,`messages_replaced`],n=e=>t=>{try{let n=JSON.parse(t.data),r=n.sessionId;if(!r&&e!==`scheduled_task_notification`)return;let i=e?{type:e,...n}:n;r?this.emit(r,i):this.emitGlobal(i)}catch{}};this.eventSource.onmessage=n();for(let e of t)this.eventSource.addEventListener(e,n(e));this.eventSource.onerror=()=>{if(this.eventSource?.close(),this.eventSource=null,this.baseUrl===this.directBaseUrl&&this.fallbackBaseUrl!==this.directBaseUrl){this.baseUrl=this.fallbackBaseUrl,this.connect();return}this.scheduleReconnect()}}scheduleReconnect(){this.reconnectTimer||this.handlersBySession.size===0&&this.globalHandlers.size===0||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,!(this.handlersBySession.size===0&&this.globalHandlers.size===0)&&(this.reconnectDelay=Math.min(this.reconnectDelay*2,3e4),this.connect())},this.reconnectDelay))}emitGlobal(e){for(let t of this.globalHandlers)try{t(e)}catch{}}emit(e,t){this.emitGlobal(t);let n=this.handlersBySession.get(e);if(n)for(let e of n)try{e(t)}catch{}}disconnect(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.eventSource?.close(),this.eventSource=null}},Is=200,Ls=null;function Rs(e=``){let t=Date.now(),n=Ls;if(n&&n.baseUrl===e&&t-n.startedAt<Is)return n.promise;let r=(async()=>{let t=await fetch(`${e}/api/agents`,{cache:`no-store`});if(!t.ok)return[];let n=await t.json().catch(()=>null);return Array.isArray(n?.sessions)?n.sessions:[]})();return Ls={baseUrl:e,startedAt:t,promise:r},r.finally(()=>{Ls?.promise===r&&(Ls=null)}),r}function zs(e,t=``){return Fs.subscribeAll(t,e)}var Bs=class e{state;streamFn=We;getApiKey;sessionId;listeners=new Set;unsubscribeSse;baseUrl;disposed=!1;_syncingThinkingLevel=!1;pollTimer=null;refreshPromise=null;statusPromise=null;lastSseEventAt=Date.now();lastServerStateVersion=0;nextPromptCapabilities=[];planMode=!1;onPlanModeConsumed;stateVersion=0;constructor(e){this.sessionId=e.sessionId,this.baseUrl=e.baseUrl??``;let t=e.initialState??{};this.lastServerStateVersion=typeof t.stateVersion==`number`?t.stateVersion:0;let n={systemPrompt:t.systemPrompt??``,model:t.model??null,thinkingLevel:t.thinkingLevel??`off`,messages:t.messages?.slice()??[],tools:t.tools??[],accessMode:X(t.accessMode,tn(t.yoloMode)),yoloMode:nn(X(t.accessMode,tn(t.yoloMode))),isStreaming:t.isStreaming??!1,streamingMessage:void 0,pendingToolCalls:new Set(t.pendingToolCalls??[]),errorMessage:t.errorMessage,contextCompaction:t.contextCompaction??null,contextUsage:t.contextUsage??null,pendingToolApproval:t.pendingToolApproval??null,pendingAutoCompactApproval:t.pendingAutoCompactApproval??null};this.state=new Proxy(n,{set:(e,t,n)=>{let r=e[t];return e[t]=n,t===`thinkingLevel`&&!this._syncingThinkingLevel&&n!==r&&this.updateThinkingLevel(n),!0}}),this.unsubscribeSse=Fs.subscribe(this.sessionId,this.baseUrl,e=>this.handleSseEvent(e)),this.state.isStreaming&&this.startStateWatchdog()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setNextPromptCapabilities(e){this.nextPromptCapabilities=Array.isArray(e)?e.slice(0,4):[]}setPlanMode(e,t){this.planMode=e,this.onPlanModeConsumed=e?t:void 0}async prompt(e){if(this.disposed)return;if(this.state.isStreaming){B.warn(`Ignored prompt while agent is already streaming`);return}let t;t=typeof e==`string`?{role:`user`,content:e,timestamp:Date.now()}:Array.isArray(e)?[...e].reverse().find(e=>e.role===`user`||e.role===`user-with-attachments`)??e[e.length-1]:e;let n=this.nextPromptCapabilities,r=this.planMode?{type:`plan`}:void 0;if(this.nextPromptCapabilities=[],this.planMode){this.planMode=!1;let e=this.onPlanModeConsumed;this.onPlanModeConsumed=void 0,e?.()}let i=this.state.messages.length,a=t;this.state.messages=[...this.state.messages,a],this.state.contextUsage=null,this.emitToListeners({type:`message_start`,message:a}),this.state.isStreaming||(this.state.isStreaming=!0,this.state.errorMessage=void 0,this.emitToListeners({type:`agent_start`}));let o=new AbortController,s=setTimeout(()=>o.abort(),3e4),c=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/prompt`;fetch(c,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:a,selectedCapabilities:n,command:r}),signal:o.signal}).then(e=>{if(clearTimeout(s),!e.ok)throw Error(`Failed to send prompt: HTTP ${e.status}`)}).catch(e=>{clearTimeout(s);let t=e instanceof Error?e.message:String(e);B.error(`Failed to send prompt:`,e),this.state.messages.length===i+1&&this.state.messages[this.state.messages.length-1]===a&&(this.state.messages=this.state.messages.slice(0,-1)),this.state.errorMessage=t,this.state.isStreaming=!1,this.state.streamingMessage=void 0,this.stopStateWatchdog(),this.emitToListeners({type:`error`,error:t}),this.emitToListeners({type:`agent_end`,messages:this.state.messages})}),this.startStateWatchdog()}abort(){let e=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/abort`;fetch(e,{method:`POST`}).catch(e=>{B.error(`Failed to abort:`,e)})}steer(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/steer`;fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:e})}).catch(e=>{B.error(`Failed to send steer:`,e)})}followUp(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/follow-up`;fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:e})}).catch(e=>{B.error(`Failed to send follow-up:`,e)})}reset(){this.state.messages=[],this.state.errorMessage=void 0,this.state.isStreaming=!1,this.state.streamingMessage=void 0,this.state.pendingToolCalls=new Set,this.state.pendingToolApproval=null,this.state.pendingAutoCompactApproval=null}async updateAccessMode(e){let t=X(e),n=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/access-mode`,r=await fetch(n,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({accessMode:t})});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error||`Failed to sync Agent access mode: HTTP ${r.status}`)}this.state.accessMode=t,this.state.yoloMode=nn(t)}async updateYoloMode(e){await this.updateAccessMode(e?`full-access`:`default`)}async updateModel(e){this.state.model=e,this.state.contextUsage=null;let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/model`;fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({model:e})}).catch(e=>{B.error(`Failed to sync model update to server:`,e)})}async updateThinkingLevel(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/thinking-level`;fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({thinkingLevel:e})}).catch(e=>{B.error(`Failed to sync thinking level update to server:`,e)})}async rollback(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/rollback`,n=await fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({messageIndex:e})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`Failed to roll back: HTTP ${n.status}`);return r}async continue(){let e=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/continue`,t=await fetch(e,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||`Failed to continue: HTTP ${t.status}`)}this.state.isStreaming=!0,this.state.errorMessage=void 0,this.startStateWatchdog()}async approveToolCall(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/approve-tool`,n=await fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({toolCallId:e})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error||`Failed to approve tool call: HTTP ${n.status}`)}this.state.pendingToolApproval?.toolCallId===e&&(this.state.pendingToolApproval=null)}async rejectToolCall(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/reject-tool`,n=await fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({toolCallId:e})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error||`Failed to reject tool call: HTTP ${n.status}`)}this.state.pendingToolApproval?.toolCallId===e&&(this.state.pendingToolApproval=null)}async approveAutoCompact(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/approve-auto-compact`,n=await fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({approvalId:e})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error||`Failed to approve auto compact: HTTP ${n.status}`)}this.state.pendingAutoCompactApproval?.approvalId===e&&(this.state.pendingAutoCompactApproval=null)}async rejectAutoCompact(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/reject-auto-compact`,n=await fetch(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({approvalId:e})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error||`Failed to reject auto compact: HTTP ${n.status}`)}this.state.pendingAutoCompactApproval?.approvalId===e&&(this.state.pendingAutoCompactApproval=null)}dispose(){this.disposed=!0,this.pollTimer&&=(clearInterval(this.pollTimer),null),this.statusPromise=null,this.unsubscribeSse?.(),this.unsubscribeSse=void 0,this.listeners.clear()}handleSseEvent(e){if(this.noteSseEvent(e)){switch(e.type){case`state`:{let t=e;if(t.systemPrompt!==void 0&&(this.state.systemPrompt=t.systemPrompt),t.messages&&(t.messages.length>this.state.messages.length||!this.state.isStreaming&&t.messages.length===this.state.messages.length)&&(this.state.messages=t.messages,this.stateVersion++),t.model&&(this.state.model=t.model),t.thinkingLevel&&(this._syncingThinkingLevel=!0,this.state.thinkingLevel=t.thinkingLevel,this._syncingThinkingLevel=!1),t.accessMode!==void 0||t.yoloMode!==void 0){let e=X(t.accessMode,tn(t.yoloMode));this.state.accessMode=e,this.state.yoloMode=nn(e)}t.tools&&(this.state.tools=t.tools),t.contextCompaction!==void 0&&(this.state.contextCompaction=t.contextCompaction),t.contextUsage===void 0?t.messages&&(this.state.contextUsage=null):this.state.contextUsage=t.contextUsage,t.pendingToolApproval!==void 0&&(this.state.pendingToolApproval=t.pendingToolApproval),t.pendingAutoCompactApproval!==void 0&&(this.state.pendingAutoCompactApproval=t.pendingAutoCompactApproval),t.pendingToolCalls!==void 0&&(this.state.pendingToolCalls=new Set(t.pendingToolCalls));let n=this.state.isStreaming;t.isStreaming!==void 0&&(n=this.state.isStreaming,this.state.isStreaming=t.isStreaming,t.isStreaming?this.startStateWatchdog():this.stopStateWatchdog()),t.isStreaming?(this.state.errorMessage=void 0,this.emitToListeners({type:`agent_start`})):n&&(this.stateVersion++,this.emitToListeners({type:`agent_end`,messages:this.state.messages}));return}case`agent_start`:this.state.isStreaming=!0,this.state.errorMessage=void 0,this.state.pendingToolApproval=null,this.state.pendingAutoCompactApproval=null,this.startStateWatchdog();break;case`agent_end`:{this.stopStateWatchdog();let t=e;if(t.messages&&t.messages.length>=this.state.messages.length){this.state.messages=t.messages,this.state.contextUsage=t.contextUsage===void 0?null:t.contextUsage,this.state.isStreaming=!1,this.state.streamingMessage=void 0,this.state.pendingToolApproval=null,this.state.pendingAutoCompactApproval=null,t.errorMessage&&(this.state.errorMessage=t.errorMessage),this.stateVersion++,this.emitToListeners(e);return}this.refreshStateFromServer({forceMessages:!0}).finally(()=>{this.state.isStreaming=!1,this.state.streamingMessage=void 0,this.state.pendingToolApproval=null,this.state.pendingAutoCompactApproval=null,t.errorMessage&&(this.state.errorMessage=t.errorMessage),this.emitToListeners(e)});return}case`message_end`:{let t=e;if(t.message){this.state.messages=Cs(this.state.messages,t.message),this.state.contextUsage=t.contextUsage===void 0?null:t.contextUsage,this.stateVersion++,this.emitToListeners(e);return}if(t.messages&&t.messages.length>=this.state.messages.length){this.state.messages=t.messages,this.state.contextUsage=t.contextUsage===void 0?null:t.contextUsage,this.stateVersion++,this.emitToListeners(e);return}this.refreshStateFromServer().finally(()=>{this.emitToListeners(e)});return}case`turn_end`:{let t=e;if(t.messages&&t.messages.length>=this.state.messages.length){this.state.messages=t.messages,this.state.contextUsage=t.contextUsage===void 0?null:t.contextUsage,this.stateVersion++,this.emitToListeners(e);return}this.refreshStateFromServer().finally(()=>{this.emitToListeners(e)});return}case`messages_replaced`:{let t=e;t.messages&&(this.state.messages=t.messages,this.state.streamingMessage=void 0,this.stateVersion++),t.contextCompaction!==void 0&&(this.state.contextCompaction=t.contextCompaction),t.contextUsage===void 0?t.messages&&(this.state.contextUsage=null):this.state.contextUsage=t.contextUsage;break}case`error`:{let t=e.error;this.state.errorMessage=t||`Unknown error`,this.state.pendingToolApproval=null,this.state.pendingAutoCompactApproval=null;break}case`title_updated`:break;case`session_forked`:break;case`tool_execution_start`:{let t=e;t.toolCallId&&(this.state.messages=Os(this.state.messages,Ds(t,this.sessionId),!0),this.state.pendingToolCalls=new Set([...this.state.pendingToolCalls,t.toolCallId]),this.stateVersion++);break}case`tool_execution_update`:{let t=e;this.state.messages=Os(this.state.messages,t,!0),t.toolCallId&&(this.state.pendingToolCalls=new Set([...this.state.pendingToolCalls,t.toolCallId])),this.stateVersion++;break}case`tool_execution_end`:{let t=e;if(this.state.messages=Os(this.state.messages,t,!1),t.toolCallId){let e=new Set(this.state.pendingToolCalls);e.delete(t.toolCallId),this.state.pendingToolCalls=e}this.stateVersion++;break}case`auto_compact_completed`:{let t=e;t.contextCompaction!==void 0&&(this.state.contextCompaction=t.contextCompaction),t.contextUsage!==void 0&&(this.state.contextUsage=t.contextUsage);break}case`auto_compact_failed`:case`message_start`:case`message_update`:case`turn_start`:case`auto_compact_threshold_reached`:break;case`tool_approval_required`:{let t=e;typeof t.toolCallId==`string`&&typeof t.toolName==`string`&&(this.state.pendingToolApproval=t,this.state.pendingAutoCompactApproval=null);break}case`auto_compact_approval_required`:{let t=e;typeof t.approvalId==`string`&&(this.state.pendingAutoCompactApproval=t,this.state.pendingToolApproval=null);break}}this.emitToListeners(e)}}emitToListeners(e){for(let t of this.listeners)try{t(e)}catch{}}noteSseEvent(e){this.lastSseEventAt=Date.now();let t=e.stateVersion;if(typeof t==`number`&&Number.isFinite(t)){if(t<this.lastServerStateVersion)return!1;this.lastServerStateVersion=t}return!0}startStateWatchdog(){this.pollTimer||this.disposed||(this.lastSseEventAt=Date.now(),this.pollTimer=setInterval(()=>{if(this.disposed||!this.state.isStreaming){this.stopStateWatchdog();return}Date.now()-this.lastSseEventAt<js||this.refreshStatusFromServer()},As))}stopStateWatchdog(){this.pollTimer&&=(clearInterval(this.pollTimer),null)}async refreshStatusFromServer(){return this.statusPromise||=this._doRefreshStatusFromServer().finally(()=>{this.statusPromise=null}),this.statusPromise}async _doRefreshStatusFromServer(){let e=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/status`;try{let{response:t,body:n}=await Ps(e,Ms);if(!t.ok){t.status===404&&this.state.isStreaming&&(this.state.isStreaming=!1,this.stopStateWatchdog(),this.emitToListeners({type:`agent_end`,messages:this.state.messages}));return}let r=n??{};this.lastSseEventAt=Date.now();let i=typeof r.stateVersion==`number`&&Number.isFinite(r.stateVersion)?r.stateVersion:this.lastServerStateVersion;if(r.isStreaming===!1){let e=this.state.isStreaming;this.stopStateWatchdog(),await this.refreshStateFromServer({notify:!0,forceMessages:!0}),e&&this.state.isStreaming&&(this.state.isStreaming=!1,this.state.streamingMessage=void 0,this.state.pendingToolApproval=null,this.state.pendingAutoCompactApproval=null,this.emitToListeners({type:`agent_end`,messages:this.state.messages}));return}r.isStreaming===!0&&(this.state.isStreaming=!0,this.state.errorMessage=r.errorMessage),i>this.lastServerStateVersion&&await this.refreshStateFromServer({notify:!0,forceMessages:!0})}catch{}}async syncState(){await this.refreshStateFromServer({notify:!0,forceMessages:!0})}async refreshStateFromServer(e){return this.refreshPromise||=this._doRefreshStateFromServer(e).finally(()=>{this.refreshPromise=null}),this.refreshPromise}async _doRefreshStateFromServer(e){let t=`${this.baseUrl}/api/agents/${encodeURIComponent(this.sessionId)}/state`;try{let n=this.stateVersion,{response:r,body:i}=await Ps(t,Ns);if(!r.ok){r.status===404&&this.state.isStreaming&&(this.state.isStreaming=!1,this.stopStateWatchdog(),this.emitToListeners({type:`agent_end`,messages:this.state.messages}));return}let a=i??{},o=typeof a.stateVersion==`number`&&Number.isFinite(a.stateVersion)?a.stateVersion:void 0;if(o!==void 0&&o<this.lastServerStateVersion||n!==this.stateVersion)return;o!==void 0&&(this.lastServerStateVersion=o);let s=!!(a.messages&&(e?.forceMessages||a.messages.length>this.state.messages.length||!this.state.isStreaming&&a.messages.length===this.state.messages.length));if(s&&a.messages&&(this.state.messages=a.messages,this.state.contextUsage=a.contextUsage===void 0?null:a.contextUsage,this.stateVersion++),a.systemPrompt!==void 0&&(this.state.systemPrompt=a.systemPrompt),a.model&&(this.state.model=a.model),a.thinkingLevel&&(this._syncingThinkingLevel=!0,this.state.thinkingLevel=a.thinkingLevel,this._syncingThinkingLevel=!1),a.accessMode!==void 0||a.yoloMode!==void 0){let e=X(a.accessMode,tn(a.yoloMode));this.state.accessMode=e,this.state.yoloMode=nn(e)}if(a.tools&&(this.state.tools=a.tools),a.contextCompaction!==void 0&&(this.state.contextCompaction=a.contextCompaction),a.contextUsage!==void 0&&(this.state.contextUsage=a.contextUsage),a.pendingToolApproval!==void 0&&(this.state.pendingToolApproval=a.pendingToolApproval),a.pendingAutoCompactApproval!==void 0&&(this.state.pendingAutoCompactApproval=a.pendingAutoCompactApproval),a.pendingToolCalls!==void 0&&(this.state.pendingToolCalls=new Set(a.pendingToolCalls)),a.isStreaming!==void 0){let t=this.state.isStreaming;if(this.state.isStreaming=!!a.isStreaming,a.isStreaming?(this.state.errorMessage=void 0,t||this.emitToListeners({type:`agent_start`})):(this.stopStateWatchdog(),this.state.pendingToolApproval=null,this.state.pendingAutoCompactApproval=null),e?.notify&&t&&!a.isStreaming){this.stateVersion++,this.emitToListeners({type:`agent_end`,messages:this.state.messages});return}}if(e?.notify)if(a.isStreaming&&s){let e=this.state.messages[this.state.messages.length-1];e&&this.emitToListeners({type:`message_update`,message:e})}else a.isStreaming||this.emitToListeners({type:`message_end`})}catch{}}static async restore(t,n={}){let r=n.baseUrl??``,i=performance.now(),{response:a,body:o}=await Ps(`${r}/api/agents/${encodeURIComponent(t)}/restore`,Ns,{method:`POST`,signal:n.signal});if(!a.ok)throw Error(o?.error||`Failed to restore agent: HTTP ${a.status}`);if(n.signal?.aborted)throw n.signal.reason??new DOMException(`Aborted`,`AbortError`);let s=o??{},c=new e({sessionId:t,baseUrl:r,initialState:{systemPrompt:s.systemPrompt??``,model:s.model??null,thinkingLevel:s.thinkingLevel??`off`,messages:s.messages??[],tools:s.tools??[],accessMode:X(s.accessMode,s.yoloMode),yoloMode:!!s.yoloMode,isStreaming:!!s.isStreaming,pendingToolCalls:s.pendingToolCalls??[],errorMessage:s.errorMessage,contextCompaction:s.contextCompaction,contextUsage:s.contextUsage,pendingToolApproval:s.pendingToolApproval,pendingAutoCompactApproval:s.pendingAutoCompactApproval,stateVersion:s.stateVersion}});return B.debug(`Restored ServerAgent`,{sessionId:t,messageCount:s.messages?.length??0,durationMs:Math.round((performance.now()-i)*10)/10}),{agent:c,snapshot:s}}static async create(t,n={}){let r=n.baseUrl??``,i=await fetch(`${r}/api/agents/${encodeURIComponent(t)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({scope:n.scope??`global`,projectId:n.projectId,source:n.source,channelId:n.channelId,channelName:n.channelName,accessMode:n.accessMode,yoloMode:n.yoloMode??nn(X(n.accessMode)),model:n.model,thinkingLevel:n.thinkingLevel??`off`,messages:n.messages??[],title:n.title??`New chat`,contextCompaction:n.contextCompaction})});if(!i.ok){let e=await i.json().catch(()=>({error:`Failed to create agent`}));throw Error(e.error||`Failed to create agent`)}let a={};try{let{response:e,body:n}=await Ps(`${r}/api/agents/${encodeURIComponent(t)}/state`,Ns);e.ok&&(a=n??{})}catch{}return new e({sessionId:t,baseUrl:r,initialState:{systemPrompt:a.systemPrompt??``,model:a.model??n.model??null,thinkingLevel:a.thinkingLevel??n.thinkingLevel??`off`,messages:a.messages??n.messages??[],tools:a.tools??[],accessMode:X(a.accessMode,n.accessMode??a.yoloMode??n.yoloMode),yoloMode:!!(a.yoloMode??n.yoloMode),isStreaming:!!a.isStreaming,pendingToolCalls:a.pendingToolCalls??[],errorMessage:a.errorMessage,contextCompaction:a.contextCompaction,contextUsage:a.contextUsage,pendingToolApproval:a.pendingToolApproval,pendingAutoCompactApproval:a.pendingAutoCompactApproval,stateVersion:a.stateVersion}})}},Vs=class{sessionId;streamFn=We;getApiKey;scope;project;createAgent;listeners=new Set;disposed=!1;realAgentPromise;promotedAgent;nextPromptCapabilities=[];planMode=!1;onPlanModeConsumed;state;constructor(e){this.sessionId=`pending-${Y()}`,this.scope=e.scope,this.project=e.project,this.createAgent=e.createAgent;let t=X(e.accessMode,e.yoloMode?`full-access`:`default`);this.state={systemPrompt:``,model:e.model,thinkingLevel:e.thinkingLevel,messages:[],tools:[],accessMode:t,yoloMode:nn(t),isStreaming:!1,pendingToolCalls:new Set,contextCompaction:null,contextUsage:null}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setNextPromptCapabilities(e){this.nextPromptCapabilities=Array.isArray(e)?e.slice(0,4):[]}setPlanMode(e,t){this.planMode=e,this.onPlanModeConsumed=e?t:void 0}async prompt(e){if(this.disposed||this.state.isStreaming)return;let t=this.normalizePromptInput(e),n=this.state.messages.length;this.state.messages=[...this.state.messages,t],this.state.contextUsage=null,this.emitToListeners({type:`message_start`,message:t}),this.state.isStreaming=!0,this.state.errorMessage=void 0,this.emitToListeners({type:`agent_start`});let r;try{r=await this.ensureRealAgent()}catch(e){this.state.messages.length===n+1&&this.state.messages[this.state.messages.length-1]===t&&(this.state.messages=this.state.messages.slice(0,-1));let r=e instanceof Error?e.message:String(e);throw this.state.errorMessage=r,this.state.isStreaming=!1,this.state.streamingMessage=void 0,this.emitToListeners({type:`error`,error:r}),this.emitToListeners({type:`agent_end`,messages:this.state.messages}),e}r.setNextPromptCapabilities(this.nextPromptCapabilities),r.setPlanMode(this.planMode,this.onPlanModeConsumed),this.nextPromptCapabilities=[],this.planMode=!1,this.onPlanModeConsumed=void 0,await r.prompt(t)}abort(){this.realAgentPromise?.then(e=>e.abort())}reset(){this.state.messages=[],this.state.isStreaming=!1,this.state.streamingMessage=void 0,this.state.pendingToolCalls=new Set,this.state.errorMessage=void 0}async rollback(){throw Error(`Cannot roll back a pending chat`)}async continue(){await(await this.ensureRealAgent()).continue()}async approveToolCall(){throw Error(`No pending tool call`)}async rejectToolCall(){throw Error(`No pending tool call`)}async approveAutoCompact(){throw Error(`No pending auto compact request`)}async rejectAutoCompact(){throw Error(`No pending auto compact request`)}async updateAccessMode(e){let t=X(e);this.state.accessMode=t,this.state.yoloMode=nn(t);let n=await this.realAgentPromise;n&&await n.updateAccessMode(t)}async updateYoloMode(e){await this.updateAccessMode(e?`full-access`:`default`)}async updateModel(e){this.state.model=e;let t=await this.realAgentPromise;t&&await t.updateModel(e)}async updateThinkingLevel(e){this.state.thinkingLevel=e;let t=await this.realAgentPromise;t&&await t.updateThinkingLevel(e)}dispose(){this.disposed=!0,this.listeners.clear(),this.promotedAgent||this.realAgentPromise?.then(e=>{this.promotedAgent!==e&&e.dispose()}).catch(()=>{})}promoteTo(e){this.promotedAgent=e,this.listeners.clear()}normalizePromptInput(e){return typeof e==`string`?{role:`user`,content:e,timestamp:Date.now()}:Array.isArray(e)?[...e].reverse().find(e=>e.role===`user`||e.role===`user-with-attachments`)??e[e.length-1]:e}emitToListeners(e){for(let t of this.listeners)try{t(e)}catch{}}async ensureRealAgent(){if(!this.realAgentPromise){let e=Y();this.realAgentPromise=this.createAgent({model:this.state.model,thinkingLevel:this.state.thinkingLevel,tools:[]},e,{scope:this.scope,project:this.project,attachToView:!0,accessMode:this.state.accessMode,yoloMode:this.state.yoloMode}).then(e=>(this.disposed&&this.promotedAgent!==e&&e.dispose(),e))}return this.realAgentPromise}};function Hs(e,t=` `){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&`text`in e&&typeof e.text==`string`).map(e=>e.text).join(t):``}function Us(e){return e.role===`assistant`?Hs(e.content,`
61
-
62
- `).trim():``}function Ws(e,t){let n=t;if(e[t]?.role===`assistant`){for(let r=t-1;r>=0;r--)if(e[r].role===`user`||e[r].role===`user-with-attachments`){n=r;break}}let r=e[n];return!r||r.role!==`user`&&r.role!==`user-with-attachments`?-1:n}function Gs(e){return e.role!==`user`&&e.role!==`user-with-attachments`?``:typeof e.content==`string`?e.content:Hs(e.content,`
63
-
64
- `)}async function Ks(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.append(t),t.select(),document.execCommand(`copy`),t.remove()}function qs(e){let t=e.find(e=>e.role===`user`||e.role===`user-with-attachments`);if(!t||t.role!==`user`&&t.role!==`user-with-attachments`)return`New chat`;let n=t.content,r=(typeof n==`string`?n:Hs(n)).trim().replace(/\s+/g,` `);return r?r.length>46?`${r.slice(0,43)}...`:r:`New chat`}function Js(e){return e===`New chat`||e===H(`newChat`)}function Ys(e){return e.some(e=>e.role===`user`||e.role===`user-with-attachments`)}function Xs(e){return Ys(e)&&e.some(e=>e.role===`assistant`)}var Zs=new Set([`idle`,`error`,`aborted`]);function Qs(e,t=Date.now()){e.lastAccessedAt=t}function $s(e,t,n=5){let r=Array.from(e).filter(e=>e.sessionId!==t&&e.status!==`running`&&!e.agent.state.isStreaming&&Zs.has(e.status));return r.length<=n?[]:(r.sort((e,t)=>(e.lastAccessedAt??0)-(t.lastAccessedAt??0)),r.slice(0,r.length-n).map(e=>e.sessionId))}function ec(e,t){let n=e.get(t);return n?(n.unsubscribe(),n.agent.dispose(),e.delete(t),!0):!1}function tc(e){for(let t of[...e.keys()])ec(e,t)}function nc({title:e,description:t,actions:n,onCancel:r}){let i=(0,V.useRef)(null),a=(0,V.useRef)(!1),o=(0,V.useCallback)(()=>{a.current||(a.current=!0,r())},[r]),s=(0,V.useCallback)(e=>{a.current||(a.current=!0,e.onClick())},[]);return(0,V.useEffect)(()=>{i.current?.focus();let e=e=>{if(e.key===`Escape`&&o(),e.key===`Enter`){let e;for(let t=n.length-1;t>=0;t--)if(n[t].enter!==!1){e=n[t];break}e&&s(e)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o,s,n]),(0,fr.createPortal)((0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/45 px-4 py-6`,onMouseDown:e=>{e.target===e.currentTarget&&o()},children:(0,G.jsxs)(`div`,{className:W(`w-full max-w-[420px] rounded-2xl border border-border bg-background p-5 shadow-quickforge`),role:`dialog`,"aria-modal":`true`,"aria-labelledby":e?`message-dialog-title`:void 0,"aria-describedby":`message-dialog-description`,onMouseDown:e=>e.stopPropagation(),children:[e?(0,G.jsx)(`h2`,{id:`message-dialog-title`,className:`text-base font-semibold text-foreground/90`,children:e}):null,(0,G.jsx)(`p`,{id:`message-dialog-description`,className:W(`text-sm leading-6 text-muted-foreground/72`,e?`mt-2`:void 0),children:t}),(0,G.jsx)(`div`,{className:`mt-6 flex justify-end gap-2`,children:n.map((e,t)=>(0,G.jsx)(K,{ref:e.autoFocus?i:void 0,variant:e.variant,size:`sm`,onClick:()=>s(e),children:e.label},`${e.label}-${t}`))})]})}),document.body)}function rc(e){return new Promise(t=>{let n=document.createElement(`div`);document.body.appendChild(n);let r=(0,qe.createRoot)(n);function i(){r.unmount(),setTimeout(()=>n.remove(),0)}function a(e){i(),t(e)}r.render(e(a))})}function ic(e){return rc(t=>(0,G.jsx)(nc,{title:e.title,description:e.description,onCancel:()=>t(!1),actions:[{label:e.cancelLabel??`Cancel`,variant:`outline`,onClick:()=>t(!1),autoFocus:e.variant===`destructive`},{label:e.confirmLabel??`Confirm`,variant:e.variant===`destructive`?`destructive`:`default`,autoFocus:e.variant!==`destructive`,enter:e.variant!==`destructive`,onClick:()=>t(!0)}]}))}function ac(e){let t=typeof e==`string`?{description:e}:e;return rc(e=>(0,G.jsx)(nc,{title:t.title,description:t.description,onCancel:()=>e(),actions:[{label:t.confirmLabel??`OK`,autoFocus:!0,onClick:()=>e()}]}))}function oc(e){let{storageRef:t,activeModelRef:n,agentAccessModeRef:r,activeProjectRef:i,defaultWorkspaceRef:a,setAgentAccessMode:o,switchActiveProject:s,refreshSessions:c,updateSessionTitle:l}=e,u=(0,V.useRef)(null),d=(0,V.useRef)(new Map),f=(0,V.useRef)(`global`),p=(0,V.useRef)(void 0),m=(0,V.useRef)(`New chat`),h=(0,V.useRef)(void 0),g=(0,V.useRef)(null),_=(0,V.useRef)(0),v=(0,V.useRef)(null),y=(0,V.useRef)(e.onTaskComplete);(0,V.useEffect)(()=>{y.current=e.onTaskComplete}),(0,V.useEffect)(()=>()=>{v.current?.abort()},[]);let[b,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(),[w,T]=(0,V.useState)(`New chat`),[E,D]=(0,V.useState)(`global`),[O,k]=(0,V.useState)(),[ee,A]=(0,V.useState)({}),[j,M]=(0,V.useState)(0),[N,P]=(0,V.useState)(),te=(0,V.useCallback)(e=>{e.length!==0&&A(t=>{let n={...t},r=!1;for(let t of e)Object.prototype.hasOwnProperty.call(n,t)&&(delete n[t],r=!0);return r?n:t})},[]),ne=(0,V.useCallback)(e=>{let t=$s(d.current.values(),e);for(let e of t)ec(d.current,e);te(t)},[te]),F=(0,V.useCallback)((e,t)=>{!e||e===t||[...d.current.values()].some(t=>t.agent===e)||e.dispose()},[d]),I=(0,V.useCallback)(async e=>{if(p.current===e.sessionId){let t=e.agent.state.messages,n=e.title;Js(n)&&(n=qs(t)),h.current=e.createdAt??new Date().toISOString(),m.current=n,T(n)}await c({broadcast:!0})},[c]),L=(0,V.useCallback)(e=>{F(u.current,e.agent),Qs(e),f.current=e.scope,p.current=e.sessionId,h.current=e.createdAt,m.current=e.title,D(e.scope),C(e.sessionId),T(e.title),k(e.project),u.current=e.agent,x(e.agent);let t=new URL(window.location.href);t.searchParams.set(`session`,e.sessionId),window.history.replaceState({},``,t)},[F]),R=(0,V.useCallback)(async(e,s=Y(),h)=>{let _=u.current,v=d.current.get(s);if(v)return h?.attachToView!==!1&&h?.shouldAttachToView?.()!==!1&&(F(_,v.agent),L(v)),v.agent;let b=h?.scope??f.current,x=b===`project`?h?.project??i.current:h?.project??a.current;if(b===`project`&&!x?.id)throw Error(`Cannot create project chat without an active project.`);let S=new Date().toISOString(),{model:C,thinkingLevel:w,tools:E,...D}=e??{},O=t.current,k=O?await En(O):{},ee=C??k.model??n.current,j=O?await Fn(O,ee):gn(ee),M=w??k.thinkingLevel??Cn(j);n.current=j;let N=X(h?.accessMode,h?.yoloMode??r.current);r.current=N,o(N);let P=await Bs.create(s,{scope:b,projectId:b===`project`?x?.id:void 0,source:h?.source,channelId:h?.channelId,channelName:h?.channelName,accessMode:N,yoloMode:nn(N),model:j,thinkingLevel:M,messages:D.messages??[],title:h?.title,contextCompaction:D.contextCompaction});D.contextCompaction&&!P.state.contextCompaction&&(P.state.contextCompaction=D.contextCompaction);let te=P.state.isStreaming?`running`:P.state.errorMessage?`error`:`idle`,R={sessionId:P.sessionId,agent:P,scope:b,project:x,title:h?.title??`New chat`,createdAt:h?.createdAt??S,status:te,startedAt:S,lastAccessedAt:Date.now(),unsubscribe:()=>void 0};return R.unsubscribe=P.subscribe(e=>{if(e.type===`agent_start`&&(R.status=`running`,R.startedAt=R.startedAt??new Date().toISOString(),R.finishedAt=void 0,A(e=>({...e,[R.sessionId]:R.status}))),e.type===`message_end`&&(P.state.messages=[...P.state.messages]),e.type===`agent_end`){let t=R.status===`running`,n=e;R.status=n.status===`aborted`?`aborted`:n.errorMessage||P.state.errorMessage?`error`:`idle`,R.finishedAt=new Date().toISOString(),Qs(R),A(e=>({...e,[R.sessionId]:R.status})),I(R).catch(e=>B.error(`Failed to sync session UI:`,e)),t&&y.current?.(R.sessionId,R.title,R.status),ne(p.current)}if(e.type===`title_updated`){let t=e;t.title&&(R.title=t.title),R.sessionId===p.current&&t.title&&(m.current=t.title,T(t.title)),t.title&&l(R.sessionId,t.title)}if(e.type===`session_forked`){let t=e;if(!t.targetSessionId)return;c({broadcast:!0}).catch(e=>B.error(`Failed to refresh sessions:`,e)),g.current?.(t.targetSessionId,{title:t.title,createdAt:t.createdAt,scope:t.scope,projectId:t.projectId??void 0})}}),d.current.set(s,R),R.status!==`idle`&&A(e=>({...e,[R.sessionId]:R.status})),h?.attachToView!==!1&&h?.shouldAttachToView?.()!==!1&&(_ instanceof Vs?_.promoteTo(R.agent):u.current===_&&F(_,R.agent),L(R)),ne(p.current),h?.refreshSessions!==!1&&P.state.messages.length>0&&await c({broadcast:!0}),P},[L,F,ne,c,I,l,t,n,r,i,a,o]),re=(0,V.useCallback)(async e=>{let i=t.current,o=i?await En(i):{},s=o.model??n.current,c=i?await Fn(i,s):gn(s),l=o.thinkingLevel??Cn(c);n.current=c;let d=e.scope,g=d===`project`?e.project:e.project??a.current,_=new Vs({scope:d,project:g,model:c,thinkingLevel:l,accessMode:r.current,yoloMode:nn(r.current),createAgent:R});_.subscribe(e=>{u.current===_&&(e.type===`message_start`||e.type===`agent_end`)&&M(e=>e+1)}),F(u.current),f.current=d,p.current=void 0,h.current=void 0,m.current=`New chat`,D(d),C(void 0),T(`New chat`),k(g),u.current=_,x(_);let v=new URL(window.location.href);return v.searchParams.delete(`session`),window.history.replaceState({},``,v),_},[n,R,a,F,t,r]),ie=(0,V.useCallback)(async(e,t)=>{let u=++_.current;v.current?.abort();let f=new AbortController;v.current=f;let h=()=>_.current===u&&!f.signal.aborted;P(e);try{if(!h())return!1;let u=d.current.get(e);if(u){if(u.scope===`project`&&u.project?.id&&i.current?.id!==u.project.id)try{await s(u.project.id)}catch(e){B.error(`Failed to switch project for running session:`,e)}return h()?(L(u),ne(u.sessionId),!0):!1}let _,v;try{let t=await Bs.restore(e,{signal:f.signal});_=t.agent,v=t.snapshot}catch(e){return f.signal.aborted||!h()||B.error(`Failed to restore session:`,e),!1}if(!h())return _.dispose(),!1;let b=t?.scope??v.scope??`global`,x=t?.projectId??v.projectId??void 0,S;if(b===`project`&&x)if(i.current?.id!==x)try{S=await s(x)}catch(e){return _.dispose(),B.error(`Failed to switch project for session:`,e),h()&&ac(H(`projectSwitchFailed`)),!1}else S=i.current;if(!h())return _.dispose(),!1;n.current=_.state.model;let C=X(_.state.accessMode,_.state.yoloMode);r.current=C,o(C);let w={sessionId:e,agent:_,scope:b,project:b===`project`?S:a.current,title:v.title??t?.title??`New chat`,createdAt:v.createdAt??t?.createdAt??new Date().toISOString(),status:v.status===`running`||_.state.isStreaming?`running`:_.state.errorMessage?`error`:v.status===`aborted`?`aborted`:`idle`,startedAt:v.startedAt??void 0,finishedAt:v.finishedAt??void 0,lastAccessedAt:Date.now(),unsubscribe:()=>void 0};return w.unsubscribe=_.subscribe(e=>{if(e.type===`agent_start`&&(w.status=`running`,w.startedAt=w.startedAt??new Date().toISOString(),w.finishedAt=void 0,A(e=>({...e,[w.sessionId]:w.status}))),e.type===`message_end`&&(_.state.messages=[..._.state.messages]),e.type===`agent_end`){let t=w.status===`running`,n=e;w.status=n.status===`aborted`?`aborted`:n.errorMessage||_.state.errorMessage?`error`:`idle`,w.finishedAt=new Date().toISOString(),Qs(w),A(e=>({...e,[w.sessionId]:w.status})),I(w).catch(e=>B.error(`Failed to sync session UI:`,e)),t&&y.current?.(w.sessionId,w.title,w.status),ne(p.current)}if(e.type===`title_updated`){let t=e;t.title&&(w.title=t.title),w.sessionId===p.current&&t.title&&(m.current=t.title,T(t.title)),t.title&&l(w.sessionId,t.title)}if(e.type===`session_forked`){let t=e;if(!t.targetSessionId)return;c({broadcast:!0}).catch(e=>B.error(`Failed to refresh sessions:`,e)),g.current?.(t.targetSessionId,{title:t.title,createdAt:t.createdAt,scope:t.scope,projectId:t.projectId??void 0})}}),d.current.set(e,w),w.status!==`idle`&&A(e=>({...e,[w.sessionId]:w.status})),L(w),ne(e),!0}finally{v.current===f&&(v.current=null),_.current===u&&P(void 0)}},[n,i,r,L,a,ne,c,o,s,I,l]);return(0,V.useEffect)(()=>{g.current=ie},[ie]),{agentRef:u,taskMapRef:d,currentSessionIdRef:p,currentChatScopeRef:f,agent:b,currentSessionId:S,currentTitle:w,chatScope:E,currentToolProject:O,taskStatuses:ee,chatPanelRevision:j,loadingSessionId:N,createAgent:R,startDeferredSession:re,loadSession:ie,syncSessionUI:I,setChatPanelRevision:M,setCurrentAgentMessages:(0,V.useCallback)(e=>{u.current&&(u.current.state.messages=e)},[]),updateCurrentAgentModel:(0,V.useCallback)(e=>{u.current&&(u.current.state.model=e,u.current.updateModel(e).catch(e=>{B.error(`Failed to sync model to server:`,e)}))},[]),setCurrentTitleRef:(0,V.useCallback)(e=>{m.current=e,T(e)},[])}}function sc(e){if(!e)return 0;let t=new Date(e).getTime();return Number.isNaN(t)?0:t}function cc(e,t){let n=t===`createdAt`?`createdAt`:`lastModified`;return[...e].sort((e,t)=>{let r=sc(t.pinnedAt)-sc(e.pinnedAt);return r===0?e.pinnedAt&&!t.pinnedAt?-1:!e.pinnedAt&&t.pinnedAt?1:sc(t[n])-sc(e[n]):r})}function lc(e){let t=new Set;return e.filter(e=>t.has(e.id)?!1:(t.add(e.id),!0))}function uc(e,t,n){let r=e.items.some(e=>e.id===t.id);return{...e,items:cc(lc([t,...e.items.filter(e=>e.id!==t.id)]),n),total:r?e.total:e.total+1}}function dc(e,t,n){return e.items.some(e=>e.id===t)?{...e,items:e.items.map(e=>e.id===t?{...e,title:n}:e)}:e}var fc=20;function pc(e){if(!e)return!1;let t=e.trim();return!t||t===`undefined`||t===`null`||t===`false`?!1:!Number.isNaN(Date.parse(t))}function mc({backendRef:e,expandedProjectIds:t,externalProjectIds:n,viewMode:r,sortMode:i,onBroadcastSessionsChanged:a}){let[o,s]=(0,V.useState)({items:[],total:0,loading:!1}),[c,l]=(0,V.useState)({items:[],total:0,loading:!1}),[u,d]=(0,V.useState)({}),[f,p]=(0,V.useState)({items:[],total:0,loading:!1}),m=(0,V.useRef)(u),h=(0,V.useRef)(t),g=(0,V.useRef)(n??new Set),_=(0,V.useRef)(0);(0,V.useEffect)(()=>{m.current=u},[u]),(0,V.useEffect)(()=>{h.current=t},[t]),(0,V.useEffect)(()=>{g.current=n??new Set},[n]);let v=(0,V.useCallback)(()=>(_.current+=1,_.current),[]),y=(0,V.useCallback)(e=>e===_.current,[]),b=(0,V.useMemo)(()=>lc([...c.items,...o.items,...Object.values(u).flatMap(e=>e.items),...f.items]),[c.items,o.items,u,f.items]),x=(0,V.useCallback)(async(t,n=_.current)=>{let r=e.current;if(r){l(e=>({...e,loading:!0}));try{let e=await r.fetchPaginatedFromIndex(`sessions-metadata`,`pinnedAt`,{direction:`desc`,limit:fc,offset:t,pinned:`only`});if(!y(n))return;let a=e.values.filter(e=>pc(e.pinnedAt));l(n=>({items:cc(t===0?a:lc([...n.items,...a]),i),total:e.total,loading:!1}))}catch{if(!y(n))return;l(e=>({...e,loading:!1}))}}},[e,y,i]),S=(0,V.useCallback)(async(t,n=_.current)=>{let r=e.current;if(r){s(e=>({...e,loading:!0}));try{let e=i===`createdAt`?`createdAt`:`lastModified`,a=await r.fetchPaginatedFromIndex(`sessions-metadata`,e,{direction:`desc`,limit:fc,offset:t,scope:`global`});if(!y(n))return;s(e=>({items:cc(t===0?a.values:lc([...e.items,...a.values]),i),total:a.total,loading:!1}))}catch{if(!y(n))return;s(e=>({...e,loading:!1}))}}},[e,y,i]),C=(0,V.useCallback)(async(t,n,r=_.current)=>{let a=e.current;if(a){d(e=>{let n=e[t];return{...e,[t]:{...n??{items:[],total:0},loading:!0}}});try{let e=i===`createdAt`?`createdAt`:`lastModified`,o=await a.fetchPaginatedFromIndex(`sessions-metadata`,e,{direction:`desc`,limit:fc,offset:n,scope:`project`,projectId:t});if(!y(r))return;d(e=>{let r=e[t]?.items??[];return{...e,[t]:{items:cc(n===0?o.values:lc([...r,...o.values]),i),total:o.total,loading:!1}}})}catch{if(!y(r))return;d(e=>{let n=e[t];return{...e,[t]:{...n??{items:[],total:0},loading:!1}}})}}},[e,y,i]),w=(0,V.useCallback)(async(t,n=_.current)=>{let r=e.current;if(r){p(e=>({...e,loading:!0}));try{let e=i===`createdAt`?`createdAt`:`lastModified`,a=await r.fetchPaginatedFromIndex(`sessions-metadata`,e,{direction:`desc`,limit:fc,offset:t,scope:`projects`});if(!y(n))return;p(e=>({items:cc(t===0?a.values:lc([...e.items,...a.values]),i),total:a.total,loading:!1}))}catch{if(!y(n))return;p(e=>({...e,loading:!1}))}}},[e,y,i]),T=(0,V.useCallback)(async t=>{if(!e.current)return;let n=v();if(await Promise.all([x(0,n),S(0,n)]),!y(n))return;if(r===`timeline`){d(e=>{let t={};for(let[n,r]of Object.entries(e))t[n]={...r,loading:!1};return t}),await w(0,n),t?.broadcast&&y(n)&&a?.();return}p(e=>({...e,loading:!1}));let i=new Set([...Object.keys(m.current),...h.current,...g.current]);i.size===0?d({}):await Promise.all([...i].map(e=>C(e,0,n))),t?.broadcast&&y(n)&&a?.()},[e,y,S,x,C,w,v,a,r]),E=(0,V.useCallback)(e=>{if(pc(e.pinnedAt)&&l(t=>uc(t,e,i)),e.scope===`project`&&e.projectId){d(t=>{let n=t[e.projectId];return n?{...t,[e.projectId]:uc(n,e,i)}:t}),r===`timeline`&&p(t=>uc(t,e,i));return}s(t=>uc(t,e,i))},[i,r]),D=(0,V.useCallback)((e,t)=>{l(n=>dc(n,e,t)),s(n=>dc(n,e,t)),p(n=>dc(n,e,t)),d(n=>{let r=!1,i=Object.fromEntries(Object.entries(n).map(([n,i])=>{let a=dc(i,e,t);return a!==i&&(r=!0),[n,a]}));return r?i:n})},[]),O=(0,V.useCallback)(e=>u[e]?.items??[],[u]),k=(0,V.useCallback)(e=>{let t=u[e];return t?t.items.length<t.total:!0},[u]),ee=(0,V.useCallback)(e=>u[e]?.loading??!1,[u]),A=(0,V.useCallback)(e=>e in u,[u]),j=(0,V.useCallback)(()=>{c.loading||c.items.length>=c.total||x(c.items.length)},[x,c.items.length,c.loading,c.total]),M=(0,V.useCallback)(()=>{S(o.items.length)},[o.items.length,S]),N=(0,V.useCallback)(e=>{let t=u[e];C(e,t?.items.length??0)},[C,u]),P=(0,V.useCallback)(()=>{f.loading||f.items.length>=f.total||w(f.items.length)},[w,f.items.length,f.loading,f.total]);return(0,V.useEffect)(()=>{Promise.resolve().then(()=>T())},[T]),{allLoadedSessions:b,pinnedSessions:c.items,pinnedHasMore:c.items.length<c.total,pinnedLoading:c.loading,globalSessions:o.items,sessionsForProject:O,projectTimelineSessions:f.items,projectTimelineHasMore:f.items.length<f.total,projectTimelineLoading:f.loading,globalHasMore:o.items.length<o.total,projectHasMore:k,globalLoading:o.loading,projectLoading:ee,projectLoaded:A,loadGlobalSessions:S,loadProjectSessions:C,refreshSessions:T,upsertSessionMetadata:E,updateSessionTitle:D,loadMorePinned:j,loadMoreGlobal:M,loadMoreProject:N,loadMoreProjectTimeline:P}}function hc(){let[e,t]=(0,V.useState)([]),n=(0,V.useCallback)(e=>{t(t=>[...t,{...e,id:Y(),createdAt:Date.now()}])},[]);return{toasts:e,handleTaskComplete:(0,V.useCallback)((e,t,r)=>{n({sessionId:e,title:t,status:r})},[n]),addToast:n,dismissToast:(0,V.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[])}}var gc=`tool-display-settings`,_c={toolDisplayMode:`compact`,showContextUsage:!1},vc={..._c};function yc(e){if(!e||typeof e!=`object`)return{..._c};let t=e;return{toolDisplayMode:t.toolDisplayMode===`detailed`?`detailed`:`compact`,showContextUsage:t.showContextUsage===!0}}function bc(){return vc}async function xc(e){let t=yc(await e.settings.get(gc));return vc=t,t}async function Sc(e,t){let n=yc(t);await e.settings.set(gc,n),vc=n}var Cc=`font-size-settings`,wc=`font-size-settings-force-13px-v1`,Tc={min:12,max:18},Ec={interfaceFontSizePx:13,messageFontSizePx:13},Dc=`quickforge:font-size-settings-changed`;function Oc(){if(typeof document>`u`)return Ec.interfaceFontSizePx;let e=Number.parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)?e:Ec.interfaceFontSizePx}function kc(e=Oc()){let t=jc(e-1,13,Tc.min,Tc.max);return{fontSize:t,lineHeight:Math.round(t*1.54)}}function Ac(e=Oc()){return{fontSize:jc(e-2,12,Tc.min,Tc.max),lineHeight:1.2}}function jc(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.round(i))):t}function Mc(e){if(!e||typeof e!=`object`)return{...Ec};let t=e;return{interfaceFontSizePx:jc(t.interfaceFontSizePx??t.baseFontSizePx??t.bodyFontSizePx,Ec.interfaceFontSizePx,Tc.min,Tc.max),messageFontSizePx:jc(t.messageFontSizePx,Ec.messageFontSizePx,Tc.min,Tc.max)}}function Nc(e){if(typeof document>`u`)return;let t=Mc(e),n=document.documentElement;n.style.fontSize=`${t.interfaceFontSizePx}px`,n.style.setProperty(`--quickforge-message-font-size`,`${t.messageFontSizePx}px`),n.style.setProperty(`--quickforge-message-line-height`,`1.625`),window.dispatchEvent(new CustomEvent(Dc,{detail:t}))}async function Pc(e){if(!await e.settings.get(wc)){let t={...Ec};return await e.settings.set(Cc,t),await e.settings.set(wc,!0),t}return Mc(await e.settings.get(Cc))}async function Fc(e){let t=await Pc(e);return Nc(t),t}async function Ic(e,t){let n=Mc(t);await e.settings.set(Cc,n),Nc(n)}var Lc=`appearance-settings`,Rc={theme:`light`};function zc(e){return!e||typeof e!=`object`?{...Rc}:{theme:e.theme===`dark`?`dark`:`light`}}function Bc(e){if(typeof document>`u`)return;let t=zc(e),n=document.documentElement;n.classList.toggle(`dark`,t.theme===`dark`),n.style.setProperty(`color-scheme`,t.theme)}function Vc(){return typeof document>`u`?Rc.theme:document.documentElement.classList.contains(`dark`)?`dark`:`light`}async function Hc(e){return zc(await e.settings.get(Lc))}async function Uc(e){let t=await Hc(e);return Bc(t),t}async function Wc(e,t){let n=zc(t);await e.settings.set(Lc,n),Bc(n)}function Gc({storageRef:e,backendRef:t,activeModelRef:n,agentAccessModeRef:r,taskMapRef:i,refreshSessions:a,loadProject:o,initAgentAccessMode:s,createAgent:c,loadSession:l,setNeedsModelSetup:u,onStorageReady:d}){let[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(),[g,_]=(0,V.useState)(0),v=(0,V.useRef)({refreshSessions:a,loadProject:o,initAgentAccessMode:s,createAgent:c,loadSession:l,setNeedsModelSetup:u,onStorageReady:d});return(0,V.useEffect)(()=>{v.current={refreshSessions:a,loadProject:o,initAgentAccessMode:s,createAgent:c,loadSession:l,setNeedsModelSetup:u,onStorageReady:d}}),(0,V.useEffect)(()=>{let a=!1;async function o(){let{refreshSessions:i,loadProject:o,initAgentAccessMode:s,createAgent:c,loadSession:l,setNeedsModelSetup:u,onStorageReady:d}=v.current;try{p(!1),h(void 0);let f=await xn();if(a)return;e.current=f,d?.(f),t.current=f.backend,await st(f),await xc(f),await Uc(f),await Fc(f),await Promise.all([i(),o()]),r.current=await s(f);let m=await Nn(f),g=await En(f);m&&(n.current=g.model??m);let _=new URLSearchParams(window.location.search).get(`session`);_&&await l(_)||(m?await c({model:g.model??m,thinkingLevel:g.thinkingLevel,tools:[]},Y(),{scope:`global`,attachToView:!0}):u(!0)),p(!0)}catch(e){B.error(`Failed to bootstrap QuickForge:`,e),a||h(H(`localServiceUnavailableDescription`))}}o();let s=i.current;return()=>{a=!0,tc(s)}},[e,t,n,r,i,g]),{ready:f,startupError:m,retryBootstrap:(0,V.useCallback)(()=>{p(!1),h(void 0),_(e=>e+1)},[])}}var Kc=`update-check-settings`,qc={frequency:`startup`,lastCheckAt:null,ignoredVersion:null};function Jc(e){if(!e||typeof e!=`object`)return{...qc};let t=e;return{frequency:[`startup`,`daily`,`weekly`,`off`].includes(t.frequency)?t.frequency:qc.frequency,lastCheckAt:typeof t.lastCheckAt==`string`?t.lastCheckAt:null,ignoredVersion:typeof t.ignoredVersion==`string`?t.ignoredVersion:null}}var Yc=1440*60*1e3;function Xc(e,t=Date.now()){switch(e.frequency){case`off`:return!1;case`startup`:return!0;case`daily`:case`weekly`:{if(!e.lastCheckAt)return!0;let n=Date.parse(e.lastCheckAt);if(Number.isNaN(n))return!0;let r=e.frequency===`daily`?Yc:7*Yc;return t-n>=r}default:return!1}}async function Zc(e){return Jc(await e.settings.get(Kc))}async function Qc(e,t){await e.settings.set(Kc,Jc(t))}var $c={status:`idle`,updateAvailable:!1};function el(){if(typeof document>`u`)return!1;let e=window;return document.body.classList.contains(`quickforge-desktop-app`)||e.__quickforgeDesktopApp===!0}function tl(e,t){let[n,r]=(0,V.useState)($c),i=(0,V.useRef)(!1);return(0,V.useEffect)(()=>{if(!t||i.current||el())return;let n=e.current;n&&(i.current=!0,(async()=>{let e;try{e=await Zc(n)}catch(e){B.error(`Failed to load update-check settings:`,e);return}if(Xc(e)){r(e=>({...e,status:`checking`}));try{let t=await fetch(`/api/system/update/check`,{cache:`no-store`});if(!t.ok){r(e=>({...e,status:`error`}));return}let i=await t.json(),a=i.updateAvailable&&i.latestVersion!==e.ignoredVersion;try{await Qc(n,{...e,lastCheckAt:new Date().toISOString()})}catch(e){B.error(`Failed to persist last update-check time:`,e)}r({status:`done`,currentVersion:i.currentVersion,latestVersion:i.latestVersion,updateAvailable:a})}catch(e){B.error(`Startup update check failed:`,e),r(e=>({...e,status:`error`}))}}})())},[t,e]),{result:n,dismissUpdate:(0,V.useCallback)(()=>{let t=e.current,i=n.latestVersion;!t||!i||(r(e=>({...e,updateAvailable:!1})),(async()=>{try{await Qc(t,{...await Zc(t),ignoredVersion:i})}catch(e){B.error(`Failed to persist ignored update version:`,e)}})())},[n.latestVersion,e])}}var nl=[`low`,`medium`,`high`,`xhigh`];function rl(e){switch(e){case`low`:return H(`thinkingLow`);case`medium`:return H(`thinkingMedium`);case`high`:return H(`thinkingHigh`);case`xhigh`:return H(`thinkingXHigh`);default:return H(`thinkingOff`)}}function il(e){return e.id}function al(e,t=``){let n=document.createElement(`button`);return n.type=`button`,n.className=e,n.textContent=t,n}function ol(e){document.querySelectorAll(`.quickforge-model-menu, .quickforge-model-submenu, .quickforge-model-sheet-backdrop`).forEach(e=>{e.__quickforgeCleanup?.(),e.remove()}),e?.setAttribute(`aria-expanded`,`false`)}function sl(e){return e??document.querySelector(`.quickforge-model-trigger`)}function cl(e,t){let n=sl(t),r=Math.min(260,window.innerWidth-24);e.style.width=`${r}px`;let i=e.offsetHeight||360;if(!n){e.style.left=`${Math.max(12,Math.round((window.innerWidth-r)/2))}px`,e.style.top=`${Math.max(12,Math.round((window.innerHeight-i)/2))}px`;return}let a=n.getBoundingClientRect(),o=Math.max(12,Math.min(a.right-r,window.innerWidth-r-12)),s=a.top-i-8,c=a.bottom+8,l=s>=12?s:Math.min(c,window.innerHeight-i-12);e.style.left=`${o}px`,e.style.top=`${Math.max(12,l)}px`}function ll(e,t){let n=Math.min(252,window.innerWidth-24);e.style.width=`${n}px`;let r=t.getBoundingClientRect(),i=e.offsetHeight||320,a=r.left-n-0>=12?r.left-n-0:Math.min(r.right+0,window.innerWidth-n-12),o=Math.max(12,Math.min(r.top,window.innerHeight-i-12));e.style.left=`${a}px`,e.style.top=`${o}px`}function ul(e){let t=al(`quickforge-model-menu-item`);t.setAttribute(`role`,`menuitemradio`),t.setAttribute(`aria-checked`,String(!!e.selected)),e.disabled&&(t.disabled=!0);let n=document.createElement(`span`);n.className=`quickforge-model-menu-item-label`,n.textContent=e.label;let r=document.createElement(`span`);return r.className=`quickforge-model-menu-item-suffix`,r.textContent=e.chevron?`›`:e.selected?`✓`:``,t.append(n,r),e.onPointerDown&&(t.onpointerdown=e.onPointerDown),e.onPointerEnter&&(t.onpointerenter=e.onPointerEnter),e.onClick&&t.addEventListener(`click`,e.onClick),t}function dl(e,t,n,r,i){let a=r.thinkingLevel??`off`,o=e,s=document.createElement(`div`);s.className=`quickforge-model-sheet-backdrop`;let c=document.createElement(`div`);c.className=`quickforge-model-sheet`,c.setAttribute(`role`,`dialog`),c.setAttribute(`aria-modal`,`true`),c.setAttribute(`aria-label`,H(`selectCustomModel`));let l=document.createElement(`div`);l.className=`quickforge-model-sheet-drag-zone`;let u=document.createElement(`div`);u.className=`quickforge-model-sheet-handle`,l.append(u);let d=document.createElement(`div`);d.className=`quickforge-model-sheet-header`;let f=document.createElement(`div`);f.className=`quickforge-model-sheet-title`,f.textContent=H(`selectCustomModel`);let p=al(`quickforge-model-sheet-close`,`×`);p.setAttribute(`aria-label`,H(`close`)),p.title=H(`close`),p.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),ol(i)},d.append(f,p);let m=r.showThinking===!1?null:document.createElement(`div`),h;if(m){m.className=`quickforge-model-sheet-section`;let e=document.createElement(`div`);e.className=`quickforge-model-sheet-section-label`,e.textContent=H(`reasoning`),h=()=>{if(m.replaceChildren(e),o?.reasoning===!0){let e=document.createElement(`div`);e.className=`quickforge-model-sheet-thinking-options`;let t=new Map;for(let n of nl){let i=al(`quickforge-model-sheet-thinking-option`,rl(n));t.set(n,i),i.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),a=n,r.onThinkingLevelSelect?.(n);for(let[e,n]of t){let t=e===a;n.classList.toggle(`is-selected`,t),n.setAttribute(`aria-pressed`,String(t))}};let o=n===a;i.classList.toggle(`is-selected`,o),i.setAttribute(`aria-pressed`,String(o)),e.append(i)}m.append(e)}else{let e=document.createElement(`div`);e.className=`quickforge-model-menu-note`,e.textContent=H(`thinkingNotSupported`),m.append(e)}},h()}let g=document.createElement(`div`);g.className=`quickforge-model-sheet-section-label quickforge-model-sheet-model-label`,g.textContent=H(`model`);let _=document.createElement(`div`);_.className=`quickforge-model-sheet-model-list`,_.setAttribute(`role`,`menu`),_.setAttribute(`aria-label`,H(`model`));let v=0;_.addEventListener(`scroll`,()=>{v=Date.now()});let y=new Map,b=e=>{o=e,!e.reasoning&&a!==`off`&&(a=`off`,r.onThinkingLevelSelect?.(`off`));for(let[t,n]of y){let r=Ge(n,e);t.setAttribute(`aria-checked`,String(r));let i=t.querySelector(`.quickforge-model-menu-item-suffix`);i&&(i.textContent=r?`✓`:``)}h?.(),n(e)};if(r.noneLabel){let t=ul({label:r.noneLabel,selected:e===null});t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),!(Date.now()-v<300)&&(r.onNoneSelect?.(),ol(i))}),_.append(t)}let x=[...t].sort((e,t)=>il(e).localeCompare(il(t)));for(let e of x){let t=ul({label:r.modelLabelOverride?r.modelLabelOverride(e):il(e),selected:Ge(o,e),onClick:t=>{t.preventDefault(),t.stopPropagation(),!(Date.now()-v<300)&&b(e)}});y.set(t,e),_.append(t)}c.append(l,d,...m?[m]:[],g,_),c.addEventListener(`pointerdown`,e=>e.stopPropagation()),s.addEventListener(`pointerdown`,e=>{e.target===s&&ol(i)});let S=0,C=!1,w=!1,T,E=e=>{e.pointerType===`mouse`&&e.button!==0||(S=e.clientY,C=!0,w=!1,c.style.transition=`none`)},D=e=>{if(!C)return;let t=e.clientY-S;t>0&&(w=!0,c.style.transform=`translateY(${t}px)`,s.style.background=`rgb(15 23 42 / ${Math.max(0,.34*(1-t/480))})`)},O=()=>{C&&(C=!1,c.style.transition=`transform 0.24s ease`,(w&&Number.parseFloat(c.style.transform.replace(/[^0-9.-]/g,``))||0)>=112?(c.style.transform=`translateY(110%)`,s.style.background=`rgb(15 23 42 / 0)`,T=setTimeout(()=>ol(i),220)):(c.style.transform=``,s.style.background=``))};l.addEventListener(`pointerdown`,E),window.addEventListener(`pointermove`,D),window.addEventListener(`pointerup`,O),window.addEventListener(`pointercancel`,O);let k=e=>{if(e.type===`resize`){window.innerWidth>768&&ol(i);return}!(e instanceof KeyboardEvent)||e.key!==`Escape`||(e.preventDefault(),ol(i))};s.__quickforgeCleanup=()=>{T&&clearTimeout(T),document.removeEventListener(`keydown`,k,!0),window.removeEventListener(`resize`,k,!0),window.removeEventListener(`pointermove`,D),window.removeEventListener(`pointerup`,O),window.removeEventListener(`pointercancel`,O)},s.append(c),document.body.append(s),i?.setAttribute(`aria-expanded`,`true`),document.addEventListener(`keydown`,k,!0),window.addEventListener(`resize`,k,!0)}function fl(e,t,n,r={}){let i=sl(r.anchor);if(document.querySelector(`.quickforge-model-menu, .quickforge-model-sheet-backdrop`)){ol(i);return}dl(e,t,n,{...r,showThinking:!1,onNoneSelect:r.noneLabel?()=>n(null):void 0},i)}function pl(e,t,n,r,i={}){let a=sl(i.anchor);if(document.querySelector(`.quickforge-model-menu, .quickforge-model-sheet-backdrop`)){ol(a);return}if(window.innerWidth<=768){dl(e,t,n,i,a);return}let o=i.thinkingLevel??`off`,s=e,c=null,l=document.createElement(`div`);l.className=`quickforge-model-menu`,l.setAttribute(`role`,`menu`),l.setAttribute(`aria-label`,H(`selectCustomModel`));let u=()=>{c?.remove(),c=document.createElement(`div`),c.className=`quickforge-model-submenu`,c.setAttribute(`role`,`menu`),c.setAttribute(`aria-label`,H(`model`));let e=document.createElement(`div`);e.className=`quickforge-model-menu-header`,e.textContent=H(`model`),c.append(e);let r=[...t].sort((e,t)=>il(e).localeCompare(il(t)));for(let e of r)c.append(ul({label:il(e),selected:Ge(s,e),onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),!e.reasoning&&o!==`off`&&(o=`off`,i.onThinkingLevelSelect?.(`off`)),s=e,n(e),ol(a)}}));c.addEventListener(`pointerdown`,e=>e.stopPropagation()),document.body.append(c),ll(c,l)},d=()=>{l.replaceChildren();let e=document.createElement(`div`);if(e.className=`quickforge-model-menu-header`,e.textContent=H(`reasoning`),l.append(e),s?.reasoning===!0)for(let e of nl)l.append(ul({label:rl(e),selected:o===e,onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),o=e,i.onThinkingLevelSelect?.(e),d(),cl(l,a)}}));else{let e=document.createElement(`div`);e.className=`quickforge-model-menu-note`,e.textContent=H(`thinkingNotSupported`),l.append(e)}let t=document.createElement(`div`);t.className=`quickforge-model-menu-separator`,l.append(t),l.append(ul({label:s?il(s):H(`noModelAdded`),chevron:!0,onPointerEnter:u,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),u()}}))},f=()=>ol(a),p=e=>{if(e.type===`resize`||e.type===`scroll`){cl(l,a),c&&ll(c,l);return}if(e instanceof KeyboardEvent){if(e.key!==`Escape`)return;e.preventDefault()}else{let t=e.target;if(l.contains(t)||c?.contains(t)||a?.contains(t))return}f()};l.__quickforgeCleanup=()=>{document.removeEventListener(`pointerdown`,p,!0),document.removeEventListener(`keydown`,p,!0),window.removeEventListener(`resize`,p,!0),window.removeEventListener(`scroll`,p,!0)},l.addEventListener(`pointerdown`,e=>e.stopPropagation()),d(),document.body.append(l),cl(l,a),a?.setAttribute(`aria-expanded`,`true`),document.addEventListener(`pointerdown`,p,!0),document.addEventListener(`keydown`,p,!0),window.addEventListener(`resize`,p,!0),window.addEventListener(`scroll`,p,!0)}function ml({storageRef:e,activeModelRef:t,agentRef:n,createAgent:r,updateCurrentAgentModel:i,setChatPanelRevision:a,setNeedsModelSetup:o,setRestoredDraft:s,notifySettingsChanged:c,openSettingsPage:l}){let u=(0,V.useCallback)(async()=>{let s=e.current;if(!s)return!1;let l=await Nn(s);return l?(t.current=l,o(!1),await Sn(s,l),n.current?(i(l),a(e=>e+1)):await r({model:l,tools:[]},Y(),{scope:`global`,attachToView:!0}),c(),!0):(o(!0),!1)},[e,t,n,r,i,a,o,c]),d=(0,V.useCallback)((e,t)=>{l(e,t)},[l]),f=(0,V.useCallback)(()=>{d(`customModels`)},[d]);return{activateConfiguredModel:u,openModelSettings:f,openDefaultOptionsSettings:(0,V.useCallback)(()=>{d(`defaults`)},[d]),openAboutSettings:(0,V.useCallback)(()=>{d(`about`)},[d]),activateLiteLlmExampleModel:(0,V.useCallback)(async()=>{let s=e.current;if(!s)return;let l=_n(un);await Rn(s,un,l),await Sn(s,l),t.current=l,o(!1),n.current?(i(l),a(e=>e+1)):await r({model:l,tools:[]},Y(),{scope:`global`,attachToView:!0}),c()},[e,t,n,r,i,a,o,c]),openCustomModelSelector:(0,V.useCallback)(async r=>{let o=e.current,c=n.current;if(!o||!c)return;let l=r instanceof HTMLElement?r:r?.currentTarget instanceof HTMLElement?r.currentTarget:document.querySelector(`.quickforge-model-trigger`),u=document.querySelector(`agent-interface message-editor textarea`),p=document.querySelector(`agent-interface message-editor`),m=u?.value??``,h=p?.attachments?[...p.attachments]:[],g=Qt();if(!g){try{g=jn(await o.customProviders.getAll()),en(g)}catch(e){B.error(`Failed to load custom models, falling back to cache:`,e),g=$t()}if(!g)return}if(g.length===0){await ic({description:H(`addCustomModelFirst`),confirmLabel:H(`modelSetupAddModel`),cancelLabel:H(`cancel`)})&&f();return}pl(c.state.model??t.current,g,e=>{let n=e,r=n.reasoning?c.state.thinkingLevel:`off`;c.state.thinkingLevel!==r&&(c.state.thinkingLevel=r,c.updateThinkingLevel(r).catch(e=>{B.error(`Failed to sync thinking level to server:`,e)})),t.current=n,i(n),(m||h.length>0)&&s({id:Date.now(),sessionId:c.sessionId,text:m,attachments:h}),a(e=>e+1),Sn(o,n).catch(e=>{B.error(`Failed to save active model:`,e)})},async e=>{d(`customModels`,e.provider)},{thinkingLevel:c.state.thinkingLevel,anchor:l,onThinkingLevelSelect:e=>{c.state.thinkingLevel=e,c.updateThinkingLevel(e).catch(e=>{B.error(`Failed to sync thinking level to server:`,e)}),a(e=>e+1)}})},[e,t,n,i,a,s,f,d])}}function hl(){let e=new URL(window.location.href);e.searchParams.delete(`session`),window.history.replaceState({},``,e)}function gl(e){return!!(e&&!e.state.isStreaming&&e.state.messages.length===0)}function _l({storageRef:e,activeModelRef:t,activeProjectRef:n,currentChatScopeRef:r,currentSessionIdRef:i,taskMapRef:a,agentRef:o,startDeferredSession:s,createAgent:c,syncSessionUI:l,setCurrentAgentMessages:u,setChatPanelRevision:d,refreshSessions:f,needsModelSetup:p,switchActiveProject:m,closeWorkspacePage:h,setRestoredDraft:g}){let _=(0,V.useCallback)(async()=>{if(p){ac(H(`modelSetupRequired`));return}h(),!(gl(o.current)&&r.current===`global`)&&(g(void 0),hl(),await s({scope:`global`}))},[o,r,p,g,h,s]),v=(0,V.useCallback)(async e=>{if(p){ac(H(`modelSetupRequired`));return}h();let t=e??n.current;t&&(gl(o.current)&&r.current===`project`&&n.current?.id===t.id||(n.current?.id!==t.id&&await m(t.id),g(void 0),hl(),await s({scope:`project`,project:t})))},[n,o,r,p,g,h,s,m]),y=(0,V.useCallback)(async s=>{let p=o.current;if(!p)return;if(p.state.isStreaming){ac(H(`generationStillRunning`));return}let m=Ws(p.state.messages,s),h=m>=0?p.state.messages[m]:void 0;if(m<0||!h){ac(H(`noConversationTurnToRollback`));return}let _={id:Date.now(),sessionId:p.sessionId,text:Gs(h),attachments:h.role===`user-with-attachments`?h.attachments:void 0},v=p.state.messages.slice(0,m);try{v=(await p.rollback(s)).session.messages??v}catch(e){B.error(`Failed to rollback conversation:`,e),ac(e instanceof Error?e.message:H(`rollbackFailed`));return}u(v);let y=i.current?a.current.get(i.current):void 0;if(Xs(v)&&y){_&&g(_),d(e=>e+1),l(y).catch(e=>B.error(`Failed to sync session UI:`,e));return}let b=e.current,x=i.current,S=r.current,C=S===`project`?n.current:void 0,w=p.state.model??t.current,T=p.state.thinkingLevel;if(x&&ec(a.current,x),b&&x)try{await b.sessions.delete(x),await f({broadcast:!0})}catch(e){B.error(`Failed to delete rolled back empty session:`,e)}let E=Y();await c({model:w,thinkingLevel:T,messages:[],tools:[]},E,{scope:S,project:C,attachToView:!0,title:`New chat`}),g({..._,sessionId:E}),d(e=>e+1)},[t,n,o,c,r,i,f,d,u,g,e,l,a]),b=(0,V.useCallback)(async e=>{try{await Ks(e)}catch(e){throw B.error(`Failed to copy answer:`,e),ac(H(`copyFailed`)),e}},[]),x=(0,V.useCallback)(async i=>{let a=o.current;if(!a)return;if(a.state.isStreaming){ac(H(`generationStillRunning`));return}let s=a.state.messages.slice(0,i+1);if(!Ys(s))return;let l=r.current,u=l===`project`?n.current:void 0,d=Y(),p=qs(s),m=e.current;await c({model:a.state.model??t.current,thinkingLevel:a.state.thinkingLevel,messages:s,tools:[]},d,{scope:l,project:u,attachToView:!0,title:p}),m&&f({broadcast:!0}).catch(e=>B.error(`Failed to refresh sessions:`,e))},[t,n,o,c,r,f,e]);return{startNewGlobalChat:_,startNewProjectChat:v,rollbackFromMessage:y,retryFromMessage:(0,V.useCallback)(async e=>{let t=o.current;if(!t)return;if(t.state.isStreaming){ac(H(`generationStillRunning`));return}let n=t.state.messages;if(e<0||e>=n.length)return;let r=n[e];if(r.role!==`user`&&r.role!==`user-with-attachments`)return;u(n.slice(0,e+1)),d(e=>e+1);try{await t.continue()}catch(e){B.error(`Failed to retry:`,e),ac(e instanceof Error?e.message:H(`retryFailed`));return}let s=i.current?a.current.get(i.current):void 0;s&&(l(s).catch(e=>B.error(`Failed to sync session UI after retry:`,e)),d(e=>e+1))},[o,i,d,u,l,a]),copyAnswer:b,forkFromMessage:x}}function vl({activeProjectRef:e,refreshSessions:t,notifyProjectsChanged:n,setActiveProject:r,setProjects:i,setExpandedProjectIds:a,setChatPanelRevision:o}){return{deleteProjectInline:(0,V.useCallback)(async s=>{let c=await fetch(`/api/project/${encodeURIComponent(s)}`,{method:`DELETE`}),l=await c.json().catch(()=>null);if(!c.ok)throw Error(l?.error||`Failed to delete project`);r(l.project),i(l.projects),a(e=>{let t=new Set(e);return t.delete(s),t}),ls(`/api/project`),await t({broadcast:!0}),n(),e.current?.id===s&&(e.current=l.project,o(e=>e+1))},[e,t,n,r,i,a,o])}}var yl=V.forwardRef(({className:e,type:t,...n},r)=>(0,G.jsx)(`input`,{type:t,className:W(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:border-primary focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));yl.displayName=`Input`;function bl({options:e,onResolve:t}){let n=(0,V.useRef)(null),[r,i]=(0,V.useState)(e.defaultValue??``),a=(0,V.useRef)(r);return(0,V.useEffect)(()=>{a.current=r},[r]),(0,V.useEffect)(()=>{n.current?.focus(),n.current?.select()},[]),(0,V.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t(null),e.key===`Enter`&&a.current.trim()&&t(a.current.trim())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),(0,fr.createPortal)((0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onClick:e=>{e.target===e.currentTarget&&t(null)},children:(0,G.jsxs)(`div`,{className:W(`w-full max-w-sm rounded-lg border border-border bg-background p-6 shadow-quickforge`,`mx-4`),children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e.title}),e.description?(0,G.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description}):null,(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(yl,{ref:n,value:r,onChange:e=>i(e.target.value),placeholder:e.placeholder,className:`w-full`})}),(0,G.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,G.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>t(null),children:e.cancelLabel??`Cancel`}),(0,G.jsx)(K,{size:`sm`,onClick:()=>r.trim()?t(r.trim()):void 0,disabled:!r.trim(),children:e.confirmLabel??`Save`})]})]})}),document.body)}function xl(e){return new Promise(t=>{let n=document.createElement(`div`);document.body.appendChild(n);let r=(0,qe.createRoot)(n);function i(){r.unmount(),setTimeout(()=>n.remove(),0)}function a(e){i(),t(e)}r.render((0,G.jsx)(bl,{options:e,onResolve:a}))})}function Sl({storageRef:e,taskMapRef:t,currentSessionIdRef:n,loadAgentSession:r,setCurrentTitleRef:i,refreshSessions:a,updateSessionTitle:o,closeWorkspacePage:s,startNewGlobalChat:c}){return{loadSession:(0,V.useCallback)(e=>{s(),r(e)},[r,s]),renameSession:(0,V.useCallback)(async(t,r)=>{if(!e.current)return;let a=await xl({title:H(`renameSession`),description:H(`sessionName`),defaultValue:r,confirmLabel:H(`save`),cancelLabel:H(`cancel`)});if(!a||a===r)return;let s=await fetch(`/api/agents/${encodeURIComponent(t)}/title`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:a})});if(!s.ok)throw Error(`Failed to rename session: HTTP ${s.status}`);o(t,a),n.current===t&&i(a)},[n,i,e,o]),togglePinSession:(0,V.useCallback)(async t=>{let n=e.current;if(!n)return;let r=await n.sessions.getMetadata(t);if(!r)return;let i=r.pinnedAt?void 0:new Date().toISOString(),o={...r,pinnedAt:i};await n.backend.set(`sessions-metadata`,t,o),await a({broadcast:!0})},[a,e]),archiveSession:(0,V.useCallback)(async r=>{let i=e.current;if(!i)return;ec(t.current,r);let o=await i.sessions.get(r);if(!o)return;let l=await i.sessions.getMetadata(r);if(!l)return;let u=new Date().toISOString(),d={...o,archivedAt:u},f={...l,archivedAt:u};await i.sessions.save(d,f),await a({broadcast:!0}),n.current===r&&(s(),await c())},[n,a,s,c,e,t]),startNewGlobalSession:(0,V.useCallback)(()=>{s(),c()},[s,c])}}var Cl=e=>e===`full-access`;function wl({storageRef:e,agentAccessModeRef:t,setAgentAccessMode:n,agentRef:r,setChatPanelRevision:i,notifySettingsChanged:a}){let o=(0,V.useCallback)(o=>{let s=e.current,c=r.current,l=t.current;if(l===o)return;n(o),t.current=o;let u=()=>{t.current=l,n(l),i(e=>e+1)};(async()=>{try{c&&await c.updateAccessMode(o),s&&await In(s,o),i(e=>e+1),a()}catch(e){B.error(`Failed to sync agent access mode:`,e),u(),ac(e instanceof Error?e.message:H(`agentAccessModeSyncFailed`))}})()},[t,r,a,n,i,e]);return{setAccessMode:o,toggleYoloMode:(0,V.useCallback)(()=>{o(Cl(t.current)?`default`:`full-access`)},[t,o])}}function Tl(){let[e,t]=(0,V.useState)(!0),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(),[w,T]=(0,V.useState)(!1),[E,D]=(0,V.useState)(!1),[O,k]=(0,V.useState)(`defaults`),[ee,A]=(0,V.useState)();return{sidebarOpen:e,setSidebarOpen:t,mobileSidebarOpen:n,setMobileSidebarOpen:r,projectsCollapsed:i,setProjectsCollapsed:a,pinnedCollapsed:o,setPinnedCollapsed:s,conversationsCollapsed:c,setConversationsCollapsed:l,skillsDialog:u,setSkillsDialog:d,shareDialogOpen:f,setShareDialogOpen:p,conversationMenuOpen:m,setConversationMenuOpen:h,workspaceInspectorOpen:g,setWorkspaceInspectorOpen:_,workspaceInspectorRequest:v,setWorkspaceInspectorRequest:y,artifactPreviewOpen:b,setArtifactPreviewOpen:x,activeArtifactPath:S,setActiveArtifactPath:C,firstUseGuideDismissed:w,setFirstUseGuideDismissed:T,settingsDialogOpen:E,setSettingsDialogOpen:D,settingsInitialTab:O,setSettingsInitialTab:k,settingsCustomProvider:ee,setSettingsCustomProvider:A,toggleProjectsCollapsed:(0,V.useCallback)(()=>a(e=>!e),[]),togglePinnedCollapsed:(0,V.useCallback)(()=>s(e=>!e),[]),toggleConversationsCollapsed:(0,V.useCallback)(()=>l(e=>!e),[])}}function El(e){return e===`running`||e===`idle`||e===`error`||e===`aborted`?e:void 0}function Dl(e){let[t,n]=(0,V.useState)({}),r=(0,V.useMemo)(()=>new Set(e.map(e=>e.id)),[e]),i=(0,V.useMemo)(()=>e.map(e=>e.id).sort().join(`
65
- `),[e]),a=(0,V.useCallback)(async()=>{if(r.size===0){n({});return}try{let e=await Rs(),t=new Map(e.map(e=>[e.sessionId,El(e.status)]).filter(e=>!!e[1]));n(e=>{let n={};for(let i of r){let r=t.get(i),a=e[i];r?n[i]=r:a===`running`?n[i]=`idle`:a&&a!==`idle`&&(n[i]=a)}return n})}catch(e){B.error(`Failed to refresh visible agent statuses:`,e)}},[r]);return(0,V.useEffect)(()=>{let e=window.setTimeout(()=>{a()},0);return()=>window.clearTimeout(e)},[a,i]),(0,V.useEffect)(()=>zs(e=>{let t=e.sessionId;if(!(!t||!r.has(t))){if(e.type===`agent_start`){n(e=>({...e,[t]:`running`}));return}if(e.type===`agent_end`){let r=El(e.status)===`aborted`?`aborted`:e.errorMessage?`error`:`idle`;n(e=>({...e,[t]:r}))}}}),[r]),(0,V.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&a()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[a]),t}function Ol({ready:e,currentToolProjectId:t,projects:n,activeProject:r,recoveringProjectId:i}){return!e||!t||t===`default`||n.some(e=>e.id===t)||i===t?{type:`none`}:r?{type:`project`,deletedProjectId:t,project:r}:{type:`global`,deletedProjectId:t}}function kl(e,t,n){return e.projectId===t&&e.requestId===n}var Al=new Set([`write_file`,`edit_file`,`run_command`,`run_subagent`]);function jl(e,t,n){return e.type!==`tool_execution_end`||!t||e.sessionId!==t||!n?!1:typeof e.toolName==`string`&&Al.has(e.toolName)}function Ml(e){return e===`idle`?{tone:`success`,message:H(`taskCompleted`)}:e===`error`?{tone:`error`,message:H(`taskError`)}:e===`aborted`?{tone:`aborted`,message:H(`processAborted`)}:e===`running`?{tone:`running`,message:H(`taskRunning`)}:{tone:`neutral`,message:H(`taskRunning`)}}function Nl({toast:e,onDismiss:t,onClick:n}){let[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1),s=(0,V.useRef)(null);(0,V.useEffect)(()=>{let n=window.setTimeout(()=>i(!0),10);return s.current=window.setTimeout(()=>{o(!0),s.current=window.setTimeout(()=>t(e.id),200)},5e3),()=>{window.clearTimeout(n),s.current!==null&&window.clearTimeout(s.current)}},[e.id,t]);let c=()=>{o(!0),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>t(e.id),200)},l=Ml(e.status),u=l.tone===`error`,d=l.tone===`success`,f=W(`size-5`,u&&`text-destructive`,d&&`text-emerald-500`,l.tone===`aborted`&&`text-amber-600`,l.tone===`running`&&`text-blue-600`,l.tone===`neutral`&&`text-muted-foreground`);return(0,G.jsxs)(`div`,{role:`alert`,onClick:()=>n(e.sessionId),className:W(`pointer-events-auto flex w-80 cursor-pointer items-start gap-3 rounded-xl border border-border bg-background p-3 shadow-quickforge transition-all duration-200 ease-out`,r&&!a?`translate-x-0 opacity-100`:`translate-x-4 opacity-0`),children:[(0,G.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:d?(0,G.jsx)(O,{className:f}):(0,G.jsx)(I,{className:f})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.title}),(0,G.jsx)(`p`,{className:`mt-0.5 line-clamp-3 text-xs text-muted-foreground`,children:e.message||l.message})]}),(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},className:`shrink-0 rounded-md p-0.5 text-muted-foreground/60 transition-colors hover:text-foreground`,"aria-label":H(`close`),children:(0,G.jsx)(se,{className:`size-4`})})]})}function Pl({toasts:e,onDismiss:t,onClick:n}){return e.length===0?null:(0,G.jsx)(`div`,{className:`pointer-events-none fixed right-4 top-16 z-50 flex flex-col gap-2`,children:e.map(e=>(0,G.jsx)(Nl,{toast:e,onDismiss:t,onClick:n},e.id))})}async function Fl(e){let t=await fetch(e,{cache:`no-store`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||`Request failed: ${t.status}`);return n}async function Il(e,t){let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`Request failed: ${n.status}`);return r}function Ll(e){return`projectId=${encodeURIComponent(e)}`}function Rl(e){return Fl(`/api/workspace/tree?${Ll(e)}`)}function zl(e,t){return Fl(`/api/workspace/file?${Ll(e)}&path=${encodeURIComponent(t)}`)}function Bl(e,t){return Il(`/api/workspace/resolve-path`,{projectId:e,path:t})}function Vl(e,t,n){return Il(`/api/workspace/open-external`,{projectId:e,path:t,target:n})}function Hl(e){return Fl(`/api/git/status?${Ll(e)}`)}function Ul(e,t){return Fl(`/api/git/file-diff?${Ll(e)}&path=${encodeURIComponent(t)}`)}function Wl(e,t){return Il(`/api/git/stage`,{projectId:e,path:t})}function Gl(e){return Il(`/api/git/stage-all`,{projectId:e})}function Kl(e,t){return Il(`/api/git/unstage`,{projectId:e,path:t})}function ql(e){return Il(`/api/git/unstage-all`,{projectId:e})}function Jl(e,t){return Il(`/api/git/restore`,{projectId:e,path:t})}function Yl(e){return Il(`/api/git/restore-all`,{projectId:e})}function Xl(e){return Fl(`/api/git/branches?${Ll(e)}`)}function Zl(e,t){return Il(`/api/git/checkout`,{projectId:e,branch:t})}function Ql(e,t){return Il(`/api/git/create-branch`,{projectId:e,branch:t})}function $l(e){return Fl(`/api/git/log?${Ll(e)}`)}function eu(e,t,n,r){return Il(`/api/git/generate-commit-message`,{projectId:e,model:t,thinkingLevel:n,includeUnstaged:r})}function tu(e,t,n){return Il(`/api/git/commit`,{projectId:e,message:t,includeUnstaged:n})}function nu(e){return Il(`/api/git/push`,{projectId:e})}function ru(e,t,n){return Il(`/api/git/commit-and-push`,{projectId:e,message:t,includeUnstaged:n})}function iu({projectId:e,currentBranch:n,dirtyCount:r=0,className:i,openChangesClassName:a,onCheckout:o,onCreated:s,onOpenGraph:l,onOpenChanges:u}){let d=(0,V.useRef)(null),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)([]),[g,_]=(0,V.useState)(!0),[v,b]=(0,V.useState)(),[x,S]=(0,V.useState)(),C=(0,V.useCallback)(async()=>{_(!0),b(void 0);try{h((await Xl(e)).branches)}catch(e){b(e instanceof Error?e.message:H(`gitBranchesFailed`))}finally{_(!1)}},[e]);(0,V.useEffect)(()=>{let e=window.setTimeout(()=>{C(),d.current?.focus()},0);return()=>window.clearTimeout(e)},[C]);let w=(0,V.useMemo)(()=>{let e=f.trim().toLowerCase();return e?m.filter(t=>t.name.toLowerCase().includes(e)):m},[m,f]),T=(0,V.useCallback)(async e=>{if(!(e.current||x)){S(e.name);try{await o(e.name),await C()}finally{S(void 0)}}},[x,o,C]),E=(0,V.useCallback)(async()=>{let t=await xl({title:H(`createBranchTitle`),description:H(`createBranchDescription`),placeholder:H(`createBranchPlaceholder`),confirmLabel:H(`createAndCheckoutBranch`),cancelLabel:H(`cancel`)});if(t){S(t);try{let n=await Ql(e,t);s?.(n),await C()}catch(e){ac(e instanceof Error?e.message:H(`gitCheckoutFailed`))}finally{S(void 0)}}},[s,e,C]);return(0,G.jsxs)(`div`,{className:W(`absolute left-0 top-10 z-40 w-[340px] overflow-hidden rounded-2xl border border-border bg-popover shadow-quickforge`,i),onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`div`,{className:`border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] p-3`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(D,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/70`}),(0,G.jsx)(yl,{ref:d,value:f,onChange:e=>p(e.target.value),placeholder:H(`searchBranches`),className:`h-10 rounded-xl border-transparent bg-background pl-9 text-sm shadow-none focus-visible:border-border`})]})}),u?(0,G.jsxs)(`button`,{type:`button`,className:W(`flex w-full items-center justify-center gap-2 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-3 py-3 text-sm text-muted-foreground transition-colors hover:bg-muted/20 hover:text-foreground`,a),onClick:u,children:[(0,G.jsx)(`span`,{children:H(`uncommittedChanges`)}),(0,G.jsx)(`span`,{children:H(`filesCount`,{count:r})})]}):null,(0,G.jsx)(`div`,{className:`max-h-[340px] overflow-y-auto p-2`,children:g?(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-3 py-8 text-sm text-muted-foreground`,children:[(0,G.jsx)(t,{className:`size-4 animate-spin`}),(0,G.jsx)(`span`,{children:H(`loading`)})]}):v?(0,G.jsx)(`div`,{className:`rounded-xl bg-muted/40 px-3 py-4 text-sm text-muted-foreground`,children:v}):w.length===0?(0,G.jsx)(`div`,{className:`rounded-xl bg-muted/40 px-3 py-4 text-sm text-muted-foreground`,children:H(`noBranchesFound`)}):w.map(e=>{let r=e.current||e.name===n,i=x===e.name;return(0,G.jsxs)(`button`,{type:`button`,className:W(`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors`,r?`bg-muted text-foreground`:`text-foreground/88 hover:bg-muted/70`),onClick:()=>void T(e),disabled:r||!!x,title:e.name,children:[i?(0,G.jsx)(t,{className:`size-4 shrink-0 animate-spin`}):(0,G.jsx)(de,{className:W(`size-4 shrink-0`,r?`text-foreground`:`text-muted-foreground`)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),r?(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:H(`currentBranch`)}):null]},`${e.remote?`remote`:`local`}:${e.name}`)})}),s||l?(0,G.jsxs)(`div`,{className:`border-t-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] p-2`,children:[s?(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm text-foreground/88 transition-colors hover:bg-muted/70`,onClick:()=>void E(),disabled:!!x,children:[(0,G.jsx)(y,{className:`size-4 text-muted-foreground`}),(0,G.jsx)(`span`,{children:H(`createAndCheckoutBranchEllipsis`)})]}):null,l?(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm text-foreground/88 transition-colors hover:bg-muted/70`,onClick:l,children:[(0,G.jsx)(c,{className:`size-4 text-muted-foreground`}),(0,G.jsx)(`span`,{children:H(`gitGraph`)})]}):null]}):null]})}function au(e){return e?.detached===!0||e?.branch===`HEAD`||!!e?.branch?.startsWith(`HEAD `)}function ou(e,t){return e?.files?.length?e.files.filter(e=>!e.conflict&&(t||e.staged)):[]}function su(e,t,n){return!!(e?.isGitRepository&&!e.counts?.conflicts&&!au(e)&&n.trim()&&ou(e,t).length)}function cu(e){return(e?.files??[]).reduce((e,t)=>(e.additions+=t.additions??0,e.deletions+=t.deletions??0,e),{additions:0,deletions:0})}function lu(e){return e.conflict?`!`:e.status===`untracked`?`?`:e.status===`added`?`A`:e.status===`deleted`?`D`:e.status===`renamed`?`R`:`M`}function uu({open:e,projectId:n,status:i,onClose:a,onCheckout:o,onRefreshStatus:s,onStatusChange:c,onCompleted:l}){let[u,d]=(0,V.useState)(``),[f,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(!1),[y,x]=(0,V.useState)(!0),[S,C]=(0,V.useState)(),[w,T]=(0,V.useState)(``),[E,D]=(0,V.useState)(``),[O,k]=(0,V.useState)(),[ee,A]=(0,V.useState)(`off`),M=(0,V.useMemo)(()=>cu(i),[i]),P=(0,V.useMemo)(()=>ou(i,f),[f,i]),te=(0,V.useMemo)(()=>new Set(P.map(e=>e.path)),[P]),ne=i?.counts?.total??i?.files.length??0,F=au(i),I=!y&&su(i,f,u);if((0,V.useEffect)(()=>{if(!e)return;let t=!1;return s().then(e=>{!t&&!e&&T(H(`gitStatusRefreshFailed`))}).finally(()=>{t||x(!1)}),()=>{t=!0}},[s,e,n]),(0,V.useEffect)(()=>{if(!e)return;let t=!1;async function n(){try{let e=await xn(),n=await Mn(e),r=await En(e),i=r.model??await Nn(e)??n[0];if(t||!i)return;k(i),A(r.thinkingLevel??Cn(i))}catch{}}return n(),()=>{t=!0}},[e]),(0,V.useEffect)(()=>{if(!h)return;let e=()=>g(!1);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[h]),(0,V.useEffect)(()=>{if(!e)return;function t(e){e.key===`Escape`&&!S&&(g(!1),a())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[S,a,e]),!e)return null;async function L(){if(!n){T(H(`gitCommitNoProject`));return}if(!O){T(H(`gitCommitNoModel`));return}if(!P.length){T(H(`gitNoStagedChanges`));return}C(`generate`),T(``);try{d((await eu(n,O,ee,f)).message)}catch(e){T(e instanceof Error?e.message:H(`gitGenerateCommitMessageFailed`))}finally{C(void 0)}}async function R(e){if(n){if(e!==`push`){if(!u.trim()){T(H(`gitCommitMessageRequired`));return}if(!I){T(H(F?`gitDetachedHeadBlocked`:`gitNoStagedChanges`));return}}if(F){T(H(`gitDetachedHeadBlocked`));return}C(e),T(``);try{if(e===`push`){let e=await nu(n);D(``),l(e);return}if(e===`commit-push`){let e=await ru(n,u.trim(),f);if(!e.pushed){c(e),d(``),D(e.pushError||H(`gitOperationFailed`));return}d(``),l(e);return}let t=await tu(n,u.trim(),f);d(``),l(t)}catch(e){T(e instanceof Error?e.message:H(`gitOperationFailed`))}finally{C(void 0)}}}return(0,fr.createPortal)((0,G.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center bg-black/50 px-6 py-8`,role:`dialog`,"aria-modal":`true`,onMouseDown:e=>{e.target===e.currentTarget&&!S&&(g(!1),a())},children:(0,G.jsxs)(`div`,{className:`flex max-h-[min(700px,calc(100vh-64px))] w-full max-w-[760px] flex-col overflow-hidden rounded-3xl border border-[color-mix(in_oklab,var(--border)_42%,transparent)] bg-background shadow-2xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-5`,children:[(0,G.jsxs)(`div`,{className:`relative min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex max-w-[280px] items-center gap-2.5 rounded-xl px-2 py-1.5 text-base text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:()=>g(e=>!e),disabled:!n||!!S,"aria-label":H(`gitBranchMenu`),"aria-haspopup":`menu`,"aria-expanded":h,children:[(0,G.jsx)(de,{className:`size-5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:i?.branch||H(`unknown`)}),(0,G.jsx)(b,{className:`size-4 shrink-0`})]}),h&&n?(0,G.jsx)(iu,{projectId:n,currentBranch:i?.branch,className:`top-11`,onCheckout:async e=>{await o(e),g(!1)}}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-base font-medium`,children:[(0,G.jsxs)(`span`,{className:`text-emerald-600`,children:[`+`,M.additions]}),(0,G.jsxs)(`span`,{className:`text-red-600`,children:[`-`,M.deletions]}),(0,G.jsx)(`button`,{type:`button`,className:`ml-2 rounded-full p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:()=>{g(!1),a()},disabled:!!S,"aria-label":H(`close`),children:(0,G.jsx)(se,{className:`size-5`})})]})]}),(0,G.jsxs)(`div`,{className:`relative min-h-44 px-6 pb-4`,children:[(0,G.jsx)(`textarea`,{value:u,onChange:e=>{d(e.target.value),T(``)},onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),!S&&I&&R(`commit`))},placeholder:H(`gitCommitMessagePlaceholder`),disabled:!!S,className:`min-h-40 w-full resize-none bg-transparent pr-12 text-base leading-7 text-foreground/90 outline-none placeholder:text-muted-foreground/72 disabled:opacity-60`}),(0,G.jsx)(`button`,{type:`button`,className:W(`absolute right-6 top-0 rounded-full p-2 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,S===`generate`&&`pointer-events-none`),onClick:()=>void L(),disabled:!!S||y||!P.length||F,title:H(`gitGenerateCommitMessage`),"aria-label":H(`gitGenerateCommitMessage`),children:S===`generate`?(0,G.jsx)(t,{className:`size-5 animate-spin`}):(0,G.jsx)(j,{className:`size-5`})})]}),(0,G.jsxs)(`div`,{className:`border-t border-[color-mix(in_oklab,var(--border)_24%,transparent)] px-6 py-3 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex min-w-0 items-center gap-3 text-foreground/92`,children:[(0,G.jsx)(`button`,{type:`button`,className:W(`flex size-5 shrink-0 items-center justify-center rounded-md border transition-colors`,f?`border-black bg-black text-white`:`border-border bg-background text-transparent`),onClick:()=>{m(e=>!e),D(``),T(``)},disabled:!!S||y,"aria-pressed":f,children:(0,G.jsx)(r,{className:`size-3.5`})}),(0,G.jsx)(`span`,{children:H(`gitIncludeUnstagedChanges`)})]}),(0,G.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center gap-1.5 text-muted-foreground transition-colors hover:text-foreground`,onClick:()=>v(e=>!e),disabled:!ne,children:[(0,G.jsx)(`span`,{children:H(`gitCommitFilesSummary`,{selected:P.length,total:ne})}),(0,G.jsx)(b,{className:W(`size-4 transition-transform`,_&&`rotate-180`)})]})]}),f?(0,G.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:H(`gitIncludeUnstagedWarning`)}):null,_?(0,G.jsx)(`div`,{className:`mt-3 max-h-44 space-y-1 overflow-y-auto border-t border-[color-mix(in_oklab,var(--border)_24%,transparent)] pt-3`,children:(i?.files??[]).map(e=>{let t=te.has(e.path);return(0,G.jsxs)(`div`,{className:W(`flex items-center gap-2 rounded-lg px-2 py-1.5`,!t&&`opacity-45`),children:[(0,G.jsx)(`span`,{className:`w-4 shrink-0 text-center font-mono text-xs text-muted-foreground`,children:lu(e)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.path,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),t?null:(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:H(`gitFileNotIncluded`)})]},`${e.oldPath??``}:${e.path}`)})}):null]}),y?(0,G.jsx)(`div`,{className:`mx-6 mb-3 rounded-2xl bg-muted/55 px-4 py-3 text-sm text-muted-foreground`,children:H(`gitRefreshingStatus`)}):null,F?(0,G.jsx)(`div`,{className:`mx-6 mb-3 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:H(`gitDetachedHeadBlocked`)}):null,E?(0,G.jsxs)(`div`,{className:`mx-6 mb-3 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:H(`gitCommitSucceededPushFailed`)}),(0,G.jsx)(`div`,{className:`mt-1 break-words text-xs opacity-90`,children:E})]}):null,w?(0,G.jsx)(`div`,{className:`mx-6 mb-3 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:w}):null,i?.counts?.conflicts?(0,G.jsx)(`div`,{className:`mx-6 mb-3 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:H(`gitCommitConflictsBlocked`)}):null,(0,G.jsx)(`div`,{className:`border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-6 py-4`,children:E?(0,G.jsxs)(`button`,{type:`button`,className:`flex h-12 w-full items-center gap-3 rounded-2xl bg-muted/70 px-3 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-45`,disabled:!!S||F,onClick:()=>void R(`push`),children:[S===`push`?(0,G.jsx)(t,{className:`size-4 shrink-0 animate-spin`}):(0,G.jsx)(re,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{children:H(`gitRetryPush`)})]}):(0,G.jsxs)(`div`,{className:`space-y-1.5 text-base`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex h-11 w-full items-center gap-3 rounded-2xl px-3 text-left transition-colors hover:bg-muted/55 disabled:cursor-not-allowed disabled:opacity-45`,disabled:!!S||!I,onClick:()=>void R(`commit`),children:[S===`commit`?(0,G.jsx)(t,{className:`size-4 shrink-0 animate-spin`}):(0,G.jsx)(p,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{children:H(`gitCommitOnly`)})]}),(0,G.jsxs)(`button`,{type:`button`,className:`flex h-12 w-full items-center gap-3 rounded-2xl bg-muted/70 px-3 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-45`,disabled:!!S||!I,onClick:()=>void R(`commit-push`),children:[S===`commit-push`?(0,G.jsx)(t,{className:`size-4 shrink-0 animate-spin`}):(0,G.jsx)(N,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`flex-1`,children:H(`gitCommitAndPush`)})]}),(0,G.jsxs)(`button`,{type:`button`,className:`flex h-11 w-full items-center gap-3 rounded-2xl px-3 text-left text-muted-foreground transition-colors hover:bg-muted/45 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35`,disabled:!!S||y||F,onClick:()=>void R(`push`),children:[S===`push`?(0,G.jsx)(t,{className:`size-4 shrink-0 animate-spin`}):(0,G.jsx)(re,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{children:H(`gitPushOnly`)})]})]})})]})}),document.body)}function du(e){return e.files.reduce((e,t)=>(e.additions+=t.additions??0,e.deletions+=t.deletions??0,e),{additions:0,deletions:0})}function fu({projectId:e,status:t,expanded:n,onExpandedChange:r,onOpenChanges:i,onOpenCommitPush:a,onCheckout:o,onCreated:s,onOpenGraph:c,mobileShell:l=!1}){let u=(0,V.useRef)(null),[d,f]=(0,V.useState)(!1),p=(0,V.useMemo)(()=>du(t),[t]),m=t.counts?.total??t.files.length;return(0,V.useEffect)(()=>{if(!n)return;function e(){f(!1),r(!1)}function t(t){u.current?.contains(t.target)||e()}function i(t){t.key===`Escape`&&e()}return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,i)}},[n,r]),t.isGitRepository?(0,G.jsxs)(`div`,{ref:u,className:`relative`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`button`,{type:`button`,className:W(`inline-flex size-9 items-center justify-center rounded-2xl bg-transparent text-muted-foreground/85 transition-colors hover:bg-muted/45 hover:text-foreground/90`,n&&`bg-muted/45 text-foreground/90`),onClick:()=>r(!n),"aria-label":H(`togglePinnedSummary`),title:H(`togglePinnedSummary`),"aria-expanded":n,children:(0,G.jsx)(C,{className:`size-[18px]`})}),n?(0,G.jsxs)(`div`,{className:W(`fixed inset-x-2 top-14 z-40 max-h-[calc(100dvh-4rem)] overflow-y-auto overscroll-contain rounded-3xl border border-[color-mix(in_oklab,var(--border)_38%,transparent)] bg-background p-4 text-foreground shadow-quickforge md:absolute md:inset-x-auto md:-right-10 md:top-11 md:max-h-none md:w-[min(15rem,calc(100vw-1rem))] md:overflow-visible lg:-right-20`,l&&`md:fixed md:inset-x-2 md:right-auto md:top-14 md:max-h-[calc(100dvh-4rem)] md:w-auto md:overflow-y-auto lg:inset-x-2 lg:right-auto lg:top-14`),children:[(0,G.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:H(`environmentInfo`)}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-full p-1.5 text-foreground/85 transition-colors hover:bg-muted`,onClick:()=>{f(!1),r(!1)},"aria-label":H(`gitToolsCollapse`),title:H(`gitToolsCollapse`),children:(0,G.jsx)(se,{className:`size-4`})})]}),(0,G.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,G.jsxs)(`button`,{type:`button`,className:W(`hidden h-11 w-full items-center gap-3 rounded-2xl px-2.5 text-left text-foreground/88 transition-colors hover:bg-muted/45 hover:text-foreground md:flex`,l&&`md:hidden`),onClick:i,children:[(0,G.jsx)(P,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`flex-1 font-medium`,children:H(`gitToolsChanges`)}),(0,G.jsxs)(`span`,{className:`font-medium text-emerald-600`,children:[`+`,p.additions]}),(0,G.jsxs)(`span`,{className:`font-medium text-red-600`,children:[`-`,p.deletions]})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex h-11 w-full items-center gap-3 rounded-2xl px-2.5 text-left text-foreground/88 transition-colors hover:bg-muted/45 hover:text-foreground`,onClick:()=>f(e=>!e),"aria-expanded":d,children:[(0,G.jsx)(de,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:t.branch||H(`unknown`)}),(0,G.jsx)(b,{className:W(`size-4 shrink-0 text-muted-foreground transition-transform`,d&&`rotate-180`)})]}),d?(0,G.jsx)(iu,{projectId:e,currentBranch:t.branch,dirtyCount:m,className:W(`fixed inset-x-2 top-[7.75rem] max-h-[calc(100dvh-8.25rem)] w-auto overflow-y-auto md:absolute md:inset-x-auto md:left-auto md:right-0 md:top-full md:mt-2 md:max-h-none md:w-[min(340px,calc(100vw-1rem))] md:overflow-hidden lg:right-full lg:top-0 lg:mr-3 lg:mt-0`,l&&`md:fixed md:inset-x-2 md:right-auto md:top-[7.75rem] md:mt-0 md:max-h-[calc(100dvh-8.25rem)] md:w-auto md:overflow-y-auto lg:inset-x-2 lg:right-auto lg:top-[7.75rem] lg:mr-0`),openChangesClassName:W(`hidden md:flex`,l&&`md:hidden`),onCheckout:async e=>{await o(e),f(!1)},onCreated:e=>{s(e),f(!1)},onOpenGraph:()=>{f(!1),c()},onOpenChanges:()=>{f(!1),i()}}):null]}),(0,G.jsxs)(`button`,{type:`button`,className:`flex h-11 w-full items-center gap-3 rounded-2xl px-2.5 text-left text-foreground/88 transition-colors hover:bg-muted/45 hover:text-foreground`,onClick:a,children:[(0,G.jsx)(z,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`font-medium`,children:H(`gitToolsCommitOrPush`)})]})]})]}):null]}):null}function pu(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(ot(),{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(t)}function mu(e){return e.type===`head`?`border-amber-500 text-foreground`:e.type===`tag`?`border-emerald-600 text-emerald-700 dark:text-emerald-300`:e.type===`remote`?`border-border bg-muted/40 text-muted-foreground`:`border-border bg-muted/30 text-muted-foreground`}function hu({decoration:e}){return(0,G.jsxs)(`span`,{className:W(`inline-flex h-6 items-center gap-1 rounded-lg border px-2 text-xs`,mu(e)),children:[e.type===`tag`?(0,G.jsx)(ce,{className:`size-3`}):(0,G.jsx)(de,{className:`size-3`}),(0,G.jsx)(`span`,{children:e.name})]})}function gu({index:e,isLast:t}){return(0,G.jsxs)(`div`,{className:`relative flex h-full min-h-14 w-full justify-center`,"aria-hidden":`true`,children:[t?null:(0,G.jsx)(`div`,{className:`absolute left-1/2 top-0 h-full w-px -translate-x-1/2 bg-amber-500/20`}),e>0?(0,G.jsx)(`div`,{className:`absolute left-1/2 top-0 h-1/2 w-px -translate-x-1/2 bg-amber-500/20`}):null,(0,G.jsx)(`div`,{className:W(`relative z-10 mt-5 rounded-full border bg-background`,e===0?`size-3.5 border-2 border-amber-500/80`:`size-2.5 border-amber-500/65`)})]})}function _u({projectId:e,projectName:n,onClose:r}){let[i,a]=(0,V.useState)([]),[o,s]=(0,V.useState)(!0),[l,u]=(0,V.useState)(),d=(0,V.useCallback)(async()=>{s(!0),u(void 0);try{a((await $l(e)).commits)}catch(e){u(e instanceof Error?e.message:H(`gitGraphFailed`))}finally{s(!1)}},[e]);(0,V.useEffect)(()=>{let e=window.setTimeout(()=>{d()},0);return()=>window.clearTimeout(e)},[d]),(0,V.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]);let f=(0,V.useMemo)(()=>i,[i]);return(0,fr.createPortal)((0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/45 p-6 backdrop-blur-sm`,onClick:e=>e.target===e.currentTarget?r():void 0,children:(0,G.jsxs)(`div`,{className:`flex h-[78vh] w-[86vw] max-w-[1500px] flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,children:[(0,G.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-3 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5`,children:[(0,G.jsx)(c,{className:`size-5 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate text-base font-medium text-foreground`,children:H(`gitGraph`)}),(0,G.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:n})]}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:`size-8`,onClick:()=>void d(),"aria-label":H(`refresh`),disabled:o,children:o?(0,G.jsx)(t,{className:`size-4 animate-spin`}):(0,G.jsx)(ee,{className:`size-4`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:`size-8`,onClick:r,"aria-label":H(`close`),children:(0,G.jsx)(se,{className:`size-4`})})]}),(0,G.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[72px_minmax(360px,1fr)_160px_140px_120px] border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-muted/20 text-sm font-medium text-muted-foreground`,children:[(0,G.jsx)(`div`,{className:`border-r-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5 py-3`,children:H(`graphColumn`)}),(0,G.jsx)(`div`,{className:`border-r-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5 py-3`,children:H(`description`)}),(0,G.jsx)(`div`,{className:`border-r-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5 py-3`,children:H(`date`)}),(0,G.jsx)(`div`,{className:`border-r-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5 py-3`,children:H(`author`)}),(0,G.jsx)(`div`,{className:`px-5 py-3`,children:H(`commit`)})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:o?(0,G.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,G.jsx)(t,{className:`size-4 animate-spin`}),(0,G.jsx)(`span`,{children:H(`loading`)})]}):l?(0,G.jsx)(`div`,{className:`m-5 rounded-2xl border border-border bg-muted/30 p-5 text-sm text-muted-foreground`,children:l}):f.length===0?(0,G.jsx)(`div`,{className:`m-5 rounded-2xl border border-border bg-muted/30 p-5 text-sm text-muted-foreground`,children:H(`noGitCommits`)}):f.map((e,t)=>(0,G.jsxs)(`div`,{className:W(`grid min-h-14 grid-cols-[72px_minmax(360px,1fr)_160px_140px_120px] border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] text-sm`,e.decorations.some(e=>e.type===`head`||e.name===`HEAD`)?`bg-muted/28`:`bg-background`),children:[(0,G.jsx)(gu,{index:t,isLast:t===f.length-1}),(0,G.jsx)(`div`,{className:`flex min-w-0 items-center gap-2 px-5 py-3`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.decorations.map(t=>(0,G.jsx)(hu,{decoration:t},`${e.hash}:${t.type}:${t.name}`)),(0,G.jsx)(`span`,{className:`min-w-0 break-words text-foreground/90`,children:e.subject})]})}),(0,G.jsx)(`div`,{className:`flex items-center border-l-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5 py-3 text-muted-foreground`,children:pu(e.date)}),(0,G.jsx)(`div`,{className:`flex min-w-0 items-center border-l-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5 py-3 text-muted-foreground`,children:(0,G.jsx)(`span`,{className:`truncate`,children:e.author})}),(0,G.jsx)(`div`,{className:`flex items-center border-l-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-5 py-3 font-mono text-muted-foreground`,children:e.shortHash})]},e.hash))})]})}),document.body)}async function vu(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.body?{"content-type":`application/json`}:void 0,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`Request failed: ${n.status}`);return r}function yu(e){if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let t=new Uint8Array(1);return crypto.getRandomValues(t),e[t[0]%e.length]}return e[Math.floor(Math.random()*e.length)]}function bu(){let e=()=>Array.from({length:6},()=>yu(`ABCDEFGHJKLMNPQRSTUVWXYZ23456789`)).join(``);return`${e()}-${e()}`}function xu(e=24){return new Date(Date.now()+e*60*60*1e3).toISOString()}async function Su(e){return vu(`/api/shares`,{method:`POST`,body:JSON.stringify(e)})}async function Cu(e){return vu(`/api/shares${e?`?sessionId=${encodeURIComponent(e)}`:``}`)}async function wu(e){return vu(`/api/shares/${encodeURIComponent(e)}`,{method:`DELETE`})}async function Tu(e){return vu(`/api/shared/${encodeURIComponent(e)}/meta`)}async function Eu(e,t=``){return vu(`/api/shared/${encodeURIComponent(e)}/unlock`,{method:`POST`,body:JSON.stringify({password:t})})}async function Du(e){return vu(`/api/shared/${encodeURIComponent(e)}/models`)}function Ou({open:e,sessionId:t,title:n,onOpenChange:r}){let i=(0,V.useId)(),[a,o]=(0,V.useState)(`read`),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(`24h`),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)([]),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(),x=(0,V.useMemo)(()=>{if(l!==`never`)return xu(l===`1h`?1:l===`7d`?168:24)},[l]);if((0,V.useEffect)(()=>{!e||!t||Cu(t).then(e=>g(e.shares)).catch(e=>b(e instanceof Error?e.message:`Failed to load shares`))},[e,t]),!e)return null;let S=a===`operate`,C=!!t&&(a!==`operate`||d&&s.trim()),w=async()=>{if(!(!t||!C)){if(S&&!s.trim()){b(`可操作分享必须设置密码。`);return}v(!0),b(void 0);try{let e=await Su({sessionId:t,permission:a,password:s.trim(),expiresAt:x});m(e.url),await Ks(e.url),f(!1),g((await Cu(t)).shares)}catch(e){b(e instanceof Error?e.message:`Failed to create share`)}finally{v(!1)}}},T=async e=>{let t=e.url||`${window.location.origin}/share/${encodeURIComponent(e.id)}`;m(t),await Ks(t)},E=async e=>{try{await wu(e),g(t=>t.map(t=>t.id===e?{...t,revokedAt:new Date().toISOString()}:t))}catch(e){b(e instanceof Error?e.message:`Failed to revoke share`)}};return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,G.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`shrink-0 border-b border-border px-5 py-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold`,children:`分享到局域网`}),(0,G.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[`当前对话:`,n,`。同一个对话只会有一个固定分享链接;只读分享密码可选,可操作分享必须设置密码。`]})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-sm font-medium`,children:`权限`}),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`rounded-xl border p-3 text-left text-sm ${a===`read`?`border-primary bg-primary/10`:`border-border`}`,onClick:()=>o(`read`),children:[(0,G.jsx)(`div`,{className:`font-medium`,children:`仅阅读`}),(0,G.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:`只能查看这一个对话。`})]}),(0,G.jsxs)(`button`,{type:`button`,className:`rounded-xl border p-3 text-left text-sm ${a===`operate`?`border-red-400 bg-red-50 text-red-950`:`border-border`}`,onClick:()=>o(`operate`),children:[(0,G.jsx)(`div`,{className:`font-medium text-red-700`,children:`可操作(高危)`}),(0,G.jsx)(`div`,{className:`mt-1 text-xs text-red-700`,children:`允许对方操作这个原对话,禁止 Fork。`})]})]})]}),a===`operate`?(0,G.jsxs)(`div`,{className:`rounded-xl border border-red-300 bg-red-50 p-3 text-sm text-red-900`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2 font-semibold`,children:[(0,G.jsx)(L,{className:`mt-0.5 size-4`}),`高危可操作权限`]}),(0,G.jsx)(`p`,{className:`mt-2 text-xs leading-5`,children:`拥有链接和密码的人只能操作这一个原对话,但对方的消息、停止生成、回滚、模型/思考等级选择、YOLO 状态下可用工具等操作会按正常对话权限直接影响你的本机原对话。可操作分享必须设置密码。`}),(0,G.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs font-medium`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`我已了解风险,仍然允许可操作权限。`]})]}):null,(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`block text-sm font-medium`,children:S?`密码(可操作必填)`:`密码(可选)`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,G.jsx)(`input`,{id:i,value:s,onChange:e=>c(e.target.value),className:`h-10 w-full min-w-0 rounded-md border border-input bg-background px-3 text-sm`,placeholder:S?`可操作分享必须设置密码`:`留空则打开链接无需密码`}),(0,G.jsxs)(K,{variant:`outline`,className:`h-10 sm:shrink-0`,onClick:()=>c(bu()),children:[(0,G.jsx)(ee,{className:`mr-2 size-4`}),`生成密码`]})]}),(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:S?`可操作分享必须设置非空密码;修改密码后旧密码和已解锁状态会失效。`:`留空保存会取消密码保护;填写新密码保存后旧密码和已解锁状态会失效。`})]}),(0,G.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`有效期`,(0,G.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`mt-2 h-10 w-full rounded-md border border-input bg-background px-3 text-sm`,children:[(0,G.jsx)(`option`,{value:`1h`,children:`1 小时`}),(0,G.jsx)(`option`,{value:`24h`,children:`24 小时`}),(0,G.jsx)(`option`,{value:`7d`,children:`7 天`}),(0,G.jsx)(`option`,{value:`never`,children:`永久,需手动撤销`})]})]}),p?(0,G.jsxs)(`div`,{className:`rounded-xl border border-emerald-300 bg-emerald-50 p-3 text-sm text-emerald-900`,children:[`已复制到剪切板。`,(0,G.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto whitespace-pre-wrap text-xs`,children:p})]}):null,y?(0,G.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:y}):null,h.length?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-2 text-sm font-medium`,children:`已有分享`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:h.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border p-2 text-xs`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-mono`,children:e.id}),(0,G.jsxs)(`div`,{className:`text-muted-foreground`,children:[e.permission===`operate`?`可操作`:`只读`,` · `,e.hasPassword?`有密码`:`无密码`,` · `,e.revokedAt?`已撤销`:e.expiresAt?`到期 ${new Date(e.expiresAt).toLocaleString()}`:`永久`]})]}),e.revokedAt?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,onClick:()=>void T(e),"aria-label":`复制分享链接`,title:`复制分享链接`,children:(0,G.jsx)(ae,{className:`size-4`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:`text-destructive`,onClick:()=>void E(e.id),"aria-label":`撤销分享`,title:`撤销分享`,children:(0,G.jsx)(k,{className:`size-4`})})]})]},e.id))})]}):null]})}),(0,G.jsx)(`div`,{className:`shrink-0 border-t border-border px-5 py-4`,children:(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(K,{variant:`outline`,onClick:()=>r(!1),children:H(`cancel`)}),(0,G.jsxs)(K,{variant:a===`operate`?`destructive`:`default`,disabled:!C||_,onClick:()=>void w(),title:a===`operate`&&!s.trim()?`可操作分享必须设置密码`:void 0,children:[(0,G.jsx)(ae,{className:`mr-2 size-4`}),a===`operate`?`保存配置并复制高危可操作链接`:`保存配置并复制链接`]})]})})]})})}function ku(e){let t=e.replace(/\\/g,`/`);return t.split(`/`).filter(Boolean).pop()||t||`artifact`}function Au(e){let t=e.toLowerCase(),n=t.replace(/\\/g,`/`).split(`/`).pop()||t;return t.endsWith(`.html`)||t.endsWith(`.htm`)?`html`:/\.(svg|png|jpe?g|webp|gif|ico)$/i.test(t)?`image`:/\.(md|mdx|markdown)$/i.test(t)?`markdown`:n===`dockerfile`||n.endsWith(`.dockerfile`)||n===`makefile`||/\.(ts|tsx|js|jsx|mjs|cjs|css|scss|less|json|jsonc|txt|csv|tsv|log|sql|xml|yml|yaml|toml|ini|py|rb|go|rs|java|swift|kt|kts|c|h|cpp|hpp|cs|php|sh|bash|zsh|ps1)$/i.test(t)?`code`:`unknown`}function ju(e){return Au(e)!==`unknown`}var Mu=/\.(svg|png|jpe?g|webp|gif|ico)$/i;function Nu(e){return Au(e)===`html`||Mu.test(e)}function Pu(e,t=Au(e)){if(t===`markdown`||t===`code`)return`reader`;if((t===`html`||t===`image`)&&Nu(e))return`browser`}function Fu(e,t){let n=t.replace(/\\/g,`/`);return!e?.trim()||n.startsWith(`/`)||/^[a-zA-Z]:\//.test(n)?t:`${e.trim().replace(/\\/g,`/`).replace(/\/+$/,``)}/${n.replace(/^\/+/,``)}`}function Iu(e,t,n){let r=t.replace(/\\/g,`/`),i=r.match(/^\/+/)?.[0]??``,a=i+r.slice(i.length).split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`),o=`/api/workspace/preview/${encodeURIComponent(e)}/${a}`;return n?`${o}?r=${n}`:o}function Lu(e){return e.replace(/\\/g,`/`).toLowerCase()}function Ru(e){let t=ku(e.path).toLowerCase();return e.defaultPreview?0:e.explicit&&e.preview?1:e.explicit?2:t===`index.html`?3:e.kind===`html`?4:e.kind===`image`?5:e.kind===`markdown`?6:e.kind===`code`?7:20}function zu(e){let t=new Map;for(let n of e){if(!n.path)continue;let e=Lu(n.path),r=n.kind??Au(n.path),i=t.get(e),a=n.preview??ju(n.path),o=n.source===`present_files`||n.presentation===`explicit`;if(!i){t.set(e,{id:e,path:n.path,title:n.title,description:n.description,kind:r,preview:a,defaultPreview:!!n.defaultPreview,explicit:o,addedLines:n.addedLines,removedLines:n.removedLines,sources:[n.source],toolCallIds:n.toolCallId?[n.toolCallId]:[]});continue}i.preview=i.preview||a,i.defaultPreview=i.defaultPreview||!!n.defaultPreview,i.explicit=i.explicit||o,i.title=n.title||i.title,i.description=n.description||i.description,typeof n.addedLines==`number`&&(i.addedLines=(i.addedLines??0)+n.addedLines),typeof n.removedLines==`number`&&(i.removedLines=(i.removedLines??0)+n.removedLines),i.kind=i.kind===`unknown`?r:i.kind,i.sources.includes(n.source)||i.sources.push(n.source),n.toolCallId&&!i.toolCallIds.includes(n.toolCallId)&&i.toolCallIds.push(n.toolCallId)}return[...t.values()].sort((e,t)=>Ru(e)-Ru(t))}function Bu(e){let t=zu(e).filter(e=>e.preview&&e.explicit);if(t.length<=1)return t[0];let n=new Map;for(let t=0;t<e.length;t++){let r=e[t]?.toolCallId;r&&n.set(r,t)}let r=e=>{let t=e.toolCallIds,r=-1;for(let e of t){let t=n.get(e);typeof t==`number`&&t>r&&(r=t)}return r};return[...t].sort((e,t)=>r(t)-r(e))[0]}function Vu(){let e=(0,V.useMemo)(()=>Tt(),[]),t=new URLSearchParams(window.location.search).get(`connect`)===`1`,[n,i]=(0,V.useState)(e),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(!1);(0,V.useEffect)(()=>{!t&&e.lastUsedUrl&&window.location.replace(Dt(e.lastUsedUrl))},[e,t]);let d=e=>{Et(e),i(e)},f=e=>{try{let t=Ct(a);d({urls:n.urls.includes(t)?n.urls:[...n.urls,t],lastUsedUrl:e?t:n.lastUsedUrl||t}),o(``),c(``),u(!0),e&&window.location.assign(Dt(t))}catch(e){u(!1),c(e instanceof Error?e.message:`无法保存 QuickForge 服务地址`)}},p=e=>{e.preventDefault(),f(!0)},h=e=>{try{d({...n,lastUsedUrl:e}),window.location.assign(Dt(e))}catch(e){c(e instanceof Error?e.message:`无法连接到 QuickForge 服务`)}},g=e=>{try{let t=n.urls.filter(t=>t!==e);d({urls:t,lastUsedUrl:n.lastUsedUrl===e?t[0]||``:n.lastUsedUrl}),c(``),u(!1)}catch(e){c(e instanceof Error?e.message:`无法删除服务器地址`)}};return(0,G.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background px-5 py-8 text-foreground`,children:(0,G.jsxs)(`section`,{className:`w-full max-w-md`,children:[(0,G.jsxs)(`div`,{className:`mb-8 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex size-11 items-center justify-center rounded-xl border border-border bg-background shadow-quickforge`,children:(0,G.jsx)(F,{className:`size-5 text-foreground/80`,"aria-hidden":`true`})}),(0,G.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`服务器设置`})]}),(0,G.jsxs)(`form`,{className:`rounded-2xl border border-border bg-background p-5 shadow-quickforge`,onSubmit:p,children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium`,htmlFor:`quickforge-mobile-server`,children:`服务器地址`}),(0,G.jsx)(`input`,{id:`quickforge-mobile-server`,autoCapitalize:`none`,autoCorrect:`off`,inputMode:`url`,spellCheck:!1,value:a,onChange:e=>{o(e.target.value),c(``),u(!1)},placeholder:`http://服务器地址:5176`,className:`mt-2 h-11 w-full rounded-xl border border-input bg-background px-3.5 text-sm outline-none transition-[border-color,box-shadow] placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:shadow-quickforge`}),s?(0,G.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,role:`alert`,children:s}):null,l&&!s?(0,G.jsxs)(`p`,{className:`mt-3 flex items-center gap-1.5 text-sm text-muted-foreground`,role:`status`,children:[(0,G.jsx)(r,{className:`size-4`,"aria-hidden":`true`}),`已保存`]}):null,(0,G.jsxs)(`div`,{className:`mt-5 grid grid-cols-2 gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,className:`inline-flex h-11 items-center justify-center rounded-xl border border-border bg-background px-4 text-sm font-medium text-foreground/80 transition-colors hover:bg-muted/45 active:bg-muted/65`,onClick:()=>f(!1),children:`保存`}),(0,G.jsxs)(`button`,{type:`submit`,className:`inline-flex h-11 items-center justify-center gap-2 rounded-xl bg-primary px-4 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-92 active:opacity-85`,children:[`保存并连接`,(0,G.jsx)(m,{className:`size-4`,"aria-hidden":`true`})]})]})]}),n.urls.length>0?(0,G.jsx)(`div`,{className:`mt-5 overflow-hidden rounded-2xl border border-border bg-background`,children:n.urls.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 p-2 last:border-b-0`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 rounded-xl px-2 py-2.5 text-left text-sm text-foreground/80 transition-colors hover:bg-muted/45`,onClick:()=>h(e),title:e,children:[(0,G.jsx)(`span`,{className:`inline-flex size-5 shrink-0 items-center justify-center`,children:e===n.lastUsedUrl?(0,G.jsx)(r,{className:`size-4 text-foreground/65`,"aria-hidden":`true`}):null}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e})]}),(0,G.jsx)(`button`,{type:`button`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition-colors hover:bg-muted/45 hover:text-foreground`,onClick:()=>g(e),"aria-label":`删除 ${e}`,title:`删除 ${e}`,children:(0,G.jsx)(k,{className:`size-4`,"aria-hidden":`true`})})]},e))}):null]})})}var Hu=`quickforge:system-notifications-enabled`,Uu=`quickforge:system-notifications-recent:v1`,Wu=1e4,Gu=100,Ku=!1;function qu(){if(!(typeof window>`u`||!Te.isNativePlatform()))return window.QuickForgeBridge}function Ju(){if(typeof window>`u`)return;let e=window;e.__quickforgeOpenSession||=e=>{$u(e)}}function Yu(){let e=qu();if(!e?.setNotificationService)return;let t=window.location.origin;if(t)try{e.setNotificationService(rd(),t)}catch(e){B.warn(`Failed to sync native notification service:`,e)}}Ju();function Xu(){if(typeof document>`u`||typeof window>`u`)return!1;let e=window;return document.body?.classList.contains(`quickforge-desktop-app`)||e.__quickforgeDesktopApp===!0}function Zu(){return Te.isNativePlatform()&&Te.isPluginAvailable(`LocalNotifications`)}function Qu(e){return`${H(e===`idle`?`taskCompleted`:e===`error`?`taskError`:e===`aborted`?`processAborted`:`taskRunning`)}. ${H(`systemNotificationOpenDetails`)}`}function $u(e){typeof window>`u`||(window.focus(),e&&window.dispatchEvent(new CustomEvent(`quickforge:open-session-from-settings`,{detail:{sessionId:e}})))}function ed(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n)|0;return(t>>>0)%2147483646+1}function td(){if(typeof localStorage>`u`)return{};try{let e=JSON.parse(localStorage.getItem(Uu)||`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&Number.isFinite(e[1])))}catch{return{}}}function nd(e){if(typeof localStorage>`u`)return!0;let t=Date.now(),n=td(),r=n[e];if(typeof r==`number`&&t-r<Wu)return!1;let i=Object.entries({...n,[e]:t}).filter(([,e])=>t-e<Wu).sort((e,t)=>t[1]-e[1]).slice(0,Gu);try{localStorage.setItem(Uu,JSON.stringify(Object.fromEntries(i)))}catch{}return!0}function rd(){if(typeof localStorage>`u`)return!1;try{return localStorage.getItem(Hu)===`1`}catch{return!1}}function id(e){if(!(typeof localStorage>`u`)){try{e?localStorage.setItem(Hu,`1`):localStorage.removeItem(Hu)}catch{}Yu()}}async function ad(){try{if(Zu()){let{LocalNotifications:e}=await Ue(async()=>{let{LocalNotifications:e}=await import(`./esm-oa69b5u4.js`);return{LocalNotifications:e}},__vite__mapDeps([0,1,2,3])),t=await e.checkPermissions();return t.display===`granted`?`granted`:t.display===`prompt`||t.display===`prompt-with-rationale`?`prompt`:`denied`}return Xu()||typeof Notification>`u`?`unsupported`:Notification.permission===`granted`?`granted`:Notification.permission===`denied`?`denied`:`prompt`}catch(e){return B.warn(`Failed to check system notification permission:`,e),`unsupported`}}async function od(){try{let e;if(Zu()){let{LocalNotifications:t}=await Ue(async()=>{let{LocalNotifications:e}=await import(`./esm-oa69b5u4.js`);return{LocalNotifications:e}},__vite__mapDeps([0,1,2,3]));e=(await t.requestPermissions()).display===`granted`?`granted`:`denied`,await sd()}else if(!Xu()&&typeof Notification<`u`){let t=await Notification.requestPermission();e=t===`granted`?`granted`:t===`denied`?`denied`:`prompt`}else e=`unsupported`;return id(e===`granted`),e}catch(e){return B.warn(`Failed to request system notification permission:`,e),id(!1),`denied`}}async function sd(){if(Yu(),!(!Zu()||Ku)){Ku=!0;try{let{LocalNotifications:e}=await Ue(async()=>{let{LocalNotifications:e}=await import(`./esm-oa69b5u4.js`);return{LocalNotifications:e}},__vite__mapDeps([0,1,2,3]));await e.addListener(`localNotificationActionPerformed`,e=>{let t=e.notification.extra?.sessionId;$u(typeof t==`string`?t:void 0)})}catch(e){Ku=!1,B.warn(`Failed to initialize native notification listener:`,e)}}}async function cd(e){if(!rd()||!e.force&&e.status===`running`&&typeof document<`u`&&document.visibilityState===`visible`&&document.hasFocus())return!1;try{if(await ad()!==`granted`||!nd(e.key))return!1;let t=Qu(e.status);if(Zu()){let{LocalNotifications:n}=await Ue(async()=>{let{LocalNotifications:e}=await import(`./esm-oa69b5u4.js`);return{LocalNotifications:e}},__vite__mapDeps([0,1,2,3]));return await sd(),await n.schedule({notifications:[{id:ed(e.key),title:e.title,body:t,extra:{sessionId:e.sessionId}}]}),!0}if(typeof Notification>`u`)return!1;let n=new Notification(e.title,{body:t,icon:`/pwa-icon-192.png`,tag:e.key});return n.onclick=()=>{n.close(),$u(e.sessionId)},!0}catch(e){return B.warn(`Failed to show system notification:`,e),!1}}var ld=(0,V.lazy)(()=>Ue(()=>import(`./ChatPanelHost-CyO8fEoj.js`).then(e=>({default:e.ChatPanelHost})),__vite__mapDeps([4,2,5,1,6,7,8,9,10,11]))),ud=(0,V.lazy)(()=>Ue(()=>import(`./SharedConversationPage-Cw2QFnbC.js`).then(e=>({default:e.SharedConversationPage})),__vite__mapDeps([12,2,1,5,6,7,8,4,9,10,11]))),dd=(0,V.lazy)(()=>Ue(()=>import(`./WorkspaceInspector-3uLiu6Bv.js`).then(e=>({default:e.WorkspaceInspector})),__vite__mapDeps([13,2,14,7,8,15,16,17,11,1]))),fd=(0,V.lazy)(()=>Ue(()=>import(`./TerminalDock-Dgg-_ZmU.js`).then(e=>({default:e.TerminalDock})),__vite__mapDeps([15,2,16,17,7,8]))),pd=(0,V.lazy)(()=>Ue(()=>import(`./SettingsWorkspacePage-B53_eDf2.js`).then(e=>({default:e.SettingsWorkspacePage})),__vite__mapDeps([18,2,1,5,6,7,8,10]))),md=`quickforge:auto-preview-seen-signatures`,hd=200,gd=`https://github.com/shawnstack/quickforge/releases/latest`,_d=1350,vd=280,yd=150,bd=280;function xd(){if(typeof window>`u`)return new Set;try{let e=window.sessionStorage.getItem(md),t=e?JSON.parse(e):void 0;return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`&&e.length>0)):new Set}catch{return new Set}}function Sd(e){return xd().has(e)}function Cd(e){if(!(typeof window>`u`))try{let t=[...xd(),e].slice(-hd);window.sessionStorage.setItem(md,JSON.stringify(t))}catch{}}function wd(){return(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:H(`loading`)})}function Td(){return null}function Ed({exiting:e=!1}){let t=H(`loadingChatWorkspace`);return(0,G.jsxs)(`div`,{className:W(`quickforge-startup-splash`,e&&`quickforge-startup-splash-exit`),role:`status`,"aria-label":t,children:[(0,G.jsxs)(`svg`,{className:`quickforge-startup-splash-icon`,viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`,children:[(0,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`linearGradient`,{id:`startupIconStroke`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#9ca3af`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#4b5563`})]}),(0,G.jsxs)(`linearGradient`,{id:`startupIconBolt`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#374151`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#0f172a`})]})]}),(0,G.jsx)(`polygon`,{className:`quickforge-startup-splash-outline`,points:`32,6 52.78,18 52.78,42 32,54 11.22,42 11.22,18`,fill:`none`,stroke:`url(#startupIconStroke)`,strokeWidth:`4.5`,strokeLinejoin:`round`}),(0,G.jsx)(`polygon`,{className:`quickforge-startup-splash-outline-final`,points:`32,6 52.78,18 52.78,42 32,54 11.22,42 11.22,18`,fill:`none`,stroke:`url(#startupIconStroke)`,strokeWidth:`4.5`,strokeLinejoin:`round`}),(0,G.jsx)(`path`,{className:`quickforge-startup-splash-bolt`,d:`M37.2 13 L22 34 L30.6 34 L26.8 50 L42.8 26 L33.8 26 Z`,fill:`url(#startupIconBolt)`}),(0,G.jsx)(`path`,{className:`quickforge-startup-splash-bolt-trace`,d:`M37.2 13 L22 34 L30.6 34 L26.8 50 L42.8 26 L33.8 26 Z`,fill:`none`,stroke:`#f8fafc`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,G.jsx)(`path`,{className:`quickforge-startup-splash-bolt-highlight`,d:`M37.2 13 L22 34 L30.6 34 L33.8 26 Z`,fill:`#e5e7eb`})]}),(0,G.jsx)(`span`,{className:`sr-only`,children:t})]})}function Dd(e){return e===`idle`||e===`running`||e===`error`||e===`aborted`}function Od(e){return e.type===`scheduled_task_notification`}function kd(e){return e.type===`scheduled_task_started`}function Ad(e){return e.workspace?.kind===`project`&&typeof e.workspace.id==`string`&&e.workspace.id.length>0?e.workspace.id:typeof e.projectId==`string`&&e.projectId.length>0?e.projectId:void 0}function jd(){let e=At(),r=kt(),a=r?window.location.origin:void 0,o=(0,V.useRef)(null),s=(0,V.useRef)(_n(un)),c=(0,V.useRef)(`default`),d=(0,V.useRef)(void 0),f=(0,V.useRef)(void 0),{activeProject:p,projects:m,defaultWorkspace:h,expandedProjectIds:g,selectingProject:_,projectPickerOpen:y,loadProject:S,switchActiveProject:C,handleSelectProjectPath:w,selectProjectDirectory:E,setProjectPickerOpen:D,toggleProjectExpanded:O,toggleAllProjectsExpanded:k,reorderProjects:A,setActiveProject:j,setProjects:M,setExpandedProjectIds:N}=vs(),{agentAccessMode:P,setAgentAccessMode:ne,initialize:F}=ys(),I=Tl(),{setArtifactPreviewOpen:L,setWorkspaceInspectorOpen:re,setWorkspaceInspectorRequest:ie}=I,[z,ae]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(),[ce,le]=(0,V.useState)(!1),[ue,pe]=(0,V.useState)(null),[me,ge]=(0,V.useState)(!1),[_e,ve]=(0,V.useState)(!1),[ye,xe]=(0,V.useState)({artifacts:[]}),[Se,Ce]=(0,V.useState)(`project`),[we,Te]=(0,V.useState)(`updatedAt`),[Ee,De]=(0,V.useState)(!1),Oe=(0,V.useRef)(!1),ke=(0,V.useRef)(``),[Ae,je]=(0,V.useState)(),[Me,Ne]=(0,V.useState)(),Pe=(0,V.useRef)(0),Fe=(0,V.useRef)(void 0),[Ie,Le]=(0,V.useState)(!1),[Re,ze]=(0,V.useState)(!1),[Be,Ve]=(0,V.useState)(!1),[He,Ue]=(0,V.useState)(!1),[We,Ge]=(0,V.useState)(()=>new Set),qe=(0,V.useRef)(0),Je=(0,V.useRef)(0),Ye=(0,V.useRef)(0),Xe=(0,V.useRef)(void 0),[Ze,Qe]=(0,V.useState)(null),[$e,et]=(0,V.useState)(!1),[tt,nt]=(0,V.useState)(!1),[rt,it]=(0,V.useState)(),at=(0,V.useRef)(void 0),{toasts:ot,handleTaskComplete:st,addToast:U,dismissToast:ct}=hc(),lt=(0,V.useCallback)((e,t,n)=>{st(e,t,n),cd({key:`agent:${e}:${n}`,sessionId:e,title:t,status:n})},[st]),ut=(0,V.useCallback)(()=>void 0,[]),dt=(0,V.useCallback)(()=>le(!1),[]),ft=(0,V.useCallback)(()=>{le(!1),window.open(gd,`_blank`,`noopener,noreferrer`)},[]),pt=(0,V.useCallback)(()=>{le(!1),window.open(`quickforge://exit`,`_blank`,`noopener,noreferrer`)},[]),mt=(0,V.useRef)(null),ht=(0,V.useRef)(null),{allLoadedSessions:gt,pinnedSessions:_t,pinnedHasMore:vt,pinnedLoading:yt,globalSessions:bt,sessionsForProject:xt,globalHasMore:St,projectTimelineSessions:Ct,projectTimelineHasMore:wt,projectTimelineLoading:Tt,projectHasMore:Et,globalLoading:Dt,projectLoading:Ot,projectLoaded:Mt,loadGlobalSessions:Pt,loadProjectSessions:It,refreshSessions:Lt,upsertSessionMetadata:Rt,updateSessionTitle:zt,loadMorePinned:Bt,loadMoreGlobal:Ht,loadMoreProject:Ut,loadMoreProjectTimeline:Wt}=mc({backendRef:ht,expandedProjectIds:g,externalProjectIds:We,viewMode:Se,sortMode:we,onBroadcastSessionsChanged:(0,V.useCallback)(()=>mt.current?.notifySessionsChanged(),[])}),Gt=xs({onSessionsChanged:()=>{Lt()},onProjectsChanged:()=>{S(!0)},onSettingsChanged:()=>{Lt()}});(0,V.useEffect)(()=>{c.current=P},[P]),(0,V.useEffect)(()=>{d.current=p},[p]),(0,V.useEffect)(()=>{f.current=h},[h]),(0,V.useEffect)(()=>{mt.current=Gt},[Gt]),(0,V.useEffect)(()=>{sd()},[]),(0,V.useEffect)(()=>{let e=window.setTimeout(()=>et(!0),_d);return()=>window.clearTimeout(e)},[]);let Kt=(0,V.useCallback)((e,t)=>{je(n=>n?.sessionId===e&&er(n,t)?n:{sessionId:e,...t})},[]),q=oc({storageRef:o,activeModelRef:s,agentAccessModeRef:c,activeProjectRef:d,defaultWorkspaceRef:f,setAgentAccessMode:ne,switchActiveProject:C,sessions:gt,refreshSessions:Lt,updateSessionTitle:zt,onTaskComplete:lt});(0,V.useEffect)(()=>{if(q.loadingSessionId){let e=q.loadingSessionId,t=window.setTimeout(()=>{at.current=e,it(e)},yd);return()=>window.clearTimeout(t)}if(!at.current)return;let e=window.setTimeout(()=>{at.current=void 0,it(void 0)},bd);return()=>window.clearTimeout(e)},[q.loadingSessionId]);let{createAgent:qt,startDeferredSession:Jt,loadSession:Yt,syncSessionUI:Xt,setCurrentAgentMessages:Zt,updateCurrentAgentModel:Qt,setChatPanelRevision:$t,setCurrentTitleRef:en,agentRef:J,taskMapRef:Y,currentSessionIdRef:tn,currentChatScopeRef:X}=q;(0,V.useEffect)(()=>{Fe.current=q.currentToolProject?.id,Pe.current+=1,Ye.current+=1},[q.currentToolProject?.id]);let nn=(0,V.useCallback)(e=>{e&&Yt(e)},[Yt]);(0,V.useEffect)(()=>{let e=e=>{let t=e.detail;typeof t?.sessionId==`string`&&nn(t.sessionId)};return window.addEventListener(`quickforge:open-session-from-settings`,e),()=>window.removeEventListener(`quickforge:open-session-from-settings`,e)},[nn]);let an=(0,V.useCallback)(e=>{se(t=>t?.id===e?void 0:t)},[]),Z=(0,V.useCallback)(e=>{Je.current+=1,ie({...e,id:Je.current}),re(!0)},[re,ie]),on=(0,V.useCallback)(e=>{ie(t=>t?.id===e?void 0:t)},[ie]),sn=(0,V.useCallback)(()=>{let e=q.currentToolProject?.id;e&&(L(!1),Z({projectId:e,kind:`review`,view:`changes`}))},[q.currentToolProject?.id,Z,L]),cn=(0,V.useCallback)(async()=>{let e=q.currentToolProject?.id,t=Pe.current+1;if(Pe.current=t,!e){Ne(void 0);return}try{let n=await Hl(e);return kl({projectId:e,requestId:t},Fe.current,Pe.current)?(Ne(n),n):void 0}catch(n){if(!kl({projectId:e,requestId:t},Fe.current,Pe.current))return;B.warn(`Failed to refresh title git status:`,n),Ne(void 0);return}},[q.currentToolProject?.id]);(0,V.useEffect)(()=>{let e=window.setTimeout(()=>{cn()},0);return()=>window.clearTimeout(e)},[cn]),(0,V.useEffect)(()=>{let e,t=zs(t=>{jl(t,tn.current,Fe.current)&&(e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,cn()},400))});return()=>{e!==void 0&&window.clearTimeout(e),t()}},[q.currentSessionId,tn,cn]);let ln=(0,V.useCallback)(async e=>{let t=q.currentToolProject?.id;if(!t)return;let n=Pe.current+1;Pe.current=n;try{let r=await Zl(t,e);if(!kl({projectId:t,requestId:n},Fe.current,Pe.current))return;Ne(r),Le(!1),U({sessionId:q.currentSessionId??``,title:H(`gitBranchSwitched`),status:`idle`,message:e})}catch(e){if(!kl({projectId:t,requestId:n},Fe.current,Pe.current))return;throw B.error(`Failed to checkout git branch:`,e),ac(e instanceof Error?e.message:H(`gitCheckoutFailed`)),e}},[U,q.currentSessionId,q.currentToolProject?.id]),dn=(0,V.useCallback)(e=>{Ne(e),Le(!1),U({sessionId:q.currentSessionId??``,title:H(`gitBranchCreated`),status:`idle`,message:e.branch??``})},[U,q.currentSessionId]),fn=(0,V.useCallback)(e=>{Ne(e),U({sessionId:q.currentSessionId??``,title:H(`gitOperationCompleted`),status:`idle`,message:e.branch??``})},[U,q.currentSessionId]),pn=(0,V.useCallback)(async e=>{let t=q.currentToolProject?.id;if(!t){U({sessionId:q.currentSessionId??``,title:`无法打开文件`,status:`error`,message:`当前对话没有关联项目。`});return}let n=Ye.current+1;Ye.current=n;try{let r=await Bl(t,e);if(!kl({projectId:t,requestId:n},Fe.current,Ye.current))return;Z({projectId:t,kind:`reader`,path:r.relativePath})}catch(e){if(!kl({projectId:t,requestId:n},Fe.current,Ye.current))return;let r=e instanceof Error?e.message:`打开文件失败`;U({sessionId:q.currentSessionId??``,title:`无法打开文件`,status:`error`,message:r})}},[U,q.currentSessionId,q.currentToolProject?.id,Z]),mn=(0,V.useCallback)((e,t,n)=>{let r=q.currentToolProject,i=Pu(t,n);if(!(!r||r.id!==e||!i)){if(L(!1),i===`reader`){Z({projectId:e,kind:`reader`,path:t});return}Z({projectId:e,kind:`browser`,url:Fu(r.path,t)})}},[q.currentToolProject,Z,L]);(0,V.useEffect)(()=>{let e=q.currentToolProject,t=e?.id;if(!t||ye.projectId!==t||ye.sessionId!==q.currentSessionId)return;let n=Bu(ye.artifacts);if(!n?.path)return;let r=n.toolCallIds[n.toolCallIds.length-1],i=`${t}:${n.path}:${n.defaultPreview?`default`:n.explicit?`explicit`:`inferred`}:${r??``}`;if(i!==ke.current){if(Sd(i)){ke.current=i;return}ke.current=i,Cd(i),queueMicrotask(()=>{let r=Pu(n.path,n.kind);r&&(L(!1),Z(r===`reader`?{projectId:t,kind:`reader`,path:n.path}:{projectId:t,kind:`browser`,url:Fu(e.path,n.path)}))})}},[q.currentSessionId,q.currentToolProject,ye,Z,L]),(0,V.useEffect)(()=>{ke.current=``,L(!1),ie(void 0)},[q.currentToolProject?.id,L,ie]),(0,V.useEffect)(()=>{if(!mn)return;let e=e=>{let t=e.detail,n=q.currentToolProject?.id;n&&t&&typeof t.path==`string`&&mn(n,t.path,t.kind)};return window.addEventListener(`quickforge:preview-artifact`,e),()=>window.removeEventListener(`quickforge:preview-artifact`,e)},[q.currentToolProject?.id,mn]),(0,V.useEffect)(()=>zs(e=>{if(kd(e)){let t=typeof e.projectId==`string`?e.projectId:void 0;t&&(N(e=>{let n=new Set(e);return n.add(t),n}),It(t,0)),Lt({broadcast:!0});return}if(e.type===`session_created`){let t=e.metadata;t?.id&&Rt(t)}else if(e.type===`title_updated`){let t=typeof e.sessionId==`string`?e.sessionId:void 0,n=typeof e.title==`string`?e.title:void 0;t&&n&&zt(t,n)}else (e.type===`agent_end`||e.type===`session_forked`)&&Lt({broadcast:!0});if(!Od(e))return;let t=typeof e.sessionId==`string`?e.sessionId:void 0,n=typeof e.title==`string`?e.title:H(`scheduledTasks`),r=Dd(e.status)?e.status:`idle`,i=typeof e.message==`string`?e.message:void 0;U({sessionId:t??``,title:n,status:r,message:i});let a=typeof e.runId==`string`?e.runId:void 0;cd({key:a?`scheduled:${a}`:`scheduled:${t??n}:${r}`,sessionId:t,title:n,status:r})}),[U,It,Lt,N,zt,Rt]);let{ready:hn,startupError:gn,retryBootstrap:vn}=Gc({storageRef:o,backendRef:ht,activeModelRef:s,agentAccessModeRef:c,taskMapRef:Y,refreshSessions:Lt,loadProject:S,initAgentAccessMode:F,createAgent:qt,loadSession:Yt,setNeedsModelSetup:ae,onStorageReady:Qe}),yn=tl(o,hn),bn=hn&&$e&&!!(q.agent||z);(0,V.useEffect)(()=>{if(!bn)return;let e=window.setTimeout(()=>nt(!0),vd);return()=>window.clearTimeout(e)},[bn]),(0,V.useEffect)(()=>{if(!hn)return;let e=new EventSource(`/api/channels/events`),t=e=>{try{let t=JSON.parse(e.data);if(t.type!==`sessions-changed`||typeof t.sessionId!=`string`)return;let n=Ad(t);n&&Ge(e=>e.has(n)?e:new Set([...e,n])),t.metadata?.id===t.sessionId?Rt(t.metadata):n?It(n,0):Pt(0);let r=J.current;t.sessionId===tn.current&&r instanceof Bs&&r.syncState()}catch{}};return e.addEventListener(`sessions-changed`,t),()=>{e.removeEventListener(`sessions-changed`,t),e.close()}},[J,tn,Pt,It,hn,Rt]),(0,V.useEffect)(()=>{if(hn)for(let e of g)!Mt(e)&&!Ot(e)&&It(e,0)},[hn,g,Mt,Ot,It]);let{startNewGlobalChat:xn,startNewProjectChat:Sn,rollbackFromMessage:Cn,retryFromMessage:wn,copyAnswer:Tn,forkFromMessage:En}=_l({storageRef:o,activeModelRef:s,activeProjectRef:d,currentChatScopeRef:X,currentSessionIdRef:tn,taskMapRef:Y,agentRef:J,createAgent:qt,startDeferredSession:Jt,syncSessionUI:Xt,setCurrentAgentMessages:Zt,setChatPanelRevision:$t,refreshSessions:Lt,needsModelSetup:z,switchActiveProject:C,closeWorkspacePage:ut,setRestoredDraft:se}),{deleteProjectInline:Dn}=vl({activeProjectRef:d,refreshSessions:Lt,notifyProjectsChanged:Gt.notifyProjectsChanged,setActiveProject:j,setProjects:M,setExpandedProjectIds:N,setChatPanelRevision:$t});(0,V.useEffect)(()=>{let e=Ol({ready:hn,currentToolProjectId:q.currentToolProject?.id,projects:m,activeProject:p,recoveringProjectId:Xe.current});if(e.type===`none`){let e=q.currentToolProject?.id;Xe.current&&Xe.current!==e&&(Xe.current=void 0);return}Xe.current=e.deletedProjectId,xe({artifacts:[]}),ie(void 0),L(!1),pe(null),ge(!1),Ye.current+=1,Jt(e.type===`project`?{scope:`project`,project:e.project}:{scope:`global`}).catch(e=>{Xe.current=void 0,B.error(`Failed to recover after the current project was deleted:`,e)})},[p,q.currentToolProject?.id,m,hn,L,ie,Jt]);let{setAccessMode:On}=wl({storageRef:o,agentAccessModeRef:c,setAgentAccessMode:ne,agentRef:J,setChatPanelRevision:$t,notifySettingsChanged:Gt.notifySettingsChanged}),kn=(0,V.useCallback)(async e=>{let t=J.current;if(!t)throw Error(H(`toolApprovalFailed`));try{await t.approveToolCall(e)}catch(e){throw B.error(`Failed to approve tool call:`,e),e instanceof Error?e:Error(H(`toolApprovalFailed`))}},[J]),An=(0,V.useCallback)(async e=>{let t=J.current;if(!t)throw Error(H(`toolApprovalFailed`));try{await t.rejectToolCall(e)}catch(e){throw B.error(`Failed to reject tool call:`,e),e instanceof Error?e:Error(H(`toolApprovalFailed`))}},[J]),jn=(0,V.useCallback)(async e=>{let t=J.current;if(!t?.approveAutoCompact)throw Error(H(`toolApprovalFailed`));await t.approveAutoCompact(e)},[J]),Mn=(0,V.useCallback)(async e=>{let t=J.current;if(!t?.rejectAutoCompact)throw Error(H(`toolApprovalFailed`));await t.rejectAutoCompact(e)},[J]),{loadSession:Nn,renameSession:Pn,togglePinSession:Fn,archiveSession:In,startNewGlobalSession:Ln}=Sl({storageRef:o,taskMapRef:Y,currentSessionIdRef:tn,loadAgentSession:Yt,setCurrentTitleRef:en,refreshSessions:Lt,updateSessionTitle:zt,closeWorkspacePage:ut,startNewGlobalChat:xn}),Rn=(0,V.useCallback)((e,t)=>{I.setSettingsInitialTab(e),I.setSettingsCustomProvider(t),I.setSettingsDialogOpen(!0),I.setMobileSidebarOpen(!1)},[I]),{activateConfiguredModel:zn,openModelSettings:Bn,openDefaultOptionsSettings:Vn,openAboutSettings:Hn,activateLiteLlmExampleModel:Un,openCustomModelSelector:Wn}=ml({storageRef:o,activeModelRef:s,agentRef:J,createAgent:qt,updateCurrentAgentModel:Qt,setChatPanelRevision:$t,setNeedsModelSetup:ae,setRestoredDraft:se,notifySettingsChanged:Gt.notifySettingsChanged,openSettingsPage:Rn}),Gn=(0,V.useCallback)(()=>{I.setSettingsDialogOpen(!1),I.setSettingsCustomProvider(void 0),(z||!J.current)&&zn().catch(e=>B.error(`Failed to activate configured model:`,e))},[zn,J,z,I]),Kn=(0,V.useCallback)(()=>{le(!1),Hn()},[Hn]),qn=(0,V.useMemo)(()=>gt,[gt]),Jn=(0,V.useMemo)(()=>{if(q.currentSessionId)return qn.find(e=>e.id===q.currentSessionId)},[q.currentSessionId,qn]),Yn=!!Jn?.pinnedAt,Xn=Dl(qn),Zn=(0,V.useCallback)(e=>q.taskStatuses[e.id]??Xn[e.id]??e.taskStatus??`idle`,[q.taskStatuses,Xn]);(0,V.useEffect)(()=>{if(ce)return window.addEventListener(`click`,dt),window.addEventListener(`blur`,dt),()=>{window.removeEventListener(`click`,dt),window.removeEventListener(`blur`,dt)}},[dt,ce]),(0,V.useEffect)(()=>{if(!I.conversationMenuOpen)return;let e=()=>I.setConversationMenuOpen(!1),t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),window.addEventListener(`orientationchange`,e),document.addEventListener(`keydown`,t),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e),window.removeEventListener(`orientationchange`,e),document.removeEventListener(`keydown`,t)}},[I,I.conversationMenuOpen]),(0,V.useEffect)(()=>{if(!Ie)return;let e=()=>Le(!1);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[Ie]),(0,V.useEffect)(()=>{let t=t=>{if(e){ac(`远程客户端不能使用服务端终端`);return}let n=t.detail,r=typeof n?.command==`string`?n.command.trim():``;r&&(async()=>{(n?.confirm||n?.dangerous)&&!await ic({title:H(`confirmExecuteCommandTitle`),description:n?.dangerous?H(`confirmExecuteDangerousCommand`):H(`confirmExecuteMultipleCommands`),confirmLabel:H(`executeInTerminal`),cancelLabel:H(`cancel`),variant:n?.dangerous?`destructive`:`default`})||(L(!1),ge(!0),pe({id:++qe.current,command:r,execute:!0}))})().catch(e=>{B.error(`Failed to execute markdown command:`,e),ac(e instanceof Error?e.message:H(`terminalCommandExecuteFailed`))})};return window.addEventListener(`quickforge:execute-markdown-command`,t),()=>window.removeEventListener(`quickforge:execute-markdown-command`,t)},[e,L]);let Qn=(0,V.useCallback)(e=>{pe(t=>t?.id===e?null:t)},[]),$n=(0,V.useCallback)(()=>{I.setFirstUseGuideDismissed(!0)},[I]),tr=(0,V.useCallback)(()=>{let e=q.currentToolProject?.id?H(`firstUseGuideProjectPrompt`):H(`firstUseGuideGeneralPrompt`);navigator.clipboard.writeText(e).then(()=>U({sessionId:q.currentSessionId??``,title:H(`copied`),status:`idle`,message:e})).catch(e=>{B.error(`Failed to copy first-use guide prompt:`,e),ac(H(`copyFailed`))})},[U,q.currentSessionId,q.currentToolProject?.id]),nr=!z&&!!q.agent&&!q.agent?.state.isStreaming&&(q.agent?.state.messages.length??0)===0;(0,V.useEffect)(()=>{nr&&!Oe.current&&De(!1),Oe.current=nr},[nr]),(0,V.useEffect)(()=>{!nr||Ee||!p||q.chatScope!==`global`||Sn(p)},[p,q.chatScope,Ee,nr,Sn]);let rr=(0,V.useCallback)(()=>{if(De(!1),p){Sn(p);return}Ln()},[p,Ln,Sn]),ir=(0,V.useCallback)(e=>{Sn(e)},[Sn]),ar=(0,V.useCallback)(()=>{De(!0),Ln()},[Ln]),or=(0,V.useCallback)(()=>{E()},[E]),sr=!!Ze&&!I.firstUseGuideDismissed&&!nr&&m.length===0&&bt.length===0,cr=(0,V.useCallback)(()=>{let e=q.currentSessionId;e&&(I.setConversationMenuOpen(!1),Fn(e))},[q.currentSessionId,Fn,I]),lr=(0,V.useCallback)(()=>{let e=q.currentSessionId;e&&(I.setConversationMenuOpen(!1),Pn(e,q.currentTitle))},[q.currentSessionId,q.currentTitle,Pn,I]),fr=(0,V.useCallback)(()=>{I.setConversationMenuOpen(!1),I.setShareDialogOpen(!0)},[I]),mr=(0,V.useCallback)(()=>{let e=q.currentSessionId;e&&(I.setConversationMenuOpen(!1),In(e))},[q.currentSessionId,In,I]),{setSkillsDialog:hr,setSidebarOpen:gr}=I,_r=(0,V.useCallback)(()=>{Rn(`skills`)},[Rn]),vr=(0,V.useCallback)(()=>{Rn(`agents`)},[Rn]),yr=(0,V.useCallback)(()=>{Rn(`scheduledTasks`)},[Rn]),br=(0,V.useCallback)(e=>{hr({scope:`project`,project:e})},[hr]),xr=(0,V.useCallback)(async e=>{let t=await fetch(`/api/project/${encodeURIComponent(e.id)}/open-in-explorer`,{method:`POST`});if(t.ok)return;let n=await t.json().catch(()=>null);throw Error(n?.error||H(`openInExplorerFailed`))},[]),Sr=(0,V.useCallback)(async e=>{let t=await fetch(`/api/project/${encodeURIComponent(e.id)}/open-in-vscode`,{method:`POST`});if(t.ok)return;let n=await t.json().catch(()=>null);throw Error(n?.error||H(`openInVSCodeFailed`))},[]),Cr=(0,V.useCallback)(async e=>{let t=await fetch(`/api/project/${encodeURIComponent(e.id)}/open-in-idea`,{method:`POST`});if(t.ok)return;let n=await t.json().catch(()=>null);throw Error(n?.error||H(`openInIDEAFailed`))},[]),wr=(0,V.useCallback)(e=>{xr(e).catch(e=>{B.error(`Failed to open project in explorer:`,e),ac(e instanceof Error?e.message:H(`openInExplorerFailed`))})},[xr]),Tr=(0,V.useCallback)(e=>{Sr(e).catch(e=>{B.error(`Failed to open project in VS Code:`,e),ac(e instanceof Error?e.message:H(`openInVSCodeFailed`))})},[Sr]),Er=(0,V.useCallback)(e=>{Cr(e).catch(e=>{B.error(`Failed to open project in IntelliJ IDEA:`,e),ac(e instanceof Error?e.message:H(`openInIDEAFailed`))})},[Cr]),Dr=(0,V.useCallback)(()=>gr(e=>!e),[gr]),Q=(0,V.useCallback)(()=>{I.setMobileSidebarOpen(!1)},[I]),Or=(0,V.useCallback)(e=>{Q(),Nn(e)},[Q,Nn]),kr=(0,V.useCallback)(()=>{Q(),rr()},[Q,rr]),Ar=(0,V.useCallback)(e=>{Q(),Sn(e)},[Q,Sn]),jr=(0,V.useCallback)(()=>{Q(),_r()},[Q,_r]),Mr=(0,V.useCallback)(()=>{Q(),vr()},[Q,vr]),Nr=(0,V.useCallback)(()=>{Q(),yr()},[Q,yr]),Pr=(0,V.useCallback)(e=>{Q(),br(e)},[Q,br]),Fr=(0,V.useCallback)(e=>{if(e.scope===`project`&&e.project&&e.projects){M(e.projects),I.setSkillsDialog({scope:`project`,project:e.project}),d.current?.id===e.project.id&&(j(e.project),d.current=e.project),Gt.notifyProjectsChanged();return}Gt.notifyProjectsChanged()},[Gt,j,M,I]);return gn?(0,G.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-background p-6 text-foreground`,children:(0,G.jsxs)(`div`,{className:`max-w-md rounded-lg border border-border bg-background p-5 text-center`,children:[(0,G.jsx)(`h1`,{className:`text-base font-semibold`,children:H(`localServiceUnavailableTitle`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:gn}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,G.jsx)(K,{variant:`outline`,size:`sm`,onClick:vn,children:H(`retry`)}),(0,G.jsx)(K,{variant:`default`,size:`sm`,onClick:()=>window.location.reload(),children:H(`reloadPage`)})]})]})}):bn?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`quickforge-desktop-titlebar fixed left-0 right-0 top-0 z-40 hidden h-8 items-center px-2`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`quickforge-desktop-titlebar-trigger inline-flex h-8 translate-y-1 items-center gap-2.5 rounded-none px-3 text-[13px] font-medium leading-none text-foreground/90 transition-colors hover:bg-accent hover:text-accent-foreground`,onClick:e=>{e.stopPropagation(),le(e=>!e)},"aria-haspopup":`menu`,"aria-expanded":ce,children:[(0,G.jsxs)(`svg`,{className:`h-[18px] w-[18px] shrink-0`,viewBox:`0 0 64 64`,"aria-hidden":`true`,children:[(0,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`linearGradient`,{id:`titlebarIconStroke`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#9ca3af`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#4b5563`})]}),(0,G.jsxs)(`linearGradient`,{id:`titlebarIconBolt`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#374151`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#0f172a`})]})]}),(0,G.jsx)(`polygon`,{points:`32,6 52.78,18 52.78,42 32,54 11.22,42 11.22,18`,fill:`none`,stroke:`url(#titlebarIconStroke)`,strokeWidth:`4.5`,strokeLinejoin:`round`}),(0,G.jsx)(`path`,{d:`M37.2 13 L22 34 L30.6 34 L26.8 50 L42.8 26 L33.8 26 Z`,fill:`url(#titlebarIconBolt)`}),(0,G.jsx)(`path`,{d:`M37.2 13 L22 34 L30.6 34 L33.8 26 Z`,fill:`#e5e7eb`,opacity:`0.4`})]}),(0,G.jsx)(`span`,{children:`QuickForge`})]}),ce&&(0,G.jsxs)(`div`,{className:`quickforge-desktop-titlebar-menu absolute left-2 top-8 min-w-40 overflow-hidden rounded-md border border-border bg-popover py-1 text-[13px] text-popover-foreground shadow-lg`,role:`menu`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex h-8 w-full items-center gap-2.5 px-3 text-left hover:bg-accent hover:text-accent-foreground`,role:`menuitem`,onClick:Kn,children:[(0,G.jsx)(l,{className:`size-4`}),(0,G.jsx)(`span`,{children:H(`about`)})]}),(0,G.jsxs)(`button`,{type:`button`,className:`flex h-8 w-full items-center gap-2.5 px-3 text-left hover:bg-accent hover:text-accent-foreground`,role:`menuitem`,onClick:ft,children:[(0,G.jsx)(ee,{className:`size-4`}),(0,G.jsx)(`span`,{children:H(`desktopUpdate`)})]}),(0,G.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,G.jsxs)(`button`,{type:`button`,className:`flex h-8 w-full items-center gap-2.5 px-3 text-left text-destructive hover:bg-destructive/10`,role:`menuitem`,onClick:pt,children:[(0,G.jsx)(be,{className:`size-4`}),(0,G.jsx)(`span`,{children:H(`desktopExit`)})]})]})]}),!I.settingsDialogOpen&&(0,G.jsxs)(`div`,{className:W(`quickforge-window-toolbar fixed right-2 z-30 flex items-center gap-1`,_e&&`pointer-events-none invisible`),"aria-hidden":_e||void 0,"aria-label":H(`workspacePanel`),children:[!e&&!I.workspaceInspectorOpen?(0,G.jsx)(Vt,{project:q.currentToolProject,disabled:z,onOpenInExplorer:wr,onOpenInVSCode:Tr,onOpenInIDEA:Er}):null,!I.workspaceInspectorOpen&&q.currentToolProject?.id&&Me?.isGitRepository?(0,G.jsx)(fu,{projectId:q.currentToolProject.id,status:Me,expanded:Re,onExpandedChange:ze,onOpenChanges:()=>{ze(!1),sn()},onOpenCommitPush:()=>{ze(!1),Ve(!0)},onCheckout:ln,onCreated:dn,onOpenGraph:()=>Ue(!0),mobileShell:r}):null,e?null:(0,G.jsx)(K,{variant:`ghost`,size:`icon`,onClick:()=>{L(!1),ge(e=>!e)},disabled:!q.currentToolProject?.id||z,"aria-label":H(me?`terminalCollapse`:`rightPanelTerminal`),title:H(me?`terminalCollapse`:`rightPanelTerminal`),className:W(`rounded-[10px] text-muted-foreground/85 hover:bg-muted/45 hover:text-foreground/90 disabled:opacity-40`,me?`bg-accent text-accent-foreground hover:bg-accent hover:text-accent-foreground`:void 0),children:(0,G.jsx)(fe,{className:`size-[18px] stroke-[1.85]`})}),(0,G.jsx)(K,{variant:`ghost`,size:`icon`,onClick:()=>{L(!1),I.setWorkspaceInspectorOpen(e=>!e)},disabled:!q.currentToolProject?.id||z,"aria-label":I.workspaceInspectorOpen?H(`workspaceCollapseRightPanel`):H(`workspaceExpandRightPanel`),title:I.workspaceInspectorOpen?H(`workspaceCollapseRightPanel`):H(`workspaceExpandRightPanel`),className:W(`hidden rounded-[10px] text-muted-foreground/85 hover:bg-muted/45 hover:text-foreground/90 disabled:opacity-40 lg:inline-flex`,I.workspaceInspectorOpen?`bg-accent text-accent-foreground hover:bg-accent hover:text-accent-foreground`:void 0),children:(0,G.jsx)(i,{className:`size-[18px] stroke-[1.85]`})})]}),I.settingsDialogOpen?(0,G.jsx)(V.Suspense,{fallback:(0,G.jsx)(wd,{}),children:(0,G.jsx)(pd,{initialTab:I.settingsInitialTab,customProvider:I.settingsCustomProvider,onBack:Gn})}):(0,G.jsxs)(`div`,{className:`flex h-screen min-h-0 supports-[height:100dvh]:h-dvh bg-[var(--quickforge-sidebar-bg)] text-foreground`,children:[(0,G.jsx)($o,{sidebarOpen:I.sidebarOpen,projectsCollapsed:I.projectsCollapsed,pinnedCollapsed:I.pinnedCollapsed,conversationsCollapsed:I.conversationsCollapsed,projects:m,expandedProjectIds:g,activeProject:p,currentSessionId:q.currentSessionId,loadingSessionId:q.loadingSessionId,sessionViewMode:Se,sessionSortMode:we,globalSessions:bt,pinnedSessions:_t,pinnedHasMore:vt,pinnedLoading:yt,sessionsForProject:xt,projectTimelineSessions:Ct,projectTimelineHasMore:wt,projectTimelineLoading:Tt,globalHasMore:St,globalLoading:Dt,onLoadMoreGlobal:Ht,onLoadMorePinned:Bt,projectHasMore:Et,projectLoading:Ot,projectLoaded:Mt,onLoadMoreProject:Ut,onLoadMoreProjectTimeline:Wt,sessionTaskStatus:Zn,selectingProject:_,onTogglePinnedCollapsed:I.togglePinnedCollapsed,onToggleProjectsCollapsed:I.toggleProjectsCollapsed,onToggleConversationsCollapsed:I.toggleConversationsCollapsed,onToggleProjectExpanded:O,onToggleAllProjectsExpanded:k,onReorderProjects:A,onSelectProjectDirectory:e?void 0:E,onStartNewProjectChat:Sn,onOpenGlobalSkills:_r,onOpenAgents:vr,onOpenScheduledTasks:yr,onOpenProjectSkills:br,onOpenProjectInExplorer:e?void 0:wr,onDeleteProject:Dn,onLoadSession:Nn,onSessionViewModeChange:Ce,onSessionSortModeChange:Te,onTogglePinSession:Fn,onDeleteSession:In,onStartNewGlobalChat:rr,onOpenSettings:Vn,currentServerUrl:a,onOpenServer:r?jt:void 0,updateAvailable:yn.result.updateAvailable,latestVersion:yn.result.latestVersion,currentVersion:yn.result.currentVersion,onOpenUpdate:Hn,onDismissUpdate:yn.dismissUpdate,onToggleSidebar:Dr,currentSessionHoverInfo:Ae}),I.mobileSidebarOpen?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 md:hidden`,role:`dialog`,"aria-modal":`true`,children:[(0,G.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-background/65 backdrop-blur-sm`,onClick:Q,"aria-label":H(`toggleSidebar`)}),(0,G.jsx)(`div`,{className:`absolute inset-y-0 left-0 max-w-[85vw] shadow-quickforge`,children:(0,G.jsx)($o,{variant:`mobile`,sidebarOpen:!0,projectsCollapsed:I.projectsCollapsed,pinnedCollapsed:I.pinnedCollapsed,conversationsCollapsed:I.conversationsCollapsed,projects:m,expandedProjectIds:g,activeProject:p,currentSessionId:q.currentSessionId,loadingSessionId:q.loadingSessionId,sessionViewMode:Se,sessionSortMode:we,globalSessions:bt,pinnedSessions:_t,pinnedHasMore:vt,pinnedLoading:yt,sessionsForProject:xt,projectTimelineSessions:Ct,projectTimelineHasMore:wt,projectTimelineLoading:Tt,globalHasMore:St,globalLoading:Dt,onLoadMoreGlobal:Ht,onLoadMorePinned:Bt,projectHasMore:Et,projectLoading:Ot,projectLoaded:Mt,onLoadMoreProject:Ut,onLoadMoreProjectTimeline:Wt,sessionTaskStatus:Zn,selectingProject:_,onTogglePinnedCollapsed:I.togglePinnedCollapsed,onToggleProjectsCollapsed:I.toggleProjectsCollapsed,onToggleConversationsCollapsed:I.toggleConversationsCollapsed,onToggleProjectExpanded:O,onToggleAllProjectsExpanded:k,onReorderProjects:A,onSelectProjectDirectory:e?void 0:()=>{Q(),E()},onStartNewProjectChat:Ar,onOpenGlobalSkills:jr,onOpenAgents:Mr,onOpenScheduledTasks:Nr,onOpenProjectSkills:Pr,onOpenProjectInExplorer:e?void 0:e=>{Q(),xr(e).catch(e=>{B.error(`Failed to open project in explorer:`,e),ac(e instanceof Error?e.message:H(`openInExplorerFailed`))})},onDeleteProject:Dn,onLoadSession:Or,onSessionViewModeChange:Ce,onSessionSortModeChange:Te,onTogglePinSession:Fn,onDeleteSession:In,onStartNewGlobalChat:kr,onOpenSettings:()=>{Q(),Vn()},currentServerUrl:a,onOpenServer:r?()=>{Q(),jt()}:void 0,updateAvailable:yn.result.updateAvailable,latestVersion:yn.result.latestVersion,currentVersion:yn.result.currentVersion,onOpenUpdate:()=>{Q(),Hn()},onDismissUpdate:yn.dismissUpdate,onToggleSidebar:Q,currentSessionHoverInfo:Ae})})]}):null,(0,G.jsxs)(`main`,{className:W(`flex min-w-0 flex-1 flex-col bg-[var(--quickforge-main-bg)] md:overflow-hidden md:rounded-tl-2xl`),children:[(0,G.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center gap-2 border-b border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-3 pr-20`,children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:()=>I.setMobileSidebarOpen(!0),"aria-label":H(`toggleSidebar`),children:(0,G.jsx)(u,{className:`size-[18px]`})}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`min-w-0 truncate text-sm font-semibold text-foreground/92`,children:rn(q.currentTitle,Jn?.channelName)}),q.currentToolProject?.name||Me?.isGitRepository&&Me.branch?(0,G.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-xs leading-none text-muted-foreground sm:hidden`,children:[q.currentToolProject?.name?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-0 items-center gap-1`,title:q.currentToolProject.name,children:[(0,G.jsx)(T,{className:`size-3 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:q.currentToolProject.name})]}):null,Me?.isGitRepository&&Me.branch?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-0 items-center gap-1`,title:Me.branch,children:[(0,G.jsx)(de,{className:`size-3 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:Me.branch})]}):null]}):null]}),!r&&q.currentToolProject?.name?(0,G.jsxs)(`div`,{className:`hidden h-9 max-w-[220px] shrink-0 items-center gap-2 rounded-full bg-muted/55 px-3 text-sm text-foreground/88 md:inline-flex`,title:q.currentToolProject.name,children:[(0,G.jsx)(T,{className:`size-4 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:q.currentToolProject.name})]}):null,!r&&q.currentToolProject?.id&&Me?.isGitRepository&&Me.branch?(0,G.jsxs)(`div`,{className:`relative hidden shrink-0 md:block`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex h-9 max-w-[220px] items-center gap-2 rounded-full bg-muted/55 px-3 text-sm text-foreground/88 transition-colors hover:bg-muted`,onClick:()=>Le(e=>!e),"aria-label":H(`gitBranchMenu`),"aria-expanded":Ie,children:[(0,G.jsx)(de,{className:`size-4 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:Me.branch}),(0,G.jsx)(b,{className:`size-4 text-muted-foreground`})]}),Ie?(0,G.jsx)(iu,{projectId:q.currentToolProject.id,currentBranch:Me.branch,dirtyCount:Me.counts?.total??0,onCheckout:ln,onCreated:dn,onOpenGraph:()=>{Le(!1),Ue(!0)},onOpenChanges:()=>{Le(!1),sn()}}):null]}):null,(0,G.jsxs)(`div`,{className:`relative shrink-0`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(K,{variant:`ghost`,size:`icon`,className:W(I.conversationMenuOpen&&`bg-muted/45 text-foreground/90`),onClick:()=>I.setConversationMenuOpen(e=>!e),disabled:!q.currentSessionId||z,"aria-label":H(`moreOptions`),"aria-haspopup":`menu`,"aria-expanded":I.conversationMenuOpen,children:(0,G.jsx)(R,{className:`size-[18px]`})}),I.conversationMenuOpen?(0,G.jsxs)(`div`,{className:W(`fixed inset-x-2 top-14 z-40 max-h-[calc(100dvh-4rem)] overflow-y-auto overscroll-contain rounded-lg border border-border bg-popover p-1 shadow-quickforge md:absolute md:inset-x-auto md:left-0 md:top-full md:z-30 md:mt-1 md:min-w-44 md:max-h-none md:overflow-visible`,r&&`md:fixed md:inset-x-2 md:left-auto md:top-14 md:z-40 md:mt-0 md:max-h-[calc(100dvh-4rem)] md:min-w-0 md:overflow-y-auto lg:inset-x-2 lg:left-auto lg:top-14`),role:`menu`,"aria-label":H(`moreOptions`),children:[(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex h-10 w-full items-center gap-2 whitespace-nowrap rounded-md px-2 text-left text-sm text-foreground/86 transition-colors hover:bg-muted`,onClick:cr,children:[Yn?(0,G.jsx)(he,{className:`size-[18px]`}):(0,G.jsx)(n,{className:`size-[18px]`}),(0,G.jsx)(`span`,{children:H(Yn?`unpinSession`:`pinSession`)})]}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex h-10 w-full items-center gap-2 whitespace-nowrap rounded-md px-2 text-left text-sm text-foreground/86 transition-colors hover:bg-muted`,onClick:lr,children:[(0,G.jsx)(x,{className:`size-[18px]`}),(0,G.jsx)(`span`,{children:H(`renameSession`)})]}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex h-10 w-full items-center gap-2 whitespace-nowrap rounded-md px-2 text-left text-sm text-foreground/86 transition-colors hover:bg-muted`,onClick:fr,children:[(0,G.jsx)(te,{className:`size-[18px]`}),(0,G.jsx)(`span`,{children:H(`shareSession`)})]}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex h-10 w-full items-center gap-2 whitespace-nowrap rounded-md px-2 text-left text-sm text-foreground/86 transition-colors hover:bg-muted`,onClick:mr,children:[(0,G.jsx)(v,{className:`size-[18px]`}),(0,G.jsx)(`span`,{children:H(`archiveSession`)})]})]}):null]})]})})]}),(0,G.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[rt?(0,G.jsx)(`div`,{className:W(`quickforge-session-loading-overlay`,!q.loadingSessionId&&`quickforge-session-loading-overlay-exit`),role:`status`,"aria-live":`polite`,"aria-label":H(`loadingConversation`),children:(0,G.jsxs)(`div`,{className:`quickforge-session-loading-indicator`,children:[(0,G.jsx)(t,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{children:H(`loadingConversation`)})]})}):null,z?(0,G.jsx)(dr,{onAddModel:Bn,onUseExample:()=>{Un().catch(e=>B.error(`Failed to use LiteLLM example:`,e))}}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:W(`flex min-h-0 flex-1 flex-col`,nr?`quickforge-empty-chat`:void 0,!q.loadingSessionId&&rt&&`quickforge-conversation-enter`),children:[nr?(0,G.jsx)(`div`,{className:`quickforge-empty-chat-hero`,"aria-hidden":`true`,children:(0,G.jsx)(`h1`,{className:`quickforge-empty-chat-title`,children:H(`newChatEmptyTitle`)})}):null,(0,G.jsx)(Nt,{children:(0,G.jsx)(V.Suspense,{fallback:(0,G.jsx)(wd,{}),children:(0,G.jsx)(ld,{agent:q.agent,onModelSelect:Wn,revision:q.chatPanelRevision,agentAccessMode:P,workspaceToolsEnabled:!!q.currentToolProject?.id,project:q.currentToolProject,projectId:q.currentToolProject?.id,chatScope:q.chatScope,onAccessModeChange:On,onRollbackFromMessage:Cn,onRetryFromMessage:wn,onCopyAnswer:Tn,onForkFromMessage:En,onApproveToolCall:kn,onRejectToolCall:An,onApproveAutoCompact:jn,onRejectAutoCompact:Mn,onOpenWorkspaceGitChanges:sn,onOpenLocalFilePath:pn,onArtifactsChange:e=>{xe({projectId:q.currentToolProject?.id,sessionId:q.currentSessionId,artifacts:e})},onContextUsageDisplayChange:Kt,disableFork:!1,restoredDraft:oe,onRestoredDraftConsumed:an,newChatEmptyState:nr})})}),nr?(0,G.jsx)(pr,{projects:m,selectedProject:q.chatScope===`project`?q.currentToolProject:void 0,onSelectProject:ir,onClearProject:ar,onNewProject:or}):null]}),sr?(0,G.jsx)(ur,{hasProject:!!q.currentToolProject?.id,onConfigureModel:Bn,onAddProject:E,onCopyExamplePrompt:tr,onDismiss:$n}):null]})]}),me&&!e&&q.currentToolProject?.id?(0,G.jsx)(V.Suspense,{fallback:(0,G.jsx)(wd,{}),children:(0,G.jsx)(fd,{project:q.currentToolProject,pendingCommand:ue,onPendingCommandHandled:Qn,onCollapse:()=>ge(!1)})}):null]}),q.currentToolProject?.id?(0,G.jsxs)(G.Fragment,{children:[I.workspaceInspectorOpen?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`hidden w-px shrink-0 bg-[color-mix(in_oklab,var(--border)_30%,var(--quickforge-sidebar-bg))] lg:block`}):null,(0,G.jsx)(V.Suspense,{fallback:(0,G.jsx)(Td,{}),children:(0,G.jsx)(dd,{project:q.currentToolProject,open:I.workspaceInspectorOpen,onOpenChange:I.setWorkspaceInspectorOpen,onOpenCommitPush:()=>Ve(!0),onOpenProjectInExplorer:e?void 0:wr,onOpenProjectInVSCode:e?void 0:Tr,onOpenProjectInIDEA:e?void 0:Er,onPreviewArtifact:mn,request:I.workspaceInspectorRequest,onRequestHandled:on,artifacts:ye.projectId===q.currentToolProject.id&&ye.sessionId===q.currentSessionId?ye.artifacts:[],globalTerminalOpen:e?!1:me,onShowGlobalTerminal:e?void 0:()=>{L(!1),ge(!0)},onFullscreenChange:ve},q.currentToolProject.id)})]}):null,He&&q.currentToolProject?.id?(0,G.jsx)(_u,{projectId:q.currentToolProject.id,projectName:q.currentToolProject.name,onClose:()=>Ue(!1)}):null,Be?(0,G.jsx)(uu,{open:!0,projectId:q.currentToolProject?.id,status:Me,onClose:()=>Ve(!1),onCheckout:ln,onRefreshStatus:cn,onStatusChange:Ne,onCompleted:fn},q.currentToolProject?.id??`git-commit`):null]}),tt?null:(0,G.jsx)(Ed,{exiting:!0}),(0,G.jsx)(Ft,{open:y,initialPath:p?.path,disabled:_,onOpenChange:D,onSelect:w}),(0,G.jsx)(Ke,{open:!!I.skillsDialog,scope:I.skillsDialog?.scope??`global`,project:I.skillsDialog?.project,onOpenChange:e=>{e||I.setSkillsDialog(void 0)},onSaved:Fr}),(0,G.jsx)(Ou,{open:I.shareDialogOpen,sessionId:q.currentSessionId,title:rn(q.currentTitle),onOpenChange:I.setShareDialogOpen}),(0,G.jsx)(Pl,{toasts:ot,onDismiss:ct,onClick:nn})]}):(0,G.jsx)(Ed,{})}function Md(){if(Ot())return(0,G.jsx)(Vu,{});let e=window.location.pathname.match(/^\/share\/([^/]+)\/?$/)?.[1];return e?(0,G.jsx)(V.Suspense,{fallback:(0,G.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-background text-sm text-muted-foreground`,children:H(`loadingChatWorkspace`)}),children:(0,G.jsx)(ud,{shareId:decodeURIComponent(e)})}):(0,G.jsx)(jd,{})}mt({hideSelector:!0}),gt(),Te.isNativePlatform()&&kt()&&document.documentElement.classList.add(`quickforge-mobile-native`),window.addEventListener(`error`,e=>{B.error(`Uncaught error:`,e.error??e.message)}),window.addEventListener(`unhandledrejection`,e=>{B.error(`Unhandled promise rejection:`,e.reason)}),`serviceWorker`in navigator&&!Te.isNativePlatform()&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).catch(()=>{})}),(0,qe.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(V.StrictMode,{children:(0,G.jsx)(s,{strokeWidth:1.75,children:(0,G.jsx)(Nt,{children:(0,G.jsx)(Md,{})})})}));export{Ts as $,Zc as A,Vt as At,Ac as B,Wl as C,gn as Ct,pl as D,J as Dt,yl as E,Y as Et,Ec as F,ot as Ft,xc as G,Mc as H,Tc as I,H as It,ic as J,Sc as K,Dc as L,Vc as M,W as Mt,Hc as N,U as Nt,fl as O,q as Ot,Wc as P,at as Pt,Ws as Q,Nc as R,Gl as S,Nn as St,Kl as T,rn as Tt,Ic as U,Pc as V,bc as W,Ks as X,Us as Y,Gs as Z,zl as _,un as _t,cd as a,Oo as at,Yl as b,xn as bt,Au as c,si as ct,Iu as d,Rr as dt,Ds as et,Tu as f,lr as ft,Hl as g,Bn as gt,Ul as h,Vn as ht,id as i,fo as it,Qc as j,K as jt,qc as k,Wt as kt,Nu as l,$r as lt,Eu as m,Un as mt,rd as n,Os as nt,ku as o,Xa as ot,Du as p,Hn as pt,ac as q,od as r,bo as rt,Pu as s,$i as st,ad as t,Cs as tt,zu as u,ei as ut,Rl as v,Cn as vt,ql as w,Tn as wt,Jl as x,En as xt,Vl as y,Mn as yt,kc as z};