@xopcai/xopc 0.0.399 → 0.0.401

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 (382) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/pairing/feishu-pairing-prompt.js +2 -2
  3. package/dist/extensions/feishu/src/plugin.js +2 -2
  4. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +1 -1
  5. package/dist/extensions/feishu/src/transport/webhook/monitor.js +1 -1
  6. package/dist/extensions/feishu/src/workflow-progress.js +1 -1
  7. package/dist/extensions/telegram/src/adapters/outbound-adapter.js +1 -1
  8. package/dist/extensions/telegram/src/adapters/security-adapter.js +1 -1
  9. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +2 -2
  10. package/dist/extensions/telegram/src/command-handler.js +1 -1
  11. package/dist/extensions/telegram/src/doctor.js +2 -2
  12. package/dist/extensions/telegram/src/draft-stream.js +1 -1
  13. package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
  14. package/dist/extensions/telegram/src/focus-handler.js +1 -1
  15. package/dist/extensions/telegram/src/inbound-processor.js +6 -6
  16. package/dist/extensions/telegram/src/outbound-sender.js +3 -3
  17. package/dist/extensions/telegram/src/pairing-config-resolver.js +1 -1
  18. package/dist/extensions/telegram/src/plugin.js +24 -24
  19. package/dist/extensions/telegram/xopc.extension.json +1 -1
  20. package/dist/extensions/weixin/src/api/api.js +1 -1
  21. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  22. package/dist/extensions/weixin/src/pairing-config-resolver.js +1 -1
  23. package/dist/extensions/weixin/src/plugin.js +2 -2
  24. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CpQYvwOW.js → agent-avatar-dicebear-ByXMoFsY.js} +1 -1
  25. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BQxtFjlw.js → agent-defaults-settings-panel-DTWNXsbp.js} +1 -1
  26. package/dist/gateway/static/root/assets/{agents-AuBMS_Pf.js → agents-CaB8tdC-.js} +3 -3
  27. package/dist/gateway/static/root/assets/{app-management-settings-panel-QMCJPUuH.js → app-management-settings-panel-X9szJlYD.js} +1 -1
  28. package/dist/gateway/static/root/assets/{appearance-settings-BGPmyRLn.js → appearance-settings-BfE1yedW.js} +1 -1
  29. package/dist/gateway/static/root/assets/{apps-page-DtqV9r9m.js → apps-page-B4temKvg.js} +1 -1
  30. package/dist/gateway/static/root/assets/{archive-plugin-H2rWTIwC.js → archive-plugin-PQHi2w72.js} +1 -1
  31. package/dist/gateway/static/root/assets/{automations-page-jENavthQ.js → automations-page-KIyLxqyX.js} +1 -1
  32. package/dist/gateway/static/root/assets/{automations-workspace-CImof0cA.js → automations-workspace-C99c2Mps.js} +1 -1
  33. package/dist/gateway/static/root/assets/{binary-plugins-DPyR9xd5.js → binary-plugins-DPDgIi0y.js} +1 -1
  34. package/dist/gateway/static/root/assets/{block-editor-LrMWBpSq.js → block-editor-BL6uYJRu.js} +1 -1
  35. package/dist/gateway/static/root/assets/{browser-automation-inputs-CyjyiwCe.js → browser-automation-inputs-BMe7eqyS.js} +1 -1
  36. package/dist/gateway/static/root/assets/{browser-automations-page-BwuUYfOv.js → browser-automations-page-Cxy3o5SG.js} +1 -1
  37. package/dist/gateway/static/root/assets/{browser-settings-page-C2B2U1px.js → browser-settings-page-Dn-LW9q4.js} +1 -1
  38. package/dist/gateway/static/root/assets/{capabilities-page-D95AkBeY.js → capabilities-page-CHWxG2ns.js} +2 -2
  39. package/dist/gateway/static/root/assets/{capabilities-settings-panel-Dibaaecx.js → capabilities-settings-panel-Da9ak03p.js} +1 -1
  40. package/dist/gateway/static/root/assets/{capability-header-actions-DIAfw_sB.js → capability-header-actions-WRaPQFq0.js} +1 -1
  41. package/dist/gateway/static/root/assets/{channels-BDsCl-WU.js → channels-Cx2WkRWN.js} +1 -1
  42. package/dist/gateway/static/root/assets/{chat-terminal-dock-B_JFEyRy.js → chat-terminal-dock-63FqSsS_.js} +1 -1
  43. package/dist/gateway/static/root/assets/{computer-settings-page-B2vSOHPO.js → computer-settings-page-Cr6u_6gd.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connector-service-page-D2cCQJWy.js → connector-service-page-FJwMon8U.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connectors-page-C9t9v36q.js → connectors-page-BBH388aG.js} +1 -1
  46. package/dist/gateway/static/root/assets/{date-picker-BYz1BvpE.js → date-picker-D5Xit3eb.js} +1 -1
  47. package/dist/gateway/static/root/assets/{dependency-picker-B5onlFRJ.js → dependency-picker-1aJOOQPo.js} +1 -1
  48. package/dist/gateway/static/root/assets/{desktop-pet-IsOXKVI4.js → desktop-pet-ggDJ99Z6.js} +1 -1
  49. package/dist/gateway/static/root/assets/{desktop-pet-settings-BZhPDsCp.js → desktop-pet-settings-ChfLbqqO.js} +1 -1
  50. package/dist/gateway/static/root/assets/{device-pairing-wizard-Hf-xMRH5.js → device-pairing-wizard-3OvOHf6N.js} +1 -1
  51. package/dist/gateway/static/root/assets/{directory-picker-path-field-C7mO36eo.js → directory-picker-path-field-ummF1SFe.js} +1 -1
  52. package/dist/gateway/static/root/assets/{extension-debug-page-BkSnNO_a.js → extension-debug-page-SmrPvYO6.js} +1 -1
  53. package/dist/gateway/static/root/assets/{extension-page-CTXu0lgl.js → extension-page-CGVGUA3i.js} +1 -1
  54. package/dist/gateway/static/root/assets/{extension-settings-page-DzsZI4dz.js → extension-settings-page-nns2sDcu.js} +1 -1
  55. package/dist/gateway/static/root/assets/{gateway-settings-DDfLdRFy.js → gateway-settings-CFhtbGZh.js} +1 -1
  56. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-Dy3ktsqG.js → highlighted-body-KQOG7T2V-BOfrdIh2.js} +1 -1
  57. package/dist/gateway/static/root/assets/{home-page-Cw0YZFEE.js → home-page-GtF10ylS.js} +1 -1
  58. package/dist/gateway/static/root/assets/{image-generation-api-CsX0tJA9.js → image-generation-api-D0EUiJdS.js} +1 -1
  59. package/dist/gateway/static/root/assets/{imports-page-BnaJaGsz.js → imports-page-CoQLVDRZ.js} +1 -1
  60. package/dist/gateway/static/root/assets/{index-dViajQ_4.js → index-Cmrvxc_s.js} +8 -8
  61. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B0-L_-9C.js → keyboard-shortcuts-settings-Big_fVjG.js} +1 -1
  62. package/dist/gateway/static/root/assets/{local-app-workbench-page-DCU-MUm0.js → local-app-workbench-page-BQq4v2h9.js} +1 -1
  63. package/dist/gateway/static/root/assets/{local-apps-page-CYB-jS8K.js → local-apps-page-BEJLnf07.js} +1 -1
  64. package/dist/gateway/static/root/assets/{logs-page-Dd_Miu5W.js → logs-page-t85fyv9m.js} +1 -1
  65. package/dist/gateway/static/root/assets/{management-settings-EhbGOA7d.js → management-settings-BNah9d9e.js} +1 -1
  66. package/dist/gateway/static/root/assets/{media-plugins-Gg2S_-0J.js → media-plugins-DJBhcY1R.js} +1 -1
  67. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CILrbgBf.js +1 -0
  68. package/dist/gateway/static/root/assets/{note-detail-panel-b0LhcM8E.js → note-detail-panel-C2lBQc4t.js} +3 -3
  69. package/dist/gateway/static/root/assets/{notes-page-CrrJhf22.js → notes-page-WnkqzfLz.js} +1 -1
  70. package/dist/gateway/static/root/assets/{page-context-capture-button-CVkaHzKp.js → page-context-capture-button-BJVRA9-x.js} +1 -1
  71. package/dist/gateway/static/root/assets/{personal-page-C5bS9Zox.js → personal-page-Cm2wT4by.js} +1 -1
  72. package/dist/gateway/static/root/assets/{plugin-details-dialog-BEmOUy9T.js → plugin-details-dialog-BWEc8nwk.js} +1 -1
  73. package/dist/gateway/static/root/assets/{plugin-presentation-B9Am-_vW.js → plugin-presentation-BcZHPy_6.js} +1 -1
  74. package/dist/gateway/static/root/assets/{preview-open-alternatives-BsblzqIi.js → preview-open-alternatives-DKLblfvY.js} +1 -1
  75. package/dist/gateway/static/root/assets/{product-open-page-OZZTYmjY.js → product-open-page-CMMI-Lvy.js} +1 -1
  76. package/dist/gateway/static/root/assets/{product-preview-content-BECp_NcY.js → product-preview-content-Dik_ORgj.js} +1 -1
  77. package/dist/gateway/static/root/assets/{project-detail-page-BIXCksxe.js → project-detail-page-RnKTj04F.js} +1 -1
  78. package/dist/gateway/static/root/assets/{projects-page-XzE2Lrf2.js → projects-page-BhTpBKMy.js} +1 -1
  79. package/dist/gateway/static/root/assets/{remote-access-hub-DdeFnheH.js → remote-access-hub-LUQUvC84.js} +1 -1
  80. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DTEruUBq.js → runtime-tools-settings-panel-Bo4YiO7D.js} +1 -1
  81. package/dist/gateway/static/root/assets/{schema-form-v4qyepTr.js → schema-form-B3bVaQx1.js} +1 -1
  82. package/dist/gateway/static/root/assets/{sessions-page-D6ff4Ntg.js → sessions-page-fseCCI6W.js} +1 -1
  83. package/dist/gateway/static/root/assets/settings-advanced-gate-CBn8SVz7.js +1 -0
  84. package/dist/gateway/static/root/assets/{settings-form-section-Bg4VGpOS.js → settings-form-section-vezTIqZ6.js} +1 -1
  85. package/dist/gateway/static/root/assets/{settings-page-DWnJiiZ3.js → settings-page-DC4NPD9q.js} +1 -1
  86. package/dist/gateway/static/root/assets/{setup-status-panel-ShBGdTLC.js → setup-status-panel-B7__vDF3.js} +1 -1
  87. package/dist/gateway/static/root/assets/{share-preview-page-CajYPnal.js → share-preview-page-rXG53c7x.js} +1 -1
  88. package/dist/gateway/static/root/assets/{shares-settings-CbkMauXr.js → shares-settings-8trvsXe5.js} +1 -1
  89. package/dist/gateway/static/root/assets/{skill-api-CViUmvY5.js → skill-api-DS7l6xfp.js} +1 -1
  90. package/dist/gateway/static/root/assets/{skill-reload-api-BBJFG6Sa.js → skill-reload-api-B5xkDw4T.js} +1 -1
  91. package/dist/gateway/static/root/assets/{skills-page-Xz71fZ-2.js → skills-page-DANnetBA.js} +1 -1
  92. package/dist/gateway/static/root/assets/{style-C06V_QkC.js → style-DMaxcb-J.js} +1 -1
  93. package/dist/gateway/static/root/assets/{system-settings-panel-ygHZouKG.js → system-settings-panel-x1QJgZjs.js} +1 -1
  94. package/dist/gateway/static/root/assets/{task-detail-page-yrk_lymf.js → task-detail-page-CKYCAG5-.js} +1 -1
  95. package/dist/gateway/static/root/assets/{tracing-settings-page-BpwIY_cs.js → tracing-settings-page-BcLJq6Jq.js} +1 -1
  96. package/dist/gateway/static/root/assets/{tunnel-api-DJwLyVlX.js → tunnel-api-GdTAmuHs.js} +1 -1
  97. package/dist/gateway/static/root/assets/{usage-page-B7nIyRrc.js → usage-page-DgOCrgPr.js} +1 -1
  98. package/dist/gateway/static/root/assets/{use-autosave-CYG5ELoQ.js → use-autosave-BZw6SkOF.js} +1 -1
  99. package/dist/gateway/static/root/assets/{user-model-page-BYt2yFNk.js → user-model-page-BTIjtFxG.js} +1 -1
  100. package/dist/gateway/static/root/assets/{voice-api-key-field-CTvb35O3.js → voice-api-key-field-D1R1yQNb.js} +1 -1
  101. package/dist/gateway/static/root/assets/{work-discovery-overlay-DQJpheuI.js → work-discovery-overlay-R2dBw9bp.js} +1 -1
  102. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BDK1g07U.js → workflow-run-setup-panel-CtqK25lT.js} +1 -1
  103. package/dist/gateway/static/root/assets/{workflows-page-DFsw6QAX.js → workflows-page-C01mllUo.js} +1 -1
  104. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CbASlMPP.js → xopc-cloud-account-card-BjPp3a2X.js} +1 -1
  105. package/dist/gateway/static/root/index.html +1 -1
  106. package/dist/package.js +1 -1
  107. package/dist/src/activity/emitter.js +1 -1
  108. package/dist/src/agent/agent-manager.d.ts +1 -0
  109. package/dist/src/agent/agent-manager.js +14 -10
  110. package/dist/src/agent/background-review/run-background-review.js +4 -4
  111. package/dist/src/agent/coding/repository-instructions.js +1 -1
  112. package/dist/src/agent/coding/workspace-revision.js +2 -2
  113. package/dist/src/agent/context/workspace.js +1 -1
  114. package/dist/src/agent/data-acquisition/service.js +1 -1
  115. package/dist/src/agent/embedded/codemode-output.js +1 -1
  116. package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
  117. package/dist/src/agent/embedded/model-runtime.js +1 -1
  118. package/dist/src/agent/embedded/run-for-session.js +8 -2
  119. package/dist/src/agent/embedded/run-turn.js +2 -2
  120. package/dist/src/agent/embedded/xopc-stream-bridge.js +3 -3
  121. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  122. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  123. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  124. package/dist/src/agent/external-tools/index.js +1 -1
  125. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  126. package/dist/src/agent/image/generation/providers/xopc-cloud.js +2 -2
  127. package/dist/src/agent/image/load-image-media.js +1 -1
  128. package/dist/src/agent/image/tool-model-config.js +1 -1
  129. package/dist/src/agent/independent-execution.js +1 -1
  130. package/dist/src/agent/mcp/connection-drafts.js +1 -1
  131. package/dist/src/agent/mcp/credential-store-modules.d.ts +5 -0
  132. package/dist/src/agent/mcp/credential-store-modules.js +13 -0
  133. package/dist/src/agent/mcp/credential-store.js +2 -3
  134. package/dist/src/agent/sandbox/path-policy.js +1 -1
  135. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  136. package/dist/src/agent/service.js +4 -4
  137. package/dist/src/agent/skills/hub-pull.js +2 -2
  138. package/dist/src/agent/skills/index.js +1 -1
  139. package/dist/src/agent/skills/installer.js +3 -3
  140. package/dist/src/agent/skills/skill-manager.js +2 -1
  141. package/dist/src/agent/skills/skill-sources.js +10 -5
  142. package/dist/src/agent/skills/test-framework.js +1 -1
  143. package/dist/src/agent/tasks/task-judge-service.js +1 -1
  144. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  145. package/dist/src/agent/tool-manuals/computer.js +2 -2
  146. package/dist/src/agent/tools/computer-use-tool.js +9 -3
  147. package/dist/src/agent/tools/executor.js +1 -1
  148. package/dist/src/agent/tools/factory.js +1 -1
  149. package/dist/src/agent/tools/personal-read-tool.js +2 -2
  150. package/dist/src/agent/tools/read.js +1 -1
  151. package/dist/src/agent/tools/review-workspace.js +1 -1
  152. package/dist/src/agent/tools/send-media.js +1 -1
  153. package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
  154. package/dist/src/agent/tools/write.js +1 -1
  155. package/dist/src/agent/tools/xopc-use-tool.js +5 -5
  156. package/dist/src/agent-catalog/capabilities.js +2 -2
  157. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +3 -3
  158. package/dist/src/agent-catalog/repository.js +3 -3
  159. package/dist/src/auth/oauth-provider-lock.js +1 -1
  160. package/dist/src/automations/capabilities/drafts.js +1 -1
  161. package/dist/src/backup/archive.js +2 -2
  162. package/dist/src/bootstrap/application-state.js +1 -1
  163. package/dist/src/browser/cache-dir-policy.js +1 -1
  164. package/dist/src/browser/native-messaging-host.js +1 -1
  165. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  166. package/dist/src/capabilities/readiness/from-config.js +2 -2
  167. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  168. package/dist/src/capabilities/runtime/product.js +1 -1
  169. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  170. package/dist/src/channels/format.js +1 -1
  171. package/dist/src/channels/index.js +3 -3
  172. package/dist/src/channels/pairing/pairing-service.js +1 -1
  173. package/dist/src/chat-commands/builtins/config.js +2 -2
  174. package/dist/src/chat-commands/builtins/session.js +1 -1
  175. package/dist/src/chat-commands/context.js +2 -2
  176. package/dist/src/chat-commands/index.js +1 -1
  177. package/dist/src/cli/commands/agent.js +1 -1
  178. package/dist/src/cli/commands/agents.js +1 -1
  179. package/dist/src/cli/commands/channels.js +2 -2
  180. package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -1
  181. package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
  182. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  183. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  184. package/dist/src/cli/commands/extension-marketplace.js +3 -3
  185. package/dist/src/cli/commands/extension-pack.js +1 -1
  186. package/dist/src/cli/commands/mcp.js +1 -1
  187. package/dist/src/cli/commands/models.js +3 -3
  188. package/dist/src/cli/commands/onboard/model.js +3 -3
  189. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  190. package/dist/src/computer/broker.js +1 -1
  191. package/dist/src/computer/diagnostics.js +1 -0
  192. package/dist/src/computer/errors.js +1 -0
  193. package/dist/src/computer/flows.js +1 -1
  194. package/dist/src/computer/runtime.d.ts +23 -0
  195. package/dist/src/computer/runtime.js +92 -9
  196. package/dist/src/config/agent-model-intents.js +1 -1
  197. package/dist/src/config/agent-profile.js +1 -1
  198. package/dist/src/config/index.js +4 -4
  199. package/dist/src/config/loader.js +1 -1
  200. package/dist/src/config/models-json.js +1 -1
  201. package/dist/src/config/paths-state.js +1 -1
  202. package/dist/src/config/schema.js +7 -7
  203. package/dist/src/config/workspace-path.js +1 -1
  204. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  205. package/dist/src/connectors/content-enrichment.js +1 -1
  206. package/dist/src/daemon/constants.js +1 -1
  207. package/dist/src/daemon/install-plan.js +1 -1
  208. package/dist/src/daemon/launchd.js +1 -1
  209. package/dist/src/daemon/schtasks.js +1 -1
  210. package/dist/src/daemon/systemd.js +1 -1
  211. package/dist/src/discussions/action-tasks.js +1 -1
  212. package/dist/src/discussions/live-worker.js +2 -2
  213. package/dist/src/discussions/recording.js +1 -1
  214. package/dist/src/discussions/repository.js +1 -1
  215. package/dist/src/discussions/sealer.js +2 -2
  216. package/dist/src/discussions/service.js +1 -1
  217. package/dist/src/execution-environments/worktree-safety.js +1 -1
  218. package/dist/src/extensions/activation-context.js +2 -2
  219. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  220. package/dist/src/extensions/agent-plugins/capability-access.d.ts +23 -0
  221. package/dist/src/extensions/agent-plugins/capability-access.js +101 -0
  222. package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +1 -0
  223. package/dist/src/extensions/agent-plugins/cli-authorization.js +2 -2
  224. package/dist/src/extensions/agent-plugins/inventory.js +1 -1
  225. package/dist/src/extensions/agent-plugins/mcp-adapter.js +5 -5
  226. package/dist/src/extensions/agent-plugins/refresh-runtime-access.d.ts +3 -0
  227. package/dist/src/extensions/agent-plugins/refresh-runtime-access.js +36 -0
  228. package/dist/src/extensions/agent-plugins/setup-contract.d.ts +1 -0
  229. package/dist/src/extensions/agent-plugins/setup-contract.js +1 -0
  230. package/dist/src/extensions/agent-plugins/setup.d.ts +4 -1
  231. package/dist/src/extensions/agent-plugins/setup.js +70 -37
  232. package/dist/src/extensions/agent-plugins/skill-catalog.js +2 -2
  233. package/dist/src/extensions/agent-plugins/source-catalog.js +1 -1
  234. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  235. package/dist/src/extensions/agent-plugins/sources.js +1 -1
  236. package/dist/src/extensions/agent-plugins/store.d.ts +1 -0
  237. package/dist/src/extensions/agent-plugins/store.js +10 -3
  238. package/dist/src/extensions/agent-plugins/validation.js +12 -2
  239. package/dist/src/extensions/api.js +1 -1
  240. package/dist/src/extensions/install.js +1 -1
  241. package/dist/src/extensions/loader.js +1 -1
  242. package/dist/src/extensions/sdk/index.js +1 -1
  243. package/dist/src/extensions/update.js +1 -1
  244. package/dist/src/gateway/agents-admin.js +2 -2
  245. package/dist/src/gateway/file-path-classifier.js +2 -2
  246. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  247. package/dist/src/gateway/hono/lib/static-ui.js +1 -1
  248. package/dist/src/gateway/hono/routes/agent-plugins.js +2 -2
  249. package/dist/src/gateway/hono/routes/agents.js +1 -1
  250. package/dist/src/gateway/hono/routes/browser.js +1 -1
  251. package/dist/src/gateway/hono/routes/channels.js +1 -1
  252. package/dist/src/gateway/hono/routes/config-patch/misc.js +6 -6
  253. package/dist/src/gateway/hono/routes/discussions.js +1 -1
  254. package/dist/src/gateway/hono/routes/host-fs.js +1 -1
  255. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  256. package/dist/src/gateway/hono/routes/memory-learning.js +1 -1
  257. package/dist/src/gateway/hono/routes/models.js +6 -6
  258. package/dist/src/gateway/hono/routes/notes.js +3 -3
  259. package/dist/src/gateway/hono/routes/observability.js +1 -1
  260. package/dist/src/gateway/hono/routes/projects.js +3 -3
  261. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  262. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  263. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  264. package/dist/src/gateway/hono/routes/shares.js +1 -1
  265. package/dist/src/gateway/hono/routes/status.js +1 -1
  266. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  267. package/dist/src/gateway/hono/routes/voice.js +5 -5
  268. package/dist/src/gateway/image-generation-setup.js +3 -3
  269. package/dist/src/gateway/mobile-privacy.js +1 -1
  270. package/dist/src/gateway/provider-model-setup.js +1 -1
  271. package/dist/src/gateway/service/agent-runner.js +1 -1
  272. package/dist/src/gateway/service/config-coordinator.js +1 -1
  273. package/dist/src/gateway/service/marketplace-service.js +2 -2
  274. package/dist/src/gateway/service.js +12 -12
  275. package/dist/src/gateway/session-context-summary.js +1 -1
  276. package/dist/src/gateway/xopc-cloud-capability-setup.js +2 -2
  277. package/dist/src/home-intelligence/repository.js +1 -1
  278. package/dist/src/imports/importService.js +1 -1
  279. package/dist/src/imports/inventory.js +1 -1
  280. package/dist/src/imports/sources.js +1 -1
  281. package/dist/src/infra/brew.js +1 -1
  282. package/dist/src/infra/package-runtime-check.js +1 -1
  283. package/dist/src/infra/path-env.js +1 -1
  284. package/dist/src/infra/process-diagnostics.js +1 -1
  285. package/dist/src/infra/update-check.js +1 -1
  286. package/dist/src/local-apps/service.js +3 -3
  287. package/dist/src/markdown/index.js +1 -1
  288. package/dist/src/media/session-references.js +1 -1
  289. package/dist/src/media-shared/http/provider-http.js +1 -1
  290. package/dist/src/media-understanding/runner.js +1 -1
  291. package/dist/src/memory-learning/source-learning.js +2 -2
  292. package/dist/src/notes/agent-context.js +1 -1
  293. package/dist/src/notifications/store.js +1 -1
  294. package/dist/src/observability/runtime.js +1 -1
  295. package/dist/src/personal-agent/onboarding.d.ts +1 -1
  296. package/dist/src/personal-agent/proactivity/repository.js +2 -2
  297. package/dist/src/personal-agent/proactivity/service.js +2 -2
  298. package/dist/src/personal-agent/reply-composer.js +1 -1
  299. package/dist/src/personal-agent/request-delivery.js +1 -1
  300. package/dist/src/personal-agent/request-service.js +1 -1
  301. package/dist/src/personal-agent/result-reader.js +2 -2
  302. package/dist/src/personal-agent/service.js +3 -3
  303. package/dist/src/personal-agent/unread.js +1 -1
  304. package/dist/src/platform/index.js +1 -1
  305. package/dist/src/process/run-process.js +1 -1
  306. package/dist/src/project-trust/trust-store.js +1 -1
  307. package/dist/src/projects/workspace-project.js +1 -1
  308. package/dist/src/providers/extension-stream-bridge.js +1 -1
  309. package/dist/src/providers/index.js +4 -4
  310. package/dist/src/providers/model-call.js +3 -3
  311. package/dist/src/providers/model-catalog-persistence.js +1 -1
  312. package/dist/src/providers/model-registry.js +3 -3
  313. package/dist/src/providers/provider-disconnect-core.js +1 -1
  314. package/dist/src/providers/register-runtime-providers.js +1 -1
  315. package/dist/src/providers/setup/voice.js +1 -1
  316. package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
  317. package/dist/src/providers/xopc-cloud-credit-budget.js +1 -1
  318. package/dist/src/review/review-git.js +1 -1
  319. package/dist/src/session/store.js +1 -1
  320. package/dist/src/share/hosted-session-share.js +1 -1
  321. package/dist/src/share/share-zip.js +1 -1
  322. package/dist/src/share/site-proxy.js +1 -1
  323. package/dist/src/share/site-static-serve.js +1 -1
  324. package/dist/src/storage/sqlite/ai-usage-repository.js +1 -1
  325. package/dist/src/storage/sqlite/clarification-wait-repository.js +2 -2
  326. package/dist/src/storage/sqlite/connection.js +1 -1
  327. package/dist/src/storage/sqlite/conversation-repository.js +2 -2
  328. package/dist/src/storage/sqlite/device-access-repository.js +1 -1
  329. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  330. package/dist/src/storage/sqlite/migrations/runner.js +2 -2
  331. package/dist/src/storage/sqlite/session-creation-repository.js +1 -1
  332. package/dist/src/storage/sqlite/session-repository.js +1 -1
  333. package/dist/src/tasks/capabilities/management.js +1 -1
  334. package/dist/src/tasks/capabilities/read.js +2 -2
  335. package/dist/src/tasks/capabilities/relations.js +1 -1
  336. package/dist/src/tasks/capabilities/write.js +1 -1
  337. package/dist/src/tasks/task-allocation-service.js +3 -3
  338. package/dist/src/tasks/task-application-service.js +1 -1
  339. package/dist/src/tasks/task-context-assembler.js +2 -2
  340. package/dist/src/tasks/task-criterion-review-repository.js +1 -1
  341. package/dist/src/tasks/task-handoff-service.js +1 -1
  342. package/dist/src/tasks/task-handoff.js +2 -2
  343. package/dist/src/tasks/task-research-repair.js +1 -1
  344. package/dist/src/tasks/task-research-result.js +2 -2
  345. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  346. package/dist/src/tasks/task-result-delivery-service.js +1 -1
  347. package/dist/src/tasks/task-signal-service.js +1 -1
  348. package/dist/src/tui/backends/embedded-backend.js +6 -6
  349. package/dist/src/tui/clipboard-image.js +2 -2
  350. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  351. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  352. package/dist/src/tui/tui-startup-resources.js +2 -2
  353. package/dist/src/tui/tui.js +3 -3
  354. package/dist/src/tunnel/frpc-binary.js +1 -1
  355. package/dist/src/usage/cloud-capability.js +1 -1
  356. package/dist/src/usage/cloud-receipts.js +1 -1
  357. package/dist/src/usage/recorder.js +2 -2
  358. package/dist/src/user-context/access-policy.js +2 -2
  359. package/dist/src/utils/index.js +1 -1
  360. package/dist/src/utils/logger/index.js +1 -1
  361. package/dist/src/utils/logger.js +1 -1
  362. package/dist/src/voice/audio/normalize.js +1 -1
  363. package/dist/src/voice/platform-settings.js +1 -1
  364. package/dist/src/voice/realtime/memory-context.js +3 -3
  365. package/dist/src/voice/realtime/persona-context.js +1 -1
  366. package/dist/src/voice/realtime/runtime.js +2 -2
  367. package/dist/src/voice/stt/factory.js +1 -1
  368. package/dist/src/voice/stt/index.js +2 -2
  369. package/dist/src/voice/stt/preflight.js +2 -2
  370. package/dist/src/voice/stt/providers/bailian-plan-transcription.js +3 -3
  371. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +3 -3
  372. package/dist/src/voice/stt/transcribe-core.js +1 -1
  373. package/dist/src/voice/tts/factory.js +1 -1
  374. package/dist/src/voice/tts/providers/bailian-plan-speech.js +2 -2
  375. package/dist/src/voice/tts/providers/edge-speech.js +1 -1
  376. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +2 -2
  377. package/dist/src/work-discovery/candidate-discovery.js +2 -2
  378. package/dist/src/work-discovery/probe.js +2 -2
  379. package/dist/src/work-discovery/service.js +3 -3
  380. package/package.json +3 -3
  381. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B491wqqw.js +0 -1
  382. package/dist/gateway/static/root/assets/settings-advanced-gate-ewl9-rd5.js +0 -1
