@xopcai/xopc 0.0.393 → 0.0.394

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 (293) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1AF2KGju.js → agent-avatar-dicebear-CIpp0ZG6.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DzkKx0Dv.js +1 -0
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-cjJXJj_3.js → agent-plugin-dialog-dWqozfQm.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-CXG8SYr5.js +77 -0
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-B_MFhXXU.js → app-management-settings-panel-SmT1HDDg.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-TYGidVnd.js → appearance-settings-Da9jf0ZC.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-DYaxWrTI.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-BrFfEp0u.js → archive-plugin-D6bFXdsA.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-B7OofUPF.js → automations-page-CM3wI2Nr.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-BSMdKgxD.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-BfAWnYG8.js → binary-plugins-CYKGdQnF.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-_Y-QwZ-3.js → block-editor-Fx38xFF4.js} +40 -40
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-DH9QHI9m.js → browser-automation-inputs-CQMc-Gol.js} +1 -1
  17. package/dist/gateway/static/root/assets/browser-automations-page-C4VhFvyu.js +3 -0
  18. package/dist/gateway/static/root/assets/browser-settings-page-8WZOkfL7.js +3 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-dreSJEes.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-9DviVNpG.js +8 -0
  21. package/dist/gateway/static/root/assets/{capability-header-actions-CFVx3iaZ.js → capability-header-actions-AbVbg7kZ.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-DqGCiVmr.js +1 -0
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-D3GuiG3N.js → chat-terminal-dock-djkqphez.js} +16 -16
  24. package/dist/gateway/static/root/assets/{computer-settings-page-CIbHDlp8.js → computer-settings-page-DE9zl7bK.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-CDyCHkpK.js → connector-service-page--gB9vL3C.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-Bcr2NNoX.js +1 -0
  27. package/dist/gateway/static/root/assets/{date-picker-C424c_g9.js → date-picker-D9q-5a8a.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-BVJh9sYc.js → dependency-picker-Ci0dApIr.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-Q52A8vjp.js → desktop-pet-CjaVVJDQ.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CZr1CXxu.js → desktop-pet-settings-C7TFazyr.js} +1 -1
  31. package/dist/gateway/static/root/assets/device-pairing-wizard-B6S-RpNJ.js +1 -0
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-C6cUgrvg.js → directory-picker-path-field-BpymM_E_.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-DyyfC4gA.js → extension-debug-page-CABAv66K.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-Dho9o3ZZ.js → extension-page-B3dACpKA.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-CdnIGyCH.js → extension-settings-page-B3bwBvgp.js} +1 -1
  36. package/dist/gateway/static/root/assets/gateway-settings-CzA1bTXZ.js +1 -0
  37. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BNpj_mIM.js → highlighted-body-KQOG7T2V-53FJXO9w.js} +1 -1
  38. package/dist/gateway/static/root/assets/home-page-KRPp-I4O.js +2 -0
  39. package/dist/gateway/static/root/assets/{image-generation-api-DwkO2y46.js → image-generation-api-DWRmAkoe.js} +1 -1
  40. package/dist/gateway/static/root/assets/{imports-page-BrYvomnU.js → imports-page-B0Y8iy6G.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-BvAvfZ5R.js +260 -0
  42. package/dist/gateway/static/root/assets/index-CMRCop32.css +1 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BveDYfYk.js → keyboard-shortcuts-settings-CjkACa5H.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-CcIi1BhT.js → local-app-workbench-page-DROP52YA.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-apps-page-B1a69mlV.js → local-apps-page-BELUF7Pg.js} +1 -1
  46. package/dist/gateway/static/root/assets/logs-page-DBm3g8Mu.js +2 -0
  47. package/dist/gateway/static/root/assets/management-settings-CcsW4Z-r.js +1 -0
  48. package/dist/gateway/static/root/assets/{media-plugins-CR1fp6IL.js → media-plugins-UU3qSAhq.js} +1 -1
  49. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CG664NRI.js +1 -0
  50. package/dist/gateway/static/root/assets/note-detail-panel-BS9XnQ8a.js +5 -0
  51. package/dist/gateway/static/root/assets/notes-page-Cfy_WnU-.js +8 -0
  52. package/dist/gateway/static/root/assets/{page-context-capture-button-Cn_WK68Y.js → page-context-capture-button-BD7T7uqR.js} +1 -1
  53. package/dist/gateway/static/root/assets/personal-page-DZEh3dXq.js +1 -0
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-3NbiWGRG.js → preview-open-alternatives--3aGeYJ5.js} +1 -1
  55. package/dist/gateway/static/root/assets/{product-open-page-KKE5-V8k.js → product-open-page-B0ZxsnFO.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-preview-content-BM0oqNxi.js → product-preview-content-CheSHKJq.js} +1 -1
  57. package/dist/gateway/static/root/assets/project-detail-page-Bm7bVHVo.js +1 -0
  58. package/dist/gateway/static/root/assets/projects-page-DPA6QL_Z.js +1 -0
  59. package/dist/gateway/static/root/assets/remote-access-hub-Pxf4EiKh.js +1 -0
  60. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-W0X_Fy7b.js → runtime-tools-settings-panel-2BnqCeNt.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-DNM2Zdyr.js → schema-form-KmnpEBtP.js} +1 -1
  62. package/dist/gateway/static/root/assets/sessions-page-d0anT7iK.js +1 -0
  63. package/dist/gateway/static/root/assets/settings-advanced-gate-DfDaPyh5.js +1 -0
  64. package/dist/gateway/static/root/assets/{settings-form-section-DCSHPFAN.js → settings-form-section-Db5XOKMH.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-page-B18UbbaJ.js → settings-page-aRM6ax6B.js} +1 -1
  66. package/dist/gateway/static/root/assets/setup-status-panel-DCNAcalA.js +1 -0
  67. package/dist/gateway/static/root/assets/{share-preview-page-BLnS3hoH.js → share-preview-page-DR3Esqa_.js} +1 -1
  68. package/dist/gateway/static/root/assets/shares-settings-CvEwnQch.js +1 -0
  69. package/dist/gateway/static/root/assets/{skill-api-CcYGkRPL.js → skill-api-BJBU8YgD.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skill-reload-api-PnUZjoPK.js → skill-reload-api-DEQ1bdN9.js} +1 -1
  71. package/dist/gateway/static/root/assets/skills-page-BXNFSIIy.js +2 -0
  72. package/dist/gateway/static/root/assets/sliding-indicator-hwz0sx3h.js +1 -0
  73. package/dist/gateway/static/root/assets/{style-BQqU-1pP.js → style-Df_wL13k.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-C974myUM.js → system-settings-panel-DWnyafB7.js} +1 -1
  75. package/dist/gateway/static/root/assets/task-detail-page-DyHDW8A5.js +2 -0
  76. package/dist/gateway/static/root/assets/tracing-settings-page-vvREqbQ3.js +1 -0
  77. package/dist/gateway/static/root/assets/{tunnel-api-DWyI3uA3.js → tunnel-api-BEzsymVO.js} +1 -1
  78. package/dist/gateway/static/root/assets/usage-page-ByYOqsHo.js +1 -0
  79. package/dist/gateway/static/root/assets/{use-autosave-CY0YuljR.js → use-autosave-Cp4kZ3E-.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-model-page-D0qeCXwD.js +2 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-BNG4ixJE.js → voice-api-key-field-DH3OdR-w.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-CohIoAre.js → work-discovery-overlay-CICdfBBR.js} +1 -1
  83. package/dist/gateway/static/root/assets/workflow-run-setup-panel-VIJQCUY5.js +3 -0
  84. package/dist/gateway/static/root/assets/workflows-page-DDYp2Jbo.js +6 -0
  85. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-C_COnY_B.js → xopc-cloud-account-card-BTMfgVTk.js} +1 -1
  86. package/dist/gateway/static/root/index.html +3 -2
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/agent-manager.js +10 -10
  89. package/dist/src/agent/background-review/run-background-review.js +5 -5
  90. package/dist/src/agent/coding/run-verification.js +4 -4
  91. package/dist/src/agent/context/execution-context.js +3 -3
  92. package/dist/src/agent/context/project-context.js +3 -3
  93. package/dist/src/agent/embedded/agent-profile-context.js +10 -4
  94. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  95. package/dist/src/agent/embedded/run-for-session.js +2 -2
  96. package/dist/src/agent/embedded/run-turn.js +1 -1
  97. package/dist/src/agent/external-tools/cliProvider.js +1 -1
  98. package/dist/src/agent/external-tools/composio-provider.js +1 -1
  99. package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
  100. package/dist/src/agent/prompt/response-language.js +1 -1
  101. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  102. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  103. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  104. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  105. package/dist/src/agent/service.js +9 -9
  106. package/dist/src/agent/session/session-config-service.js +2 -2
  107. package/dist/src/agent/session/session-inspector.js +1 -1
  108. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  109. package/dist/src/agent/skills/hub-pull.js +2 -2
  110. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  111. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  112. package/dist/src/agent/tasks/task-judge-service.js +6 -6
  113. package/dist/src/agent/tools/exec-command.d.ts +2 -0
  114. package/dist/src/agent/tools/exec-command.js +45 -1
  115. package/dist/src/agent/tools/factory.js +4 -4
  116. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  117. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  118. package/dist/src/agent/tools/personal-request-tool.js +2 -2
  119. package/dist/src/agent/tools/personal-task-tool.js +6 -6
  120. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  121. package/dist/src/agent/tools/review-workspace.js +1 -1
  122. package/dist/src/agent/tools/skills-tools.js +1 -1
  123. package/dist/src/agent/tools/task-collaboration-tool.js +3 -3
  124. package/dist/src/agent/tools/write.js +1 -1
  125. package/dist/src/agent/tools/xopc-use-tool.js +4 -4
  126. package/dist/src/agent-matching/delegation-service.js +1 -1
  127. package/dist/src/ai-assist/text-assist.js +1 -1
  128. package/dist/src/auth/oauth/xopc-cloud.js +2 -2
  129. package/dist/src/auth/sync-provider-auth.js +1 -1
  130. package/dist/src/automations/domain/index.js +1 -1
  131. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  132. package/dist/src/automations/index.js +2 -2
  133. package/dist/src/capabilities/store-connector.js +2 -2
  134. package/dist/src/channels/index.js +1 -1
  135. package/dist/src/channels/manager.js +1 -1
  136. package/dist/src/chat-commands/builtins/config.js +1 -1
  137. package/dist/src/chat-commands/context.js +1 -1
  138. package/dist/src/cli/commands/channels.js +1 -1
  139. package/dist/src/cli/commands/connectors.js +1 -1
  140. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  141. package/dist/src/cli/commands/models.js +1 -1
  142. package/dist/src/cli/commands/onboard/model.js +1 -1
  143. package/dist/src/cli/commands/onboard.js +1 -1
  144. package/dist/src/cli/commands/skills.js +1 -1
  145. package/dist/src/computer/flows.js +1 -1
  146. package/dist/src/config/agent-model-intents.js +1 -1
  147. package/dist/src/config/index.js +1 -1
  148. package/dist/src/config/loader.js +1 -1
  149. package/dist/src/config/models-json.d.ts +16 -16
  150. package/dist/src/config/models-json.js +1 -1
  151. package/dist/src/config/schema.js +6 -6
  152. package/dist/src/connectors/composio-sessions.js +1 -1
  153. package/dist/src/connectors/composio.js +1 -1
  154. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  155. package/dist/src/connectors/connected-source-understanding.js +2 -2
  156. package/dist/src/connectors/health.js +1 -1
  157. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  158. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  159. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  160. package/dist/src/extensions/api.js +1 -1
  161. package/dist/src/extensions/install.js +1 -1
  162. package/dist/src/extensions/sdk/index.js +1 -1
  163. package/dist/src/extensions/update.js +1 -1
  164. package/dist/src/gateway/file-path-classifier.js +1 -1
  165. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  166. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  167. package/dist/src/gateway/hono/routes/config-patch/misc.js +4 -4
  168. package/dist/src/gateway/hono/routes/context-sources.js +2 -2
  169. package/dist/src/gateway/hono/routes/memory-learning.js +2 -2
  170. package/dist/src/gateway/hono/routes/models.js +2 -2
  171. package/dist/src/gateway/hono/routes/projects.js +3 -3
  172. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  173. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  174. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  175. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  176. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  177. package/dist/src/gateway/hono/routes/user-model.js +6 -6
  178. package/dist/src/gateway/hono/routes/voice.js +1 -1
  179. package/dist/src/gateway/media-access.js +1 -1
  180. package/dist/src/gateway/service/agent-runner.js +3 -3
  181. package/dist/src/gateway/service/marketplace-service.js +2 -2
  182. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  183. package/dist/src/gateway/service/session-command-service.js +2 -2
  184. package/dist/src/gateway/service.js +31 -31
  185. package/dist/src/gateway/session-context-summary.js +4 -4
  186. package/dist/src/home-intelligence/generator.js +2 -2
  187. package/dist/src/home-intelligence/host.js +2 -2
  188. package/dist/src/imports/compatibility.js +1 -1
  189. package/dist/src/imports/inventory.js +3 -3
  190. package/dist/src/imports/productImport.js +2 -2
  191. package/dist/src/imports/runtime.js +1 -1
  192. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  193. package/dist/src/knowledge-memory/repository.js +1 -1
  194. package/dist/src/local-apps/service.js +2 -2
  195. package/dist/src/memory-learning/source-learning.js +2 -2
  196. package/dist/src/notes/index.js +1 -1
  197. package/dist/src/notes/service.js +3 -3
  198. package/dist/src/personal-agent/capability-service.js +2 -2
  199. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  200. package/dist/src/personal-agent/proactivity/service.js +5 -5
  201. package/dist/src/personal-agent/prompt-context.js +7 -7
  202. package/dist/src/personal-agent/reply-composer.js +7 -7
  203. package/dist/src/personal-agent/request-delivery.js +2 -2
  204. package/dist/src/personal-agent/request-service.js +6 -6
  205. package/dist/src/personal-agent/result-reader.js +1 -1
  206. package/dist/src/personal-agent/service.js +1 -1
  207. package/dist/src/personal-agent/task-cancel.js +1 -1
  208. package/dist/src/platform/index.js +1 -1
  209. package/dist/src/projects/index.js +1 -1
  210. package/dist/src/projects/project-agent-suggestion.js +1 -1
  211. package/dist/src/projects/project-service.js +1 -1
  212. package/dist/src/projects/project-skill-service.js +2 -2
  213. package/dist/src/projects/workspace.js +1 -1
  214. package/dist/src/providers/cloud-thinking.d.ts +3 -0
  215. package/dist/src/providers/cloud-thinking.js +13 -0
  216. package/dist/src/providers/model-registry.js +4 -1
  217. package/dist/src/providers/register-runtime-providers.js +3 -0
  218. package/dist/src/routing/agent-session-key.js +1 -1
  219. package/dist/src/session/index.js +1 -1
  220. package/dist/src/session/init-session-turn.js +1 -1
  221. package/dist/src/session/resolve-session.js +1 -1
  222. package/dist/src/session/store.js +2 -2
  223. package/dist/src/share/hosted-session-share.js +2 -2
  224. package/dist/src/share/session-share-service.js +1 -1
  225. package/dist/src/tasks/capabilities/read.js +2 -2
  226. package/dist/src/tasks/capabilities/write.js +1 -1
  227. package/dist/src/tasks/home-query-service.js +1 -1
  228. package/dist/src/tasks/index.js +3 -3
  229. package/dist/src/tasks/task-allocation-service.js +5 -5
  230. package/dist/src/tasks/task-application-service.js +6 -6
  231. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  232. package/dist/src/tasks/task-context-assembler.js +2 -2
  233. package/dist/src/tasks/task-contract-planner.js +1 -1
  234. package/dist/src/tasks/task-handoff-service.js +1 -1
  235. package/dist/src/tasks/task-handoff.js +5 -5
  236. package/dist/src/tasks/task-main-update-decision-service.js +3 -3
  237. package/dist/src/tasks/task-model-call.js +1 -1
  238. package/dist/src/tasks/task-research-result.js +4 -4
  239. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  240. package/dist/src/tasks/task-result-delivery-service.js +2 -2
  241. package/dist/src/tasks/task-run-coordinator.js +4 -4
  242. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  243. package/dist/src/tui/backends/embedded-backend.js +5 -5
  244. package/dist/src/tui/tui-commands.js +2 -2
  245. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  246. package/dist/src/tui/tui-startup-resources.js +3 -3
  247. package/dist/src/tui/tui.js +1 -1
  248. package/dist/src/user-context/access-policy.js +2 -2
  249. package/dist/src/user-model/bootstrap.js +1 -1
  250. package/dist/src/user-model/capture/executor.js +1 -1
  251. package/dist/src/user-model/index.js +2 -2
  252. package/dist/src/voice/realtime/memory-context.js +5 -5
  253. package/dist/src/voice/realtime/runtime.js +1 -1
  254. package/dist/src/work-discovery/incremental-repository.js +1 -1
  255. package/dist/src/work-discovery/service.js +7 -7
  256. package/dist/src/workflows/context/workflow-context.js +1 -1
  257. package/dist/src/workflows/service/workflow-run-service.js +5 -5
  258. package/package.json +3 -3
  259. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +0 -1
  260. package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +0 -77
  261. package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +0 -1
  262. package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +0 -6
  263. package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +0 -3
  264. package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +0 -3
  265. package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +0 -2
  266. package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +0 -8
  267. package/dist/gateway/static/root/assets/channels-BXA55GY2.js +0 -1
  268. package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +0 -1
  269. package/dist/gateway/static/root/assets/device-pairing-wizard-D_WWTsze.js +0 -1
  270. package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +0 -1
  271. package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +0 -2
  272. package/dist/gateway/static/root/assets/index-CKdOZoVu.js +0 -260
  273. package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +0 -1
  274. package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +0 -2
  275. package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +0 -1
  276. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +0 -1
  277. package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +0 -5
  278. package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +0 -8
  279. package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +0 -1
  280. package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +0 -1
  281. package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +0 -1
  282. package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +0 -1
  283. package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +0 -1
  284. package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +0 -1
  285. package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +0 -1
  286. package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +0 -1
  287. package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +0 -2
  288. package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +0 -2
  289. package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +0 -1
  290. package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +0 -1
  291. package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +0 -2
  292. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BXI8eyYh.js +0 -3
  293. package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +0 -6
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./check-DUBLcKHA.js";import{F as o}from"./markdown-view-PrKvVpRh.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./messages-CaeL_miw.js";import{a as l,n as u,r as d}from"./locale-store-CE7L6MlS.js";import{T as f,d as p,ot as m,t as h}from"./session-manager-DoFTlgNz.js";import{Ao as g,Bs as _,Cf as v,Cs as y,Gs as b,Gu as x,Ic as S,Io as C,J as w,Sf as T,Ss as E,Ts as D,Uo as O,Y as k,Zi as A,Zl as ee,_u as j,cs as M,et as N,ji as P,n as te,pu as ne,rc as re,tc as ie,wf as F,wl as ae,ws as oe,xs as se,ys as ce,zl as I}from"./index-CKdOZoVu.js";import{l as L,n as le,t as ue}from"./voice-config-api-D0Wscn9W.js";var R=n(),z=e(t(),1),B=r();function de(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var fe=de();function pe({zh:e}){let[t,n]=(0,z.useState)(),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(``),u=s.trim().toLowerCase().replaceAll(`_`,` `),f=[...new Set([...fe,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(u)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,z.useEffect)(()=>{let e=!0;return l(d(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(m.parse(t.payload))}).catch(t=>{e&&i(String(t))}),()=>{e=!1}},[]);async function p(e){if(!(!t||a)){o(!0),i(``);try{let r=await l(d(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(m.parse(r.payload))}catch(e){i(String(e));let t=await l(d(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(m.parse(t.payload))}finally{o(!1)}}}return(0,B.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,B.jsx)(S,{className:`h-9 w-full`}):t&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(M,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:a,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void p({mode:e})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`静默开始`:`Quiet from`,(0,B.jsx)(M,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:a,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void p({quietStart:Number(e)})})]}),(0,B.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`静默结束`:`Quiet until`,(0,B.jsx)(M,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:a,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void p({quietEnd:Number(e)})})]})]}),(0,B.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,B.jsx)(M,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:f,disabled:a,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:s,onSearchChange:c,statusMessage:f.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{c(``),e!==t.timezone&&p({timezone:e})}})]}),(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}var V=[`intro`,`identity`,`voice`,`connections`],me=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function he(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function ge(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await l(d(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),C(e)}function _e({modelsAvailable:e,onCreated:t}){let n=u(e=>e.language)===`zh`,r=u(e=>e.language),[o,s]=(0,z.useState)(`intro`),[f,p]=(0,z.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[m,h]=(0,z.useState)(!1),[_,y]=(0,z.useState)(!1),[x,C]=(0,z.useState)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),[A,ee]=(0,z.useState)(null),[j,M]=(0,z.useState)(!0),[P,te]=(0,z.useState)([]),[oe,se]=(0,z.useState)(null),ce=(0,z.useRef)(null),I=(0,z.useRef)(null),[R,de]=(0,z.useState)([]),[fe,pe]=(0,z.useState)(!0),[_e,ve]=(0,z.useState)([]),[H,U]=(0,z.useState)(null);(0,z.useEffect)(()=>{let e=!1;return l(d(`/api/personal-agent/onboarding`)).then(t=>{e||(s(t.payload.step),p(t.payload.draft))}).catch(t=>{e||C(t instanceof Error?t.message:String(t))}).finally(()=>{e||h(!0)}),()=>{e=!0}},[]),(0,z.useEffect)(()=>{if(!m)return;let e=window.setTimeout(()=>{l(d(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:o,draft:f})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[f,m,o]),(0,z.useEffect)(()=>{let e=!1;return ue().then(t=>{e||(t.tts&&t.enabled?ee({provider:t.tts.provider,model:t.tts.model,enabled:!0}):M(!1))}).catch(()=>{e||M(!1)}),()=>{e=!0}},[]),(0,z.useEffect)(()=>{if(!A?.enabled)return;let e=!1;return le(A.provider,A.model,`realtime`).then(t=>{e||te(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||M(!1)}),()=>{e=!0}},[A]),(0,z.useEffect)(()=>{if(o!==`connections`)return;let e=!1;return pe(!0),Promise.allSettled([ie({page:1,pageSize:24,verification:`verified`}),re()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];de(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&ve(n.value),pe(!1)}}),()=>{e=!0}},[o]),(0,z.useEffect)(()=>()=>{I.current?.abort(),ce.current?.close()},[]),(0,z.useEffect)(()=>()=>{D&&URL.revokeObjectURL(D)},[D]);let W=async(e,t=f)=>{await l(d(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),s(e)},ye=async e=>{C(null);let t=V[Math.max(0,Math.min(V.length-1,V.indexOf(o)+e))];try{await W(t)}catch(e){C(e instanceof Error?e.message:String(e))}},G=async(n=!1)=>{if(!(!e||_)){y(!0),C(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:f,r=e.voice&&A?.enabled&&P.some(t=>t.id===e.voice)?{provider:A.provider,model:A.model,voice:e.voice}:void 0,i=(await l(d(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&T)try{await ge(i.agentId,T),i=(await l(d(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`,preferences:i.preferences})})).payload}catch{a=!0}t(i,a)}catch(e){C(e instanceof Error?e.message:String(e))}finally{y(!1)}}},be=(0,z.useCallback)(async e=>{I.current?.abort(),ce.current?.close();let t=new AbortController;I.current=t,se(e),C(null);try{let n=new b;ce.current=n,await n.start();let r=await L(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>se(null))}catch(e){t.signal.aborted||C(e instanceof Error?e.message:String(e)),se(null)}},[]);if(!m)return(0,B.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,B.jsx)(S,{className:`h-10 w-2/3`}),(0,B.jsx)(S,{className:`h-64 w-full rounded-2xl`}),(0,B.jsx)(S,{className:`h-12 w-full rounded-xl`})]});let K=V.indexOf(o),xe={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[o];return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,B.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,B.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[K>0?(0,B.jsxs)(`button`,{type:`button`,disabled:_,onClick:()=>void ye(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm 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:opacity-40`,children:[(0,B.jsx)(F,{className:`size-4`}),n?`上一步`:`Back`]}):(0,B.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,B.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,B.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":K+1,"aria-valuemin":1,"aria-valuemax":V.length,children:V.map((e,t)=>(0,B.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=K?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,B.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,B.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,B.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,B.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:D?(0,B.jsx)(`img`,{src:D,alt:``,className:`size-14 rounded-xl object-cover`}):(0,B.jsx)(g,{appearance:f.appearance,className:`size-14`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,B.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:f.displayName||`Ada`})]})]}),(0,B.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${K+1} 步 · 共 ${V.length} 步`:`Step ${K+1} of ${V.length}`}),(0,B.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:xe}),o===`intro`&&(0,B.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,B.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,B.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,B.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),o===`identity`&&(0,B.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,B.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,B.jsx)(`input`,{value:f.displayName,maxLength:60,onChange:e=>p(t=>({...t,displayName:e.target.value})),onBlur:()=>p(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[me.map(e=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":!T&&f.appearance===e.id,onClick:()=>{E(null),O(null),p(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!T&&f.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,B.jsx)(g,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,B.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${T?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,B.jsx)(ae,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,B.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){C(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}E(t),O(URL.createObjectURL(t))}}})]})]}),(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),o===`voice`&&(0,B.jsxs)(`div`,{className:`mt-5`,children:[(0,B.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),j?(0,B.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,B.jsx)(S,{className:`h-20 rounded-xl`}),(0,B.jsx)(S,{className:`h-20 rounded-xl`})]}):A?.enabled&&P.length>0?(0,B.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":!f.voice,onClick:()=>p(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${f.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),P.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${f.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":f.voice===e.id,onClick:()=>p(t=>({...t,voice:e.id})),children:[(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void be(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,B.jsx)(ne,{className:`size-4 ${oe===e.id?`text-accent`:``}`})})]},e.id))]}):(0,B.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,B.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),o===`connections`&&(0,B.jsxs)(`div`,{className:`mt-5`,children:[(0,B.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),fe?(0,B.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,B.jsx)(S,{className:`h-18 rounded-xl`}),(0,B.jsx)(S,{className:`h-18 rounded-xl`})]}):(0,B.jsx)(`div`,{className:`mt-5 space-y-2`,children:R.length?R.map(e=>{let t=he(_e.find(t=>t.connectorId===e.id));return(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,B.jsx)(N,{connector:e,size:`sm`}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,B.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,B.jsx)(a,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,B.jsx)(`button`,{type:`button`,onClick:()=>U(w(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,B.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,B.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),x&&(0,B.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:x})]},o)}),(0,B.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[o===`intro`&&(0,B.jsx)(`button`,{type:`button`,disabled:!e||_,onClick:()=>void G(!0),className:`min-h-11 rounded-lg px-3 text-sm 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:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),o===`voice`&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let e={...f,voice:null};p(e),C(null),W(`connections`,e).catch(e=>C(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,B.jsxs)(`button`,{type:`button`,disabled:_||o===`connections`&&!e,onClick:()=>o===`connections`?void G():void ye(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 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 focus-visible:ring-offset-2 disabled:opacity-40`,children:[_?n?`正在创建…`:`Creating…`:o===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!_&&(0,B.jsx)(v,{className:`size-4`})]})]})]})}),H&&(0,B.jsx)(k,{draft:H,onChange:U,onClose:()=>U(null),t:c(r).connectorsSettings,onInstalled:async()=>{ve(await re()),U(null)}})]})}function ve({record:e,zh:t,onSelectVoice:n,onGreetingChange:r}){let[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(!0),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(null),[p,m]=(0,z.useState)([]),[h,g]=(0,z.useState)(e.voicePreference?.voice??``),[_,v]=(0,z.useState)(!1),[y,x]=(0,z.useState)(null),[C,w]=(0,z.useState)(null),T=(0,z.useRef)(null),E=(0,z.useRef)(null);(0,z.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await ue();if(e||(o(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};f(n);let r=await le(n.provider,n.model,`realtime`);e||m(r)}catch(t){e||x(t instanceof Error?t.message:String(t))}finally{e||c(!1)}})(),()=>{e=!0}},[]),(0,z.useEffect)(()=>()=>{E.current?.abort(),T.current?.close()},[]);let D=()=>{E.current?.abort(),E.current=null,T.current?.close(),T.current=null,w(null)},O=async e=>{if(C!==null){D();return}D(),x(null);let n=new AbortController;E.current=n,w(e);try{let t=new b;T.current=t,await t.start();let r=await L(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{E.current===n&&(w(null),E.current=null,T.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;x(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}E.current===n&&D()}},k=async e=>{if(_||e===h)return;D();let t=h;g(e),u(``),v(!0),x(null);try{await n(e&&d?{provider:d.provider,model:d.model,voice:e}:null)||g(t)}catch(e){g(t),x(e instanceof Error?e.message:String(e))}finally{v(!1)}},A=p.find(e=>e.id===h),ee=t?`默认声音`:`Default voice`,j=A?.name||(h?t?`当前音色不可用`:`Current voice unavailable`:ee),N=l.trim().toLocaleLowerCase(),P=p.filter(e=>!N||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(N)).map(e=>({value:e.id,label:e.name}));return(0,B.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),s?(0,B.jsx)(`div`,{className:`mt-3`,"aria-busy":`true`,children:(0,B.jsx)(S,{className:`h-10 w-full`})}):d&&p.length?(0,B.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,B.jsx)(M,{value:h,selectedLabel:j,options:P,placeholder:ee,emptyLabel:ee,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:_,onChange:e=>void k(e),searchPlaceholder:p.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:l,onSearchChange:u,statusMessage:N&&!P.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,B.jsxs)(`button`,{type:`button`,disabled:_||!!(h&&!A),onClick:()=>void O(h),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,title:C===null?t?`试听${j}`:`Preview ${j}`:t?`停止试听`:`Stop preview`,"aria-label":C===null?t?`试听${j}`:`Preview ${j}`:t?`停止试听`:`Stop preview`,children:[C===null?(0,B.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):(0,B.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),C===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:A?.description||A?.style||(h?t?`选择后自动保存,用于之后的语音通话。`:`Saved automatically for future voice calls.`:t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,B.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,B.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),r&&a&&(0,B.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`连接时打招呼`:`Greet me when connected`,(0,B.jsx)(`input`,{type:`checkbox`,checked:e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:_,onChange:e=>{let t=e.target.checked;v(!0),r(t).catch(e=>x(String(e))).finally(()=>v(!1))}})]}),y&&(0,B.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:y})]})}var H=new h;function U({conversationId:e,zh:t,onSaved:n}){let r=f(t=>t.sessions[e]),[i,a]=(0,z.useState)(!0),[o,s]=(0,z.useState)(``);(0,z.useEffect)(()=>{let t=!0;return H.loadSessionAgentConfig(e).then(n=>{t&&p(e,n)}).catch(e=>{t&&s(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function u(t,i){f.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{p(e,await H.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await H.loadSessionAgentConfig(e).catch(()=>null);throw n&&p(e,n),t}finally{f.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,B.jsx)(S,{className:`h-9 w-full`}):(0,B.jsx)(A,{chat:c(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:u,onThinkingChange:e=>u(r?.model??``,e)}),o&&(0,B.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var W=5;function ye(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function G(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function be(e){let t=(0,R.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=G(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let s=a,c;t[3]===n.id?c=t[4]:(c=o(`/personal`,n.id),t[3]=n.id,t[4]=c);let l=`mt-2 size-1.5 shrink-0 rounded-full ${s.tone}`,u;t[5]===l?u=t[6]:(u=(0,B.jsx)(`span`,{className:l,"aria-hidden":!0}),t[5]=l,t[6]=u);let d;t[7]===n.title?d=t[8]:(d=ye(n.title),t[7]=n.title,t[8]=d);let f;t[9]===d?f=t[10]:(f=(0,B.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:d}),t[9]=d,t[10]=f);let p;t[11]===s.label?p=t[12]:(p=(0,B.jsx)(`span`,{children:s.label}),t[11]=s.label,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=m):m=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=P(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,B.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==p?(v=(0,B.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,_]}),t[19]=_,t[20]=p,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==f?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,v]}),t[22]=v,t[23]=f,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,B.jsx)(T,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==c||t[28]!==u?(x=(0,B.jsxs)(i,{to:c,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,y,b]}),t[26]=y,t[27]=c,t[28]=u,t[29]=x):x=t[29],x}var K=[{id:`direct`,warmth:`reserved`,zh:`直接`,en:`Direct`},{id:`natural`,warmth:`balanced`,zh:`自然`,en:`Natural`},{id:`gentle`,warmth:`gentle`,zh:`温和`,en:`Gentle`}],xe=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function Se(e,t){return e.warmth===`reserved`?t?`你可以直接说目标或问题。我会先给结论,需要时再展开。`:`Tell me the goal or question. I’ll lead with the answer and expand when useful.`:e.warmth===`gentle`?t?`想聊一件事,或让我帮你推进工作,都可以从这里开始。我会认真听,也会把下一步说清楚。`:`You can talk something through or ask me to move work forward. I’ll listen carefully and make the next step clear.`:t?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`}function Ce(e){return K.find(t=>t.warmth===e.warmth)?.id??`natural`}function we(){let e=_(),t=(0,z.useRef)(e);t.current=e;let n=u(e=>e.language)===`zh`,r=O(e=>e.setPageHeader),i=O(e=>e.clearPageHeader),[a,o]=(0,z.useState)(null),c=(0,z.useRef)(null),f=(0,z.useRef)(Promise.resolve()),[p,m]=(0,z.useState)([]),[h,v]=(0,z.useState)(!0),[b,w]=(0,z.useState)(0),[T,k]=(0,z.useState)(null),[A,N]=(0,z.useState)(!0),[P,ne]=(0,z.useState)(!1),[re,ie]=(0,z.useState)(`natural`),[F,I]=(0,z.useState)(`loopi`),[L,le]=(0,z.useState)(!1),ue=(0,z.useRef)(null),R=(0,z.useRef)(null),de=(0,z.useRef)(null),[fe,V]=(0,z.useState)(``),[me,he]=(0,z.useState)(`untangle`),[ge,H]=(0,z.useState)(`none`),[ye,G]=(0,z.useState)(`balanced`),[we,Te]=(0,z.useState)(`decisions`),[Ee,De]=(0,z.useState)(!1),[Oe,q]=(0,z.useState)(!1),[J,ke]=(0,z.useState)(!1),[Y,Ae]=(0,z.useState)(null),[je,Me]=(0,z.useState)(!1),[X,Ne]=(0,z.useState)(!1),[Pe,Fe]=(0,z.useState)(!1),[Z,Ie]=(0,z.useState)(0),Q=(0,z.useRef)(0),Le=(0,z.useCallback)(()=>{ke(!1),q(!1),De(!0)},[]),Re=(0,z.useCallback)(()=>{ke(!1),q(!1),De(e=>!e)},[]),ze=(0,z.useCallback)(async()=>{try{let[e,t]=await Promise.all([l(d(`/api/personal-agent`)),l(d(`/api/personal-agent/models`))]);if(c.current=e.payload,o(e.payload),e.payload?.state===`ready`){let e=await l(d(`/api/personal-agent/onboarding`));N(!e.payload.completed||e.payload.welcomeDone)}window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),m(t.payload),e.payload&&(V(e.payload.displayName),I(e.payload.appearance),ie(Ce(e.payload.preferences)),he(e.payload.preferences.supportMode??`untangle`),H(e.payload.preferences.humor??`none`),G(e.payload.preferences.detailLevel??`balanced`),Te(e.payload.preferences.proactivity??`decisions`))}catch(e){k(e instanceof Error?e.message:String(e))}finally{v(!1)}},[]);(0,z.useEffect)(()=>{ze()},[ze]);let $=(0,z.useCallback)(e=>{w(e=>e+1),k(null);let t=f.current.then(async()=>{let t=c.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i={...t.preferences,...e.preferences},a=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.preferences)&&JSON.stringify(a)===JSON.stringify(t.voicePreference)&&(!e.voiceCallPreferences||JSON.stringify(e.voiceCallPreferences)===JSON.stringify(t.voiceCallPreferences)))return!0;try{let s=await l(d(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,preferences:i,...e.voicePreference===void 0?{}:{voicePreference:a},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return c.current=s.payload,o(s.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:s.payload})),!0}catch(e){return k(e instanceof Error?e.message:String(e)),!1}}).finally(()=>w(e=>e-1));return f.current=t,t},[]),Be=async e=>{if(a){k(null);try{if(e){let t=await l(d(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:a.revision,displayName:a.displayName,appearance:a.appearance,preferences:{...a.preferences,supportMode:e}})});c.current=t.payload,o(t.payload)}await l(d(`/api/personal-agent/onboarding/welcome`),{method:`POST`,body:`{}`}),N(!0)}catch(e){k(e instanceof Error?e.message:String(e))}}},Ve=(0,z.useCallback)(async()=>{let e=++Q.current;ke(!0),Ae(null),Me(!1),Ne(!1),Fe(!1),Ie(0);try{let t=await l(d(`/api/personal-agent/activity?limit=${W}&offset=0`));if(e!==Q.current)return;Ae(t.payload),Ie(t.payload.items.length)}catch{e===Q.current&&Me(!0)}},[]),He=(0,z.useCallback)(async()=>{if(!Y||X||Z>=Y.total)return;let e=Q.current;Ne(!0),Fe(!1);try{let t=await l(d(`/api/personal-agent/activity?limit=${W}&offset=${Z}`));if(e!==Q.current)return;Ae(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),Ie(e=>e+t.payload.items.length)}catch{e===Q.current&&Fe(!0)}finally{e===Q.current&&Ne(!1)}},[Y,Z,X]);(0,z.useEffect)(()=>{if(!J||!Y||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=Q.current;try{let t=await l(d(`/api/personal-agent/activity?limit=${Math.max(W,Math.min(100,Z))}&offset=0`));if(e!==Q.current)return;Ae(t.payload),Ie(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[Y,Z,X,J]);let Ue=async e=>{if(!a||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){k(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){k(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}le(!0),k(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await l(d(`/api/agents/${encodeURIComponent(a.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),C(a.agentId),I(`custom`),q(!1),await $({appearance:`custom`})}catch(e){k(e instanceof Error?e.message:String(e))}finally{le(!1)}};(0,z.useLayoutEffect)(()=>{let o=a?.state===`ready`,c=o?a.appearance:F,l=o?a.displayName:`Ada`;return r({startExtra:null,main:(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[o?(0,B.jsx)(`button`,{ref:de,type:`button`,onClick:Re,"aria-expanded":Ee,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`编辑${l}的资料`:`Edit ${l}'s profile`,title:n?`资料`:`Profile`,children:(0,B.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,B.jsx)(g,{appearance:c,agentId:a?.agentId,className:`size-8`})})}):(0,B.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,B.jsx)(g,{appearance:c,agentId:a?.agentId,className:`size-8`})}),(0,B.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:l})]}),end:o?(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{a?.state===`ready`&&t.current.open({conversationId:a.conversationId,name:a.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,B.jsx)(j,{className:`size-5`})}),(0,B.jsxs)(oe,{open:J,onOpenChange:e=>{e?Ve():ke(!1)},children:[(0,B.jsx)(D,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,"aria-pressed":J,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,B.jsx)(x,{className:`size-5`})})}),(0,B.jsx)(y,{children:(0,B.jsxs)(E,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(25rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-inset shadow-xl focus:outline-none`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Y?n?`最近更新 · 共 ${Y.total} 项`:`Recently updated · ${Y.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,B.jsx)(se,{className:`touch-target -mr-2 -mt-1 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`,"aria-label":n?`关闭活动`:`Close activity`,children:(0,B.jsx)(s,{className:`size-4`})})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!Y&&!je&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(S,{className:`h-18 rounded-2xl`}),(0,B.jsx)(S,{className:`h-18 rounded-2xl`}),(0,B.jsx)(S,{className:`h-18 rounded-2xl`})]}),je&&(0,B.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void Ve(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),Y?.items.length===0&&(0,B.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,B.jsx)(x,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),Y&&Y.items.length>0&&(0,B.jsx)(`div`,{className:`space-y-2`,children:Y.items.map(e=>(0,B.jsx)(be,{item:e,zh:n},e.id))}),Y&&Z<Y.total&&(0,B.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>void He(),disabled:X,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),Pe&&(0,B.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,B.jsx)(`button`,{ref:R,type:`button`,onClick:Re,"aria-expanded":Ee,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`回应偏好`:`Response preferences`,children:(0,B.jsx)(ee,{className:`size-5`})})]}):null}),()=>i()},[Y,je,Z,X,Pe,F,i,He,Ve,a,r,J,Ee,Re,e.active,n]);function We(){return a?(0,B.jsxs)(oe,{open:Ee,onOpenChange:e=>{De(e),e||q(!1)},children:[(0,B.jsx)(ce,{virtualRef:R}),(0,B.jsx)(y,{children:(0,B.jsxs)(E,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(R.current?.contains(e.target)||de.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex h-[min(38rem,calc(100dvh-6rem))] w-[min(28rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,B.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-5 pt-5 text-center`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:L,onClick:()=>q(e=>!e),"aria-expanded":Oe,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,B.jsx)(g,{appearance:F,agentId:a.agentId,className:`size-20`})}),(0,B.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:fe,onChange:e=>V(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(V(t),$({displayName:t})):V(c.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c.current?.displayName??``,V(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-3 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`}),b>0&&(0,B.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto overscroll-contain px-5 py-5`,children:[T&&(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:T}),Oe&&(0,B.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[xe.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{I(e.id),q(!1),$({appearance:e.id})},"aria-pressed":F===e.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${F===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,B.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,B.jsx)(g,{appearance:e.id,className:`size-8`})}),(0,B.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,B.jsx)(`input`,{ref:ue,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Ue(t),e.currentTarget.value=``}}),(0,B.jsxs)(`button`,{type:`button`,disabled:L,onClick:()=>ue.current?.click(),"aria-pressed":F===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${F===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,B.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:F===`custom`?(0,B.jsx)(g,{appearance:`custom`,agentId:a.agentId,className:`size-8`}):(0,B.jsx)(ae,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:L?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`语气`:`Tone`}),(0,B.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:K.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>{ie(e.id),$({preferences:{warmth:e.warmth}})},"aria-pressed":re===e.id,className:`min-h-10 rounded-xl px-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${re===e.id?`bg-accent/10 font-medium text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:n?e.zh:e.en},e.id))})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`棘手时`:`When things get tricky`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[[`listen`,n?`先听`:`Listen`],[`untangle`,n?`理清`:`Untangle`],[`solutions`,n?`给办法`:`Suggest`]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":me===e,onClick:()=>{he(e),$({preferences:{supportMode:e}})},className:`min-h-9 rounded-full px-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${me===e?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:t},e))})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`回答长度`:`Length`}),(0,B.jsx)(M,{value:ye??`balanced`,options:[{value:`brief`,label:n?`简短`:`Brief`},{value:`balanced`,label:n?`适中`:`Balanced`},{value:`detailed`,label:n?`详细`:`Detailed`}],placeholder:n?`选择长度`:`Choose length`,allowEmpty:!1,onChange:e=>{let t=e;G(t),$({preferences:{detailLevel:t}})}})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`主动更新`:`Updates`}),(0,B.jsx)(M,{value:we??`decisions`,options:[{value:`decisions`,label:n?`结果与决定`:`Results only`},{value:`important`,label:n?`重要进展`:`Milestones`},{value:`open`,label:n?`多提建议`:`Suggestions`}],placeholder:n?`选择频率`:`Choose frequency`,allowEmpty:!1,onChange:e=>{let t=e;Te(t),$({preferences:{proactivity:t}})}})]})]}),(0,B.jsxs)(`details`,{className:`text-sm text-fg-muted`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer select-none`,children:n?`更多偏好`:`More preferences`}),(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsx)(`p`,{className:`mb-2 font-medium text-fg`,children:n?`轻松程度`:`Humor`}),(0,B.jsx)(M,{value:ge??`none`,options:[{value:`none`,label:n?`不加玩笑`:`None`},{value:`occasional`,label:n?`偶尔轻松`:`Sometimes`},{value:`playful`,label:n?`活泼`:`Playful`}],placeholder:n?`选择程度`:`Choose level`,allowEmpty:!1,onChange:e=>{let t=e;H(t),$({preferences:{humor:t}})}})]})]}),(0,B.jsx)(pe,{zh:n}),(0,B.jsx)(ve,{onGreetingChange:e=>$({voiceCallPreferences:{openingGreetingEnabled:e}}),record:a,zh:n,onSelectVoice:e=>$({voicePreference:e})}),(0,B.jsx)(`div`,{className:`border-t border-edge pt-5`,children:(0,B.jsx)(U,{conversationId:a.conversationId,zh:n,onSaved:async()=>{let e=await l(d(`/api/personal-agent`));e.ok&&e.payload&&(c.current=e.payload,o(e.payload))}})})]})]})})]}):null}return h?(0,B.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,B.jsx)(S,{className:`h-20 w-20 rounded-full`}),(0,B.jsx)(S,{className:`h-9 w-72`}),(0,B.jsx)(S,{className:`h-44 w-full rounded-2xl`})]}):a?.state===`ready`?(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[P&&(0,B.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,B.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{ne(!1),Le()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,B.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,B.jsx)(te,{embedded:!0,personal:!0,personalWelcome:{name:a.displayName,addressAs:a.userCallName??void 0,avatar:(0,B.jsx)(g,{appearance:a.appearance,agentId:a.agentId,className:`size-14`}),opening:Se(a.preferences,n),showSupportChoice:!A,onChooseSupport:e=>void Be(e),onSkipSupport:()=>void Be(),supportChoiceError:T},conversationId:a.conversationId})})}),We()]}):(0,B.jsx)(_e,{modelsAvailable:p.length>0,onCreated:(e,t)=>{c.current=e,o(e),V(e.displayName),N(!1),ne(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{we as PersonalPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-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-PrKvVpRh.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./messages-CaeL_miw.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-CE7L6MlS.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-B5aykqg_.js";import{$c as B,$l as V,$n as H,A as U,Ai as W,Bd as ee,Cd as G,Cf as K,Co as q,Cs as te,Cu as ne,Dd as re,Do as ie,Ed as ae,Ef as oe,Eo as se,Er as ce,Fl as le,Fr as ue,Fu as J,Ga as de,Gd as fe,Ha as pe,Hc as Y,Hi as me,Hl as he,Hu as ge,Ic as _e,Il as ve,Ja as ye,Jc as be,Jl as xe,Ka as Se,Mi as Ce,Mr as we,Nu as Te,Ol as Ee,Oo as De,Pd as Oe,Qn as ke,Ra as Ae,Rn as je,Rs as Me,Sd as Ne,Sl as Pe,So as Fe,Sr as Ie,Ss as Le,To as Re,Tr as ze,Ts as Be,Ua as Ve,Ul as He,Uo as Ue,Va as We,Vu as Ge,Wa as Ke,Xa as qe,Xc as Je,Xd as Ye,Xl as Xe,Ya as Ze,Ys as Qe,Yu as $e,_ as et,_o as tt,af as nt,ao as rt,bd as it,bf as at,bo as ot,bu as st,co as ct,cr as lt,cs as ut,da as dt,dd as ft,dr as pt,ea as mt,ed as ht,er as gt,eu as _t,fd as vt,fo as yt,gl as bt,go as xt,gu as St,hf as Ct,ho as wt,hu as Tt,ia as Et,if as Dt,ir as Ot,iu as kt,ld as At,lf as jt,ll as Mt,ls as Nt,mo as Pt,ni as Ft,nr as It,ns as Lt,nu as Rt,of as zt,pa as Bt,pd as Vt,po as Ht,pr as Ut,pu as Wt,qa as Gt,qc as Kt,rr as qt,sf as Jt,so as Yt,ta as Xt,td as Zt,tf as Qt,ti as $t,to as en,tr as tn,ul as nn,us as rn,v as an,vo as on,wf as sn,wl as cn,wo as ln,wr as un,ws as dn,xo as fn,xs as pn,xu as mn,yo as hn,za as gn,zl as _n}from"./index-CKdOZoVu.js";import{n as vn,t as yn}from"./use-autosave-CY0YuljR.js";import{t as bn}from"./directory-picker-path-field-C6cUgrvg.js";import{d as xn,h as Sn,o as Cn}from"./skill-api-CcYGkRPL.js";import{t as wn}from"./date-picker-C424c_g9.js";import{t as Tn}from"./automations-workspace-DIod-bfm.js";import{i as En,r as Dn,t as On}from"./workflow-run-setup-panel-BXI8eyYh.js";import{t as kn}from"./page-context-capture-button-Cn_WK68Y.js";import{i as An,n as X,r as jn,t as Mn}from"./note-detail-panel-Q4yRx9iZ.js";import{c as Nn,l as Pn,n as Fn,o as In,r as Z,t as Ln,u as Rn}from"./style-BQqU-1pP.js";import{t as zn}from"./dependency-picker-BVJh9sYc.js";var Bn=n(),Q=e(t(),1),$=r();function Vn(e){let t=(0,Bn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ft(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)(ft,{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)(ue,{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 Hn(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 Un(e){let t=(0,Bn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=$t(),f=$t(Gn),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)(ge,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(st,{className:`size-3.5`}):(0,$.jsx)(Wt,{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=Hn(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:Wn,children:[k,P]}),t[34]=P,t[35]=w,t[36]=k,t[37]=F):F=t[37],F}function Wn(e){return e.stopPropagation()}function Gn(e){return e.toggle}function Kn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function qn(e){let t=(0,Bn.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(tr)===`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=Kn(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)(er),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==l?(_=An(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)(Vn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(Un,{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)(Ot,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:$n,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(Zn)},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)(Tt,{className:`size-4`}):(0,$.jsx)(St,{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)(gt,{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(Xn)},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)(oe,{className:`size-4`}),t[48]=B):B=t[48];let V;t[49]!==c.archive||t[50]!==z?(V=(0,$.jsxs)(gt,{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 U;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(qt,{className:`my-1 h-px bg-edge-subtle`}),t[52]=U):U=t[52];let W;t[53]!==n.id||t[54]!==s?(W=()=>{s(n.id).catch(Yn)},t[53]=n.id,t[54]=s,t[55]=W):W=t[55];let ee;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Ee,{className:`size-4`}),t[56]=ee):ee=t[56];let G;t[57]!==c.delete||t[58]!==W?(G=(0,$.jsxs)(gt,{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:W,children:[ee,c.delete]}),t[57]=c.delete,t[58]=W,t[59]=G):G=t[59];let K;t[60]!==R||t[61]!==V||t[62]!==G?(K=(0,$.jsx)(tn,{children:(0,$.jsxs)(H,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:Qn,children:[R,V,U,G]})}),t[60]=R,t[61]=V,t[62]=G,t[63]=K):K=t[63];let q;t[64]!==P||t[65]!==K?(q=(0,$.jsxs)(It,{children:[P,K]}),t[64]=P,t[65]=K,t[66]=q):q=t[66];let te;t[67]!==D||t[68]!==M||t[69]!==q?(te=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[D,M,q]}),t[67]=D,t[68]=M,t[69]=q,t[70]=te):te=t[70];let ne;t[71]===n.pinned?ne=t[72]:(ne=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)(St,{className:`size-3`})}),t[71]=n.pinned,t[72]=ne);let re;t[73]===n.tags?re=t[74]:(re=n.tags?.slice(0,2).map(Jn),t[73]=n.tags,t[74]=re);let ie;t[75]===v?ie=t[76]:(ie=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[75]=v,t[76]=ie);let ae;t[77]!==ne||t[78]!==re||t[79]!==ie?(ae=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ne,re,ie]}),t[77]=ne,t[78]=re,t[79]=ie,t[80]=ae):ae=t[80];let se;return t[81]!==te||t[82]!==ae||t[83]!==y||t[84]!==x||t[85]!==C||t[86]!==T||t[87]!==E?(se=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:x,className:C,"aria-current":T,children:[E,te,ae]}),t[81]=te,t[82]=ae,t[83]=y,t[84]=x,t[85]=C,t[86]=T,t[87]=E,t[88]=se):se=t[88],se}function Jn(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 Yn(){}function Xn(){}function Zn(){}function Qn(e){return e.stopPropagation()}function $n(e){return e.stopPropagation()}function er(){return Date.now()}function tr(e){return e.language}var nr=3e4;function rr(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function ir({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||rr()||`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=rr(),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()},nr)}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)(_n,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(It,{children:[(0,$.jsx)(Ot,{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)(tn,{children:(0,$.jsxs)(H,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(gt,{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)(At,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(gt,{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)(Te,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(gt,{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)(at,{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)(V,{className:`size-4`,"aria-hidden":!0})})]})}var ar={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},or=240,sr=320,cr=520,lr=560;function ur(e){if(globalThis.localStorage===void 0)return sr;try{let t=globalThis.localStorage.getItem(e);if(!t)return sr;let n=Number(t);return Number.isFinite(n)?n:sr}catch{return sr}}function dr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var fr={thought:ve,todo:he,voice:Te,media:At,bookmark:Ct,mixed:ve,task:he};function pr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function mr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function hr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function gr({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)(en,ar),[x,T]=(0,Q.useState)(!1),[D,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>ur(d)),[B,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(!1),[W,ee]=(0,Q.useState)(!1),[G,K]=(0,Q.useState)(null),[q,te]=(0,Q.useState)(null),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(null),[ae]=(0,Q.useState)(()=>Date.now()),oe=i(),se=(0,Q.useCallback)(e=>{let t=re.current?.clientWidth??window.innerWidth,n=Math.max(or,t-lr);return Math.max(or,Math.min(Math.min(cr,n),e))},[]),le=(0,Q.useCallback)(e=>{let t=se(e);z(t),dr(d,t)},[se,d]);(0,Q.useLayoutEffect)(()=>{z(e=>se(e))},[se]);let{data:ue,mutate:J,isLoading:de}=L((0,Q.useMemo)(()=>m?[`notes-list`,o,h.statusFilter,h.kindFilter,h.pinnedOnly]:null,[m,o,h.statusFilter,h.kindFilter,h.pinnedOnly]),()=>Ie({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}),fe=de&&!ue,pe=ue?.items??[],Y=ue?.total??0,me=D.trim(),{data:he,isLoading:ge}=L(m&&x&&me?[`notes-search`,o,me]:null,()=>Ie({search:me,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),_e=he?.items??[],ye=e?pe.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{I(0)},[me]),(0,Q.useEffect)(()=>{F>=_e.length&&I(Math.max(0,_e.length-1))},[F,_e.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 be=Ue(e=>e.setPageHeader),xe=Ue(e=>e.clearPageHeader),Se=p.noteCount.replace(`{{count}}`,String(Y)),Ce=!r&&Y===0&&c?c:Se,Ee=p.searchDialogTitle,De=p.searchClose,Oe=p.searchClear,Ae=(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`,Me),"aria-label":Ee,children:[(0,$.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ee})]}),[Ee]);(0,Q.useLayoutEffect)(()=>{if(n)return m?(be({startExtra:null,main:(0,$.jsxs)(`div`,{className:b(`flex min-w-0 items-center gap-2`,Me),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}),Se?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Se}):null]}),end:Ae}),()=>xe()):(xe(),()=>xe())},[xe,m,Ae,s,n,p.title,p.discussionCapture.recoveredTitle,Se,e,be]);let je=(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]),Ne=(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]),Pe=Ne.find(e=>mr(h,e))??Ne[0],Fe=s??Pe.label,Le=(0,Q.useCallback)(async e=>{K(null);try{let n=o?await pt({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await un(e,`web`);await J(),oe(hr(t,n.id))}catch(e){throw K(`${p.quickCaptureFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`),e}},[t,J,p.quickCaptureFailed,p.quickCaptureFailedHint,oe,o]),Re=(0,Q.useCallback)(async()=>{if(!W){ee(!0),K(null);try{let e=await pt({markdown:``,kind:`thought`,projectId:o,channel:`web`});g({type:`patch`,patch:ar}),await J(),te(e.id),oe(hr(t,e.id))}catch(e){K(`${p.createBlankFailed}: ${e instanceof Error?e.message:p.createBlankFailedHint}`)}finally{ee(!1)}}},[t,W,J,p.createBlankFailed,p.createBlankFailedHint,oe,o]),Be=(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 ze(t,`web`),await J()}catch(e){K(`${p.imageUploadFailed}: ${e instanceof Error?e.message:p.imageUploadFailedHint}`)}},e.click()},[J,p.imageUploadFailed,p.imageUploadFailedHint]),Ve=(0,Q.useCallback)(async(e,t)=>{try{K(null),await ce(e,t,`web`),await J()}catch(e){K(`${p.voiceUploadFailed}: ${e instanceof Error?e.message:p.voiceUploadFailedHint}`)}},[J,p.voiceUploadFailed,p.voiceUploadFailedHint]),He=(0,Q.useCallback)(()=>{K(`${p.voiceCaptureFailed}: ${p.voiceCaptureFailedHint}`)},[p.voiceCaptureFailed,p.voiceCaptureFailedHint]),We=(0,Q.useCallback)(async(e,t)=>{K(null);try{await we(e,{pinned:t}),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),Ge=(0,Q.useCallback)(async e=>{K(null);try{await we(e,{status:`archived`}),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 Ut(e),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),qe=(0,Q.useCallback)(e=>{oe(hr(t,e))},[t,oe]),Je=(0,Q.useCallback)(e=>{oe(hr(t,e)),T(!1)},[t,oe]),Ye=(0,Q.useCallback)(e=>{if(_e.length){if(e.key===`ArrowDown`)e.preventDefault(),I(e=>Math.min(_e.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=_e[F]??_e[0];t&&Je(t.id)}}},[F,Je,_e]),Xe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ie.current;t.setPointerCapture(e.pointerId),V(!0);let r=re.current?.clientWidth??window.innerWidth,i=Math.max(or,r-lr),a=Math.min(cr,i),o=e=>Math.max(or,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),re.current?.style.setProperty(`--notes-list-width`,`${p}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(p),dr(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(),Re())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Re]);let Ze=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),le(R-16)):e.key===`ArrowRight`?(e.preventDefault(),le(R+16)):e.key===`Home`?(e.preventDefault(),le(or)):e.key===`End`&&(e.preventDefault(),le(cr))},[le,R]);return m?(0,$.jsxs)(`div`,{ref:re,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:ie,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`,H?`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":H?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[G?(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:G}):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)(Nt,{value:Pe.id,onChange:e=>{let t=Ne.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:Ne.map(e=>(0,$.jsx)(rn,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Fe}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Ce})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>U(!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)(ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>ke(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)(Te,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Re,disabled:W,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)(_t,{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:fe?(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))}):pe.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)(ve,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!ye?p.noteOutsideCurrentView:l??p.noNotes}),e&&!ye?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&&!ye?(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,pe.map((t,n)=>{let r=n>0?X(pe[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[X(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:jn(t.createdAt,ae,je)}),(0,$.jsx)(qn,{note:t,selected:t.id===e,onPress:qe,onPin:We,onArchive:Ge,onDelete:Ke,timeLabels:je,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)(ir,{placeholder:p.quickCapturePlaceholder,submitLabel:p.quickCaptureSubmit,actionsLabel:p.quickCaptureActions,imageLabel:p.quickCaptureImage,voiceLabel:p.quickCaptureVoice,stopRecordingLabel:p.stopRecording,onCapture:Le,onImagePick:a?Be:void 0,onVoiceCapture:a?Ve:void 0,onVoiceError:He,recordingLabel:p.recording,discussionCaptureLabel:p.discussionCapture.title,onDiscussionCapture:()=>ke(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.resizeNotesList,"aria-valuemin":or,"aria-valuemax":cr,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:Xe,onDoubleClick:()=>le(sr),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`,H?`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:[H?(0,$.jsx)(`button`,{type:`button`,onClick:()=>U(!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)(ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Mn,{noteId:e,onBack:()=>oe(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:()=>te(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)(ve,{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:()=>ke(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)(Te,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`button`,{type:`button`,onClick:Re,disabled:W,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}),W?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:Ee}),(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":De,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)(_t,{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":Oe,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:me?ge&&!he?(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))}):_e.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)(ve,{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(he?.total??_e.length))}),_e.map((e,t)=>{let n=fr[e.kind]||ve,r=pr(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:An(e.updatedAt,ae,je)})]}),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)(_t,{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)(ve,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.needToken})]})}var _r=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function vr({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)(_r),[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,an,{revalidateOnFocus:!1}),I=L(i?`workflow-agents`:null,z,{revalidateOnFocus:!1}),R=L(i?[`workflow-project-presets`,e]:null,()=>et(e),{revalidateOnFocus:!1}),B=F.data?.find(e=>e.id===o),V=B?W(B,t):null,H=u||I.data?.defaultId,ee=F.isLoading||I.isLoading||R.isLoading,G=F.error||I.error||R.error,K=En(B,f,g).valid,q=e=>{b||(e&&(l(``),d(``),p(_r()),h([]),_(!0),C(null),P(null)),a(e))},te=e=>{l(e),p(_r()),_(!0),C(null),h(R.data?.find(t=>t.definitionId===e)?.contextRefs??[])},ne=async()=>{if(!(!B||!H||!K||b||T||ee||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:Dn(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:q,children:[(0,$.jsx)(D,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`secondary`,className:`h-9 rounded-lg`,children:[(0,$.jsx)(it,{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})})]}):ee?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r?`正在加载工作流`:`Loading workflows`,children:[(0,$.jsx)(_e,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(_e,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(_e,{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)(Nt,{value:o,onChange:e=>te(e.target.value),disabled:b,"aria-label":n.chooseWorkflow,className:`mt-1 w-full`,children:[(0,$.jsx)(rn,{value:``,children:n.chooseWorkflow}),F.data.map(e=>(0,$.jsx)(rn,{value:e.id,children:W(e,t).title},e.id))]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[r?`执行助手`:`Execution assistant`,(0,$.jsx)(Nt,{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)(rn,{value:e.id,children:je(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)(Rn,{projectId:e,language:t,value:m,onChange:h}),(0,$.jsx)(On,{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:ee||!!G||!B||!H||!K||b,onClick:()=>void ne(),children:[(0,$.jsx)(Wt,{className:`size-4`,"aria-hidden":!0}),b?n.starting:n.runWorkflow]})]})]})]})]})}function yr(e){return x(T(`/api/projects/${encodeURIComponent(e)}/skills`))}function br(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function xr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Sr(e,t){let n=new FormData;return n.set(`file`,t),x(T(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Cr(e,t,n={}){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function wr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Tr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function Er({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,ee]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(!1),[q,ne]=(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 yr(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 fn(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),Xt(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(()=>{K(!0),ne(``),Cn({q:B,page:H,pageSize:8,sort:`downloads`,signal:e.signal}).then(ee).catch(t=>{e.signal.aborted||ne(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||K(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[I,H,B]);async function se(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 ce(t){F(``);try{z((await br(e,t)).skill)}catch(e){F(e instanceof Error?e.message:String(e))}}async function ue(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){T(!0);try{await Tr(e,n.directoryId),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}}async function J(){T(!0),F(``);try{await xr(e,!0),await oe()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}let de=s.find(e=>e.origin===`agents-workspace`),fe=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)(dn,{children:[(0,$.jsx)(Be,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t.add,(0,$.jsx)(Jt,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,$.jsx)(te,{children:(0,$.jsxs)(Le,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,$.jsx)(Ar,{icon:le,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>L(`marketplace`)}),(0,$.jsx)(Ar,{icon:it,title:t.source,hint:t.sourceHint,onClick:()=>L(`source`)}),(0,$.jsx)(Ar,{icon:cn,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&&se(()=>Sr(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,de?.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)(Ge,{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 J(),children:[(0,$.jsx)(xe,{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)(ut,{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)(_e,{className:`h-36 rounded-lg`},e))}):r.length?(0,$.jsx)(Dr,{title:t.localTitle,items:r,copy:t,busy:C,availabilityByName:fe,onPreview:ce,onRemove:ue}):(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)(Dr,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:C,availabilityByName:fe,onPreview:ce,onRemove:ue}):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)(_t,{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})]}),q?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:q}):null,G&&!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)(_e,{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=Et(i,n),o=i.providerId??W.provider,s=Sn(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)(xn,{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 se(()=>Cr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):G?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:G||H<=1,onClick:()=>U(e=>Math.max(1,e-1)),children:[(0,$.jsx)(zt,{className:`size-4`}),t.marketplacePrevious]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:G||H>=W.meta.totalPages,onClick:()=>U(e=>e+1),children:[t.marketplaceNext,(0,$.jsx)(nt,{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 se(()=>wr(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 Dr(e){let t=(0,Bn.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)(oe,{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:Or(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:kr(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)(Ee,{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 Or(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 kr(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 Ar(e){let t=(0,Bn.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)(pn,{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 jr(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 Mr(e,t,n){let r=jr(t),i=jr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var Nr={active:0,review:1,ready:2,backlog:3,closed:4},Pr={failed:0,blocked:1,waiting:2,verifying:3,running:4,queued:5,allocating:5,cancelled:6,idle:7},Fr={critical:0,high:1,normal:2,low:3};function Ir(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=Pr[e.operationalState]-Pr[t.operationalState];if(r!==0)return r;let i=Nr[e.phase]-Nr[t.phase];if(i!==0)return i;let a=Fr[e.priority]-Fr[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Lr=[`backlog`,`ready`,`active`,`review`,`closed`];function Rr(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 zr(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 Br(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 Vr(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 Hr(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Vr(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 Ur(e,t){let{incoming:n}=Vr(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 Wr(e,t){let{incoming:n,outgoing:r}=Vr(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 Gr={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 Kr(e){let t=(0,Bn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Gr[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)(Z,{type:`target`,position:Pn.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)(vt,{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)(Z,{type:`source`,position:Pn.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 qr={taskNode:Kr};function Jr(e){let t=(0,Bn.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=Ur(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(ni),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(ti)),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=Hr(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?Wr(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(ei)),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:Nn.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 ee;t[50]!==u||t[51]!==c||t[52]!==C.length?(ee=[u,c,C.length],t[50]=u,t[51]=c,t[52]=C.length,t[53]=ee):ee=t[53],(0,Q.useEffect)(W,ee);let G;t[54]===m?G=t[55]:(G=()=>{m&&v.current?.fitView({nodes:[{id:m}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=m,t[55]=G);let K=G,q;t[56]!==r||t[57]!==o?(q=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map($r);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=q):q=t[58];let te=q,ne;t[59]!==r||t[60]!==o||t[61]!==g?(ne=()=>{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(Qr)))},t[59]=r,t[60]=o,t[61]=g,t[62]=ne):ne=t[62];let re=ne,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 oe=u?`secondary`:`ghost`,se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>d(Zr),t[65]=se):se=t[65];let ce=u?a.allTasks:a.blockedChains,le;t[66]!==u||t[67]!==oe||t[68]!==ce?(le=(0,$.jsx)(Y,{type:`button`,variant:oe,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:se,children:ce}),t[66]=u,t[67]=oe,t[68]=ce,t[69]=le):le=t[69];let ue;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>l(Xr),t[70]=ue):ue=t[70];let J=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==J?(de=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:ue,disabled:u,children:J}),t[71]=u,t[72]=c,t[73]=J,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:K,children:[(0,$.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,pe;t[75]!==a.removeDependency||t[76]!==re||t[77]!==g?(pe=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]=pe):pe=t[78];let me;t[79]!==le||t[80]!==de||t[81]!==fe||t[82]!==pe?(me=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[le,de,fe,pe]}),t[79]=le,t[80]=de,t[81]=fe,t[82]=pe,t[83]=me):me=t[83];let he;t[84]!==ie||t[85]!==me?(he=(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,me]}),t[84]=ie,t[85]=me,t[86]=he):he=t[86];let ge=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)(In,{nodes:L,edges:z,nodeTypes:qr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>h(t.id),onEdgeClick:(e,t)=>_(t.id),onConnect:te,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)(Ln,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Fn,{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(Yr)})]}):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}),_e;return t[87]!==he||t[88]!==ge?(_e=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[he,ge]}),t[87]=he,t[88]=ge,t[89]=_e):_e=t[89],_e}function Yr(e){return(0,$.jsx)(`li`,{children:e.title},e.id)}function Xr(e){return!e}function Zr(e){return!e}function Qr(e){return e.dependencyTaskId}function $r(e){return e.dependencyTaskId}function ei(e){return[e.id,e]}function ti(e){return e.id}function ni(e){return e.phase!==`closed`}function ri(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var ii={backlog:Qt,ready:Qt,active:$e,review:Pe,closed:l},ai={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 oi(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 si(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 ci(e){let t=(0,Bn.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=Br(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:Ye,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=ui,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)(vt,{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(li).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)(Dt,{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`,oi(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`,si(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)($e,{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)(jt,{className:`size-3`,"aria-hidden":!0}),Ce(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)(jt,{className:`size-3`,"aria-hidden":!0}),Ce(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)(Pe,{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)(K,{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 B;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?(B=(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]=B):B=t[82],B}function li(e){return e.title}function ui(e){e.preventDefault(),e.stopPropagation()}function di({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,G]=(0,Q.useState)(null),K=w(e=>e.language),q=me({chat:y(K).chat}),te=Rr(e),ne=e.filter(e=>e.phase!==`closed`),re=(e,t)=>void i(e,t),ie=async(t,n)=>{let r=e.find(e=>e.id===p);if(m(null),!r||r.id===n)return;let o=te[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=zr(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})},ae=async e=>{e.preventDefault();let t=F.trim();if(!(!t||U)){W(!0),G(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){G(e instanceof Error?e.message:r.createFailed)}finally{W(!1)}}},oe=()=>{P(crypto.randomUUID()),I(``),R(`normal`),B(``),H([]),q.clearAttachments(),G(null),T(!0)};(0,Q.useImperativeHandle)(u,()=>({openCreate:oe})),(0,Q.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>v(null),6e3);return()=>window.clearTimeout(e)},[_]);let se=(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))},[]),ce=(0,Q.useCallback)(e=>{if(e.button!==0||ri(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))},[]),le=(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)(`div`,{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)(ht,{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)(it,{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:ce,onPointerMove:le,onPointerUp:se,onPointerCancel:se,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:Lr.map(t=>{let i=ii[t],a=te[t];return(0,$.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===p);r&&(r.phase===t||zr(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),ie(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`,ai[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)(ci,{task:e,returnTo:n,copy:r,busy:l===e.id,onAction:re,onDragStart:m,onDropBefore:e=>void ie(t,e)},e.id))})})]},t)})})}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,$.jsx)(Jr,{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 ae(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),G(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:U}),(0,$.jsx)(mt,{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)(mn,{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)(Nt,{value:L,onChange:e=>R(e.target.value),disabled:U,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,$.jsx)(rn,{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)(wn,{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)(zn,{candidates:ne,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 fi=new Set([{id:`overview`,icon:Zt},{id:`tasks`,icon:ee},{id:`automations`,icon:bt},{id:`files`,icon:Ne},{id:`notes`,icon:re},{id:`skills`,icon:He},{id:`sessions`,icon:J},{id:`progress`,icon:Vt},{id:`settings`,icon:Xe}].map(e=>e.id)),pi=`xopc.projectFiles.panelWidthPx`,mi=320,hi=220,gi=560;function _i(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 vi(e){return Math.min(gi,Math.max(hi,Math.round(e)))}function yi(){try{let e=window.localStorage.getItem(pi);if(e==null)return mi;let t=Number.parseInt(e,10);return Number.isFinite(t)?vi(t):mi}catch{return mi}}function bi(e){try{window.localStorage.setItem(pi,String(vi(e)))}catch{}}function xi(e){return!!(e&&fi.has(e))}function Si(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ci(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ce(n)}function wi(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 Ti(e){let t=(0,Bn.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 Ei(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 Di(e){let t=(0,Bn.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 Oi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function ki(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Ai(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function ji(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Mi(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 Ni(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Pi(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 Fi(e){let t=e.sourceChannel?.trim();return t?Ii(t):``}function Ii(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Li(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 Ri(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 zi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:zi(e.children,t,n)}:e)}function Bi({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,V]=(0,Q.useState)(null),H=(0,Q.useCallback)(async()=>{m(!0),g(null);try{let t=await Fe({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&&H()},[H,o]);let U=(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=Oi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>ki(t)-ki(e))},[e.id,l,d]),W=e=>t.statuses[e.status]??e.status,ee=e=>e.description||e.brief||t.common.defaultWorkspace,K=e=>{S(e),w(``),D(``),z(null),y(!0),s(!1)},q=(0,Q.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?Ai(t):``);if(n){F(!0),z(null),V(null);try{let r=await Ht({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=ji(e);t?(V(t),y(!1)):z(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[x,C,a,T,I]),ne=(0,Q.useCallback)(e=>{e.preventDefault(),q()},[q]),re=(0,Q.useCallback)(()=>{q({createWorkspaceRoot:!0})},[q]),ie=(0,Q.useCallback)(()=>{V(null),y(!0)},[]),ae=e=>{D(e),x===`directory`&&!C.trim()&&w(Ai(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`,wi(e.status)),children:W(e)})]},e.id);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(dn,{open:o,onOpenChange:s,children:[(0,$.jsx)(Be,{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`,wi(e.status)),children:W(e)})]}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ee(e)})]}),(0,$.jsx)(Jt,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,$.jsx)(te,{children:(0,$.jsxs)(Le,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(_t,{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&&U.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&U.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,U.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:()=>K(`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:()=>K(`directory`),children:[(0,$.jsx)(Ne,{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)(Xe,{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:ne,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)(bn,{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)(Yt,{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`&&Ai(T)),children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,$.jsx)(N,{open:!!B,onOpenChange:e=>{e||V(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?Si(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)(Ne,{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)(G,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Vi(){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=Ue(e=>e.setPageHeader),T=Ue(e=>e.clearPageHeader),[D,L]=(0,Q.useState)(null),V=(0,Q.useRef)(D);(0,Q.useLayoutEffect)(()=>{V.current=D},[D]);let[H,U]=(0,Q.useState)(null),[W,K]=(0,Q.useState)([]),[te,ne]=(0,Q.useState)(``),[ae,ce]=(0,Q.useState)([]),[le,ue]=(0,Q.useState)(0),[me,he]=(0,Q.useState)(!1),[ge,ve]=(0,Q.useState)(!1),[xe,Ce]=(0,Q.useState)(!1),[we,Te]=(0,Q.useState)([]),[Oe,ke]=(0,Q.useState)(null),Me=(0,Q.useRef)(new Set),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(null),[ze,Be]=(0,Q.useState)(null),[Ge,Ye]=(0,Q.useState)(yi),[$e,et]=(0,Q.useState)(!1),[nt,it]=(0,Q.useState)(!1),[at,st]=(0,Q.useState)(``),[ut,ft]=(0,Q.useState)([]),[pt,mt]=(0,Q.useState)(!1),[ht,gt]=(0,Q.useState)(null),[vt,Ct]=(0,Q.useState)(!1),[Et,Ot]=(0,Q.useState)(null),[At,jt]=(0,Q.useState)([]),[Ft,It]=(0,Q.useState)(``),[zt,Ht]=(0,Q.useState)(!0),[Ut,Wt]=(0,Q.useState)(!1),[qt,Jt]=(0,Q.useState)(!1),[Yt,Xt]=(0,Q.useState)(null),[Qt,$t]=(0,Q.useState)(!1),[en,tn]=(0,Q.useState)(`fixed`),[an,cn]=(0,Q.useState)(``),[un,dn]=(0,Q.useState)(null),[pn,mn]=(0,Q.useState)(!1),[_n,xn]=(0,Q.useState)(!1),[Sn,Cn]=(0,Q.useState)(!1),[wn,En]=(0,Q.useState)(null),Dn=(0,Q.useRef)(null),On=(0,Q.useRef)(!1),[An,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`:xi(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||xi(t)||r(Rn(In),{replace:!0})},[In,r,e,Rn,t]),(0,Q.useEffect)(()=>{if(!e)return;let t=!1;return Ht(!0),X(null),Promise.all([xt(e),hn(e),fn(e),z().catch(()=>null),ot(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;L(e),U(n),K(r),ke(a),jt(i?.agents??[]),It(e.defaultAgentId??``);let o=jr(e);Fn.current=o,Pn(o)}).catch(e=>{t||(ke(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Ht(!1)}),()=>{t=!0}},[e]);let Wn=(0,Q.useCallback)(async()=>{e&&U(await hn(e))},[e]);(0,Q.useEffect)(()=>{if(zt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([xt(e),hn(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=V.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=Mr(Fn.current,i,e);Fn.current=t,Pn(t)}V.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,zt]),(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)=>{En(e.id),X(null);try{let n=await B(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 Je(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 Kt(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{En(null)}},[H,x.board.actionFailed,Wn]),Kn=(0,Q.useCallback)(async t=>{e&&(X(null),await be({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)=>{En(e),X(null);try{return await Mt(e,t,(await B(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{En(null)}},[x.board.actionFailed,Wn]),Jn=(0,Q.useCallback)(async(e,t,n)=>{En(e),X(null);try{let r=await B(e);return r.task.phase!==t&&(r=await Kt(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 Mt(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{En(null)}},[x.board.actionFailed,Wn]),Yn=(0,Q.useCallback)(async(e,t)=>{En(e),X(null);try{await nn(e,t,(await B(e)).task.version),await Wn()}catch(e){await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed)}finally{En(null)}},[x.board.actionFailed,Wn]),Xn=(0,Q.useCallback)(async()=>{if(D){he(!0),X(null);try{let e=await tt(D.id,{includeRelated:ge,limit:100});ce(e.items),ue(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{he(!1)}}},[D,ge]);(0,Q.useEffect)(()=>{Z===`progress`&&Xn()},[Xn,Z]);let Zn=(0,Q.useCallback)(async()=>{if(!D?.effectiveWorkspaceRoot?.trim()){Te([]),Me.current.clear(),Ot(null);return}Ct(!0),Ot(null),Me.current.clear();try{Te(Ri((await on(D.id,``)).entries)),Me.current.add(``)}catch(e){Te([]),Me.current.clear(),Ot(e instanceof Error?e.message:String(e))}finally{Ct(!1)}},[D]),Qn=(0,Q.useCallback)(async e=>{if(!(!D?.effectiveWorkspaceRoot?.trim()||Me.current.has(e))){Me.current.add(e),Ot(null);try{let t=await on(D.id,e);Te(n=>zi(n,e,Ri(t.entries)))}catch(t){Me.current.delete(e),Ot(t instanceof Error?t.message:String(t))}}},[D]),$n=(0,Q.useCallback)(async e=>{if(!D?.effectiveWorkspaceRoot?.trim())return;let t=Ri((await on(D.id,e)).entries);Te(e?n=>zi(n,e,t):t),Me.current.add(e)},[D]);(0,Q.useEffect)(()=>{Z===`files`&&Zn()},[Zn,Z]);let er=at.trim();(0,Q.useEffect)(()=>{if(Z!==`files`||!D||!nt||!er){ft([]),mt(!1),gt(null);return}let e=!1;mt(!0),gt(null),ft([]);let t=window.setTimeout(()=>{se(D.id,er,50).then(t=>{e||ft(t)}).catch(t=>{e||gt(t instanceof Error?t.message:String(t))}).finally(()=>{e||mt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[er,D,nt,Z]);let tr=(0,Q.useCallback)(async()=>{if(!D)return;let[e,t]=await Promise.all([xt(D.id),hn(D.id)]);U(t),L(e)},[D]),nr=(0,Q.useCallback)(async e=>{if(e.preventDefault(),!(!D||!jn.title.trim())){xn(!0),X(null);try{await Pt(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{xn(!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)(sn,{className:`size-4`,"aria-hidden":!0})}),[Ln,d.sidebar.back,x.backToProjects]),ir=(0,Q.useMemo)(()=>D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kn,{resource:{kind:`project`,id:D.id,revision:String(D.version)},disabled:Ut||_i(Nn,D)}),(0,$.jsx)(vr,{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:rt(D.id),state:{forceNewChat:!0,agentId:D.defaultAgentId},onClick:Hn(`sessions`),children:[(0,$.jsx)(J,{className:`size-4`,"aria-hidden":!0}),x.common.newChat]})})]}):null,[Bn,Hn,x.board.create,x.common.newChat,D,Ut,Nn]);(0,Q.useLayoutEffect)(()=>(C({startExtra:rr,main:D?(0,$.jsx)(Bi,{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),It(e.defaultAgentId??``),ot(e.id).then(ke).catch(()=>ke(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function or(e=Fn.current){if(!(!D||!_i(e,D))){X(null),Xt(null);try{let t=await De(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=ji(e);throw t?Xt(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()??``;tn(e?`fixed`:`follow`),cn(e||D.effectiveWorkspaceRoot||``),$t(!0)},[D]);async function ur(e={}){if(!D)return;let t=en===`fixed`?an.trim():``;if(!(en===`fixed`&&!t)){Wt(!0),X(null),Xt(null);try{let n=await De(D.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},D.version);ar(n),cr({workspaceRoot:n.workspaceRoot??``}),$t(!1),Xt(null)}catch(e){let t=ji(e);t?(Xt(t),$t(!1)):X(e instanceof Error?e.message:String(e))}finally{Wt(!1)}}}async function dr(){if(!(!D||un)){dn(`pin`),X(null);try{ar(D.pinnedAt?await ie(D.id,D.version):await q(D.id,D.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function fr(){if(!(!D||un)){dn(`archive`),X(null);try{let e=D.status===`archived`?await ln(D.id,D.version):await yt(D.id,D.version);ar(e),cr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function pr(){if(D){mn(!0),X(null);try{await wt(D.id,D.version),Jt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{mn(!1)}}}async function mr(){if(!(!D||xe)){Ce(!0),X(null);try{await Re(D.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}}let hr=(0,Q.useCallback)(e=>{Fe(e)},[]),_r=(0,Q.useCallback)((e,t)=>{t||Fe(e)},[]),yr=(0,Q.useCallback)(async(e,t,n)=>{let r=D?.id;if(r)switch(e){case`preview`:t.isDirectory||Fe(t.path);break;case`download`:if(t.isDirectory)return;try{let e=gn(t.path);if(We(Ae(e))!==`text`){let n=await de(t.path,{projectId:r}),i=R(e)??`application/octet-stream`;Ve(e,await n.arrayBuffer(),i)}else{let{content:n}=await Se(t.path,{projectId:r});Ke(e,n)}}catch(e){Qe(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await I(t.path)&&Qe(`success`,d.workspace.pathCopied,void 0,{duration:2500})}catch{Qe(`warning`,d.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await Bt(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWith`:await Bt(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await Bt(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),d.workspace.openFileFailed);break;case`revealInFolder`:await Bt(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),d.workspace.revealFileFailed);break;case`trash`:Le(t);break;case`delete`:t.isDirectory||Be(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=Ie;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){Qe(`warning`,t?.error??d.workspace.trashFailed,void 0,{duration:4e3});return}Pe===e.path&&Fe(null),Le(null),await Zn(),Qe(`success`,d.workspace.trashSuccess,void 0,{duration:2500})},[d.workspace.trashFailed,d.workspace.trashSuccess,Ie,Pe,Zn]),xr=(0,Q.useCallback)(async(e,t)=>{let n=D?.id;if(n)try{await Promise.all(e.map(e=>Gt(e,t,{projectId:n}))),await $n(t).catch(()=>void 0),Qe(`success`,d.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await $n(t).catch(()=>void 0),Qe(`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=ze;if(e)try{await pe(e.fileId),Pe===e.path&&Fe(null),Be(null);let t=e.path.lastIndexOf(`/`);await $n(t<0?``:e.path.slice(0,t)).catch(()=>void 0),Qe(`success`,d.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){Qe(`warning`,`${d.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[d.workspace.deleteFailed,d.workspace.deleteSuccess,ze,Pe,$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),et(!0);let r=e.clientX,i=Ge,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=vi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}et(!1),Ye(c),bi(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)},[Ge]);(0,Q.useEffect)(()=>{Z!==`files`&&Fe(null)},[e,Z]);let wr=!!(D&&_i(Nn,D)),Tr=yn({value:D?Nn:null,dirty:wr,onSave:or,validate:e=>e.name.trim()?null:x.settings.nameRequired});if(zt)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)(sn,{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:An||x.notFound})]});let Dr=W.slice(0,3),Or=H?.blockers??[],kr=Ir(H?.tasks??[]),Ar=H?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Nr=e=>x.statuses[e]??e,Pr=e=>Si(x.common.messages,{count:e}),Fr=te.trim().toLowerCase(),Lr=Fr?W.filter(e=>{let t=Ci(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=e.name?.trim()||x.sessions.fallbackTitle,i=Pr(e.messageCount??0),a=Fi(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Fr)}):W,Rr=W.length>0&&Lr.length===0,zr=At.find(e=>e.id===D.defaultAgentId)?.name||D.defaultAgentId||x.settings.globalDefaultAgent,Br=At.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=en===`fixed`?an.trim()||x.settings.workspacePlaceholder:Br?.workspace||D.effectiveWorkspaceRoot||x.common.defaultWorkspace,qr=(en===`fixed`?an.trim():``)!==Vr&&(en===`follow`||!!an.trim()),Jr=[{id:`overview`,icon:Zt,label:x.tabs.overview},{id:`tasks`,icon:ee,label:x.tabs.tasks},{id:`automations`,icon:bt,label:x.tabs.automations},{id:`files`,icon:Ne,label:x.tabs.files},{id:`notes`,icon:re,label:x.tabs.notes},{id:`skills`,icon:He,label:x.tabs.skills},{id:`sessions`,icon:J,label:x.tabs.sessions},{id:`progress`,icon:Vt,label:x.tabs.progress}];async function Yr(){if(!Gr)return;let e=await I(Gr);Qe(e?`success`:`warning`,e?d.workspace.pathCopied:d.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){Xt(null),$t(!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,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,$.jsx)(Lt,{items:Jr,activeTab:Z,onChange:zn,ariaLabel:x.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,$.jsxs)(Y,{id:`project-primary-tab-settings`,type:`button`,variant:Z===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Z===`settings`?`page`:void 0,onClick:()=>zn(`settings`),children:[(0,$.jsx)(Xe,{className:`size-4`,"aria-hidden":!0}),x.tabs.settings,wr?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":x.settings.unsavedChanges}):null]})]}),An?(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:An}):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)(ct,{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:Si(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:Si(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:xe,children:[(0,$.jsx)(Rt,{className:`size-3.5`,"aria-hidden":!0}),xe?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)(Dt,{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?` · ${Nr(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:_n||!jn.title.trim(),"aria-label":_n?x.overview.addingBlocker:x.overview.addBlocker,title:_n?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)(fe,{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:Dr.length?Dr.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:Ci(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)(di,{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)(Tn,{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)(gr,{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)(Er,{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)]`,$e&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Ge}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:[Oe?(0,$.jsx)(dt,{resourceId:Oe.fileId,displayName:Oe.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`,nt&&`bg-surface-hover text-fg`),onClick:()=>it(!0),"aria-label":x.files.search,title:x.files.search,"aria-pressed":nt,children:(0,$.jsx)(_t,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(Ze,{className:`size-7 shrink-0 rounded-md p-0`,loading:vt,label:d.cron.refresh,onClick:()=>void Zn()})]})]}),nt?(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)(_t,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`text`,role:`searchbox`,value:at,onChange:e=>st(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:()=>{st(``),it(!1)},children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Et?(0,$.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Et}):null,er?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:pt?(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,$.jsx)(_e,{className:`h-11 w-full`}),(0,$.jsx)(_e,{className:`h-11 w-full`}),(0,$.jsx)(_e,{className:`h-11 w-full`})]}):ht?(0,$.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[d.workspace.loadError,`: `,ht]}):ut.length===0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:x.files.noSearchResults}):ut.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`,Pe===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Fe(e.path),title:e.path,children:[(0,$.jsx)(re,{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))}):vt&&we.length===0?(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.files.loading}):(0,$.jsx)(ye,{tree:we,selectedPath:Pe,onSelectFile:hr,onSelectEntry:_r,onExpandDir:e=>void Qn(e),onAction:yr,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`,$e&&`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`,$e&&`bg-accent/60`)})}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Pe?(0,$.jsx)(lt,{filePath:Pe,projectId:D.id,agentId:D.defaultAgentId||Ft||void 0,onClose:()=>Fe(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)(Ne,{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:[W.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)(_t,{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:te,onChange:e=>ne(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`}),te?(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:()=>ne(``),children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Lr.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Lr.map(e=>{let t=Ci(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=Fi(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)(J,{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:Si(x.progress.count,{count:le})})]}),(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:ge,onChange:e=>ve(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:me,children:[(0,$.jsx)(kt,{className:b(`size-4`,me&&`animate-spin`),"aria-hidden":!0}),x.common.refresh]})]})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:me&&ae.length===0?(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:x.progress.loading}):ae.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge`,children:ae.map(e=>{let t=x.progress.types[e.type]??e.type,n=x.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Li(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,`: `,Ni(e)]})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Ci(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,`: `,Mi(e)]}),(0,$.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[x.progress.source,`: `,Pi(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`,wi(Nn.status)),children:x.settings.statuses[Nn.status]}),(0,$.jsx)(vn,{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)(Ti,{label:x.settings.name,children:(0,$.jsx)(`input`,{className:Ei(),value:Nn.name,onChange:e=>cr({name:e.target.value})})}),(0,$.jsx)(Ti,{label:x.settings.defaultAgent,children:(0,$.jsxs)(Nt,{className:Ei(),value:Nn.defaultAgentId,onChange:e=>cr({defaultAgentId:e.target.value},!0),children:[(0,$.jsx)(rn,{value:``,children:x.settings.globalDefaultAgent}),At.map(e=>(0,$.jsx)(rn,{value:e.id,children:je(e,d.agentsSettings)},e.id))]})}),(0,$.jsx)(Ti,{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)(Nt,{className:Ei(),value:Nn.status===`archived`?`active`:Nn.status,onChange:e=>cr({status:e.target.value},!0),children:[(0,$.jsx)(rn,{value:`active`,children:x.settings.statuses.active}),(0,$.jsx)(rn,{value:`paused`,children:x.settings.statuses.paused})]})}),(0,$.jsx)(Ti,{label:x.settings.executionMode,hint:x.settings.executionModeHint,children:(0,$.jsxs)(Nt,{className:Ei(),value:Nn.executionMode,onChange:e=>cr({executionMode:e.target.value},!0),children:[(0,$.jsx)(rn,{value:`managed_worktree`,children:x.settings.executionModeWorktree}),(0,$.jsx)(rn,{value:`local_checkout`,children:x.settings.executionModeLocal})]})}),(0,$.jsx)(Ti,{label:x.settings.description,hint:x.settings.descriptionHint,children:(0,$.jsx)(`textarea`,{className:Ei(!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)(Ti,{label:x.settings.brief,hint:x.settings.briefHint,children:(0,$.jsx)(`textarea`,{className:Ei(!0),value:Nn.brief,onChange:e=>cr({brief:e.target.value})})}),(0,$.jsx)(Ti,{label:x.settings.instructions,hint:x.settings.instructionsHint,children:(0,$.jsx)(`textarea`,{className:Ei(!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]}),Oe?(0,$.jsx)(dt,{resourceId:Oe.fileId,displayName:Oe.name}):null,(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:lr,children:[(0,$.jsx)(G,{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)(Di,{label:x.settings.defaultAgent,value:zr}),(0,$.jsx)(Di,{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)(Di,{label:x.settings.createdAt,value:Ci(D.createdAt)||x.common.never}),(0,$.jsx)(Di,{label:x.settings.updatedAt,value:Ci(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:un===`pin`,onClick:()=>void dr(),children:[Ur?(0,$.jsx)(Tt,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(St,{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:un===`archive`,onClick:()=>void fr(),children:[Hr?(0,$.jsx)(kt,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(oe,{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:()=>Jt(!0),children:[(0,$.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,$.jsx)(N,{open:qt,onOpenChange:e=>{pn||Jt(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)(Dt,{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?Si(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:pn,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:pn||!D,onClick:()=>void pr(),children:[(0,$.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})}),(0,$.jsx)(qe,{open:!!Ie,title:d.workspace.trashConfirmTitle,description:d.workspace.trashConfirmDescription.replace(`{{name}}`,Ie?.name??``),confirmLabel:d.workspace.moveToTrash,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void br(),onCancel:()=>Le(null)}),(0,$.jsx)(qe,{open:!!ze,title:d.workspace.deleteConfirmTitle,description:d.workspace.deleteConfirmDescription.replace(`{{name}}`,ze?.name??``),confirmLabel:d.workspace.deleteFile,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void Sr(),onCancel:()=>Be(null)}),(0,$.jsx)(N,{open:Qt,onOpenChange:e=>{Ut||$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(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`,en===`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:en===`fixed`,onChange:()=>tn(`fixed`),disabled:Ut}),(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`,en===`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:en===`follow`,onChange:()=>tn(`follow`),disabled:Ut}),(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})]})]})]})]}),en===`fixed`?(0,$.jsx)(bn,{value:an,onChange:cn,disabled:Ut,wd:f,placeholder:x.settings.workspacePlaceholder,inputClassName:Ei(),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:Si(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:Ut,children:x.common.cancel})}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Ut||!qr,onClick:()=>void ur(),children:[(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMigrationConfirm]})]})]})]})}),(0,$.jsx)(N,{open:!!Yt,onOpenChange:e=>{e||Xt(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:Yt?Si(x.settings.workspaceMissingDescription,{workspace:Yt}):null})]}),Yt?(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)(Ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:Yt})]})}):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:Ut,children:x.settings.workspaceMissingBack}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void ur({createWorkspaceRoot:!0}),disabled:Ut,children:[(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMissingCreate]})]})]})]})})]})}export{Vi as ProjectDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as ee}from"./messages-CaeL_miw.js";import{t as c}from"./cn-0WouolD0.js";import{n as l}from"./locale-store-CE7L6MlS.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{Cf as _,Co as v,Do as y,Ef as b,Hc as x,Hu as S,Ic as C,Qa as w,So as T,Uo as E,eu as D,fo as O,gu as te,hu as k,iu as A,ji as j,ls as M,no as N,po as P,so as ne,us as re,wd as F,wo as ie}from"./index-CKdOZoVu.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:j(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(C,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=l(V),c,u,d,f,p,m,h,g;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,h=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(F,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),l;t[20]===o?l=t[21]:(l=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=l);let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,R.jsx)(_,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=v):v=t[22];let y;t[23]===l?y=t[24]:(y=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[l,v]}),t[23]=l,t[24]=y),g=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[y,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,p=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),u=`mt-1`,d=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=u,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g}else c=t[9],u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],h=t[15],g=t[16];let v;t[25]!==u||t[26]!==d?(v=(0,R.jsx)(`p`,{className:u,children:d}),t[25]=u,t[26]=d,t[27]=v):v=t[27];let y;t[28]!==f||t[29]!==p||t[30]!==v?(y=(0,R.jsxs)(`div`,{className:f,children:[p,v]}),t[28]=f,t[29]=p,t[30]=v,t[31]=y):y=t[31];let S=n.pinnedAt?c.unpin:c.pin,C=n.pinnedAt?c.unpin:c.pin,w;t[32]===n.pinnedAt?w=t[33]:(w=n.pinnedAt?(0,R.jsx)(k,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=w);let T;t[34]!==r||t[35]!==a||t[36]!==S||t[37]!==C||t[38]!==w?(T=(0,R.jsx)(x,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":S,title:C,children:w}),t[34]=r,t[35]=a,t[36]=S,t[37]=C,t[38]=w,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,O;t[40]===n.status?O=t[41]:(O=n.status===`archived`?(0,R.jsx)(A,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=O);let j;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==O?(j=(0,R.jsx)(x,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:O}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=O,t[47]=j):j=t[47];let M;t[48]!==T||t[49]!==j?(M=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,j]}),t[48]=T,t[49]=j,t[50]=M):M=t[50];let N;t[51]!==M||t[52]!==m||t[53]!==y?(N=(0,R.jsxs)(`div`,{className:m,children:[y,M]}),t[51]=M,t[52]=m,t[53]=y,t[54]=N):N=t[54];let P;return t[55]!==N||t[56]!==h||t[57]!==g?(P=(0,R.jsxs)(`article`,{className:h,children:[g,N]}),t[55]=N,t[56]=h,t[57]=g,t[58]=P):P=t[58],P}function V(e){return e.language}function H(){let e=ee(l(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=E(e=>e.setPageHeader),_=E(e=>e.clearPageHeader),[b,C]=(0,L.useState)([]),[te,k]=(0,L.useState)(!0),[A,j]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,U]=(0,L.useState)(!1),[fe,W]=(0,L.useState)(null),[G,pe]=(0,L.useState)(!1),[K,me]=(0,L.useState)(!0),[q,he]=(0,L.useState)(``),[J,ge]=(0,L.useState)(``),[Y,_e]=(0,L.useState)(``),X=N({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(k(!0),j(null));try{let e=await T({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&C(ae(e.items))}catch(n){!e&&t===Z.current&&j(n instanceof Error?n.message:String(n))}finally{t===Z.current&&k(!1)}},[]);(0,L.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,L.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return b.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,b,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(x,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>_()),[_,ve,n.title,i]);let ye=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||G)){pe(!0),W(null);try{let e=await P({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});C(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[G,J,q,Y,K]),be=(0,L.useCallback)(async(e,t)=>{ue(e.id),j(null);try{let n;n=t===`pin`?e.pinnedAt?await y(e.id,e.version):await v(e.id,e.version):e.status===`archived`?await ie(e.id,e.version):await O(e.id,e.version),C(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){j(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===H)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,R.jsx)(g,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(p,{children:[(0,R.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(m,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,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,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(h,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:G||X.picking,children:[X.picking?(0,R.jsx)(S,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(a,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:c(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(ne,{checked:K,onChange:me,disabled:G}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(f,{asChild:!0,children:(0,R.jsx)(x,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(x,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(w,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,R.jsxs)(`div`,{className:c(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(D,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(s,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(x,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(D,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(M,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:xe.map(e=>(0,R.jsx)(re,{value:e.id,children:e.label},e.id))})]})]}),A?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:A}),(0,R.jsx)(x,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,te?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(F,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};