@xopcai/xopc 0.0.339 → 0.0.341

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 (366) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  3. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  4. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  5. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +2 -2
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/api/api.js +2 -2
  9. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  10. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  11. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cc_FeKSx.js → agent-avatar-dicebear-BLPcg31f.js} +1 -1
  13. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6lTld5j.js +1 -0
  14. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DoC_yH9K.js → agent-plugin-dialog-C4tkmkNX.js} +1 -1
  15. package/dist/gateway/static/root/assets/agents-CfnoU72e.js +70 -0
  16. package/dist/gateway/static/root/assets/{agents-admin-api-C82B1W9Z.js → agents-admin-api-9hEICfl6.js} +1 -1
  17. package/dist/gateway/static/root/assets/{app-management-settings-panel-BquxFv-S.js → app-management-settings-panel-D1t5R8Nw.js} +1 -1
  18. package/dist/gateway/static/root/assets/{appearance-settings-CZYqmnu6.js → appearance-settings-AEXbf39m.js} +1 -1
  19. package/dist/gateway/static/root/assets/{apps-page-jIVrH3te.js → apps-page-BBlltMmy.js} +1 -1
  20. package/dist/gateway/static/root/assets/{archive-plugin-B0vUM0zp.js → archive-plugin-Dn0-Buj5.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-page-B0Y5BNRb.js → automations-page-BSra2qfj.js} +1 -1
  22. package/dist/gateway/static/root/assets/automations-workspace-wN4UZK_t.js +7 -0
  23. package/dist/gateway/static/root/assets/{binary-plugins-NBJu1CLg.js → binary-plugins-Dot1Il-Y.js} +1 -1
  24. package/dist/gateway/static/root/assets/{block-editor-TXHouZOO.js → block-editor-CDcC8LCq.js} +3 -3
  25. package/dist/gateway/static/root/assets/{browser-automation-inputs-CLOq1KtH.js → browser-automation-inputs-cnvnVaXG.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-automations-page-BqMknmu3.js → browser-automations-page-CAUS0Ri8.js} +2 -2
  27. package/dist/gateway/static/root/assets/{browser-settings-page-GRFXQqKe.js → browser-settings-page-DXgm5Ckn.js} +2 -2
  28. package/dist/gateway/static/root/assets/{capabilities-BfHgt4uk.js → capabilities-CE5NAPxj.js} +1 -1
  29. package/dist/gateway/static/root/assets/{capabilities-page-DmJDCbYN.js → capabilities-page-CADE2fFw.js} +2 -2
  30. package/dist/gateway/static/root/assets/capabilities-settings-panel-BVA9R5lZ.js +8 -0
  31. package/dist/gateway/static/root/assets/{capability-header-actions-BF9_u3xd.js → capability-header-actions-BJNo9stz.js} +1 -1
  32. package/dist/gateway/static/root/assets/{channels-BG-1mvQi.js → channels-Do21a722.js} +1 -1
  33. package/dist/gateway/static/root/assets/{chat-terminal-dock-DYysZFAt.js → chat-terminal-dock-kdmj_0as.js} +1 -1
  34. package/dist/gateway/static/root/assets/computer-settings-page-0eV1PD7w.js +1 -0
  35. package/dist/gateway/static/root/assets/{connector-service-page-BWkcwg_D.js → connector-service-page-CfoHye-I.js} +1 -1
  36. package/dist/gateway/static/root/assets/connectors-page-Db1Y7qF-.js +2 -0
  37. package/dist/gateway/static/root/assets/{date-picker-Di84qsYg.js → date-picker-Cos4-ejW.js} +1 -1
  38. package/dist/gateway/static/root/assets/{dependency-picker-BfxDCpmT.js → dependency-picker-BPwj_jHy.js} +1 -1
  39. package/dist/gateway/static/root/assets/{desktop-pet-BRTL_oOb.js → desktop-pet-DEuqqeV7.js} +1 -1
  40. package/dist/gateway/static/root/assets/{desktop-pet-settings-BNVH1m1M.js → desktop-pet-settings-CjBMcLuI.js} +1 -1
  41. package/dist/gateway/static/root/assets/device-pairing-wizard-BsqwXeyv.js +1 -0
  42. package/dist/gateway/static/root/assets/{directory-picker-path-field-BpuRd-vD.js → directory-picker-path-field-CcGJupzB.js} +1 -1
  43. package/dist/gateway/static/root/assets/{extension-debug-page-mQPbBDJQ.js → extension-debug-page-BK0gkhEA.js} +1 -1
  44. package/dist/gateway/static/root/assets/{extension-page-BHSB_YFM.js → extension-page-BjfzKvd3.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-settings-page-IoBTZ9jq.js → extension-settings-page-xqe5mUAc.js} +1 -1
  46. package/dist/gateway/static/root/assets/{gateway-config-swr-Hn1vj6uI.js → gateway-config-swr-BdBCP9uF.js} +1 -1
  47. package/dist/gateway/static/root/assets/{gateway-realtime-vOLum3RR.js → gateway-realtime-MiR9DJIf.js} +1 -1
  48. package/dist/gateway/static/root/assets/gateway-realtime-store-Cj-byMay.js +1 -0
  49. package/dist/gateway/static/root/assets/gateway-settings-C07o7J3o.js +1 -0
  50. package/dist/gateway/static/root/assets/{gateway-startup-retry-CtTVgB7_.js → gateway-startup-retry-B8XTENLw.js} +1 -1
  51. package/dist/gateway/static/root/assets/home-page-a92Q8Na2.js +1 -0
  52. package/dist/gateway/static/root/assets/{image-generation-api-DBA-bdEM.js → image-generation-api-DufKsb8h.js} +1 -1
  53. package/dist/gateway/static/root/assets/{imports-page-DLJp26Cn.js → imports-page-BMiS5gUB.js} +1 -1
  54. package/dist/gateway/static/root/assets/index-CJRGgrw3.js +106 -0
  55. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-YnkILLU1.js → keyboard-shortcuts-settings-BTOmULWn.js} +1 -1
  56. package/dist/gateway/static/root/assets/{local-app-workbench-page-C4d2T20s.js → local-app-workbench-page-EwMSmvUp.js} +1 -1
  57. package/dist/gateway/static/root/assets/{local-apps-page-DfOhJ8iP.js → local-apps-page-gicbE8bt.js} +1 -1
  58. package/dist/gateway/static/root/assets/{local-session-drafts-Byxxogdc.js → local-session-drafts-Bwxng2U0.js} +1 -1
  59. package/dist/gateway/static/root/assets/{locale-store-7F4l6DRV.js → locale-store-GbEE8D1I.js} +1 -1
  60. package/dist/gateway/static/root/assets/{logs-page-Ds6pm2I7.js → logs-page-BBxTvrXn.js} +2 -2
  61. package/dist/gateway/static/root/assets/{management-settings-D0kBRnl2.js → management-settings-CcEPCLdK.js} +1 -1
  62. package/dist/gateway/static/root/assets/{markdown-view-bxpOryax.js → markdown-view-DtEVIWB3.js} +1 -1
  63. package/dist/gateway/static/root/assets/{media-plugins-vBKV9GvC.js → media-plugins-1hJztT1f.js} +1 -1
  64. package/dist/gateway/static/root/assets/{messages-DsUnS7rn.js → messages-DvcSrOiI.js} +2 -2
  65. package/dist/gateway/static/root/assets/note-detail-panel-LcJBf6gK.js +5 -0
  66. package/dist/gateway/static/root/assets/notes-page-BaTCRZLb.js +8 -0
  67. package/dist/gateway/static/root/assets/{page-context-capture-button-DvMerCk-.js → page-context-capture-button-yJUYnJxT.js} +1 -1
  68. package/dist/gateway/static/root/assets/{page-tabs-Bp0yPTYw.js → page-tabs-BM7TwlkM.js} +1 -1
  69. package/dist/gateway/static/root/assets/{preview-open-alternatives-CQO4X4dH.js → preview-open-alternatives-C8ewCNje.js} +1 -1
  70. package/dist/gateway/static/root/assets/{product-open-page-BQ4vLqay.js → product-open-page-CRx7HKvw.js} +1 -1
  71. package/dist/gateway/static/root/assets/project-detail-page-CSh8kKw8.js +1 -0
  72. package/dist/gateway/static/root/assets/{projects-page-EvaT-KoY.js → projects-page-DYwOgWaC.js} +1 -1
  73. package/dist/gateway/static/root/assets/{registry-api-DU915Prn.js → registry-api-DTHBAr2T.js} +1 -1
  74. package/dist/gateway/static/root/assets/remote-access-hub-B8ApF5IX.js +1 -0
  75. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-POD_UkI6.js → runtime-tools-settings-panel-DOB15s5m.js} +1 -1
  76. package/dist/gateway/static/root/assets/scenes-page-DqhxjqAy.js +2 -0
  77. package/dist/gateway/static/root/assets/{schema-form-DDjuoH6S.js → schema-form-DchPlBrp.js} +1 -1
  78. package/dist/gateway/static/root/assets/{session-api-C7i3UFhq.js → session-api-Bb2zLVED.js} +1 -1
  79. package/dist/gateway/static/root/assets/{session-manager-g96pFnRm.js → session-manager-9M-yBtb4.js} +1 -1
  80. package/dist/gateway/static/root/assets/sessions-page-BcnoQbIP.js +1 -0
  81. package/dist/gateway/static/root/assets/settings-advanced-gate-Cedcl54F.js +1 -0
  82. package/dist/gateway/static/root/assets/{settings-form-section-DziWi7ar.js → settings-form-section-UlkZDGLU.js} +1 -1
  83. package/dist/gateway/static/root/assets/{settings-page-DieZ7WKk.js → settings-page-PYnr6mlX.js} +1 -1
  84. package/dist/gateway/static/root/assets/setup-status-panel-xp2jQuPa.js +1 -0
  85. package/dist/gateway/static/root/assets/{share-preview-page-CKuGdvQ1.js → share-preview-page-B0jqVHIE.js} +1 -1
  86. package/dist/gateway/static/root/assets/shares-settings-BnRfPQfC.js +1 -0
  87. package/dist/gateway/static/root/assets/{skill-api-CEaxaT32.js → skill-api-DgwnV477.js} +1 -1
  88. package/dist/gateway/static/root/assets/skill-reload-api-zai_s2F8.js +1 -0
  89. package/dist/gateway/static/root/assets/{skills-page-C4z5rpJp.js → skills-page-BYAE6Al2.js} +1 -1
  90. package/dist/gateway/static/root/assets/{system-settings-panel-DqFk7NdF.js → system-settings-panel-eEK7Mm70.js} +1 -1
  91. package/dist/gateway/static/root/assets/{task-detail-page-BIA_56uP.js → task-detail-page-BK82L-MC.js} +1 -1
  92. package/dist/gateway/static/root/assets/{tunnel-api-mpYTR5df.js → tunnel-api-Cty9Iw8k.js} +1 -1
  93. package/dist/gateway/static/root/assets/{usage-page-CBew7QUj.js → usage-page-C3ZO6KNv.js} +1 -1
  94. package/dist/gateway/static/root/assets/{use-autosave-CujxcROb.js → use-autosave-EEUVQbRp.js} +1 -1
  95. package/dist/gateway/static/root/assets/user-model-page-CT_RNLbB.js +2 -0
  96. package/dist/gateway/static/root/assets/{voice-api-key-field-BAewnwoh.js → voice-api-key-field-DTmACeYO.js} +1 -1
  97. package/dist/gateway/static/root/assets/{voice-config-api-LKFent6f.js → voice-config-api-DIBe0AZN.js} +1 -1
  98. package/dist/gateway/static/root/assets/{work-discovery-overlay-Bgtzc3ng.js → work-discovery-overlay-C9guuKGB.js} +1 -1
  99. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-ONIY4un8.js → workflow-run-setup-panel-BjGFnWIF.js} +2 -2
  100. package/dist/gateway/static/root/assets/workflows-page-B1uzFMKj.js +6 -0
  101. package/dist/gateway/static/root/index.html +14 -14
  102. package/dist/package.js +1 -1
  103. package/dist/src/agent/agent-manager.js +12 -12
  104. package/dist/src/agent/agent-scope.js +2 -2
  105. package/dist/src/agent/background-review/prompts.js +1 -1
  106. package/dist/src/agent/background-review/run-background-review.js +2 -2
  107. package/dist/src/agent/coding/repository-instructions.js +1 -1
  108. package/dist/src/agent/context/coordinator.js +2 -2
  109. package/dist/src/agent/context/execution-context.js +4 -4
  110. package/dist/src/agent/context/execution-scope.js +2 -2
  111. package/dist/src/agent/context/project-context.js +3 -3
  112. package/dist/src/agent/data-acquisition/service.js +1 -1
  113. package/dist/src/agent/embedded/current-turn-images.d.ts +4 -0
  114. package/dist/src/agent/embedded/current-turn-images.js +22 -0
  115. package/dist/src/agent/embedded/index.js +2 -2
  116. package/dist/src/agent/embedded/run-for-session.js +3 -3
  117. package/dist/src/agent/embedded/run-turn.js +19 -7
  118. package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
  119. package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
  120. package/dist/src/agent/external-tools/cliProvider.js +3 -3
  121. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  122. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  123. package/dist/src/agent/external-tools/mcp-provider.js +3 -3
  124. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  125. package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
  126. package/dist/src/agent/image/generation/providers/fal.js +1 -1
  127. package/dist/src/agent/image/generation/providers/google.js +1 -1
  128. package/dist/src/agent/image/generation/runtime.js +1 -1
  129. package/dist/src/agent/image/index.js +1 -1
  130. package/dist/src/agent/image/load-image-media.js +1 -1
  131. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  132. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  133. package/dist/src/agent/index.js +1 -1
  134. package/dist/src/agent/mcp/bundle-mcp-config.js +1 -1
  135. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
  136. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  137. package/dist/src/agent/mcp/index.js +2 -2
  138. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  139. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  140. package/dist/src/agent/mcp/plugin-http-fetch.js +1 -1
  141. package/dist/src/agent/memory/context-recovery.js +1 -1
  142. package/dist/src/agent/memory/index.js +1 -1
  143. package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
  144. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  145. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  146. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  147. package/dist/src/agent/service/direct-turn-helpers.js +4 -4
  148. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  149. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  150. package/dist/src/agent/service/webchat-tts.js +2 -2
  151. package/dist/src/agent/service.js +18 -18
  152. package/dist/src/agent/source-context/index.js +2 -2
  153. package/dist/src/agent/tasks/task-judge-service.js +2 -2
  154. package/dist/src/agent/tools/create-share-tool.js +3 -3
  155. package/dist/src/agent/tools/dataBatch.js +1 -1
  156. package/dist/src/agent/tools/delegate-tool.js +3 -3
  157. package/dist/src/agent/tools/delegation-parent-policy.js +1 -1
  158. package/dist/src/agent/tools/executor.js +1 -1
  159. package/dist/src/agent/tools/factory.js +16 -16
  160. package/dist/src/agent/tools/fetch-text.js +1 -1
  161. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  162. package/dist/src/agent/tools/index.js +6 -6
  163. package/dist/src/agent/tools/list-dir.js +1 -1
  164. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  165. package/dist/src/agent/tools/read.js +2 -2
  166. package/dist/src/agent/tools/review-workspace.js +1 -1
  167. package/dist/src/agent/tools/send-media.js +2 -2
  168. package/dist/src/agent/tools/skills-tools.js +1 -1
  169. package/dist/src/agent/tools/tts-tool.js +1 -1
  170. package/dist/src/agent/tools/user-context-tool.js +1 -1
  171. package/dist/src/agent/tools/write.js +2 -2
  172. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  173. package/dist/src/automations/domain/index.js +2 -2
  174. package/dist/src/automations/index.js +4 -4
  175. package/dist/src/automations/service/automation-service.js +2 -2
  176. package/dist/src/browser/native-messaging-host.js +1 -1
  177. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  178. package/dist/src/channels/index.js +2 -2
  179. package/dist/src/channels/outbound-sender.js +1 -1
  180. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  181. package/dist/src/channels/pairing/pairing-store.js +6 -6
  182. package/dist/src/chat-commands/builtins/config.js +3 -3
  183. package/dist/src/chat-commands/builtins/review.js +1 -1
  184. package/dist/src/chat-commands/builtins/session.js +1 -1
  185. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  186. package/dist/src/chat-commands/builtins/tts.js +1 -1
  187. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  188. package/dist/src/chat-commands/builtins/workflow.js +2 -2
  189. package/dist/src/chat-commands/context.js +3 -3
  190. package/dist/src/chat-commands/index.js +3 -3
  191. package/dist/src/cli/commands/agent.js +6 -6
  192. package/dist/src/cli/commands/config.js +1 -1
  193. package/dist/src/cli/commands/connectors.js +1 -1
  194. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  195. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  196. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  197. package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
  198. package/dist/src/cli/commands/extension-dev.js +1 -1
  199. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  200. package/dist/src/cli/commands/extension.js +4 -4
  201. package/dist/src/cli/commands/gateway/shared.js +1 -1
  202. package/dist/src/cli/commands/gateway/token.js +1 -1
  203. package/dist/src/cli/commands/image.js +1 -1
  204. package/dist/src/cli/commands/init.js +1 -1
  205. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  206. package/dist/src/cli/commands/onboard.js +1 -1
  207. package/dist/src/cli/commands/project.js +2 -2
  208. package/dist/src/cli/commands/runtime.js +1 -1
  209. package/dist/src/cli/commands/skills.js +2 -2
  210. package/dist/src/cli/commands/tunnel.js +4 -4
  211. package/dist/src/cli/extension-cli-register.js +4 -4
  212. package/dist/src/cli/utils/gateway-client.js +1 -1
  213. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  214. package/dist/src/cli/utils/session.js +1 -1
  215. package/dist/src/computer/runtime.js +1 -1
  216. package/dist/src/config/index.js +3 -3
  217. package/dist/src/config/loader.js +1 -1
  218. package/dist/src/connectors/cli/authorization.js +1 -1
  219. package/dist/src/connectors/cli/runtime.js +1 -1
  220. package/dist/src/connectors/composio-sessions.js +1 -1
  221. package/dist/src/connectors/composio.js +1 -1
  222. package/dist/src/connectors/connected-source-understanding.js +3 -3
  223. package/dist/src/connectors/connection-recovery-service.js +5 -5
  224. package/dist/src/connectors/health.js +1 -1
  225. package/dist/src/connectors/plugin-mcp-recovery.js +1 -1
  226. package/dist/src/discussions/live-worker.js +1 -1
  227. package/dist/src/discussions/recording.js +1 -1
  228. package/dist/src/discussions/sealer.js +1 -1
  229. package/dist/src/extensions/activation-context.js +3 -3
  230. package/dist/src/extensions/api.js +4 -4
  231. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  232. package/dist/src/extensions/index.js +3 -3
  233. package/dist/src/extensions/install.js +1 -1
  234. package/dist/src/extensions/loader.js +2 -2
  235. package/dist/src/extensions/sdk/index.js +1 -1
  236. package/dist/src/extensions/sdk/media.js +1 -1
  237. package/dist/src/extensions/update.js +1 -1
  238. package/dist/src/gateway/agents-admin.js +1 -1
  239. package/dist/src/gateway/device-routes.js +2 -2
  240. package/dist/src/gateway/file-path-classifier.js +1 -1
  241. package/dist/src/gateway/global-defaults-admin.js +1 -1
  242. package/dist/src/gateway/hono/app.js +3 -3
  243. package/dist/src/gateway/hono/lib/config-payload.js +3 -3
  244. package/dist/src/gateway/hono/routes/agents.js +1 -1
  245. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  246. package/dist/src/gateway/hono/routes/browser.js +1 -1
  247. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  248. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  249. package/dist/src/gateway/hono/routes/home.js +1 -1
  250. package/dist/src/gateway/hono/routes/mcp.js +2 -2
  251. package/dist/src/gateway/hono/routes/media.js +1 -1
  252. package/dist/src/gateway/hono/routes/models.js +4 -4
  253. package/dist/src/gateway/hono/routes/notes.js +1 -1
  254. package/dist/src/gateway/hono/routes/projects.js +2 -2
  255. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  256. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  257. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  258. package/dist/src/gateway/hono/routes/shares.js +3 -3
  259. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  260. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  261. package/dist/src/gateway/hono/routes/user-model.js +5 -5
  262. package/dist/src/gateway/hono/routes/voice.js +6 -6
  263. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  264. package/dist/src/gateway/image-generation-setup.js +1 -1
  265. package/dist/src/gateway/index.js +1 -1
  266. package/dist/src/gateway/lock.js +11 -11
  267. package/dist/src/gateway/media-access.js +1 -1
  268. package/dist/src/gateway/mobile-privacy.js +2 -2
  269. package/dist/src/gateway/ports.js +6 -6
  270. package/dist/src/gateway/run-loop.js +1 -1
  271. package/dist/src/gateway/scenes/mailContext.js +1 -1
  272. package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
  273. package/dist/src/gateway/server.js +1 -1
  274. package/dist/src/gateway/service/config-coordinator.js +3 -3
  275. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  276. package/dist/src/gateway/service/session-input-coordinator.js +2 -2
  277. package/dist/src/gateway/service/sessions-api.js +1 -1
  278. package/dist/src/gateway/service.js +34 -34
  279. package/dist/src/gateway/session-context-summary.js +1 -1
  280. package/dist/src/gateway/workspace-editor-path.js +2 -2
  281. package/dist/src/infra/gateway-processes.js +2 -2
  282. package/dist/src/infra/path-env.js +3 -3
  283. package/dist/src/infra/update-global.js +10 -10
  284. package/dist/src/local-apps/service.js +1 -1
  285. package/dist/src/mcp/gateway-http-client.js +1 -1
  286. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  287. package/dist/src/notes/agent-context.js +4 -4
  288. package/dist/src/notes/index.js +1 -1
  289. package/dist/src/notes/store.js +1 -1
  290. package/dist/src/providers/model-reference-auditor.js +1 -1
  291. package/dist/src/remote-access/exposure-manager.js +1 -1
  292. package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
  293. package/dist/src/scenes/taskFollowUp/resources.js +1 -1
  294. package/dist/src/scenes/taskFollowUp/service.js +4 -4
  295. package/dist/src/session/index.js +2 -2
  296. package/dist/src/session/session-title.js +1 -1
  297. package/dist/src/session/store.js +4 -4
  298. package/dist/src/session/thinking-resolve.js +1 -1
  299. package/dist/src/share/share-store.js +1 -1
  300. package/dist/src/share/share-thumbnail.js +1 -1
  301. package/dist/src/share/site-proxy.js +1 -1
  302. package/dist/src/share/site-share-store.js +1 -1
  303. package/dist/src/storage/sqlite/connection.js +9 -9
  304. package/dist/src/tasks/capabilities/read.js +2 -2
  305. package/dist/src/tasks/capabilities/write.js +1 -1
  306. package/dist/src/tasks/execution-context.js +1 -1
  307. package/dist/src/tasks/home-query-service.js +3 -3
  308. package/dist/src/tasks/index.js +4 -4
  309. package/dist/src/tasks/task-application-service.js +1 -1
  310. package/dist/src/tasks/task-context-assembler.js +1 -1
  311. package/dist/src/tasks/task-handoff-service.js +1 -1
  312. package/dist/src/tui/backends/embedded-backend.js +9 -9
  313. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  314. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  315. package/dist/src/tui/tui-command-formatters.js +1 -1
  316. package/dist/src/tui/tui-commands.js +5 -5
  317. package/dist/src/tui/tui-picker-overlay.js +1 -1
  318. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  319. package/dist/src/tui/tui-startup-resources.js +4 -4
  320. package/dist/src/tui/tui.js +5 -5
  321. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  322. package/dist/src/voice/realtime/memory-context.js +3 -3
  323. package/dist/src/voice/realtime/omniEngine.js +8 -6
  324. package/dist/src/voice/realtime/runtime.js +3 -3
  325. package/dist/src/voice/stt/index.js +2 -2
  326. package/dist/src/voice/stt/preflight.js +1 -1
  327. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  328. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  329. package/dist/src/voice/stt/transcribe-core.js +1 -1
  330. package/dist/src/voice/tts/index.js +3 -3
  331. package/dist/src/voice/tts/merge-config.js +1 -1
  332. package/dist/src/voice/tts/payload.js +1 -1
  333. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  334. package/dist/src/voice/tts/speak-core.js +1 -1
  335. package/dist/src/work-discovery/incremental-repository.js +1 -1
  336. package/dist/src/work-discovery/index.js +1 -1
  337. package/dist/src/work-discovery/service.js +3 -3
  338. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  339. package/dist/src/workflows/service/workflow-run-service.js +7 -7
  340. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  341. package/package.json +5 -5
  342. package/skills/THIRD_PARTY_NOTICES.md +6 -0
  343. package/skills/engineering/design-recurring-work/SKILL.md +75 -0
  344. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-s5yXNGQE.js +0 -1
  345. package/dist/gateway/static/root/assets/agents-HRZFsjeH.js +0 -70
  346. package/dist/gateway/static/root/assets/automations-workspace-8OSlJ6lL.js +0 -7
  347. package/dist/gateway/static/root/assets/capabilities-settings-panel-D8kedO-n.js +0 -8
  348. package/dist/gateway/static/root/assets/computer-settings-page-DI3Ek853.js +0 -1
  349. package/dist/gateway/static/root/assets/connectors-page-DBTyibaI.js +0 -2
  350. package/dist/gateway/static/root/assets/device-pairing-wizard-C3S9vWJ1.js +0 -1
  351. package/dist/gateway/static/root/assets/gateway-realtime-store-DytaaEu8.js +0 -1
  352. package/dist/gateway/static/root/assets/gateway-settings-9HNthvnR.js +0 -1
  353. package/dist/gateway/static/root/assets/home-page-B_NubC1h.js +0 -1
  354. package/dist/gateway/static/root/assets/index-CdvabjRm.js +0 -106
  355. package/dist/gateway/static/root/assets/note-detail-panel-CSdLXt8V.js +0 -5
  356. package/dist/gateway/static/root/assets/notes-page-CIQEybLR.js +0 -8
  357. package/dist/gateway/static/root/assets/project-detail-page-DGRQilZq.js +0 -1
  358. package/dist/gateway/static/root/assets/remote-access-hub-D6EmYuZ9.js +0 -1
  359. package/dist/gateway/static/root/assets/scenes-page-gpgblOWJ.js +0 -2
  360. package/dist/gateway/static/root/assets/sessions-page-D7QQpt4W.js +0 -1
  361. package/dist/gateway/static/root/assets/settings-advanced-gate-CPyqCG90.js +0 -1
  362. package/dist/gateway/static/root/assets/setup-status-panel-aGTS3JX2.js +0 -1
  363. package/dist/gateway/static/root/assets/shares-settings-B2oqZsDF.js +0 -1
  364. package/dist/gateway/static/root/assets/skill-reload-api-BAzfIHkQ.js +0 -1
  365. package/dist/gateway/static/root/assets/user-model-page-DhMojGHW.js +0 -2
  366. package/dist/gateway/static/root/assets/workflows-page-DcVuZjq_.js +0 -6
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u,t as d}from"./popover-select-0p9PIHRy.js";import{t as f}from"./circle-check-C23XjkUj.js";import{t as p}from"./copy-Dv6d4Dvw.js";import{t as m}from"./download-Dk-ZjtO6.js";import{t as h}from"./external-link-DjqjBmc3.js";import{f as g,m as _,t as v}from"./markdown-view-bxpOryax.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{t as b}from"./message-square-plus-XP0tGdlV.js";import{t as x}from"./plus-Q2yW6OE7.js";import{t as S}from"./search-DA7gz22f.js";import{t as C}from"./x-B_N4OPjy.js";import{t as w}from"./messages-DsUnS7rn.js";import{t as T}from"./cn-JdwAhgNB.js";import{a as E,c as D,f as O,n as k,r as A}from"./locale-store-7F4l6DRV.js";import{a as j,i as M,n as N,o as P,r as F,s as I,t as L}from"./dist-BGTk37IG.js";import{i as R,t as z}from"./tasks-QQJXsiER.js";import{t as B}from"./copy-to-clipboard-HOJ79TWv.js";import{i as V}from"./vendor-swr-BIWyz7Rc.js";import{t as H}from"./button-CS04eWY9.js";import{a as U}from"./attachment-utils-core-BIOUBrpT.js";import{o as ee}from"./agents-admin-api-C82B1W9Z.js";import{a as W,i as G,n as K,o as te,r as ne}from"./dist-io9jFpN72.js";import{t as q}from"./skeleton-BwbyijEw.js";import{$c as J,$l as re,$u as ie,Ai as ae,Ba as oe,Bc as se,Bl as ce,Bn as le,Dc as ue,Dl as Y,Eu as de,Fc as fe,Fn as pe,Fu as me,Ga as he,Gn as ge,Gu as _e,Ha as ve,Hl as ye,Ho as be,Ia as xe,Ii as Se,In as Ce,Is as we,Iu as Te,Ja as Ee,Js as De,Ka as Oe,La as ke,Ln as Ae,Lu as je,Ma as Me,Ml as Ne,Nc as Pe,Ni as Fe,Nr as Ie,Ns as Le,Oc as Re,Pn as ze,Po as Be,Pr as Ve,Ps as He,Pu as Ue,Qa as We,Qc as Ge,Ql as Ke,Qs as qe,Ra as Je,Rc as Ye,Rn as Xe,Ta as Ze,Ua as Qe,Ui as $e,Ul as et,Un as tt,Va as nt,Vc as rt,Vi as it,Wa as at,Wl as ot,Xa as st,Xc as ct,Xl as lt,Xt as ut,Xu as dt,Ya as ft,Ys as pt,Za as mt,_a as ht,_o as gt,ba as _t,bc as vt,bl as yt,bn as bt,ed as xt,er as St,fa as Ct,ga as wt,gu as Tt,ha as Et,il as Dt,ir as Ot,ja as kt,jl as At,ju as jt,ka as Mt,la as Nt,lc as Pt,li as Ft,ma as It,nc as Lt,nd as Rt,nl as zt,nr as Bt,nu as Vt,pa as Ht,pc as Ut,pl as Wt,pr as Gt,qa as Kt,rr as qt,ru as Jt,sc as Yt,tl as Xt,ua as Zt,ur as Qt,uu as $t,va as en,wc as tn,xa as nn,xc as rn,xu as an,ya as on,yi as sn,za as cn,zn as ln,zs as un,zu as dn}from"./index-CdvabjRm.js";import{t as fn}from"./page-tabs-Bp0yPTYw.js";import{n as pn,t as mn}from"./use-autosave-CujxcROb.js";import{t as hn}from"./page-context-capture-button-DvMerCk-.js";import{t as gn}from"./directory-picker-path-field-BpuRd-vD.js";import{d as _n,h as vn,o as yn}from"./skill-api-CEaxaT32.js";import{t as bn}from"./date-picker-Di84qsYg.js";import{t as xn}from"./automations-workspace-8OSlJ6lL.js";import{i as Sn,n as Cn,r as wn,t as Tn}from"./note-detail-panel-CSdLXt8V.js";import{t as En}from"./dependency-picker-BfxDCpmT.js";import{c as Dn,l as On,n as kn,o as An,r as jn,t as X}from"./style-TIDOdKy0.js";var Mn=n(),Z=e(t(),1),Q=r();function Nn(e){let t=(0,Mn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Z.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ve(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=T(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(ye,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Q.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=T(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,Q.jsx)(Gt,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Pn(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function Fn(e){let t=(0,Mn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Ie(),f=Ie(Ln),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=T(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let E=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=T(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,Q.jsx)(y,{className:`size-3.5 animate-spin`}):m?(0,Q.jsx)(Xt,{className:`size-3.5`}):(0,Q.jsx)(ct,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,Q.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${v}%`,M;t[23]===j?M=t[24]:(M=(0,Q.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==_||t[26]!==p||t[27]!==g?(N=Pn(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==w||t[36]!==A?(I=(0,Q.jsxs)(`div`,{className:w,onClick:In,children:[A,F]}),t[34]=F,t[35]=w,t[36]=A,t[37]=I):I=t[37],I}function In(e){return e.stopPropagation()}function Ln(e){return e.toggle}function $(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Rn(e){let t=(0,Mn.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=$(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Z.useState)(Gn),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=Sn(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=T(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,Q.jsx)(Nn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Q.jsx)(Fn,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,Q.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let E=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=T(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let O;t[25]!==f||t[26]!==D?(O=(0,Q.jsx)(`p`,{className:D,children:f}),t[25]=f,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==w||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,O]}),t[28]=w,t[29]=O,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)($t,{className:`size-4`}),t[31]=A):A=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:Wn,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:A})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(Hn)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,Q.jsx)(Ge,{className:`size-4`}):(0,Q.jsx)(J,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,Q.jsxs)(Ce,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Vn)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(Rt,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,Q.jsxs)(Ce,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(ln,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Bn)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let V;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(Ut,{className:`size-4`}),t[55]=V):V=t[55];let H;t[56]!==c.delete||t[57]!==B?(H=(0,Q.jsxs)(Ce,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[V,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=H):H=t[58];let U;t[59]!==F||t[60]!==R||t[61]!==H?(U=(0,Q.jsx)(Ae,{children:(0,Q.jsxs)(pe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:Un,children:[F,R,z,H]})}),t[59]=F,t[60]=R,t[61]=H,t[62]=U):U=t[62];let ee;t[63]!==j||t[64]!==U?(ee=(0,Q.jsxs)(Xe,{children:[j,U]}),t[63]=j,t[64]=U,t[65]=ee):ee=t[65];let W;t[66]!==C||t[67]!==k||t[68]!==ee?(W=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,k,ee]}),t[66]=C,t[67]=k,t[68]=ee,t[69]=W):W=t[69];let G;t[70]===n.pinned?G=t[71]:(G=n.pinned&&(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,Q.jsx)(J,{className:`size-3`})}),t[70]=n.pinned,t[71]=G);let K;t[72]===n.tags?K=t[73]:(K=n.tags?.slice(0,2).map(zn),t[72]=n.tags,t[73]=K);let te;t[74]===g?te=t[75]:(te=(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=te);let ne;t[76]!==G||t[77]!==K||t[78]!==te?(ne=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[G,K,te]}),t[76]=G,t[77]=K,t[78]=te,t[79]=ne):ne=t[79];let q;return t[80]!==W||t[81]!==ne||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(q=(0,Q.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,W,ne]}),t[80]=W,t[81]=ne,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=q):q=t[87],q}function zn(e){return(0,Q.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function Bn(){}function Vn(){}function Hn(){}function Un(e){return e.stopPropagation()}function Wn(e){return e.stopPropagation()}function Gn(){return Date.now()}var Kn=3e4;function qn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Jn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(0),[w,E]=(0,Z.useState)(!1),D=(0,Z.useRef)(null),O=(0,Z.useRef)(null),k=(0,Z.useRef)(null),A=(0,Z.useRef)([]),j=(0,Z.useRef)(0),M=(0,Z.useRef)(null),N=(0,Z.useRef)(null),P=(0,Z.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),k.current?.getTracks().forEach(e=>e.stop()),k.current=null,O.current=null,A.current=[],b(!1),C(0)},[]);(0,Z.useEffect)(()=>()=>P(),[P]);let F=(0,Z.useCallback)(async()=>{let e=O.current;if(!e||e.state!==`recording`)return;E(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||qn()||`audio/webm`,r=new Blob(A.current,{type:n});if(P(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{E(!1)}return}E(!1)},[P,c]),I=(0,Z.useCallback)(async()=>{if(!(!c||w||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=qn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);O.current=n,A.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&A.current.push(e.data)},n.start(),b(!0),C(0),M.current=setInterval(()=>{C(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},Kn)}catch{P(),l?.()}}},[P,c,l,y,F,w]),L=(0,Z.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),D.current?.focus()}}},[h,_,o]),R=(0,Z.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||w,B=!!(s||c||p);return(0,Q.jsxs)(`div`,{className:T(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[y?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:w,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,Q.jsx)(tn,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,Q.jsxs)(Xe,{children:[(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,disabled:z,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":n,title:n,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(Ae,{children:(0,Q.jsxs)(pe,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,Q.jsxs)(Ce,{disabled:d,onSelect:s,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,Q.jsxs)(Ce,{disabled:f,onSelect:()=>void I(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(Wt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,Q.jsxs)(Ce,{onSelect:p,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(dt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(S))}):(0,Q.jsx)(`textarea`,{ref:D,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,Q.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:T(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,Q.jsx)(Ye,{className:`size-4`,"aria-hidden":!0})})]})}var Yn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Xn=240,Zn=320,Qn=520,$n=560;function er(e){if(globalThis.localStorage===void 0)return Zn;try{let t=globalThis.localStorage.getItem(e);if(!t)return Zn;let n=Number(t);return Number.isFinite(n)?n:Zn}catch{return Zn}}function tr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var nr={thought:rn,todo:ue,voice:Wt,media:ce,bookmark:_e,mixed:rn,task:ue};function rr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function ir(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function ar(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function or({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=k(e=>e.language),h=w(m).notes,g=!!D(e=>e.conversationId),[_,v]=(0,Z.useReducer)(Ze,Yn),[y,b]=(0,Z.useState)(!1),[E,A]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(0),[B,H]=(0,Z.useState)(()=>er(p)),[U,ee]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(!1),[K,te]=(0,Z.useState)(!1),[ne,q]=(0,Z.useState)(null),[J,re]=(0,Z.useState)(null),ie=(0,Z.useRef)(null),ae=(0,Z.useRef)(null),[oe]=(0,Z.useState)(()=>Date.now()),se=i(),ce=(0,Z.useCallback)(e=>{let t=ie.current?.clientWidth??window.innerWidth,n=Math.max(Xn,t-$n);return Math.max(Xn,Math.min(Math.min(Qn,n),e))},[]),le=(0,Z.useCallback)(e=>{let t=ce(e);H(t),tr(p,t)},[ce,p]);(0,Z.useLayoutEffect)(()=>{H(e=>ce(e))},[ce]);let{data:ue,mutate:Y,isLoading:de}=V((0,Z.useMemo)(()=>g?[`notes-list`,o,_.statusFilter,_.kindFilter,_.pinnedOnly]:null,[g,o,_.statusFilter,_.kindFilter,_.pinnedOnly]),()=>St({status:_.statusFilter===`all`?void 0:_.statusFilter,kind:_.kindFilter===`all`?void 0:_.kindFilter,projectId:o,pinned:_.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),fe=de&&!ue,pe=ue?.items??[],me=ue?.total??0,he=E.trim(),{data:_e,isLoading:ve}=V(g&&y&&he?[`notes-search`,o,he]:null,()=>St({search:he,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),ye=_e?.items??[],be=e?pe.some(t=>t.id===e):!0;(0,Z.useEffect)(()=>{z(0)},[he]),(0,Z.useEffect)(()=>{R>=ye.length&&z(Math.max(0,ye.length-1))},[R,ye.length]),(0,Z.useEffect)(()=>{let e=()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,h.quickCaptureFailedHint,h.refreshFailed]);let xe=gt(e=>e.setPageHeader),Se=gt(e=>e.clearPageHeader),Ce=h.noteCount.replace(`{{count}}`,String(me)),we=!r&&me===0&&c?c:Ce,Te=h.searchDialogTitle,Ee=h.searchClose,De=h.searchClear,Oe=(0,Z.useMemo)(()=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:T(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Be),"aria-label":Te,children:[(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:Te})]}),[Te]);(0,Z.useLayoutEffect)(()=>{if(n)return g?(xe({startExtra:null,main:(0,Q.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-2`,Be),children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??h.title}),Ce?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Ce}):null]}),end:Oe}),()=>Se()):(Se(),()=>Se())},[Se,g,Oe,s,n,h.title,Ce,e,xe]);let ke=(0,Z.useMemo)(()=>({justNow:h.justNow,minutesAgo:h.minutesAgo,today:h.today,yesterday:h.yesterday,daysAgo:h.daysAgo,locale:O(m)}),[m,h.justNow,h.minutesAgo,h.today,h.yesterday,h.daysAgo]),Ae=(0,Z.useMemo)(()=>[{id:`recent`,label:h.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:h.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:h.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:h.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:h.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:h.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:h.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:h.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:h.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[h.filterArchived,h.filterInbox,h.filterProcessed,h.kindBookmark,h.kindMedia,h.kindVoice,h.pinned,h.viewRecent,h.viewTasks]),je=Ae.find(e=>ir(_,e))??Ae[0],Me=s??je.label,Ne=(0,Z.useCallback)(async e=>{q(null);try{let n=o?await tt({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Bt(e,`web`);await Y(),se(ar(t,n.id))}catch(e){throw q(`${h.quickCaptureFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`),e}},[t,Y,h.quickCaptureFailed,h.quickCaptureFailedHint,se,o]),Pe=(0,Z.useCallback)(async()=>{if(!K){te(!0),q(null);try{let e=await tt({markdown:``,kind:`thought`,projectId:o,channel:`web`});v({type:`patch`,patch:Yn}),await Y(),re(e.id),se(ar(t,e.id))}catch(e){q(`${h.createBlankFailed}: ${e instanceof Error?e.message:h.createBlankFailedHint}`)}finally{te(!1)}}},[t,K,Y,h.createBlankFailed,h.createBlankFailedHint,se,o]),Fe=(0,Z.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{q(null),await qt(t,`web`),await Y()}catch(e){q(`${h.imageUploadFailed}: ${e instanceof Error?e.message:h.imageUploadFailedHint}`)}},e.click()},[Y,h.imageUploadFailed,h.imageUploadFailedHint]),Ie=(0,Z.useCallback)(async(e,t)=>{try{q(null),await Ot(e,t,`web`),await Y()}catch(e){q(`${h.voiceUploadFailed}: ${e instanceof Error?e.message:h.voiceUploadFailedHint}`)}},[Y,h.voiceUploadFailed,h.voiceUploadFailedHint]),Le=(0,Z.useCallback)(()=>{q(`${h.voiceCaptureFailed}: ${h.voiceCaptureFailedHint}`)},[h.voiceCaptureFailed,h.voiceCaptureFailedHint]),Re=(0,Z.useCallback)(async(e,t)=>{q(null);try{await Qt(e,{pinned:t}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ve=(0,Z.useCallback)(async e=>{q(null);try{await Qt(e,{status:`archived`}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),He=(0,Z.useCallback)(async e=>{q(null);try{await ge(e),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ue=(0,Z.useCallback)(e=>{se(ar(t,e))},[t,se]),We=(0,Z.useCallback)(e=>{se(ar(t,e)),b(!1)},[t,se]),Ge=(0,Z.useCallback)(e=>{if(ye.length){if(e.key===`ArrowDown`)e.preventDefault(),z(e=>Math.min(ye.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),z(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=ye[R]??ye[0];t&&We(t.id)}}},[R,We,ye]),Ke=(0,Z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ae.current;t.setPointerCapture(e.pointerId),ee(!0);let r=ie.current?.clientWidth??window.innerWidth,i=Math.max(Xn,r-$n),a=Math.min(Qn,i),o=e=>Math.max(Xn,Math.min(a,e)),s=e.clientX,c=o(B),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},h=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}ee(!1),ie.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),H(f),tr(p,f),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,B]);(0,Z.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Pe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pe]);let qe=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),le(B-16)):e.key===`ArrowRight`?(e.preventDefault(),le(B+16)):e.key===`Home`?(e.preventDefault(),le(Xn)):e.key===`End`&&(e.preventDefault(),le(Qn))},[le,B]);return g?(0,Q.jsxs)(`div`,{ref:ie,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${B}px`},children:[(0,Q.jsxs)(`section`,{ref:ae,className:T(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!U&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":W?!0:void 0,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ne?(0,Q.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:ne}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,Q.jsx)(l,{value:je.id,onChange:e=>{let t=Ae.find(t=>t.id===e.target.value);t&&v({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":h.libraryTitle,children:Ae.map(e=>(0,Q.jsx)(u,{value:e.id,children:e.label},e.id))}):(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Me}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:we})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>G(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":h.collapseNotesList,title:h.collapseNotesList,children:(0,Q.jsx)(Dt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:Pe,disabled:K,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":h.createBlankNote,title:h.createBlankShortcut,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>b(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":h.searchDialogTitle,title:h.searchDialogTitle,children:(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:fe?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Q.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):pe.length===0?(0,Q.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,Q.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,Q.jsx)(rn,{className:`size-6`,"aria-hidden":!0})}),(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!be?h.noteOutsideCurrentView:d??h.noNotes}),e&&!be?null:(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??h.noNotesDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!be?(0,Q.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:h.noteOutsideCurrentView}):null,pe.map((t,n)=>{let r=n>0?Cn(pe[n-1].createdAt):null;return(0,Q.jsxs)(`div`,{children:[Cn(t.createdAt)!==r&&(0,Q.jsx)(`div`,{className:T(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:wn(t.createdAt,oe,ke)}),(0,Q.jsx)(Rn,{note:t,selected:t.id===e,onPress:Ue,onPin:Re,onArchive:Ve,onDelete:He,timeLabels:ke,labels:{pin:h.pin,unpin:h.unpin,archive:h.archive,delete:h.delete,actions:h.noteActions,imageNote:h.imageNote,noText:h.noText}})]},t.id)})]})}),(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,Q.jsx)(Jn,{placeholder:h.quickCapturePlaceholder,submitLabel:h.quickCaptureSubmit,actionsLabel:h.quickCaptureActions,imageLabel:h.quickCaptureImage,voiceLabel:h.quickCaptureVoice,stopRecordingLabel:h.stopRecording,onCapture:Ne,onImagePick:a?Fe:void 0,onVoiceCapture:a?Ie:void 0,onVoiceError:Le,recordingLabel:h.recording,discussionCaptureLabel:h.discussionCapture.title,onDiscussionCapture:()=>ze(o)})})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.resizeNotesList,"aria-valuemin":Xn,"aria-valuemax":Qn,"aria-valuenow":Math.round(B),tabIndex:0,onPointerDown:Ke,onDoubleClick:()=>le(Zn),onKeyDown:qe,title:h.resizeNotesList,className:T(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-transparent hover:bg-surface-hover/60 lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,Q.jsx)(`span`,{"aria-hidden":!0,className:T(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,U&&`bg-accent scale-x-[2]`)})}),(0,Q.jsxs)(`section`,{className:T(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[W?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>G(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":h.expandNotesList,title:h.expandNotesList,children:(0,Q.jsx)(Dt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Q.jsx)(Tn,{noteId:e,onBack:()=>se(t),onSaved:()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>b(!0),autoFocus:e===J,onAutoFocusConsumed:()=>re(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(rn,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:h.emptyEditorTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h.emptyEditorDescription}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Pe,disabled:K,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),K?h.creatingBlankNote:h.createBlankNote]})]})})]}),(0,Q.jsx)(L,{open:y,onOpenChange:b,children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(I,{className:`text-sm font-semibold text-fg`,children:Te}),(0,Q.jsx)(M,{className:`sr-only`,children:h.searchPlaceholder}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Ee,children:(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:E,onChange:e=>A(e.target.value),onKeyDown:Ge,placeholder:h.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),E?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>A(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":De,children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:he?ve&&!_e?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):ye.length===0?(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(rn,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchNoResults}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchNoResultsDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:h.searchResultsCount.replace(`{{count}}`,String(_e?.total??ye.length))}),ye.map((e,t)=>{let n=nr[e.kind]||rn,r=rr(e,{imageNote:h.imageNote,noText:h.noText});return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>We(e.id),onMouseEnter:()=>z(t),className:T(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===R?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Q.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Sn(e.updatedAt,oe,ke)})]}),e.title?(0,Q.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Q.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Q.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(S,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchEmptyTitle}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchEmptyDescription})]})})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Q.jsx)(rn,{className:`size-10 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.needToken})]})}function sr(e){return E(A(`/api/projects/${encodeURIComponent(e)}/skills`))}function cr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function lr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function ur(e,t){let n=new FormData;return n.set(`file`,t),E(A(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function dr(e,t,n={}){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function fr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function pr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function mr({projectId:e,copy:t}){let n=k(e=>e.language),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)([]),[s,c]=(0,Z.useState)([]),[l,u]=(0,Z.useState)([]),[f,p]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!0),[w,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(null),[A,M]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),[U,ee]=(0,Z.useState)(``),[K,J]=(0,Z.useState)(1),[re,ie]=(0,Z.useState)(null),[ae,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(``),[le,ue]=(0,Z.useState)(``),Y=(0,Z.useRef)(null),de=(0,Z.useCallback)(async()=>{b(!0),M(``);try{let t=await sr(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){M(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,Z.useEffect)(()=>{de()},[de]),(0,Z.useEffect)(()=>{let t=!1;return he(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Z.useEffect)(()=>{if(!f){g(null);return}let e=l.find(e=>e.key===f),t=!1;return g(null),M(``),v(!0),Fe(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||g(e)}).catch(e=>{t||M(e instanceof Error?e.message:String(e))}).finally(()=>{t||v(!1)}),()=>{t=!0}},[f,l]),(0,Z.useEffect)(()=>{if(R!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{oe(!0),ce(``),yn({q:U,page:K,pageSize:8,sort:`downloads`,signal:e.signal}).then(ie).catch(t=>{e.signal.aborted||ce(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||oe(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[R,K,U]);async function fe(e,t){E(!0),O(t??null),M(``);try{await e(),z(null),ue(``),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1),O(null)}}async function pe(t){M(``);try{V((await cr(e,t)).skill)}catch(e){M(e instanceof Error?e.message:String(e))}}async function ge(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){E(!0);try{await pr(e,n.directoryId),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1)}}}async function _e(){E(!0),M(``);try{await lr(e,!0),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1)}}let ve=s.find(e=>e.origin===`agents-workspace`),ye=new Map(h?.skills.map(e=>[e.name,e]));return(0,Q.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsxs)(H,{type:`button`,children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Q.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Q.jsx)(G,{children:(0,Q.jsxs)(ne,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Q.jsx)(vr,{icon:vt,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>z(`marketplace`)}),(0,Q.jsx)(vr,{icon:lt,title:t.source,hint:t.sourceHint,onClick:()=>z(`source`)}),(0,Q.jsx)(vr,{icon:Pt,title:t.upload,hint:t.uploadHint,onClick:()=>Y.current?.click()})]})})]}),(0,Q.jsx)(`input`,{ref:Y,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&fe(()=>ur(e,n)),t.target.value=``}})]})}),A?(0,Q.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:A}):null,ve?.state===`untrusted`?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(yt,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,disabled:w,onClick:()=>void _e(),children:[(0,Q.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),w?t.trusting:t.trustAction]})]}):null,l.length?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_?t.sessionLoading:f?h?.agentId:t.sessionViewAll})]}),(0,Q.jsx)(d,{value:f,options:l.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:p})]}):null,y?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Q.jsx)(q,{className:`h-36 rounded-lg`},e))}):r.length?(0,Q.jsx)(hr,{title:t.localTitle,items:r,copy:t,busy:w,availabilityByName:ye,onPreview:pe,onRemove:ge}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!y&&a.length?(0,Q.jsx)(hr,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:w,availabilityByName:ye,onPreview:pe,onRemove:ge}):null,(0,Q.jsx)(L,{open:R!==null,onOpenChange:e=>{e||z(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:T(`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-xl`,R===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:R===`marketplace`?t.marketplace:t.source}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(C,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:R===`marketplace`?(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Q.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:U,onChange:e=>{ee(e.target.value),J(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),se?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:se}):null,ae&&!re?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Q.jsx)(q,{className:`h-32 rounded-lg`},e))}):re?.items.length?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:re.items.map(i=>{let a=Se(i,n),o=i.providerId??re.provider,s=vn(i,o),c=r.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===i.id||e.directoryId===s||e.name===i.name)),l=D===s;return(0,Q.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(_n,{name:i.name,className:`size-10`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,Q.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,Q.jsx)(H,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:w||c,onClick:()=>void fe(()=>dr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):ae?null:(0,Q.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),re&&re.meta.totalPages>1?(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(re.meta.page)).replace(`{{total}}`,String(re.meta.totalPages))}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ae||K<=1,onClick:()=>J(e=>Math.max(1,e-1)),children:[(0,Q.jsx)(Te,{className:`size-4`}),t.marketplacePrevious]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ae||K>=re.meta.totalPages,onClick:()=>J(e=>e+1),children:[t.marketplaceNext,(0,Q.jsx)(me,{className:`size-4`})]})]})]}):null]}):(0,Q.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Q.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:le,onChange:e=>ue(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,children:t.close})}),(0,Q.jsx)(H,{type:`button`,disabled:w||!le.trim(),onClick:()=>void fe(()=>fr(e,le.trim())),children:w?t.installing:t.install})]})]})})]})]})}),(0,Q.jsx)(L,{open:!!B,onOpenChange:e=>{e||V(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-xl`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:B?.name}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(C,{className:`size-4`})})})]}),(0,Q.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:B?.bodyMarkdown})]})]})})]})}function hr(e){let t=(0,Mn.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,Q.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,Q.jsxs)(`article`,{className:T(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Rt,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Q.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:gr(a,e.origin)}),e.writable?null:(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Q.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,Q.jsx)(`span`,{className:T(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:_r(a,t)}):null]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Q.jsx)(Ut,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let g;return t[22]!==f||t[23]!==m?(g=(0,Q.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=g):g=t[24],g}function gr(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function _r(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function vr(e){let t=(0,Mn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Q.jsx)(K,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function yr(e){return{name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``}}function br(e,t,n){let r=yr(t),i=yr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var xr={active:0,review:1,ready:2,backlog:3,closed:4},Sr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},Cr={critical:0,high:1,normal:2,low:3};function wr(e,t=4){return e.filter(e=>e.phase!==`closed`&&!(e.operationalState===`waiting`&&e.attention.length===0)).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=Sr[e.operationalState]-Sr[t.operationalState];if(r!==0)return r;let i=xr[e.phase]-xr[t.phase];if(i!==0)return i;let a=Cr[e.priority]-Cr[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Tr=[`backlog`,`ready`,`active`,`review`,`closed`];function Er(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function Dr(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function Or(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function kr(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Ar(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=kr(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function jr(e,t){let{incoming:n}=kr(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Mr(e,t){let{incoming:n,outgoing:r}=kr(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var Nr={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function Pr(e){let t=(0,Mn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Nr[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=T(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(jn,{type:`target`,position:On.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,Q.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Q.jsx)(et,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Q.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Q.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(jn,{type:`source`,position:On.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,Q.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var Fr={taskNode:Pr};function Ir(e){let t=(0,Mn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(),[m,g]=(0,Z.useState)(),_=(0,Z.useRef)(null),v;t[0]!==r||t[1]!==n?(v=jr(n,r),t[0]=r,t[1]=n,t[2]=v):v=t[2];let y=v,b;t[3]!==y||t[4]!==u||t[5]!==c||t[6]!==n?(b=u?n.filter(e=>y.has(e.id)):c?n:n.filter(Wr),t[3]=y,t[4]=u,t[5]=c,t[6]=n,t[7]=b):b=t[7];let x=b,S;t[8]===x?S=t[9]:(S=new Set(x.map(Ur)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let E=w,D;t[15]!==E||t[16]!==x?(D=Ar(x,E),t[15]=E,t[16]=x,t[17]=D):D=t[17];let O=D,k;t[18]!==f||t[19]!==E?(k=f?Mr(f,E):void 0,t[18]=f,t[19]=E,t[20]=k):k=t[20];let A=k,j;t[21]===f?j=t[22]:(j=e=>e.id===f,t[21]=f,t[22]=j);let M=x.find(j),N;t[23]===x?N=t[24]:(N=new Map(x.map(Hr)),t[23]=x,t[24]=N);let P=N,F;if(t[25]!==a.phases||t[26]!==O||t[27]!==A||t[28]!==x){let e;t[30]!==a.phases||t[31]!==O||t[32]!==A?(e=e=>({id:e.id,type:`taskNode`,position:O.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(A&&!A.has(e.id))}}),t[30]=a.phases,t[31]=O,t[32]=A,t[33]=e):e=t[33],F=x.map(e),t[25]=a.phases,t[26]=O,t[27]=A,t[28]=x,t[29]=F}else F=t[29];let I=F,L;if(t[34]!==A||t[35]!==P||t[36]!==E){let e;t[38]!==A||t[39]!==P?(e=e=>{let t=P.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(A&&(!A.has(e.dependencyTaskId)||!A.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Dn.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=A,t[39]=P,t[40]=e):e=t[40],L=E.map(e),t[34]=A,t[35]=P,t[36]=E,t[37]=L}else L=t[37];let R=L,z,B;t[41]!==f||t[42]!==C?(z=()=>{f&&!C.has(f)&&p(void 0)},B=[f,C],t[41]=f,t[42]=C,t[43]=z,t[44]=B):(z=t[43],B=t[44]),(0,Z.useEffect)(z,B);let V,U;t[45]!==R||t[46]!==m?(V=()=>{m&&!R.some(e=>e.id===m)&&g(void 0)},U=[R,m],t[45]=R,t[46]=m,t[47]=V,t[48]=U):(V=t[47],U=t[48]),(0,Z.useEffect)(V,U);let ee;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{let e=window.requestAnimationFrame(()=>{_.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=ee):ee=t[49];let W;t[50]!==u||t[51]!==c||t[52]!==x.length?(W=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=W):W=t[53],(0,Z.useEffect)(ee,W);let G;t[54]===f?G=t[55]:(G=()=>{f&&_.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=G);let K=G,te;t[56]!==r||t[57]!==o?(te=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Vr);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=te):te=t[58];let ne=te,q;t[59]!==r||t[60]!==o||t[61]!==m?(q=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(g(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(Br)))},t[59]=r,t[60]=o,t[61]=m,t[62]=q):q=t[62];let J=q,re;t[63]===a.connectHint?re=t[64]:(re=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=re);let ie=u?`secondary`:`ghost`,ae;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>d(zr),t[65]=ae):ae=t[65];let oe=u?a.allTasks:a.blockedChains,se;t[66]!==u||t[67]!==ie||t[68]!==oe?(se=(0,Q.jsx)(H,{type:`button`,variant:ie,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:ae,children:oe}),t[66]=u,t[67]=ie,t[68]=oe,t[69]=se):se=t[69];let ce;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>l(Rr),t[70]=ce):ce=t[70];let le=c?a.hideCompleted:a.showCompleted,ue;t[71]!==u||t[72]!==c||t[73]!==le?(ue=(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:ce,disabled:u,children:le}),t[71]=u,t[72]=c,t[73]=le,t[74]=ue):ue=t[74];let Y=M?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:K,children:[(0,Q.jsx)(Vt,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,de;t[75]!==a.removeDependency||t[76]!==J||t[77]!==m?(de=m?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:J,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=J,t[77]=m,t[78]=de):de=t[78];let fe;t[79]!==se||t[80]!==ue||t[81]!==Y||t[82]!==de?(fe=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[se,ue,Y,de]}),t[79]=se,t[80]=ue,t[81]=Y,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==re||t[85]!==fe?(pe=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[re,fe]}),t[84]=re,t[85]=fe,t[86]=pe):pe=t[86];let me=x.length>0?(0,Q.jsxs)(`div`,{className:T(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,M&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Q.jsxs)(An,{nodes:I,edges:R,nodeTypes:Fr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>g(t.id),onConnect:ne,onPaneClick:()=>{p(void 0),g(void 0)},onInit:e=>{_.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Q.jsx)(X,{color:`var(--color-edge)`,gap:22,size:1}),(0,Q.jsx)(kn,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),M?(0,Q.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[M.phase]}),(0,Q.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:M.title}),M.operationalState===`blocked`&&M.blockedBy.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(M.blockedBy.length))}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:M.blockedBy.map(Lr)})]}):null,(0,Q.jsxs)(s,{to:qe(i,M.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Q.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),he;return t[87]!==pe||t[88]!==me?(he=(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[pe,me]}),t[87]=pe,t[88]=me,t[89]=he):he=t[89],he}function Lr(e){return(0,Q.jsx)(`li`,{children:e.title},e.id)}function Rr(e){return!e}function zr(e){return!e}function Br(e){return e.dependencyTaskId}function Vr(e){return e.dependencyTaskId}function Hr(e){return[e.id,e]}function Ur(e){return e.id}function Wr(e){return e.phase!==`closed`}function Gr(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Kr={backlog:jt,ready:jt,active:Y,review:Yt,closed:f},qr={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function Jr(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Yr(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Xr(e){let t=(0,Mn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,p,m,h,g,_,v,y,b,x,S,C,w,E,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(h=Or(n),g=h!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,p=n.phase===`closed`,m=!!(n.dueAt&&n.dueAt<Date.now()&&!p),d=p?f:de,v=n.priority!==`normal`,_=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=Qr,t[25]!==l||t[26]!==n.id?(E=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=E):E=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=qe(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=T(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,g?`pr-19`:h&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=E,t[19]=D):(u=t[4],d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],E=t[18],D=t[19]);let O=p?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=T(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,Q.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=p?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=T(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,Q.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Q.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Q.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Zr).join(`、`)})]}):n.attention[0]?(0,Q.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(Ue,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==m||t[51]!==_||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=_?(0,Q.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Jr(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Yr(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Q.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,Q.jsx)(Y,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Q.jsxs)(`span`,{className:T(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,m?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,Q.jsx)(dn,{className:`size-3`,"aria-hidden":!0}),Ft(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Q.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,Q.jsx)(dn,{className:`size-3`,"aria-hidden":!0}),Ft(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=m,t[51]=_,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,Q.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==h||t[71]!==g||t[72]!==n?(R=h?(0,Q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[g?(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[g],title:i.actions[g],children:(0,Q.jsx)(Yt,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,Q.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=h,t[71]=g,t[72]=n,t[73]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==E||t[81]!==D?(z=(0,Q.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:E,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=E,t[81]=D,t[82]=z):z=t[82],z}function Zr(e){return e.title}function Qr(e){e.preventDefault(),e.stopPropagation()}function $r({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:d,ref:f}){let p=(0,Z.useRef)(null),m=(0,Z.useRef)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(`board`),[C,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(()=>crypto.randomUUID()),[A,R]=(0,Z.useState)(``),[z,B]=(0,Z.useState)(`normal`),[V,U]=(0,Z.useState)(``),[ee,W]=(0,Z.useState)([]),[G,K]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(null),q=k(e=>e.language),J=sn({chat:w(q).chat}),re=Er(e),ie=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void i(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let o=re[r.phase],s=o.findIndex(e=>e.id===r.id),c=s>=0?o[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Dr(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=A.trim();if(!(!t||G)){K(!0),ne(null);try{let e=V?new Date(`${V}T23:59:59.999`).getTime():void 0;await c({requestId:D,objective:t,priority:z,dependsOnTaskIds:ee,attachments:J.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),O(crypto.randomUUID()),E(!1)}catch(e){ne(e instanceof Error?e.message:r.createFailed)}finally{K(!1)}}},le=()=>{O(crypto.randomUUID()),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),ne(null),E(!0)};(0,Z.useImperativeHandle)(f,()=>({openCreate:le})),(0,Z.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[y]);let ue=(0,Z.useCallback)(e=>{let t=m.current;!t||t.pointerId!==e.pointerId||(m.current=null,v(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),Y=(0,Z.useCallback)(e=>{if(e.button!==0||Gr(e.target))return;let t=p.current;t&&(m.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),de=(0,Z.useCallback)(e=>{let t=m.current,n=p.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,v(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Q.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,Q.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(At,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,Q.jsx)(`div`,{ref:p,className:T(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,_?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:Y,onPointerMove:de,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{m.current?.pointerId===e.pointerId&&(m.current=null,v(!1))},children:(0,Q.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Tr.map(t=>{let i=Kr[t],a=re[t];return(0,Q.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Dr(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),se(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-inset/70 p-2.5`,children:[(0,Q.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Q.jsxs)(`div`,{className:T(`flex items-center gap-1.5 rounded-md px-2 py-1`,qr[t]),children:[(0,Q.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Q.jsx)(Xr,{task:e,returnTo:n,copy:r,busy:d===e.id,onAction:oe,onDragStart:g,onDropBefore:e=>void se(t,e)},e.id))})})]},t)})})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ir,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,Q.jsx)(L,{open:C,onOpenChange:e=>{G||E(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,Q.jsxs)(`div`,{className:T(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,J.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),G||J.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||J.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),J.setIsDragging(!1),G||J.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Q.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:A,onChange:e=>{R(e.target.value),ne(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,Q.jsx)(ae,{attachments:J.attachments,topPadded:!1,onRemove:e=>{G||J.removeAttachment(e)}}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>J.fileInputRef.current?.click(),children:[(0,Q.jsx)(zt,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,Q.jsx)(`input`,{ref:J.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{J.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,Q.jsx)(l,{value:z,onChange:e=>B(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Q.jsx)(u,{value:e,children:r.priorityOptions[e]},e))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(bn,{className:`min-h-10 bg-surface-base`,value:V,onChange:U,disabled:G,ariaLabel:r.dueDate})]})]}),(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,Q.jsx)(En,{candidates:ie,selectedIds:ee,disabled:G,onChange:W,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),te?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:te}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:r.cancel})}),(0,Q.jsx)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!A.trim(),children:G?r.creating:q===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),y?(0,Q.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Q.jsx)(`span`,{children:r.moved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=y;b(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:r.undo})]}):null]})}var ei=new Set([{id:`overview`,icon:Ne},{id:`tasks`,icon:Tt},{id:`automations`,icon:Lt},{id:`files`,icon:Ke},{id:`notes`,icon:Jt},{id:`skills`,icon:Re},{id:`sessions`,icon:b},{id:`progress`,icon:ot},{id:`settings`,icon:fe}].map(e=>e.id)),ti=`xopc.projectFiles.panelWidthPx`,ni=320,ri=220,ii=560;function ai(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function oi(e){return Math.min(ii,Math.max(ri,Math.round(e)))}function si(){try{let e=window.localStorage.getItem(ti);if(e==null)return ni;let t=Number.parseInt(e,10);return Number.isFinite(t)?oi(t):ni}catch{return ni}}function ci(e){try{window.localStorage.setItem(ti,String(oi(e)))}catch{}}function li(e){return!!(e&&ei.has(e))}function ui(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function di(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ft(n)}function fi(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-inset text-fg-subtle`:`bg-surface-hover text-fg-muted`}function pi(e){let t=(0,Mn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Q.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function mi(e=!1){return T(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function hi(e){let t=(0,Mn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=T(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Q.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function gi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function _i(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function vi(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function yi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function bi(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.conversationId?t.conversationId:t.kind}function xi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Si(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Ci(e){let t=e.sourceChannel?.trim();return t?wi(t):``}function wi(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ti(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Ei(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Di(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Di(e.children,t,n)}:e)}function Oi({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([e]),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(`new`),[C,w]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(!1),[A,R]=(0,Z.useState)(!0),[z,B]=(0,Z.useState)(null),[V,U]=(0,Z.useState)(null),ee=(0,Z.useCallback)(async()=>{m(!0),g(null);try{let t=await Oe({limit:100});u(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,Z.useEffect)(()=>{u(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Z.useEffect)(()=>{o&&ee()},[ee,o]);let K=(0,Z.useMemo)(()=>{let t=d.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=gi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>_i(t)-_i(e))},[e.id,l,d]),q=e=>t.statuses[e.status]??e.status,J=e=>e.description||e.brief||t.common.defaultWorkspace,ie=e=>{b(e),w(``),D(``),B(null),v(!0),s(!1)},ae=(0,Z.useCallback)(async(e={})=>{let t=E.trim(),n=C.trim()||(y===`directory`?vi(t):``);if(n){k(!0),B(null),U(null);try{let r=await ke({autoUnderstand:A,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),w(``),D(``),R(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),u(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=yi(e);t?(U(t),v(!1)):B(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[y,C,a,E,A]),oe=(0,Z.useCallback)(e=>{e.preventDefault(),ae()},[ae]),se=(0,Z.useCallback)(()=>{ae({createWorkspaceRoot:!0})},[ae]),ce=(0,Z.useCallback)(()=>{U(null),v(!0)},[]),le=e=>{D(e),y===`directory`&&!C.trim()&&w(vi(e))},ue=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Q.jsx)(c,{className:T(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:J(e)})]}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fi(e.status)),children:q(e)})]},e.id);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(W,{open:o,onOpenChange:s,children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fi(e.status)),children:q(e)})]}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:J(e)})]}),(0,Q.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Q.jsx)(G,{children:(0,Q.jsxs)(ne,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:d,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Q.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ue(e,!0),(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,Q.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&K.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&K.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,K.map(e=>ue(e,!1))]}),(0,Q.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ie(`new`),children:[(0,Q.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ie(`directory`),children:[(0,Q.jsx)(Ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),a(`/projects`)},children:[(0,Q.jsx)(fe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Q.jsx)(L,{open:_,onOpenChange:e=>!O&&v(e),children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:y===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm text-fg-muted`,children:y===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Q.jsxs)(`form`,{onSubmit:oe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[z?(0,Q.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:z}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Q.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Q.jsx)(gn,{value:E,onChange:le,disabled:O,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,Q.jsx)(kt,{checked:A,onChange:R,disabled:O})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:O,children:n.cancel})}),(0,Q.jsxs)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:O||!(C.trim()||y===`directory`&&vi(E)),children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Q.jsx)(L,{open:!!V,onOpenChange:e=>{e||U(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?ui(n.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:O,children:n.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:O,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ki(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),d=k(e=>e.language),f=w(d),m=f.chat.workingDirectory,h=f.projectDetailPage,y=f.projectsPage,E=gt(e=>e.setPageHeader),D=gt(e=>e.clearPageHeader),[O,A]=(0,Z.useState)(null),V=(0,Z.useRef)(O);(0,Z.useLayoutEffect)(()=>{V.current=O},[O]);let[W,G]=(0,Z.useState)(null),[K,te]=(0,Z.useState)([]),[ne,ie]=(0,Z.useState)(``),[ae,ce]=(0,Z.useState)([]),[le,ue]=(0,Z.useState)(0),[Y,de]=(0,Z.useState)(!1),[pe,me]=(0,Z.useState)(!1),[ge,_e]=(0,Z.useState)(!1),[ye,Se]=(0,Z.useState)([]),[Ce,Te]=(0,Z.useState)(null),Oe=(0,Z.useRef)(new Set),[ke,Ae]=(0,Z.useState)(null),[je,Pe]=(0,Z.useState)(null),[Fe,Ie]=(0,Z.useState)(null),[ze,Be]=(0,Z.useState)(si),[Ve,Ye]=(0,Z.useState)(!1),[Xe,Ze]=(0,Z.useState)(!1),[et,tt]=(0,Z.useState)(``),[ct,dt]=(0,Z.useState)([]),[vt,yt]=(0,Z.useState)(!1),[St,Dt]=(0,Z.useState)(null),[Ot,kt]=(0,Z.useState)(!1),[At,jt]=(0,Z.useState)(null),[Pt,Ft]=(0,Z.useState)([]),[zt,Bt]=(0,Z.useState)(``),[Vt,Wt]=(0,Z.useState)(!0),[Gt,qt]=(0,Z.useState)(!1),[Yt,Xt]=(0,Z.useState)(!1),[Qt,$t]=(0,Z.useState)(null),[tn,rn]=(0,Z.useState)(!1),[sn,ln]=(0,Z.useState)(`fixed`),[dn,_n]=(0,Z.useState)(``),[vn,yn]=(0,Z.useState)(null),[bn,Sn]=(0,Z.useState)(!1),[Cn,wn]=(0,Z.useState)(!1),[Tn,En]=(0,Z.useState)(!1),[Dn,On]=(0,Z.useState)(null),kn=(0,Z.useRef)(null),An=(0,Z.useRef)(!1),[jn,X]=(0,Z.useState)(null),[Mn,Nn]=(0,Z.useState)({title:``,reason:``}),[Pn,Fn]=(0,Z.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),In=(0,Z.useRef)(Pn),Ln=`overview`,$=n?`notes`:li(t)?t:Ln,Rn=(0,Z.useMemo)(()=>g(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),zn=(0,Z.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Rn===`/projects`?n:_(n,Rn)},[Rn,e]),Bn=(0,Z.useCallback)(t=>{e&&r(zn(t))},[r,e,zn]),Vn=(0,Z.useCallback)(()=>{if($===`tasks`&&kn.current){kn.current.openCreate();return}An.current=!0,Bn(`tasks`)},[Bn,$]);(0,Z.useEffect)(()=>{$!==`tasks`||!An.current||(An.current=!1,kn.current?.openCreate())},[$]);let Hn=(0,Z.useCallback)(t=>{e&&r(zn(t),{replace:!0})},[r,e,zn]),Un=(0,Z.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Hn(e)},[Hn]),Wn=(0,Z.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,Z.useEffect)(()=>{!e||!t||li(t)||r(zn(Ln),{replace:!0})},[Ln,r,e,zn,t]),(0,Z.useEffect)(()=>{if(!e)return;let t=!1;return Wt(!0),X(null),Promise.all([oe(e),Qe(e),he(e),ee().catch(()=>null),at(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;A(e),G(n),te(r),Te(a),Ft(i?.agents??[]),Bt(e.defaultAgentId??``);let o=yr(e);In.current=o,Fn(o)}).catch(e=>{t||(Te(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Wt(!1)}),()=>{t=!0}},[e]);let Gn=(0,Z.useCallback)(async()=>{e&&G(await Qe(e))},[e]);(0,Z.useEffect)(()=>{if(Vt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([oe(e),Qe(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=V.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=br(In.current,i,e);In.current=t,Fn(t)}V.current=e,A(e),G(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(A(null),G(null),X(e.message))})};return window.addEventListener(`project-resource-changed`,r),r(new Event(`project-resource-changed`)),()=>{t=!1,window.removeEventListener(`project-resource-changed`,r)}},[e,Vt]),(0,Z.useEffect)(()=>{let t,n=n=>{let r=z.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),120))},r=n=>{let r=R.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,Gn]);let Kn=(0,Z.useCallback)(async(e,t)=>{On(e.id),X(null);try{let n=await un(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??(await we(e.id)).agentId}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await Le(e.id,r,n.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[W,h.board.actionFailed,Gn]),qn=(0,Z.useCallback)(async t=>{e&&(X(null),await He({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:d,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await Gn())},[d,e,Gn]),Jn=(0,Z.useCallback)(async(e,t)=>{On(e),X(null);try{return await De(e,t,(await un(e)).task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[h.board.actionFailed,Gn]),Yn=(0,Z.useCallback)(async(e,t,n)=>{On(e),X(null);try{let r=await un(e);return r.task.phase!==t&&(r=await Le(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await De(e,n,r.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[h.board.actionFailed,Gn]),Xn=(0,Z.useCallback)(async(e,t)=>{On(e),X(null);try{await pt(e,t,(await un(e)).task.version),await Gn()}catch(e){await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed)}finally{On(null)}},[h.board.actionFailed,Gn]),Zn=(0,Z.useCallback)(async()=>{if(O){de(!0),X(null);try{let e=await nt(O.id,{includeRelated:pe,limit:100});ce(e.items),ue(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{de(!1)}}},[O,pe]);(0,Z.useEffect)(()=>{$===`progress`&&Zn()},[Zn,$]);let Qn=(0,Z.useCallback)(async()=>{if(!O?.effectiveWorkspaceRoot?.trim()){Se([]),Oe.current.clear(),jt(null);return}kt(!0),jt(null),Oe.current.clear();try{Se(Ei((await ve(O.id,``)).entries)),Oe.current.add(``)}catch(e){Se([]),Oe.current.clear(),jt(e instanceof Error?e.message:String(e))}finally{kt(!1)}},[O]),$n=(0,Z.useCallback)(async e=>{if(!(!O?.effectiveWorkspaceRoot?.trim()||Oe.current.has(e))){Oe.current.add(e),jt(null);try{let t=await ve(O.id,e);Se(n=>Di(n,e,Ei(t.entries)))}catch(t){Oe.current.delete(e),jt(t instanceof Error?t.message:String(t))}}},[O]),er=(0,Z.useCallback)(async e=>{if(!O?.effectiveWorkspaceRoot?.trim())return;let t=Ei((await ve(O.id,e)).entries);Se(e?n=>Di(n,e,t):t),Oe.current.add(e)},[O]);(0,Z.useEffect)(()=>{$===`files`&&Qn()},[Qn,$]);let tr=et.trim();(0,Z.useEffect)(()=>{if($!==`files`||!O||!Xe||!tr){dt([]),yt(!1),Dt(null);return}let e=!1;yt(!0),Dt(null),dt([]);let t=window.setTimeout(()=>{st(O.id,tr,50).then(t=>{e||dt(t)}).catch(t=>{e||Dt(t instanceof Error?t.message:String(t))}).finally(()=>{e||yt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[tr,O,Xe,$]);let nr=(0,Z.useCallback)(async()=>{if(!O)return;let[e,t]=await Promise.all([oe(O.id),Qe(O.id)]);G(t),A(e)},[O]),rr=(0,Z.useCallback)(async e=>{if(e.preventDefault(),!(!O||!Mn.title.trim())){wn(!0),X(null);try{await Je(O.id,{title:Mn.title.trim(),reason:Mn.reason.trim()||void 0}),Nn({title:``,reason:``}),En(!1),await nr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{wn(!1)}}},[Mn.reason,Mn.title,O,nr]),ir=(0,Z.useMemo)(()=>(0,Q.jsx)(s,{to:Rn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Rn===`/projects`?h.backToProjects:f.sidebar.back,children:(0,Q.jsx)(xt,{className:`size-4`,"aria-hidden":!0})}),[Rn,f.sidebar.back,h.backToProjects]),ar=(0,Z.useMemo)(()=>O?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hn,{resource:{kind:`project`,id:O.id,revision:String(O.version)},disabled:Gt||ai(Pn,O)}),(0,Q.jsx)(H,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(O.id)}`,children:[(0,Q.jsx)(lt,{className:`size-4`,"aria-hidden":!0}),h.common.runWorkflow]})}),(0,Q.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Vn,children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),h.board.create]}),(0,Q.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:Mt(O.id),state:{forceNewChat:!0,agentId:O.defaultAgentId},onClick:Un(`sessions`),children:[(0,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0}),h.common.newChat]})})]}):null,[Vn,Un,h.board.create,h.common.newChat,h.common.runWorkflow,O,Gt,Pn]);(0,Z.useLayoutEffect)(()=>(E({startExtra:ir,main:O?(0,Q.jsx)(Oi,{currentProject:O,pm:h,projectsText:y,wd:m}):(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h.fallbackTitle}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:h.fallbackContext})]}),end:ar}),()=>D()),[D,ar,ir,h,O,y,E,m]);function sr(e){A(t=>t?{...t,...e}:null),Bt(e.defaultAgentId??``),at(e.id).then(Te).catch(()=>Te(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function cr(e=In.current){if(!(!O||!ai(e,O))){X(null),$t(null);try{let t=await We(O.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},O.version);sr(t);let n=In.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};In.current=r,Fn(r)}catch(e){let t=yi(e);throw t?$t(t):X(e instanceof Error?e.message:String(e)),e}}}function lr(e){e.preventDefault(),kr.flush()}function ur(e,t=!1){let n={...In.current,...e};In.current=n,Fn(n),t&&kr.saveNow(n)}let dr=(0,Z.useCallback)(()=>{if(!O)return;let e=O.workspaceRoot?.trim()??``;ln(e?`fixed`:`follow`),_n(e||O.effectiveWorkspaceRoot||``),rn(!0)},[O]);async function fr(e={}){if(!O)return;let t=sn===`fixed`?dn.trim():``;if(!(sn===`fixed`&&!t)){qt(!0),X(null),$t(null);try{let n=await We(O.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},O.version);sr(n),ur({workspaceRoot:n.workspaceRoot??``}),rn(!1),$t(null)}catch(e){let t=yi(e);t?($t(t),rn(!1)):X(e instanceof Error?e.message:String(e))}finally{qt(!1)}}}async function pr(){if(!(!O||vn)){yn(`pin`),X(null);try{sr(O.pinnedAt?await mt(O.id,O.version):await Kt(O.id,O.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(null)}}}async function hr(){if(!(!O||vn)){yn(`archive`),X(null);try{let e=O.status===`archived`?await Ee(O.id,O.version):await xe(O.id,O.version);sr(e),ur({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(null)}}}async function gr(){if(O){Sn(!0),X(null);try{await cn(O.id,O.version),Xt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Sn(!1)}}}async function _r(){if(!(!O||ge)){_e(!0),X(null);try{await ft(O.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_e(!1)}}}let vr=(0,Z.useCallback)(e=>{Ae(e)},[]),xr=(0,Z.useCallback)((e,t)=>{t||Ae(e)},[]),Sr=(0,Z.useCallback)(async(e,t,n)=>{let r=O?.id;if(r)switch(e){case`preview`:t.isDirectory||Ae(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Zt(t.path);if(Ct(Nt(e))!==`text`){let n=await wt(t.path,{projectId:r}),i=U(e)??`application/octet-stream`;It(e,await n.arrayBuffer(),i)}else{let{content:n}=await ht(t.path,{projectId:r});Et(e,n)}}catch(e){be(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await B(t.path)&&be(`success`,f.workspace.pathCopied,void 0,{duration:2500})}catch{be(`warning`,f.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await $e(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWith`:await $e(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await $e(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),f.workspace.openFileFailed);break;case`revealInFolder`:await $e(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),f.workspace.revealFileFailed);break;case`trash`:Pe(t);break;case`delete`:t.isDirectory||Ie(t);break;default:break}},[f.clipboard.copyFailed,f.workspace.openFileFailed,f.workspace.pathCopied,f.workspace.revealFileFailed,O?.id]),Cr=(0,Z.useCallback)(async()=>{let e=je;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){be(`warning`,t?.error??f.workspace.trashFailed,void 0,{duration:4e3});return}ke===e.path&&Ae(null),Pe(null),await Qn(),be(`success`,f.workspace.trashSuccess,void 0,{duration:2500})},[f.workspace.trashFailed,f.workspace.trashSuccess,je,ke,Qn]),Tr=(0,Z.useCallback)(async(e,t)=>{let n=O?.id;if(n)try{await Promise.all(e.map(e=>en(e,t,{projectId:n}))),await er(t).catch(()=>void 0),be(`success`,f.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await er(t).catch(()=>void 0),be(`warning`,`${f.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.uploadFailed,f.workspace.uploadSuccess,O?.id,er]),Er=(0,Z.useCallback)(async()=>{let e=Fe;if(e)try{await Ht(e.fileId),ke===e.path&&Ae(null),Ie(null);let t=e.path.lastIndexOf(`/`);await er(t<0?``:e.path.slice(0,t)).catch(()=>void 0),be(`success`,f.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){be(`warning`,`${f.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.deleteFailed,f.workspace.deleteSuccess,Fe,ke,er]),Dr=(0,Z.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Ye(!0);let r=e.clientX,i=ze,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=oi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ye(!1),Be(c),ci(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[ze]);(0,Z.useEffect)(()=>{$!==`files`&&Ae(null)},[e,$]);let Or=!!(O&&ai(Pn,O)),kr=mn({value:O?Pn:null,dirty:Or,onSave:cr,validate:e=>e.name.trim()?null:h.settings.nameRequired});if(Vt)return(0,Q.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:h.loading});if(!O)return(0,Q.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Q.jsxs)(s,{to:Rn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Q.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),Rn===`/projects`?h.backToProjects:f.sidebar.back]}),(0,Q.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:jn||h.notFound})]});let Ar=K.slice(0,3),jr=W?.blockers??[],Mr=wr(W?.tasks??[]),Nr=W?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Pr=e=>h.statuses[e]??e,Fr=e=>ui(h.common.messages,{count:e}),Ir=ne.trim().toLowerCase(),Lr=Ir?K.filter(e=>{let t=di(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=e.name?.trim()||h.sessions.fallbackTitle,i=Fr(e.messageCount??0),a=Ci(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Ir)}):K,Rr=K.length>0&&Lr.length===0,zr=Pt.find(e=>e.id===O.defaultAgentId)?.name||O.defaultAgentId||h.settings.globalDefaultAgent,Br=Pt.find(e=>e.id===Pn.defaultAgentId),Vr=O.workspaceRoot?.trim()||``,Hr=O.status===`archived`,Ur=!!O.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||O.effectiveWorkspaceRoot||h.common.defaultWorkspace,Kr=sn===`fixed`?dn.trim()||h.settings.workspacePlaceholder:Br?.workspace||O.effectiveWorkspaceRoot||h.common.defaultWorkspace,qr=(sn===`fixed`?dn.trim():``)!==Vr&&(sn===`follow`||!!dn.trim()),Jr=[{id:`overview`,icon:Ne,label:h.tabs.overview},{id:`tasks`,icon:Tt,label:h.tabs.tasks},{id:`automations`,icon:Lt,label:h.tabs.automations},{id:`files`,icon:Ke,label:h.tabs.files},{id:`notes`,icon:Jt,label:h.tabs.notes},{id:`skills`,icon:Re,label:h.tabs.skills},{id:`sessions`,icon:b,label:h.tabs.sessions},{id:`progress`,icon:ot,label:h.tabs.progress}];async function Yr(){if(!Gr)return;let e=await B(Gr);be(e?`success`:`warning`,e?f.workspace.pathCopied:f.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){$t(null),rn(!0)}return(0,Q.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Q.jsx)(fn,{items:Jr,activeTab:$,onChange:Bn,ariaLabel:h.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Q.jsxs)(H,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Bn(`settings`),children:[(0,Q.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),h.tabs.settings,Or?(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":h.settings.unsavedChanges}):null]})]}),jn?(0,Q.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:jn}):null,(0,Q.jsxs)(`div`,{className:T(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,Q.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Q.jsx)(Me,{projectId:O.id},O.id),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`p-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.directionTitle}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ui(h.overview.activitySummary,{moving:Nr,attention:jr.length})})]}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:O.outcome||O.description||O.brief||h.overview.directionFallback}),W?.digest.recommendedAction?(0,Q.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:ui(h.overview.recommendedNext,{action:W.digest.recommendedAction})}):null]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void _r(),disabled:ge,children:[(0,Q.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),ge?h.overview.savingDigest:h.overview.saveDigest]})]})}),(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.nextActions}),(0,Q.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Bn(`tasks`),children:h.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Mr.length?Mr.map(e=>(0,Q.jsxs)(s,{to:qe(zn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsxs)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.attention.length?`bg-warning/10 text-warning`:`bg-surface-hover text-fg-muted`),children:[h.board.phases[e.phase],e.operationalState===`idle`?``:` · ${h.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noNextActions})})]})]}),W?.recentResults.length?(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.recentResults})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:W.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Q.jsxs)(s,{to:qe(zn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[h.overview.resultStatuses[n.status],` · `,h.board.verification[n.verification.status]]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,Q.jsx)(v,{content:n.summary,compact:!0})})]},n.runId))})]}):null,O.milestones.length||O.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[O.milestones.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.milestones})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.milestones.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:h.statuses[e.status]})]},e.id))})]}):null,O.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.projectUpdates})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.recentUpdates.slice(0,3).map(e=>(0,Q.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,Q.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.attention}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Tn,onClick:()=>En(e=>!e),children:[(0,Q.jsx)(x,{className:T(`size-3.5 transition-transform`,Tn&&`rotate-45`),"aria-hidden":!0}),h.overview.addBlocker]})]}),jr.length?(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3`,children:jr.map(e=>{let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Ue,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Q.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[h.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Pr(e.status)}`:``]})]});return e.href?(0,Q.jsx)(s,{to:e.href,onClick:Un(Wn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Q.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h.overview.noBlockedTasks}),Tn?(0,Q.jsxs)(`form`,{onSubmit:rr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,Q.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Mn.title,onChange:e=>Nn(t=>({...t,title:e.target.value})),placeholder:h.overview.blockerTitlePlaceholder}),(0,Q.jsx)(H,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:Cn||!Mn.title.trim(),"aria-label":Cn?h.overview.addingBlocker:h.overview.addBlocker,title:Cn?h.overview.addingBlocker:h.overview.addBlocker,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(an,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:h.overview.recentSessions})]}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Bn(`sessions`),children:h.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Ar.length?Ar.map(e=>(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:di(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==O.defaultAgentId?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Q.jsx)($r,{ref:kn,tasks:W?.tasks??[],dependencyEdges:W?.dependencyEdges??[],returnTo:zn(`tasks`),copy:h.board,onAction:Kn,onReorder:Jn,onUndoMove:Yn,onDependenciesChange:Xn,onCreate:qn,actionBusyId:Dn}):null,$===`automations`?(0,Q.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Q.jsx)(xn,{projectId:O.id,embedded:!0,title:h.automations.title,subtitle:h.automations.hint})}):null,$===`notes`?(0,Q.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Q.jsx)(or,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(O.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:O.id,listTitle:h.notes.title,listDescription:h.notes.hint,emptyText:h.notes.emptyTitle,emptyDescription:h.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${O.id}`})}):null,$===`skills`?(0,Q.jsx)(mr,{projectId:O.id,copy:h.skills}):null,$===`files`?(0,Q.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:O.effectiveWorkspaceRoot?(0,Q.jsxs)(`div`,{"data-project-files-grid":!0,className:T(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,Ve&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${ze}px`},children:[(0,Q.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[Ce?(0,Q.jsx)(it,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,className:T(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Xe&&`bg-surface-hover text-fg`),onClick:()=>Ze(!0),"aria-label":h.files.search,title:h.files.search,"aria-pressed":Xe,children:(0,Q.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(_t,{className:`size-7 shrink-0 rounded-md p-0`,loading:Ot,label:f.cron.refresh,onClick:()=>void Qn()})]})]}),Xe?(0,Q.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,Q.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md bg-surface-base px-2 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,Q.jsx)(S,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`text`,role:`searchbox`,value:et,onChange:e=>tt(e.target.value),placeholder:h.files.searchPlaceholder,"aria-label":h.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Q.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":h.files.clearSearch,title:h.files.clearSearch,onClick:()=>{tt(``),Ze(!1)},children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,At?(0,Q.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:At}):null,tr?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:vt?(0,Q.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Q.jsx)(q,{className:`h-11 w-full`}),(0,Q.jsx)(q,{className:`h-11 w-full`}),(0,Q.jsx)(q,{className:`h-11 w-full`})]}):St?(0,Q.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[f.workspace.loadError,`: `,St]}):ct.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:h.files.noSearchResults}):ct.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,ke===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Ae(e.path),title:e.path,children:[(0,Q.jsx)(Jt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Ot&&ye.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.files.loading}):(0,Q.jsx)(on,{tree:ye,selectedPath:ke,onSelectFile:vr,onSelectEntry:xr,onExpandDir:e=>void $n(e),onAction:Sr,onUploadFiles:(e,t)=>void Tr(e,t),uploadDropHint:f.workspace.dropToUpload,actionLabels:{preview:f.workspace.preview,download:f.workspace.download,copyPath:f.workspace.copyPath,openDefault:f.workspace.openSystemApp,openDirectory:f.workspace.openInFileManager,openWith:f.workspace.openWith,revealInFolder:f.workspace.revealInFolder,trash:f.workspace.moveToTrash,delete:f.workspace.deleteFile,recommendedApps:f.workspace.recommendedApps,desktopUpdateRequired:f.workspace.desktopUpdateRequired},emptyHint:h.files.emptyDirectory})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.files.resizeHandle,className:T(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,Ve&&`bg-surface-hover/70`),onPointerDown:Dr,children:(0,Q.jsx)(`div`,{className:T(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,Ve&&`bg-accent/60`)})}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:ke?(0,Q.jsx)(ut,{filePath:ke,projectId:O.id,agentId:O.defaultAgentId||zt||void 0,onClose:()=>Ae(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(Ke,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h.files.previewEmptyTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.files.previewEmptyDescription})]})})})]}):(0,Q.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:h.files.needWorkspace}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Bn(`settings`),children:h.files.openSettings})})]})})}):null,$===`sessions`?(0,Q.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[K.length?(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:ne,onChange:e=>ie(e.currentTarget.value),placeholder:h.sessions.searchPlaceholder,"aria-label":h.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),ne?(0,Q.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":h.sessions.clearSearch,onClick:()=>ie(``),children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Lr.length?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Lr.map(e=>{let t=di(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=Ci(e),i=e.name?.trim()||h.sessions.fallbackTitle,a=Fr(e.messageCount??0);return(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Q.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.agent,`: `,n]}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Q.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.noMatches})}):(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.emptyTitle}),(0,Q.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:h.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Q.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.progress.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ui(h.progress.count,{count:le})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:pe,onChange:e=>me(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),h.progress.includeRelated]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Zn(),disabled:Y,children:[(0,Q.jsx)(rt,{className:T(`size-4`,Y&&`animate-spin`),"aria-hidden":!0}),h.common.refresh]})]})]}),(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Y&&ae.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.loading}):ae.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:ae.map(e=>{let t=h.progress.types[e.type]??e.type,n=h.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ti(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===O.id);return(0,Q.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:h.progress.related}):null]}),(0,Q.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,xi(e)]})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:di(e.createdAt)})]}),r?(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[h.progress.actor,`: `,bi(e)]}),(0,Q.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.progress.source,`: `,Si(e)]})]})]},e.id)})}):(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.empty})})]}):null,$===`settings`?(0,Q.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:lr,onBlurCapture:kr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Q.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.summaryTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:h.settings.summaryHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Q.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-xs font-medium`,fi(Pn.status)),children:h.settings.statuses[Pn.status]}),(0,Q.jsx)(pn,{status:kr.status,error:kr.error})]})]}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.detailsTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.detailsHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(pi,{label:h.settings.name,children:(0,Q.jsx)(`input`,{className:mi(),value:Pn.name,onChange:e=>ur({name:e.target.value})})}),(0,Q.jsx)(pi,{label:h.settings.defaultAgent,children:(0,Q.jsxs)(l,{className:mi(),value:Pn.defaultAgentId,onChange:e=>ur({defaultAgentId:e.target.value},!0),children:[(0,Q.jsx)(u,{value:``,children:h.settings.globalDefaultAgent}),Pt.map(e=>(0,Q.jsx)(u,{value:e.id,children:bt(e,f.agentsSettings)},e.id))]})}),(0,Q.jsx)(pi,{label:h.settings.status,children:Hr?(0,Q.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-inset px-3 text-sm text-fg-muted`,children:h.settings.statuses.archived}):(0,Q.jsxs)(l,{className:mi(),value:Pn.status===`archived`?`active`:Pn.status,onChange:e=>ur({status:e.target.value},!0),children:[(0,Q.jsx)(u,{value:`active`,children:h.settings.statuses.active}),(0,Q.jsx)(u,{value:`paused`,children:h.settings.statuses.paused})]})}),(0,Q.jsx)(pi,{label:h.settings.executionMode,hint:h.settings.executionModeHint,children:(0,Q.jsxs)(l,{className:mi(),value:Pn.executionMode,onChange:e=>ur({executionMode:e.target.value},!0),children:[(0,Q.jsx)(u,{value:`managed_worktree`,children:h.settings.executionModeWorktree}),(0,Q.jsx)(u,{value:`local_checkout`,children:h.settings.executionModeLocal})]})}),(0,Q.jsx)(pi,{label:h.settings.description,hint:h.settings.descriptionHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.description,onChange:e=>ur({description:e.target.value})})})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.projectGuidanceTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.projectGuidanceHint})]}),(0,Q.jsx)(pi,{label:h.settings.brief,hint:h.settings.briefHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.brief,onChange:e=>ur({brief:e.target.value})})}),(0,Q.jsx)(pi,{label:h.settings.instructions,hint:h.settings.instructionsHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.instructions,onChange:e=>ur({instructions:e.target.value})})})]})]}),(0,Q.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.workspaceRoot}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceIndependentHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?h.settings.workspaceModeFollow:h.settings.workspaceModeFixed}),(0,Q.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0}),h.settings.copyWorkspacePath]}),Ce?(0,Q.jsx)(it,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:dr,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.migrateWorkspace]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.currentProjectTitle}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(hi,{label:h.settings.defaultAgent,value:zr}),(0,Q.jsx)(hi,{label:h.settings.pinState,value:Ur?h.settings.pinned:h.settings.notPinned}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Q.jsx)(hi,{label:h.settings.createdAt,value:di(O.createdAt)||h.common.never}),(0,Q.jsx)(hi,{label:h.settings.updatedAt,value:di(O.updatedAt)||h.common.never})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.managementTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.managementHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?h.settings.pinnedTitle:h.settings.pinTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.pinHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:vn===`pin`,onClick:()=>void pr(),children:[Ur?(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(J,{className:`size-4`,"aria-hidden":!0}),Ur?h.settings.unpinProject:h.settings.pinProject]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?h.settings.restoreTitle:h.settings.archiveTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?h.settings.restoreHint:h.settings.archiveHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:vn===`archive`,onClick:()=>void hr(),children:[Hr?(0,Q.jsx)(rt,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Rt,{className:`size-4`,"aria-hidden":!0}),Hr?h.settings.restoreProject:h.settings.archiveProject]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:h.settings.dangerTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:h.settings.dangerHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>Xt(!0),children:[(0,Q.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Q.jsx)(L,{open:Yt,onOpenChange:e=>{bn||Xt(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5 shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Q.jsx)(Ue,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.deleteConfirmTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O?ui(h.settings.deleteConfirm,{name:O.name}):h.settings.deleteConfirmFallback})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:bn,children:h.common.cancel})}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:bn||!O,onClick:()=>void gr(),children:[(0,Q.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})}),(0,Q.jsx)(nn,{open:!!je,title:f.workspace.trashConfirmTitle,description:f.workspace.trashConfirmDescription.replace(`{{name}}`,je?.name??``),confirmLabel:f.workspace.moveToTrash,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void Cr(),onCancel:()=>Pe(null)}),(0,Q.jsx)(nn,{open:!!Fe,title:f.workspace.deleteConfirmTitle,description:f.workspace.deleteConfirmDescription.replace(`{{name}}`,Fe?.name??``),confirmLabel:f.workspace.deleteFile,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void Er(),onCancel:()=>Ie(null)}),(0,Q.jsx)(L,{open:tn,onOpenChange:e=>{Gt||rn(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMigrationTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.workspaceMigrationDescription})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:h.settings.workspaceMode}),(0,Q.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`fixed`,onChange:()=>ln(`fixed`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFixed}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceMigrationFixedHint})]})]}),(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`follow`,onChange:()=>ln(`follow`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFollow}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceHint})]})]})]})]}),sn===`fixed`?(0,Q.jsx)(gn,{value:dn,onChange:_n,disabled:Gt,wd:m,placeholder:h.settings.workspacePlaceholder,inputClassName:mi(),autoFocus:!0}):null,(0,Q.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:h.settings.workspaceMigrationImpact}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:ui(h.settings.workspaceCurrent,{workspace:Kr})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Gt,children:h.common.cancel})}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Gt||!qr,onClick:()=>void fr(),children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Q.jsx)(L,{open:!!Qt,onOpenChange:e=>{e||$t(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMissingTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Qt?ui(h.settings.workspaceMissingDescription,{workspace:Qt}):null})]}),Qt?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:Qt})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:Gt,children:h.settings.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void fr({createWorkspaceRoot:!0}),disabled:Gt,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMissingCreate]})]})]})]})})]})}export{ki as ProjectDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,t as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./messages-DsUnS7rn.js";import{t as p}from"./cn-JdwAhgNB.js";import{c as m,n as h}from"./locale-store-7F4l6DRV.js";import{a as g,i as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./copy-to-clipboard-HOJ79TWv.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{t as w}from"./button-CS04eWY9.js";import{n as T,r as E}from"./gateway-config-swr-Hn1vj6uI.js";import{i as D,o as O}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{$u as k,At as A,Bt as j,Do as M,Eu as N,Fu as P,Il as F,It as I,Lc as L,Lu as R,Nt as z,Ot as B,Pt as V,Ta as ee,_c as H,cl as U,fc as W,jc as te,kc as G,kt as ne,oa as K,qc as q,xa as re}from"./index-CdvabjRm.js";import{t as ie}from"./page-tabs-Bp0yPTYw.js";import{n as J,r as ae,t as oe}from"./settings-page-layout-X1x-2Cp9.js";import{n as Y,r as se,t as ce}from"./settings-form-section-DziWi7ar.js";import{_ as le,a as ue,b as de,c as fe,h as pe,i as me,n as he,o as X,r as ge,s as _e,t as ve,v as ye,y as be}from"./tunnel-api-mpYTR5df.js";import{t as xe}from"./settings-advanced-gate-CPyqCG90.js";var Z=e(t(),1),Q=n(),$=r();function Se(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Ce(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=p(`inline-flex items-center gap-1.5 text-xs font-medium`,Se(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=p(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function we(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=h(Ee),i;t[0]===r?i=t[1]:(i=f(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!m(Te),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=C(o?`exposure-status`:null,be,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=C(o?`tunnel-status`:null,he,l),g=E(o);if(!o)return null;let _=c?.tailscale.active===!0,v=d?.state,y=d?.enabled&&v===`connected`,b=d?.enabled&&(v===`connecting`||v===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),x=g.data?.payload?.config,S=!!(x&&typeof x==`object`&&!Array.isArray(x)&&x.gateway?.publicUrl),w=_?`active`:`off`,T=_?a.statusActive:a.statusOff,D;t[4]!==a.tailscaleCardTitle||t[5]!==w||t[6]!==T?(D={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:w,statusLabel:T},t[4]=a.tailscaleCardTitle,t[5]=w,t[6]=T,t[7]=D):D=t[7];let O=y?`active`:b?`connecting`:`off`,k=y?a.statusActive:b?a.statusConnecting:a.statusOff,A;t[8]!==a.publicCardTitle||t[9]!==O||t[10]!==k?(A={tab:`public`,icon:U,title:a.publicCardTitle,kind:O,statusLabel:k},t[8]=a.publicCardTitle,t[9]=O,t[10]=k,t[11]=A):A=t[11];let j=S?`active`:`off`,M=S?a.statusActive:a.statusOff,N;t[12]!==a.reverseProxyCardTitle||t[13]!==j||t[14]!==M?(N={tab:`reverse-proxy`,icon:te,title:a.reverseProxyCardTitle,kind:j,statusLabel:M},t[12]=a.reverseProxyCardTitle,t[13]=j,t[14]=M,t[15]=N):N=t[15];let P;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(P={tab:`ssh`,icon:H,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=P):P=t[18];let F;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(F={tab:`lan`,icon:L,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=F):F=t[21];let I;t[22]!==N||t[23]!==P||t[24]!==F||t[25]!==D||t[26]!==A?(I=[D,A,N,P,F],t[22]=N,t[23]=P,t[24]=F,t[25]=D,t[26]=A,t[27]=I):I=t[27];let R=I,z;return t[28]!==R||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:p(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Ce,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=R,t[29]=n,t[30]=z):z=t[30],z}function Te(e){return e.conversationId}function Ee(e){return e.language}function De(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=p(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let d;t[5]!==i||t[6]!==s?(d=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=d):d=t[7];let f;t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let m;t[11]===r?m=t[12]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=m);let h;t[13]!==f||t[14]!==m?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,m]}),t[13]=f,t[14]=m,t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(P,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=g):g=t[16];let _;return t[17]!==o||t[18]!==l||t[19]!==h?(_=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,h,g]}),t[17]=o,t[18]=l,t[19]=h,t[20]=_):_=t[20],_}function Oe(e){let t=(0,Q.c)(74),{onOpenTab:n}=e,r=h(je),i;t[0]===r?i=t[1]:(i=f(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!m(Ae),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=C(s?`exposure-status`:null,be,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let p=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(we,{onOpenTab:n}),t[7]=n,t[8]=g);let _;t[9]!==p||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(_=p.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:p.map(ke)})]}):null,t[9]=p,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=_):_=t[12];let v;t[13]===o.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==y?(b=(0,$.jsx)(De,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:y}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=y,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=()=>n(`public`),t[22]=n,t[23]=x);let S;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==x?(S=(0,$.jsx)(De,{icon:U,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:x}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=x,t[27]=S):S=t[27];let w;t[28]===n?w=t[29]:(w=()=>n(`reverse-proxy`),t[28]=n,t[29]=w);let T;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==w?(T=(0,$.jsx)(De,{icon:te,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:w}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=w,t[33]=T):T=t[33];let E;t[34]===n?E=t[35]:(E=()=>n(`ssh`),t[34]=n,t[35]=E);let D;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==E?(D=(0,$.jsx)(De,{icon:H,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:E}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=E,t[39]=D):D=t[39];let O;t[40]===n?O=t[41]:(O=()=>n(`lan`),t[40]=n,t[41]=O);let k;t[42]!==o.lanCardDesc||t[43]!==o.lanCardTitle||t[44]!==O?(k=(0,$.jsx)(De,{icon:L,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:O}),t[42]=o.lanCardDesc,t[43]=o.lanCardTitle,t[44]=O,t[45]=k):k=t[45];let A;t[46]!==S||t[47]!==T||t[48]!==D||t[49]!==k||t[50]!==b?(A=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[b,S,T,D,k]}),t[46]=S,t[47]=T,t[48]=D,t[49]=k,t[50]=b,t[51]=A):A=t[51];let j;t[52]!==A||t[53]!==v?(j=(0,$.jsxs)(`div`,{children:[v,A]}),t[52]=A,t[53]=v,t[54]=j):j=t[54];let M;t[55]===o.oneAtATimeHint?M=t[56]:(M=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[55]=o.oneAtATimeHint,t[56]=M);let N;t[57]===a.advanced.proxyTitle?N=t[58]:(N=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[57]=a.advanced.proxyTitle,t[58]=N);let P;t[59]===a.advanced.proxyBody?P=t[60]:(P=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[59]=a.advanced.proxyBody,t[60]=P);let F;t[61]!==r||t[62]!==a.advanced.proxyDocs?(F=(0,$.jsx)(de,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[61]=r,t[62]=a.advanced.proxyDocs,t[63]=F):F=t[63];let I;t[64]!==N||t[65]!==P||t[66]!==F?(I=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[N,P,F]}),t[64]=N,t[65]=P,t[66]=F,t[67]=I):I=t[67];let R;return t[68]!==j||t[69]!==M||t[70]!==I||t[71]!==g||t[72]!==_?(R=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,j,M,I]}),t[68]=j,t[69]=M,t[70]=I,t[71]=g,t[72]=_,t[73]=R):R=t[73],R}function ke(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Ae(e){return e.conversationId}function je(e){return e.language}function Me(){let e=(0,Q.c)(16),t=h(Ne),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(Y,{icon:L,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==a||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ce,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Ne(e){return e.language}function Pe(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=h(Fe),a;t[0]===i?a=t[1]:(a=f(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await S(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=p):p=t[3];let m,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),g=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=m,t[5]=g):(m=t[4],g=t[5]);let _=s?o.copied:o.copy,v;t[6]===_?v=t[7]:(v=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`ghost`,onClick:m,children:[g,_]})}),t[6]=_,t[7]=v);let y;t[8]!==r||t[9]!==o.hint?(y=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=y):y=t[10];let b;t[11]!==v||t[12]!==y?(b=(0,$.jsxs)($.Fragment,{children:[p,v,y]}),t[11]=v,t[12]=y,t[13]=b):b=t[13];let x=b;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Y,{icon:H,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===x?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:x}),t[17]=x,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ce,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let C;t[22]!==o.subtitle||t[23]!==o.title?(C=(0,$.jsx)(Y,{icon:H,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=C):C=t[24];let T;t[25]===x?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:x}),t[25]=x,t[26]=T);let E;return t[27]!==C||t[28]!==T?(E=(0,$.jsxs)(ce,{children:[C,T]}),t[27]=C,t[28]=T,t[29]=E):E=t[29],E}function Fe(e){return e.language}function Ie(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Pe,{embedded:!0}),e[0]=t):t=e[0],t}var Le=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Re(e){return e&&Le.includes(e)?e:`guide`}function ze(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,f]=(0,Z.useState)(c??!1),m;t[0]===s?m=t[1]:(m=p(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>f(Be),t[2]=h):h=t[2];let g=d&&`rotate-180`,_;t[3]===g?_=t[4]:(_=p(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[3]=g,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,$.jsx)(R,{className:_,"aria-hidden":!0}),t[5]=_,t[6]=v);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=d?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==d||t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:h,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[v,y,x]}),t[11]=d,t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=p(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==S||t[27]!==D||t[28]!==m?(O=(0,$.jsxs)(`section`,{className:m,children:[S,D]}),t[26]=S,t[27]=D,t[28]=m,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(xe,{children:k}),t[30]=k,t[31]=e),e}return k}function Be(e){return!e}function Ve(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,f]=(0,Z.useState)(!1),m;t[0]===u?m=t[1]:(m=e=>{e||(f(!1),u())},t[0]=u,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(g,{className:p(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,O)}),t[2]=h):h=t[2];let S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=p(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`,D),t[3]=S):S=t[3];let C;t[4]===r?C=t[5]:(C=(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=C);let T;t[6]===i?T=t[7]:(T=(0,$.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=T);let E;t[8]===a?E=t[9]:(E=a.map(He),t[8]=a,t[9]=E);let k;t[10]===E?k=t[11]:(k=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:E}),t[10]=E,t[11]=k);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>f(e.target.checked),t[12]=A):A=t[12];let j;t[13]===d?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:A}),t[13]=d,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(w,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=P):P=t[22];let F=!d,I;t[23]!==s||t[24]!==l||t[25]!==F?(I=(0,$.jsx)(w,{type:`button`,disabled:F,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==C||t[33]!==T||t[34]!==k?(R=(0,$.jsxs)(v,{children:[h,(0,$.jsxs)(y,{className:S,onOpenAutoFocus:Ue,children:[C,T,k,N,L]})]}),t[30]=N,t[31]=L,t[32]=C,t[33]=T,t[34]=k,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==m||t[38]!==R?(z=(0,$.jsx)(x,{open:n,onOpenChange:m,children:R}),t[36]=n,t[37]=m,t[38]=R,t[39]=z):z=t[39],z}function He(e){return(0,$.jsx)(`li`,{children:e},e)}function Ue(e){return e.preventDefault()}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ge=[`preparing_frpc`,`registering`,`starting_frpc`];function Ke(e){return e?e===`reconnecting_frpc`?Ge.indexOf(`starting_frpc`):Ge.indexOf(e):-1}function qe(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Ge.indexOf(e),i=Ke(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Je(e,t,n){let r=n.startProgress;return qe(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ye(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Xe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Ze(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(Qe),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,f,m,h;if(t[6]!==n||t[7]!==r){let e=Xe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(f=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=f):f=t[19];let o=Ge.map(e=>{let t=qe(e,n),i=Je(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(N,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:p(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ye(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:p(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[We(n.frpcDownload.bytesReceived),` /`,` `,We(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=f,t[11]=m,t[12]=h}else l=t[8],u=t[9],f=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==f||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[f,m,h,g]}),t[25]=u,t[26]=f,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function Qe(e){return e+1}function $e(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function et(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function tt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function nt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function rt(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:f,startDisabledReason:m,stepLabel:h,onStart:g,onStop:_}=e,v=f===void 0?!1:f,y,b,x,S,C,T,E;t[0]!==r||t[1]!==o?(E=et(r),y=r.enabled||o,b=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=p(se(),`space-y-4`),t[9]=T):T=t[9],C=`flex flex-wrap items-start justify-between gap-3`,S=`flex items-center gap-2`,x=p(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,tt(E)),t[0]=r,t[1]=o,t[2]=y,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=T,t[8]=E):(y=t[2],b=t[3],x=t[4],S=t[5],C=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,j;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(j=p(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===j?M=t[16]:(M=(0,$.jsx)(`span`,{className:j,"aria-hidden":!0}),t[15]=j,t[16]=M);let N;t[17]!==i||t[18]!==r||t[19]!==n?(N=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):$e(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=N):N=t[20];let P;t[21]!==M||t[22]!==N||t[23]!==x?(P=(0,$.jsxs)(`span`,{className:x,children:[M,N]}),t[21]=M,t[22]=N,t[23]=x,t[24]=P):P=t[24];let F;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(F=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,nt(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=F):F=t[28];let I;t[29]!==P||t[30]!==F||t[31]!==S?(I=(0,$.jsxs)(`div`,{className:S,children:[P,F]}),t[29]=P,t[30]=F,t[31]=S,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(u,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=L):L=t[33];let R;t[34]!==I||t[35]!==C?(R=(0,$.jsxs)(`div`,{className:C,children:[I,L]}),t[34]=I,t[35]=C,t[36]=R):R=t[36];let z;t[37]===a?z=t[38]:(z=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=z);let B;t[39]!==c||t[40]!==n.consentExpiredBanner?(B=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=B):B=t[41];let V;t[42]!==y||t[43]!==l||t[44]!==g||t[45]!==_||t[46]!==b||t[47]!==r||t[48]!==v||t[49]!==m||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(V=y?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(K,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,b?(0,$.jsx)(Ze,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:s,onClick:_,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(w,{type:`button`,disabled:o,onClick:g,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(q,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:h}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),v&&m?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:m}):null,(0,$.jsxs)(w,{type:`button`,disabled:o||v,onClick:g,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(q,{className:`size-4`}),n.start]})]}),t[42]=y,t[43]=l,t[44]=g,t[45]=_,t[46]=b,t[47]=r,t[48]=v,t[49]=m,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=V):V=t[54];let ee;return t[55]!==R||t[56]!==z||t[57]!==B||t[58]!==V||t[59]!==T?(ee=(0,$.jsxs)(`section`,{className:T,children:[R,z,B,V]}),t[55]=R,t[56]=z,t[57]=B,t[58]=V,t[59]=T,t[60]=ee):ee=t[60],ee}var it={reconfiguring:!1};function at(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:f,brokerSecretNotice:m,copyFailedLabel:h,onDraftChange:g,onSave:_,onAuthorize:v,onClear:y,sectionRef:b}=e,x=(0,Z.useId)(),S=r,C=!S,[T,E]=(0,Z.useReducer)(ee,it),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let N=A,P;t[9]===o?P=t[10]:(P=o.trim().length>0&&!j(o.trim()),t[9]=o,t[10]=P);let I=P,L;t[11]===g?L=t[12]:(L=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),g(``)},t[11]=g,t[12]=L);let R=L,z=C&&`ring-1 ring-amber-500/30`,B;t[13]===z?B=t[14]:(B=p(z),t[13]=z,t[14]=B);let V=S?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:C?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,H;t[15]===V?H=t[16]:(H=p(`flex size-9 shrink-0 items-center justify-center rounded-lg`,V),t[15]=V,t[16]=H);let U;t[17]===S?U=t[18]:(U=S?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(F,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=S,t[18]=U);let W;t[19]!==H||t[20]!==U?(W=(0,$.jsx)(`span`,{className:H,children:U}),t[19]=H,t[20]=U,t[21]=W):W=t[21];let te=S?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,G;t[22]===te?G=t[23]:(G=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:te}),t[22]=te,t[23]=G);let ne=S?n.brokerSecretReadyHint:n.brokerSecretHint,K;t[24]===ne?K=t[25]:(K=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:ne}),t[24]=ne,t[25]=K);let q;t[26]!==C||t[27]!==n.brokerSecretMissingHint?(q=C?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=C,t[27]=n.brokerSecretMissingHint,t[28]=q):q=t[28];let re;t[29]!==G||t[30]!==K||t[31]!==q?(re=(0,$.jsxs)(`div`,{children:[G,K,q]}),t[29]=G,t[30]=K,t[31]=q,t[32]=re):re=t[32];let ie;t[33]!==u||t[34]!==C||t[35]!==v||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(ie=C||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||u,onClick:v,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:ve,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=C,t[35]=v,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=ie):ie=t[41];let J;t[42]!==u||t[43]!==f||t[44]!==n.brokerSecretOpenAuthorization?(J=u&&f?(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=f,t[44]=n.brokerSecretOpenAuthorization,t[45]=J):J=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==I||t[50]!==R||t[51]!==h||t[52]!==x||t[53]!==C||t[54]!==y||t[55]!==g||t[56]!==_||t[57]!==D||t[58]!==c||t[59]!==N||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(ae=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(M,{id:x,value:a,labels:N,reveal:ot,loadFailedLabel:h||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(M,{id:x,value:o,onChange:g,placeholder:n.brokerSecretPlaceholder,labels:N,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||!I,onClick:_,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,C?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear}):null,D?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:R,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=I,t[50]=R,t[51]=h,t[52]=x,t[53]=C,t[54]=y,t[55]=g,t[56]=_,t[57]=D,t[58]=c,t[59]=N,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=ae):ae=t[71];let oe;t[72]===m?oe=t[73]:(oe=m?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:m}):null,t[72]=m,t[73]=oe);let Y;t[74]!==re||t[75]!==ie||t[76]!==J||t[77]!==ae||t[78]!==oe?(Y=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[re,ie,J,ae,oe]}),t[74]=re,t[75]=ie,t[76]=J,t[77]=ae,t[78]=oe,t[79]=Y):Y=t[79];let se;t[80]!==W||t[81]!==Y?(se=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[W,Y]}),t[80]=W,t[81]=Y,t[82]=se):se=t[82];let le;t[83]!==se||t[84]!==B?(le=(0,$.jsx)(ce,{className:B,children:se}),t[83]=se,t[84]=B,t[85]=le):le=t[85];let ue;return t[86]!==b||t[87]!==le?(ue=(0,$.jsx)(`div`,{ref:b,id:`tunnel-broker-secret-setup`,children:le}),t[86]=b,t[87]=le,t[88]=ue):ue=t[88],ue}function ot(){return X().then(st)}function st(e){return e.registrationSecret??null}var ct={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function lt({embedded:e=!1}){let t=h(e=>e.language),n=f(t).tunnelSettings,r=!!m(e=>e.conversationId),[i,a]=(0,Z.useReducer)(ee,ct),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:g,autoStartConfirmOpen:_,releaseConfirmOpen:v,releasing:y,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O}=i,k=(0,Z.useRef)(null),{data:M}=E(r),{data:N,error:P,isLoading:F,mutate:L}=C(r?`tunnel-status`:null,he,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),R=(0,Z.useMemo)(()=>{let e=M?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return N?.config?.autoStart===!0},[M,N?.config?.autoStart]),H=(0,Z.useMemo)(()=>{let e=M?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[M]),U=j(H),W=N?.registrationSecret?.configured??U;(0,Z.useEffect)(()=>{let e=()=>{L()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[L]);let te=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await _e(),await L(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[L]),K=(0,Z.useCallback)(()=>{if(!W){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),k.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(N?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}G()},[W,N?.consentRequired,G,n.brokerSecretRequiredBeforeStart]),q=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await ue(),await Promise.all([L(),G()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[L,G]),ie=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await fe(),await L(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[L]),J=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ge({autoStart:e}),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),ae=(0,Z.useCallback)(()=>{if(R){J(!1);return}if(N?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!N?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[J,N?.canAutoStart,N?.consentRequired,n,R]),oe=(0,Z.useCallback)(async()=>{let e=b.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),T(),await L(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[b,L,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),T(),await L()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[L,n.brokerSecretCleared]),se=(0,Z.useCallback)(async()=>{let e=A(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await I(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await V(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await ne(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await me(),await Promise.all([L(),T()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{B(e),t&&z(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[L,n.brokerSecretSaved]),le=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await fe({release:!0}),await L(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[L]),pe=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:f(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=N??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:R,brokerUrl:`https://frp.xopc.ai/api`}},ve=N?.consentRequired&&(X.enabled||R||N?.consent?.acceptedAt),ye=(0,$.jsx)(at,{t:n,brokerSecretReady:W,brokerSecretConfiguredInConfig:U,brokerSecretMaskedValue:U?H:``,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O,copyFailedLabel:f(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void se(),onClear:()=>void Y(),sectionRef:k}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ve,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:te,checkboxLabel:n.consentCheckbox,confirmLabel:ve?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void q(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(re,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),J(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(re,{open:v,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void le(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:F,statusErr:P,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:pe,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:K,onStop:()=>void ie()}),(0,$.jsxs)(ze,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:p(`flex items-center gap-3 text-sm text-fg`,!R&&!N?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:R,disabled:l||!R&&!N?.canAutoStart,onChange:ae}),n.autoStart]}),!N?.canAutoStart&&!R?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(ze,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:F,statusErr:P,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:pe,startDisabled:!W,startDisabledReason:W?void 0:n.brokerSecretRequiredBeforeStart,onStart:K,onStop:()=>void ie()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ce,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:p(`flex items-center gap-3 text-sm text-fg`,!R&&!N?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:R,disabled:l||!R&&!N?.canAutoStart,onChange:ae}),n.autoStart]}),!N?.canAutoStart&&!R?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ut(e,t){return e.tabs[t]}function dt(e,t){return e.tabIntro[t]}function ft(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function pt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Oe,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ye,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(lt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(le,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ie,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Me,{}),t[6]=e):e=t[6],e}}}function mt(){let e=(0,Q.c)(3),t=i(),n=h(gt),r=f(n).remoteAccess,o=!!m(ht),[s,c]=a(),l=Re(s.get(`tab`)),u=s.get(`intent`)===`mobile-pairing`,d;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:2e3},e[0]=d):d=e[0];let p=C(u?`device-pairing-readiness`:null,pe,d),g;e[1]===c?g=e[2]:(g=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=g);let _=g,v=dt(r,l),y=Le.map(e=>({id:e,label:ut(r,e)}));return(0,$.jsxs)(ae,{children:[(0,$.jsx)(J,{title:r.pageTitle,meta:(0,$.jsx)(de,{language:n,label:r.docsLink,section:ft(l),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(G,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:p.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(w,{variant:`primary`,disabled:!p.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[p.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ie,{items:y,activeTab:l,onChange:_,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(oe,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ut(r,l),hint:l===`public`?void 0:v,showHeading:!1,framed:!1,children:(0,$.jsx)(pt,{tab:l,onOpenTab:_})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function ht(e){return e.conversationId}function gt(e){return e.language}export{mt as RemoteAccessHub};