@xopcai/xopc 0.0.217 → 0.0.219

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 (329) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-D6trMTyZ.js → activity-store-slG02hSm.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-DZ6ETNIk.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-DxaIH0Ep.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-Tz57QxiN.js} +1 -1
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-DdR1L4LR.js +1 -0
  8. package/dist/gateway/static/root/assets/appearance-settings-wYbwqmee.js +1 -0
  9. package/dist/gateway/static/root/assets/apps-page-CyWr6KyO.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DKXa160O.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-CzwA9g2y.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-DwAXyWAY.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-CL7ieYIt.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-DoQ_DnT7.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-Bj_Uxxng.js} +47 -47
  16. package/dist/gateway/static/root/assets/browser-settings-page-BYa_FNC1.js +8 -0
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-D4roXE6r.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-CleKTAKD.js} +2 -2
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-DYG37N0k.js +7 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-wtEN6Ss6.js} +1 -1
  21. package/dist/gateway/static/root/assets/capability-presets-settings-panel-C0Q4dFq-.js +3 -0
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-DhuS2RJ3.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-CpO6Xg0n.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-CXhPeiNj.js +1 -0
  25. package/dist/gateway/static/root/assets/chat-terminal-dock-ClQMDe2n.js +36 -0
  26. package/dist/gateway/static/root/assets/connectors-page-BvyiPdKU.js +2 -0
  27. package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-4DvCFs-v.js} +1 -1
  28. package/dist/gateway/static/root/assets/date-picker-B6FSjt4Z.js +1 -0
  29. package/dist/gateway/static/root/assets/dependency-picker-Za18eMp1.js +1 -0
  30. package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-DUUf3yyJ.js} +1 -1
  31. package/dist/gateway/static/root/assets/desktop-pet-settings-Dwx3GfB8.js +1 -0
  32. package/dist/gateway/static/root/assets/directory-picker-path-field-C6dfTCsl.js +1 -0
  33. package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
  34. package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cordpg4X.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-Dw0dGyMl.js} +1 -1
  36. package/dist/gateway/static/root/assets/extension-settings-page-B2pUMaXm.js +1 -0
  37. package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
  38. package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +1 -0
  39. package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +1 -0
  40. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
  41. package/dist/gateway/static/root/assets/gateway-config-api-DAZUOEQh.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-BIqRg-zo.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-settings-ik2f-pmV.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-BFjWYOCS.js} +1 -1
  45. package/dist/gateway/static/root/assets/heartbeat-settings-BE81XJ8F.js +1 -0
  46. package/dist/gateway/static/root/assets/home-page-BTWXJu_m.js +1 -0
  47. package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-HXAWlgm6.js} +1 -1
  48. package/dist/gateway/static/root/assets/index-B6gWYy08.js +108 -0
  49. package/dist/gateway/static/root/assets/index-CDkuz_YC.css +2 -0
  50. package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +1 -0
  51. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
  52. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-ROqQ_Xlo.js} +1 -1
  53. package/dist/gateway/static/root/assets/local-app-workbench-page-Dcaf190G.js +2 -0
  54. package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-Be79cyMG.js} +1 -1
  55. package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-DfK-Hofd.js} +1 -1
  56. package/dist/gateway/static/root/assets/logs-page-C2pjbXno.js +2 -0
  57. package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-CRspx0oY.js} +1 -1
  58. package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-G3PTpGw3.js} +1 -1
  59. package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D4FPJZ91.js} +1 -1
  60. package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-DT0P7j7u.js} +1 -1
  61. package/dist/gateway/static/root/assets/messages-B701TEZ5.js +3 -0
  62. package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-q7HjYO07.js} +1 -1
  63. package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-Cgl2h7AR.js} +1 -1
  64. package/dist/gateway/static/root/assets/notes-workbench-DFMQYyGJ.js +4 -0
  65. package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +1 -0
  66. package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +1 -0
  67. package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-ComKLO4D.js} +1 -1
  68. package/dist/gateway/static/root/assets/project-detail-page-DUFmQscH.js +1 -0
  69. package/dist/gateway/static/root/assets/projects-page-CTWxt3dv.js +1 -0
  70. package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-BBoJ7khF.js} +1 -1
  71. package/dist/gateway/static/root/assets/remote-access-hub-qmG-3qjj.js +1 -0
  72. package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
  73. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-CXHQc53b.js} +2 -2
  74. package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-3jTDF2lJ.js} +1 -1
  75. package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
  76. package/dist/gateway/static/root/assets/sessions-page-D_We4_MV.js +1 -0
  77. package/dist/gateway/static/root/assets/settings-advanced-gate-B_QhPgU0.js +1 -0
  78. package/dist/gateway/static/root/assets/settings-form-section-CUDozALU.js +1 -0
  79. package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-H3ZH6a6l.js} +1 -1
  80. package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-tx29z21o.js} +1 -1
  81. package/dist/gateway/static/root/assets/setup-status-panel-VunfXpTX.js +1 -0
  82. package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-MyThymEx.js} +1 -1
  83. package/dist/gateway/static/root/assets/shares-settings-DkZvY1cr.js +1 -0
  84. package/dist/gateway/static/root/assets/skill-reload-api-DVDOh1iY.js +1 -0
  85. package/dist/gateway/static/root/assets/skills-page-BOOyMnno.js +2 -0
  86. package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Bl5Yv3Cx.js} +1 -1
  87. package/dist/gateway/static/root/assets/system-settings-panel-DwQ3O1ta.js +1 -0
  88. package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
  89. package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
  90. package/dist/gateway/static/root/assets/task-detail-page-BwOyrADL.js +1 -0
  91. package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-Br4BtK4x.js} +1 -1
  92. package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +1 -0
  93. package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-DRS3RwS9.js} +1 -1
  94. package/dist/gateway/static/root/assets/user-context-page-ClV2r3Cr.js +1 -0
  95. package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-CGTE5156.js} +1 -1
  96. package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-CW-HKD7h.js} +1 -1
  97. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-Dtr9fDC8.js} +2 -2
  98. package/dist/gateway/static/root/assets/workflows-page-CDOyNgZf.js +5 -0
  99. package/dist/gateway/static/root/index.html +20 -11
  100. package/dist/package.js +1 -1
  101. package/dist/packages/gateway-contract/src/new-session.js +99 -0
  102. package/dist/packages/gateway-contract/src/tasks.js +5 -0
  103. package/dist/packages/gateway-contract/src/user-message-display.js +55 -0
  104. package/dist/src/agent/agent-manager.js +3 -2
  105. package/dist/src/agent/background-review/prompts.d.ts +1 -1
  106. package/dist/src/agent/background-review/prompts.js +6 -3
  107. package/dist/src/agent/background-review/run-background-review.js +144 -16
  108. package/dist/src/agent/inbound/turn-dispatcher.d.ts +3 -1
  109. package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
  110. package/dist/src/agent/memory/context/types.d.ts +1 -1
  111. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  112. package/dist/src/agent/memory/manager.d.ts +2 -1
  113. package/dist/src/agent/memory/manager.js +2 -6
  114. package/dist/src/agent/memory/understanding/service.d.ts +1 -0
  115. package/dist/src/agent/memory/understanding/service.js +179 -36
  116. package/dist/src/agent/memory/understanding/types.d.ts +6 -0
  117. package/dist/src/agent/messaging/command-handler.d.ts +2 -0
  118. package/dist/src/agent/messaging/command-handler.js +3 -1
  119. package/dist/src/agent/service/direct-turn-helpers.d.ts +3 -0
  120. package/dist/src/agent/service/direct-turn-helpers.js +13 -3
  121. package/dist/src/agent/service/process-direct-streaming.d.ts +2 -1
  122. package/dist/src/agent/service/process-direct-streaming.js +12 -11
  123. package/dist/src/agent/session/session-config-service.d.ts +1 -0
  124. package/dist/src/agent/session/session-config-service.js +11 -0
  125. package/dist/src/agent/session/session-inspector.d.ts +1 -0
  126. package/dist/src/agent/session/session-inspector.js +1 -0
  127. package/dist/src/agent/source-context/budget.d.ts +3 -0
  128. package/dist/src/agent/source-context/budget.js +21 -0
  129. package/dist/src/agent/source-context/index.js +3 -3
  130. package/dist/src/agent/source-context/injector.d.ts +2 -2
  131. package/dist/src/agent/source-context/injector.js +19 -9
  132. package/dist/src/agent/source-context/types.d.ts +16 -0
  133. package/dist/src/agent/source-context/types.js +25 -1
  134. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  135. package/dist/src/agent/tool-manuals/xopc-use.js +19 -2
  136. package/dist/src/agent/tools/xopc-use-tool.js +62 -2
  137. package/dist/src/agent-runtime/index.js +1 -1
  138. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  139. package/dist/src/browser/backend-from-config.d.ts +8 -0
  140. package/dist/src/browser/backend-from-config.js +16 -1
  141. package/dist/src/browser/providers/browser-ext-install.d.ts +3 -2
  142. package/dist/src/browser/providers/browser-ext-install.js +4 -2
  143. package/dist/src/chat-commands/builtins/review.js +11 -2
  144. package/dist/src/chat-commands/builtins/understanding.js +11 -4
  145. package/dist/src/chat-commands/types.d.ts +4 -0
  146. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  147. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  148. package/dist/src/cli/commands/extension.js +1 -1
  149. package/dist/src/config/agent-profile.js +1 -1
  150. package/dist/src/config/models-json.d.ts +20 -20
  151. package/dist/src/connectors/connected-source-ingestion.js +21 -4
  152. package/dist/src/connectors/connected-source-normalizers.js +51 -4
  153. package/dist/src/connectors/connected-source-understanding.d.ts +20 -0
  154. package/dist/src/connectors/connected-source-understanding.js +180 -0
  155. package/dist/src/connectors/content-enrichment.d.ts +1 -0
  156. package/dist/src/connectors/content-enrichment.js +11 -7
  157. package/dist/src/connectors/learning-coordinator.js +112 -15
  158. package/dist/src/connectors/learning-recipes.js +2 -2
  159. package/dist/src/document-understanding/extract.d.ts +1 -1
  160. package/dist/src/document-understanding/extract.js +54 -1
  161. package/dist/src/extensions/update.js +1 -1
  162. package/dist/src/gateway/agents-admin.js +1 -1
  163. package/dist/src/gateway/chat-stream/mapper.js +18 -0
  164. package/dist/src/gateway/heartbeat/service.js +1 -1
  165. package/dist/src/gateway/hono/routes/agent-stream.js +12 -2
  166. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  167. package/dist/src/gateway/hono/routes/commands-skills.js +1 -0
  168. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +46 -2
  169. package/dist/src/gateway/hono/routes/session-input-handler.js +23 -3
  170. package/dist/src/gateway/hono/routes/sessions.js +17 -20
  171. package/dist/src/gateway/hono/routes/tasks.js +25 -0
  172. package/dist/src/gateway/hono/routes/understanding-sources.d.ts +9 -0
  173. package/dist/src/gateway/hono/routes/understanding-sources.js +138 -24
  174. package/dist/src/gateway/hono/routes/you.js +71 -4
  175. package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
  176. package/dist/src/gateway/rate-limit/buckets.js +2 -2
  177. package/dist/src/gateway/service/agent-runner.d.ts +7 -2
  178. package/dist/src/gateway/service/agent-runner.js +21 -1
  179. package/dist/src/gateway/service/config-coordinator.js +1 -1
  180. package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
  181. package/dist/src/gateway/service/run-gateway-agent.js +2 -1
  182. package/dist/src/gateway/service/session-input-coordinator.d.ts +8 -2
  183. package/dist/src/gateway/service/session-input-coordinator.js +62 -3
  184. package/dist/src/gateway/service/sessions-api.d.ts +1 -0
  185. package/dist/src/gateway/service.d.ts +3 -2
  186. package/dist/src/gateway/service.js +16 -6
  187. package/dist/src/gateway/user-turn-input.d.ts +2 -0
  188. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +3 -2
  189. package/dist/src/gateway/xopc-cloud-capability-setup.js +16 -3
  190. package/dist/src/heartbeat/index.js +1 -1
  191. package/dist/src/infra/update-runner.js +1 -1
  192. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
  193. package/dist/src/knowledge/connected-understanding-pipeline.js +4 -2
  194. package/dist/src/retrieval/queryProfile.d.ts +1 -0
  195. package/dist/src/retrieval/queryProfile.js +9 -1
  196. package/dist/src/session/client-history.d.ts +11 -0
  197. package/dist/src/session/client-history.js +24 -2
  198. package/dist/src/session/config-types.d.ts +1 -1
  199. package/dist/src/session/session-title.js +2 -3
  200. package/dist/src/session/store.js +1 -0
  201. package/dist/src/session/transcript-outline.js +5 -2
  202. package/dist/src/session/types.d.ts +1 -0
  203. package/dist/src/session/user-message-display.d.ts +4 -0
  204. package/dist/src/session/user-message-display.js +22 -0
  205. package/dist/src/storage/sqlite/context-extraction-repository.d.ts +57 -0
  206. package/dist/src/storage/sqlite/context-extraction-repository.js +119 -0
  207. package/dist/src/storage/sqlite/context-relation-repository.d.ts +50 -0
  208. package/dist/src/storage/sqlite/context-relation-repository.js +97 -0
  209. package/dist/src/storage/sqlite/index.d.ts +4 -2
  210. package/dist/src/storage/sqlite/index.js +5 -3
  211. package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +72 -0
  212. package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +36 -0
  213. package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +73 -0
  214. package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +51 -0
  215. package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +18 -0
  216. package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +2 -0
  217. package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +34 -0
  218. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  219. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  220. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  221. package/dist/src/storage/sqlite/schema.js +1 -1
  222. package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
  223. package/dist/src/storage/sqlite/session-input-repository.js +19 -7
  224. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +3 -0
  225. package/dist/src/storage/sqlite/session-turn-replace-repository.js +3 -2
  226. package/dist/src/storage/sqlite/transcript-repository.js +29 -3
  227. package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -1
  228. package/dist/src/storage/sqlite/user-context-repository.js +65 -29
  229. package/dist/src/tasks/index.d.ts +1 -0
  230. package/dist/src/tasks/index.js +2 -1
  231. package/dist/src/tasks/task-deletion-service.d.ts +21 -0
  232. package/dist/src/tasks/task-deletion-service.js +35 -0
  233. package/dist/src/tasks/task-repository.js +22 -1
  234. package/dist/src/tui/backends/embedded-backend.js +5 -3
  235. package/dist/src/tui/backends/gateway-realtime-backend.js +5 -3
  236. package/dist/src/tui/chat-history.js +2 -1
  237. package/dist/src/tui/tui-agent-events.js +4 -2
  238. package/dist/src/tui/tui-commands.d.ts +1 -0
  239. package/dist/src/tui/tui-commands.js +8 -3
  240. package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -1
  241. package/dist/src/tui/tui-empty-session-cleanup.js +1 -11
  242. package/dist/src/tui/tui-new-session-preferences.d.ts +10 -0
  243. package/dist/src/tui/tui-new-session-preferences.js +32 -0
  244. package/dist/src/tui/tui-session-actions.d.ts +1 -0
  245. package/dist/src/tui/tui-session-actions.js +2 -1
  246. package/dist/src/tui/tui-settings.d.ts +2 -0
  247. package/dist/src/tui/tui-settings.js +4 -1
  248. package/dist/src/tui/tui-types.d.ts +1 -0
  249. package/dist/src/tui/tui.js +57 -4
  250. package/dist/src/tunnel/frpc-process.js +3 -0
  251. package/dist/src/tunnel/tunnel-service.d.ts +2 -0
  252. package/dist/src/tunnel/tunnel-service.js +40 -28
  253. package/dist/src/user-context/context-objects.d.ts +17 -0
  254. package/dist/src/user-context/context-objects.js +99 -0
  255. package/dist/src/user-context/domain.d.ts +13 -1
  256. package/dist/src/user-context/evaluation/harness.d.ts +13 -0
  257. package/dist/src/user-context/evaluation/harness.js +31 -0
  258. package/dist/src/user-context/extraction/registry.d.ts +26 -0
  259. package/dist/src/user-context/extraction/registry.js +113 -0
  260. package/dist/src/user-context/extraction/repair.d.ts +19 -0
  261. package/dist/src/user-context/extraction/repair.js +68 -0
  262. package/dist/src/user-context/planner.js +214 -57
  263. package/dist/src/user-context/retriever.js +69 -9
  264. package/dist/src/user-context/sources/catalog.js +9 -2
  265. package/dist/src/user-context/sources/index.js +2 -2
  266. package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
  267. package/dist/src/user-context/sources/local-source-contract.js +1 -0
  268. package/dist/src/user-context/sources/processing-policy.d.ts +2 -0
  269. package/dist/src/user-context/sources/processing-policy.js +7 -0
  270. package/dist/src/user-context/sources/repository.d.ts +23 -4
  271. package/dist/src/user-context/sources/repository.js +122 -12
  272. package/dist/src/user-context/sources/types.d.ts +10 -1
  273. package/dist/src/user-context/understanding-writing.d.ts +1 -0
  274. package/dist/src/user-context/understanding-writing.js +4 -0
  275. package/dist/src/user-context/understanding.js +1 -1
  276. package/dist/src/work-discovery/analyzer.d.ts +6 -0
  277. package/dist/src/work-discovery/analyzer.js +181 -57
  278. package/dist/src/work-discovery/index.js +1 -1
  279. package/dist/src/work-discovery/probe.js +20 -0
  280. package/dist/src/work-discovery/service.d.ts +9 -0
  281. package/dist/src/work-discovery/service.js +39 -11
  282. package/dist/src/work-discovery/source-repository.js +1 -1
  283. package/dist/src/work-discovery/types.d.ts +5 -0
  284. package/package.json +3 -3
  285. package/dist/gateway/static/root/assets/agents-C6q_vDzP.js +0 -68
  286. package/dist/gateway/static/root/assets/app-management-settings-panel-DRsTwFbF.js +0 -1
  287. package/dist/gateway/static/root/assets/appearance-settings-B99NaPTf.js +0 -1
  288. package/dist/gateway/static/root/assets/apps-page-Dx66anqa.js +0 -1
  289. package/dist/gateway/static/root/assets/automations-workspace-CHbA8d-P.js +0 -6
  290. package/dist/gateway/static/root/assets/browser-settings-page-CpRc-9Jy.js +0 -8
  291. package/dist/gateway/static/root/assets/capabilities-settings-panel-C89FGECN.js +0 -7
  292. package/dist/gateway/static/root/assets/capability-presets-settings-panel-XT6WEz9E.js +0 -3
  293. package/dist/gateway/static/root/assets/channels-settings-DhKk1oNT.js +0 -1
  294. package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
  295. package/dist/gateway/static/root/assets/chat-terminal-dock-CTbkTsc2.js +0 -36
  296. package/dist/gateway/static/root/assets/connectors-page-BDn3HTzX.js +0 -2
  297. package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
  298. package/dist/gateway/static/root/assets/dependency-picker-ndtb88_T.js +0 -1
  299. package/dist/gateway/static/root/assets/desktop-pet-settings-C7BLs783.js +0 -1
  300. package/dist/gateway/static/root/assets/directory-picker-path-field-BWiap88p.js +0 -1
  301. package/dist/gateway/static/root/assets/extension-settings-page-BhbcGuiJ.js +0 -1
  302. package/dist/gateway/static/root/assets/gateway-config-api-CUt9bIpL.js +0 -1
  303. package/dist/gateway/static/root/assets/gateway-settings-RafSECLG.js +0 -1
  304. package/dist/gateway/static/root/assets/heartbeat-settings-CwVPlPLB.js +0 -1
  305. package/dist/gateway/static/root/assets/home-page-CbdBcCwC.js +0 -1
  306. package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
  307. package/dist/gateway/static/root/assets/index-CMLkr37Y.js +0 -108
  308. package/dist/gateway/static/root/assets/local-app-workbench-page-DdaPtQ5M.js +0 -2
  309. package/dist/gateway/static/root/assets/logs-page-CjxMHTQO.js +0 -2
  310. package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
  311. package/dist/gateway/static/root/assets/notes-workbench-V9C-8vSn.js +0 -4
  312. package/dist/gateway/static/root/assets/page-tabs-e99j9S9K.js +0 -1
  313. package/dist/gateway/static/root/assets/preview-open-alternatives-DW9MDOva.js +0 -1
  314. package/dist/gateway/static/root/assets/project-detail-page-DHmAUggu.js +0 -1
  315. package/dist/gateway/static/root/assets/projects-page-D0EiN69Y.js +0 -1
  316. package/dist/gateway/static/root/assets/remote-access-hub-BuAVFk2O.js +0 -1
  317. package/dist/gateway/static/root/assets/sessions-page-hzlTfgOl.js +0 -1
  318. package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
  319. package/dist/gateway/static/root/assets/settings-form-section-z0JH53Fu.js +0 -1
  320. package/dist/gateway/static/root/assets/setup-status-panel-fZQfoJAk.js +0 -1
  321. package/dist/gateway/static/root/assets/shares-settings-B5dPMq3Y.js +0 -1
  322. package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
  323. package/dist/gateway/static/root/assets/skills-page-BSN2VaqR.js +0 -2
  324. package/dist/gateway/static/root/assets/system-settings-panel-CSibO8vj.js +0 -1
  325. package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
  326. package/dist/gateway/static/root/assets/task-detail-page-HCKZ11E8.js +0 -1
  327. package/dist/gateway/static/root/assets/typed-models-lib-zrYg51t3.js +0 -1
  328. package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
  329. package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-ybRARsPs.js";import{t as o}from"./cn-JdwAhgNB.js";import{l as s,o as c,r as l,s as u}from"./locale-store-De8wYkd7.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=s.getState().token??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await c(l(_(e,t)));if(n.status===401&&s.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function k(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function A(e,t){let n=s.getState().token,r=new Headers;n&&r.set(`Authorization`,`Bearer ${n}`);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&s.getState().onUnauthorized(),!i.ok)throw Error(await k(i));return i.json()}var j=r();function M(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,j.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,j.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,j.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,j.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function N(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function P(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function F(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return P(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=N(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,j.jsx)(`div`,{ref:o,children:(0,j.jsx)(a,{content:l,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function I(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return u(l(`/api/notes${n?`?${n}`:``}`))}async function L(e,t=`web`){return(await u(l(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function R(e){return(await u(l(`/api/notes`),{method:`POST`,body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function z(e){let t=await c(l(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function B(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function V(e){await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function H(e){return u(l(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function U(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function W(e,t={}){return u(l(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t.forceNew?{forceNew:!0}:{})})}async function G(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function K(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function q(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function J(e,t,n){return(await u(l(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Y(e,t={}){return(await u(l(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceSessionKey:t.sourceSessionKey||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function X(e,t){let n=new FormData;return n.append(`file`,t),(await A(l(`/api/notes/${encodeURIComponent(e)}/media`),n)).attachment}async function Z(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await A(l(`/api/notes`),n)).note}async function Q(e,t=`web`){let n=await Z(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${D(n.id,r.id)})`;return n.markdown!==i&&(n=await B(n.id,{markdown:i})),n}async function $(e,t,n=`web`){let r=await Z(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await B(r.id,{markdown:a,kind:`voice`})),r}async function ee(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function te(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function ne(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{D as C,g as D,h as E,d as O,M as S,E as T,U as _,V as a,X as b,te as c,I as d,W as f,q as g,$ as h,Y as i,ee as l,Q as m,H as n,z as o,L as p,R as r,K as s,J as t,G as u,ne as v,T as w,F as x,B as y};
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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-D4FPJZ91.js";import{t as o}from"./cn-JdwAhgNB.js";import{l as s,o as c,r as l,s as u}from"./locale-store-DfK-Hofd.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=s.getState().token??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await c(l(_(e,t)));if(n.status===401&&s.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function k(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function A(e,t){let n=s.getState().token,r=new Headers;n&&r.set(`Authorization`,`Bearer ${n}`);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&s.getState().onUnauthorized(),!i.ok)throw Error(await k(i));return i.json()}var j=r();function M(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,j.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,j.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,j.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,j.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function N(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function P(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function F(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return P(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=N(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,j.jsx)(`div`,{ref:o,children:(0,j.jsx)(a,{content:l,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function I(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return u(l(`/api/notes${n?`?${n}`:``}`))}async function L(e,t=`web`){return(await u(l(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function R(e){return(await u(l(`/api/notes`),{method:`POST`,body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function z(e){let t=await c(l(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function B(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function V(e){await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function H(e){return u(l(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function U(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function W(e,t={}){return u(l(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t.forceNew?{forceNew:!0}:{})})}async function G(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function K(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function q(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function J(e,t,n){return(await u(l(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Y(e,t={}){return(await u(l(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceSessionKey:t.sourceSessionKey||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function X(e,t){let n=new FormData;return n.append(`file`,t),(await A(l(`/api/notes/${encodeURIComponent(e)}/media`),n)).attachment}async function Z(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await A(l(`/api/notes`),n)).note}async function Q(e,t=`web`){let n=await Z(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${D(n.id,r.id)})`;return n.markdown!==i&&(n=await B(n.id,{markdown:i})),n}async function $(e,t,n=`web`){let r=await Z(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await B(r.id,{markdown:a,kind:`voice`})),r}async function ee(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function te(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function ne(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{D as C,g as D,h as E,d as O,M as S,E as T,U as _,V as a,X as b,te as c,I as d,W as f,q as g,$ as h,Y as i,ee as l,Q as m,H as n,z as o,L as p,R as r,K as s,J as t,G as u,ne as v,T as w,F as x,B as y};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-V9C-8vSn.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-DFMQYyGJ.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Bj_Uxxng.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-B6gWYy08.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/markdown-view-D4FPJZ91.js","assets/dist-BPoKqzeH.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-DfK-Hofd.js","assets/messages-B701TEZ5.js","assets/cn-JdwAhgNB.js","assets/product-delivery-tRr-7IxY.js","assets/schemas-zIBW3wiV.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DD_PgVue.css","assets/dist-DY4Af0fY.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-BzdnTy3h.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/file-code-corner-byQA1VfD.js","assets/globe-DSSGFWFn.js","assets/notes-api-q7HjYO07.js","assets/loader-circle-CifKLtgG.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/tool-activity-R8V9l6nk.js","assets/button-CSEbl4zT.js","assets/registry-api-BBoJ7khF.js","assets/gateway-startup-retry-BFjWYOCS.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-BIqRg-zo.js","assets/electron-env-DH5wF8X8.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/is-masked-secret-DOkL5b_X.js","assets/activity-store-slG02hSm.js","assets/theme-store-Br4BtK4x.js","assets/index-CDkuz_YC.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
2
+ 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"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./eye-CABVeTq0.js";import{E as u,O as d,S as f,T as p,_ as m,a as h,c as g,d as _,f as v,g as y,h as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,u as O,v as k,w as A,x as j,y as M}from"./notes-api-q7HjYO07.js";import{t as N}from"./loader-circle-CifKLtgG.js";import{t as P}from"./plus-Q2yW6OE7.js";import{t as F}from"./search-DA7gz22f.js";import{t as I}from"./x-B_N4OPjy.js";import{t as L}from"./cn-JdwAhgNB.js";import{t as R}from"./button-CSEbl4zT.js";import{t as z}from"./messages-B701TEZ5.js";import{l as B,n as ee}from"./locale-store-DfK-Hofd.js";import{i as te}from"./theme-store-Br4BtK4x.js";import{a as ne,i as re,n as ie,o as ae,r as V,s as oe,t as H}from"./dist-BPoKqzeH.js";import{i as U}from"./vendor-swr-BIWyz7Rc.js";import{$l as se,$s as ce,As as le,Bs as ue,Cs as W,Ec as de,Es as G,Gr as fe,Hr as pe,Ic as me,Ii as he,Jr as ge,Kr as _e,Ll as K,Qa as q,Ul as J,Ur as ve,Us as ye,Vr as Y,Wr as be,Xl as xe,Xn as Se,Xr as Ce,Ya as we,Yl as Te,Yr as Ee,Zr as X,Zs as De,_s as Oe,ac as ke,c as Ae,d as je,dl as Me,ec as Ne,fc as Pe,gc as Fe,gs as Ie,hs as Le,il as Re,ks as ze,l as Be,ql as Ve,rc as He,s as Ue,tc as We,tl as Ge,u as Ke,uo as qe,vs as Je,zc as Ye}from"./index-B6gWYy08.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ne,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=L(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=m):m=t[4];let h=a?.alt||`Image preview`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(oe,{className:`sr-only`,children:h}),t[5]=h,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(I,{className:`size-5`,"aria-hidden":!0}),t[7]=_):_=t[7];let v;t[8]===i?v=t[9]:(v=(0,$.jsx)(ie,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:_})}),t[8]=i,t[9]=v);let y;t[10]===a?y=t[11]:(y=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=y);let b;t[12]!==v||t[13]!==y||t[14]!==g?(b=(0,$.jsxs)(ae,{children:[p,(0,$.jsxs)(V,{className:m,"aria-describedby":void 0,children:[g,v,y]})]}),t[12]=v,t[13]=y,t[14]=g,t[15]=b):b=t[15];let x;t[16]!==b||t[17]!==d?(x=(0,$.jsx)(H,{open:d,onOpenChange:f,children:b}),t[16]=b,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==n||t[20]!==x?(S=(0,$.jsxs)(Xe.Provider,{value:u,children:[n,x]}),t[19]=n,t[20]=x,t[21]=S):S=t[21],S}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=u(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=L(`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)(d,{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 p;t[9]===i?p=t[10]:(p=L(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=p);let m;return t[11]!==n||t[12]!==c||t[13]!==p?(m=(0,$.jsx)(f,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:p}),t[11]=n,t[12]=c,t[13]=p,t[14]=m):m=t[14],m}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(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 lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=X(),f=X(dt),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 b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=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]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=L(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=L(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(N,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(He,{className:`size-3.5`}):(0,$.jsx)(De,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(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:k}})}),t[23]=k,t[24]=A);let j;t[25]!==_||t[26]!==p||t[27]!==g?(j=ct(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=j):j=t[28];let M;t[29]===j?M=t[30]:(M=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:j}),t[29]=j,t[30]=M);let P;t[31]!==A||t[32]!==M?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,M]}),t[31]=A,t[32]=M,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==C||t[36]!==O?(F=(0,$.jsxs)(`div`,{className:C,onClick:ut,children:[O,P]}),t[34]=P,t[35]=C,t[36]=O,t[37]=F):F=t[37],F}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=ft(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(_t),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=at(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=L(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=L(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Re,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(_e,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,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:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>a(n.id,!n.pinned),t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(ce,{className:`size-4`}):(0,$.jsx)(Ne,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(pe,{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:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==n.id||t[45]!==o?(F=()=>o(n.id),t[44]=n.id,t[45]=o,t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(xe,{className:`size-4`}),t[47]=I):I=t[47];let R;t[48]!==c.archive||t[49]!==F?(R=(0,$.jsxs)(pe,{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,c.archive]}),t[48]=c.archive,t[49]=F,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(fe,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>s(n.id),t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Ie,{className:`size-4`}),t[55]=ee):ee=t[55];let te;t[56]!==c.delete||t[57]!==B?(te=(0,$.jsxs)(pe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[ee,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=te):te=t[58];let ne;t[59]!==P||t[60]!==R||t[61]!==te?(ne=(0,$.jsx)(ve,{children:(0,$.jsxs)(Y,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[P,R,z,te]})}),t[59]=P,t[60]=R,t[61]=te,t[62]=ne):ne=t[62];let re;t[63]!==A||t[64]!==ne?(re=(0,$.jsxs)(be,{children:[A,ne]}),t[63]=A,t[64]=ne,t[65]=re):re=t[65];let ie;t[66]!==C||t[67]!==O||t[68]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,re]}),t[66]=C,t[67]=O,t[68]=re,t[69]=ie):ie=t[69];let ae;t[70]===n.pinned?ae=t[71]:(ae=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)(Ne,{className:`size-3`})}),t[70]=n.pinned,t[71]=ae);let V;t[72]===n.tags?V=t[73]:(V=n.tags?.slice(0,2).map(mt),t[72]=n.tags,t[73]=V);let oe;t[74]===g?oe=t[75]:(oe=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=oe);let H;t[76]!==ae||t[77]!==V||t[78]!==oe?(H=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ae,V,oe]}),t[76]=ae,t[77]=V,t[78]=oe,t[79]=H):H=t[79];let U;return t[80]!==ie||t[81]!==H||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(U=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,ie,H]}),t[80]=ie,t[81]=H,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=U):U=t[87],U}function mt(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 ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:l}=e,u=l===void 0?`card`:l,d=ee(xt),f=z(d).automations.suggestions,p=z(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=U(o?`automation-suggestion-coverage`:null,bt,h),_=o?g?.automations.find(e=>Ke(e,o)):void 0,v=_?Ae(_,p):[];if(u===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=L(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(c,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(R,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=L(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(de,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let l;t[12]!==m||t[13]!==i?(l=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=l):l=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(R,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:l,children:[u,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=L(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(R,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Be(f.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(yt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=L(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(de,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(R,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,$.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return je.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),A(n,r).then(i=>{if(e=!0,t){p(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&p(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(we,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=f):f=t[9],f}function Tt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=z(ee(Ot)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>Se(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:l}=U(i,a,o),u,d;if(t[4]===l?(u=t[5],d=t[6]):(u=()=>{let e=e=>{let t=e.detail;t&&l(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Dt);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void l();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},d=[l],t[4]=l,t[5]=u,t[6]=d),(0,Q.useEffect)(u,d),!s)return null;let{discussion:f,transcript:p}=s,m=s.organization?.organization,h=[`stopping`,`sealing`,`organizing`].includes(f.status),g=p.stats.uploaded+p.stats.transcribing,_=p.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(p.stats.failed)):g>0?r.processingSegments.replace(`{{count}}`,String(g)):h?r.finalizing:f.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==m?(v=m?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:m.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[m.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(St,{values:m.decisions})]}):null,m.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(St,{values:m.actionItems.map(Et)})]}):null,m.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(St,{values:m.risks})]}):null,m.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(St,{values:m.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=m,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==f.audioAttachmentId||t[17]!==n?(y=f.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Pe,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(wt,{noteId:n,attachmentId:f.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=f.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Pe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=f.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===f.status?C=t[23]:(C=f.status===`needs_attention`?(0,$.jsx)(Le,{className:`size-3.5 text-danger`}):f.status===`completed`?(0,$.jsx)(c,{className:`size-3.5 text-success`}):null,t[22]=f.status,t[23]=C);let w=f.status===`needs_attention`?f.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==S||t[28]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=E):E=t[29];let D=p.text||r.waitingTranscript,O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:D}),t[30]=D,t[31]=O);let k;t[32]!==E||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==k||t[36]!==v||t[37]!==y?(A=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,k]}),t[35]=k,t[36]=v,t[37]=y,t[38]=A):A=t[38],A}function Et(e){return e.title}function Dt(e,t){return e.sequence-t.sequence}function Ot(e){return e.language}var kt={edit:We,ai_edit:le,sync:ye,restore:Te};function At(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function jt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=z(ee(e=>e.language)).notes,o=a,{data:s}=U(e?[`note-history`,e]:null,()=>x(e)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useCallback)(async t=>{l(!0),p(null);try{await k(e,t),d(null),i()}catch{p(a.restoreFailed)}finally{l(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),h=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:f}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=kt[e.trigger]??We,i=t===e.timestamp,s=u===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:L(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:At(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,h,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},disabled:c,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),d(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),d(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function Mt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:l,onOpenChat:u,onOpenNewChat:d}=e,f=z(ee(zt)).notes,p=a(),h=r?.aiDeep?.catalysis,g=h?.report??null,_;t[0]===n?_=t[1]:(_=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=_);let v;t[2]===n?v=t[3]:(v=()=>D(n),t[2]=n,t[3]=v);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},t[4]=b):b=t[4];let{data:x,mutate:S,isLoading:C}=U(_,v,b),w;t[5]===n?w=t[6]:(w=async e=>{try{await m(n,e)}catch{}},t[5]=n,t[6]=w);let T=w,E;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(le,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=E):E=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Ve,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=O):O=t[8];let k;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Fe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=k):k=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:O})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:f.catalysisSectionDescription}),x?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(()=>y(n),{revalidate:!1}),disabled:C,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:f.contextRebuild}),(0,$.jsx)(`span`,{className:L(`rounded-full px-2 py-0.5 text-[11px] font-medium`,x.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:x.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:x.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:f.contextStatusDetail.replace(`{{attachments}}`,String(x.attachments.length)).replace(`{{tokens}}`,String(x.tokenEstimate??0))}),x.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:x.attachments.slice(0,5).map(Rt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?f.processing:g?f.recatalyze:f.catalyzeAction}),g?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:g.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:g.targetUsers.slice(0,5).map(Lt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.keyQuestions.slice(0,3).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.mvpPath.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.risks.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.nextActions.slice(0,4).map(Nt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(g.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`helpful`),className:L(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,$.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`not_helpful`),className:L(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,$.jsx)(Je,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:f.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[k,f.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:u,disabled:l,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:l?f.openingChat:f.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:d,disabled:l,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:f.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>p(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||f.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:f.noThreads})]})]})]})}function Nt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Pt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Ft(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function It(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function Lt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Rt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function zt(e){return e.language}var Bt=()=>i(()=>import(`./block-editor-Bj_Uxxng.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])),Vt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([56,1,3,53,5,57])),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.BlockEditor}))),Ut=(0,Q.lazy)(()=>Vt().then(e=>({default:e.MarkdownEditor})));function Wt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Gt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Ge},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Me},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:l},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let u=c,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&Bt(),t===`source`&&Vt()},onFocus:()=>{t===`wysiwyg`&&Bt(),t===`source`&&Vt()},className:L(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Kt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=ee(qt),h;t[0]===m?h=t[1]:(h=z(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(Jt,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)($e,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function qt(e){return e.language}function Jt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=ee(e=>e.language),d=z(u).notes,f=z(u).automations.suggestions,p=a(),m=te(e=>e.resolved)===`dark`,{openImage:h}=Ze(),[_,y]=(0,Q.useState)(`wysiwyg`),[b,x]=(0,Q.useState)(null),[S,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(360),[I,R]=(0,Q.useState)(!1),[B,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(!1),[ae,V]=(0,Q.useState)(null),oe=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),ce=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),W=(0,Q.useRef)(null),de=(0,Q.useRef)(null),G=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(null),_e=qe(e=>e.setPageHeader),K=qe(e=>e.clearPageHeader),{data:q,mutate:J}=U(e?[`note-detail`,e]:null,()=>w(e)),{data:ve=[],mutate:ye}=U(e?[`note-threads`,e]:null,()=>O(e),{revalidateOnFocus:!1}),Y=S!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{oe.current=!1,A(``),T(null),x(null),H.current=!1,he.current=null},[e]),(0,Q.useEffect)(()=>{!q||oe.current||(A(q.title??``),oe.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||Y||he.current===e)return;let t=window.requestAnimationFrame(()=>{me.current?.focus(),l?.()});return he.current=e,()=>window.cancelAnimationFrame(t)},[c,Y,q,e,l]);let be=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,xe=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:L(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,se,i),children:(0,$.jsx)(Ve,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),Se=(0,Q.useCallback)(t=>{A(t),e&&(de.current=t,ue.current&&clearTimeout(ue.current),ue.current=setTimeout(async()=>{let t=de.current;if(de.current=null,t!==null){D(!0);try{await M(e,{title:t}),await J(),n?.()}catch{}finally{D(!1)}}},600))},[e,J,n]),we=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:L(`flex min-w-0 items-center gap-2`,se),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:k||be||void 0,children:k||be}),E?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,E,be,k]),Te=(0,Q.useCallback)(async(t=!1)=>{ie(!0),V(null);try{let n=await v(e,{forceNew:t});await J(),await ye(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){V(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ie(!1)}},[J,ye,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),X=(0,Q.useCallback)(async()=>{ne(!0),V(null);try{await C(e),await J()}catch(e){V(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ne(!1)}},[J,e]),De=(0,Q.useCallback)(()=>{x(b===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!B&&X()},[b,B,X,q?.aiDeep?.catalysis?.report]),Oe=(0,Q.useCallback)(()=>{let t=S?.markdown??W.current??q?.markdown??``,n=S?.title??k,r=Ee([n,t].filter(Boolean).join(`
3
+
4
+ `));return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:Ce(r,u)}},[u,d.titlePlaceholder,q?.markdown,e,S,k]),ke=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:L(`flex items-center gap-2`,se),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":d.searchDialogTitle,className:`rounded-lg p-1.5 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:(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(ge,{input:Oe,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:De,disabled:B,"aria-label":d.catalysisSectionTitle,className:L(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,b===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),B?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Te(!1),disabled:re,className:L(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),re?d.openingChat:d.openChatButton]}),(0,$.jsx)(Gt,{mode:_,onModeChange:y,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(b===`history`?null:`history`),"aria-label":d.history,className:L(`rounded-lg p-1.5 transition-colors`,b===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0})})]}),[B,De,Te,_,d.history,d.modeEdit,d.modePreview,d.modeSource,re,b,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,Oe]);(0,Q.useLayoutEffect)(()=>(_e({startExtra:xe,main:q?we:null,end:q?ke:null}),()=>{o&&K()}),[o,K,ke,we,xe,q,_e]);let Ae=(0,Q.useCallback)(t=>{e&&(W.current=t,ce.current&&clearTimeout(ce.current),ce.current=setTimeout(async()=>{let t=W.current;if(W.current=null,t!==null){D(!0),V(null);try{await M(e,{markdown:t}),await J(),n?.()}catch(e){V(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{D(!1)}}},600))},[e,J,d.saveFailed,d.saveFailedHint,n]),je=(0,Q.useCallback)(t=>{g(e,t.timestamp).then(e=>{e&&T(e)})},[e]),Me=(0,Q.useCallback)(()=>{x(null),T(null)},[]),Ne=(0,Q.useCallback)(()=>{x(null),T(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{ce.current&&clearTimeout(ce.current),ue.current&&clearTimeout(ue.current);let t=W.current,n=de.current;W.current=null,de.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&M(e,r)},[e]),q===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(q===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:d.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:d.back})]});let Pe=Y?S.title??``:k,Ie=Y?S.markdown??``:q.markdown??``,Le=new Date(q.createdAt).getTime(),Re=Number.isFinite(Le)&&Date.now()-Le<3600*1e3?(0,$.jsx)(vt,{title:f.noteCreatedTitle,description:f.noteCreatedDescription,prompt:f.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ae?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ae}):null,(0,$.jsx)(Ue,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(Ue,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:G,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[(0,$.jsx)(Tt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:Y?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Pe&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Pe}),Ie?(0,$.jsx)(j,{noteId:e,content:Ie,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[_===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:me,type:`text`,value:k,onChange:e=>Se(e.target.value),onCompositionStart:()=>{H.current=!0},onCompositionEnd:()=>{H.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!H.current&&!t.isComposing&&(e.preventDefault(),(G.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:d.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Re]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wt,{}),children:(0,$.jsx)(Ht,{initialContent:q.markdown??``,onChange:Ae,noteId:e},`wysiwyg-${e}`)})})]}),_===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:me,type:`text`,value:k,onChange:e=>Se(e.target.value),placeholder:d.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Re]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wt,{}),children:(0,$.jsx)(Ut,{initialContent:q.markdown??``,onChange:Ae,isDark:m},`source-${e}`)})})]}),_===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&h(t.currentSrc||t.src,t.alt)},children:[k&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:k}),q.markdown?(0,$.jsx)(j,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:fe,className:L(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!I&&`transition-[width] duration-300 ease-in-out`),style:{width:b?N:0},children:(0,$.jsxs)(`div`,{ref:pe,className:`flex min-h-0 flex-1 flex-col`,style:{width:N},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),R(!0);let n=e.clientX,r=N,i=e.pointerId,a=0,o=N,s=N,c=()=>{a=0,s=o,b&&fe.current?.style.setProperty(`width`,`${s}px`),pe.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}R(!1),P(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:L(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,I&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:b===`history`?(0,$.jsx)(jt,{noteId:e,activeTimestamp:S?.timestamp??null,onSelect:je,onClose:Me,onRestored:Ne}):b===`breakdown`?(0,$.jsx)(Mt,{noteId:e,note:q??null,catalyzing:B,onCatalyze:X,onClose:()=>x(null),noteThreads:ve,openingChat:re,onOpenChat:()=>Te(!1),onOpenNewChat:()=>Te(!0)}):null})]})})]})}var Yt=3e4;function Xt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Zt({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]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)([]),k=(0,Q.useRef)(0),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Q.useEffect)(()=>()=>M(),[M]);let N=(0,Q.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||Xt()||`audio/webm`,r=new Blob(O.current,{type:n});if(M(),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{w(!1)}return}w(!1)},[M,c]),F=(0,Q.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=Xt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{N()},Yt)}catch{M(),l?.()}}},[M,c,l,y,N,C]),I=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),R=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),I())},[I]),z=_||C,B=!!(s||c||p);return(0,$.jsxs)(`div`,{className:L(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void N(),disabled:C,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)(G,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(be,{children:[(0,$.jsx)(_e,{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)(P,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ve,{children:(0,$.jsxs)(Y,{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)(pe,{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)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(pe,{disabled:f,onSelect:()=>void F(),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)(Pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(pe,{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)(J,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:T,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||y,onClick:()=>void I(),"aria-label":t,title:t,className:L(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})]})}var Qt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},$t=240,en=320,tn=520,nn=560;function rn(e){if(globalThis.localStorage===void 0)return en;try{let t=globalThis.localStorage.getItem(e);if(!t)return en;let n=Number(t);return Number.isFinite(n)?n:en}catch{return en}}function an(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var on={thought:W,todo:ze,voice:Pe,media:me,bookmark:K,mixed:W,task:ze};function sn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function cn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function ln(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function un({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:c,listTitle:l,listDescription:u,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=z(ee(e=>e.language)).notes,g=!!B(e=>e.token),[v,y]=(0,Q.useReducer)(he,Qt),[x,C]=(0,Q.useState)(!1),[w,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(0),[A,j]=(0,Q.useState)(()=>rn(p)),[N,R]=(0,Q.useState)(!1),[te,ce]=(0,Q.useState)(!1),[le,ue]=(0,Q.useState)(!1),[de,G]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),[_e]=(0,Q.useState)(()=>Date.now()),K=a(),J=(0,Q.useCallback)(e=>{let t=me.current?.clientWidth??window.innerWidth,n=Math.max($t,t-nn);return Math.max($t,Math.min(Math.min(tn,n),e))},[]),ve=(0,Q.useCallback)(e=>{let t=J(e);j(t),an(p,t)},[J,p]);(0,Q.useLayoutEffect)(()=>{j(e=>J(e))},[J]);let{data:ye,mutate:Y,isLoading:be}=U((0,Q.useMemo)(()=>g?[`notes-list`,c,v.statusFilter,v.kindFilter,v.pinnedOnly]:null,[g,c,v.statusFilter,v.kindFilter,v.pinnedOnly]),()=>_({status:v.statusFilter===`all`?void 0:v.statusFilter,kind:v.kindFilter===`all`?void 0:v.kindFilter,projectId:c,pinned:v.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),xe=be&&!ye,Se=ye?.items??[],Ce=ye?.total??0,we=w.trim(),{data:Te,isLoading:Ee}=U(g&&x&&we?[`notes-search`,c,we]:null,()=>_({search:we,projectId:c,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Te?.items??[],De=e?Se.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{k(0)},[we]),(0,Q.useEffect)(()=>{O>=X.length&&k(Math.max(0,X.length-1))},[O,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Oe=qe(e=>e.setPageHeader),Ae=qe(e=>e.clearPageHeader),je=m.noteCount.replace(`{{count}}`,String(Ce)),Me=!r&&Ce===0&&u?u:je,Ne=m.searchDialogTitle,Pe=m.searchClose,Fe=m.searchClear,Ie=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),className:L(`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`,se),"aria-label":Ne,children:[(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ne})]}),[Ne]);(0,Q.useLayoutEffect)(()=>{if(n)return g?(Oe({startExtra:null,main:(0,$.jsxs)(`div`,{className:L(`flex min-w-0 items-center gap-2`,se),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:l??m.title}),je?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:je}):null]}),end:Ie}),()=>Ae()):(Ae(),()=>Ae())},[Ae,g,Ie,l,n,m.title,je,e,Oe]);let Le=(0,Q.useMemo)(()=>({justNow:m.justNow,minutesAgo:m.minutesAgo,today:m.today,yesterday:m.yesterday,daysAgo:m.daysAgo}),[m.justNow,m.minutesAgo,m.today,m.yesterday,m.daysAgo]),Re=(0,Q.useMemo)(()=>[{id:`recent`,label:m.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:m.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:m.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:m.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:m.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:m.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:m.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:m.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:m.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[m.filterArchived,m.filterInbox,m.filterProcessed,m.kindBookmark,m.kindMedia,m.kindVoice,m.pinned,m.viewRecent,m.viewTasks]),ze=Re.find(e=>cn(v,e))??Re[0],Be=l??ze.label,Ve=(0,Q.useCallback)(async e=>{G(null);try{let n=c?await E({markdown:e,kind:`thought`,projectId:c,channel:`web`}):await T(e,`web`);await Y(),K(ln(t,n.id))}catch(e){throw G(`${m.quickCaptureFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`),e}},[t,Y,m.quickCaptureFailed,m.quickCaptureFailedHint,K,c]),He=(0,Q.useCallback)(async()=>{if(!le){ue(!0),G(null);try{let e=await E({markdown:``,kind:`thought`,projectId:c,channel:`web`});y({type:`patch`,patch:Qt}),await Y(),pe(e.id),K(ln(t,e.id))}catch(e){G(`${m.createBlankFailed}: ${e instanceof Error?e.message:m.createBlankFailedHint}`)}finally{ue(!1)}}},[t,le,Y,m.createBlankFailed,m.createBlankFailedHint,K,c]),Ue=(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{G(null),await S(t,`web`),await Y()}catch(e){G(`${m.imageUploadFailed}: ${e instanceof Error?e.message:m.imageUploadFailedHint}`)}},e.click()},[Y,m.imageUploadFailed,m.imageUploadFailedHint]),We=(0,Q.useCallback)(async(e,t)=>{try{G(null),await b(e,t,`web`),await Y()}catch(e){G(`${m.voiceUploadFailed}: ${e instanceof Error?e.message:m.voiceUploadFailedHint}`)}},[Y,m.voiceUploadFailed,m.voiceUploadFailedHint]),Ge=(0,Q.useCallback)(()=>{G(`${m.voiceCaptureFailed}: ${m.voiceCaptureFailedHint}`)},[m.voiceCaptureFailed,m.voiceCaptureFailedHint]),Ke=(0,Q.useCallback)(async(e,t)=>{await M(e,{pinned:t}),await Y()},[Y]),Je=(0,Q.useCallback)(async e=>{await M(e,{status:`archived`}),await Y()},[Y]),Ye=(0,Q.useCallback)(async e=>{await h(e),await Y()},[Y]),Z=(0,Q.useCallback)(e=>{K(ln(t,e))},[t,K]),Xe=(0,Q.useCallback)(e=>{K(ln(t,e)),C(!1)},[t,K]),Ze=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),k(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),k(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[O]??X[0];t&&Xe(t.id)}}},[O,Xe,X]),Qe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ge.current;t.setPointerCapture(e.pointerId),R(!0);let r=me.current?.clientWidth??window.innerWidth,i=Math.max($t,r-nn),a=Math.min(tn,i),o=e=>Math.max($t,Math.min(a,e)),s=e.clientX,c=o(A),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},h=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}R(!1),me.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),j(f),an(p,f),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,A]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),He())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[He]);let $e=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ve(A-16)):e.key===`ArrowRight`?(e.preventDefault(),ve(A+16)):e.key===`Home`?(e.preventDefault(),ve($t)):e.key===`End`&&(e.preventDefault(),ve(tn))},[ve,A]);return g?(0,$.jsxs)(`div`,{ref:me,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${A}px`},children:[(0,$.jsxs)(`section`,{ref:ge,className:L(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!N&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,te?`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":te?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[de?(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:de}):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)(o,{value:ze.id,onChange:e=>{let t=Re.find(t=>t.id===e.target.value);t&&y({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":m.libraryTitle,children:Re.map(e=>(0,$.jsx)(s,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Be}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Me})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>ce(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":m.collapseNotesList,title:m.collapseNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:He,disabled:le,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":m.createBlankNote,title:m.createBlankShortcut,children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>C(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":m.searchDialogTitle,title:m.searchDialogTitle,children:(0,$.jsx)(F,{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:xe?(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))}):Se.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)(W,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!De?m.noteOutsideCurrentView:d??m.noNotes}),e&&!De?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??m.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!De?(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:m.noteOutsideCurrentView}):null,Se.map((t,n)=>{let r=n>0?st(Se[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[st(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:L(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ot(t.createdAt,_e,Le)}),(0,$.jsx)(pt,{note:t,selected:t.id===e,onPress:Z,onPin:Ke,onArchive:Je,onDelete:Ye,timeLabels:Le,labels:{pin:m.pin,unpin:m.unpin,archive:m.archive,delete:m.delete,actions:m.noteActions,imageNote:m.imageNote,noText:m.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Zt,{placeholder:m.quickCapturePlaceholder,submitLabel:m.quickCaptureSubmit,actionsLabel:m.quickCaptureActions,imageLabel:m.quickCaptureImage,voiceLabel:m.quickCaptureVoice,stopRecordingLabel:m.stopRecording,onCapture:Ve,onImagePick:i?Ue:void 0,onVoiceCapture:i?We:void 0,onVoiceError:Ge,recordingLabel:m.recording,discussionCaptureLabel:m.discussionCapture.title,onDiscussionCapture:()=>q(c)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.resizeNotesList,"aria-valuemin":$t,"aria-valuemax":tn,"aria-valuenow":Math.round(A),tabIndex:0,onPointerDown:Qe,onDoubleClick:()=>ve(en),onKeyDown:$e,title:m.resizeNotesList,className:L(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,te?`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:L(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,N&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:L(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[te?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ce(!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":m.expandNotesList,title:m.expandNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Kt,{noteId:e,onBack:()=>K(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>C(!0),autoFocus:e===fe,onAutoFocusConsumed:()=>pe(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)(W,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:m.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:He,disabled:le,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white 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)(P,{className:`size-4`,"aria-hidden":!0}),le?m.creatingBlankNote:m.createBlankNote]})]})})]}),(0,$.jsx)(H,{open:x,onOpenChange:C,children:(0,$.jsxs)(ae,{children:[(0,$.jsx)(ne,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(V,{className:`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-panel 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)(oe,{className:`text-sm font-semibold text-fg`,children:Ne}),(0,$.jsx)(re,{className:`sr-only`,children:m.searchPlaceholder}),(0,$.jsx)(ie,{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":Pe,children:(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(F,{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:w,onChange:e=>D(e.target.value),onKeyDown:Ze,placeholder:m.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`}),w?(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(``),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":Fe,children:(0,$.jsx)(I,{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:we?Ee&&!Te?(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))}):X.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)(W,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.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:m.searchResultsCount.replace(`{{count}}`,String(Te?.total??X.length))}),X.map((e,t)=>{let n=on[e.kind]||W,r=sn(e,{imageNote:m.imageNote,noText:m.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),onMouseEnter:()=>k(t),className:L(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===O?`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:at(e.updatedAt,_e,Le)})]}),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)(F,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(W,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.needToken})]})}export{Ze as n,un as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{n as a}from"./interaction-BmQogeqz.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{n as a}from"./interaction-BmQogeqz.js";import{t as o}from"./electron-env-DH5wF8X8.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=o()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=o()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=i(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,a.transition,a.press,a.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,a.transition,a.press,a.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=i(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,a.transition,a.press,a.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-De8wYkd7.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{Ua as l}from"./index-CMLkr37Y.js";import{n as u}from"./api-B9pZAyMB.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-DfK-Hofd.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{Ya as l}from"./index-B6gWYy08.js";import{n as u}from"./api-Tz57QxiN.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,u as h}from"./popover-select-BzdnTy3h.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./copy-Dv6d4Dvw.js";import{t as v}from"./download-Dk-ZjtO6.js";import{t as y}from"./external-link-DjqjBmc3.js";import{f as b,u as x}from"./markdown-view-D4FPJZ91.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./x-B_N4OPjy.js";import{t as T}from"./cn-JdwAhgNB.js";import{t as E}from"./button-CSEbl4zT.js";import{t as D}from"./copy-to-clipboard-HOJ79TWv.js";import{t as ee}from"./messages-B701TEZ5.js";import{n as O,r as k,s as A}from"./locale-store-DfK-Hofd.js";import{a as j,c as M,i as N,n as P,o as F,r as I,s as L,t as R}from"./dist-BPoKqzeH.js";import{$c as z,$s as B,Aa as te,Ac as V,As as H,Ba as U,Da as ne,Dl as W,Ea as G,El as K,Fa as re,Gc as ie,Gn as ae,Ha as q,Hi as oe,Hs as se,Ia as ce,Jc as le,Ka as ue,Kl as de,L as fe,La as pe,Ls as me,Ma as he,Na as ge,Oa as _e,Ol as ve,Pa as ye,Q as be,R as xe,Ra as Se,Rc as Ce,Rs as we,Ss as Te,Ti as Ee,U as De,Ua as Oe,Un as ke,V as Ae,Va as je,Vs as Me,Xl as Ne,Ya as Pe,Z as Fe,_l as Ie,aa as Le,ca as Re,da as ze,ec as Be,el as Ve,fs as He,gs as Ue,ha as We,ht as Ge,ia as Ke,ic as qe,io as Je,it as Ye,ja as Xe,jl as Ze,ka as Qe,kc as $e,kl as et,la as tt,ll as nt,ls as rt,ma as it,mc as at,or as ot,pa as st,pl as ct,pr as lt,qc as ut,ql as dt,ro as ft,sa as pt,ts as mt,ua as ht,uo as gt,wc as _t,wl as vt,za as yt,zc as bt}from"./index-B6gWYy08.js";import{t as xt}from"./notes-workbench-DFMQYyGJ.js";import{n as St,t as Ct}from"./use-autosave-DRS3RwS9.js";import{t as wt}from"./page-tabs-BaEQMYm_.js";import{t as Tt}from"./directory-picker-path-field-C6dfTCsl.js";import{t as Et}from"./date-picker-B6FSjt4Z.js";import{t as Dt}from"./automations-workspace-CL7ieYIt.js";import{i as Ot,p as kt,s as At}from"./skills-page.utils-Bl5Yv3Cx.js";import{t as jt}from"./dependency-picker-Za18eMp1.js";import{c as Mt,l as Nt,n as Pt,o as Ft,r as It,t as Lt}from"./style-TIDOdKy0.js";var J=e(t(),1),Rt=n();function zt(e){return A(k(`/api/projects/${encodeURIComponent(e)}/skills`))}function Bt(e,t){return A(k(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Vt(e,t){let n=new FormData;return n.set(`file`,t),A(k(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Ht(e,t,n={}){return A(k(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Ut(e,t){return A(k(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Wt(e,t){return A(k(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var Y=r();function Gt({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!0),[c,d]=(0,J.useState)(!1),[f,m]=(0,J.useState)(null),[g,_]=(0,J.useState)(``),[b,x]=(0,J.useState)(null),[D,ee]=(0,J.useState)(null),[O,k]=(0,J.useState)(``),[A,M]=(0,J.useState)(1),[N,z]=(0,J.useState)(null),[B,te]=(0,J.useState)(!1),[V,H]=(0,J.useState)(``),[U,ne]=(0,J.useState)(``),G=(0,J.useRef)(null),K=(0,J.useCallback)(async()=>{s(!0),_(``);try{let t=await zt(e);r(t.items),a(t.skillsRoot)}catch(e){_(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,J.useEffect)(()=>{K()},[K]),(0,J.useEffect)(()=>{if(b!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{te(!0),H(``),kt({q:O,page:A,pageSize:8,sort:`downloads`,signal:e.signal}).then(z).catch(t=>{e.signal.aborted||H(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||te(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[b,A,O]);async function re(e,t){d(!0),m(t??null),_(``);try{await e(),x(null),ne(``),await K()}catch(e){_(e instanceof Error?e.message:String(e))}finally{d(!1),m(null)}}async function ae(t){_(``);try{ee((await Bt(e,t)).skill)}catch(e){_(e instanceof Error?e.message:String(e))}}async function q(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){d(!0);try{await Wt(e,n.id),await K()}catch(e){_(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(E,{type:`button`,children:[(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(et,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(Kt,{icon:Te,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>x(`marketplace`)}),(0,Y.jsx)(Kt,{icon:ie,title:t.source,hint:t.sourceHint,onClick:()=>x(`source`)}),(0,Y.jsx)(Kt,{icon:He,title:t.upload,hint:t.uploadHint,onClick:()=>G.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:G,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&re(()=>Vt(e,n)),t.target.value=``}})]}),i?(0,Y.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),g?(0,Y.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:g}):null,o?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(Pe,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,Y.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Ne,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void ae(e.id),children:[(0,Y.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void q(e),children:[(0,Y.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,Y.jsx)(R,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(I,{className:T(`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-panel shadow-xl`,b===`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,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:b===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(w,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:b===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.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:O,onChange:e=>{k(e.target.value),M(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),V?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:V}):null,B&&!N?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(Pe,{className:`h-32 rounded-lg`},e))}):N?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:N.items.map(r=>{let i=r.providerId??N.provider,a=Ot(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=f===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(At,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(E,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void re(()=>Ht(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):B?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),N&&N.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(N.meta.page)).replace(`{{total}}`,String(N.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:B||A<=1,onClick:()=>M(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(ve,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:B||A>=N.meta.totalPages,onClick:()=>M(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(W,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.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:U,onChange:e=>ne(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(E,{type:`button`,disabled:c||!U.trim(),onClick:()=>void re(()=>Ut(e,U.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(R,{open:!!D,onOpenChange:e=>{e||ee(null)},children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(I,{className:`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-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:D?.name}),(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(w,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:D?.bodyMarkdown})]})]})})]})}function Kt(e){let t=(0,Rt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.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,Y.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,Y.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,Y.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,Y.jsx)(d,{asChild:!0,children:(0,Y.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}var qt=[`backlog`,`ready`,`active`,`review`,`closed`];function Jt(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 Yt(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 Xt(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 Zt(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 Qt(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Zt(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 $t(e,t){let{incoming:n}=Zt(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 en(e,t){let{incoming:n,outgoing:r}=Zt(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 tn={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 nn(e){let t=(0,Rt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=tn[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=T(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(It,{type:`target`,position:Nt.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,Y.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,Y.jsx)(Ce,{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,Y.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,Y.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,Y.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,Y.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,Y.jsx)(It,{type:`source`,position:Nt.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,Y.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 rn={taskNode:nn};function an(e){let t=(0,Rt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(),g=(0,J.useRef)(null),_;t[0]!==r||t[1]!==n?(_=$t(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,b;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(b=u?n.filter(e=>v.has(e.id)):c?n:n.filter(pn),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=b):b=t[7];let x=b,S;t[8]===x?S=t[9]:(S=new Set(x.map(fn)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let D=w,ee;t[15]!==D||t[16]!==x?(ee=Qt(x,D),t[15]=D,t[16]=x,t[17]=ee):ee=t[17];let O=ee,k;t[18]!==f||t[19]!==D?(k=f?en(f,D):void 0,t[18]=f,t[19]=D,t[20]=k):k=t[20];let A=k,j;t[21]===f?j=t[22]:(j=e=>e.id===f,t[21]=f,t[22]=j);let M=x.find(j),N;t[23]===x?N=t[24]:(N=new Map(x.map(dn)),t[23]=x,t[24]=N);let P=N,F;if(t[25]!==a.phases||t[26]!==O||t[27]!==A||t[28]!==x){let e;t[30]!==a.phases||t[31]!==O||t[32]!==A?(e=e=>({id:e.id,type:`taskNode`,position:O.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(A&&!A.has(e.id))}}),t[30]=a.phases,t[31]=O,t[32]=A,t[33]=e):e=t[33],F=x.map(e),t[25]=a.phases,t[26]=O,t[27]=A,t[28]=x,t[29]=F}else F=t[29];let I=F,L;if(t[34]!==A||t[35]!==P||t[36]!==D){let e;t[38]!==A||t[39]!==P?(e=e=>{let t=P.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(A&&(!A.has(e.dependencyTaskId)||!A.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Mt.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=A,t[39]=P,t[40]=e):e=t[40],L=D.map(e),t[34]=A,t[35]=P,t[36]=D,t[37]=L}else L=t[37];let R=L,B,te;t[41]!==f||t[42]!==C?(B=()=>{f&&!C.has(f)&&p(void 0)},te=[f,C],t[41]=f,t[42]=C,t[43]=B,t[44]=te):(B=t[43],te=t[44]),(0,J.useEffect)(B,te);let V,H;t[45]!==R||t[46]!==m?(V=()=>{m&&!R.some(e=>e.id===m)&&h(void 0)},H=[R,m],t[45]=R,t[46]=m,t[47]=V,t[48]=H):(V=t[47],H=t[48]),(0,J.useEffect)(V,H);let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=U):U=t[49];let ne;t[50]!==u||t[51]!==c||t[52]!==x.length?(ne=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=ne):ne=t[53],(0,J.useEffect)(U,ne);let W;t[54]===f?W=t[55]:(W=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=W);let G=W,K;t[56]!==r||t[57]!==o?(K=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(un);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=K):K=t[58];let re=K,ie;t[59]!==r||t[60]!==o||t[61]!==m?(ie=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(ln)))},t[59]=r,t[60]=o,t[61]=m,t[62]=ie):ie=t[62];let ae=ie,q;t[63]===a.connectHint?q=t[64]:(q=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=q);let oe=u?`secondary`:`ghost`,se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>d(cn),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,Y.jsx)(E,{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(sn),t[70]=ue):ue=t[70];let de=c?a.hideCompleted:a.showCompleted,fe;t[71]!==u||t[72]!==c||t[73]!==de?(fe=(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:ue,disabled:u,children:de}),t[71]=u,t[72]=c,t[73]=de,t[74]=fe):fe=t[74];let pe=M?(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:G,children:[(0,Y.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,me;t[75]!==a.removeDependency||t[76]!==ae||t[77]!==m?(me=m?(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ae,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ae,t[77]=m,t[78]=me):me=t[78];let he;t[79]!==le||t[80]!==fe||t[81]!==pe||t[82]!==me?(he=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[le,fe,pe,me]}),t[79]=le,t[80]=fe,t[81]=pe,t[82]=me,t[83]=he):he=t[83];let ge;t[84]!==q||t[85]!==he?(ge=(0,Y.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:[q,he]}),t[84]=q,t[85]=he,t[86]=ge):ge=t[86];let _e=x.length>0?(0,Y.jsxs)(`div`,{className:T(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,M&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Ft,{nodes:I,edges:R,nodeTypes:rn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:re,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Lt,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Pt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),M?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[M.phase]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:M.title}),M.operationalState===`blocked`&&M.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(M.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:M.blockedBy.map(on)})]}):null,(0,Y.jsxs)(s,{to:ke(i,M.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ve;return t[87]!==ge||t[88]!==_e?(ve=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[ge,_e]}),t[87]=ge,t[88]=_e,t[89]=ve):ve=t[89],ve}function on(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function sn(e){return!e}function cn(e){return!e}function ln(e){return e.dependencyTaskId}function un(e){return e.dependencyTaskId}function dn(e){return[e.id,e]}function fn(e){return e.id}function pn(e){return e.phase!==`closed`}function mn({policy:e,copy:t,onSave:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.mode),[s,c]=(0,J.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,J.useState)(!!e.quietHours),[d,p]=(0,J.useState)(e.quietHours?.startHour??22),[h,g]=(0,J.useState)(e.quietHours?.endHour??8),[_,v]=(0,J.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[y,b]=(0,J.useState)(e.allowedActions.includes(`create_project_task`)),[x,S]=(0,J.useState)(!1),[C,T]=(0,J.useState)();(0,J.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),b(e.allowedActions.includes(`create_project_task`))},[e]);let D=async()=>{S(!0),T(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:y?[`create_project_task`]:[]}),i(!1)}catch(e){T(e instanceof Error?e.message:t.saveFailed)}finally{S(!1)}};return(0,Y.jsxs)(R,{open:r,onOpenChange:e=>{x||i(e)},children:[(0,Y.jsx)(M,{asChild:!0,children:(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Y.jsx)(we,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Y.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:x,children:(0,Y.jsx)(w,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Y.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Y.jsx)(m,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Y.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Y.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:y,onChange:e=>b(e.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[C?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:C}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,disabled:x,children:t.cancel})}),(0,Y.jsx)(E,{type:`button`,variant:`primary`,disabled:x||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void D(),children:x?t.saving:t.save})]})]})]})]})]})}var hn={backlog:vt,ready:vt,active:_t,review:rt,closed:g},gn={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 _n(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function vn(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 yn(e){let t=(0,Rt.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,_,v,y,b,x,S,C,w,E,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=Xt(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?g:Ie,v=n.priority!==`normal`,_=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=xn,t[25]!==l||t[26]!==n.id?(E=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=E):E=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=ke(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=T(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=E,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],E=t[18],D=t[19]);let ee=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,O;t[31]===ee?O=t[32]:(O=T(`mt-0.5 size-4 shrink-0`,ee),t[31]=ee,t[32]=O);let k;t[33]!==d||t[34]!==O?(k=(0,Y.jsx)(d,{className:O,"aria-hidden":!0}),t[33]=d,t[34]=O,t[35]=k):k=t[35];let A=f?`text-fg-subtle`:`text-fg`,j;t[36]===A?j=t[37]:(j=T(`min-w-0 break-words text-sm font-semibold leading-5`,A),t[36]=A,t[37]=j);let M;t[38]!==j||t[39]!==n.title?(M=(0,Y.jsx)(`h3`,{className:j,children:n.title}),t[38]=j,t[39]=n.title,t[40]=M):M=t[40];let N;t[41]!==k||t[42]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[k,M]}),t[41]=k,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(P=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Y.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,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(bn).join(`、`)})]}):n.attention[0]?(0,Y.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Y.jsx)(K,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Y.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]=P):P=t[48];let F;t[49]!==i||t[50]!==p||t[51]!==_||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(F=_?(0,Y.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Y.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,Y.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,_n(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Y.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,vn(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Y.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,Y.jsx)(_t,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Y.jsxs)(`span`,{className:T(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`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,Y.jsx)(Ze,{className:`size-3`,"aria-hidden":!0}),Ee(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Y.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,Y.jsx)(Ze,{className:`size-3`,"aria-hidden":!0}),Ee(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=_,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=F):F=t[59];let I;t[60]!==u||t[61]!==y||t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==b?(I=(0,Y.jsxs)(u,{to:y,className:b,children:[N,P,F]}),t[60]=u,t[61]=y,t[62]=N,t[63]=P,t[64]=F,t[65]=b,t[66]=I):I=t[66];let L;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(L=m?(0,Y.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:[h?(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),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[h],title:i.actions[h],children:(0,Y.jsx)(rt,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),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[m],title:i.actions[m],children:(0,Y.jsx)(de,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=L):L=t[73];let R;return t[74]!==I||t[75]!==L||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==E||t[81]!==D?(R=(0,Y.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:E,className:D,children:[I,L]}),t[74]=I,t[75]=L,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=E,t[81]=D,t[82]=R):R=t[82],R}function bn(e){return e.title}function xn(e){e.preventDefault(),e.stopPropagation()}function Sn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(`board`),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(()=>crypto.randomUUID()),[D,k]=(0,J.useState)(``),[A,M]=(0,J.useState)(`normal`),[z,B]=(0,J.useState)(``),[te,V]=(0,J.useState)([]),[H,U]=(0,J.useState)(!1),[ne,W]=(0,J.useState)(null),G=Ye({chat:ee(O(e=>e.language)).chat}),K=Jt(e),re=e.filter(e=>e.phase!==`closed`),ae=(e,t)=>void a(e,t),q=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let i=K[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Yt(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&v({taskId:r.id,phase:r.phase,beforeTaskId:c})},oe=async e=>{e.preventDefault();let t=D.trim();if(!(!t||H)){U(!0),W(null);try{let e=z?new Date(`${z}T23:59:59.999`).getTime():void 0;await u({requestId:C,objective:t,priority:A,dependsOnTaskIds:te,attachments:G.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),k(``),M(`normal`),B(``),V([]),G.clearAttachments(),w(crypto.randomUUID()),S(!1)}catch(e){W(e instanceof Error?e.message:i.createFailed)}finally{U(!1)}}},se=()=>{w(crypto.randomUUID()),k(``),M(`normal`),B(``),V([]),G.clearAttachments(),W(null),S(!0)};return(0,J.useImperativeHandle)(p,()=>({openCreate:se})),(0,J.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>v(null),6e3);return()=>window.clearTimeout(e)},[_]),(0,Y.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,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(mn,{policy:n,copy:i.monitoring,onSave:l}),(0,Y.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":y===`board`,onClick:()=>b(`board`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,y===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)($e,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":y===`graph`,onClick:()=>b(`graph`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,y===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),y===`board`?(0,Y.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:qt.map(t=>{let n=hn[t],a=K[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Yt(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),q(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Y.jsxs)(`div`,{className:T(`flex items-center gap-1.5 rounded-md px-2 py-1`,gn[t]),children:[(0,Y.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Y.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,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Y.jsx)(yn,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ae,onDragStart:g,onDropBefore:e=>void q(t,e)},e.id))})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(an,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,Y.jsx)(R,{open:x,onOpenChange:e=>{H||S(e)},children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`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-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Y.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void oe(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,Y.jsxs)(`div`,{className:T(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,G.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),H||G.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||G.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),G.setIsDragging(!1),H||G.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.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:D,onChange:e=>{k(e.target.value),W(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:H}),(0,Y.jsx)(Ge,{attachments:G.attachments,topPadded:!1,onRemove:e=>{H||G.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:H,onClick:()=>G.fileInputRef.current?.click(),children:[(0,Y.jsx)(qe,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:G.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{G.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,Y.jsx)(f,{value:A,onChange:e=>M(e.target.value),disabled:H,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(Et,{className:`min-h-10 bg-surface-base`,value:z,onChange:B,disabled:H,ariaLabel:i.dueDate})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Y.jsx)(jt,{candidates:re,selectedIds:te,disabled:H,onChange:V,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ne?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ne}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:H,children:i.cancel})}),(0,Y.jsx)(E,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:H||!D.trim(),children:H?i.creating:i.create})]})]})]})]})}),_?(0,Y.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,Y.jsx)(`span`,{children:i.moved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=_;v(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||v(e)})},children:i.undo})]}):null]})}var X=new Set([{id:`overview`,icon:V},{id:`tasks`,icon:nt},{id:`automations`,icon:mt},{id:`files`,icon:ut},{id:`notes`,icon:Ve},{id:`skills`,icon:H},{id:`sessions`,icon:at},{id:`progress`,icon:bt},{id:`settings`,icon:me}].map(e=>e.id)),Cn=`xopc.projectFiles.panelWidthPx`,wn=320,Z=220,Tn=560;function En(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function Dn(e){return Math.min(Tn,Math.max(Z,Math.round(e)))}function On(){try{let e=window.localStorage.getItem(Cn);if(e==null)return wn;let t=Number.parseInt(e,10);return Number.isFinite(t)?Dn(t):wn}catch{return wn}}function kn(e){try{window.localStorage.setItem(Cn,String(Dn(e)))}catch{}}function An(e){return!!(e&&X.has(e))}function jn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Mn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ee(n)}function Nn(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-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Pn(e){let t=(0,Rt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.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,Y.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,Y.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 Fn(e=!1){return T(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function In(e){let t=(0,Rt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=T(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Y.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,Y.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 Ln(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Rn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Q(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function zn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Bn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Vn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Hn(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 Un(e){let t=e.sourceChannel?.trim();if(t)return Wn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return Wn(r||``)}function Wn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Gn(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 Kn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function qn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:qn(e.children,t,n)}:e)}function Jn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,J.useState)(!1),[d,f]=(0,J.useState)([e]),[m,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(null),[x,w]=(0,J.useState)(!1),[D,ee]=(0,J.useState)(`new`),[O,k]=(0,J.useState)(``),[A,M]=(0,J.useState)(``),[z,B]=(0,J.useState)(!1),[te,V]=(0,J.useState)(null),[H,U]=(0,J.useState)(null),W=(0,J.useCallback)(async()=>{v(!0),b(null);try{let t=await ce({limit:100});f(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){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,J.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{o&&W()},[W,o]);let G=(0,J.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Ln(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Rn(t)-Rn(e))},[e.id,d,m]),K=e=>t.statuses[e.status]??e.status,re=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ie=e=>{ee(e),k(``),M(``),V(null),w(!0),s(!1)},ae=(0,J.useCallback)(async(e={})=>{let t=A.trim(),n=O.trim()||(D===`directory`?Q(t):``);if(n){B(!0),V(null),U(null);try{let r=await ne({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});w(!1),k(``),M(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=zn(e);t?(U(t),w(!1)):V(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[D,O,i,A]),q=(0,J.useCallback)(e=>{e.preventDefault(),ae()},[ae]),oe=(0,J.useCallback)(()=>{ae({createWorkspaceRoot:!0})},[ae]),se=(0,J.useCallback)(()=>{U(null),w(!0)},[]),ue=e=>{M(e),D===`directory`&&!O.trim()&&k(Q(e))},de=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:T(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(c,{className:T(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:re(e)})]}),(0,Y.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Nn(e.status)),children:K(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(u,{open:o,onOpenChange:s,children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.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,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Nn(e.status)),children:K(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:re(e)})]}),(0,Y.jsx)(et,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{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,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.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:m,onChange:e=>g(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),de(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),y?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&G.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&G.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,G.map(e=>de(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ie(`new`),children:[(0,Y.jsx)(S,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ie(`directory`),children:[(0,Y.jsx)(ut,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.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),i(`/projects`)},children:[(0,Y.jsx)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(R,{open:x,onOpenChange:e=>!z&&w(e),children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`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-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:D===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(N,{className:`mt-1 text-sm text-fg-muted`,children:D===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:q,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[te?(0,Y.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:te}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.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:O,onChange:e=>k(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(Tt,{value:A,onChange:ue,disabled:z,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,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:z,children:n.cancel})}),(0,Y.jsxs)(E,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:z||!(O.trim()||D===`directory`&&Q(A)),children:[(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(R,{open:!!H,onOpenChange:e=>{e||U(null)},children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`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-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:H?jn(n.workspaceMissingDescription,{workspace:H}):null})]}),H?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(ut,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:H})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:se,disabled:z,children:n.workspaceMissingBack}),(0,Y.jsxs)(E,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:oe,disabled:z,children:[(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Yn(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[c]=o(),l=O(e=>e.language),u=ee(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=gt(e=>e.setPageHeader),v=gt(e=>e.clearPageHeader),[y,k]=(0,J.useState)(null),[A,M]=(0,J.useState)(null),[z,ne]=(0,J.useState)([]),[W,ce]=(0,J.useState)(``),[de,ve]=(0,J.useState)([]),[Ce,we]=(0,J.useState)(0),[Te,Ee]=(0,J.useState)(!1),[Ie,He]=(0,J.useState)(!1),[Ge,qe]=(0,J.useState)(!1),[Ye,Ze]=(0,J.useState)([]),$e=(0,J.useRef)(new Set),[et,rt]=(0,J.useState)(null),[_t,vt]=(0,J.useState)(On),[Et,Ot]=(0,J.useState)(!1),[kt,At]=(0,J.useState)(!1),[jt,Mt]=(0,J.useState)(``),[Nt,Pt]=(0,J.useState)([]),[Ft,It]=(0,J.useState)(!1),[Lt,Rt]=(0,J.useState)(null),[zt,Bt]=(0,J.useState)(!1),[Vt,Ht]=(0,J.useState)(null),[Ut,Wt]=(0,J.useState)([]),[Kt,qt]=(0,J.useState)(``),[Jt,Yt]=(0,J.useState)(!0),[Xt,Zt]=(0,J.useState)(!1),[Qt,$t]=(0,J.useState)(!1),[en,tn]=(0,J.useState)(null),[nn,rn]=(0,J.useState)(!1),[an,on]=(0,J.useState)(`fixed`),[sn,cn]=(0,J.useState)(``),[ln,un]=(0,J.useState)(null),[dn,fn]=(0,J.useState)(!1),[pn,mn]=(0,J.useState)(!1),[hn,gn]=(0,J.useState)(!1),[_n,vn]=(0,J.useState)(null),yn=(0,J.useRef)(null),bn=(0,J.useRef)(!1),[xn,X]=(0,J.useState)(null),[Cn,wn]=(0,J.useState)({title:``,reason:``}),[Z,Tn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Ln=(0,J.useRef)(Z),Rn=`overview`,Q=n?`notes`:An(t)?t:Rn,Wn=(0,J.useMemo)(()=>x(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Yn=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Wn===`/projects`?n:b(n,Wn)},[Wn,e]),Xn=(0,J.useCallback)(t=>{e&&r(Yn(t))},[r,e,Yn]),Zn=(0,J.useCallback)(()=>{if(Q===`tasks`&&yn.current){yn.current.openCreate();return}bn.current=!0,Xn(`tasks`)},[Xn,Q]);(0,J.useEffect)(()=>{Q!==`tasks`||!bn.current||(bn.current=!1,yn.current?.openCreate())},[Q]);let Qn=(0,J.useCallback)(t=>{e&&r(Yn(t),{replace:!0})},[r,e,Yn]),$n=(0,J.useCallback)((e,t)=>{Qn(e),r(t)},[r,Qn]),er=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Qn(e)},[Qn]),tr=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,J.useEffect)(()=>{!e||!t||An(t)||r(Yn(Rn),{replace:!0})},[Rn,r,e,Yn,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return Yt(!0),X(null),Promise.all([Xe(e),ye(e),re(e),lt().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;k(e),M(n),ne(r),Wt(i?.agents??[]),qt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Ln.current=a,Tn(a)}).catch(e=>{t||X(e instanceof Error?e.message:String(e))}).finally(()=>{t||Yt(!1)}),()=>{t=!0}},[e]);let $=(0,J.useCallback)(async()=>{e&&M(await ye(e))},[e]);(0,J.useEffect)(()=>{let t,n=n=>{let r=ft.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Je.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),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,$]);let nr=(0,J.useCallback)(async(e,t)=>{vn(e.id),X(null);try{let n=await De(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 Ae(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 fe(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{vn(null)}},[A,p.board.actionFailed,$]),rr=(0,J.useCallback)(async t=>{e&&(X(null),await xe({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await $())},[l,e,$]),ir=(0,J.useCallback)(async(e,t)=>{vn(e),X(null);try{return await Fe(e,t,(await De(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{vn(null)}},[p.board.actionFailed,$]),ar=(0,J.useCallback)(async(e,t,n)=>{vn(e),X(null);try{let r=await De(e);return r.task.phase!==t&&(r=await fe(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 Fe(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{vn(null)}},[p.board.actionFailed,$]),or=(0,J.useCallback)(async(e,t)=>{vn(e),X(null);try{await be(e,t,(await De(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed)}finally{vn(null)}},[p.board.actionFailed,$]),sr=(0,J.useCallback)(async t=>{if(e){X(null);try{await Oe(e,t),await $()}catch(e){throw X(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),cr=(0,J.useCallback)(async()=>{if(y){Ee(!0),X(null);try{let e=await he(y.id,{includeRelated:Ie,limit:100});ve(e.items),we(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ee(!1)}}},[y,Ie]);(0,J.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let lr=(0,J.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){Ze([]),$e.current.clear(),Ht(null);return}Bt(!0),Ht(null),$e.current.clear();try{Ze(Kn((await ge(y.id,``)).entries)),$e.current.add(``)}catch(e){Ze([]),$e.current.clear(),Ht(e instanceof Error?e.message:String(e))}finally{Bt(!1)}},[y]),ur=(0,J.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||$e.current.has(e))){$e.current.add(e),Ht(null);try{let t=await ge(y.id,e);Ze(n=>qn(n,e,Kn(t.entries)))}catch(t){$e.current.delete(e),Ht(t instanceof Error?t.message:String(t))}}},[y]);(0,J.useEffect)(()=>{Q===`files`&&lr()},[lr,Q]);let dr=jt.trim();(0,J.useEffect)(()=>{if(Q!==`files`||!y||!kt||!dr){Pt([]),It(!1),Rt(null);return}let e=!1;It(!0),Rt(null),Pt([]);let t=window.setTimeout(()=>{U(y.id,dr,50).then(t=>{e||Pt(t)}).catch(t=>{e||Rt(t instanceof Error?t.message:String(t))}).finally(()=>{e||It(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[dr,y,kt,Q]);let fr=(0,J.useCallback)(async()=>{if(y){mn(!0),X(null);try{let e=await Qe(y.id);$n(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{mn(!1)}}},[$n,y]),pr=(0,J.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([Xe(y.id),ye(y.id)]);M(t),k(e)},[y]),mr=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!y||!Cn.title.trim())){gn(!0),X(null);try{await _e(y.id,{title:Cn.title.trim(),reason:Cn.reason.trim()||void 0}),wn({title:``,reason:``}),await pr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(!1)}}},[Cn.reason,Cn.title,y,pr]),hr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:Wn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Wn===`/projects`?p.backToProjects:u.sidebar.back,children:(0,Y.jsx)(dt,{className:`size-4`,"aria-hidden":!0})}),[Wn,u.sidebar.back,p.backToProjects]),gr=(0,J.useMemo)(()=>y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(E,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Y.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,Y.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,Y.jsxs)(E,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Zn,children:[(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,Y.jsxs)(E,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void fr(),disabled:pn,children:[(0,Y.jsx)(at,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[Zn,p.board.create,p.common.newChat,p.common.runWorkflow,y,fr,pn]);(0,J.useLayoutEffect)(()=>(g({startExtra:hr,main:y?(0,Y.jsx)(Jn,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:gr}),()=>v()),[v,gr,hr,p,y,h,g,d]);function _r(e){k(t=>t?{...t,...e}:null),qt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function vr(e=Ln.current){if(!(!y||!En(e,y))){X(null),tn(null);try{let t=await q(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});_r(t);let n=Ln.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,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Ln.current=r,Tn(r)}catch(e){let t=zn(e);throw t?tn(t):X(e instanceof Error?e.message:String(e)),e}}}function yr(e){e.preventDefault(),Mr.flush()}function br(e,t=!1){let n={...Ln.current,...e};Ln.current=n,Tn(n),t&&Mr.saveNow(n)}let xr=(0,J.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;on(e?`fixed`:`follow`),cn(e||y.effectiveWorkspaceRoot||``),rn(!0)},[y]);async function Sr(e={}){if(!y)return;let t=an===`fixed`?sn.trim():``;if(!(an===`fixed`&&!t)){Zt(!0),X(null),tn(null);try{let n=await q(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});_r(n),br({workspaceRoot:n.workspaceRoot??``}),rn(!1),tn(null)}catch(e){let t=zn(e);t?(tn(t),rn(!1)):X(e instanceof Error?e.message:String(e))}finally{Zt(!1)}}}async function Cr(){if(!(!y||ln)){un(`pin`),X(null);try{_r(y.pinnedAt?await je(y.id):await pe(y.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{un(null)}}}async function wr(){if(!(!y||ln)){un(`archive`),X(null);try{let e=y.status===`archived`?await Se(y.id):await G(y.id);_r(e),br({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{un(null)}}}async function Tr(){if(y){fn(!0),X(null);try{await te(y.id),$t(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{fn(!1)}}}async function Er(){if(!(!y||Ge)){qe(!0),X(null);try{await yt(y.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{qe(!1)}}}let Dr=(0,J.useCallback)(e=>{rt(e)},[]),Or=(0,J.useCallback)((e,t)=>{t||rt(e)},[]),kr=(0,J.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||rt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Le(t.path);if(pt(Ke(e))!==`text`){let n=await ht(t.path,{projectId:r}),i=ue(e)??`application/octet-stream`;Re(e,await n.arrayBuffer(),i)}else{let{content:n}=await ze(t.path,{projectId:r});tt(e,n)}}catch(e){We(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await D(t.absolutePath??t.path)&&We(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{We(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[u.clipboard.copyFailed,u.workspace.pathCopied,y?.id]),Ar=(0,J.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),Ot(!0);let r=e.clientX,i=_t,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=Dn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ot(!1),vt(c),kn(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)},[_t]);(0,J.useEffect)(()=>{Q!==`files`&&rt(null)},[e,Q]);let jr=!!(y&&En(Z,y)),Mr=Ct({value:y?Z:null,dirty:jr,onSave:vr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Jt)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!y)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:Wn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(dt,{className:`size-4`,"aria-hidden":!0}),Wn===`/projects`?p.backToProjects:u.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:xn||p.notFound})]});let Nr=z.slice(0,6),Pr=A?.blockers??[],Fr=A?.tasks.filter(e=>e.phase!==`closed`)??[],Ir=e=>p.statuses[e]??e,Lr=e=>jn(p.common.messages,{count:e}),Rr=W.trim().toLowerCase(),zr=Rr?z.filter(e=>{let t=Mn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Lr(e.messageCount??0),a=Un(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Rr)}):z,Br=z.length>0&&zr.length===0,Vr=Ut.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Hr=Ut.find(e=>e.id===Z.defaultAgentId),Ur=y.workspaceRoot?.trim()||``,Wr=y.status===`archived`,Gr=!!y.pinnedAt,Kr=!Ur,qr=Ur||Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Jr=an===`fixed`?sn.trim()||p.settings.workspacePlaceholder:Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Yr=(an===`fixed`?sn.trim():``)!==Ur&&(an===`follow`||!!sn.trim()),Xr=[{id:`overview`,icon:V,label:p.tabs.overview},{id:`tasks`,icon:nt,label:p.tabs.tasks},{id:`automations`,icon:mt,label:p.tabs.automations},{id:`files`,icon:ut,label:p.tabs.files},{id:`notes`,icon:Ve,label:p.tabs.notes},{id:`skills`,icon:H,label:p.tabs.skills},{id:`sessions`,icon:at,label:p.tabs.sessions},{id:`progress`,icon:bt,label:p.tabs.progress}];async function Zr(){if(!qr)return;let e=await D(qr);We(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Qr(){tn(null),rn(!0)}return(0,Y.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,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(wt,{items:Xr,activeTab:Q,onChange:Xn,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(E,{id:`project-primary-tab-settings`,type:`button`,variant:Q===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Q===`settings`?`page`:void 0,onClick:()=>Xn(`settings`),children:[(0,Y.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,jr?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),xn?(0,Y.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:xn}):null,(0,Y.jsxs)(`div`,{className:T(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,Y.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,Y.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,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.outcome||A?.digest.summary||y.description||y.brief||p.overview.directionFallback}),A?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:jn(p.overview.recommendedNext,{action:A.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(E,{type:`button`,variant:`secondary`,onClick:()=>void Er(),disabled:Ge,children:[(0,Y.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),Ge?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Fr.length?Fr.map(e=>(0,Y.jsxs)(s,{to:ke(Yn(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),A?.recentResults.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:A.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Y.jsxs)(s,{to:ke(Yn(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:y.milestones.length?y.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:y.recentUpdates.length?y.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Pr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Pr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(K,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Ir(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:er(tr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:mr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.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:Cn.title,onChange:e=>wn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,Y.jsx)(E,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:hn||!Cn.title.trim(),"aria-label":hn?p.overview.addingBlocker:p.overview.addBlocker,title:hn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(ct,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Xn(`sessions`),children:p.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Nr.length?Nr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:Mn(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,Y.jsx)(Sn,{ref:yn,tasks:A?.tasks??[],dependencyEdges:A?.dependencyEdges??[],monitoring:A?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:Yn(`tasks`),copy:p.board,onAction:nr,onReorder:ir,onUndoMove:ar,onDependenciesChange:or,onMonitoringChange:sr,onCreate:rr,actionBusyId:_n}):null,Q===`automations`?(0,Y.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,Y.jsx)(Dt,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,Q===`notes`?(0,Y.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,Y.jsx)(xt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,Q===`skills`?(0,Y.jsx)(Gt,{projectId:y.id,copy:p.skills}):null,Q===`files`?(0,Y.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,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:y.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:T(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Et&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${_t}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,Y.jsx)(oe,{workspacePath:qr}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:T(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,kt&&`bg-surface-hover text-fg`),onClick:()=>At(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":kt,children:(0,Y.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(it,{className:`size-7 shrink-0 rounded-md p-0`,loading:zt,label:u.cron.refresh,onClick:()=>void lr()})]})]}),kt?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(C,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:jt,onChange:e=>Mt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.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":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{Mt(``),At(!1)},children:(0,Y.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Vt?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Vt}):null,dr?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Ft?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(Pe,{className:`h-11 w-full`}),(0,Y.jsx)(Pe,{className:`h-11 w-full`}),(0,Y.jsx)(Pe,{className:`h-11 w-full`})]}):Lt?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,Lt]}):Nt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Nt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:T(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,et===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>rt(e.path),title:e.path,children:[(0,Y.jsx)(Ve,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):zt&&Ye.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,Y.jsx)(st,{tree:Ye,selectedPath:et,onSelectFile:Dr,onSelectEntry:Or,onExpandDir:e=>void ur(e),onAction:kr,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,recommendedApps:u.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:T(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Et&&`bg-surface-hover`),onPointerDown:Ar,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:et?(0,Y.jsx)(ae,{filePath:et,projectId:y.id,agentId:y.defaultAgentId||Kt||void 0,onClose:()=>rt(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(ut,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:p.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(E,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Xn(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[z.length?(0,Y.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,Y.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:W,onChange:e=>ce(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.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`}),W?(0,Y.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":p.sessions.clearSearch,onClick:()=>ce(``),children:(0,Y.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,zr.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:zr.map(e=>{let t=Mn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Un(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Lr(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`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,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.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,Y.jsx)(at,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.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,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Br?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:jn(p.progress.count,{count:Ce})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.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,Y.jsx)(`input`,{type:`checkbox`,checked:Ie,onChange:e=>He(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,Y.jsxs)(E,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:Te,children:[(0,Y.jsx)(se,{className:T(`size-4`,Te&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Te&&de.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):de.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:de.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Gn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Vn(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Mn(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Bn(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Hn(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:yr,onBlurCapture:Mr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-xs font-medium`,Nn(Z.status)),children:p.settings.statuses[Z.status]}),(0,Y.jsx)(St,{status:Mr.status,error:Mr.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(Pn,{label:p.settings.name,children:(0,Y.jsx)(`input`,{className:Fn(),value:Z.name,onChange:e=>br({name:e.target.value})})}),(0,Y.jsx)(Pn,{label:p.settings.defaultAgent,children:(0,Y.jsxs)(f,{className:Fn(),value:Z.defaultAgentId,onChange:e=>br({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Ut.map(e=>(0,Y.jsx)(m,{value:e.id,children:ot(e,u.agentsSettings)},e.id))]})}),(0,Y.jsx)(Pn,{label:p.settings.status,children:Wr?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,Y.jsxs)(f,{className:Fn(),value:Z.status===`archived`?`active`:Z.status,onChange:e=>br({status:e.target.value},!0),children:[(0,Y.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,Y.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,Y.jsx)(Pn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:Fn(!0),value:Z.description,onChange:e=>br({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,Y.jsx)(Pn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:Fn(!0),value:Z.brief,onChange:e=>br({brief:e.target.value})})}),(0,Y.jsx)(Pn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:Fn(!0),value:Z.instructions,onChange:e=>br({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Kr?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:qr,children:qr}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Zr(),children:[(0,Y.jsx)(_,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,Y.jsx)(oe,{workspacePath:qr}),(0,Y.jsxs)(E,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:xr,children:[(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(In,{label:p.settings.defaultAgent,value:Vr}),(0,Y.jsx)(In,{label:p.settings.pinState,value:Gr?p.settings.pinned:p.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)(In,{label:p.settings.createdAt,value:Mn(y.createdAt)||p.common.never}),(0,Y.jsx)(In,{label:p.settings.updatedAt,value:Mn(y.updatedAt)||p.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Gr?p.settings.pinnedTitle:p.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,Y.jsxs)(E,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:ln===`pin`,onClick:()=>void Cr(),children:[Gr?(0,Y.jsx)(B,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),Gr?p.settings.unpinProject:p.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Wr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,Y.jsxs)(E,{type:`button`,variant:Wr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:ln===`archive`,onClick:()=>void wr(),children:[Wr?(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(Ne,{className:`size-4`,"aria-hidden":!0}),Wr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,Y.jsxs)(E,{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:()=>$t(!0),children:[(0,Y.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(R,{open:Qt,onOpenChange:e=>{dn||$t(e)},children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`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-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.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,Y.jsx)(K,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,Y.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?jn(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:dn,children:p.common.cancel})}),(0,Y.jsxs)(E,{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:dn||!y,onClick:()=>void Tr(),children:[(0,Y.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(R,{open:nn,onOpenChange:e=>{Xt||rn(e)},children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`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-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,Y.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,an===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:an===`fixed`,onChange:()=>on(`fixed`),disabled:Xt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,an===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:an===`follow`,onChange:()=>on(`follow`),disabled:Xt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),an===`fixed`?(0,Y.jsx)(Tt,{value:sn,onChange:cn,disabled:Xt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Fn(),autoFocus:!0}):null,(0,Y.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:p.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:jn(p.settings.workspaceCurrent,{workspace:Jr})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Xt,children:p.common.cancel})}),(0,Y.jsxs)(E,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Xt||!Yr,onClick:()=>void Sr(),children:[(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(R,{open:!!en,onOpenChange:e=>{e||tn(null)},children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(j,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`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-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,Y.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:en?jn(p.settings.workspaceMissingDescription,{workspace:en}):null})]}),en?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(ut,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:en})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(E,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Qr,disabled:Xt,children:p.settings.workspaceMissingBack}),(0,Y.jsxs)(E,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Sr({createWorkspaceRoot:!0}),disabled:Xt,children:[(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{Yn as ProjectDetailPage};