@@ -1 +1 @@
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-B2HK1psj.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./download-Dk-ZjtO6.js";import{t as f}from"./external-link-DjqjBmc3.js";import{F as p,V as m,t as h,z as g}from"./markdown-view-B58RypQ4.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./messages-DBvKzlCl.js";import{t as b}from"./cn-0WouolD0.js";import{a as x,c as S,f as C,n as w,r as T}from"./locale-store-Jnhw2WMv.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./dist-BGTk37IG.js";import{i as P,t as F}from"./tasks-PuIUgF9L.js";import{t as I}from"./copy-to-clipboard-HOJ79TWv.js";import{i as L}from"./vendor-swr-BIWyz7Rc.js";import{a as R}from"./attachment-utils-core-BIOUBrpT.js";import{o as z}from"./agents-admin-api-DvSe10zu.js";import{$d as B,$l as V,$n as H,A as U,Ad as W,Ao as G,Ba as ee,Bs as te,Cd as ne,Cf as K,Co as q,Cr as re,Cs as ie,Cu as ae,Df as oe,Dl as se,Do as ce,Dr as le,Ds as ue,Ed as de,Ef as fe,Eo as J,Er as pe,Es as me,Eu as he,Ga as ge,Gl as _e,Go as ve,Gu as ye,Ha as be,Hl as xe,Ir as Se,Iu as Ce,Ja as we,Jd as Te,Ka as Ee,Kl as De,Ld as Oe,Ni as ke,Nr as Ae,Oo as je,Qc as Me,Qu as Ne,Rc as Pe,Rl as Fe,Rn as Ie,Ru as Le,So as Re,Td as ze,Tl as Be,To as Ve,Tr as He,Ts as Ue,Ua as We,Ud as Ge,Ui as Ke,Wa as qe,Wc as Y,Wu as Je,Xa as Ye,Xc as Xe,Ya as Ze,Yc as Qe,Za as $e,Zl as et,Zs as tt,_ as nt,_o as rt,aa as it,ar as at,au as ot,bo as st,cf as ct,co as lt,dl as ut,ds as dt,er as ft,fa as pt,fd as mt,ff as ht,fl as gt,fr as _t,fs as vt,gd as yt,go as bt,gu as xt,hd as St,ho as Ct,id as wt,if as Tt,ir as Et,is as Dt,ji as Ot,jl as kt,kd as At,kf as jt,ko as Mt,lf as Nt,lo as Pt,lr as Ft,ma as It,md as Lt,mo as Rt,mr as zt,na as Bt,ni as Vt,no as Ht,nr as Ut,nu as Wt,oo as Gt,po as Kt,qa as qt,rd as Jt,ri as Yt,rr as Xt,ru as Zt,sf as Qt,su as $t,ta as en,tl as tn,tr as nn,uf as rn,us as an,v as on,vf as sn,vo as cn,vu as ln,wo as un,ws as dn,wu as fn,xo as pn,yl as mn,yo as hn,yu as gn,za as _n,zl as vn}from"./index-dViajQ_4.js";import{n as yn,t as bn}from"./use-autosave-CYG5ELoQ.js";import{t as xn}from"./directory-picker-path-field-C7mO36eo.js";import{d as Sn,h as Cn,o as wn}from"./skill-api-CViUmvY5.js";import{t as Tn}from"./date-picker-BYz1BvpE.js";import{t as En}from"./automations-workspace-CImof0cA.js";import{i as Dn,r as On,t as kn}from"./workflow-run-setup-panel-BDK1g07U.js";import{t as An}from"./page-context-capture-button-CVkaHzKp.js";import{i as X,n as jn,r as Mn,t as Nn}from"./note-detail-panel-b0LhcM8E.js";import{c as Pn,l as Fn,n as In,o as Z,r as Ln,t as Rn,u as zn}from"./style-C06V_QkC.js";import{t as Bn}from"./dependency-picker-B5onlFRJ.js";var Vn=n(),Q=e(t(),1),$=r();function Hn(e){let t=(0,Vn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Yt(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=b(`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,$.jsx)(Lt,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.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=b(`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,$.jsx)(Se,{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 Un(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 Wn(e){let t=(0,Vn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Vt(),f=Vt(Kn),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,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let x=y,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=b(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=b(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=m?`Pause`:`Play`,O;t[14]!==h||t[15]!==m?(O=h?(0,$.jsx)(ye,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(ae,{className:`size-3.5`}):(0,$.jsx)(xt,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let A=`${v}%`,j;t[23]===A?j=t[24]:(j=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:A}})}),t[23]=A,t[24]=j);let M;t[25]!==_||t[26]!==p||t[27]!==g?(M=Un(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==j||t[32]!==N?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==w||t[36]!==k?(F=(0,$.jsxs)(`div`,{className:w,onClick:Gn,children:[k,P]}),t[34]=P,t[35]=w,t[36]=k,t[37]=F):F=t[37],F}function Gn(e){return e.stopPropagation()}function Kn(e){return e.toggle}function qn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Jn(e){let t=(0,Vn.c)(89),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d=w(nr)===`zh`,f=n.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(n.title??``)?d?`语音笔记`:`Voice note`:n.title,p;t[0]!==c||t[1]!==n?(p=qn(n,c),t[0]=c,t[1]=n,t[2]=p):p=t[2];let m=p,h=!n.snippet?.trim(),[g]=(0,Q.useState)(tr),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==l?(_=X(n.createdAt,g,l),t[3]=n.createdAt,t[4]=g,t[5]=l,t[6]=_):_=t[6];let v=_,y,x;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),x=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=y,t[10]=x):(y=t[9],x=t[10]);let S=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,C;t[11]===S?C=t[12]:(C=b(`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`,S),t[11]=S,t[12]=C);let T=u?`true`:void 0,E;t[13]===u?E=t[14]:(E=u?(0,$.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]=E);let D;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(D=n.coverAttachmentId?(0,$.jsx)(Hn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(Wn,{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]=D):D=t[20];let O;t[21]!==f||t[22]!==n.title?(O=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:f}),t[21]=f,t[22]=n.title,t[23]=O):O=t[23];let k=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,A;t[24]===k?A=t[25]:(A=b(`truncate text-sm leading-5`,k),t[24]=k,t[25]=A);let j;t[26]!==m||t[27]!==A?(j=(0,$.jsx)(`p`,{className:A,children:m}),t[26]=m,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==O||t[30]!==j?(M=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,j]}),t[29]=O,t[30]=j,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(Oe,{className:`size-4`}),t[32]=N):N=t[32];let P;t[33]===c.actions?P=t[34]:(P=(0,$.jsx)(at,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:er,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:N})}),t[33]=c.actions,t[34]=P);let F;t[35]!==n.id||t[36]!==n.pinned||t[37]!==a?(F=()=>{a(n.id,!n.pinned).catch(Qn)},t[35]=n.id,t[36]=n.pinned,t[37]=a,t[38]=F):F=t[38];let I;t[39]===n.pinned?I=t[40]:(I=n.pinned?(0,$.jsx)(ln,{className:`size-4`}):(0,$.jsx)(gn,{className:`size-4`}),t[39]=n.pinned,t[40]=I);let L=n.pinned?c.unpin:c.pin,R;t[41]!==F||t[42]!==I||t[43]!==L?(R=(0,$.jsxs)(nn,{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:F,children:[I,L]}),t[41]=F,t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==n.id||t[46]!==o?(z=()=>{o(n.id).catch(Zn)},t[45]=n.id,t[46]=o,t[47]=z):z=t[47];let B;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(jt,{className:`size-4`}),t[48]=B):B=t[48];let V;t[49]!==c.archive||t[50]!==z?(V=(0,$.jsxs)(nn,{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:z,children:[B,c.archive]}),t[49]=c.archive,t[50]=z,t[51]=V):V=t[51];let H;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(Et,{className:`my-1 h-px bg-edge-subtle`}),t[52]=H):H=t[52];let U;t[53]!==n.id||t[54]!==s?(U=()=>{s(n.id).catch(Xn)},t[53]=n.id,t[54]=s,t[55]=U):U=t[55];let W;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(kt,{className:`size-4`}),t[56]=W):W=t[56];let G;t[57]!==c.delete||t[58]!==U?(G=(0,$.jsxs)(nn,{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:U,children:[W,c.delete]}),t[57]=c.delete,t[58]=U,t[59]=G):G=t[59];let ee;t[60]!==R||t[61]!==V||t[62]!==G?(ee=(0,$.jsx)(Ut,{children:(0,$.jsxs)(ft,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-overlay p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:$n,children:[R,V,H,G]})}),t[60]=R,t[61]=V,t[62]=G,t[63]=ee):ee=t[63];let te;t[64]!==P||t[65]!==ee?(te=(0,$.jsxs)(Xt,{children:[P,ee]}),t[64]=P,t[65]=ee,t[66]=te):te=t[66];let ne;t[67]!==D||t[68]!==M||t[69]!==te?(ne=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[D,M,te]}),t[67]=D,t[68]=M,t[69]=te,t[70]=ne):ne=t[70];let K;t[71]===n.pinned?K=t[72]:(K=n.pinned&&(0,$.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,$.jsx)(gn,{className:`size-3`})}),t[71]=n.pinned,t[72]=K);let q;t[73]===n.tags?q=t[74]:(q=n.tags?.slice(0,2).map(Yn),t[73]=n.tags,t[74]=q);let re;t[75]===v?re=t[76]:(re=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[75]=v,t[76]=re);let ie;t[77]!==K||t[78]!==q||t[79]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,q,re]}),t[77]=K,t[78]=q,t[79]=re,t[80]=ie):ie=t[80];let ae;return t[81]!==ne||t[82]!==ie||t[83]!==y||t[84]!==x||t[85]!==C||t[86]!==T||t[87]!==E?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:x,className:C,"aria-current":T,children:[E,ne,ie]}),t[81]=ne,t[82]=ie,t[83]=y,t[84]=x,t[85]=C,t[86]=T,t[87]=E,t[88]=ae):ae=t[88],ae}function Yn(e){return(0,$.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 Xn(){}function Zn(){}function Qn(){}function $n(e){return e.stopPropagation()}function er(e){return e.stopPropagation()}function tr(){return Date.now()}function nr(e){return e.language}var rr=3e4;function ir(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function ar({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,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(0),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A=(0,Q.useRef)([]),j=(0,Q.useRef)(0),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.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=[],S(!1),w(0)},[]);(0,Q.useEffect)(()=>()=>P(),[P]);let F=(0,Q.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||ir()||`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,Q.useCallback)(async()=>{if(!(!c||T||x)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=ir(),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(),S(!0),w(0),M.current=setInterval(()=>{w(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},rr)}catch{P(),l?.()}}},[P,c,l,x,F,T]),L=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||v)){y(!0),g(``);try{await o(e)}catch{g(e)}finally{y(!1),D.current?.focus()}}},[h,v,o]),R=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=v||T,B=!!(s||c||p);return(0,$.jsxs)(`div`,{className:b(`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`,x&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[x?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:T,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,$.jsx)(xe,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(Xt,{children:[(0,$.jsx)(at,{asChild:!0,children:(0,$.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,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(Ut,{children:(0,$.jsxs)(ft,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[s?(0,$.jsxs)(nn,{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,$.jsx)(mt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(nn,{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,$.jsx)(Ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(nn,{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,$.jsx)(K,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,x?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(C))}):(0,$.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,$.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||x,onClick:()=>void L(),"aria-label":t,title:t,className:b(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!x?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(Wt,{className:`size-4`,"aria-hidden":!0})})]})}var or={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},sr=240,cr=320,lr=520,ur=560;function dr(e){if(globalThis.localStorage===void 0)return cr;try{let t=globalThis.localStorage.getItem(e);if(!t)return cr;let n=Number(t);return Number.isFinite(n)?n:cr}catch{return cr}}function fr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var pr={thought:vn,todo:_e,voice:Ce,media:mt,bookmark:sn,mixed:vn,task:_e};function mr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function hr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function gr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function _r({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:l,emptyDescription:u,listWidthStorageKey:d=`xopc.notes.listWidth`}){let f=w(e=>e.language),p=y(f).notes,m=!!S(e=>e.conversationId),[h,g]=(0,Q.useReducer)(Ht,or),[x,T]=(0,Q.useState)(!1),[D,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>dr(d)),[B,V]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(!1),[G,ee]=(0,Q.useState)(!1),[ne,K]=(0,Q.useState)(null),[q,ie]=(0,Q.useState)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),[se]=(0,Q.useState)(()=>Date.now()),ce=i(),ue=(0,Q.useCallback)(e=>{let t=ae.current?.clientWidth??window.innerWidth,n=Math.max(sr,t-ur);return Math.max(sr,Math.min(Math.min(lr,n),e))},[]),de=(0,Q.useCallback)(e=>{let t=ue(e);z(t),fr(d,t)},[ue,d]);(0,Q.useLayoutEffect)(()=>{z(e=>ue(e))},[ue]);let{data:fe,mutate:J,isLoading:me}=L((0,Q.useMemo)(()=>m?[`notes-list`,o,h.statusFilter,h.kindFilter,h.pinnedOnly]:null,[m,o,h.statusFilter,h.kindFilter,h.pinnedOnly]),()=>re({status:h.statusFilter===`all`?void 0:h.statusFilter,kind:h.kindFilter===`all`?void 0:h.kindFilter,projectId:o,pinned:h.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ge=me&&!fe,_e=fe?.items??[],ye=fe?.total??0,be=D.trim(),{data:xe,isLoading:Se}=L(m&&x&&be?[`notes-search`,o,be]:null,()=>re({search:be,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),we=xe?.items??[],Te=e?_e.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{I(0)},[be]),(0,Q.useEffect)(()=>{F>=we.length&&I(Math.max(0,we.length-1))},[F,we.length]),(0,Q.useEffect)(()=>{let e=()=>{J().catch(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[J,p.quickCaptureFailedHint,p.refreshFailed]);let Ee=ve(e=>e.setPageHeader),De=ve(e=>e.clearPageHeader),Oe=p.noteCount.replace(`{{count}}`,String(ye)),ke=!r&&ye===0&&c?c:Oe,je=p.searchDialogTitle,Me=p.searchClose,Ne=p.searchClear,Pe=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>T(!0),className:b(`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`,te),"aria-label":je,children:[(0,$.jsx)(Zt,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:je})]}),[je]);(0,Q.useLayoutEffect)(()=>{if(n)return m?(Ee({startExtra:null,main:(0,$.jsxs)(`div`,{className:b(`flex min-w-0 items-center gap-2`,te),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??p.title}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:p.discussionCapture.recoveredTitle}),Oe?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Oe}):null]}),end:Pe}),()=>De()):(De(),()=>De())},[De,m,Pe,s,n,p.title,p.discussionCapture.recoveredTitle,Oe,e,Ee]);let Fe=(0,Q.useMemo)(()=>({justNow:p.justNow,minutesAgo:p.minutesAgo,today:p.today,yesterday:p.yesterday,daysAgo:p.daysAgo,locale:C(f)}),[f,p.justNow,p.minutesAgo,p.today,p.yesterday,p.daysAgo]),Ie=(0,Q.useMemo)(()=>[{id:`recent`,label:p.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:p.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:p.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:p.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:p.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:p.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:p.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:p.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:p.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[p.filterArchived,p.filterInbox,p.filterProcessed,p.kindBookmark,p.kindMedia,p.kindVoice,p.pinned,p.viewRecent,p.viewTasks]),Le=Ie.find(e=>hr(h,e))??Ie[0],Re=s??Le.label,ze=(0,Q.useCallback)(async e=>{K(null);try{let n=o?await _t({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await He(e,`web`);await J(),ce(gr(t,n.id))}catch(e){throw K(`${p.quickCaptureFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`),e}},[t,J,p.quickCaptureFailed,p.quickCaptureFailedHint,ce,o]),Be=(0,Q.useCallback)(async()=>{if(!G){ee(!0),K(null);try{let e=await _t({markdown:``,kind:`thought`,projectId:o,channel:`web`});g({type:`patch`,patch:or}),await J(),ie(e.id),ce(gr(t,e.id))}catch(e){K(`${p.createBlankFailed}: ${e instanceof Error?e.message:p.createBlankFailedHint}`)}finally{ee(!1)}}},[t,G,J,p.createBlankFailed,p.createBlankFailedHint,ce,o]),Ve=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{K(null),await pe(t,`web`),await J()}catch(e){K(`${p.imageUploadFailed}: ${e instanceof Error?e.message:p.imageUploadFailedHint}`)}},e.click()},[J,p.imageUploadFailed,p.imageUploadFailedHint]),Ue=(0,Q.useCallback)(async(e,t)=>{try{K(null),await le(e,t,`web`),await J()}catch(e){K(`${p.voiceUploadFailed}: ${e instanceof Error?e.message:p.voiceUploadFailedHint}`)}},[J,p.voiceUploadFailed,p.voiceUploadFailedHint]),We=(0,Q.useCallback)(()=>{K(`${p.voiceCaptureFailed}: ${p.voiceCaptureFailedHint}`)},[p.voiceCaptureFailed,p.voiceCaptureFailedHint]),Ge=(0,Q.useCallback)(async(e,t)=>{K(null);try{await Ae(e,{pinned:t}),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),Ke=(0,Q.useCallback)(async e=>{K(null);try{await Ae(e,{status:`archived`}),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),qe=(0,Q.useCallback)(async e=>{K(null);try{await zt(e),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),Y=(0,Q.useCallback)(e=>{ce(gr(t,e))},[t,ce]),Je=(0,Q.useCallback)(e=>{ce(gr(t,e)),T(!1)},[t,ce]),Ye=(0,Q.useCallback)(e=>{if(we.length){if(e.key===`ArrowDown`)e.preventDefault(),I(e=>Math.min(we.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),I(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=we[F]??we[0];t&&Je(t.id)}}},[F,Je,we]),Xe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=oe.current;t.setPointerCapture(e.pointerId),V(!0);let r=ae.current?.clientWidth??window.innerWidth,i=Math.max(sr,r-ur),a=Math.min(lr,i),o=e=>Math.max(sr,Math.min(a,e)),s=e.clientX,c=o(R),l=e.pointerId,u=0,f=c,p=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,p=f,n&&(n.style.width=`${p}px`)},h=e=>{f=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}V(!1),ae.current?.style.setProperty(`--notes-list-width`,`${p}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(p),fr(d,p),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[d,R]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Be())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Be]);let Ze=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),de(R-16)):e.key===`ArrowRight`?(e.preventDefault(),de(R+16)):e.key===`Home`?(e.preventDefault(),de(sr)):e.key===`End`&&(e.preventDefault(),de(lr))},[de,R]);return m?(0,$.jsxs)(`div`,{ref:ae,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${R}px`},children:[(0,$.jsxs)(`section`,{ref:oe,className:b(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!B&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`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":U?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ne?(0,$.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,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(dt,{value:Le.id,onChange:e=>{let t=Ie.find(t=>t.id===e.target.value);t&&g({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":p.libraryTitle,children:Ie.map(e=>(0,$.jsx)(vt,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Re}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:ke})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`hidden size-11 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":p.collapseNotesList,title:p.collapseNotesList,children:(0,$.jsx)(he,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>H(o),"aria-label":f===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ce,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Be,disabled:G,className:`inline-flex size-11 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":p.createBlankNote,title:p.createBlankShortcut,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(!0),className:`inline-flex size-11 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":p.searchDialogTitle,title:p.searchDialogTitle,children:(0,$.jsx)(Zt,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:ge?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):_e.length===0?(0,$.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,$.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,$.jsx)(vn,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Te?p.noteOutsideCurrentView:l??p.noNotes}),e&&!Te?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:u??p.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Te?(0,$.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:p.noteOutsideCurrentView}):null,_e.map((t,n)=>{let r=n>0?jn(_e[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[jn(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:b(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Mn(t.createdAt,se,Fe)}),(0,$.jsx)(Jn,{note:t,selected:t.id===e,onPress:Y,onPin:Ge,onArchive:Ke,onDelete:qe,timeLabels:Fe,labels:{pin:p.pin,unpin:p.unpin,archive:p.archive,delete:p.delete,actions:p.noteActions,imageNote:p.imageNote,noText:p.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(ar,{placeholder:p.quickCapturePlaceholder,submitLabel:p.quickCaptureSubmit,actionsLabel:p.quickCaptureActions,imageLabel:p.quickCaptureImage,voiceLabel:p.quickCaptureVoice,stopRecordingLabel:p.stopRecording,onCapture:ze,onImagePick:a?Ve:void 0,onVoiceCapture:a?Ue:void 0,onVoiceError:We,recordingLabel:p.recording,discussionCaptureLabel:p.discussionCapture.title,onDiscussionCapture:()=>H(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.resizeNotesList,"aria-valuemin":sr,"aria-valuemax":lr,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:Xe,onDoubleClick:()=>de(cr),onKeyDown:Ze,title:p.resizeNotesList,className:b(`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`,U?`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,$.jsx)(`span`,{"aria-hidden":!0,className:b(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,B&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:b(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!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":p.expandNotesList,title:p.expandNotesList,children:(0,$.jsx)(he,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Nn,{noteId:e,onBack:()=>ce(t),onSaved:()=>{J().catch(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>T(!0),autoFocus:e===q,onAutoFocusConsumed:()=>ie(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(vn,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:p.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:p.emptyEditorDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>H(o),"aria-label":f===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ce,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`button`,{type:`button`,onClick:Be,disabled:G,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,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),G?p.creatingBlankNote:p.createBlankNote]})]})})]}),(0,$.jsx)(N,{open:x,onOpenChange:T,children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(M,{className:`text-sm font-semibold text-fg`,children:je}),(0,$.jsx)(O,{className:`sr-only`,children:p.searchPlaceholder}),(0,$.jsx)(k,{asChild:!0,children:(0,$.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":Me,children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:D,onChange:e=>P(e.target.value),onKeyDown:Ye,placeholder:p.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`}),D?(0,$.jsx)(`button`,{type:`button`,onClick:()=>P(``),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":Ne,children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:be?Se&&!xe?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):we.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(vn,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:p.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:p.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:p.searchResultsCount.replace(`{{count}}`,String(xe?.total??we.length))}),we.map((e,t)=>{let n=pr[e.kind]||vn,r=mr(e,{imageNote:p.imageNote,noText:p.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Je(e.id),onMouseEnter:()=>I(t),className:b(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===F?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:X(e.updatedAt,se,Fe)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.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,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(Zt,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:p.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:p.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(vn,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.needToken})]})}var vr=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function yr({projectId:e}){let t=w(e=>e.language),n=y(t).workflows,r=t===`zh`,[i,a]=(0,Q.useState)(!1),[o,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(vr),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[T,P]=(0,Q.useState)(null),F=L(i?`workflow-definitions`:null,on,{revalidateOnFocus:!1}),I=L(i?`workflow-agents`:null,z,{revalidateOnFocus:!1}),R=L(i?[`workflow-project-presets`,e]:null,()=>nt(e),{revalidateOnFocus:!1}),B=F.data?.find(e=>e.id===o),V=B?Ot(B,t):null,H=u||I.data?.defaultId,W=F.isLoading||I.isLoading||R.isLoading,G=F.error||I.error||R.error,ee=Dn(B,f,g).valid,te=e=>{b||(e&&(l(``),d(``),p(vr()),h([]),_(!0),C(null),P(null)),a(e))},K=e=>{l(e),p(vr()),_(!0),C(null),h(R.data?.find(t=>t.definitionId===e)?.contextRefs??[])},q=async()=>{if(!(!B||!H||!ee||b||T||W||G)){x(!0),C(null);try{P({runId:(await U({definitionId:B.id,agentId:H,projectId:e,goal:f.goal.trim()||V?.description||B.title,input:On(B,f),contextRefs:m,concurrency:f.concurrency.trim()?Number(f.concurrency):void 0,maxSubagents:f.maxSubagents.trim()?Number(f.maxSubagents):void 0})).runId,agentId:H})}catch(e){C(e instanceof Error?e.message:n.startFailed);return}finally{x(!1)}}};return(0,$.jsxs)(N,{open:i,onOpenChange:te,children:[(0,$.jsx)(D,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`secondary`,className:`h-9 rounded-lg`,children:[(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),y(t).projectDetailPage.common.runWorkflow]})}),(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(46rem,calc(100dvh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:y(t).projectDetailPage.common.runWorkflow}),(0,$.jsx)(O,{className:`mt-1 text-xs text-fg-muted`,children:r?`选择工作流并运行,结果将关联到当前项目。`:`Choose and run a workflow. The run will be linked to this project.`})]}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,className:`size-8 p-0`,disabled:b,"aria-label":n.pickStartClose,children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:T?(0,$.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(c,{className:`size-8 text-success`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-base font-medium text-fg`,children:n.startSuccess}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`工作流正在后台运行,你可以继续处理项目。`:`The workflow is running in the background. You can continue working on your project.`}),(0,$.jsx)(Y,{asChild:!0,variant:`secondary`,children:(0,$.jsx)(s,{to:`/workflows/runs/${encodeURIComponent(T.runId)}?agentId=${encodeURIComponent(T.agentId)}&projectId=${encodeURIComponent(e)}`,children:n.taskOpenDetails})})]}):W?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r?`正在加载工作流`:`Loading workflows`,children:[(0,$.jsx)(Pe,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(Pe,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(Pe,{className:`h-56 w-full rounded-xl`})]}):G?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G instanceof Error?G.message:n.startFailed}):F.data?.length?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n.chooseWorkflow,(0,$.jsxs)(dt,{value:o,onChange:e=>K(e.target.value),disabled:b,"aria-label":n.chooseWorkflow,className:`mt-1 w-full`,children:[(0,$.jsx)(vt,{value:``,children:n.chooseWorkflow}),F.data.map(e=>(0,$.jsx)(vt,{value:e.id,children:Ot(e,t).title},e.id))]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[r?`执行助手`:`Execution assistant`,(0,$.jsx)(dt,{value:H??``,onChange:e=>d(e.target.value),disabled:b,"aria-label":r?`执行助手`:`Execution assistant`,className:`mt-1 w-full`,children:I.data?.agents.map(e=>(0,$.jsx)(vt,{value:e.id,children:Ie(e,y(t).agentsSettings)},e.id))})]}),B&&V?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:V.description}),(0,$.jsx)(zn,{projectId:e,language:t,value:m,onChange:h}),(0,$.jsx)(kn,{definition:B,language:t,value:f,onChange:p,mode:`manual`,onValidityChange:e=>_(e.reason!==`raw-json`)})]}):null,S?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:S}):null]}):(0,$.jsx)(`p`,{className:`py-12 text-center text-sm text-fg-muted`,children:r?`还没有可运行的工作流,请先新建工作流。`:`No workflows are available. Create a workflow to get started.`})}),(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{asChild:!0,variant:`ghost`,disabled:b,children:(0,$.jsx)(s,{to:`/workflows/new?projectId=${encodeURIComponent(e)}`,onClick:e=>{b&&e.preventDefault()},children:n.addWorkflow})}),T?(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{variant:`primary`,children:n.pickStartClose})}):(0,$.jsxs)(Y,{variant:`primary`,disabled:W||!!G||!B||!H||!ee||b,onClick:()=>void q(),children:[(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),b?n.starting:n.runWorkflow]})]})]})]})]})}function br(e){return x(T(`/api/projects/${encodeURIComponent(e)}/skills`))}function xr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Sr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Cr(e,t){let n=new FormData;return n.set(`file`,t),x(T(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function wr(e,t,n={}){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Tr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Er(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function Dr({projectId:e,copy:t}){let n=w(e=>e.language),[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)([]),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!0),[C,T]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(``),[H,U]=(0,Q.useState)(1),[W,G]=(0,Q.useState)(null),[ee,te]=(0,Q.useState)(!1),[K,q]=(0,Q.useState)(``),[re,ie]=(0,Q.useState)(``),ae=(0,Q.useRef)(null),oe=(0,Q.useCallback)(async()=>{S(!0),F(``);try{let t=await br(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){F(e instanceof Error?e.message:String(e))}finally{S(!1)}},[e]);(0,Q.useEffect)(()=>{oe()},[oe]),(0,Q.useEffect)(()=>{let t=!1;return Re(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Q.useEffect)(()=>{if(!f){h(null);return}let e=l.find(e=>e.key===f),t=!1;return h(null),F(``),y(!0),Bt(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||h(e)}).catch(e=>{t||F(e instanceof Error?e.message:String(e))}).finally(()=>{t||y(!1)}),()=>{t=!0}},[f,l]),(0,Q.useEffect)(()=>{if(I!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{te(!0),q(``),wn({q:B,page:H,pageSize:8,sort:`downloads`,signal:e.signal}).then(G).catch(t=>{e.signal.aborted||q(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||te(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[I,H,B]);async function ce(e,t){T(!0),O(t??null),F(``);try{await e(),L(null),ie(``),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1),O(null)}}async function le(t){F(``);try{z((await xr(e,t)).skill)}catch(e){F(e instanceof Error?e.message:String(e))}}async function de(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){T(!0);try{await Er(e,n.directoryId),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}}async function fe(){T(!0),F(``);try{await Sr(e,!0),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}let J=s.find(e=>e.origin===`agents-workspace`),pe=new Map(m?.skills.map(e=>[e.name,e]));return(0,$.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsxs)(me,{children:[(0,$.jsx)(ue,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t.add,(0,$.jsx)(rn,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,$.jsx)(Ue,{children:(0,$.jsxs)(dn,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-overlay p-1.5 shadow-xl`,children:[(0,$.jsx)(jr,{icon:Fe,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>L(`marketplace`)}),(0,$.jsx)(jr,{icon:ne,title:t.source,hint:t.sourceHint,onClick:()=>L(`source`)}),(0,$.jsx)(jr,{icon:se,title:t.upload,hint:t.uploadHint,onClick:()=>ae.current?.click()})]})})]}),(0,$.jsx)(`input`,{ref:ae,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ce(()=>Cr(e,n)),t.target.value=``}})]})}),P?(0,$.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:P}):null,J?.state===`untrusted`?(0,$.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,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Je,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:C,onClick:()=>void fe(),children:[(0,$.jsx)(et,{className:`size-4`,"aria-hidden":!0}),C?t.trusting:t.trustAction]})]}):null,l.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g?t.sessionLoading:f?m?.agentId:t.sessionViewAll})]}),(0,$.jsx)(an,{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,x?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,$.jsx)(Pe,{className:`h-36 rounded-lg`},e))}):r.length?(0,$.jsx)(Or,{title:t.localTitle,items:r,copy:t,busy:C,availabilityByName:pe,onPreview:le,onRemove:de}):(0,$.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!x&&a.length?(0,$.jsx)(Or,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:C,availabilityByName:pe,onPreview:le,onRemove:de}):null,(0,$.jsx)(N,{open:I!==null,onOpenChange:e=>{e||L(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:b(`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`,I===`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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:I===`marketplace`?t.marketplace:t.source}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(v,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:I===`marketplace`?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,$.jsxs)(`div`,{className:`relative mt-3`,children:[(0,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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:B,onChange:e=>{V(e.target.value),U(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),K?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:K}):null,ee&&!W?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,$.jsx)(Pe,{className:`h-32 rounded-lg`},e))}):W?.items.length?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:W.items.map(i=>{let a=it(i,n),o=i.providerId??W.provider,s=Cn(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,$.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(Sn,{name:i.name,className:`size-10`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,$.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,$.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,$.jsx)(Y,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:C||c,onClick:()=>void ce(()=>wr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):ee?null:(0,$.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),W&&W.meta.totalPages>1?(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(W.meta.page)).replace(`{{total}}`,String(W.meta.totalPages))}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ee||H<=1,onClick:()=>U(e=>Math.max(1,e-1)),children:[(0,$.jsx)(Nt,{className:`size-4`}),t.marketplacePrevious]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ee||H>=W.meta.totalPages,onClick:()=>U(e=>e+1),children:[t.marketplaceNext,(0,$.jsx)(ct,{className:`size-4`})]})]})]}):null]}):(0,$.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,$.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:re,onChange:e=>ie(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`secondary`,children:t.close})}),(0,$.jsx)(Y,{type:`button`,disabled:C||!re.trim(),onClick:()=>void ce(()=>Tr(e,re.trim())),children:C?t.installing:t.install})]})]})})]})]})}),(0,$.jsx)(N,{open:!!R,onOpenChange:e=>{e||z(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:R?.name}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(v,{className:`size-4`})})})]}),(0,$.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:R?.bodyMarkdown})]})]})})]})}function Or(e){let t=(0,Vn.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,$.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,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let p;t[4]!==u||t[5]!==d?(p=(0,$.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=p):p=t[6];let m;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,$.jsxs)(`article`,{className:b(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(jt,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:kr(a,e.origin)}),e.writable?null:(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,$.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,$.jsx)(`span`,{className:b(`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:Ar(a,t)}):null]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,$.jsx)(kt,{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],m=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=m}else m=t[13];let h;t[20]===m?h=t[21]:(h=(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:m}),t[20]=m,t[21]=h);let g;return t[22]!==p||t[23]!==h?(g=(0,$.jsxs)(`section`,{className:`grid gap-3`,children:[p,h]}),t[22]=p,t[23]=h,t[24]=g):g=t[24],g}function kr(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 Ar(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 jr(e){let t=(0,Vn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.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,$.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,$.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,$.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,$.jsx)(ie,{asChild:!0,children:(0,$.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 Mr(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 Nr(e,t,n){let r=Mr(t),i=Mr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var Pr={active:0,review:1,ready:2,backlog:3,closed:4},Fr={failed:0,blocked:1,waiting:2,verifying:3,running:4,queued:5,allocating:5,cancelled:6,idle:7},Ir={critical:0,high:1,normal:2,low:3};function Lr(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=Fr[e.operationalState]-Fr[t.operationalState];if(r!==0)return r;let i=Pr[e.phase]-Pr[t.phase];if(i!==0)return i;let a=Ir[e.priority]-Ir[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Rr=[`backlog`,`ready`,`active`,`review`,`closed`];function zr(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 Br(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 Vr(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 Hr(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 Ur(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Hr(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 Wr(e,t){let{incoming:n}=Hr(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 Gr(e,t){let{incoming:n,outgoing:r}=Hr(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 Kr={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 qr(e){let t=(0,Vn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Kr[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=b(`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,$.jsx)(Ln,{type:`target`,position:Fn.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,$.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,$.jsx)(St,{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,$.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,$.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,$.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,$.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,$.jsx)(Ln,{type:`source`,position:Fn.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,$.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 Jr={taskNode:qr};function Yr(e){let t=(0,Vn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(),[g,_]=(0,Q.useState)(),v=(0,Q.useRef)(null),y;t[0]!==r||t[1]!==n?(y=Wr(n,r),t[0]=r,t[1]=n,t[2]=y):y=t[2];let x=y,S;t[3]!==x||t[4]!==u||t[5]!==c||t[6]!==n?(S=u?n.filter(e=>x.has(e.id)):c?n:n.filter(ri),t[3]=x,t[4]=u,t[5]=c,t[6]=n,t[7]=S):S=t[7];let C=S,w;t[8]===C?w=t[9]:(w=new Set(C.map(ni)),t[8]=C,t[9]=w);let T=w,E;if(t[10]!==r||t[11]!==T){let e;t[13]===T?e=t[14]:(e=e=>T.has(e.dependencyTaskId)&&T.has(e.dependentTaskId),t[13]=T,t[14]=e),E=r.filter(e),t[10]=r,t[11]=T,t[12]=E}else E=t[12];let D=E,O;t[15]!==D||t[16]!==C?(O=Ur(C,D),t[15]=D,t[16]=C,t[17]=O):O=t[17];let k=O,A;t[18]!==m||t[19]!==D?(A=m?Gr(m,D):void 0,t[18]=m,t[19]=D,t[20]=A):A=t[20];let j=A,M;t[21]===m?M=t[22]:(M=e=>e.id===m,t[21]=m,t[22]=M);let N=C.find(M),P;t[23]===C?P=t[24]:(P=new Map(C.map(ti)),t[23]=C,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==C){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=C.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=C,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==D){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Pn.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]=j,t[39]=F,t[40]=e):e=t[40],R=D.map(e),t[34]=j,t[35]=F,t[36]=D,t[37]=R}else R=t[37];let z=R,B,V;t[41]!==m||t[42]!==T?(B=()=>{m&&!T.has(m)&&h(void 0)},V=[m,T],t[41]=m,t[42]=T,t[43]=B,t[44]=V):(B=t[43],V=t[44]),(0,Q.useEffect)(B,V);let H,U;t[45]!==z||t[46]!==g?(H=()=>{g&&!z.some(e=>e.id===g)&&_(void 0)},U=[z,g],t[45]=z,t[46]=g,t[47]=H,t[48]=U):(H=t[47],U=t[48]),(0,Q.useEffect)(H,U);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=window.requestAnimationFrame(()=>{v.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=W):W=t[49];let G;t[50]!==u||t[51]!==c||t[52]!==C.length?(G=[u,c,C.length],t[50]=u,t[51]=c,t[52]=C.length,t[53]=G):G=t[53],(0,Q.useEffect)(W,G);let ee;t[54]===m?ee=t[55]:(ee=()=>{m&&v.current?.fitView({nodes:[{id:m}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=m,t[55]=ee);let te=ee,ne;t[56]!==r||t[57]!==o?(ne=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(ei);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=ne):ne=t[58];let K=ne,q;t[59]!==r||t[60]!==o||t[61]!==g?(q=()=>{if(!g)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===g);e&&(_(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map($r)))},t[59]=r,t[60]=o,t[61]=g,t[62]=q):q=t[62];let re=q,ie;t[63]===a.connectHint?ie=t[64]:(ie=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ie);let ae=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(Qr),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==ae||t[68]!==se?(ce=(0,$.jsx)(Y,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Zr),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:te,children:[(0,$.jsx)(At,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,J;t[75]!==a.removeDependency||t[76]!==re||t[77]!==g?(J=g?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:re,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=re,t[77]=g,t[78]=J):J=t[78];let pe;t[79]!==ce||t[80]!==de||t[81]!==fe||t[82]!==J?(pe=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,fe,J]}),t[79]=ce,t[80]=de,t[81]=fe,t[82]=J,t[83]=pe):pe=t[83];let me;t[84]!==ie||t[85]!==pe?(me=(0,$.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:[ie,pe]}),t[84]=ie,t[85]=pe,t[86]=me):me=t[86];let he=C.length>0?(0,$.jsxs)(`div`,{className:b(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,$.jsxs)(Z,{nodes:L,edges:z,nodeTypes:Jr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>h(t.id),onEdgeClick:(e,t)=>_(t.id),onConnect:K,onPaneClick:()=>{h(void 0),_(void 0)},onInit:e=>{v.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Rn,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(In,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,$.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,$.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(Xr)})]}):null,(0,$.jsxs)(s,{to:p(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,$.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function Xr(e){return(0,$.jsx)(`li`,{children:e.title},e.id)}function Zr(e){return!e}function Qr(e){return!e}function $r(e){return e.dependencyTaskId}function ei(e){return e.dependencyTaskId}function ti(e){return[e.id,e]}function ni(e){return e.id}function ri(e){return e.phase!==`closed`}function ii(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var ai={backlog:Tt,ready:Tt,active:Ne,review:Be,closed:l},oi={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 si(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===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-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 ci(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 li(e){let t=(0,Vn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:u}=e,d,f,m,h,g,_,v,y,x,S,C,w,T,E,D,O;t[0]!==c||t[1]!==u||t[2]!==r||t[3]!==n?(g=Vr(n),_=g!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,m=n.phase===`closed`,h=!!(n.dueAt&&n.dueAt<Date.now()&&!m),f=m?l:B,y=n.priority!==`normal`,v=y||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,C=!0,t[20]!==c||t[21]!==n.id?(w=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=w):w=t[22],t[23]===c?T=t[24]:(T=()=>c(``),t[23]=c,t[24]=T),E=di,t[25]!==u||t[26]!==n.id?(D=e=>{e.preventDefault(),e.stopPropagation(),u(n.id)},t[25]=u,t[26]=n.id,t[27]=D):D=t[27],O=`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`,d=s,t[28]!==r||t[29]!==n.id?(x=p(r,n.id),t[28]=r,t[29]=n.id,t[30]=x):x=t[30],S=b(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,_?`pr-19`:g&&`pr-11`),t[0]=c,t[1]=u,t[2]=r,t[3]=n,t[4]=d,t[5]=f,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O):(d=t[4],f=t[5],m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19]);let k=m?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,A;t[31]===k?A=t[32]:(A=b(`mt-0.5 size-4 shrink-0`,k),t[31]=k,t[32]=A);let j;t[33]!==f||t[34]!==A?(j=(0,$.jsx)(f,{className:A,"aria-hidden":!0}),t[33]=f,t[34]=A,t[35]=j):j=t[35];let M=m?`text-fg-subtle`:`text-fg`,N;t[36]===M?N=t[37]:(N=b(`min-w-0 break-words text-sm font-semibold leading-5`,M),t[36]=M,t[37]=N);let P;t[38]!==N||t[39]!==n.title?(P=(0,$.jsx)(`h3`,{className:N,children:n.title}),t[38]=N,t[39]=n.title,t[40]=P):P=t[40];let F;t[41]!==j||t[42]!==P?(F=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[j,P]}),t[41]=j,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(I=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,$.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,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,$.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ui).join(`、`)})]}):n.attention[0]?(0,$.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(Qt,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.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]=I):I=t[48];let L;t[49]!==i||t[50]!==h||t[51]!==v||t[52]!==y||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(L=v?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[y?(0,$.jsx)(`span`,{className:b(`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,$.jsx)(`span`,{className:b(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,si(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,$.jsx)(`span`,{className:b(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,ci(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,$.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,$.jsx)(Ne,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,$.jsxs)(`span`,{className:b(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,h?`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,$.jsx)(ht,{className:`size-3`,"aria-hidden":!0}),ke(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,$.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,$.jsx)(ht,{className:`size-3`,"aria-hidden":!0}),ke(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=h,t[51]=v,t[52]=y,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]=L):L=t[59];let R;t[60]!==d||t[61]!==x||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==S?(R=(0,$.jsxs)(d,{to:x,className:S,children:[F,I,L]}),t[60]=d,t[61]=x,t[62]=F,t[63]=I,t[64]=L,t[65]=S,t[66]=R):R=t[66];let z;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==g||t[71]!==_||t[72]!==n?(z=g?(0,$.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:[_?(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,_),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[_],title:i.actions[_],children:(0,$.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),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[g],title:i.actions[g],children:(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=g,t[71]=_,t[72]=n,t[73]=z):z=t[73];let V;return t[74]!==R||t[75]!==z||t[76]!==C||t[77]!==w||t[78]!==T||t[79]!==E||t[80]!==D||t[81]!==O?(V=(0,$.jsxs)(`article`,{draggable:C,onDragStart:w,onDragEnd:T,onDragOver:E,onDrop:D,className:O,children:[R,z]}),t[74]=R,t[75]=z,t[76]=C,t[77]=w,t[78]=T,t[79]=E,t[80]=D,t[81]=O,t[82]=V):V=t[82],V}function ui(e){return e.title}function di(e){e.preventDefault(),e.stopPropagation()}function fi({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:l,ref:u}){let d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(`board`),[C,T]=(0,Q.useState)(!1),[D,P]=(0,Q.useState)(()=>crypto.randomUUID()),[F,I]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(`normal`),[z,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)([]),[U,W]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(null),K=w(e=>e.language),q=Ke({chat:y(K).chat}),re=zr(e),ie=e.filter(e=>e.phase!==`closed`),ae=(e,t)=>void i(e,t),oe=async(t,n)=>{let r=e.find(e=>e.id===p);if(m(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=Br(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&v({taskId:r.id,phase:r.phase,beforeTaskId:c})},se=async e=>{e.preventDefault();let t=F.trim();if(!(!t||U)){W(!0),te(null);try{let e=z?new Date(`${z}T23:59:59.999`).getTime():void 0;await c({requestId:D,objective:t,priority:L,dependsOnTaskIds:V,attachments:q.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),I(``),R(`normal`),B(``),H([]),q.clearAttachments(),P(crypto.randomUUID()),T(!1)}catch(e){te(e instanceof Error?e.message:r.createFailed)}finally{W(!1)}}},ce=()=>{P(crypto.randomUUID()),I(``),R(`normal`),B(``),H([]),q.clearAttachments(),te(null),T(!0)};(0,Q.useImperativeHandle)(u,()=>({openCreate:ce})),(0,Q.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>v(null),6e3);return()=>window.clearTimeout(e)},[_]);let le=(0,Q.useCallback)(e=>{let t=f.current;!t||t.pointerId!==e.pointerId||(f.current=null,g(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),ue=(0,Q.useCallback)(e=>{if(e.button!==0||ii(e.target))return;let t=d.current;t&&(f.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),de=(0,Q.useCallback)(e=>{let t=f.current,n=d.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,g(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,$.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,$.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,$.jsxs)(G,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:b(`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,$.jsx)(Jt,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:b(`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,$.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,$.jsx)(`div`,{ref:d,className:b(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,h?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:ue,onPointerMove:de,onPointerUp:le,onPointerCancel:le,onLostPointerCapture:e=>{f.current?.pointerId===e.pointerId&&(f.current=null,g(!1))},children:(0,$.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Rr.map(t=>{let i=ai[t],a=re[t];return(0,$.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===p);r&&(r.phase===t||Br(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),oe(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,$.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,$.jsxs)(`div`,{className:b(`flex items-center gap-1.5 rounded-md px-2 py-1`,oi[t]),children:[(0,$.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,$.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,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,$.jsx)(li,{task:e,returnTo:n,copy:r,busy:l===e.id,onAction:ae,onDragStart:m,onDropBefore:e=>void oe(t,e)},e.id))})})]},t)})})}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,$.jsx)(Yr,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,$.jsx)(N,{open:C,onOpenChange:e=>{U||T(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,$.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void se(e),children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,$.jsxs)(`div`,{className:b(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,q.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),U||q.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||q.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),q.setIsDragging(!1),U||q.processFiles(Array.from(e.dataTransfer.files))},children:[(0,$.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:F,onChange:e=>{I(e.target.value),te(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:U}),(0,$.jsx)(en,{attachments:q.attachments,topPadded:!1,onRemove:e=>{U||q.removeAttachment(e)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:U,onClick:()=>q.fileInputRef.current?.click(),children:[(0,$.jsx)(fn,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,$.jsx)(`input`,{ref:q.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{q.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,$.jsx)(dt,{value:L,onChange:e=>R(e.target.value),disabled:U,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,$.jsx)(vt,{value:e,children:r.priorityOptions[e]},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(Tn,{className:`min-h-10 bg-surface-base`,value:z,onChange:B,disabled:U,ariaLabel:r.dueDate})]})]}),(0,$.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,$.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,$.jsx)(Bn,{candidates:ie,selectedIds:V,disabled:U,onChange:H,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),ee?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ee}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:U,children:r.cancel})}),(0,$.jsx)(Y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:U||!F.trim(),children:U?r.creating:K===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),_?(0,$.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,$.jsx)(`span`,{children:r.moved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=_;v(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||v(e)})},children:r.undo})]}):null]})}var pi=new Set([{id:`overview`,icon:wt},{id:`tasks`,icon:Ge},{id:`automations`,icon:mn},{id:`files`,icon:ze},{id:`notes`,icon:W},{id:`skills`,icon:De},{id:`sessions`,icon:Le},{id:`progress`,icon:yt},{id:`settings`,icon:V}].map(e=>e.id)),mi=`xopc.projectFiles.panelWidthPx`,hi=320,gi=220,_i=560;function vi(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 yi(e){return Math.min(_i,Math.max(gi,Math.round(e)))}function bi(){try{let e=window.localStorage.getItem(mi);if(e==null)return hi;let t=Number.parseInt(e,10);return Number.isFinite(t)?yi(t):hi}catch{return hi}}function xi(e){try{window.localStorage.setItem(mi,String(yi(e)))}catch{}}function Si(e){return!!(e&&pi.has(e))}function Ci(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function wi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):ke(n)}function Ti(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 Ei(e){let t=(0,Vn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.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,$.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,$.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 Di(e=!1){return b(`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 Oi(e){let t=(0,Vn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,$.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=b(`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,$.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,$.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 ki(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Ai(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function ji(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Mi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Ni(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 Pi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Fi(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 Ii(e){let t=e.sourceChannel?.trim();return t?Li(t):``}function Li(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ri(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 zi(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 Bi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Bi(e.children,t,n)}:e)}function Vi({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)([e]),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(`new`),[C,w]=(0,Q.useState)(``),[T,D]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(!0),[R,z]=(0,Q.useState)(null),[B,H]=(0,Q.useState)(null),U=(0,Q.useCallback)(async()=>{m(!0),g(null);try{let t=await q({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,Q.useEffect)(()=>{u(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Q.useEffect)(()=>{o&&U()},[U,o]);let W=(0,Q.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=ki(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Ai(t)-Ai(e))},[e.id,l,d]),G=e=>t.statuses[e.status]??e.status,ee=e=>e.description||e.brief||t.common.defaultWorkspace,te=e=>{S(e),w(``),D(``),z(null),y(!0),s(!1)},ne=(0,Q.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?ji(t):``);if(n){F(!0),z(null),H(null);try{let r=await Rt({autoUnderstand:I,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),w(``),D(``),L(!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=Mi(e);t?(H(t),y(!1)):z(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[x,C,a,T,I]),K=(0,Q.useCallback)(e=>{e.preventDefault(),ne()},[ne]),re=(0,Q.useCallback)(()=>{ne({createWorkspaceRoot:!0})},[ne]),ie=(0,Q.useCallback)(()=>{H(null),y(!0)},[]),ae=e=>{D(e),x===`directory`&&!C.trim()&&w(ji(e))},oe=(e,t)=>(0,$.jsxs)(`button`,{type:`button`,className:b(`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,$.jsx)(c,{className:b(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ee(e)})]}),(0,$.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:G(e)})]},e.id);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(me,{open:o,onOpenChange:s,children:[(0,$.jsx)(ue,{asChild:!0,children:(0,$.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,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:G(e)})]}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ee(e)})]}),(0,$.jsx)(rn,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,$.jsx)(Ue,{children:(0,$.jsxs)(dn,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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,$.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),oe(e,!0),(0,$.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,$.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&W.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&W.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,W.map(e=>oe(e,!1))]}),(0,$.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,$.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:()=>te(`new`),children:[(0,$.jsx)(_,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,$.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:()=>te(`directory`),children:[(0,$.jsx)(ze,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,$.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,$.jsx)(V,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,$.jsx)(N,{open:v,onOpenChange:e=>!P&&y(e),children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,$.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[R?(0,$.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:R}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,$.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,$.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,$.jsx)(xn,{value:T,onChange:ae,disabled:P,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,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,$.jsx)(lt,{checked:I,onChange:L,disabled:P})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:P,children:n.cancel})}),(0,$.jsxs)(Y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:P||!(C.trim()||x===`directory`&&ji(T)),children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,$.jsx)(N,{open:!!B,onOpenChange:e=>{e||H(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:B?Ci(n.workspaceMissingDescription,{workspace:B}):null})]}),B?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ze,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:B})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ie,disabled:P,children:n.workspaceMissingBack}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:re,disabled:P,children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Hi(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),l=w(e=>e.language),d=y(l),f=d.chat.workingDirectory,x=d.projectDetailPage,S=d.projectsPage,C=ve(e=>e.setPageHeader),T=ve(e=>e.clearPageHeader),[D,L]=(0,Q.useState)(null),B=(0,Q.useRef)(D);(0,Q.useLayoutEffect)(()=>{B.current=D},[D]);let[H,U]=(0,Q.useState)(null),[G,te]=(0,Q.useState)([]),[ne,K]=(0,Q.useState)(``),[q,re]=(0,Q.useState)([]),[ie,ae]=(0,Q.useState)(0),[se,le]=(0,Q.useState)(!1),[ue,fe]=(0,Q.useState)(!1),[pe,me]=(0,Q.useState)(!1),[he,_e]=(0,Q.useState)([]),[ye,xe]=(0,Q.useState)(null),Se=(0,Q.useRef)(new Set),[Ce,Oe]=(0,Q.useState)(null),[ke,Ae]=(0,Q.useState)(null),[Ne,Fe]=(0,Q.useState)(null),[Be,He]=(0,Q.useState)(bi),[Ue,Ke]=(0,Q.useState)(!1),[Je,et]=(0,Q.useState)(!1),[nt,it]=(0,Q.useState)(``),[at,ct]=(0,Q.useState)([]),[lt,ft]=(0,Q.useState)(!1),[mt,ht]=(0,Q.useState)(null),[_t,xt]=(0,Q.useState)(!1),[St,Tt]=(0,Q.useState)(null),[Et,Ot]=(0,Q.useState)([]),[At,Nt]=(0,Q.useState)(``),[Lt,Rt]=(0,Q.useState)(!0),[zt,Bt]=(0,Q.useState)(!1),[Vt,Ht]=(0,Q.useState)(!1),[Ut,Wt]=(0,Q.useState)(null),[Jt,Yt]=(0,Q.useState)(!1),[Xt,en]=(0,Q.useState)(`fixed`),[nn,rn]=(0,Q.useState)(``),[an,on]=(0,Q.useState)(null),[sn,dn]=(0,Q.useState)(!1),[fn,vn]=(0,Q.useState)(!1),[Sn,Cn]=(0,Q.useState)(!1),[wn,Tn]=(0,Q.useState)(null),Dn=(0,Q.useRef)(null),On=(0,Q.useRef)(!1),[kn,X]=(0,Q.useState)(null),[jn,Mn]=(0,Q.useState)({title:``,reason:``}),[Nn,Pn]=(0,Q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),Fn=(0,Q.useRef)(Nn),In=`overview`,Z=n?`notes`:Si(t)?t:In,Ln=(0,Q.useMemo)(()=>g(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Rn=(0,Q.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Ln===`/projects`?n:m(n,Ln)},[Ln,e]),zn=(0,Q.useCallback)(t=>{e&&r(Rn(t))},[r,e,Rn]),Bn=(0,Q.useCallback)(()=>{if(Z===`tasks`&&Dn.current){Dn.current.openCreate();return}On.current=!0,zn(`tasks`)},[zn,Z]);(0,Q.useEffect)(()=>{Z!==`tasks`||!On.current||(On.current=!1,Dn.current?.openCreate())},[Z]);let Vn=(0,Q.useCallback)(t=>{e&&r(Rn(t),{replace:!0})},[r,e,Rn]),Hn=(0,Q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Vn(e)},[Vn]),Un=(0,Q.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Z,[Z]);(0,Q.useEffect)(()=>{!e||!t||Si(t)||r(Rn(In),{replace:!0})},[In,r,e,Rn,t]),(0,Q.useEffect)(()=>{if(!e)return;let t=!1;return Rt(!0),X(null),Promise.all([rt(e),st(e),Re(e),z().catch(()=>null),pn(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;L(e),U(n),te(r),xe(a),Ot(i?.agents??[]),Nt(e.defaultAgentId??``);let o=Mr(e);Fn.current=o,Pn(o)}).catch(e=>{t||(xe(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Rt(!1)}),()=>{t=!0}},[e]);let Wn=(0,Q.useCallback)(async()=>{e&&U(await st(e))},[e]);(0,Q.useEffect)(()=>{if(Lt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([rt(e),st(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=B.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=Nr(Fn.current,i,e);Fn.current=t,Pn(t)}B.current=e,L(e),U(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(L(null),U(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,Lt]),(0,Q.useEffect)(()=>{let t,n=n=>{let r=F.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),120))},r=n=>{let r=P.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),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,Wn]);let Gn=(0,Q.useCallback)(async(e,t)=>{Tn(e.id),X(null);try{let n=await tn(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 Me(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 Qe(e.id,r,n.task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[H,x.board.actionFailed,Wn]),Kn=(0,Q.useCallback)(async t=>{e&&(X(null),await Xe({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,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 Wn())},[l,e,Wn]),qn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{return await ut(e,t,(await tn(e)).task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[x.board.actionFailed,Wn]),Jn=(0,Q.useCallback)(async(e,t,n)=>{Tn(e),X(null);try{let r=await tn(e);return r.task.phase!==t&&(r=await Qe(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 ut(e,n,r.task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[x.board.actionFailed,Wn]),Yn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{await gt(e,t,(await tn(e)).task.version),await Wn()}catch(e){await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed)}finally{Tn(null)}},[x.board.actionFailed,Wn]),Xn=(0,Q.useCallback)(async()=>{if(D){le(!0),X(null);try{let e=await cn(D.id,{includeRelated:ue,limit:100});re(e.items),ae(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{le(!1)}}},[D,ue]);(0,Q.useEffect)(()=>{Z===`progress`&&Xn()},[Xn,Z]);let Zn=(0,Q.useCallback)(async()=>{if(!D?.effectiveWorkspaceRoot?.trim()){_e([]),Se.current.clear(),Tt(null);return}xt(!0),Tt(null),Se.current.clear();try{_e(zi((await hn(D.id,``)).entries)),Se.current.add(``)}catch(e){_e([]),Se.current.clear(),Tt(e instanceof Error?e.message:String(e))}finally{xt(!1)}},[D]),Qn=(0,Q.useCallback)(async e=>{if(!(!D?.effectiveWorkspaceRoot?.trim()||Se.current.has(e))){Se.current.add(e),Tt(null);try{let t=await hn(D.id,e);_e(n=>Bi(n,e,zi(t.entries)))}catch(t){Se.current.delete(e),Tt(t instanceof Error?t.message:String(t))}}},[D]),$n=(0,Q.useCallback)(async e=>{if(!D?.effectiveWorkspaceRoot?.trim())return;let t=zi((await hn(D.id,e)).entries);_e(e?n=>Bi(n,e,t):t),Se.current.add(e)},[D]);(0,Q.useEffect)(()=>{Z===`files`&&Zn()},[Zn,Z]);let er=nt.trim();(0,Q.useEffect)(()=>{if(Z!==`files`||!D||!Je||!er){ct([]),ft(!1),ht(null);return}let e=!1;ft(!0),ht(null),ct([]);let t=window.setTimeout(()=>{ce(D.id,er,50).then(t=>{e||ct(t)}).catch(t=>{e||ht(t instanceof Error?t.message:String(t))}).finally(()=>{e||ft(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[er,D,Je,Z]);let tr=(0,Q.useCallback)(async()=>{if(!D)return;let[e,t]=await Promise.all([rt(D.id),st(D.id)]);U(t),L(e)},[D]),nr=(0,Q.useCallback)(async e=>{if(e.preventDefault(),!(!D||!jn.title.trim())){vn(!0),X(null);try{await Ct(D.id,{title:jn.title.trim(),reason:jn.reason.trim()||void 0}),Mn({title:``,reason:``}),Cn(!1),await tr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(!1)}}},[jn.reason,jn.title,D,tr]),rr=(0,Q.useMemo)(()=>(0,$.jsx)(s,{to:Ln,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ln===`/projects`?x.backToProjects:d.sidebar.back,children:(0,$.jsx)(oe,{className:`size-4`,"aria-hidden":!0})}),[Ln,d.sidebar.back,x.backToProjects]),ir=(0,Q.useMemo)(()=>D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{resource:{kind:`project`,id:D.id,revision:String(D.version)},disabled:zt||vi(Nn,D)}),(0,$.jsx)(yr,{projectId:D.id},D.id),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Bn,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),x.board.create]}),(0,$.jsx)(Y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:Gt(D.id),state:{forceNewChat:!0,agentId:D.defaultAgentId},onClick:Hn(`sessions`),children:[(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),x.common.newChat]})})]}):null,[Bn,Hn,x.board.create,x.common.newChat,D,zt,Nn]);(0,Q.useLayoutEffect)(()=>(C({startExtra:rr,main:D?(0,$.jsx)(Vi,{currentProject:D,pm:x,projectsText:S,wd:f}):(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:x.fallbackTitle}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x.fallbackContext})]}),end:ir}),()=>T()),[T,ir,rr,x,D,S,C,f]);function ar(e){L(t=>t?{...t,...e}:null),Nt(e.defaultAgentId??``),pn(e.id).then(xe).catch(()=>xe(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function or(e=Fn.current){if(!(!D||!vi(e,D))){X(null),Wt(null);try{let t=await Mt(D.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},D.version);ar(t);let n=Fn.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};Fn.current=r,Pn(r)}catch(e){let t=Mi(e);throw t?Wt(t):X(e instanceof Error?e.message:String(e)),e}}}function sr(e){e.preventDefault(),Tr.flush()}function cr(e,t=!1){let n={...Fn.current,...e};Fn.current=n,Pn(n),t&&Tr.saveNow(n)}let lr=(0,Q.useCallback)(()=>{if(!D)return;let e=D.workspaceRoot?.trim()??``;en(e?`fixed`:`follow`),rn(e||D.effectiveWorkspaceRoot||``),Yt(!0)},[D]);async function ur(e={}){if(!D)return;let t=Xt===`fixed`?nn.trim():``;if(!(Xt===`fixed`&&!t)){Bt(!0),X(null),Wt(null);try{let n=await Mt(D.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},D.version);ar(n),cr({workspaceRoot:n.workspaceRoot??``}),Yt(!1),Wt(null)}catch(e){let t=Mi(e);t?(Wt(t),Yt(!1)):X(e instanceof Error?e.message:String(e))}finally{Bt(!1)}}}async function dr(){if(!(!D||an)){on(`pin`),X(null);try{ar(D.pinnedAt?await je(D.id,D.version):await un(D.id,D.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{on(null)}}}async function fr(){if(!(!D||an)){on(`archive`),X(null);try{let e=D.status===`archived`?await Ve(D.id,D.version):await Kt(D.id,D.version);ar(e),cr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{on(null)}}}async function pr(){if(D){dn(!0),X(null);try{await bt(D.id,D.version),Ht(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function mr(){if(!(!D||pe)){me(!0),X(null);try{await J(D.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{me(!1)}}}let hr=(0,Q.useCallback)(e=>{Oe(e)},[]),gr=(0,Q.useCallback)((e,t)=>{t||Oe(e)},[]),vr=(0,Q.useCallback)(async(e,t,n)=>{let r=D?.id;if(r)switch(e){case`preview`:t.isDirectory||Oe(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ee(t.path);if(be(_n(e))!==`text`){let n=await Ee(t.path,{projectId:r}),i=R(e)??`application/octet-stream`;qe(e,await n.arrayBuffer(),i)}else{let{content:n}=await qt(t.path,{projectId:r});ge(e,n)}}catch(e){tt(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await I(t.path)&&tt(`success`,d.workspace.pathCopied,void 0,{duration:2500})}catch{tt(`warning`,d.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await It(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWith`:await It(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await It(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),d.workspace.openFileFailed);break;case`revealInFolder`:await It(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),d.workspace.revealFileFailed);break;case`trash`:Ae(t);break;case`delete`:t.isDirectory||Fe(t);break;default:break}},[d.clipboard.copyFailed,d.workspace.openFileFailed,d.workspace.pathCopied,d.workspace.revealFileFailed,D?.id]),br=(0,Q.useCallback)(async()=>{let e=ke;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){tt(`warning`,t?.error??d.workspace.trashFailed,void 0,{duration:4e3});return}Ce===e.path&&Oe(null),Ae(null),await Zn(),tt(`success`,d.workspace.trashSuccess,void 0,{duration:2500})},[d.workspace.trashFailed,d.workspace.trashSuccess,ke,Ce,Zn]),xr=(0,Q.useCallback)(async(e,t)=>{let n=D?.id;if(n)try{await Promise.all(e.map(e=>we(e,t,{projectId:n}))),await $n(t).catch(()=>void 0),tt(`success`,d.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await $n(t).catch(()=>void 0),tt(`warning`,`${d.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[d.workspace.uploadFailed,d.workspace.uploadSuccess,D?.id,$n]),Sr=(0,Q.useCallback)(async()=>{let e=Ne;if(e)try{await We(e.fileId),Ce===e.path&&Oe(null),Fe(null);let t=e.path.lastIndexOf(`/`);await $n(t<0?``:e.path.slice(0,t)).catch(()=>void 0),tt(`success`,d.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){tt(`warning`,`${d.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[d.workspace.deleteFailed,d.workspace.deleteSuccess,Ne,Ce,$n]),Cr=(0,Q.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),Ke(!0);let r=e.clientX,i=Be,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=yi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ke(!1),He(c),xi(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)},[Be]);(0,Q.useEffect)(()=>{Z!==`files`&&Oe(null)},[e,Z]);let wr=!!(D&&vi(Nn,D)),Tr=bn({value:D?Nn:null,dirty:wr,onSave:or,validate:e=>e.name.trim()?null:x.settings.nameRequired});if(Lt)return(0,$.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:x.loading});if(!D)return(0,$.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsxs)(s,{to:Ln,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,$.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),Ln===`/projects`?x.backToProjects:d.sidebar.back]}),(0,$.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:kn||x.notFound})]});let Er=G.slice(0,3),Or=H?.blockers??[],kr=Lr(H?.tasks??[]),Ar=H?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,jr=e=>x.statuses[e]??e,Pr=e=>Ci(x.common.messages,{count:e}),Fr=ne.trim().toLowerCase(),Ir=Fr?G.filter(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=e.name?.trim()||x.sessions.fallbackTitle,i=Pr(e.messageCount??0),a=Ii(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Fr)}):G,Rr=G.length>0&&Ir.length===0,zr=Et.find(e=>e.id===D.defaultAgentId)?.name||D.defaultAgentId||x.settings.globalDefaultAgent,Br=Et.find(e=>e.id===Nn.defaultAgentId),Vr=D.workspaceRoot?.trim()||``,Hr=D.status===`archived`,Ur=!!D.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||D.effectiveWorkspaceRoot||x.common.defaultWorkspace,Kr=Xt===`fixed`?nn.trim()||x.settings.workspacePlaceholder:Br?.workspace||D.effectiveWorkspaceRoot||x.common.defaultWorkspace,qr=(Xt===`fixed`?nn.trim():``)!==Vr&&(Xt===`follow`||!!nn.trim()),Jr=[{id:`overview`,icon:wt,label:x.tabs.overview},{id:`tasks`,icon:Ge,label:x.tabs.tasks},{id:`automations`,icon:mn,label:x.tabs.automations},{id:`files`,icon:ze,label:x.tabs.files},{id:`notes`,icon:W,label:x.tabs.notes},{id:`skills`,icon:De,label:x.tabs.skills},{id:`sessions`,icon:Le,label:x.tabs.sessions},{id:`progress`,icon:yt,label:x.tabs.progress}];async function Yr(){if(!Gr)return;let e=await I(Gr);tt(e?`success`:`warning`,e?d.workspace.pathCopied:d.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){Wt(null),Yt(!0)}return(0,$.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,$.jsx)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:(0,$.jsx)(Dt,{items:[...Jr,{id:`settings`,icon:V,label:x.tabs.settings,suffix:wr?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":x.settings.unsavedChanges}):void 0}],activeTab:Z,onChange:zn,ariaLabel:x.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`})}),kn?(0,$.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:kn}):null,(0,$.jsxs)(`div`,{className:b(`mt-3 min-h-0 flex-1`,Z===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Z===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Z===`overview`?(0,$.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,$.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,$.jsx)(Pt,{projectId:D.id},D.id),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.directionTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ci(x.overview.activitySummary,{moving:Ar,attention:Or.length})})]}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:D.outcome||D.description||D.brief||x.overview.directionFallback}),H?.digest.recommendedAction?(0,$.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:Ci(x.overview.recommendedNext,{action:H.digest.recommendedAction})}):null]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void mr(),disabled:pe,children:[(0,$.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0}),pe?x.overview.savingDigest:x.overview.saveDigest]})]})}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.nextActions}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>zn(`tasks`),children:x.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:kr.length?kr.map(e=>(0,$.jsxs)(s,{to:p(Rn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsxs)(`span`,{className:b(`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:[x.board.phases[e.phase],e.operationalState===`idle`?``:` · ${x.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noNextActions})})]})]}),H?.recentResults.length?(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.recentResults})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:H.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,$.jsxs)(s,{to:p(Rn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[x.overview.resultStatuses[n.status],` · `,x.board.verification[n.verification.status]]})]}),(0,$.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,$.jsx)(h,{content:n.summary,compact:!0})})]},n.runId))})]}):null,D.milestones.length||D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[D.milestones.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.milestones})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.milestones.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:x.statuses[e.status]})]},e.id))})]}):null,D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.projectUpdates})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.recentUpdates.slice(0,3).map(e=>(0,$.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:x.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,$.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,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.attention}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Sn,onClick:()=>Cn(e=>!e),children:[(0,$.jsx)(_,{className:b(`size-3.5 transition-transform`,Sn&&`rotate-45`),"aria-hidden":!0}),x.overview.addBlocker]})]}),Or.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Or.map(e=>{let t=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Qt,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,$.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[x.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${jr(e.status)}`:``]})]});return e.href?(0,$.jsx)(s,{to:e.href,onClick:Hn(Un(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,$.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:x.overview.noBlockedTasks}),Sn?(0,$.jsxs)(`form`,{onSubmit:nr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,$.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:jn.title,onChange:e=>Mn(t=>({...t,title:e.target.value})),placeholder:x.overview.blockerTitlePlaceholder}),(0,$.jsx)(Y,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:fn||!jn.title.trim(),"aria-label":fn?x.overview.addingBlocker:x.overview.addBlocker,title:fn?x.overview.addingBlocker:x.overview.addBlocker,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Te,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:x.overview.recentSessions})]}),(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>zn(`sessions`),children:x.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Er.length?Er.map(e=>(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:wi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==D.defaultAgentId?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noSessions})})]})]})]}):null,Z===`tasks`?(0,$.jsx)(fi,{ref:Dn,tasks:H?.tasks??[],dependencyEdges:H?.dependencyEdges??[],returnTo:Rn(`tasks`),copy:x.board,onAction:Gn,onReorder:qn,onUndoMove:Jn,onDependenciesChange:Yn,onCreate:Kn,actionBusyId:wn}):null,Z===`automations`?(0,$.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,$.jsx)(En,{projectId:D.id,embedded:!0,title:x.automations.title,subtitle:x.automations.hint})}):null,Z===`notes`?(0,$.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,$.jsx)(_r,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(D.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:D.id,listTitle:x.notes.title,listDescription:x.notes.hint,emptyText:x.notes.emptyTitle,emptyDescription:x.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${D.id}`})}):null,Z===`skills`?(0,$.jsx)(Dr,{projectId:D.id,copy:x.skills}):null,Z===`files`?(0,$.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,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:D.effectiveWorkspaceRoot?(0,$.jsxs)(`div`,{"data-project-files-grid":!0,className:b(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,Ue&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Be}px`},children:[(0,$.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[ye?(0,$.jsx)(pt,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:b(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Je&&`bg-surface-hover text-fg`),onClick:()=>et(!0),"aria-label":x.files.search,title:x.files.search,"aria-pressed":Je,children:(0,$.jsx)(Zt,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(Ye,{className:`size-7 shrink-0 rounded-md p-0`,loading:_t,label:d.cron.refresh,onClick:()=>void Zn()})]})]}),Je?(0,$.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,$.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,$.jsx)(Zt,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`text`,role:`searchbox`,value:nt,onChange:e=>it(e.target.value),placeholder:x.files.searchPlaceholder,"aria-label":x.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,$.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":x.files.clearSearch,title:x.files.clearSearch,onClick:()=>{it(``),et(!1)},children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,St?(0,$.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:St}):null,er?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:lt?(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,$.jsx)(Pe,{className:`h-11 w-full`}),(0,$.jsx)(Pe,{className:`h-11 w-full`}),(0,$.jsx)(Pe,{className:`h-11 w-full`})]}):mt?(0,$.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[d.workspace.loadError,`: `,mt]}):at.length===0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:x.files.noSearchResults}):at.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:b(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Ce===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Oe(e.path),title:e.path,children:[(0,$.jsx)(W,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):_t&&he.length===0?(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.files.loading}):(0,$.jsx)(Ze,{tree:he,selectedPath:Ce,onSelectFile:hr,onSelectEntry:gr,onExpandDir:e=>void Qn(e),onAction:vr,onUploadFiles:(e,t)=>void xr(e,t),uploadDropHint:d.workspace.dropToUpload,actionLabels:{preview:d.workspace.preview,download:d.workspace.download,copyPath:d.workspace.copyPath,openDefault:d.workspace.openSystemApp,openDirectory:d.workspace.openInFileManager,openWith:d.workspace.openWith,revealInFolder:d.workspace.revealInFolder,trash:d.workspace.moveToTrash,delete:d.workspace.deleteFile,recommendedApps:d.workspace.recommendedApps,desktopUpdateRequired:d.workspace.desktopUpdateRequired},emptyHint:x.files.emptyDirectory})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":x.files.resizeHandle,className:b(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,Ue&&`bg-surface-hover/70`),onPointerDown:Cr,children:(0,$.jsx)(`div`,{className:b(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,Ue&&`bg-accent/60`)})}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Ce?(0,$.jsx)(Ft,{filePath:Ce,projectId:D.id,agentId:D.defaultAgentId||At||void 0,onClose:()=>Oe(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(ze,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:x.files.previewEmptyTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.files.previewEmptyDescription})]})})})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:x.files.needWorkspace}),(0,$.jsx)(`div`,{children:(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>zn(`settings`),children:x.files.openSettings})})]})})}):null,Z===`sessions`?(0,$.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[G.length?(0,$.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,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:ne,onChange:e=>K(e.currentTarget.value),placeholder:x.sessions.searchPlaceholder,"aria-label":x.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,$.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":x.sessions.clearSearch,onClick:()=>K(``),children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Ir.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Ir.map(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=Ii(e),i=e.name?.trim()||x.sessions.fallbackTitle,a=Pr(e.messageCount??0);return(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`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,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.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,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,$.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,$.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[x.sessions.agent,`: `,n]}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,$.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[x.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x.sessions.noMatches})}):(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x.sessions.emptyTitle}),(0,$.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:x.sessions.emptyDescription})]})})]}):null,Z===`progress`?(0,$.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,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.progress.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Ci(x.progress.count,{count:ie})})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.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,$.jsx)(`input`,{type:`checkbox`,checked:ue,onChange:e=>fe(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),x.progress.includeRelated]}),(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Xn(),disabled:se,children:[(0,$.jsx)($t,{className:b(`size-4`,se&&`animate-spin`),"aria-hidden":!0}),x.common.refresh]})]})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:se&&q.length===0?(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:x.progress.loading}):q.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge`,children:q.map(e=>{let t=x.progress.types[e.type]??e.type,n=x.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ri(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===D.id);return(0,$.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:x.progress.related}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Pi(e)]})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:wi(e.createdAt)})]}),r?(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[x.progress.actor,`: `,Ni(e)]}),(0,$.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[x.progress.source,`: `,Fi(e)]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:x.progress.empty})})]}):null,Z===`settings`?(0,$.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:sr,onBlurCapture:Tr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,$.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.summaryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:x.settings.summaryHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,$.jsx)(`span`,{className:b(`rounded-full px-2 py-0.5 text-xs font-medium`,Ti(Nn.status)),children:x.settings.statuses[Nn.status]}),(0,$.jsx)(yn,{status:Tr.status,error:Tr.error})]})]}),(0,$.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.detailsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.detailsHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsx)(Ei,{label:x.settings.name,children:(0,$.jsx)(`input`,{className:Di(),value:Nn.name,onChange:e=>cr({name:e.target.value})})}),(0,$.jsx)(Ei,{label:x.settings.defaultAgent,children:(0,$.jsxs)(dt,{className:Di(),value:Nn.defaultAgentId,onChange:e=>cr({defaultAgentId:e.target.value},!0),children:[(0,$.jsx)(vt,{value:``,children:x.settings.globalDefaultAgent}),Et.map(e=>(0,$.jsx)(vt,{value:e.id,children:Ie(e,d.agentsSettings)},e.id))]})}),(0,$.jsx)(Ei,{label:x.settings.status,children:Hr?(0,$.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:x.settings.statuses.archived}):(0,$.jsxs)(dt,{className:Di(),value:Nn.status===`archived`?`active`:Nn.status,onChange:e=>cr({status:e.target.value},!0),children:[(0,$.jsx)(vt,{value:`active`,children:x.settings.statuses.active}),(0,$.jsx)(vt,{value:`paused`,children:x.settings.statuses.paused})]})}),(0,$.jsx)(Ei,{label:x.settings.executionMode,hint:x.settings.executionModeHint,children:(0,$.jsxs)(dt,{className:Di(),value:Nn.executionMode,onChange:e=>cr({executionMode:e.target.value},!0),children:[(0,$.jsx)(vt,{value:`managed_worktree`,children:x.settings.executionModeWorktree}),(0,$.jsx)(vt,{value:`local_checkout`,children:x.settings.executionModeLocal})]})}),(0,$.jsx)(Ei,{label:x.settings.description,hint:x.settings.descriptionHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.description,onChange:e=>cr({description:e.target.value})})})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.projectGuidanceTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.projectGuidanceHint})]}),(0,$.jsx)(Ei,{label:x.settings.brief,hint:x.settings.briefHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.brief,onChange:e=>cr({brief:e.target.value})})}),(0,$.jsx)(Ei,{label:x.settings.instructions,hint:x.settings.instructionsHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.instructions,onChange:e=>cr({instructions:e.target.value})})})]})]}),(0,$.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.workspaceRoot}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceIndependentHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?x.settings.workspaceModeFollow:x.settings.workspaceModeFixed}),(0,$.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,$.jsx)(u,{className:`size-4`,"aria-hidden":!0}),x.settings.copyWorkspacePath]}),ye?(0,$.jsx)(pt,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:lr,children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),x.settings.migrateWorkspace]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.currentProjectTitle}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(Oi,{label:x.settings.defaultAgent,value:zr}),(0,$.jsx)(Oi,{label:x.settings.pinState,value:Ur?x.settings.pinned:x.settings.notPinned}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Oi,{label:x.settings.createdAt,value:wi(D.createdAt)||x.common.never}),(0,$.jsx)(Oi,{label:x.settings.updatedAt,value:wi(D.updatedAt)||x.common.never})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.managementTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.managementHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?x.settings.pinnedTitle:x.settings.pinTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.pinHint})]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:an===`pin`,onClick:()=>void dr(),children:[Ur?(0,$.jsx)(ln,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(gn,{className:`size-4`,"aria-hidden":!0}),Ur?x.settings.unpinProject:x.settings.pinProject]})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?x.settings.restoreTitle:x.settings.archiveTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?x.settings.restoreHint:x.settings.archiveHint})]}),(0,$.jsxs)(Y,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:an===`archive`,onClick:()=>void fr(),children:[Hr?(0,$.jsx)($t,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(jt,{className:`size-4`,"aria-hidden":!0}),Hr?x.settings.restoreProject:x.settings.archiveProject]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:x.settings.dangerTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:x.settings.dangerHint})]}),(0,$.jsxs)(Y,{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:()=>Ht(!0),children:[(0,$.jsx)(kt,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,$.jsx)(N,{open:Vt,onOpenChange:e=>{sn||Ht(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.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,$.jsx)(Qt,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.deleteConfirmTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:D?Ci(x.settings.deleteConfirm,{name:D.name}):x.settings.deleteConfirmFallback})]})]}),(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:sn,children:x.common.cancel})}),(0,$.jsxs)(Y,{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:sn||!D,onClick:()=>void pr(),children:[(0,$.jsx)(kt,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})}),(0,$.jsx)($e,{open:!!ke,title:d.workspace.trashConfirmTitle,description:d.workspace.trashConfirmDescription.replace(`{{name}}`,ke?.name??``),confirmLabel:d.workspace.moveToTrash,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void br(),onCancel:()=>Ae(null)}),(0,$.jsx)($e,{open:!!Ne,title:d.workspace.deleteConfirmTitle,description:d.workspace.deleteConfirmDescription.replace(`{{name}}`,Ne?.name??``),confirmLabel:d.workspace.deleteFile,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void Sr(),onCancel:()=>Fe(null)}),(0,$.jsx)(N,{open:Jt,onOpenChange:e=>{zt||Yt(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.workspaceMigrationTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.workspaceMigrationDescription})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:x.settings.workspaceMode}),(0,$.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:b(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Xt===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Xt===`fixed`,onChange:()=>en(`fixed`),disabled:zt}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:x.settings.workspaceModeFixed}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceMigrationFixedHint})]})]}),(0,$.jsxs)(`label`,{className:b(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Xt===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Xt===`follow`,onChange:()=>en(`follow`),disabled:zt}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:x.settings.workspaceModeFollow}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceHint})]})]})]})]}),Xt===`fixed`?(0,$.jsx)(xn,{value:nn,onChange:rn,disabled:zt,wd:f,placeholder:x.settings.workspacePlaceholder,inputClassName:Di(),autoFocus:!0}):null,(0,$.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:x.settings.workspaceMigrationImpact}),(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Ci(x.settings.workspaceCurrent,{workspace:Kr})})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:zt,children:x.common.cancel})}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:zt||!qr,onClick:()=>void ur(),children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMigrationConfirm]})]})]})]})}),(0,$.jsx)(N,{open:!!Ut,onOpenChange:e=>{e||Wt(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.workspaceMissingTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ut?Ci(x.settings.workspaceMissingDescription,{workspace:Ut}):null})]}),Ut?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ze,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:Ut})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:zt,children:x.settings.workspaceMissingBack}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void ur({createWorkspaceRoot:!0}),disabled:zt,children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMissingCreate]})]})]})]})})]})}export{Hi as ProjectDetailPage};
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-B2HK1psj.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./download-Dk-ZjtO6.js";import{t as f}from"./external-link-DjqjBmc3.js";import{F as p,V as m,t as h,z as g}from"./markdown-view-B58RypQ4.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./messages-DBvKzlCl.js";import{t as b}from"./cn-0WouolD0.js";import{a as x,c as S,f as C,n as w,r as T}from"./locale-store-Jnhw2WMv.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./dist-BGTk37IG.js";import{i as P,t as F}from"./tasks-PuIUgF9L.js";import{t as I}from"./copy-to-clipboard-HOJ79TWv.js";import{i as L}from"./vendor-swr-BIWyz7Rc.js";import{a as R}from"./attachment-utils-core-BIOUBrpT.js";import{o as z}from"./agents-admin-api-DvSe10zu.js";import{$d as B,$l as V,$n as H,A as U,Ad as W,Ao as G,Ba as ee,Bs as te,Cd as ne,Cf as K,Co as q,Cr as re,Cs as ie,Cu as ae,Df as oe,Dl as se,Do as ce,Dr as le,Ds as ue,Ed as de,Ef as fe,Eo as J,Er as pe,Es as me,Eu as he,Ga as ge,Gl as _e,Go as ve,Gu as ye,Ha as be,Hl as xe,Ir as Se,Iu as Ce,Ja as we,Jd as Te,Ka as Ee,Kl as De,Ld as Oe,Ni as ke,Nr as Ae,Oo as je,Qc as Me,Qu as Ne,Rc as Pe,Rl as Fe,Rn as Ie,Ru as Le,So as Re,Td as ze,Tl as Be,To as Ve,Tr as He,Ts as Ue,Ua as We,Ud as Ge,Ui as Ke,Wa as qe,Wc as Y,Wu as Je,Xa as Ye,Xc as Xe,Ya as Ze,Yc as Qe,Za as $e,Zl as et,Zs as tt,_ as nt,_o as rt,aa as it,ar as at,au as ot,bo as st,cf as ct,co as lt,dl as ut,ds as dt,er as ft,fa as pt,fd as mt,ff as ht,fl as gt,fr as _t,fs as vt,gd as yt,go as bt,gu as xt,hd as St,ho as Ct,id as wt,if as Tt,ir as Et,is as Dt,ji as Ot,jl as kt,kd as At,kf as jt,ko as Mt,lf as Nt,lo as Pt,lr as Ft,ma as It,md as Lt,mo as Rt,mr as zt,na as Bt,ni as Vt,no as Ht,nr as Ut,nu as Wt,oo as Gt,po as Kt,qa as qt,rd as Jt,ri as Yt,rr as Xt,ru as Zt,sf as Qt,su as $t,ta as en,tl as tn,tr as nn,uf as rn,us as an,v as on,vf as sn,vo as cn,vu as ln,wo as un,ws as dn,wu as fn,xo as pn,yl as mn,yo as hn,yu as gn,za as _n,zl as vn}from"./index-Cmrvxc_s.js";import{n as yn,t as bn}from"./use-autosave-BZw6SkOF.js";import{t as xn}from"./directory-picker-path-field-ummF1SFe.js";import{d as Sn,h as Cn,o as wn}from"./skill-api-DS7l6xfp.js";import{t as Tn}from"./date-picker-D5Xit3eb.js";import{t as En}from"./automations-workspace-C99c2Mps.js";import{i as Dn,r as On,t as kn}from"./workflow-run-setup-panel-CtqK25lT.js";import{t as An}from"./page-context-capture-button-BJVRA9-x.js";import{i as X,n as jn,r as Mn,t as Nn}from"./note-detail-panel-C2lBQc4t.js";import{c as Pn,l as Fn,n as In,o as Z,r as Ln,t as Rn,u as zn}from"./style-DMaxcb-J.js";import{t as Bn}from"./dependency-picker-1aJOOQPo.js";var Vn=n(),Q=e(t(),1),$=r();function Hn(e){let t=(0,Vn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Yt(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=b(`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,$.jsx)(Lt,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.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=b(`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,$.jsx)(Se,{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 Un(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 Wn(e){let t=(0,Vn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Vt(),f=Vt(Kn),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,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let x=y,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=b(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=b(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=m?`Pause`:`Play`,O;t[14]!==h||t[15]!==m?(O=h?(0,$.jsx)(ye,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(ae,{className:`size-3.5`}):(0,$.jsx)(xt,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let A=`${v}%`,j;t[23]===A?j=t[24]:(j=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:A}})}),t[23]=A,t[24]=j);let M;t[25]!==_||t[26]!==p||t[27]!==g?(M=Un(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==j||t[32]!==N?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==w||t[36]!==k?(F=(0,$.jsxs)(`div`,{className:w,onClick:Gn,children:[k,P]}),t[34]=P,t[35]=w,t[36]=k,t[37]=F):F=t[37],F}function Gn(e){return e.stopPropagation()}function Kn(e){return e.toggle}function qn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Jn(e){let t=(0,Vn.c)(89),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d=w(nr)===`zh`,f=n.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(n.title??``)?d?`语音笔记`:`Voice note`:n.title,p;t[0]!==c||t[1]!==n?(p=qn(n,c),t[0]=c,t[1]=n,t[2]=p):p=t[2];let m=p,h=!n.snippet?.trim(),[g]=(0,Q.useState)(tr),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==l?(_=X(n.createdAt,g,l),t[3]=n.createdAt,t[4]=g,t[5]=l,t[6]=_):_=t[6];let v=_,y,x;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),x=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=y,t[10]=x):(y=t[9],x=t[10]);let S=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,C;t[11]===S?C=t[12]:(C=b(`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`,S),t[11]=S,t[12]=C);let T=u?`true`:void 0,E;t[13]===u?E=t[14]:(E=u?(0,$.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]=E);let D;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(D=n.coverAttachmentId?(0,$.jsx)(Hn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(Wn,{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]=D):D=t[20];let O;t[21]!==f||t[22]!==n.title?(O=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:f}),t[21]=f,t[22]=n.title,t[23]=O):O=t[23];let k=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,A;t[24]===k?A=t[25]:(A=b(`truncate text-sm leading-5`,k),t[24]=k,t[25]=A);let j;t[26]!==m||t[27]!==A?(j=(0,$.jsx)(`p`,{className:A,children:m}),t[26]=m,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==O||t[30]!==j?(M=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,j]}),t[29]=O,t[30]=j,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(Oe,{className:`size-4`}),t[32]=N):N=t[32];let P;t[33]===c.actions?P=t[34]:(P=(0,$.jsx)(at,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:er,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:N})}),t[33]=c.actions,t[34]=P);let F;t[35]!==n.id||t[36]!==n.pinned||t[37]!==a?(F=()=>{a(n.id,!n.pinned).catch(Qn)},t[35]=n.id,t[36]=n.pinned,t[37]=a,t[38]=F):F=t[38];let I;t[39]===n.pinned?I=t[40]:(I=n.pinned?(0,$.jsx)(ln,{className:`size-4`}):(0,$.jsx)(gn,{className:`size-4`}),t[39]=n.pinned,t[40]=I);let L=n.pinned?c.unpin:c.pin,R;t[41]!==F||t[42]!==I||t[43]!==L?(R=(0,$.jsxs)(nn,{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:F,children:[I,L]}),t[41]=F,t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==n.id||t[46]!==o?(z=()=>{o(n.id).catch(Zn)},t[45]=n.id,t[46]=o,t[47]=z):z=t[47];let B;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(jt,{className:`size-4`}),t[48]=B):B=t[48];let V;t[49]!==c.archive||t[50]!==z?(V=(0,$.jsxs)(nn,{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:z,children:[B,c.archive]}),t[49]=c.archive,t[50]=z,t[51]=V):V=t[51];let H;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(Et,{className:`my-1 h-px bg-edge-subtle`}),t[52]=H):H=t[52];let U;t[53]!==n.id||t[54]!==s?(U=()=>{s(n.id).catch(Xn)},t[53]=n.id,t[54]=s,t[55]=U):U=t[55];let W;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(kt,{className:`size-4`}),t[56]=W):W=t[56];let G;t[57]!==c.delete||t[58]!==U?(G=(0,$.jsxs)(nn,{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:U,children:[W,c.delete]}),t[57]=c.delete,t[58]=U,t[59]=G):G=t[59];let ee;t[60]!==R||t[61]!==V||t[62]!==G?(ee=(0,$.jsx)(Ut,{children:(0,$.jsxs)(ft,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-overlay p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:$n,children:[R,V,H,G]})}),t[60]=R,t[61]=V,t[62]=G,t[63]=ee):ee=t[63];let te;t[64]!==P||t[65]!==ee?(te=(0,$.jsxs)(Xt,{children:[P,ee]}),t[64]=P,t[65]=ee,t[66]=te):te=t[66];let ne;t[67]!==D||t[68]!==M||t[69]!==te?(ne=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[D,M,te]}),t[67]=D,t[68]=M,t[69]=te,t[70]=ne):ne=t[70];let K;t[71]===n.pinned?K=t[72]:(K=n.pinned&&(0,$.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,$.jsx)(gn,{className:`size-3`})}),t[71]=n.pinned,t[72]=K);let q;t[73]===n.tags?q=t[74]:(q=n.tags?.slice(0,2).map(Yn),t[73]=n.tags,t[74]=q);let re;t[75]===v?re=t[76]:(re=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[75]=v,t[76]=re);let ie;t[77]!==K||t[78]!==q||t[79]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,q,re]}),t[77]=K,t[78]=q,t[79]=re,t[80]=ie):ie=t[80];let ae;return t[81]!==ne||t[82]!==ie||t[83]!==y||t[84]!==x||t[85]!==C||t[86]!==T||t[87]!==E?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:x,className:C,"aria-current":T,children:[E,ne,ie]}),t[81]=ne,t[82]=ie,t[83]=y,t[84]=x,t[85]=C,t[86]=T,t[87]=E,t[88]=ae):ae=t[88],ae}function Yn(e){return(0,$.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 Xn(){}function Zn(){}function Qn(){}function $n(e){return e.stopPropagation()}function er(e){return e.stopPropagation()}function tr(){return Date.now()}function nr(e){return e.language}var rr=3e4;function ir(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function ar({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,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(0),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A=(0,Q.useRef)([]),j=(0,Q.useRef)(0),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.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=[],S(!1),w(0)},[]);(0,Q.useEffect)(()=>()=>P(),[P]);let F=(0,Q.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||ir()||`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,Q.useCallback)(async()=>{if(!(!c||T||x)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=ir(),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(),S(!0),w(0),M.current=setInterval(()=>{w(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},rr)}catch{P(),l?.()}}},[P,c,l,x,F,T]),L=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||v)){y(!0),g(``);try{await o(e)}catch{g(e)}finally{y(!1),D.current?.focus()}}},[h,v,o]),R=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=v||T,B=!!(s||c||p);return(0,$.jsxs)(`div`,{className:b(`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`,x&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[x?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:T,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,$.jsx)(xe,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(Xt,{children:[(0,$.jsx)(at,{asChild:!0,children:(0,$.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,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(Ut,{children:(0,$.jsxs)(ft,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[s?(0,$.jsxs)(nn,{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,$.jsx)(mt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(nn,{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,$.jsx)(Ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(nn,{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,$.jsx)(K,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,x?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(C))}):(0,$.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,$.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||x,onClick:()=>void L(),"aria-label":t,title:t,className:b(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!x?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(Wt,{className:`size-4`,"aria-hidden":!0})})]})}var or={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},sr=240,cr=320,lr=520,ur=560;function dr(e){if(globalThis.localStorage===void 0)return cr;try{let t=globalThis.localStorage.getItem(e);if(!t)return cr;let n=Number(t);return Number.isFinite(n)?n:cr}catch{return cr}}function fr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var pr={thought:vn,todo:_e,voice:Ce,media:mt,bookmark:sn,mixed:vn,task:_e};function mr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function hr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function gr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function _r({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:l,emptyDescription:u,listWidthStorageKey:d=`xopc.notes.listWidth`}){let f=w(e=>e.language),p=y(f).notes,m=!!S(e=>e.conversationId),[h,g]=(0,Q.useReducer)(Ht,or),[x,T]=(0,Q.useState)(!1),[D,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>dr(d)),[B,V]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(!1),[G,ee]=(0,Q.useState)(!1),[ne,K]=(0,Q.useState)(null),[q,ie]=(0,Q.useState)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),[se]=(0,Q.useState)(()=>Date.now()),ce=i(),ue=(0,Q.useCallback)(e=>{let t=ae.current?.clientWidth??window.innerWidth,n=Math.max(sr,t-ur);return Math.max(sr,Math.min(Math.min(lr,n),e))},[]),de=(0,Q.useCallback)(e=>{let t=ue(e);z(t),fr(d,t)},[ue,d]);(0,Q.useLayoutEffect)(()=>{z(e=>ue(e))},[ue]);let{data:fe,mutate:J,isLoading:me}=L((0,Q.useMemo)(()=>m?[`notes-list`,o,h.statusFilter,h.kindFilter,h.pinnedOnly]:null,[m,o,h.statusFilter,h.kindFilter,h.pinnedOnly]),()=>re({status:h.statusFilter===`all`?void 0:h.statusFilter,kind:h.kindFilter===`all`?void 0:h.kindFilter,projectId:o,pinned:h.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ge=me&&!fe,_e=fe?.items??[],ye=fe?.total??0,be=D.trim(),{data:xe,isLoading:Se}=L(m&&x&&be?[`notes-search`,o,be]:null,()=>re({search:be,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),we=xe?.items??[],Te=e?_e.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{I(0)},[be]),(0,Q.useEffect)(()=>{F>=we.length&&I(Math.max(0,we.length-1))},[F,we.length]),(0,Q.useEffect)(()=>{let e=()=>{J().catch(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[J,p.quickCaptureFailedHint,p.refreshFailed]);let Ee=ve(e=>e.setPageHeader),De=ve(e=>e.clearPageHeader),Oe=p.noteCount.replace(`{{count}}`,String(ye)),ke=!r&&ye===0&&c?c:Oe,je=p.searchDialogTitle,Me=p.searchClose,Ne=p.searchClear,Pe=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>T(!0),className:b(`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`,te),"aria-label":je,children:[(0,$.jsx)(Zt,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:je})]}),[je]);(0,Q.useLayoutEffect)(()=>{if(n)return m?(Ee({startExtra:null,main:(0,$.jsxs)(`div`,{className:b(`flex min-w-0 items-center gap-2`,te),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??p.title}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:p.discussionCapture.recoveredTitle}),Oe?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Oe}):null]}),end:Pe}),()=>De()):(De(),()=>De())},[De,m,Pe,s,n,p.title,p.discussionCapture.recoveredTitle,Oe,e,Ee]);let Fe=(0,Q.useMemo)(()=>({justNow:p.justNow,minutesAgo:p.minutesAgo,today:p.today,yesterday:p.yesterday,daysAgo:p.daysAgo,locale:C(f)}),[f,p.justNow,p.minutesAgo,p.today,p.yesterday,p.daysAgo]),Ie=(0,Q.useMemo)(()=>[{id:`recent`,label:p.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:p.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:p.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:p.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:p.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:p.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:p.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:p.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:p.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[p.filterArchived,p.filterInbox,p.filterProcessed,p.kindBookmark,p.kindMedia,p.kindVoice,p.pinned,p.viewRecent,p.viewTasks]),Le=Ie.find(e=>hr(h,e))??Ie[0],Re=s??Le.label,ze=(0,Q.useCallback)(async e=>{K(null);try{let n=o?await _t({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await He(e,`web`);await J(),ce(gr(t,n.id))}catch(e){throw K(`${p.quickCaptureFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`),e}},[t,J,p.quickCaptureFailed,p.quickCaptureFailedHint,ce,o]),Be=(0,Q.useCallback)(async()=>{if(!G){ee(!0),K(null);try{let e=await _t({markdown:``,kind:`thought`,projectId:o,channel:`web`});g({type:`patch`,patch:or}),await J(),ie(e.id),ce(gr(t,e.id))}catch(e){K(`${p.createBlankFailed}: ${e instanceof Error?e.message:p.createBlankFailedHint}`)}finally{ee(!1)}}},[t,G,J,p.createBlankFailed,p.createBlankFailedHint,ce,o]),Ve=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{K(null),await pe(t,`web`),await J()}catch(e){K(`${p.imageUploadFailed}: ${e instanceof Error?e.message:p.imageUploadFailedHint}`)}},e.click()},[J,p.imageUploadFailed,p.imageUploadFailedHint]),Ue=(0,Q.useCallback)(async(e,t)=>{try{K(null),await le(e,t,`web`),await J()}catch(e){K(`${p.voiceUploadFailed}: ${e instanceof Error?e.message:p.voiceUploadFailedHint}`)}},[J,p.voiceUploadFailed,p.voiceUploadFailedHint]),We=(0,Q.useCallback)(()=>{K(`${p.voiceCaptureFailed}: ${p.voiceCaptureFailedHint}`)},[p.voiceCaptureFailed,p.voiceCaptureFailedHint]),Ge=(0,Q.useCallback)(async(e,t)=>{K(null);try{await Ae(e,{pinned:t}),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),Ke=(0,Q.useCallback)(async e=>{K(null);try{await Ae(e,{status:`archived`}),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),qe=(0,Q.useCallback)(async e=>{K(null);try{await zt(e),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),Y=(0,Q.useCallback)(e=>{ce(gr(t,e))},[t,ce]),Je=(0,Q.useCallback)(e=>{ce(gr(t,e)),T(!1)},[t,ce]),Ye=(0,Q.useCallback)(e=>{if(we.length){if(e.key===`ArrowDown`)e.preventDefault(),I(e=>Math.min(we.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),I(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=we[F]??we[0];t&&Je(t.id)}}},[F,Je,we]),Xe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=oe.current;t.setPointerCapture(e.pointerId),V(!0);let r=ae.current?.clientWidth??window.innerWidth,i=Math.max(sr,r-ur),a=Math.min(lr,i),o=e=>Math.max(sr,Math.min(a,e)),s=e.clientX,c=o(R),l=e.pointerId,u=0,f=c,p=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,p=f,n&&(n.style.width=`${p}px`)},h=e=>{f=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}V(!1),ae.current?.style.setProperty(`--notes-list-width`,`${p}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(p),fr(d,p),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[d,R]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Be())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Be]);let Ze=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),de(R-16)):e.key===`ArrowRight`?(e.preventDefault(),de(R+16)):e.key===`Home`?(e.preventDefault(),de(sr)):e.key===`End`&&(e.preventDefault(),de(lr))},[de,R]);return m?(0,$.jsxs)(`div`,{ref:ae,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${R}px`},children:[(0,$.jsxs)(`section`,{ref:oe,className:b(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!B&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`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":U?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ne?(0,$.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,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(dt,{value:Le.id,onChange:e=>{let t=Ie.find(t=>t.id===e.target.value);t&&g({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":p.libraryTitle,children:Ie.map(e=>(0,$.jsx)(vt,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Re}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:ke})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`hidden size-11 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":p.collapseNotesList,title:p.collapseNotesList,children:(0,$.jsx)(he,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>H(o),"aria-label":f===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ce,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Be,disabled:G,className:`inline-flex size-11 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":p.createBlankNote,title:p.createBlankShortcut,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(!0),className:`inline-flex size-11 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":p.searchDialogTitle,title:p.searchDialogTitle,children:(0,$.jsx)(Zt,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:ge?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):_e.length===0?(0,$.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,$.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,$.jsx)(vn,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Te?p.noteOutsideCurrentView:l??p.noNotes}),e&&!Te?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:u??p.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Te?(0,$.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:p.noteOutsideCurrentView}):null,_e.map((t,n)=>{let r=n>0?jn(_e[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[jn(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:b(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Mn(t.createdAt,se,Fe)}),(0,$.jsx)(Jn,{note:t,selected:t.id===e,onPress:Y,onPin:Ge,onArchive:Ke,onDelete:qe,timeLabels:Fe,labels:{pin:p.pin,unpin:p.unpin,archive:p.archive,delete:p.delete,actions:p.noteActions,imageNote:p.imageNote,noText:p.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(ar,{placeholder:p.quickCapturePlaceholder,submitLabel:p.quickCaptureSubmit,actionsLabel:p.quickCaptureActions,imageLabel:p.quickCaptureImage,voiceLabel:p.quickCaptureVoice,stopRecordingLabel:p.stopRecording,onCapture:ze,onImagePick:a?Ve:void 0,onVoiceCapture:a?Ue:void 0,onVoiceError:We,recordingLabel:p.recording,discussionCaptureLabel:p.discussionCapture.title,onDiscussionCapture:()=>H(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.resizeNotesList,"aria-valuemin":sr,"aria-valuemax":lr,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:Xe,onDoubleClick:()=>de(cr),onKeyDown:Ze,title:p.resizeNotesList,className:b(`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`,U?`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,$.jsx)(`span`,{"aria-hidden":!0,className:b(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,B&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:b(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!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":p.expandNotesList,title:p.expandNotesList,children:(0,$.jsx)(he,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Nn,{noteId:e,onBack:()=>ce(t),onSaved:()=>{J().catch(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>T(!0),autoFocus:e===q,onAutoFocusConsumed:()=>ie(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(vn,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:p.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:p.emptyEditorDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>H(o),"aria-label":f===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ce,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`button`,{type:`button`,onClick:Be,disabled:G,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,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),G?p.creatingBlankNote:p.createBlankNote]})]})})]}),(0,$.jsx)(N,{open:x,onOpenChange:T,children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(M,{className:`text-sm font-semibold text-fg`,children:je}),(0,$.jsx)(O,{className:`sr-only`,children:p.searchPlaceholder}),(0,$.jsx)(k,{asChild:!0,children:(0,$.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":Me,children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:D,onChange:e=>P(e.target.value),onKeyDown:Ye,placeholder:p.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`}),D?(0,$.jsx)(`button`,{type:`button`,onClick:()=>P(``),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":Ne,children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:be?Se&&!xe?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):we.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(vn,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:p.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:p.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:p.searchResultsCount.replace(`{{count}}`,String(xe?.total??we.length))}),we.map((e,t)=>{let n=pr[e.kind]||vn,r=mr(e,{imageNote:p.imageNote,noText:p.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Je(e.id),onMouseEnter:()=>I(t),className:b(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===F?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:X(e.updatedAt,se,Fe)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.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,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(Zt,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:p.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:p.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(vn,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.needToken})]})}var vr=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function yr({projectId:e}){let t=w(e=>e.language),n=y(t).workflows,r=t===`zh`,[i,a]=(0,Q.useState)(!1),[o,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(vr),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[T,P]=(0,Q.useState)(null),F=L(i?`workflow-definitions`:null,on,{revalidateOnFocus:!1}),I=L(i?`workflow-agents`:null,z,{revalidateOnFocus:!1}),R=L(i?[`workflow-project-presets`,e]:null,()=>nt(e),{revalidateOnFocus:!1}),B=F.data?.find(e=>e.id===o),V=B?Ot(B,t):null,H=u||I.data?.defaultId,W=F.isLoading||I.isLoading||R.isLoading,G=F.error||I.error||R.error,ee=Dn(B,f,g).valid,te=e=>{b||(e&&(l(``),d(``),p(vr()),h([]),_(!0),C(null),P(null)),a(e))},K=e=>{l(e),p(vr()),_(!0),C(null),h(R.data?.find(t=>t.definitionId===e)?.contextRefs??[])},q=async()=>{if(!(!B||!H||!ee||b||T||W||G)){x(!0),C(null);try{P({runId:(await U({definitionId:B.id,agentId:H,projectId:e,goal:f.goal.trim()||V?.description||B.title,input:On(B,f),contextRefs:m,concurrency:f.concurrency.trim()?Number(f.concurrency):void 0,maxSubagents:f.maxSubagents.trim()?Number(f.maxSubagents):void 0})).runId,agentId:H})}catch(e){C(e instanceof Error?e.message:n.startFailed);return}finally{x(!1)}}};return(0,$.jsxs)(N,{open:i,onOpenChange:te,children:[(0,$.jsx)(D,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`secondary`,className:`h-9 rounded-lg`,children:[(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),y(t).projectDetailPage.common.runWorkflow]})}),(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(46rem,calc(100dvh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:y(t).projectDetailPage.common.runWorkflow}),(0,$.jsx)(O,{className:`mt-1 text-xs text-fg-muted`,children:r?`选择工作流并运行,结果将关联到当前项目。`:`Choose and run a workflow. The run will be linked to this project.`})]}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,className:`size-8 p-0`,disabled:b,"aria-label":n.pickStartClose,children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:T?(0,$.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(c,{className:`size-8 text-success`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-base font-medium text-fg`,children:n.startSuccess}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`工作流正在后台运行,你可以继续处理项目。`:`The workflow is running in the background. You can continue working on your project.`}),(0,$.jsx)(Y,{asChild:!0,variant:`secondary`,children:(0,$.jsx)(s,{to:`/workflows/runs/${encodeURIComponent(T.runId)}?agentId=${encodeURIComponent(T.agentId)}&projectId=${encodeURIComponent(e)}`,children:n.taskOpenDetails})})]}):W?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r?`正在加载工作流`:`Loading workflows`,children:[(0,$.jsx)(Pe,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(Pe,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(Pe,{className:`h-56 w-full rounded-xl`})]}):G?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G instanceof Error?G.message:n.startFailed}):F.data?.length?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n.chooseWorkflow,(0,$.jsxs)(dt,{value:o,onChange:e=>K(e.target.value),disabled:b,"aria-label":n.chooseWorkflow,className:`mt-1 w-full`,children:[(0,$.jsx)(vt,{value:``,children:n.chooseWorkflow}),F.data.map(e=>(0,$.jsx)(vt,{value:e.id,children:Ot(e,t).title},e.id))]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[r?`执行助手`:`Execution assistant`,(0,$.jsx)(dt,{value:H??``,onChange:e=>d(e.target.value),disabled:b,"aria-label":r?`执行助手`:`Execution assistant`,className:`mt-1 w-full`,children:I.data?.agents.map(e=>(0,$.jsx)(vt,{value:e.id,children:Ie(e,y(t).agentsSettings)},e.id))})]}),B&&V?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:V.description}),(0,$.jsx)(zn,{projectId:e,language:t,value:m,onChange:h}),(0,$.jsx)(kn,{definition:B,language:t,value:f,onChange:p,mode:`manual`,onValidityChange:e=>_(e.reason!==`raw-json`)})]}):null,S?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:S}):null]}):(0,$.jsx)(`p`,{className:`py-12 text-center text-sm text-fg-muted`,children:r?`还没有可运行的工作流,请先新建工作流。`:`No workflows are available. Create a workflow to get started.`})}),(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{asChild:!0,variant:`ghost`,disabled:b,children:(0,$.jsx)(s,{to:`/workflows/new?projectId=${encodeURIComponent(e)}`,onClick:e=>{b&&e.preventDefault()},children:n.addWorkflow})}),T?(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{variant:`primary`,children:n.pickStartClose})}):(0,$.jsxs)(Y,{variant:`primary`,disabled:W||!!G||!B||!H||!ee||b,onClick:()=>void q(),children:[(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),b?n.starting:n.runWorkflow]})]})]})]})]})}function br(e){return x(T(`/api/projects/${encodeURIComponent(e)}/skills`))}function xr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Sr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Cr(e,t){let n=new FormData;return n.set(`file`,t),x(T(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function wr(e,t,n={}){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Tr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Er(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function Dr({projectId:e,copy:t}){let n=w(e=>e.language),[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)([]),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!0),[C,T]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(``),[H,U]=(0,Q.useState)(1),[W,G]=(0,Q.useState)(null),[ee,te]=(0,Q.useState)(!1),[K,q]=(0,Q.useState)(``),[re,ie]=(0,Q.useState)(``),ae=(0,Q.useRef)(null),oe=(0,Q.useCallback)(async()=>{S(!0),F(``);try{let t=await br(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){F(e instanceof Error?e.message:String(e))}finally{S(!1)}},[e]);(0,Q.useEffect)(()=>{oe()},[oe]),(0,Q.useEffect)(()=>{let t=!1;return Re(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Q.useEffect)(()=>{if(!f){h(null);return}let e=l.find(e=>e.key===f),t=!1;return h(null),F(``),y(!0),Bt(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||h(e)}).catch(e=>{t||F(e instanceof Error?e.message:String(e))}).finally(()=>{t||y(!1)}),()=>{t=!0}},[f,l]),(0,Q.useEffect)(()=>{if(I!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{te(!0),q(``),wn({q:B,page:H,pageSize:8,sort:`downloads`,signal:e.signal}).then(G).catch(t=>{e.signal.aborted||q(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||te(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[I,H,B]);async function ce(e,t){T(!0),O(t??null),F(``);try{await e(),L(null),ie(``),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1),O(null)}}async function le(t){F(``);try{z((await xr(e,t)).skill)}catch(e){F(e instanceof Error?e.message:String(e))}}async function de(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){T(!0);try{await Er(e,n.directoryId),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}}async function fe(){T(!0),F(``);try{await Sr(e,!0),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}let J=s.find(e=>e.origin===`agents-workspace`),pe=new Map(m?.skills.map(e=>[e.name,e]));return(0,$.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsxs)(me,{children:[(0,$.jsx)(ue,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t.add,(0,$.jsx)(rn,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,$.jsx)(Ue,{children:(0,$.jsxs)(dn,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-overlay p-1.5 shadow-xl`,children:[(0,$.jsx)(jr,{icon:Fe,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>L(`marketplace`)}),(0,$.jsx)(jr,{icon:ne,title:t.source,hint:t.sourceHint,onClick:()=>L(`source`)}),(0,$.jsx)(jr,{icon:se,title:t.upload,hint:t.uploadHint,onClick:()=>ae.current?.click()})]})})]}),(0,$.jsx)(`input`,{ref:ae,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ce(()=>Cr(e,n)),t.target.value=``}})]})}),P?(0,$.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:P}):null,J?.state===`untrusted`?(0,$.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,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Je,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:C,onClick:()=>void fe(),children:[(0,$.jsx)(et,{className:`size-4`,"aria-hidden":!0}),C?t.trusting:t.trustAction]})]}):null,l.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g?t.sessionLoading:f?m?.agentId:t.sessionViewAll})]}),(0,$.jsx)(an,{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,x?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,$.jsx)(Pe,{className:`h-36 rounded-lg`},e))}):r.length?(0,$.jsx)(Or,{title:t.localTitle,items:r,copy:t,busy:C,availabilityByName:pe,onPreview:le,onRemove:de}):(0,$.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!x&&a.length?(0,$.jsx)(Or,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:C,availabilityByName:pe,onPreview:le,onRemove:de}):null,(0,$.jsx)(N,{open:I!==null,onOpenChange:e=>{e||L(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:b(`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`,I===`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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:I===`marketplace`?t.marketplace:t.source}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(v,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:I===`marketplace`?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,$.jsxs)(`div`,{className:`relative mt-3`,children:[(0,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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:B,onChange:e=>{V(e.target.value),U(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),K?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:K}):null,ee&&!W?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,$.jsx)(Pe,{className:`h-32 rounded-lg`},e))}):W?.items.length?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:W.items.map(i=>{let a=it(i,n),o=i.providerId??W.provider,s=Cn(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,$.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(Sn,{name:i.name,className:`size-10`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,$.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,$.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,$.jsx)(Y,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:C||c,onClick:()=>void ce(()=>wr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):ee?null:(0,$.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),W&&W.meta.totalPages>1?(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(W.meta.page)).replace(`{{total}}`,String(W.meta.totalPages))}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ee||H<=1,onClick:()=>U(e=>Math.max(1,e-1)),children:[(0,$.jsx)(Nt,{className:`size-4`}),t.marketplacePrevious]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ee||H>=W.meta.totalPages,onClick:()=>U(e=>e+1),children:[t.marketplaceNext,(0,$.jsx)(ct,{className:`size-4`})]})]})]}):null]}):(0,$.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,$.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:re,onChange:e=>ie(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`secondary`,children:t.close})}),(0,$.jsx)(Y,{type:`button`,disabled:C||!re.trim(),onClick:()=>void ce(()=>Tr(e,re.trim())),children:C?t.installing:t.install})]})]})})]})]})}),(0,$.jsx)(N,{open:!!R,onOpenChange:e=>{e||z(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:R?.name}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(v,{className:`size-4`})})})]}),(0,$.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:R?.bodyMarkdown})]})]})})]})}function Or(e){let t=(0,Vn.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,$.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,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let p;t[4]!==u||t[5]!==d?(p=(0,$.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=p):p=t[6];let m;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,$.jsxs)(`article`,{className:b(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(jt,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:kr(a,e.origin)}),e.writable?null:(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,$.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,$.jsx)(`span`,{className:b(`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:Ar(a,t)}):null]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,$.jsx)(kt,{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],m=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=m}else m=t[13];let h;t[20]===m?h=t[21]:(h=(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:m}),t[20]=m,t[21]=h);let g;return t[22]!==p||t[23]!==h?(g=(0,$.jsxs)(`section`,{className:`grid gap-3`,children:[p,h]}),t[22]=p,t[23]=h,t[24]=g):g=t[24],g}function kr(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 Ar(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 jr(e){let t=(0,Vn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.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,$.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,$.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,$.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,$.jsx)(ie,{asChild:!0,children:(0,$.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 Mr(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 Nr(e,t,n){let r=Mr(t),i=Mr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var Pr={active:0,review:1,ready:2,backlog:3,closed:4},Fr={failed:0,blocked:1,waiting:2,verifying:3,running:4,queued:5,allocating:5,cancelled:6,idle:7},Ir={critical:0,high:1,normal:2,low:3};function Lr(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=Fr[e.operationalState]-Fr[t.operationalState];if(r!==0)return r;let i=Pr[e.phase]-Pr[t.phase];if(i!==0)return i;let a=Ir[e.priority]-Ir[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Rr=[`backlog`,`ready`,`active`,`review`,`closed`];function zr(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 Br(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 Vr(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 Hr(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 Ur(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Hr(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 Wr(e,t){let{incoming:n}=Hr(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 Gr(e,t){let{incoming:n,outgoing:r}=Hr(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 Kr={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 qr(e){let t=(0,Vn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Kr[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=b(`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,$.jsx)(Ln,{type:`target`,position:Fn.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,$.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,$.jsx)(St,{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,$.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,$.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,$.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,$.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,$.jsx)(Ln,{type:`source`,position:Fn.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,$.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 Jr={taskNode:qr};function Yr(e){let t=(0,Vn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(),[g,_]=(0,Q.useState)(),v=(0,Q.useRef)(null),y;t[0]!==r||t[1]!==n?(y=Wr(n,r),t[0]=r,t[1]=n,t[2]=y):y=t[2];let x=y,S;t[3]!==x||t[4]!==u||t[5]!==c||t[6]!==n?(S=u?n.filter(e=>x.has(e.id)):c?n:n.filter(ri),t[3]=x,t[4]=u,t[5]=c,t[6]=n,t[7]=S):S=t[7];let C=S,w;t[8]===C?w=t[9]:(w=new Set(C.map(ni)),t[8]=C,t[9]=w);let T=w,E;if(t[10]!==r||t[11]!==T){let e;t[13]===T?e=t[14]:(e=e=>T.has(e.dependencyTaskId)&&T.has(e.dependentTaskId),t[13]=T,t[14]=e),E=r.filter(e),t[10]=r,t[11]=T,t[12]=E}else E=t[12];let D=E,O;t[15]!==D||t[16]!==C?(O=Ur(C,D),t[15]=D,t[16]=C,t[17]=O):O=t[17];let k=O,A;t[18]!==m||t[19]!==D?(A=m?Gr(m,D):void 0,t[18]=m,t[19]=D,t[20]=A):A=t[20];let j=A,M;t[21]===m?M=t[22]:(M=e=>e.id===m,t[21]=m,t[22]=M);let N=C.find(M),P;t[23]===C?P=t[24]:(P=new Map(C.map(ti)),t[23]=C,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==C){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=C.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=C,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==D){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Pn.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]=j,t[39]=F,t[40]=e):e=t[40],R=D.map(e),t[34]=j,t[35]=F,t[36]=D,t[37]=R}else R=t[37];let z=R,B,V;t[41]!==m||t[42]!==T?(B=()=>{m&&!T.has(m)&&h(void 0)},V=[m,T],t[41]=m,t[42]=T,t[43]=B,t[44]=V):(B=t[43],V=t[44]),(0,Q.useEffect)(B,V);let H,U;t[45]!==z||t[46]!==g?(H=()=>{g&&!z.some(e=>e.id===g)&&_(void 0)},U=[z,g],t[45]=z,t[46]=g,t[47]=H,t[48]=U):(H=t[47],U=t[48]),(0,Q.useEffect)(H,U);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=window.requestAnimationFrame(()=>{v.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=W):W=t[49];let G;t[50]!==u||t[51]!==c||t[52]!==C.length?(G=[u,c,C.length],t[50]=u,t[51]=c,t[52]=C.length,t[53]=G):G=t[53],(0,Q.useEffect)(W,G);let ee;t[54]===m?ee=t[55]:(ee=()=>{m&&v.current?.fitView({nodes:[{id:m}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=m,t[55]=ee);let te=ee,ne;t[56]!==r||t[57]!==o?(ne=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(ei);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=ne):ne=t[58];let K=ne,q;t[59]!==r||t[60]!==o||t[61]!==g?(q=()=>{if(!g)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===g);e&&(_(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map($r)))},t[59]=r,t[60]=o,t[61]=g,t[62]=q):q=t[62];let re=q,ie;t[63]===a.connectHint?ie=t[64]:(ie=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ie);let ae=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(Qr),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==ae||t[68]!==se?(ce=(0,$.jsx)(Y,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Zr),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:te,children:[(0,$.jsx)(At,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,J;t[75]!==a.removeDependency||t[76]!==re||t[77]!==g?(J=g?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:re,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=re,t[77]=g,t[78]=J):J=t[78];let pe;t[79]!==ce||t[80]!==de||t[81]!==fe||t[82]!==J?(pe=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,fe,J]}),t[79]=ce,t[80]=de,t[81]=fe,t[82]=J,t[83]=pe):pe=t[83];let me;t[84]!==ie||t[85]!==pe?(me=(0,$.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:[ie,pe]}),t[84]=ie,t[85]=pe,t[86]=me):me=t[86];let he=C.length>0?(0,$.jsxs)(`div`,{className:b(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,$.jsxs)(Z,{nodes:L,edges:z,nodeTypes:Jr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>h(t.id),onEdgeClick:(e,t)=>_(t.id),onConnect:K,onPaneClick:()=>{h(void 0),_(void 0)},onInit:e=>{v.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Rn,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(In,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,$.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,$.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(Xr)})]}):null,(0,$.jsxs)(s,{to:p(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,$.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function Xr(e){return(0,$.jsx)(`li`,{children:e.title},e.id)}function Zr(e){return!e}function Qr(e){return!e}function $r(e){return e.dependencyTaskId}function ei(e){return e.dependencyTaskId}function ti(e){return[e.id,e]}function ni(e){return e.id}function ri(e){return e.phase!==`closed`}function ii(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var ai={backlog:Tt,ready:Tt,active:Ne,review:Be,closed:l},oi={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 si(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===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-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 ci(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 li(e){let t=(0,Vn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:u}=e,d,f,m,h,g,_,v,y,x,S,C,w,T,E,D,O;t[0]!==c||t[1]!==u||t[2]!==r||t[3]!==n?(g=Vr(n),_=g!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,m=n.phase===`closed`,h=!!(n.dueAt&&n.dueAt<Date.now()&&!m),f=m?l:B,y=n.priority!==`normal`,v=y||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,C=!0,t[20]!==c||t[21]!==n.id?(w=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=w):w=t[22],t[23]===c?T=t[24]:(T=()=>c(``),t[23]=c,t[24]=T),E=di,t[25]!==u||t[26]!==n.id?(D=e=>{e.preventDefault(),e.stopPropagation(),u(n.id)},t[25]=u,t[26]=n.id,t[27]=D):D=t[27],O=`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`,d=s,t[28]!==r||t[29]!==n.id?(x=p(r,n.id),t[28]=r,t[29]=n.id,t[30]=x):x=t[30],S=b(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,_?`pr-19`:g&&`pr-11`),t[0]=c,t[1]=u,t[2]=r,t[3]=n,t[4]=d,t[5]=f,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O):(d=t[4],f=t[5],m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19]);let k=m?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,A;t[31]===k?A=t[32]:(A=b(`mt-0.5 size-4 shrink-0`,k),t[31]=k,t[32]=A);let j;t[33]!==f||t[34]!==A?(j=(0,$.jsx)(f,{className:A,"aria-hidden":!0}),t[33]=f,t[34]=A,t[35]=j):j=t[35];let M=m?`text-fg-subtle`:`text-fg`,N;t[36]===M?N=t[37]:(N=b(`min-w-0 break-words text-sm font-semibold leading-5`,M),t[36]=M,t[37]=N);let P;t[38]!==N||t[39]!==n.title?(P=(0,$.jsx)(`h3`,{className:N,children:n.title}),t[38]=N,t[39]=n.title,t[40]=P):P=t[40];let F;t[41]!==j||t[42]!==P?(F=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[j,P]}),t[41]=j,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(I=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,$.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,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,$.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ui).join(`、`)})]}):n.attention[0]?(0,$.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(Qt,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.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]=I):I=t[48];let L;t[49]!==i||t[50]!==h||t[51]!==v||t[52]!==y||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(L=v?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[y?(0,$.jsx)(`span`,{className:b(`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,$.jsx)(`span`,{className:b(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,si(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,$.jsx)(`span`,{className:b(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,ci(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,$.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,$.jsx)(Ne,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,$.jsxs)(`span`,{className:b(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,h?`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,$.jsx)(ht,{className:`size-3`,"aria-hidden":!0}),ke(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,$.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,$.jsx)(ht,{className:`size-3`,"aria-hidden":!0}),ke(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=h,t[51]=v,t[52]=y,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]=L):L=t[59];let R;t[60]!==d||t[61]!==x||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==S?(R=(0,$.jsxs)(d,{to:x,className:S,children:[F,I,L]}),t[60]=d,t[61]=x,t[62]=F,t[63]=I,t[64]=L,t[65]=S,t[66]=R):R=t[66];let z;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==g||t[71]!==_||t[72]!==n?(z=g?(0,$.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:[_?(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,_),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[_],title:i.actions[_],children:(0,$.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),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[g],title:i.actions[g],children:(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=g,t[71]=_,t[72]=n,t[73]=z):z=t[73];let V;return t[74]!==R||t[75]!==z||t[76]!==C||t[77]!==w||t[78]!==T||t[79]!==E||t[80]!==D||t[81]!==O?(V=(0,$.jsxs)(`article`,{draggable:C,onDragStart:w,onDragEnd:T,onDragOver:E,onDrop:D,className:O,children:[R,z]}),t[74]=R,t[75]=z,t[76]=C,t[77]=w,t[78]=T,t[79]=E,t[80]=D,t[81]=O,t[82]=V):V=t[82],V}function ui(e){return e.title}function di(e){e.preventDefault(),e.stopPropagation()}function fi({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:l,ref:u}){let d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(`board`),[C,T]=(0,Q.useState)(!1),[D,P]=(0,Q.useState)(()=>crypto.randomUUID()),[F,I]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(`normal`),[z,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)([]),[U,W]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(null),K=w(e=>e.language),q=Ke({chat:y(K).chat}),re=zr(e),ie=e.filter(e=>e.phase!==`closed`),ae=(e,t)=>void i(e,t),oe=async(t,n)=>{let r=e.find(e=>e.id===p);if(m(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=Br(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&v({taskId:r.id,phase:r.phase,beforeTaskId:c})},se=async e=>{e.preventDefault();let t=F.trim();if(!(!t||U)){W(!0),te(null);try{let e=z?new Date(`${z}T23:59:59.999`).getTime():void 0;await c({requestId:D,objective:t,priority:L,dependsOnTaskIds:V,attachments:q.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),I(``),R(`normal`),B(``),H([]),q.clearAttachments(),P(crypto.randomUUID()),T(!1)}catch(e){te(e instanceof Error?e.message:r.createFailed)}finally{W(!1)}}},ce=()=>{P(crypto.randomUUID()),I(``),R(`normal`),B(``),H([]),q.clearAttachments(),te(null),T(!0)};(0,Q.useImperativeHandle)(u,()=>({openCreate:ce})),(0,Q.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>v(null),6e3);return()=>window.clearTimeout(e)},[_]);let le=(0,Q.useCallback)(e=>{let t=f.current;!t||t.pointerId!==e.pointerId||(f.current=null,g(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),ue=(0,Q.useCallback)(e=>{if(e.button!==0||ii(e.target))return;let t=d.current;t&&(f.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),de=(0,Q.useCallback)(e=>{let t=f.current,n=d.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,g(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,$.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,$.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,$.jsxs)(G,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:b(`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,$.jsx)(Jt,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:b(`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,$.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,$.jsx)(`div`,{ref:d,className:b(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,h?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:ue,onPointerMove:de,onPointerUp:le,onPointerCancel:le,onLostPointerCapture:e=>{f.current?.pointerId===e.pointerId&&(f.current=null,g(!1))},children:(0,$.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Rr.map(t=>{let i=ai[t],a=re[t];return(0,$.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===p);r&&(r.phase===t||Br(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),oe(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,$.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,$.jsxs)(`div`,{className:b(`flex items-center gap-1.5 rounded-md px-2 py-1`,oi[t]),children:[(0,$.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,$.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,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,$.jsx)(li,{task:e,returnTo:n,copy:r,busy:l===e.id,onAction:ae,onDragStart:m,onDropBefore:e=>void oe(t,e)},e.id))})})]},t)})})}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,$.jsx)(Yr,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,$.jsx)(N,{open:C,onOpenChange:e=>{U||T(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,$.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void se(e),children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,$.jsxs)(`div`,{className:b(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,q.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),U||q.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||q.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),q.setIsDragging(!1),U||q.processFiles(Array.from(e.dataTransfer.files))},children:[(0,$.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:F,onChange:e=>{I(e.target.value),te(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:U}),(0,$.jsx)(en,{attachments:q.attachments,topPadded:!1,onRemove:e=>{U||q.removeAttachment(e)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:U,onClick:()=>q.fileInputRef.current?.click(),children:[(0,$.jsx)(fn,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,$.jsx)(`input`,{ref:q.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{q.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,$.jsx)(dt,{value:L,onChange:e=>R(e.target.value),disabled:U,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,$.jsx)(vt,{value:e,children:r.priorityOptions[e]},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(Tn,{className:`min-h-10 bg-surface-base`,value:z,onChange:B,disabled:U,ariaLabel:r.dueDate})]})]}),(0,$.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,$.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,$.jsx)(Bn,{candidates:ie,selectedIds:V,disabled:U,onChange:H,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),ee?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ee}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:U,children:r.cancel})}),(0,$.jsx)(Y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:U||!F.trim(),children:U?r.creating:K===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),_?(0,$.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,$.jsx)(`span`,{children:r.moved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=_;v(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||v(e)})},children:r.undo})]}):null]})}var pi=new Set([{id:`overview`,icon:wt},{id:`tasks`,icon:Ge},{id:`automations`,icon:mn},{id:`files`,icon:ze},{id:`notes`,icon:W},{id:`skills`,icon:De},{id:`sessions`,icon:Le},{id:`progress`,icon:yt},{id:`settings`,icon:V}].map(e=>e.id)),mi=`xopc.projectFiles.panelWidthPx`,hi=320,gi=220,_i=560;function vi(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 yi(e){return Math.min(_i,Math.max(gi,Math.round(e)))}function bi(){try{let e=window.localStorage.getItem(mi);if(e==null)return hi;let t=Number.parseInt(e,10);return Number.isFinite(t)?yi(t):hi}catch{return hi}}function xi(e){try{window.localStorage.setItem(mi,String(yi(e)))}catch{}}function Si(e){return!!(e&&pi.has(e))}function Ci(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function wi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):ke(n)}function Ti(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 Ei(e){let t=(0,Vn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.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,$.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,$.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 Di(e=!1){return b(`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 Oi(e){let t=(0,Vn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,$.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=b(`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,$.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,$.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 ki(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Ai(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function ji(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Mi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Ni(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 Pi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Fi(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 Ii(e){let t=e.sourceChannel?.trim();return t?Li(t):``}function Li(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ri(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 zi(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 Bi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Bi(e.children,t,n)}:e)}function Vi({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)([e]),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(`new`),[C,w]=(0,Q.useState)(``),[T,D]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(!0),[R,z]=(0,Q.useState)(null),[B,H]=(0,Q.useState)(null),U=(0,Q.useCallback)(async()=>{m(!0),g(null);try{let t=await q({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,Q.useEffect)(()=>{u(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Q.useEffect)(()=>{o&&U()},[U,o]);let W=(0,Q.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=ki(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Ai(t)-Ai(e))},[e.id,l,d]),G=e=>t.statuses[e.status]??e.status,ee=e=>e.description||e.brief||t.common.defaultWorkspace,te=e=>{S(e),w(``),D(``),z(null),y(!0),s(!1)},ne=(0,Q.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?ji(t):``);if(n){F(!0),z(null),H(null);try{let r=await Rt({autoUnderstand:I,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),w(``),D(``),L(!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=Mi(e);t?(H(t),y(!1)):z(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[x,C,a,T,I]),K=(0,Q.useCallback)(e=>{e.preventDefault(),ne()},[ne]),re=(0,Q.useCallback)(()=>{ne({createWorkspaceRoot:!0})},[ne]),ie=(0,Q.useCallback)(()=>{H(null),y(!0)},[]),ae=e=>{D(e),x===`directory`&&!C.trim()&&w(ji(e))},oe=(e,t)=>(0,$.jsxs)(`button`,{type:`button`,className:b(`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,$.jsx)(c,{className:b(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ee(e)})]}),(0,$.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:G(e)})]},e.id);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(me,{open:o,onOpenChange:s,children:[(0,$.jsx)(ue,{asChild:!0,children:(0,$.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,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:G(e)})]}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ee(e)})]}),(0,$.jsx)(rn,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,$.jsx)(Ue,{children:(0,$.jsxs)(dn,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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,$.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),oe(e,!0),(0,$.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,$.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&W.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&W.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,W.map(e=>oe(e,!1))]}),(0,$.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,$.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:()=>te(`new`),children:[(0,$.jsx)(_,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,$.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:()=>te(`directory`),children:[(0,$.jsx)(ze,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,$.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,$.jsx)(V,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,$.jsx)(N,{open:v,onOpenChange:e=>!P&&y(e),children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,$.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[R?(0,$.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:R}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,$.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,$.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,$.jsx)(xn,{value:T,onChange:ae,disabled:P,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,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,$.jsx)(lt,{checked:I,onChange:L,disabled:P})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:P,children:n.cancel})}),(0,$.jsxs)(Y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:P||!(C.trim()||x===`directory`&&ji(T)),children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,$.jsx)(N,{open:!!B,onOpenChange:e=>{e||H(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:B?Ci(n.workspaceMissingDescription,{workspace:B}):null})]}),B?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ze,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:B})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ie,disabled:P,children:n.workspaceMissingBack}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:re,disabled:P,children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Hi(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),l=w(e=>e.language),d=y(l),f=d.chat.workingDirectory,x=d.projectDetailPage,S=d.projectsPage,C=ve(e=>e.setPageHeader),T=ve(e=>e.clearPageHeader),[D,L]=(0,Q.useState)(null),B=(0,Q.useRef)(D);(0,Q.useLayoutEffect)(()=>{B.current=D},[D]);let[H,U]=(0,Q.useState)(null),[G,te]=(0,Q.useState)([]),[ne,K]=(0,Q.useState)(``),[q,re]=(0,Q.useState)([]),[ie,ae]=(0,Q.useState)(0),[se,le]=(0,Q.useState)(!1),[ue,fe]=(0,Q.useState)(!1),[pe,me]=(0,Q.useState)(!1),[he,_e]=(0,Q.useState)([]),[ye,xe]=(0,Q.useState)(null),Se=(0,Q.useRef)(new Set),[Ce,Oe]=(0,Q.useState)(null),[ke,Ae]=(0,Q.useState)(null),[Ne,Fe]=(0,Q.useState)(null),[Be,He]=(0,Q.useState)(bi),[Ue,Ke]=(0,Q.useState)(!1),[Je,et]=(0,Q.useState)(!1),[nt,it]=(0,Q.useState)(``),[at,ct]=(0,Q.useState)([]),[lt,ft]=(0,Q.useState)(!1),[mt,ht]=(0,Q.useState)(null),[_t,xt]=(0,Q.useState)(!1),[St,Tt]=(0,Q.useState)(null),[Et,Ot]=(0,Q.useState)([]),[At,Nt]=(0,Q.useState)(``),[Lt,Rt]=(0,Q.useState)(!0),[zt,Bt]=(0,Q.useState)(!1),[Vt,Ht]=(0,Q.useState)(!1),[Ut,Wt]=(0,Q.useState)(null),[Jt,Yt]=(0,Q.useState)(!1),[Xt,en]=(0,Q.useState)(`fixed`),[nn,rn]=(0,Q.useState)(``),[an,on]=(0,Q.useState)(null),[sn,dn]=(0,Q.useState)(!1),[fn,vn]=(0,Q.useState)(!1),[Sn,Cn]=(0,Q.useState)(!1),[wn,Tn]=(0,Q.useState)(null),Dn=(0,Q.useRef)(null),On=(0,Q.useRef)(!1),[kn,X]=(0,Q.useState)(null),[jn,Mn]=(0,Q.useState)({title:``,reason:``}),[Nn,Pn]=(0,Q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),Fn=(0,Q.useRef)(Nn),In=`overview`,Z=n?`notes`:Si(t)?t:In,Ln=(0,Q.useMemo)(()=>g(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Rn=(0,Q.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Ln===`/projects`?n:m(n,Ln)},[Ln,e]),zn=(0,Q.useCallback)(t=>{e&&r(Rn(t))},[r,e,Rn]),Bn=(0,Q.useCallback)(()=>{if(Z===`tasks`&&Dn.current){Dn.current.openCreate();return}On.current=!0,zn(`tasks`)},[zn,Z]);(0,Q.useEffect)(()=>{Z!==`tasks`||!On.current||(On.current=!1,Dn.current?.openCreate())},[Z]);let Vn=(0,Q.useCallback)(t=>{e&&r(Rn(t),{replace:!0})},[r,e,Rn]),Hn=(0,Q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Vn(e)},[Vn]),Un=(0,Q.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Z,[Z]);(0,Q.useEffect)(()=>{!e||!t||Si(t)||r(Rn(In),{replace:!0})},[In,r,e,Rn,t]),(0,Q.useEffect)(()=>{if(!e)return;let t=!1;return Rt(!0),X(null),Promise.all([rt(e),st(e),Re(e),z().catch(()=>null),pn(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;L(e),U(n),te(r),xe(a),Ot(i?.agents??[]),Nt(e.defaultAgentId??``);let o=Mr(e);Fn.current=o,Pn(o)}).catch(e=>{t||(xe(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Rt(!1)}),()=>{t=!0}},[e]);let Wn=(0,Q.useCallback)(async()=>{e&&U(await st(e))},[e]);(0,Q.useEffect)(()=>{if(Lt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([rt(e),st(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=B.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=Nr(Fn.current,i,e);Fn.current=t,Pn(t)}B.current=e,L(e),U(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(L(null),U(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,Lt]),(0,Q.useEffect)(()=>{let t,n=n=>{let r=F.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),120))},r=n=>{let r=P.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),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,Wn]);let Gn=(0,Q.useCallback)(async(e,t)=>{Tn(e.id),X(null);try{let n=await tn(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 Me(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 Qe(e.id,r,n.task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[H,x.board.actionFailed,Wn]),Kn=(0,Q.useCallback)(async t=>{e&&(X(null),await Xe({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,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 Wn())},[l,e,Wn]),qn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{return await ut(e,t,(await tn(e)).task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[x.board.actionFailed,Wn]),Jn=(0,Q.useCallback)(async(e,t,n)=>{Tn(e),X(null);try{let r=await tn(e);return r.task.phase!==t&&(r=await Qe(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 ut(e,n,r.task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[x.board.actionFailed,Wn]),Yn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{await gt(e,t,(await tn(e)).task.version),await Wn()}catch(e){await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed)}finally{Tn(null)}},[x.board.actionFailed,Wn]),Xn=(0,Q.useCallback)(async()=>{if(D){le(!0),X(null);try{let e=await cn(D.id,{includeRelated:ue,limit:100});re(e.items),ae(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{le(!1)}}},[D,ue]);(0,Q.useEffect)(()=>{Z===`progress`&&Xn()},[Xn,Z]);let Zn=(0,Q.useCallback)(async()=>{if(!D?.effectiveWorkspaceRoot?.trim()){_e([]),Se.current.clear(),Tt(null);return}xt(!0),Tt(null),Se.current.clear();try{_e(zi((await hn(D.id,``)).entries)),Se.current.add(``)}catch(e){_e([]),Se.current.clear(),Tt(e instanceof Error?e.message:String(e))}finally{xt(!1)}},[D]),Qn=(0,Q.useCallback)(async e=>{if(!(!D?.effectiveWorkspaceRoot?.trim()||Se.current.has(e))){Se.current.add(e),Tt(null);try{let t=await hn(D.id,e);_e(n=>Bi(n,e,zi(t.entries)))}catch(t){Se.current.delete(e),Tt(t instanceof Error?t.message:String(t))}}},[D]),$n=(0,Q.useCallback)(async e=>{if(!D?.effectiveWorkspaceRoot?.trim())return;let t=zi((await hn(D.id,e)).entries);_e(e?n=>Bi(n,e,t):t),Se.current.add(e)},[D]);(0,Q.useEffect)(()=>{Z===`files`&&Zn()},[Zn,Z]);let er=nt.trim();(0,Q.useEffect)(()=>{if(Z!==`files`||!D||!Je||!er){ct([]),ft(!1),ht(null);return}let e=!1;ft(!0),ht(null),ct([]);let t=window.setTimeout(()=>{ce(D.id,er,50).then(t=>{e||ct(t)}).catch(t=>{e||ht(t instanceof Error?t.message:String(t))}).finally(()=>{e||ft(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[er,D,Je,Z]);let tr=(0,Q.useCallback)(async()=>{if(!D)return;let[e,t]=await Promise.all([rt(D.id),st(D.id)]);U(t),L(e)},[D]),nr=(0,Q.useCallback)(async e=>{if(e.preventDefault(),!(!D||!jn.title.trim())){vn(!0),X(null);try{await Ct(D.id,{title:jn.title.trim(),reason:jn.reason.trim()||void 0}),Mn({title:``,reason:``}),Cn(!1),await tr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(!1)}}},[jn.reason,jn.title,D,tr]),rr=(0,Q.useMemo)(()=>(0,$.jsx)(s,{to:Ln,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ln===`/projects`?x.backToProjects:d.sidebar.back,children:(0,$.jsx)(oe,{className:`size-4`,"aria-hidden":!0})}),[Ln,d.sidebar.back,x.backToProjects]),ir=(0,Q.useMemo)(()=>D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{resource:{kind:`project`,id:D.id,revision:String(D.version)},disabled:zt||vi(Nn,D)}),(0,$.jsx)(yr,{projectId:D.id},D.id),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Bn,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),x.board.create]}),(0,$.jsx)(Y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:Gt(D.id),state:{forceNewChat:!0,agentId:D.defaultAgentId},onClick:Hn(`sessions`),children:[(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),x.common.newChat]})})]}):null,[Bn,Hn,x.board.create,x.common.newChat,D,zt,Nn]);(0,Q.useLayoutEffect)(()=>(C({startExtra:rr,main:D?(0,$.jsx)(Vi,{currentProject:D,pm:x,projectsText:S,wd:f}):(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:x.fallbackTitle}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x.fallbackContext})]}),end:ir}),()=>T()),[T,ir,rr,x,D,S,C,f]);function ar(e){L(t=>t?{...t,...e}:null),Nt(e.defaultAgentId??``),pn(e.id).then(xe).catch(()=>xe(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function or(e=Fn.current){if(!(!D||!vi(e,D))){X(null),Wt(null);try{let t=await Mt(D.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},D.version);ar(t);let n=Fn.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};Fn.current=r,Pn(r)}catch(e){let t=Mi(e);throw t?Wt(t):X(e instanceof Error?e.message:String(e)),e}}}function sr(e){e.preventDefault(),Tr.flush()}function cr(e,t=!1){let n={...Fn.current,...e};Fn.current=n,Pn(n),t&&Tr.saveNow(n)}let lr=(0,Q.useCallback)(()=>{if(!D)return;let e=D.workspaceRoot?.trim()??``;en(e?`fixed`:`follow`),rn(e||D.effectiveWorkspaceRoot||``),Yt(!0)},[D]);async function ur(e={}){if(!D)return;let t=Xt===`fixed`?nn.trim():``;if(!(Xt===`fixed`&&!t)){Bt(!0),X(null),Wt(null);try{let n=await Mt(D.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},D.version);ar(n),cr({workspaceRoot:n.workspaceRoot??``}),Yt(!1),Wt(null)}catch(e){let t=Mi(e);t?(Wt(t),Yt(!1)):X(e instanceof Error?e.message:String(e))}finally{Bt(!1)}}}async function dr(){if(!(!D||an)){on(`pin`),X(null);try{ar(D.pinnedAt?await je(D.id,D.version):await un(D.id,D.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{on(null)}}}async function fr(){if(!(!D||an)){on(`archive`),X(null);try{let e=D.status===`archived`?await Ve(D.id,D.version):await Kt(D.id,D.version);ar(e),cr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{on(null)}}}async function pr(){if(D){dn(!0),X(null);try{await bt(D.id,D.version),Ht(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function mr(){if(!(!D||pe)){me(!0),X(null);try{await J(D.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{me(!1)}}}let hr=(0,Q.useCallback)(e=>{Oe(e)},[]),gr=(0,Q.useCallback)((e,t)=>{t||Oe(e)},[]),vr=(0,Q.useCallback)(async(e,t,n)=>{let r=D?.id;if(r)switch(e){case`preview`:t.isDirectory||Oe(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ee(t.path);if(be(_n(e))!==`text`){let n=await Ee(t.path,{projectId:r}),i=R(e)??`application/octet-stream`;qe(e,await n.arrayBuffer(),i)}else{let{content:n}=await qt(t.path,{projectId:r});ge(e,n)}}catch(e){tt(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await I(t.path)&&tt(`success`,d.workspace.pathCopied,void 0,{duration:2500})}catch{tt(`warning`,d.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await It(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWith`:await It(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await It(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),d.workspace.openFileFailed);break;case`revealInFolder`:await It(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),d.workspace.revealFileFailed);break;case`trash`:Ae(t);break;case`delete`:t.isDirectory||Fe(t);break;default:break}},[d.clipboard.copyFailed,d.workspace.openFileFailed,d.workspace.pathCopied,d.workspace.revealFileFailed,D?.id]),br=(0,Q.useCallback)(async()=>{let e=ke;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){tt(`warning`,t?.error??d.workspace.trashFailed,void 0,{duration:4e3});return}Ce===e.path&&Oe(null),Ae(null),await Zn(),tt(`success`,d.workspace.trashSuccess,void 0,{duration:2500})},[d.workspace.trashFailed,d.workspace.trashSuccess,ke,Ce,Zn]),xr=(0,Q.useCallback)(async(e,t)=>{let n=D?.id;if(n)try{await Promise.all(e.map(e=>we(e,t,{projectId:n}))),await $n(t).catch(()=>void 0),tt(`success`,d.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await $n(t).catch(()=>void 0),tt(`warning`,`${d.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[d.workspace.uploadFailed,d.workspace.uploadSuccess,D?.id,$n]),Sr=(0,Q.useCallback)(async()=>{let e=Ne;if(e)try{await We(e.fileId),Ce===e.path&&Oe(null),Fe(null);let t=e.path.lastIndexOf(`/`);await $n(t<0?``:e.path.slice(0,t)).catch(()=>void 0),tt(`success`,d.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){tt(`warning`,`${d.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[d.workspace.deleteFailed,d.workspace.deleteSuccess,Ne,Ce,$n]),Cr=(0,Q.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),Ke(!0);let r=e.clientX,i=Be,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=yi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ke(!1),He(c),xi(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)},[Be]);(0,Q.useEffect)(()=>{Z!==`files`&&Oe(null)},[e,Z]);let wr=!!(D&&vi(Nn,D)),Tr=bn({value:D?Nn:null,dirty:wr,onSave:or,validate:e=>e.name.trim()?null:x.settings.nameRequired});if(Lt)return(0,$.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:x.loading});if(!D)return(0,$.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsxs)(s,{to:Ln,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,$.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),Ln===`/projects`?x.backToProjects:d.sidebar.back]}),(0,$.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:kn||x.notFound})]});let Er=G.slice(0,3),Or=H?.blockers??[],kr=Lr(H?.tasks??[]),Ar=H?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,jr=e=>x.statuses[e]??e,Pr=e=>Ci(x.common.messages,{count:e}),Fr=ne.trim().toLowerCase(),Ir=Fr?G.filter(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=e.name?.trim()||x.sessions.fallbackTitle,i=Pr(e.messageCount??0),a=Ii(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Fr)}):G,Rr=G.length>0&&Ir.length===0,zr=Et.find(e=>e.id===D.defaultAgentId)?.name||D.defaultAgentId||x.settings.globalDefaultAgent,Br=Et.find(e=>e.id===Nn.defaultAgentId),Vr=D.workspaceRoot?.trim()||``,Hr=D.status===`archived`,Ur=!!D.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||D.effectiveWorkspaceRoot||x.common.defaultWorkspace,Kr=Xt===`fixed`?nn.trim()||x.settings.workspacePlaceholder:Br?.workspace||D.effectiveWorkspaceRoot||x.common.defaultWorkspace,qr=(Xt===`fixed`?nn.trim():``)!==Vr&&(Xt===`follow`||!!nn.trim()),Jr=[{id:`overview`,icon:wt,label:x.tabs.overview},{id:`tasks`,icon:Ge,label:x.tabs.tasks},{id:`automations`,icon:mn,label:x.tabs.automations},{id:`files`,icon:ze,label:x.tabs.files},{id:`notes`,icon:W,label:x.tabs.notes},{id:`skills`,icon:De,label:x.tabs.skills},{id:`sessions`,icon:Le,label:x.tabs.sessions},{id:`progress`,icon:yt,label:x.tabs.progress}];async function Yr(){if(!Gr)return;let e=await I(Gr);tt(e?`success`:`warning`,e?d.workspace.pathCopied:d.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){Wt(null),Yt(!0)}return(0,$.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,$.jsx)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:(0,$.jsx)(Dt,{items:[...Jr,{id:`settings`,icon:V,label:x.tabs.settings,suffix:wr?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":x.settings.unsavedChanges}):void 0}],activeTab:Z,onChange:zn,ariaLabel:x.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`})}),kn?(0,$.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:kn}):null,(0,$.jsxs)(`div`,{className:b(`mt-3 min-h-0 flex-1`,Z===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Z===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Z===`overview`?(0,$.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,$.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,$.jsx)(Pt,{projectId:D.id},D.id),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.directionTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ci(x.overview.activitySummary,{moving:Ar,attention:Or.length})})]}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:D.outcome||D.description||D.brief||x.overview.directionFallback}),H?.digest.recommendedAction?(0,$.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:Ci(x.overview.recommendedNext,{action:H.digest.recommendedAction})}):null]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void mr(),disabled:pe,children:[(0,$.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0}),pe?x.overview.savingDigest:x.overview.saveDigest]})]})}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.nextActions}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>zn(`tasks`),children:x.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:kr.length?kr.map(e=>(0,$.jsxs)(s,{to:p(Rn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsxs)(`span`,{className:b(`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:[x.board.phases[e.phase],e.operationalState===`idle`?``:` · ${x.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noNextActions})})]})]}),H?.recentResults.length?(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.recentResults})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:H.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,$.jsxs)(s,{to:p(Rn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[x.overview.resultStatuses[n.status],` · `,x.board.verification[n.verification.status]]})]}),(0,$.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,$.jsx)(h,{content:n.summary,compact:!0})})]},n.runId))})]}):null,D.milestones.length||D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[D.milestones.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.milestones})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.milestones.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:x.statuses[e.status]})]},e.id))})]}):null,D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.projectUpdates})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.recentUpdates.slice(0,3).map(e=>(0,$.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:x.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,$.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,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.attention}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Sn,onClick:()=>Cn(e=>!e),children:[(0,$.jsx)(_,{className:b(`size-3.5 transition-transform`,Sn&&`rotate-45`),"aria-hidden":!0}),x.overview.addBlocker]})]}),Or.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Or.map(e=>{let t=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Qt,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,$.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[x.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${jr(e.status)}`:``]})]});return e.href?(0,$.jsx)(s,{to:e.href,onClick:Hn(Un(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,$.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:x.overview.noBlockedTasks}),Sn?(0,$.jsxs)(`form`,{onSubmit:nr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,$.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:jn.title,onChange:e=>Mn(t=>({...t,title:e.target.value})),placeholder:x.overview.blockerTitlePlaceholder}),(0,$.jsx)(Y,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:fn||!jn.title.trim(),"aria-label":fn?x.overview.addingBlocker:x.overview.addBlocker,title:fn?x.overview.addingBlocker:x.overview.addBlocker,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Te,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:x.overview.recentSessions})]}),(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>zn(`sessions`),children:x.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Er.length?Er.map(e=>(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:wi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==D.defaultAgentId?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noSessions})})]})]})]}):null,Z===`tasks`?(0,$.jsx)(fi,{ref:Dn,tasks:H?.tasks??[],dependencyEdges:H?.dependencyEdges??[],returnTo:Rn(`tasks`),copy:x.board,onAction:Gn,onReorder:qn,onUndoMove:Jn,onDependenciesChange:Yn,onCreate:Kn,actionBusyId:wn}):null,Z===`automations`?(0,$.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,$.jsx)(En,{projectId:D.id,embedded:!0,title:x.automations.title,subtitle:x.automations.hint})}):null,Z===`notes`?(0,$.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,$.jsx)(_r,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(D.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:D.id,listTitle:x.notes.title,listDescription:x.notes.hint,emptyText:x.notes.emptyTitle,emptyDescription:x.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${D.id}`})}):null,Z===`skills`?(0,$.jsx)(Dr,{projectId:D.id,copy:x.skills}):null,Z===`files`?(0,$.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,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:D.effectiveWorkspaceRoot?(0,$.jsxs)(`div`,{"data-project-files-grid":!0,className:b(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,Ue&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Be}px`},children:[(0,$.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[ye?(0,$.jsx)(pt,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:b(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Je&&`bg-surface-hover text-fg`),onClick:()=>et(!0),"aria-label":x.files.search,title:x.files.search,"aria-pressed":Je,children:(0,$.jsx)(Zt,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(Ye,{className:`size-7 shrink-0 rounded-md p-0`,loading:_t,label:d.cron.refresh,onClick:()=>void Zn()})]})]}),Je?(0,$.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,$.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,$.jsx)(Zt,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`text`,role:`searchbox`,value:nt,onChange:e=>it(e.target.value),placeholder:x.files.searchPlaceholder,"aria-label":x.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,$.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":x.files.clearSearch,title:x.files.clearSearch,onClick:()=>{it(``),et(!1)},children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,St?(0,$.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:St}):null,er?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:lt?(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,$.jsx)(Pe,{className:`h-11 w-full`}),(0,$.jsx)(Pe,{className:`h-11 w-full`}),(0,$.jsx)(Pe,{className:`h-11 w-full`})]}):mt?(0,$.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[d.workspace.loadError,`: `,mt]}):at.length===0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:x.files.noSearchResults}):at.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:b(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Ce===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Oe(e.path),title:e.path,children:[(0,$.jsx)(W,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):_t&&he.length===0?(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.files.loading}):(0,$.jsx)(Ze,{tree:he,selectedPath:Ce,onSelectFile:hr,onSelectEntry:gr,onExpandDir:e=>void Qn(e),onAction:vr,onUploadFiles:(e,t)=>void xr(e,t),uploadDropHint:d.workspace.dropToUpload,actionLabels:{preview:d.workspace.preview,download:d.workspace.download,copyPath:d.workspace.copyPath,openDefault:d.workspace.openSystemApp,openDirectory:d.workspace.openInFileManager,openWith:d.workspace.openWith,revealInFolder:d.workspace.revealInFolder,trash:d.workspace.moveToTrash,delete:d.workspace.deleteFile,recommendedApps:d.workspace.recommendedApps,desktopUpdateRequired:d.workspace.desktopUpdateRequired},emptyHint:x.files.emptyDirectory})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":x.files.resizeHandle,className:b(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,Ue&&`bg-surface-hover/70`),onPointerDown:Cr,children:(0,$.jsx)(`div`,{className:b(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,Ue&&`bg-accent/60`)})}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Ce?(0,$.jsx)(Ft,{filePath:Ce,projectId:D.id,agentId:D.defaultAgentId||At||void 0,onClose:()=>Oe(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(ze,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:x.files.previewEmptyTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.files.previewEmptyDescription})]})})})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:x.files.needWorkspace}),(0,$.jsx)(`div`,{children:(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>zn(`settings`),children:x.files.openSettings})})]})})}):null,Z===`sessions`?(0,$.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[G.length?(0,$.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,$.jsx)(Zt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:ne,onChange:e=>K(e.currentTarget.value),placeholder:x.sessions.searchPlaceholder,"aria-label":x.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,$.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":x.sessions.clearSearch,onClick:()=>K(``),children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Ir.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Ir.map(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=Ii(e),i=e.name?.trim()||x.sessions.fallbackTitle,a=Pr(e.messageCount??0);return(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`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,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.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,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,$.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,$.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[x.sessions.agent,`: `,n]}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,$.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[x.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x.sessions.noMatches})}):(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x.sessions.emptyTitle}),(0,$.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:x.sessions.emptyDescription})]})})]}):null,Z===`progress`?(0,$.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,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.progress.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Ci(x.progress.count,{count:ie})})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.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,$.jsx)(`input`,{type:`checkbox`,checked:ue,onChange:e=>fe(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),x.progress.includeRelated]}),(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Xn(),disabled:se,children:[(0,$.jsx)($t,{className:b(`size-4`,se&&`animate-spin`),"aria-hidden":!0}),x.common.refresh]})]})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:se&&q.length===0?(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:x.progress.loading}):q.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge`,children:q.map(e=>{let t=x.progress.types[e.type]??e.type,n=x.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ri(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===D.id);return(0,$.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:x.progress.related}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Pi(e)]})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:wi(e.createdAt)})]}),r?(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[x.progress.actor,`: `,Ni(e)]}),(0,$.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[x.progress.source,`: `,Fi(e)]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:x.progress.empty})})]}):null,Z===`settings`?(0,$.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:sr,onBlurCapture:Tr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,$.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.summaryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:x.settings.summaryHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,$.jsx)(`span`,{className:b(`rounded-full px-2 py-0.5 text-xs font-medium`,Ti(Nn.status)),children:x.settings.statuses[Nn.status]}),(0,$.jsx)(yn,{status:Tr.status,error:Tr.error})]})]}),(0,$.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.detailsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.detailsHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsx)(Ei,{label:x.settings.name,children:(0,$.jsx)(`input`,{className:Di(),value:Nn.name,onChange:e=>cr({name:e.target.value})})}),(0,$.jsx)(Ei,{label:x.settings.defaultAgent,children:(0,$.jsxs)(dt,{className:Di(),value:Nn.defaultAgentId,onChange:e=>cr({defaultAgentId:e.target.value},!0),children:[(0,$.jsx)(vt,{value:``,children:x.settings.globalDefaultAgent}),Et.map(e=>(0,$.jsx)(vt,{value:e.id,children:Ie(e,d.agentsSettings)},e.id))]})}),(0,$.jsx)(Ei,{label:x.settings.status,children:Hr?(0,$.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:x.settings.statuses.archived}):(0,$.jsxs)(dt,{className:Di(),value:Nn.status===`archived`?`active`:Nn.status,onChange:e=>cr({status:e.target.value},!0),children:[(0,$.jsx)(vt,{value:`active`,children:x.settings.statuses.active}),(0,$.jsx)(vt,{value:`paused`,children:x.settings.statuses.paused})]})}),(0,$.jsx)(Ei,{label:x.settings.executionMode,hint:x.settings.executionModeHint,children:(0,$.jsxs)(dt,{className:Di(),value:Nn.executionMode,onChange:e=>cr({executionMode:e.target.value},!0),children:[(0,$.jsx)(vt,{value:`managed_worktree`,children:x.settings.executionModeWorktree}),(0,$.jsx)(vt,{value:`local_checkout`,children:x.settings.executionModeLocal})]})}),(0,$.jsx)(Ei,{label:x.settings.description,hint:x.settings.descriptionHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.description,onChange:e=>cr({description:e.target.value})})})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.projectGuidanceTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.projectGuidanceHint})]}),(0,$.jsx)(Ei,{label:x.settings.brief,hint:x.settings.briefHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.brief,onChange:e=>cr({brief:e.target.value})})}),(0,$.jsx)(Ei,{label:x.settings.instructions,hint:x.settings.instructionsHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.instructions,onChange:e=>cr({instructions:e.target.value})})})]})]}),(0,$.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.workspaceRoot}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceIndependentHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?x.settings.workspaceModeFollow:x.settings.workspaceModeFixed}),(0,$.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,$.jsx)(u,{className:`size-4`,"aria-hidden":!0}),x.settings.copyWorkspacePath]}),ye?(0,$.jsx)(pt,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:lr,children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),x.settings.migrateWorkspace]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.currentProjectTitle}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(Oi,{label:x.settings.defaultAgent,value:zr}),(0,$.jsx)(Oi,{label:x.settings.pinState,value:Ur?x.settings.pinned:x.settings.notPinned}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Oi,{label:x.settings.createdAt,value:wi(D.createdAt)||x.common.never}),(0,$.jsx)(Oi,{label:x.settings.updatedAt,value:wi(D.updatedAt)||x.common.never})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.managementTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.managementHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?x.settings.pinnedTitle:x.settings.pinTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.pinHint})]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:an===`pin`,onClick:()=>void dr(),children:[Ur?(0,$.jsx)(ln,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(gn,{className:`size-4`,"aria-hidden":!0}),Ur?x.settings.unpinProject:x.settings.pinProject]})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?x.settings.restoreTitle:x.settings.archiveTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?x.settings.restoreHint:x.settings.archiveHint})]}),(0,$.jsxs)(Y,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:an===`archive`,onClick:()=>void fr(),children:[Hr?(0,$.jsx)($t,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(jt,{className:`size-4`,"aria-hidden":!0}),Hr?x.settings.restoreProject:x.settings.archiveProject]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:x.settings.dangerTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:x.settings.dangerHint})]}),(0,$.jsxs)(Y,{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:()=>Ht(!0),children:[(0,$.jsx)(kt,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,$.jsx)(N,{open:Vt,onOpenChange:e=>{sn||Ht(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.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,$.jsx)(Qt,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.deleteConfirmTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:D?Ci(x.settings.deleteConfirm,{name:D.name}):x.settings.deleteConfirmFallback})]})]}),(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:sn,children:x.common.cancel})}),(0,$.jsxs)(Y,{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:sn||!D,onClick:()=>void pr(),children:[(0,$.jsx)(kt,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})}),(0,$.jsx)($e,{open:!!ke,title:d.workspace.trashConfirmTitle,description:d.workspace.trashConfirmDescription.replace(`{{name}}`,ke?.name??``),confirmLabel:d.workspace.moveToTrash,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void br(),onCancel:()=>Ae(null)}),(0,$.jsx)($e,{open:!!Ne,title:d.workspace.deleteConfirmTitle,description:d.workspace.deleteConfirmDescription.replace(`{{name}}`,Ne?.name??``),confirmLabel:d.workspace.deleteFile,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void Sr(),onCancel:()=>Fe(null)}),(0,$.jsx)(N,{open:Jt,onOpenChange:e=>{zt||Yt(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.workspaceMigrationTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.workspaceMigrationDescription})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:x.settings.workspaceMode}),(0,$.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:b(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Xt===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Xt===`fixed`,onChange:()=>en(`fixed`),disabled:zt}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:x.settings.workspaceModeFixed}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceMigrationFixedHint})]})]}),(0,$.jsxs)(`label`,{className:b(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Xt===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Xt===`follow`,onChange:()=>en(`follow`),disabled:zt}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:x.settings.workspaceModeFollow}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceHint})]})]})]})]}),Xt===`fixed`?(0,$.jsx)(xn,{value:nn,onChange:rn,disabled:zt,wd:f,placeholder:x.settings.workspacePlaceholder,inputClassName:Di(),autoFocus:!0}):null,(0,$.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:x.settings.workspaceMigrationImpact}),(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Ci(x.settings.workspaceCurrent,{workspace:Kr})})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:zt,children:x.common.cancel})}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:zt||!qr,onClick:()=>void ur(),children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMigrationConfirm]})]})]})]})}),(0,$.jsx)(N,{open:!!Ut,onOpenChange:e=>{e||Wt(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.workspaceMissingTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ut?Ci(x.settings.workspaceMissingDescription,{workspace:Ut}):null})]}),Ut?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ze,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:Ut})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:zt,children:x.settings.workspaceMissingBack}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void ur({createWorkspaceRoot:!0}),disabled:zt,children:[(0,$.jsx)(de,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMissingCreate]})]})]})]})})]})}export{Hi as ProjectDetailPage};