@xopcai/xopc 0.0.410 → 0.0.412

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 (688) hide show
  1. package/README.md +12 -6
  2. package/README.zh-CN.md +12 -6
  3. package/dist/browser-ext/dist/assets/{page-context-A5RCibM_.js → page-context-MuzjMBlJ.js} +1 -1
  4. package/dist/browser-ext/dist/background.js +1 -1
  5. package/dist/browser-ext/dist/sidepanel.html +1 -1
  6. package/dist/browser-ext/dist/sidepanel.js +1 -1
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/feishu/src/adapters/gateway-setup.js +9 -3
  9. package/dist/extensions/feishu/src/plugin.d.ts +0 -3
  10. package/dist/extensions/feishu/src/plugin.js +1 -11
  11. package/dist/extensions/feishu/src/schema/config-schema.d.ts +0 -2
  12. package/dist/extensions/feishu/src/schema/config-schema.js +9 -21
  13. package/dist/extensions/feishu/src/state/accounts.js +3 -7
  14. package/dist/extensions/telegram/src/plugin.d.ts +0 -3
  15. package/dist/extensions/telegram/src/plugin.js +0 -9
  16. package/dist/extensions/telegram/xopc.extension.json +1 -1
  17. package/dist/extensions/weixin/src/plugin.d.ts +0 -3
  18. package/dist/extensions/weixin/src/plugin.js +1 -12
  19. package/dist/gateway/static/root/assets/agent-avatar-dicebear-BrGZdh5N.js +1 -0
  20. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BjZpom5V.js +1 -0
  21. package/dist/gateway/static/root/assets/{agents-admin-api-D0UyB0Y_.js → agents-admin-api-uGDeJR1f.js} +1 -1
  22. package/dist/gateway/static/root/assets/agents-s3ws5Qi-.js +77 -0
  23. package/dist/gateway/static/root/assets/app-management-settings-panel-C6DHuX0L.js +1 -0
  24. package/dist/gateway/static/root/assets/{appearance-settings-byEnJz9H.js → appearance-settings-DYGY92Yr.js} +1 -1
  25. package/dist/gateway/static/root/assets/apps-page-PpT_YMmD.js +1 -0
  26. package/dist/gateway/static/root/assets/{archive-plugin-BXssEuq3.js → archive-plugin-DAmsio91.js} +1 -1
  27. package/dist/gateway/static/root/assets/{automation-display-DCkjVzA0.js → automation-display-BFN7zWBg.js} +1 -1
  28. package/dist/gateway/static/root/assets/{automations-page-C-puATkS.js → automations-page-BVutrwON.js} +1 -1
  29. package/dist/gateway/static/root/assets/automations-workspace-G6-9IYbR.js +8 -0
  30. package/dist/gateway/static/root/assets/{binary-plugins-DBz_2AhG.js → binary-plugins-41QCRAxz.js} +1 -1
  31. package/dist/gateway/static/root/assets/{block-editor-BOO5kjIl.js → block-editor-BQ8AA-Ot.js} +40 -40
  32. package/dist/gateway/static/root/assets/{browser-automation-inputs-D8bZ9iz2.js → browser-automation-inputs-D4-vQc4g.js} +1 -1
  33. package/dist/gateway/static/root/assets/browser-automations-page-o3jNFlCb.js +3 -0
  34. package/dist/gateway/static/root/assets/browser-settings-page-G0dVwiX4.js +3 -0
  35. package/dist/gateway/static/root/assets/capabilities-B9b5KCBb.js +1 -0
  36. package/dist/gateway/static/root/assets/capabilities-page-BZQanmZY.js +2 -0
  37. package/dist/gateway/static/root/assets/capabilities-settings-panel-D-YadSx_.js +8 -0
  38. package/dist/gateway/static/root/assets/{capability-header-actions-yfPUz5Wt.js → capability-header-actions-CDgI-YZF.js} +1 -1
  39. package/dist/gateway/static/root/assets/channels-3WX3f0bR.js +1 -0
  40. package/dist/gateway/static/root/assets/{chat-terminal-dock-Dlzn80cK.js → chat-terminal-dock-CUkCx_9x.js} +2 -2
  41. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-B2HK1psj.js → chunk-KS7C4IRE-BvcCCgTW.js} +2 -2
  42. package/dist/gateway/static/root/assets/computer-settings-page-CuZrL9gL.js +1 -0
  43. package/dist/gateway/static/root/assets/connector-service-page-49mgdRET.js +1 -0
  44. package/dist/gateway/static/root/assets/connectors-page-Bjj2wAeG.js +1 -0
  45. package/dist/gateway/static/root/assets/date-formatters-DukWSVwc.js +1 -0
  46. package/dist/gateway/static/root/assets/{date-picker-DGjpqOKx.js → date-picker-BpBjADAk.js} +1 -1
  47. package/dist/gateway/static/root/assets/dependency-picker-R8kdHLr3.js +1 -0
  48. package/dist/gateway/static/root/assets/desktop-pet-BpiosRqb.js +1 -0
  49. package/dist/gateway/static/root/assets/desktop-pet-settings-9h6evrKB.js +1 -0
  50. package/dist/gateway/static/root/assets/device-pairing-wizard-CZ5lwiLE.js +1 -0
  51. package/dist/gateway/static/root/assets/{directory-picker-path-field-CwT1LcLR.js → directory-picker-path-field-DwXqp_iu.js} +1 -1
  52. package/dist/gateway/static/root/assets/electron-env-Dit0bHgy.js +1 -0
  53. package/dist/gateway/static/root/assets/{extension-debug-page-DX-hX_d0.js → extension-debug-page-Bj93A2Gn.js} +1 -1
  54. package/dist/gateway/static/root/assets/{extension-page-Cji87mN9.js → extension-page-Bri62YsN.js} +1 -1
  55. package/dist/gateway/static/root/assets/{extension-settings-page-BulzpwBD.js → extension-settings-page-BSo6vRhS.js} +1 -1
  56. package/dist/gateway/static/root/assets/files-Bw4SBGdM.js +1 -0
  57. package/dist/gateway/static/root/assets/{gateway-config-swr-CTXr917C.js → gateway-config-swr-BVqYVaGy.js} +1 -1
  58. package/dist/gateway/static/root/assets/gateway-realtime-CY1LBGBS.js +1 -0
  59. package/dist/gateway/static/root/assets/gateway-realtime-store-Dafw95ol.js +1 -0
  60. package/dist/gateway/static/root/assets/gateway-settings-DgEwWJwz.js +1 -0
  61. package/dist/gateway/static/root/assets/{gateway-startup-retry-DD2fsxdd.js → gateway-startup-retry-CPKGkr6D.js} +1 -1
  62. package/dist/gateway/static/root/assets/highlight-code-CSFBakwF.js +1 -0
  63. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BgTqMa_d.js → highlighted-body-KQOG7T2V-Ci1QpkBn.js} +1 -1
  64. package/dist/gateway/static/root/assets/home-page-BKj-aPsL.js +2 -0
  65. package/dist/gateway/static/root/assets/image-generation-api-N5MYXlxr.js +1 -0
  66. package/dist/gateway/static/root/assets/imports-page-YfaRnpk1.js +1 -0
  67. package/dist/gateway/static/root/assets/index-CiDVRMmX.js +710 -0
  68. package/dist/gateway/static/root/assets/index-caRW34rg.css +1 -0
  69. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BTQcPOix.js +1 -0
  70. package/dist/gateway/static/root/assets/languages-byq_L2Ae.js +2 -0
  71. package/dist/gateway/static/root/assets/local-app-workbench-page-kCZ_fbSZ.js +1 -0
  72. package/dist/gateway/static/root/assets/local-apps-page-BjzaB1ls.js +1 -0
  73. package/dist/gateway/static/root/assets/{local-session-drafts-TqLFKwYo.js → local-session-drafts-BCaC-1rH.js} +1 -1
  74. package/dist/gateway/static/root/assets/locale-store-DAgpZxAS.js +1 -0
  75. package/dist/gateway/static/root/assets/logs-page-5Jt3uqYt.js +2 -0
  76. package/dist/gateway/static/root/assets/management-settings-DOQMLPrI.js +1 -0
  77. package/dist/gateway/static/root/assets/markdown-editor-phTQ0mox.js +1 -0
  78. package/dist/gateway/static/root/assets/{media-plugins-DQJXvbr_.js → media-plugins-8mlDAjD6.js} +1 -1
  79. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B4nztFE4.js +1 -0
  80. package/dist/gateway/static/root/assets/messages-DMXSIJUO.js +3 -0
  81. package/dist/gateway/static/root/assets/note-detail-panel-1wsKlkk3.js +5 -0
  82. package/dist/gateway/static/root/assets/note-image-lightbox-B82cToeV.js +1 -0
  83. package/dist/gateway/static/root/assets/notes-page-DKREWOku.js +8 -0
  84. package/dist/gateway/static/root/assets/page-context-capture-button-oSJIFF3E.js +1 -0
  85. package/dist/gateway/static/root/assets/personal-page-CoqQTkkS.js +1 -0
  86. package/dist/gateway/static/root/assets/personal-settings-panel-BgcJLmZN.js +1 -0
  87. package/dist/gateway/static/root/assets/plugin-details-dialog-CdOJ3Tir.js +1 -0
  88. package/dist/gateway/static/root/assets/preview-open-alternatives-n6Shdp3u.js +1 -0
  89. package/dist/gateway/static/root/assets/product-delivery-BqNm-8S5.js +1 -0
  90. package/dist/gateway/static/root/assets/{product-open-page-Bfqez8Je.js → product-open-page-BPF5rRTI.js} +1 -1
  91. package/dist/gateway/static/root/assets/product-preview-content-BOsGPNbw.js +1 -0
  92. package/dist/gateway/static/root/assets/project-detail-page-ZADyvA7-.js +7 -0
  93. package/dist/gateway/static/root/assets/projects-page-BkRe6Z8S.js +1 -0
  94. package/dist/gateway/static/root/assets/{registry-api-4NZOh0iz.js → registry-api-B6kqbuw8.js} +1 -1
  95. package/dist/gateway/static/root/assets/remote-access-hub-CCGf5kF4.js +1 -0
  96. package/dist/gateway/static/root/assets/runtime-tools-api-CY3R7unQ.js +5 -0
  97. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DSsANtha.js → runtime-tools-settings-panel-BxaxVlwM.js} +1 -1
  98. package/dist/gateway/static/root/assets/{schema-form-vbhv4JE6.js → schema-form-cXD1BC02.js} +1 -1
  99. package/dist/gateway/static/root/assets/session-api-D6-Vz8xK.js +1 -0
  100. package/dist/gateway/static/root/assets/{session-manager-D2sLfkw-.js → session-manager-DWbcMHcj.js} +3 -3
  101. package/dist/gateway/static/root/assets/sessions-page-B81rRu2-.js +1 -0
  102. package/dist/gateway/static/root/assets/settings-advanced-gate-DLHGV-I-.js +1 -0
  103. package/dist/gateway/static/root/assets/{settings-form-section-4nn0sb6v.js → settings-form-section-BXeszXR7.js} +1 -1
  104. package/dist/gateway/static/root/assets/{settings-page-_HB9FC08.js → settings-page-CNmh4YmR.js} +1 -1
  105. package/dist/gateway/static/root/assets/setup-status-panel-gEqkJWyw.js +1 -0
  106. package/dist/gateway/static/root/assets/share-preview-page-CS9cOCgX.js +2 -0
  107. package/dist/gateway/static/root/assets/shares-settings-D9Ul96XW.js +1 -0
  108. package/dist/gateway/static/root/assets/{skill-api-CyO89DKl.js → skill-api-B5lDCuOH.js} +1 -1
  109. package/dist/gateway/static/root/assets/skill-reload-api-NLAaNaDn.js +1 -0
  110. package/dist/gateway/static/root/assets/skills-page-dWeFt-6J.js +2 -0
  111. package/dist/gateway/static/root/assets/source-workspace-editor-BIvi89Zx.js +1 -0
  112. package/dist/gateway/static/root/assets/system-settings-panel-DdDsFdCh.js +1 -0
  113. package/dist/gateway/static/root/assets/task-detail-page-DO3FM--W.js +2 -0
  114. package/dist/gateway/static/root/assets/task-result-evidence-HJO1BlJm.js +1 -0
  115. package/dist/gateway/static/root/assets/tasks-TVRjEggr.js +1 -0
  116. package/dist/gateway/static/root/assets/tracing-settings-page-Dm3yToJ1.js +1 -0
  117. package/dist/gateway/static/root/assets/{tunnel-api-DOUyF9Ew.js → tunnel-api-DXU94F2Y.js} +1 -1
  118. package/dist/gateway/static/root/assets/{usage-page-Bv3fdfw1.js → usage-page-DJJhACRJ.js} +1 -1
  119. package/dist/gateway/static/root/assets/{use-autosave-D0MhLMD2.js → use-autosave-B1z_TIBu.js} +1 -1
  120. package/dist/gateway/static/root/assets/user-model-page-DnZ4qFaO.js +2 -0
  121. package/dist/gateway/static/root/assets/{vendor-codemirror-DFxP3B9T.js → vendor-codemirror-Qdcjid65.js} +16 -16
  122. package/dist/gateway/static/root/assets/{voice-api-key-field-Ds_ADBQH.js → voice-api-key-field-HOLjEhh3.js} +1 -1
  123. package/dist/gateway/static/root/assets/{voice-config-api-4yGMrp7J.js → voice-config-api-CPKzUb4R.js} +1 -1
  124. package/dist/gateway/static/root/assets/work-discovery-overlay-C9RklDaR.js +1 -0
  125. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Di-oEpCt.js → xopc-cloud-account-card-CWwGTBib.js} +1 -1
  126. package/dist/gateway/static/root/index.html +27 -35
  127. package/dist/package.js +1 -1
  128. package/dist/packages/endpoint-tools-protocol/src/index.js +1 -1
  129. package/dist/packages/gateway-contract/src/automations.js +0 -12
  130. package/dist/packages/gateway-contract/src/home.js +3 -3
  131. package/dist/packages/gateway-contract/src/product-delivery.js +0 -4
  132. package/dist/packages/gateway-contract/src/project-operating.js +0 -6
  133. package/dist/packages/gateway-contract/src/session-identity.js +0 -1
  134. package/dist/packages/gateway-contract/src/task-runs.js +0 -1
  135. package/dist/packages/gateway-contract/src/tasks.js +0 -6
  136. package/dist/src/activity/types.d.ts +4 -4
  137. package/dist/src/agent/agent-manager.d.ts +0 -3
  138. package/dist/src/agent/agent-manager.js +0 -43
  139. package/dist/src/agent/background-review/run-background-review.js +2 -2
  140. package/dist/src/agent/capabilities/definitions.d.ts +2 -18
  141. package/dist/src/agent/capabilities/definitions.js +0 -17
  142. package/dist/src/agent/child-agent-factory.d.ts +1 -1
  143. package/dist/src/agent/client-error-format.d.ts +1 -1
  144. package/dist/src/agent/client-error-format.js +1 -1
  145. package/dist/src/agent/commands/command-registry.js +1 -1
  146. package/dist/src/agent/context/execution-scope.d.ts +2 -8
  147. package/dist/src/agent/context/execution-scope.js +6 -23
  148. package/dist/src/agent/embedded/index.d.ts +0 -1
  149. package/dist/src/agent/embedded/index.js +1 -2
  150. package/dist/src/agent/embedded/run-turn.js +25 -2
  151. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +0 -2
  152. package/dist/src/agent/external-tools/gateway-tools.js +6 -6
  153. package/dist/src/agent/mcp/connection-setup.js +2 -2
  154. package/dist/src/agent/memory/compaction-ledger.d.ts +1 -1
  155. package/dist/src/agent/memory/compaction-ledger.js +1 -1
  156. package/dist/src/agent/memory/compaction-promotion.js +1 -1
  157. package/dist/src/agent/memory/source-origin.js +1 -5
  158. package/dist/src/agent/memory/turn-provenance.js +1 -3
  159. package/dist/src/agent/memory/types.d.ts +1 -1
  160. package/dist/src/agent/messaging/command-handler.d.ts +0 -3
  161. package/dist/src/agent/messaging/command-handler.js +1 -4
  162. package/dist/src/agent/prompt/sections/behavior.js +2 -2
  163. package/dist/src/agent/prompt/sections/tooling.js +1 -5
  164. package/dist/src/agent/prompt/voice-presentation.d.ts +1 -1
  165. package/dist/src/agent/prompt/voice-presentation.js +1 -1
  166. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  167. package/dist/src/agent/service/process-direct-streaming.js +0 -6
  168. package/dist/src/agent/service.d.ts +0 -2
  169. package/dist/src/agent/service.js +0 -11
  170. package/dist/src/agent/service.types.d.ts +0 -2
  171. package/dist/src/agent/session/session-config-service.d.ts +0 -2
  172. package/dist/src/agent/session/session-config-service.js +1 -1
  173. package/dist/src/agent/session/session-inspector.d.ts +0 -1
  174. package/dist/src/agent/session/session-inspector.js +0 -1
  175. package/dist/src/agent/skills/required-env-vars.d.ts +1 -1
  176. package/dist/src/agent/skills/required-env-vars.js +1 -1
  177. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  178. package/dist/src/agent/tool-manuals/xopc-use.js +2 -5
  179. package/dist/src/agent/tools/automation-tool.js +1 -1
  180. package/dist/src/agent/tools/factory.d.ts +0 -3
  181. package/dist/src/agent/tools/factory.js +6 -9
  182. package/dist/src/agent/tools/index.d.ts +0 -2
  183. package/dist/src/agent/tools/index.js +1 -3
  184. package/dist/src/agent/tools/knowledge-memory-tool.d.ts +1 -0
  185. package/dist/src/agent/tools/knowledge-memory-tool.js +13 -4
  186. package/dist/src/agent/tools/personal-task-tool.js +8 -22
  187. package/dist/src/agent/tools/search/errors.js +2 -2
  188. package/dist/src/agent/tools/session-recall-tool.js +5 -1
  189. package/dist/src/agent/tools/user-context-tool.js +7 -1
  190. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  191. package/dist/src/agent-catalog/index.d.ts +0 -1
  192. package/dist/src/agent-catalog/index.js +1 -2
  193. package/dist/src/agent-catalog/repository.js +4 -0
  194. package/dist/src/agent-config/index.js +2 -2
  195. package/dist/src/agent-config/resolver.js +0 -6
  196. package/dist/src/agent-config/schema.d.ts +0 -16
  197. package/dist/src/agent-config/schema.js +2 -9
  198. package/dist/src/agent-matching/selection-repository.d.ts +1 -1
  199. package/dist/src/agent-matching/selection-repository.js +1 -1
  200. package/dist/src/agent-matching/service.d.ts +1 -2
  201. package/dist/src/agent-matching/service.js +3 -7
  202. package/dist/src/ai-assist/text-assist.d.ts +1 -1
  203. package/dist/src/ai-assist/text-assist.js +0 -72
  204. package/dist/src/automations/capabilities/write.d.ts +0 -40
  205. package/dist/src/automations/domain/types.d.ts +0 -15
  206. package/dist/src/automations/domain/validation.d.ts +0 -80
  207. package/dist/src/automations/domain/validation.js +0 -17
  208. package/dist/src/automations/draft/automation-draft-prompt.js +0 -3
  209. package/dist/src/automations/draft/automation-draft-validator.d.ts +0 -20
  210. package/dist/src/automations/draft/automation-draft-validator.js +0 -1
  211. package/dist/src/automations/events/event-catalog.js +0 -6
  212. package/dist/src/automations/service/action-executor.d.ts +0 -1
  213. package/dist/src/automations/service/action-executor.js +1 -110
  214. package/dist/src/automations/service/automation-service.js +0 -2
  215. package/dist/src/automations/storage/automation-run-repository.js +6 -7
  216. package/dist/src/backup/archive.js +1 -1
  217. package/dist/src/bootstrap/application-state.d.ts +2 -10
  218. package/dist/src/bootstrap/application-state.js +5 -18
  219. package/dist/src/channels/manager.d.ts +0 -2
  220. package/dist/src/channels/manager.js +0 -4
  221. package/dist/src/channels/pairing/index.d.ts +2 -1
  222. package/dist/src/channels/pairing/pairing-service.d.ts +0 -1
  223. package/dist/src/chat-commands/context.d.ts +0 -3
  224. package/dist/src/chat-commands/context.js +0 -5
  225. package/dist/src/chat-commands/index.d.ts +0 -1
  226. package/dist/src/chat-commands/index.js +1 -3
  227. package/dist/src/chat-commands/types.d.ts +0 -5
  228. package/dist/src/cli/command-manifest.js +1 -1
  229. package/dist/src/cli/commands/config.js +2 -10
  230. package/dist/src/cli/commands/doctor/checks/database-relations.js +0 -3
  231. package/dist/src/cli/commands/doctor/checks/database-schema.js +4 -25
  232. package/dist/src/cli/commands/gateway/run-foreground.js +1 -1
  233. package/dist/src/cli/commands/setup-shared/prompts.d.ts +2 -2
  234. package/dist/src/cli/commands/setup-shared/prompts.js +2 -2
  235. package/dist/src/cli/commands/tui-runner.js +2 -2
  236. package/dist/src/cli/extension-cli-register.js +1 -1
  237. package/dist/src/cli/index.d.ts +0 -1
  238. package/dist/src/cli/index.js +2 -2
  239. package/dist/src/cli/utils/init-workspace-core.js +8 -9
  240. package/dist/src/config/config-file.d.ts +6 -0
  241. package/dist/src/config/config-file.js +35 -0
  242. package/dist/src/config/index.js +2 -2
  243. package/dist/src/config/loader.d.ts +0 -1
  244. package/dist/src/config/loader.js +6 -17
  245. package/dist/src/config/paths.d.ts +1 -1
  246. package/dist/src/config/paths.js +1 -1
  247. package/dist/src/connectors/composio-catalog.js +1 -3
  248. package/dist/src/connectors/composio.js +1 -2
  249. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  250. package/dist/src/connectors/connected-source-understanding.js +1 -1
  251. package/dist/src/connectors/learning-coordinator.js +1 -1
  252. package/dist/src/connectors/principal.js +1 -22
  253. package/dist/src/connectors/{workflow-preflight.d.ts → requirements-preflight.d.ts} +9 -8
  254. package/dist/src/connectors/{workflow-preflight.js → requirements-preflight.js} +2 -10
  255. package/dist/src/connectors/types.d.ts +1 -1
  256. package/dist/src/daemon/types.d.ts +0 -9
  257. package/dist/src/discussions/long-review.js +0 -11
  258. package/dist/src/endpoint-tools/policy.js +13 -14
  259. package/dist/src/extensions/agent-plugins/auth.js +1 -3
  260. package/dist/src/extensions/agent-plugins/formats.js +2 -4
  261. package/dist/src/extensions/agent-plugins/mcp-format.d.ts +1 -1
  262. package/dist/src/extensions/agent-plugins/mcp-format.js +2 -2
  263. package/dist/src/extensions/bundled-extension-activation.d.ts +0 -2
  264. package/dist/src/extensions/bundled-extension-activation.js +1 -3
  265. package/dist/src/extensions/install.js +1 -1
  266. package/dist/src/extensions/types/tui.d.ts +1 -2
  267. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -7
  268. package/dist/src/gateway/agent-builtin-tools.js +0 -7
  269. package/dist/src/gateway/agents-admin.d.ts +0 -1
  270. package/dist/src/gateway/agents-admin.js +0 -1
  271. package/dist/src/gateway/global-defaults-admin.js +1 -1
  272. package/dist/src/gateway/hono/lib/config-payload.d.ts +0 -8
  273. package/dist/src/gateway/hono/lib/config-payload.js +1 -2
  274. package/dist/src/gateway/hono/lib/config-write-lock.d.ts +1 -1
  275. package/dist/src/gateway/hono/lib/config-write-lock.js +1 -1
  276. package/dist/src/gateway/hono/middleware/auth.js +2 -2
  277. package/dist/src/gateway/hono/routes/activity.js +0 -1
  278. package/dist/src/gateway/hono/routes/agents.js +2 -9
  279. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +0 -22
  280. package/dist/src/gateway/hono/routes/chat-model-config.d.ts +0 -1
  281. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -3
  282. package/dist/src/gateway/hono/routes/config.js +2 -21
  283. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  284. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  285. package/dist/src/gateway/hono/routes/devices.js +2 -2
  286. package/dist/src/gateway/hono/routes/home.js +3 -20
  287. package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -8
  288. package/dist/src/gateway/hono/routes/memory-learning.js +1 -1
  289. package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
  290. package/dist/src/gateway/hono/routes/projects.js +0 -16
  291. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  292. package/dist/src/gateway/hono/routes/sessions.js +0 -3
  293. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  294. package/dist/src/gateway/hono/routes/user-model.js +1 -1
  295. package/dist/src/gateway/index.js +1 -1
  296. package/dist/src/gateway/run-loop.js +2 -2
  297. package/dist/src/gateway/security/device-request-proof.js +1 -1
  298. package/dist/src/gateway/security/gateway-scopes.js +0 -1
  299. package/dist/src/gateway/service/active-execution.d.ts +1 -1
  300. package/dist/src/gateway/service/active-execution.js +1 -1
  301. package/dist/src/gateway/service/agent-runner.js +1 -1
  302. package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -1
  303. package/dist/src/gateway/service/sessions-api.d.ts +1 -2
  304. package/dist/src/gateway/service/sessions-api.js +1 -1
  305. package/dist/src/gateway/service/task-conversation-query-service.d.ts +0 -4
  306. package/dist/src/gateway/service/types.d.ts +2 -0
  307. package/dist/src/gateway/service.d.ts +1 -8
  308. package/dist/src/gateway/service.js +13 -60
  309. package/dist/src/history/ctx/format.js +1 -1
  310. package/dist/src/home-intelligence/capability-preflight.js +1 -1
  311. package/dist/src/infra/unhandled-rejections.js +2 -2
  312. package/dist/src/infra/update-runner.d.ts +1 -2
  313. package/dist/src/infra/update-runner.js +2 -2
  314. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  315. package/dist/src/knowledge/local-folder-adapter.js +2 -5
  316. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  317. package/dist/src/local-apps/service.js +1 -1
  318. package/dist/src/memory-learning/forget-capture.js +3 -2
  319. package/dist/src/memory-learning/forgotten-history.d.ts +10 -0
  320. package/dist/src/memory-learning/forgotten-history.js +117 -13
  321. package/dist/src/memory-learning/owner-directive.d.ts +2 -0
  322. package/dist/src/memory-learning/owner-directive.js +10 -0
  323. package/dist/src/memory-learning/service.js +0 -2
  324. package/dist/src/memory-learning/source-learning.js +1 -1
  325. package/dist/src/memory-learning/task-receipts.js +1 -1
  326. package/dist/src/migrations/index.js +2 -2
  327. package/dist/src/migrations/runner.d.ts +1 -2
  328. package/dist/src/migrations/runner.js +2 -5
  329. package/dist/src/notes/service.js +3 -3
  330. package/dist/src/notes/types.d.ts +1 -2
  331. package/dist/src/personal-agent/communication.d.ts +0 -3
  332. package/dist/src/personal-agent/communication.js +1 -12
  333. package/dist/src/personal-agent/persona.d.ts +0 -4
  334. package/dist/src/personal-agent/persona.js +1 -5
  335. package/dist/src/personal-agent/proactivity/repository.js +2 -6
  336. package/dist/src/personal-agent/prompt-context.js +1 -1
  337. package/dist/src/personal-agent/prompts.d.ts +0 -3
  338. package/dist/src/personal-agent/prompts.js +7 -146
  339. package/dist/src/personal-agent/reply-composer.js +3 -3
  340. package/dist/src/personal-agent/reply-style.d.ts +1 -13
  341. package/dist/src/personal-agent/reply-style.js +3 -123
  342. package/dist/src/personal-agent/request-delivery.d.ts +1 -1
  343. package/dist/src/personal-agent/request-delivery.js +1 -1
  344. package/dist/src/personal-agent/request-service.js +2 -2
  345. package/dist/src/personal-agent/specialist-capabilities.js +0 -1
  346. package/dist/src/personal-agent/task-cancel.js +2 -1
  347. package/dist/src/platform/client.d.ts +0 -1
  348. package/dist/src/platform/contracts.d.ts +0 -1
  349. package/dist/src/platform/contracts.js +1 -4
  350. package/dist/src/projects/index.d.ts +0 -1
  351. package/dist/src/projects/index.js +1 -2
  352. package/dist/src/projects/project-loop.d.ts +2 -12
  353. package/dist/src/projects/project-loop.js +19 -42
  354. package/dist/src/projects/project-store.d.ts +0 -1
  355. package/dist/src/projects/project-store.js +0 -11
  356. package/dist/src/projects/types.d.ts +0 -6
  357. package/dist/src/providers/model-usage.js +0 -5
  358. package/dist/src/realtime/runtime.js +0 -1
  359. package/dist/src/routing/agent-session-key.js +1 -1
  360. package/dist/src/session/manager.js +1 -1
  361. package/dist/src/session/types.d.ts +2 -6
  362. package/dist/src/storage/sqlite/connection-wait-repository.js +0 -33
  363. package/dist/src/storage/sqlite/connection.js +2 -2
  364. package/dist/src/storage/sqlite/device-access-repository.d.ts +2 -2
  365. package/dist/src/storage/sqlite/device-access-repository.js +4 -8
  366. package/dist/src/storage/sqlite/home-attention-repository.d.ts +1 -1
  367. package/dist/src/storage/sqlite/index.d.ts +1 -3
  368. package/dist/src/storage/sqlite/index.js +4 -8
  369. package/dist/src/storage/sqlite/{migrations/conversation-backup.d.ts → offline-access.d.ts} +1 -4
  370. package/dist/src/storage/sqlite/{migrations/conversation-backup.js → offline-access.js} +6 -25
  371. package/dist/src/storage/sqlite/row-mappers.d.ts +0 -8
  372. package/dist/src/storage/sqlite/row-mappers.js +0 -8
  373. package/dist/src/storage/sqlite/{migrations/errors.d.ts → schema-errors.d.ts} +0 -6
  374. package/dist/src/storage/sqlite/schema-errors.js +28 -0
  375. package/dist/src/storage/sqlite/schema.d.ts +4 -5
  376. package/dist/src/storage/sqlite/schema.js +23 -19
  377. package/dist/src/storage/sqlite/schema.sql +1099 -427
  378. package/dist/src/storage/sqlite/session-identity-sql.js +1 -2
  379. package/dist/src/storage/sqlite/session-read-repository.d.ts +1 -1
  380. package/dist/src/storage/sqlite/session-read-repository.js +1 -2
  381. package/dist/src/storage/sqlite/session-repository.js +4 -33
  382. package/dist/src/storage/sqlite/{migrations/conversation-windows-owners.js → windows-database-owners.js} +3 -3
  383. package/dist/src/tasks/attention-governor.d.ts +1 -0
  384. package/dist/src/tasks/attention-governor.js +2 -2
  385. package/dist/src/tasks/capabilities/management.d.ts +0 -1
  386. package/dist/src/tasks/capabilities/relations.d.ts +2 -2
  387. package/dist/src/tasks/execution-context.d.ts +1 -1
  388. package/dist/src/tasks/execution-context.js +0 -2
  389. package/dist/src/tasks/home-query-service.d.ts +2 -16
  390. package/dist/src/tasks/home-query-service.js +37 -67
  391. package/dist/src/tasks/index.d.ts +0 -1
  392. package/dist/src/tasks/index.js +1 -2
  393. package/dist/src/tasks/project-operating-view-service.js +0 -1
  394. package/dist/src/tasks/task-application-service.js +0 -5
  395. package/dist/src/tasks/task-repository.d.ts +1 -1
  396. package/dist/src/tasks/task-run-coordinator.js +4 -2
  397. package/dist/src/tui/backends/embedded-backend.d.ts +1 -4
  398. package/dist/src/tui/backends/embedded-backend.js +3 -59
  399. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +1 -2
  400. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -27
  401. package/dist/src/tui/components/chat-log.d.ts +0 -2
  402. package/dist/src/tui/components/chat-log.js +0 -18
  403. package/dist/src/tui/extension-host/runtime-context.js +0 -1
  404. package/dist/src/tui/tui-backend.d.ts +0 -15
  405. package/dist/src/tui/tui-command-formatters.d.ts +0 -3
  406. package/dist/src/tui/tui-command-formatters.js +1 -28
  407. package/dist/src/tui/tui-commands.d.ts +1 -14
  408. package/dist/src/tui/tui-commands.js +4 -89
  409. package/dist/src/tui/tui-startup-resources.js +0 -2
  410. package/dist/src/tui/tui-startup-text.js +2 -3
  411. package/dist/src/tui/tui.js +1 -49
  412. package/dist/src/user-context/trust-policy.js +1 -1
  413. package/dist/src/user-model/usage-policy.js +1 -1
  414. package/dist/src/utils/index.js +1 -1
  415. package/dist/src/utils/logger/index.js +1 -1
  416. package/dist/src/utils/logger.js +1 -1
  417. package/dist/src/voice/realtime/agentBroker.js +2 -3
  418. package/dist/src/voice/realtime/memory-context.js +2 -2
  419. package/dist/src/work-discovery/incremental-repository.js +1 -1
  420. package/dist/src/work-discovery/service.js +2 -2
  421. package/package.json +5 -6
  422. package/dist/extensions/feishu/src/workflow-progress.d.ts +0 -27
  423. package/dist/extensions/feishu/src/workflow-progress.js +0 -98
  424. package/dist/extensions/telegram/src/workflow-progress.d.ts +0 -24
  425. package/dist/extensions/telegram/src/workflow-progress.js +0 -72
  426. package/dist/extensions/weixin/src/workflow-progress.d.ts +0 -26
  427. package/dist/extensions/weixin/src/workflow-progress.js +0 -98
  428. package/dist/gateway/static/root/assets/agent-avatar-dicebear-ColV_Z1C.js +0 -1
  429. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-rgRXzBCX.js +0 -1
  430. package/dist/gateway/static/root/assets/agents-C1rSl_yE.js +0 -77
  431. package/dist/gateway/static/root/assets/app-link-BV_eGr7l.js +0 -1
  432. package/dist/gateway/static/root/assets/app-management-settings-panel-B-Cl1lzt.js +0 -1
  433. package/dist/gateway/static/root/assets/apps-page-BfVMfjkC.js +0 -1
  434. package/dist/gateway/static/root/assets/automations-workspace-b7MTHd-X.js +0 -6
  435. package/dist/gateway/static/root/assets/browser-automations-page-DMqDOJgO.js +0 -3
  436. package/dist/gateway/static/root/assets/browser-settings-page-KZStwhX7.js +0 -3
  437. package/dist/gateway/static/root/assets/capabilities-CD6PzNK7.js +0 -1
  438. package/dist/gateway/static/root/assets/capabilities-page-DeJuO2rf.js +0 -2
  439. package/dist/gateway/static/root/assets/capabilities-settings-panel-DPxL_3Km.js +0 -8
  440. package/dist/gateway/static/root/assets/channels-Cp4F9zPz.js +0 -1
  441. package/dist/gateway/static/root/assets/code-editor-CXIH8jQw.js +0 -1
  442. package/dist/gateway/static/root/assets/computer-settings-page-BXhmUWbA.js +0 -1
  443. package/dist/gateway/static/root/assets/connector-service-page-B1oJCj74.js +0 -1
  444. package/dist/gateway/static/root/assets/connectors-page-Da_M7h3m.js +0 -1
  445. package/dist/gateway/static/root/assets/dependency-picker-BfWUD3LG.js +0 -1
  446. package/dist/gateway/static/root/assets/desktop-pet-CPEi55Vt.js +0 -1
  447. package/dist/gateway/static/root/assets/desktop-pet-settings-CmQ_H-nM.js +0 -1
  448. package/dist/gateway/static/root/assets/device-pairing-wizard-BeTjXc3C.js +0 -1
  449. package/dist/gateway/static/root/assets/dist-BGTk37IG.js +0 -1
  450. package/dist/gateway/static/root/assets/file-archive-DanfQJNe.js +0 -1
  451. package/dist/gateway/static/root/assets/file-braces-BoAMI_k9.js +0 -1
  452. package/dist/gateway/static/root/assets/gateway-realtime-CP6L2jIR.js +0 -1
  453. package/dist/gateway/static/root/assets/gateway-realtime-store-yXB4a40_.js +0 -1
  454. package/dist/gateway/static/root/assets/gateway-settings-CIdEroWr.js +0 -1
  455. package/dist/gateway/static/root/assets/highlight-code-BH65IIbJ.js +0 -1
  456. package/dist/gateway/static/root/assets/home-page-BSbYrVda.js +0 -2
  457. package/dist/gateway/static/root/assets/image-generation-api-BfPYnMoc.js +0 -1
  458. package/dist/gateway/static/root/assets/imports-page-DYSOfHfw.js +0 -1
  459. package/dist/gateway/static/root/assets/index-D2hEKnTM.js +0 -267
  460. package/dist/gateway/static/root/assets/index-SmKNPEmJ.css +0 -1
  461. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BwsGM6Yd.js +0 -1
  462. package/dist/gateway/static/root/assets/languages-BFe8nIOO.js +0 -2
  463. package/dist/gateway/static/root/assets/local-app-workbench-page-K6UR6cAx.js +0 -1
  464. package/dist/gateway/static/root/assets/local-apps-page-gkdwtjDE.js +0 -1
  465. package/dist/gateway/static/root/assets/locale-store-D_migb9R.js +0 -1
  466. package/dist/gateway/static/root/assets/logs-page-BAQNYk0e.js +0 -2
  467. package/dist/gateway/static/root/assets/management-settings-CMVRLGox.js +0 -1
  468. package/dist/gateway/static/root/assets/markdown-editor-BhBJANcx.js +0 -1
  469. package/dist/gateway/static/root/assets/markdown-view-Ljt0bhfF.js +0 -324
  470. package/dist/gateway/static/root/assets/markdown-view-ixUWAmoy.css +0 -1
  471. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-Cx0bXBqu.js +0 -1
  472. package/dist/gateway/static/root/assets/mermaid-render-604gISVe.js +0 -134
  473. package/dist/gateway/static/root/assets/messages-D__oW2yE.js +0 -3
  474. package/dist/gateway/static/root/assets/note-detail-panel-1GCqp26U.js +0 -5
  475. package/dist/gateway/static/root/assets/note-image-lightbox-B7RA-WsY.js +0 -1
  476. package/dist/gateway/static/root/assets/notes-page-DnjlEdzM.js +0 -8
  477. package/dist/gateway/static/root/assets/page-context-capture-button-BAwI_3uh.js +0 -1
  478. package/dist/gateway/static/root/assets/personal-page-XoLrcR0U.js +0 -1
  479. package/dist/gateway/static/root/assets/personal-settings-panel-DzubCRqj.js +0 -1
  480. package/dist/gateway/static/root/assets/plugin-details-dialog-BjzIp3T5.js +0 -1
  481. package/dist/gateway/static/root/assets/plus-Q2yW6OE7.js +0 -1
  482. package/dist/gateway/static/root/assets/preview-open-alternatives-2YjwlRHu.js +0 -1
  483. package/dist/gateway/static/root/assets/product-delivery-DwmnNJvk.js +0 -1
  484. package/dist/gateway/static/root/assets/product-preview-content-D7wLwrqj.js +0 -1
  485. package/dist/gateway/static/root/assets/project-detail-page-1ueRCmXg.js +0 -1
  486. package/dist/gateway/static/root/assets/projects-page-CDQycMPo.js +0 -1
  487. package/dist/gateway/static/root/assets/remote-access-hub-YvVmZA4K.js +0 -1
  488. package/dist/gateway/static/root/assets/runtime-tools-api-CmEWVrOg.js +0 -5
  489. package/dist/gateway/static/root/assets/session-api-aQLptIs9.js +0 -1
  490. package/dist/gateway/static/root/assets/sessions-page-B3rPljgr.js +0 -1
  491. package/dist/gateway/static/root/assets/settings-advanced-gate-Ch20Ptzp.js +0 -1
  492. package/dist/gateway/static/root/assets/setup-status-panel-L1HHrvzi.js +0 -1
  493. package/dist/gateway/static/root/assets/share-preview-page-C4lC0W3d.js +0 -2
  494. package/dist/gateway/static/root/assets/shares-settings-DtHZ9z5K.js +0 -1
  495. package/dist/gateway/static/root/assets/skill-reload-api-Drg356Pb.js +0 -1
  496. package/dist/gateway/static/root/assets/skills-page-XhCLHKlK.js +0 -2
  497. package/dist/gateway/static/root/assets/source-workspace-editor-DunRD1gY.js +0 -1
  498. package/dist/gateway/static/root/assets/style-DTLpCnuA.js +0 -7
  499. package/dist/gateway/static/root/assets/system-settings-panel-bSogz4S-.js +0 -1
  500. package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +0 -1
  501. package/dist/gateway/static/root/assets/task-detail-page-CSv2x4q-.js +0 -2
  502. package/dist/gateway/static/root/assets/task-expandable-content-4s_FTl-9.js +0 -1
  503. package/dist/gateway/static/root/assets/tasks-B4bZpO6O.js +0 -1
  504. package/dist/gateway/static/root/assets/tracing-settings-page-CZ5XLQmX.js +0 -1
  505. package/dist/gateway/static/root/assets/user-model-page-BD7WvhI0.js +0 -2
  506. package/dist/gateway/static/root/assets/work-discovery-overlay-CDJp2_l2.js +0 -1
  507. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CR4fRhZZ.js +0 -3
  508. package/dist/gateway/static/root/assets/workflows-page-BeJw5liC.js +0 -6
  509. package/dist/gateway/static/root/assets/x-B_N4OPjy.js +0 -1
  510. package/dist/gateway/static/root/assets/xml-_d7dTN2Q.js +0 -3
  511. package/dist/src/agent/embedded/session-manager-init.d.ts +0 -4
  512. package/dist/src/agent/embedded/session-manager-init.js +0 -48
  513. package/dist/src/agent/tools/workflow-manage-tool.d.ts +0 -2
  514. package/dist/src/agent/tools/workflow-manage-tool.js +0 -225
  515. package/dist/src/agent/tools/workflow-tool.d.ts +0 -20
  516. package/dist/src/agent/tools/workflow-tool.js +0 -155
  517. package/dist/src/agent/workflow/agent-progress.d.ts +0 -5
  518. package/dist/src/agent/workflow/agent-progress.js +0 -65
  519. package/dist/src/agent/workflow/builtins/index.d.ts +0 -2
  520. package/dist/src/agent/workflow/builtins/index.js +0 -374
  521. package/dist/src/agent/workflow/catalog.d.ts +0 -52
  522. package/dist/src/agent/workflow/catalog.js +0 -150
  523. package/dist/src/agent/workflow/channel-capability.d.ts +0 -76
  524. package/dist/src/agent/workflow/channel-capability.js +0 -1
  525. package/dist/src/agent/workflow/index.d.ts +0 -10
  526. package/dist/src/agent/workflow/index.js +0 -9
  527. package/dist/src/agent/workflow/progress-broker.d.ts +0 -80
  528. package/dist/src/agent/workflow/progress-broker.js +0 -261
  529. package/dist/src/agent/workflow/snapshot-empty.d.ts +0 -2
  530. package/dist/src/agent/workflow/snapshot-empty.js +0 -17
  531. package/dist/src/agent/workflow/snapshot.d.ts +0 -28
  532. package/dist/src/agent/workflow/snapshot.js +0 -267
  533. package/dist/src/agent/workflow/step-labels.d.ts +0 -8
  534. package/dist/src/agent/workflow/step-labels.js +0 -50
  535. package/dist/src/agent/workflow/structured-output-tool.d.ts +0 -33
  536. package/dist/src/agent/workflow/structured-output-tool.js +0 -56
  537. package/dist/src/agent/workflow/subagent-runner.d.ts +0 -46
  538. package/dist/src/agent/workflow/subagent-runner.js +0 -221
  539. package/dist/src/agent/workflow/types.d.ts +0 -252
  540. package/dist/src/agent/workflow/types.js +0 -1
  541. package/dist/src/agent/workflow/workflow-child-tools.d.ts +0 -4
  542. package/dist/src/agent/workflow/workflow-child-tools.js +0 -38
  543. package/dist/src/agent-catalog/migrations/identity-markdown-cutover.d.ts +0 -5
  544. package/dist/src/agent-catalog/migrations/identity-markdown-cutover.js +0 -94
  545. package/dist/src/agent-catalog/migrations/legacy-config-cutover.d.ts +0 -11
  546. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +0 -194
  547. package/dist/src/chat-commands/builtins/workflow.d.ts +0 -18
  548. package/dist/src/chat-commands/builtins/workflow.js +0 -249
  549. package/dist/src/gateway/gateway-workflow-host.types.d.ts +0 -23
  550. package/dist/src/gateway/gateway-workflow-host.types.js +0 -1
  551. package/dist/src/gateway/hono/routes/workflows.d.ts +0 -3
  552. package/dist/src/gateway/hono/routes/workflows.js +0 -572
  553. package/dist/src/knowledge-memory/repair-evidence.d.ts +0 -2
  554. package/dist/src/knowledge-memory/repair-evidence.js +0 -57
  555. package/dist/src/migrations/cloud-public-models.d.ts +0 -7
  556. package/dist/src/migrations/cloud-public-models.js +0 -157
  557. package/dist/src/migrations/memory-config.d.ts +0 -2
  558. package/dist/src/migrations/memory-config.js +0 -76
  559. package/dist/src/migrations/retired-local-stt.d.ts +0 -2
  560. package/dist/src/migrations/retired-local-stt.js +0 -52
  561. package/dist/src/projects/workflow-bind.d.ts +0 -1
  562. package/dist/src/projects/workflow-bind.js +0 -15
  563. package/dist/src/storage/sqlite/migrations/218_core_relation_indexes.sql +0 -26
  564. package/dist/src/storage/sqlite/migrations/219_json_contracts.sql +0 -123
  565. package/dist/src/storage/sqlite/migrations/220_normalize_timestamps.sql +0 -339
  566. package/dist/src/storage/sqlite/migrations/221_ai_usage_retention_index.sql +0 -2
  567. package/dist/src/storage/sqlite/migrations/222_session_config_authority.sql +0 -13
  568. package/dist/src/storage/sqlite/migrations/223_session_creation_receipts.sql +0 -59
  569. package/dist/src/storage/sqlite/migrations/224_task_origin_links.sql +0 -8
  570. package/dist/src/storage/sqlite/migrations/225_task_collaboration.sql +0 -32
  571. package/dist/src/storage/sqlite/migrations/226_task_main_updates.sql +0 -9
  572. package/dist/src/storage/sqlite/migrations/227_task_main_update_decisions.sql +0 -8
  573. package/dist/src/storage/sqlite/migrations/228_task_main_agent_links.sql +0 -14
  574. package/dist/src/storage/sqlite/migrations/229_task_criterion_reviews.sql +0 -12
  575. package/dist/src/storage/sqlite/migrations/230_personal_agent_onboarding.sql +0 -8
  576. package/dist/src/storage/sqlite/migrations/231_task_result_deliveries.sql +0 -32
  577. package/dist/src/storage/sqlite/migrations/232_personal_requests.sql +0 -28
  578. package/dist/src/storage/sqlite/migrations/233_observability_usage_links.sql +0 -3
  579. package/dist/src/storage/sqlite/migrations/234_task_result_reply.sql +0 -14
  580. package/dist/src/storage/sqlite/migrations/235_personal_conversation_priority.sql +0 -3
  581. package/dist/src/storage/sqlite/migrations/236_personal_proactivity.sql +0 -53
  582. package/dist/src/storage/sqlite/migrations/237_personal_strategy_versions.sql +0 -18
  583. package/dist/src/storage/sqlite/migrations/238_browser_record_replay.sql +0 -45
  584. package/dist/src/storage/sqlite/migrations/239_clarification_notifications.sql +0 -26
  585. package/dist/src/storage/sqlite/migrations/240_device_settings.sql +0 -5
  586. package/dist/src/storage/sqlite/migrations/241_device_grant_audit.sql +0 -13
  587. package/dist/src/storage/sqlite/migrations/242_cloud_usage_receipts.sql +0 -5
  588. package/dist/src/storage/sqlite/migrations/243_voice_opening_greetings.sql +0 -12
  589. package/dist/src/storage/sqlite/migrations/244_device_request_proofs.sql +0 -8
  590. package/dist/src/storage/sqlite/migrations/245_memory_learning.sql +0 -125
  591. package/dist/src/storage/sqlite/migrations/246_personal_session_thinking.sql +0 -22
  592. package/dist/src/storage/sqlite/migrations/247_agent_selection_records.sql +0 -32
  593. package/dist/src/storage/sqlite/migrations/248_next_turn_suggestions.sql +0 -20
  594. package/dist/src/storage/sqlite/migrations/249_task_allocations.sql +0 -17
  595. package/dist/src/storage/sqlite/migrations/250_research_checkpoints.sql +0 -15
  596. package/dist/src/storage/sqlite/migrations/251_personal_result_reads.sql +0 -40
  597. package/dist/src/storage/sqlite/migrations/252_task_work_revisions.sql +0 -15
  598. package/dist/src/storage/sqlite/migrations/253_discussion_processing_recovery.sql +0 -20
  599. package/dist/src/storage/sqlite/migrations/254_discussion_annotations.sql +0 -17
  600. package/dist/src/storage/sqlite/migrations/255_discussion_chapter_progress.sql +0 -10
  601. package/dist/src/storage/sqlite/migrations/256_task_main_update_retries.sql +0 -21
  602. package/dist/src/storage/sqlite/migrations/257_session_composer_history.sql +0 -11
  603. package/dist/src/storage/sqlite/migrations/258_task_phase_changes.sql +0 -20
  604. package/dist/src/storage/sqlite/migrations/259_personal_default_style.sql +0 -10
  605. package/dist/src/storage/sqlite/migrations/discover.d.ts +0 -4
  606. package/dist/src/storage/sqlite/migrations/discover.js +0 -40
  607. package/dist/src/storage/sqlite/migrations/errors.js +0 -40
  608. package/dist/src/storage/sqlite/migrations/runner.d.ts +0 -22
  609. package/dist/src/storage/sqlite/migrations/runner.js +0 -112
  610. package/dist/src/storage/sqlite/migrations/types.d.ts +0 -12
  611. package/dist/src/storage/sqlite/migrations/types.js +0 -1
  612. package/dist/src/tasks/task-workflow-coordinator.d.ts +0 -5
  613. package/dist/src/tasks/task-workflow-coordinator.js +0 -55
  614. package/dist/src/tui/tui-workflow-slash.d.ts +0 -29
  615. package/dist/src/tui/tui-workflow-slash.js +0 -58
  616. package/dist/src/workflows/authoring/index.d.ts +0 -2
  617. package/dist/src/workflows/authoring/index.js +0 -3
  618. package/dist/src/workflows/authoring/workflow-draft-defaults.d.ts +0 -3
  619. package/dist/src/workflows/authoring/workflow-draft-defaults.js +0 -63
  620. package/dist/src/workflows/authoring/workflow-draft-store.d.ts +0 -29
  621. package/dist/src/workflows/authoring/workflow-draft-store.js +0 -52
  622. package/dist/src/workflows/context/workflow-context-snapshot-repository.d.ts +0 -21
  623. package/dist/src/workflows/context/workflow-context-snapshot-repository.js +0 -41
  624. package/dist/src/workflows/context/workflow-context.d.ts +0 -18
  625. package/dist/src/workflows/context/workflow-context.js +0 -164
  626. package/dist/src/workflows/domain/command.d.ts +0 -19
  627. package/dist/src/workflows/domain/command.js +0 -1
  628. package/dist/src/workflows/domain/definition-utils.d.ts +0 -18
  629. package/dist/src/workflows/domain/definition-utils.js +0 -90
  630. package/dist/src/workflows/domain/definition.d.ts +0 -164
  631. package/dist/src/workflows/domain/definition.js +0 -1
  632. package/dist/src/workflows/domain/event.d.ts +0 -88
  633. package/dist/src/workflows/domain/event.js +0 -1
  634. package/dist/src/workflows/domain/index.d.ts +0 -8
  635. package/dist/src/workflows/domain/index.js +0 -5
  636. package/dist/src/workflows/domain/result.d.ts +0 -68
  637. package/dist/src/workflows/domain/result.js +0 -1
  638. package/dist/src/workflows/domain/run.d.ts +0 -257
  639. package/dist/src/workflows/domain/run.js +0 -12
  640. package/dist/src/workflows/domain/schema-validation.d.ts +0 -8
  641. package/dist/src/workflows/domain/schema-validation.js +0 -26
  642. package/dist/src/workflows/domain/validation.d.ts +0 -22
  643. package/dist/src/workflows/domain/validation.js +0 -318
  644. package/dist/src/workflows/engine/index.d.ts +0 -2
  645. package/dist/src/workflows/engine/index.js +0 -3
  646. package/dist/src/workflows/engine/projector.d.ts +0 -3
  647. package/dist/src/workflows/engine/projector.js +0 -276
  648. package/dist/src/workflows/engine/workflow-engine.d.ts +0 -88
  649. package/dist/src/workflows/engine/workflow-engine.js +0 -719
  650. package/dist/src/workflows/index.d.ts +0 -11
  651. package/dist/src/workflows/index.js +0 -19
  652. package/dist/src/workflows/project-presets/project-workflow-preset-repository.d.ts +0 -20
  653. package/dist/src/workflows/project-presets/project-workflow-preset-repository.js +0 -39
  654. package/dist/src/workflows/registry/catalog-workflow-definition-registry.d.ts +0 -9
  655. package/dist/src/workflows/registry/catalog-workflow-definition-registry.js +0 -30
  656. package/dist/src/workflows/registry/index.d.ts +0 -2
  657. package/dist/src/workflows/registry/index.js +0 -2
  658. package/dist/src/workflows/registry/workflow-definition-registry.d.ts +0 -15
  659. package/dist/src/workflows/registry/workflow-definition-registry.js +0 -1
  660. package/dist/src/workflows/runtime/graph-workflow-runtime.d.ts +0 -10
  661. package/dist/src/workflows/runtime/graph-workflow-runtime.js +0 -289
  662. package/dist/src/workflows/runtime/index.d.ts +0 -2
  663. package/dist/src/workflows/runtime/index.js +0 -2
  664. package/dist/src/workflows/runtime/workflow-runtime-port.d.ts +0 -13
  665. package/dist/src/workflows/runtime/workflow-runtime-port.js +0 -1
  666. package/dist/src/workflows/service/run-view-to-snapshot.d.ts +0 -4
  667. package/dist/src/workflows/service/run-view-to-snapshot.js +0 -64
  668. package/dist/src/workflows/service/workflow-run-service.d.ts +0 -63
  669. package/dist/src/workflows/service/workflow-run-service.js +0 -892
  670. package/dist/src/workflows/service/workflow-run-service.types.d.ts +0 -62
  671. package/dist/src/workflows/service/workflow-run-service.types.js +0 -1
  672. package/dist/src/workflows/service/workflow-session-bridge.d.ts +0 -33
  673. package/dist/src/workflows/service/workflow-session-bridge.js +0 -244
  674. package/dist/src/workflows/service/workflow-session-key.d.ts +0 -3
  675. package/dist/src/workflows/service/workflow-session-key.js +0 -19
  676. package/dist/src/workflows/service/workflow-writeback-service.d.ts +0 -9
  677. package/dist/src/workflows/service/workflow-writeback-service.js +0 -107
  678. package/dist/src/workflows/store/event-store.d.ts +0 -16
  679. package/dist/src/workflows/store/event-store.js +0 -38
  680. package/dist/src/workflows/store/paths.d.ts +0 -5
  681. package/dist/src/workflows/store/paths.js +0 -18
  682. package/dist/src/workflows/store/run-index-store.d.ts +0 -9
  683. package/dist/src/workflows/store/run-index-store.js +0 -64
  684. package/dist/src/workflows/store/run-store.d.ts +0 -16
  685. package/dist/src/workflows/store/run-store.js +0 -40
  686. package/skills/engineering/workflow-authoring/SKILL.md +0 -32
  687. /package/dist/gateway/static/root/assets/{style-DLioOiRN.css → project-detail-page-DLioOiRN.css} +0 -0
  688. /package/dist/src/storage/sqlite/{migrations/conversation-windows-owners.d.ts → windows-database-owners.d.ts} +0 -0
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u,t as d}from"./popover-select-DGKUpVsz.js";import{t as f}from"./circle-check-C23XjkUj.js";import{t as p}from"./copy-Dv6d4Dvw.js";import{t as m}from"./download-Dk-ZjtO6.js";import{t as h}from"./external-link-DjqjBmc3.js";import{t as g}from"./loader-circle-CifKLtgG.js";import{F as _,V as v,t as y,z as b}from"./markdown-view-Ljt0bhfF.js";import{t as x}from"./plus-Q2yW6OE7.js";import{t as S}from"./x-B_N4OPjy.js";import{t as C}from"./messages-D__oW2yE.js";import{t as w}from"./cn-0WouolD0.js";import{a as T,c as E,f as D,n as O,r as k}from"./locale-store-D_migb9R.js";import{a as A,c as j,i as M,n as N,o as P,r as F,s as I,t as L}from"./dist-BGTk37IG.js";import{i as R,t as z}from"./tasks-B4bZpO6O.js";import{t as B}from"./copy-to-clipboard-HOJ79TWv.js";import{i as V}from"./vendor-swr-BIWyz7Rc.js";import{t as H}from"./button-aIC072nz.js";import{t as U}from"./skeleton-BI5TyibZ.js";import{a as ee}from"./attachment-utils-core-BIOUBrpT.js";import{o as W}from"./agents-admin-api-D0UyB0Y_.js";import{a as G,i as K,o as te,r as q,s as ne}from"./dist-C3DSFZCi.js";import{$l as J,$n as re,A as ie,Ao as ae,Bd as oe,Bi as se,Bo as ce,Ca as le,Cf as Y,Co as ue,Cr as de,Da as fe,Dd as pe,Ed as me,Ef as he,Fl as ge,Fo as _e,Fr as ve,Gd as ye,Go as be,Gr as xe,Hi as Se,Hl as Ce,Ho as we,Hr as Te,Hu as Ee,Il as De,Io as Oe,Ir as ke,Iu as Ae,Jl as je,Js as Me,Kc as Ne,Lo as Pe,Ls as Fe,Mo as Ie,Mr as Le,No as Re,Ol as ze,Oo as Be,Pd as Ve,Po as He,Pr as Ue,Pu as We,Qc as Ge,Qi as Ke,Ro as qe,Sa as Je,Sd as Ye,Sl as Xe,Su as Ze,Ul as Qe,Uo as $e,Vo as et,Wo as tt,Xd as nt,Xl as rt,Yc as it,Yu as at,_ as ot,_o as st,_u as ct,af as lt,ao as ut,au as dt,ba as ft,bf as pt,bs as mt,cl as ht,co as gt,da as _t,dd as vt,di as yt,do as bt,ed as xt,eo as St,eu as Ct,fd as wt,fi as Tt,fo as Et,gl as Dt,gu as Ot,hf as kt,if as At,io as jt,jo as Mt,ka as Nt,ko as Pt,ld as Ft,lf as It,ll as Lt,lo as Rt,ma as zt,mr as Bt,mu as Vt,nu as Ht,of as Ut,oo as Wt,os as Gt,pd as Kt,qc as qt,ro as Jt,sf as Yt,so as Xt,td as Zt,tf as Qt,to as $t,ua as en,uo as tn,v as nn,va as rn,vr as an,wf as on,wl as sn,wo as cn,wu as ln,xa as un,xd as dn,xo as fn,xr as pn,xu as mn,ya as hn,yd as gn,zl as _n,zo as vn}from"./index-D2hEKnTM.js";import{n as yn,t as bn}from"./use-autosave-D0MhLMD2.js";import{t as xn}from"./directory-picker-path-field-CwT1LcLR.js";import{d as Sn,h as Cn,o as wn}from"./skill-api-CyO89DKl.js";import{t as Tn}from"./date-picker-DGjpqOKx.js";import{t as En}from"./automations-workspace-b7MTHd-X.js";import{i as Dn,r as On,t as kn}from"./workflow-run-setup-panel-CR4fRhZZ.js";import{t as An}from"./page-context-capture-button-BAwI_3uh.js";import{i as X,n as jn,r as Mn,t as Nn}from"./note-detail-panel-1GCqp26U.js";import{c as Pn,l as Fn,n as In,o as Z,r as Ln,t as Rn,u as zn}from"./style-DTLpCnuA.js";import{t as Bn}from"./dependency-picker-BfWUD3LG.js";var Vn=n(),Q=e(t(),1),$=r();function Hn(e){let t=(0,Vn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Tt(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=w(`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)(vt,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=w(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(xe,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Un(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function Wn(e){let t=(0,Vn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=yt(),f=yt(Kn),p=u===n&&d===r,m=p&&o,h=p&&s,_=p?c:0,v=p&&l>0?l:i??0,y=v>0?Math.min(_/v*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,T;t[10]===a?T=t[11]:(T=w(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=w(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,$.jsx)(g,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(mn,{className:`size-3.5`}):(0,$.jsx)(Vt,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${y}%`,M;t[23]===j?M=t[24]:(M=(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:j}})}),t[23]=j,t[24]=M);let N;t[25]!==v||t[26]!==p||t[27]!==_?(N=Un(p&&_>0?_:v),t[25]=v,t[26]=p,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==T||t[36]!==A?(I=(0,$.jsxs)(`div`,{className:T,onClick:Gn,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=I):I=t[37],I}function Gn(e){return e.stopPropagation()}function Kn(e){return e.toggle}function qn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Jn(e){let t=(0,Vn.c)(89),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d=O(nr)===`zh`,f=n.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(n.title??``)?d?`语音笔记`:`Voice note`:n.title,p;t[0]!==c||t[1]!==n?(p=qn(n,c),t[0]=c,t[1]=n,t[2]=p):p=t[2];let m=p,h=!n.snippet?.trim(),[g]=(0,Q.useState)(tr),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==l?(_=X(n.createdAt,g,l),t[3]=n.createdAt,t[4]=g,t[5]=l,t[6]=_):_=t[6];let v=_,y,b;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),b=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=y,t[10]=b):(y=t[9],b=t[10]);let x=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,S;t[11]===x?S=t[12]:(S=w(`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`,x),t[11]=x,t[12]=S);let C=u?`true`:void 0,T;t[13]===u?T=t[14]:(T=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]=T);let E;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(E=n.coverAttachmentId?(0,$.jsx)(Hn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(Wn,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=E):E=t[20];let D;t[21]!==f||t[22]!==n.title?(D=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:f}),t[21]=f,t[22]=n.title,t[23]=D):D=t[23];let k=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,A;t[24]===k?A=t[25]:(A=w(`truncate text-sm leading-5`,k),t[24]=k,t[25]=A);let j;t[26]!==m||t[27]!==A?(j=(0,$.jsx)(`p`,{className:A,children:m}),t[26]=m,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==D||t[30]!==j?(M=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,j]}),t[29]=D,t[30]=j,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(Ve,{className:`size-4`}),t[32]=N):N=t[32];let P;t[33]===c.actions?P=t[34]:(P=(0,$.jsx)(le,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:er,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:N})}),t[33]=c.actions,t[34]=P);let F;t[35]!==n.id||t[36]!==n.pinned||t[37]!==a?(F=()=>{a(n.id,!n.pinned).catch(Qn)},t[35]=n.id,t[36]=n.pinned,t[37]=a,t[38]=F):F=t[38];let I;t[39]===n.pinned?I=t[40]:(I=n.pinned?(0,$.jsx)(Ot,{className:`size-4`}):(0,$.jsx)(ct,{className:`size-4`}),t[39]=n.pinned,t[40]=I);let L=n.pinned?c.unpin:c.pin,R;t[41]!==F||t[42]!==I||t[43]!==L?(R=(0,$.jsxs)(hn,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:F,children:[I,L]}),t[41]=F,t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==n.id||t[46]!==o?(z=()=>{o(n.id).catch(Zn)},t[45]=n.id,t[46]=o,t[47]=z):z=t[47];let B;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(he,{className:`size-4`}),t[48]=B):B=t[48];let V;t[49]!==c.archive||t[50]!==z?(V=(0,$.jsxs)(hn,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:z,children:[B,c.archive]}),t[49]=c.archive,t[50]=z,t[51]=V):V=t[51];let H;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(Je,{className:`my-1 h-px bg-edge-subtle`}),t[52]=H):H=t[52];let U;t[53]!==n.id||t[54]!==s?(U=()=>{s(n.id).catch(Xn)},t[53]=n.id,t[54]=s,t[55]=U):U=t[55];let ee;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(ze,{className:`size-4`}),t[56]=ee):ee=t[56];let W;t[57]!==c.delete||t[58]!==U?(W=(0,$.jsxs)(hn,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:U,children:[ee,c.delete]}),t[57]=c.delete,t[58]=U,t[59]=W):W=t[59];let G;t[60]!==R||t[61]!==V||t[62]!==W?(G=(0,$.jsx)(ft,{children:(0,$.jsxs)(rn,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-overlay p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:$n,children:[R,V,H,W]})}),t[60]=R,t[61]=V,t[62]=W,t[63]=G):G=t[63];let K;t[64]!==P||t[65]!==G?(K=(0,$.jsxs)(un,{children:[P,G]}),t[64]=P,t[65]=G,t[66]=K):K=t[66];let te;t[67]!==E||t[68]!==M||t[69]!==K?(te=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,M,K]}),t[67]=E,t[68]=M,t[69]=K,t[70]=te):te=t[70];let q;t[71]===n.pinned?q=t[72]:(q=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)(ct,{className:`size-3`})}),t[71]=n.pinned,t[72]=q);let ne;t[73]===n.tags?ne=t[74]:(ne=n.tags?.slice(0,2).map(Yn),t[73]=n.tags,t[74]=ne);let J;t[75]===v?J=t[76]:(J=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[75]=v,t[76]=J);let re;t[77]!==q||t[78]!==ne||t[79]!==J?(re=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[q,ne,J]}),t[77]=q,t[78]=ne,t[79]=J,t[80]=re):re=t[80];let ie;return t[81]!==te||t[82]!==re||t[83]!==y||t[84]!==b||t[85]!==S||t[86]!==C||t[87]!==T?(ie=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:b,className:S,"aria-current":C,children:[T,te,re]}),t[81]=te,t[82]=re,t[83]=y,t[84]=b,t[85]=S,t[86]=C,t[87]=T,t[88]=ie):ie=t[88],ie}function Yn(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function Xn(){}function Zn(){}function Qn(){}function $n(e){return e.stopPropagation()}function er(e){return e.stopPropagation()}function tr(){return Date.now()}function nr(e){return e.language}var rr=3e4;function ir(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function ar({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(0),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A=(0,Q.useRef)([]),j=(0,Q.useRef)(0),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),k.current?.getTracks().forEach(e=>e.stop()),k.current=null,O.current=null,A.current=[],b(!1),C(0)},[]);(0,Q.useEffect)(()=>()=>P(),[P]);let F=(0,Q.useCallback)(async()=>{let e=O.current;if(!e||e.state!==`recording`)return;E(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||ir()||`audio/webm`,r=new Blob(A.current,{type:n});if(P(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{E(!1)}return}E(!1)},[P,c]),I=(0,Q.useCallback)(async()=>{if(!(!c||T||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=ir(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);O.current=n,A.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&A.current.push(e.data)},n.start(),b(!0),C(0),M.current=setInterval(()=>{C(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},rr)}catch{P(),l?.()}}},[P,c,l,y,F,T]),L=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),D.current?.focus()}}},[h,_,o]),R=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||T,B=!!(s||c||p);return(0,$.jsxs)(`div`,{className:w(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-overlay 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 F(),disabled:T,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(_n,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(un,{children:[(0,$.jsx)(le,{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)(x,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ft,{children:(0,$.jsxs)(rn,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[s?(0,$.jsxs)(hn,{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)(Ft,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(hn,{disabled:f,onSelect:()=>void I(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(We,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(hn,{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)(pt,{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(S))}):(0,$.jsx)(`textarea`,{ref:D,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:w(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(J,{className:`size-4`,"aria-hidden":!0})})]})}var or={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},sr=240,cr=320,lr=520,ur=560;function dr(e){if(globalThis.localStorage===void 0)return cr;try{let t=globalThis.localStorage.getItem(e);if(!t)return cr;let n=Number(t);return Number.isFinite(n)?n:cr}catch{return cr}}function fr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var pr={thought:De,todo:Ce,voice:We,media:Ft,bookmark:kt,mixed:De,task:Ce};function mr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function hr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function gr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function _r({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=O(e=>e.language),h=C(m).notes,g=!!E(e=>e.conversationId),[_,v]=(0,Q.useReducer)(st,or),[y,b]=(0,Q.useState)(!1),[T,k]=(0,Q.useState)(``),[j,R]=(0,Q.useState)(0),[z,B]=(0,Q.useState)(()=>dr(p)),[H,U]=(0,Q.useState)(!1),[ee,W]=(0,Q.useState)(!1),[G,K]=(0,Q.useState)(!1),[te,q]=(0,Q.useState)(null),[ne,J]=(0,Q.useState)(null),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(null),[ae]=(0,Q.useState)(()=>Date.now()),oe=i(),se=(0,Q.useCallback)(e=>{let t=re.current?.clientWidth??window.innerWidth,n=Math.max(sr,t-ur);return Math.max(sr,Math.min(Math.min(lr,n),e))},[]),ce=(0,Q.useCallback)(e=>{let t=se(e);B(t),fr(p,t)},[se,p]);(0,Q.useLayoutEffect)(()=>{B(e=>se(e))},[se]);let{data:le,mutate:Y,isLoading:ue}=V((0,Q.useMemo)(()=>g?[`notes-list`,o,_.statusFilter,_.kindFilter,_.pinnedOnly]:null,[g,o,_.statusFilter,_.kindFilter,_.pinnedOnly]),()=>Le({status:_.statusFilter===`all`?void 0:_.statusFilter,kind:_.kindFilter===`all`?void 0:_.kindFilter,projectId:o,pinned:_.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),fe=ue&&!le,pe=le?.items??[],me=le?.total??0,he=T.trim(),{data:ge,isLoading:_e}=V(g&&y&&he?[`notes-search`,o,he]:null,()=>Le({search:he,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),ye=ge?.items??[],be=e?pe.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{R(0)},[he]),(0,Q.useEffect)(()=>{j>=ye.length&&R(Math.max(0,ye.length-1))},[j,ye.length]),(0,Q.useEffect)(()=>{let e=()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,h.quickCaptureFailedHint,h.refreshFailed]);let xe=Gt(e=>e.setPageHeader),Se=Gt(e=>e.clearPageHeader),Ce=h.noteCount.replace(`{{count}}`,String(me)),we=!r&&me===0&&c?c:Ce,Ee=h.searchDialogTitle,Oe=h.searchClose,Ae=h.searchClear,je=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:w(`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`,Fe),"aria-label":Ee,children:[(0,$.jsx)(Ct,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ee})]}),[Ee]);(0,Q.useLayoutEffect)(()=>{if(n)return g?(xe({startExtra:null,main:(0,$.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-2`,Fe),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??h.title}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:h.discussionCapture.recoveredTitle}),Ce?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Ce}):null]}),end:je}),()=>Se()):(Se(),()=>Se())},[Se,g,je,s,n,h.title,h.discussionCapture.recoveredTitle,Ce,e,xe]);let Me=(0,Q.useMemo)(()=>({justNow:h.justNow,minutesAgo:h.minutesAgo,today:h.today,yesterday:h.yesterday,daysAgo:h.daysAgo,locale:D(m)}),[m,h.justNow,h.minutesAgo,h.today,h.yesterday,h.daysAgo]),Ne=(0,Q.useMemo)(()=>[{id:`recent`,label:h.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:h.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:h.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:h.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:h.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:h.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:h.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:h.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:h.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[h.filterArchived,h.filterInbox,h.filterProcessed,h.kindBookmark,h.kindMedia,h.kindVoice,h.pinned,h.viewRecent,h.viewTasks]),Pe=Ne.find(e=>hr(_,e))??Ne[0],Ie=s??Pe.label,Re=(0,Q.useCallback)(async e=>{q(null);try{let n=o?await pn({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Ue(e,`web`);await Y(),oe(gr(t,n.id))}catch(e){throw q(`${h.quickCaptureFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`),e}},[t,Y,h.quickCaptureFailed,h.quickCaptureFailedHint,oe,o]),ze=(0,Q.useCallback)(async()=>{if(!G){K(!0),q(null);try{let e=await pn({markdown:``,kind:`thought`,projectId:o,channel:`web`});v({type:`patch`,patch:or}),await Y(),J(e.id),oe(gr(t,e.id))}catch(e){q(`${h.createBlankFailed}: ${e instanceof Error?e.message:h.createBlankFailedHint}`)}finally{K(!1)}}},[t,G,Y,h.createBlankFailed,h.createBlankFailedHint,oe,o]),Be=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{q(null),await ve(t,`web`),await Y()}catch(e){q(`${h.imageUploadFailed}: ${e instanceof Error?e.message:h.imageUploadFailedHint}`)}},e.click()},[Y,h.imageUploadFailed,h.imageUploadFailedHint]),Ve=(0,Q.useCallback)(async(e,t)=>{try{q(null),await ke(e,t,`web`),await Y()}catch(e){q(`${h.voiceUploadFailed}: ${e instanceof Error?e.message:h.voiceUploadFailedHint}`)}},[Y,h.voiceUploadFailed,h.voiceUploadFailedHint]),He=(0,Q.useCallback)(()=>{q(`${h.voiceCaptureFailed}: ${h.voiceCaptureFailedHint}`)},[h.voiceCaptureFailed,h.voiceCaptureFailedHint]),Ge=(0,Q.useCallback)(async(e,t)=>{q(null);try{await Te(e,{pinned:t}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ke=(0,Q.useCallback)(async e=>{q(null);try{await Te(e,{status:`archived`}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),qe=(0,Q.useCallback)(async e=>{q(null);try{await de(e),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Je=(0,Q.useCallback)(e=>{oe(gr(t,e))},[t,oe]),Ye=(0,Q.useCallback)(e=>{oe(gr(t,e)),b(!1)},[t,oe]),Xe=(0,Q.useCallback)(e=>{if(ye.length){if(e.key===`ArrowDown`)e.preventDefault(),R(e=>Math.min(ye.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),R(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=ye[j]??ye[0];t&&Ye(t.id)}}},[j,Ye,ye]),Ze=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ie.current;t.setPointerCapture(e.pointerId),U(!0);let r=re.current?.clientWidth??window.innerWidth,i=Math.max(sr,r-ur),a=Math.min(lr,i),o=e=>Math.max(sr,Math.min(a,e)),s=e.clientX,c=o(z),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{}U(!1),re.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),B(f),fr(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,z]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),ze())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ze]);let Qe=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ce(z-16)):e.key===`ArrowRight`?(e.preventDefault(),ce(z+16)):e.key===`Home`?(e.preventDefault(),ce(sr)):e.key===`End`&&(e.preventDefault(),ce(lr))},[ce,z]);return g?(0,$.jsxs)(`div`,{ref:re,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${z}px`},children:[(0,$.jsxs)(`section`,{ref:ie,className:w(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!H&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ee?`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":ee?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[te?(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:te}):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)(l,{value:Pe.id,onChange:e=>{let t=Ne.find(t=>t.id===e.target.value);t&&v({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":h.libraryTitle,children:Ne.map(e=>(0,$.jsx)(u,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Ie}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:we})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`hidden size-11 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":h.collapseNotesList,title:h.collapseNotesList,children:(0,$.jsx)(ln,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Bt(o),"aria-label":m===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(We,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:ze,disabled:G,className:`inline-flex size-11 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":h.createBlankNote,title:h.createBlankShortcut,children:(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(!0),className:`inline-flex size-11 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":h.searchDialogTitle,title:h.searchDialogTitle,children:(0,$.jsx)(Ct,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:fe?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):pe.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(De,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!be?h.noteOutsideCurrentView:d??h.noNotes}),e&&!be?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??h.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!be?(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:h.noteOutsideCurrentView}):null,pe.map((t,n)=>{let r=n>0?jn(pe[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[jn(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:w(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Mn(t.createdAt,ae,Me)}),(0,$.jsx)(Jn,{note:t,selected:t.id===e,onPress:Je,onPin:Ge,onArchive:Ke,onDelete:qe,timeLabels:Me,labels:{pin:h.pin,unpin:h.unpin,archive:h.archive,delete:h.delete,actions:h.noteActions,imageNote:h.imageNote,noText:h.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(ar,{placeholder:h.quickCapturePlaceholder,submitLabel:h.quickCaptureSubmit,actionsLabel:h.quickCaptureActions,imageLabel:h.quickCaptureImage,voiceLabel:h.quickCaptureVoice,stopRecordingLabel:h.stopRecording,onCapture:Re,onImagePick:a?Be:void 0,onVoiceCapture:a?Ve:void 0,onVoiceError:He,recordingLabel:h.recording,discussionCaptureLabel:h.discussionCapture.title,onDiscussionCapture:()=>Bt(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.resizeNotesList,"aria-valuemin":sr,"aria-valuemax":lr,"aria-valuenow":Math.round(z),tabIndex:0,onPointerDown:Ze,onDoubleClick:()=>ce(cr),onKeyDown:Qe,title:h.resizeNotesList,className:w(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-transparent hover:bg-surface-hover/60 lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ee?`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:w(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,H&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:w(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[ee?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":h.expandNotesList,title:h.expandNotesList,children:(0,$.jsx)(ln,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Nn,{noteId:e,onBack:()=>oe(t),onSaved:()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>b(!0),autoFocus:e===ne,onAutoFocusConsumed:()=>J(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)(De,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:h.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h.emptyEditorDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Bt(o),"aria-label":m===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(We,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`button`,{type:`button`,onClick:ze,disabled:G,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),G?h.creatingBlankNote:h.createBlankNote]})]})})]}),(0,$.jsx)(L,{open:y,onOpenChange:b,children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(I,{className:`text-sm font-semibold text-fg`,children:Ee}),(0,$.jsx)(M,{className:`sr-only`,children:h.searchPlaceholder}),(0,$.jsx)(N,{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":Oe,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ct,{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:T,onChange:e=>k(e.target.value),onKeyDown:Xe,placeholder:h.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),T?(0,$.jsx)(`button`,{type:`button`,onClick:()=>k(``),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":Ae,children:(0,$.jsx)(S,{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:he?_e&&!ge?(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))}):ye.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)(De,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.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:h.searchResultsCount.replace(`{{count}}`,String(ge?.total??ye.length))}),ye.map((e,t)=>{let n=pr[e.kind]||De,r=mr(e,{imageNote:h.imageNote,noText:h.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Ye(e.id),onMouseEnter:()=>R(t),className:w(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===j?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:X(e.updatedAt,ae,Me)})]}),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)(Ct,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(De,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.needToken})]})}var vr=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function yr({projectId:e}){let t=O(e=>e.language),n=C(t).workflows,r=t===`zh`,[i,a]=(0,Q.useState)(!1),[o,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(vr),[g,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),k=V(i?`workflow-definitions`:null,nn,{revalidateOnFocus:!1}),R=V(i?`workflow-agents`:null,W,{revalidateOnFocus:!1}),z=V(i?[`workflow-project-presets`,e]:null,()=>ot(e),{revalidateOnFocus:!1}),B=k.data?.find(e=>e.id===o),ee=B?se(B,t):null,G=f||R.data?.defaultId,K=k.isLoading||R.isLoading||z.isLoading,te=k.error||R.error||z.error,q=Dn(B,m,v).valid,ne=e=>{b||(e&&(d(``),p(``),h(vr()),_([]),y(!0),T(null),D(null)),a(e))},J=e=>{d(e),h(vr()),y(!0),T(null),_(z.data?.find(t=>t.definitionId===e)?.contextRefs??[])},ae=async()=>{if(!(!B||!G||!q||b||E||K||te)){x(!0),T(null);try{D({runId:(await ie({definitionId:B.id,agentId:G,projectId:e,goal:m.goal.trim()||ee?.description||B.title,input:On(B,m),contextRefs:g,concurrency:m.concurrency.trim()?Number(m.concurrency):void 0,maxSubagents:m.maxSubagents.trim()?Number(m.maxSubagents):void 0})).runId,agentId:G})}catch(e){T(e instanceof Error?e.message:n.startFailed);return}finally{x(!1)}}};return(0,$.jsxs)(L,{open:i,onOpenChange:ne,children:[(0,$.jsx)(j,{asChild:!0,children:(0,$.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,children:[(0,$.jsx)(gn,{className:`size-4`,"aria-hidden":!0}),C(t).projectDetailPage.common.runWorkflow]})}),(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(46rem,calc(100dvh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:C(t).projectDetailPage.common.runWorkflow}),(0,$.jsx)(M,{className:`mt-1 text-xs text-fg-muted`,children:r?`选择工作流并运行,结果将关联到当前项目。`:`Choose and run a workflow. The run will be linked to this project.`})]}),(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{variant:`ghost`,className:`size-8 p-0`,disabled:b,"aria-label":n.pickStartClose,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:E?(0,$.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(c,{className:`size-8 text-success`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-base font-medium text-fg`,children:n.startSuccess}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`工作流正在后台运行,你可以继续处理项目。`:`The workflow is running in the background. You can continue working on your project.`}),(0,$.jsx)(H,{asChild:!0,variant:`secondary`,children:(0,$.jsx)(s,{to:`/workflows/runs/${encodeURIComponent(E.runId)}?agentId=${encodeURIComponent(E.agentId)}&projectId=${encodeURIComponent(e)}`,children:n.taskOpenDetails})})]}):K?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r?`正在加载工作流`:`Loading workflows`,children:[(0,$.jsx)(U,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(U,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(U,{className:`h-56 w-full rounded-xl`})]}):te?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:te instanceof Error?te.message:n.startFailed}):k.data?.length?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n.chooseWorkflow,(0,$.jsxs)(l,{value:o,onChange:e=>J(e.target.value),disabled:b,"aria-label":n.chooseWorkflow,className:`mt-1 w-full`,children:[(0,$.jsx)(u,{value:``,children:n.chooseWorkflow}),k.data.map(e=>(0,$.jsx)(u,{value:e.id,children:se(e,t).title},e.id))]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[r?`执行助手`:`Execution assistant`,(0,$.jsx)(l,{value:G??``,onChange:e=>p(e.target.value),disabled:b,"aria-label":r?`执行助手`:`Execution assistant`,className:`mt-1 w-full`,children:R.data?.agents.map(e=>(0,$.jsx)(u,{value:e.id,children:re(e,C(t).agentsSettings)},e.id))})]}),B&&ee?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:ee.description}),(0,$.jsx)(zn,{projectId:e,language:t,value:g,onChange:_}),(0,$.jsx)(kn,{definition:B,language:t,value:m,onChange:h,mode:`manual`,onValidityChange:e=>y(e.reason!==`raw-json`)})]}):null,w?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:w}):null]}):(0,$.jsx)(`p`,{className:`py-12 text-center text-sm text-fg-muted`,children:r?`还没有可运行的工作流,请先新建工作流。`:`No workflows are available. Create a workflow to get started.`})}),(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(H,{asChild:!0,variant:`ghost`,disabled:b,children:(0,$.jsx)(s,{to:`/workflows/new?projectId=${encodeURIComponent(e)}`,onClick:e=>{b&&e.preventDefault()},children:n.addWorkflow})}),E?(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{variant:`primary`,children:n.pickStartClose})}):(0,$.jsxs)(H,{variant:`primary`,disabled:K||!!te||!B||!G||!q||b,onClick:()=>void ae(),children:[(0,$.jsx)(Vt,{className:`size-4`,"aria-hidden":!0}),b?n.starting:n.runWorkflow]})]})]})]})]})}function br(e){return T(k(`/api/projects/${encodeURIComponent(e)}/skills`))}function xr(e,t){return T(k(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Sr(e,t){return T(k(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Cr(e,t){let n=new FormData;return n.set(`file`,t),T(k(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function wr(e,t,n={}){return T(k(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Tr(e,t){return T(k(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Er(e,t){return T(k(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function Dr({projectId:e,copy:t}){let n=O(e=>e.language),[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)([]),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!0),[C,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(``),[M,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(null),[V,ee]=(0,Q.useState)(``),[W,q]=(0,Q.useState)(1),[J,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(``),[ce,le]=(0,Q.useState)(``),Y=(0,Q.useRef)(null),ue=(0,Q.useCallback)(async()=>{b(!0),j(``);try{let t=await br(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){j(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,Q.useEffect)(()=>{ue()},[ue]),(0,Q.useEffect)(()=>{let t=!1;return Pe(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Q.useEffect)(()=>{if(!f){g(null);return}let e=l.find(e=>e.key===f),t=!1;return g(null),j(``),v(!0),_t(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||g(e)}).catch(e=>{t||j(e instanceof Error?e.message:String(e))}).finally(()=>{t||v(!1)}),()=>{t=!0}},[f,l]),(0,Q.useEffect)(()=>{if(M!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{ae(!0),se(``),wn({q:V,page:W,pageSize:8,sort:`downloads`,signal:e.signal}).then(re).catch(t=>{e.signal.aborted||se(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||ae(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[M,W,V]);async function de(e,t){T(!0),D(t??null),j(``);try{await e(),R(null),le(``),await ue()}catch(e){j(e instanceof Error?e.message:String(e))}finally{T(!1),D(null)}}async function fe(t){j(``);try{B((await xr(e,t)).skill)}catch(e){j(e instanceof Error?e.message:String(e))}}async function pe(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){T(!0);try{await Er(e,n.directoryId),await ue()}catch(e){j(e instanceof Error?e.message:String(e))}finally{T(!1)}}}async function me(){T(!0),j(``);try{await Sr(e,!0),await ue()}catch(e){j(e instanceof Error?e.message:String(e))}finally{T(!1)}}let he=s.find(e=>e.origin===`agents-workspace`),_e=new Map(h?.skills.map(e=>[e.name,e]));return(0,$.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsxs)(te,{children:[(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(H,{type:`button`,children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.add,(0,$.jsx)(Yt,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,$.jsx)(G,{children:(0,$.jsxs)(K,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-overlay p-1.5 shadow-xl`,children:[(0,$.jsx)(jr,{icon:ge,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>R(`marketplace`)}),(0,$.jsx)(jr,{icon:gn,title:t.source,hint:t.sourceHint,onClick:()=>R(`source`)}),(0,$.jsx)(jr,{icon:sn,title:t.upload,hint:t.uploadHint,onClick:()=>Y.current?.click()})]})})]}),(0,$.jsx)(`input`,{ref:Y,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&de(()=>Cr(e,n)),t.target.value=``}})]})}),k?(0,$.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:k}):null,he?.state===`untrusted`?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Ee,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,$.jsxs)(H,{type:`button`,variant:`secondary`,disabled:C,onClick:()=>void me(),children:[(0,$.jsx)(je,{className:`size-4`,"aria-hidden":!0}),C?t.trusting:t.trustAction]})]}):null,l.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_?t.sessionLoading:f?h?.agentId:t.sessionViewAll})]}),(0,$.jsx)(d,{value:f,options:l.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:p})]}):null,y?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,$.jsx)(U,{className:`h-36 rounded-lg`},e))}):r.length?(0,$.jsx)(Or,{title:t.localTitle,items:r,copy:t,busy:C,availabilityByName:_e,onPreview:fe,onRemove:pe}):(0,$.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!y&&a.length?(0,$.jsx)(Or,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:C,availabilityByName:_e,onPreview:fe,onRemove:pe}):null,(0,$.jsx)(L,{open:M!==null,onOpenChange:e=>{e||R(null)},children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:w(`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-xl`,M===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:M===`marketplace`?t.marketplace:t.source}),(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(S,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:M===`marketplace`?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,$.jsxs)(`div`,{className:`relative mt-3`,children:[(0,$.jsx)(Ct,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:V,onChange:e=>{ee(e.target.value),q(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),oe?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:oe}):null,ie&&!J?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,$.jsx)(U,{className:`h-32 rounded-lg`},e))}):J?.items.length?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:J.items.map(i=>{let a=zt(i,n),o=i.providerId??J.provider,s=Cn(i,o),c=r.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===i.id||e.directoryId===s||e.name===i.name)),l=E===s;return(0,$.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(Sn,{name:i.name,className:`size-10`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,$.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,$.jsx)(H,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:C||c,onClick:()=>void de(()=>wr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):ie?null:(0,$.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),J&&J.meta.totalPages>1?(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(J.meta.page)).replace(`{{total}}`,String(J.meta.totalPages))}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ie||W<=1,onClick:()=>q(e=>Math.max(1,e-1)),children:[(0,$.jsx)(Ut,{className:`size-4`}),t.marketplacePrevious]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ie||W>=J.meta.totalPages,onClick:()=>q(e=>e+1),children:[t.marketplaceNext,(0,$.jsx)(lt,{className:`size-4`})]})]})]}):null]}):(0,$.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,$.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:ce,onChange:e=>le(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`secondary`,children:t.close})}),(0,$.jsx)(H,{type:`button`,disabled:C||!ce.trim(),onClick:()=>void de(()=>Tr(e,ce.trim())),children:C?t.installing:t.install})]})]})})]})]})}),(0,$.jsx)(L,{open:!!z,onOpenChange:e=>{e||B(null)},children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-xl`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:z?.name}),(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(S,{className:`size-4`})})})]}),(0,$.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:z?.bodyMarkdown})]})]})})]})}function Or(e){let t=(0,Vn.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,$.jsxs)(`article`,{className:w(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:kr(a,e.origin)}),e.writable?null:(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,$.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,$.jsx)(`span`,{className:w(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:Ar(a,t)}):null]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,$.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let g;return t[22]!==f||t[23]!==m?(g=(0,$.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=g):g=t[24],g}function kr(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function Ar(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function jr(e){let t=(0,Vn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,$.jsx)(q,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Mr(e){return{name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``}}function Nr(e,t,n){let r=Mr(t),i=Mr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var Pr={active:0,review:1,ready:2,backlog:3,closed:4},Fr={failed:0,blocked:1,waiting:2,verifying:3,running:4,queued:5,allocating:5,cancelled:6,idle:7},Ir={critical:0,high:1,normal:2,low:3};function Lr(e,t=4){return e.filter(e=>e.phase!==`closed`&&!(e.operationalState===`waiting`&&e.attention.length===0)).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=Fr[e.operationalState]-Fr[t.operationalState];if(r!==0)return r;let i=Pr[e.phase]-Pr[t.phase];if(i!==0)return i;let a=Ir[e.priority]-Ir[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Rr=[`backlog`,`ready`,`active`,`review`,`closed`];function zr(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function Br(e,t){if(e.phase!==t&&e.allowedCommands.includes(`move`))return`move_${t}`}function Vr(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Hr(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Ur(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Hr(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Wr(e,t){let{incoming:n}=Hr(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Gr(e,t){let{incoming:n,outgoing:r}=Hr(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var Kr={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function qr(e){let t=(0,Vn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Kr[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=w(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Ln,{type:`target`,position:Fn.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,$.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,$.jsx)(wt,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,$.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,$.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,$.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ln,{type:`source`,position:Fn.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,$.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var Jr={taskNode:qr};function Yr(e){let t=(0,Vn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(),[m,g]=(0,Q.useState)(),v=(0,Q.useRef)(null),y;t[0]!==r||t[1]!==n?(y=Wr(n,r),t[0]=r,t[1]=n,t[2]=y):y=t[2];let b=y,x;t[3]!==b||t[4]!==u||t[5]!==c||t[6]!==n?(x=u?n.filter(e=>b.has(e.id)):c?n:n.filter(ri),t[3]=b,t[4]=u,t[5]=c,t[6]=n,t[7]=x):x=t[7];let S=x,C;t[8]===S?C=t[9]:(C=new Set(S.map(ni)),t[8]=S,t[9]=C);let T=C,E;if(t[10]!==r||t[11]!==T){let e;t[13]===T?e=t[14]:(e=e=>T.has(e.dependencyTaskId)&&T.has(e.dependentTaskId),t[13]=T,t[14]=e),E=r.filter(e),t[10]=r,t[11]=T,t[12]=E}else E=t[12];let D=E,O;t[15]!==D||t[16]!==S?(O=Ur(S,D),t[15]=D,t[16]=S,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==D?(A=f?Gr(f,D):void 0,t[18]=f,t[19]=D,t[20]=A):A=t[20];let j=A,M;t[21]===f?M=t[22]:(M=e=>e.id===f,t[21]=f,t[22]=M);let N=S.find(M),P;t[23]===S?P=t[24]:(P=new Map(S.map(ti)),t[23]=S,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==S){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=S.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=S,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==D){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Pn.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=j,t[39]=F,t[40]=e):e=t[40],R=D.map(e),t[34]=j,t[35]=F,t[36]=D,t[37]=R}else R=t[37];let z=R,B,V;t[41]!==f||t[42]!==T?(B=()=>{f&&!T.has(f)&&p(void 0)},V=[f,T],t[41]=f,t[42]=T,t[43]=B,t[44]=V):(B=t[43],V=t[44]),(0,Q.useEffect)(B,V);let U,ee;t[45]!==z||t[46]!==m?(U=()=>{m&&!z.some(e=>e.id===m)&&g(void 0)},ee=[z,m],t[45]=z,t[46]=m,t[47]=U,t[48]=ee):(U=t[47],ee=t[48]),(0,Q.useEffect)(U,ee);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=window.requestAnimationFrame(()=>{v.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=W):W=t[49];let G;t[50]!==u||t[51]!==c||t[52]!==S.length?(G=[u,c,S.length],t[50]=u,t[51]=c,t[52]=S.length,t[53]=G):G=t[53],(0,Q.useEffect)(W,G);let K;t[54]===f?K=t[55]:(K=()=>{f&&v.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=K);let te=K,q;t[56]!==r||t[57]!==o?(q=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(ei);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=q):q=t[58];let ne=q,J;t[59]!==r||t[60]!==o||t[61]!==m?(J=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(g(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map($r)))},t[59]=r,t[60]=o,t[61]=m,t[62]=J):J=t[62];let re=J,ie;t[63]===a.connectHint?ie=t[64]:(ie=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ie);let ae=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(Qr),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==ae||t[68]!==se?(ce=(0,$.jsx)(H,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Zr),t[70]=le):le=t[70];let Y=c?a.hideCompleted:a.showCompleted,ue;t[71]!==u||t[72]!==c||t[73]!==Y?(ue=(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:Y}),t[71]=u,t[72]=c,t[73]=Y,t[74]=ue):ue=t[74];let de=N?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:te,children:[(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,fe;t[75]!==a.removeDependency||t[76]!==re||t[77]!==m?(fe=m?(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:re,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=re,t[77]=m,t[78]=fe):fe=t[78];let pe;t[79]!==ce||t[80]!==ue||t[81]!==de||t[82]!==fe?(pe=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,ue,de,fe]}),t[79]=ce,t[80]=ue,t[81]=de,t[82]=fe,t[83]=pe):pe=t[83];let he;t[84]!==ie||t[85]!==pe?(he=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[ie,pe]}),t[84]=ie,t[85]=pe,t[86]=he):he=t[86];let ge=S.length>0?(0,$.jsxs)(`div`,{className:w(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,$.jsxs)(Z,{nodes:L,edges:z,nodeTypes:Jr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>g(t.id),onConnect:ne,onPaneClick:()=>{p(void 0),g(void 0)},onInit:e=>{v.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Rn,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(In,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,$.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,$.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(Xr)})]}):null,(0,$.jsxs)(s,{to:_(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,$.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),_e;return t[87]!==he||t[88]!==ge?(_e=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[he,ge]}),t[87]=he,t[88]=ge,t[89]=_e):_e=t[89],_e}function Xr(e){return(0,$.jsx)(`li`,{children:e.title},e.id)}function Zr(e){return!e}function Qr(e){return!e}function $r(e){return e.dependencyTaskId}function ei(e){return e.dependencyTaskId}function ti(e){return[e.id,e]}function ni(e){return e.id}function ri(e){return e.phase!==`closed`}function ii(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var ai={backlog:Qt,ready:Qt,active:at,review:Xe,closed:f},oi={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function si(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function ci(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function li(e){let t=(0,Vn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,p,m,h,g,v,y,b,x,S,C,T,E,D,O;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(h=Vr(n),g=h!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,p=n.phase===`closed`,m=!!(n.dueAt&&n.dueAt<Date.now()&&!p),d=p?f:nt,y=n.priority!==`normal`,v=y||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,S=!0,t[20]!==c||t[21]!==n.id?(C=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=C):C=t[22],t[23]===c?T=t[24]:(T=()=>c(``),t[23]=c,t[24]=T),E=di,t[25]!==l||t[26]!==n.id?(D=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=D):D=t[27],O=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(b=_(r,n.id),t[28]=r,t[29]=n.id,t[30]=b):b=t[30],x=w(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,g?`pr-19`:h&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=T,t[17]=E,t[18]=D,t[19]=O):(u=t[4],d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],T=t[16],E=t[17],D=t[18],O=t[19]);let k=p?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,A;t[31]===k?A=t[32]:(A=w(`mt-0.5 size-4 shrink-0`,k),t[31]=k,t[32]=A);let j;t[33]!==d||t[34]!==A?(j=(0,$.jsx)(d,{className:A,"aria-hidden":!0}),t[33]=d,t[34]=A,t[35]=j):j=t[35];let M=p?`text-fg-subtle`:`text-fg`,N;t[36]===M?N=t[37]:(N=w(`min-w-0 break-words text-sm font-semibold leading-5`,M),t[36]=M,t[37]=N);let P;t[38]!==N||t[39]!==n.title?(P=(0,$.jsx)(`h3`,{className:N,children:n.title}),t[38]=N,t[39]=n.title,t[40]=P):P=t[40];let F;t[41]!==j||t[42]!==P?(F=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[j,P]}),t[41]=j,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(I=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,$.jsx)(wt,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ui).join(`、`)})]}):n.attention[0]?(0,$.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(At,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=I):I=t[48];let L;t[49]!==i||t[50]!==m||t[51]!==v||t[52]!==y||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(L=v?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[y?(0,$.jsx)(`span`,{className:w(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,$.jsx)(`span`,{className:w(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,si(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,$.jsx)(`span`,{className:w(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,ci(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,$.jsx)(at,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,$.jsxs)(`span`,{className:w(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,m?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,$.jsx)(It,{className:`size-3`,"aria-hidden":!0}),Se(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,$.jsx)(It,{className:`size-3`,"aria-hidden":!0}),Se(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=m,t[51]=v,t[52]=y,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=L):L=t[59];let R;t[60]!==u||t[61]!==b||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==x?(R=(0,$.jsxs)(u,{to:b,className:x,children:[F,I,L]}),t[60]=u,t[61]=b,t[62]=F,t[63]=I,t[64]=L,t[65]=x,t[66]=R):R=t[66];let z;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==h||t[71]!==g||t[72]!==n?(z=h?(0,$.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[g?(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[g],title:i.actions[g],children:(0,$.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=h,t[71]=g,t[72]=n,t[73]=z):z=t[73];let B;return t[74]!==R||t[75]!==z||t[76]!==S||t[77]!==C||t[78]!==T||t[79]!==E||t[80]!==D||t[81]!==O?(B=(0,$.jsxs)(`article`,{draggable:S,onDragStart:C,onDragEnd:T,onDragOver:E,onDrop:D,className:O,children:[R,z]}),t[74]=R,t[75]=z,t[76]=S,t[77]=C,t[78]=T,t[79]=E,t[80]=D,t[81]=O,t[82]=B):B=t[82],B}function ui(e){return e.title}function di(e){e.preventDefault(),e.stopPropagation()}function fi({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:d,ref:f}){let p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(`board`),[T,E]=(0,Q.useState)(!1),[D,k]=(0,Q.useState)(()=>crypto.randomUUID()),[j,R]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(`normal`),[V,U]=(0,Q.useState)(``),[ee,W]=(0,Q.useState)([]),[G,K]=(0,Q.useState)(!1),[te,q]=(0,Q.useState)(null),ne=O(e=>e.language),J=Ke({chat:C(ne).chat}),re=zr(e),ie=e.filter(e=>e.phase!==`closed`),ae=(e,t)=>void i(e,t),oe=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let o=re[r.phase],s=o.findIndex(e=>e.id===r.id),c=s>=0?o[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Br(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c,resolution:r.resolution})},se=async e=>{e.preventDefault();let t=j.trim();if(!(!t||G)){K(!0),q(null);try{let e=V?new Date(`${V}T23:59:59.999`).getTime():void 0;await c({requestId:D,objective:t,priority:z,dependsOnTaskIds:ee,attachments:J.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),k(crypto.randomUUID()),E(!1)}catch(e){q(e instanceof Error?e.message:r.createFailed)}finally{K(!1)}}},ce=()=>{k(crypto.randomUUID()),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),q(null),E(!0)};(0,Q.useImperativeHandle)(f,()=>({openCreate:ce})),(0,Q.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[y]);let le=(0,Q.useCallback)(e=>{let t=m.current;!t||t.pointerId!==e.pointerId||(m.current=null,v(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),Y=(0,Q.useCallback)(e=>{if(e.button!==0||ii(e.target))return;let t=p.current;t&&(m.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),ue=(0,Q.useCallback)(e=>{let t=m.current,n=p.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,v(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,$.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,$.jsxs)(be,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:w(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(xt,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:w(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(gn,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,$.jsx)(`div`,{ref:p,className:w(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,_?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:Y,onPointerMove:ue,onPointerUp:le,onPointerCancel:le,onLostPointerCapture:e=>{m.current?.pointerId===e.pointerId&&(m.current=null,v(!1))},children:(0,$.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Rr.map(t=>{let i=ai[t],a=re[t];return(0,$.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Br(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),oe(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-inset/70 p-2.5`,children:[(0,$.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,$.jsxs)(`div`,{className:w(`flex items-center gap-1.5 rounded-md px-2 py-1`,oi[t]),children:[(0,$.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,$.jsx)(li,{task:e,returnTo:n,copy:r,busy:d===e.id,onAction:ae,onDragStart:g,onDropBefore:e=>void oe(t,e)},e.id))})})]},t)})})}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,$.jsx)(Yr,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,$.jsx)(L,{open:T,onOpenChange:e=>{G||E(e)},children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,$.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,$.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void se(e),children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,$.jsxs)(`div`,{className:w(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,J.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),G||J.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||J.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),J.setIsDragging(!1),G||J.processFiles(Array.from(e.dataTransfer.files))},children:[(0,$.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:j,onChange:e=>{R(e.target.value),q(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,$.jsx)(en,{attachments:J.attachments,topPadded:!1,onRemove:e=>{G||J.removeAttachment(e)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>J.fileInputRef.current?.click(),children:[(0,$.jsx)(Ze,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,$.jsx)(`input`,{ref:J.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{J.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,$.jsx)(l,{value:z,onChange:e=>B(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,$.jsx)(u,{value:e,children:r.priorityOptions[e]},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(Tn,{className:`min-h-10 bg-surface-base`,value:V,onChange:U,disabled:G,ariaLabel:r.dueDate})]})]}),(0,$.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,$.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,$.jsx)(Bn,{candidates:ie,selectedIds:ee,disabled:G,onChange:W,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),te?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:te}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:r.cancel})}),(0,$.jsx)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!j.trim(),children:G?r.creating:ne===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),y?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:r.moved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=y;b(null),o(e.taskId,e.phase,e.beforeTaskId,e.resolution).then(t=>{t||b(e)})},children:r.undo})]}):null]})}var pi=new Set([{id:`overview`,icon:Zt},{id:`tasks`,icon:oe},{id:`automations`,icon:Dt},{id:`files`,icon:dn},{id:`notes`,icon:pe},{id:`skills`,icon:Qe},{id:`sessions`,icon:Ae},{id:`progress`,icon:Kt},{id:`settings`,icon:rt}].map(e=>e.id)),mi=`xopc.projectFiles.panelWidthPx`,hi=320,gi=220,_i=560;function vi(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function yi(e){return Math.min(_i,Math.max(gi,Math.round(e)))}function bi(){try{let e=window.localStorage.getItem(mi);if(e==null)return hi;let t=Number.parseInt(e,10);return Number.isFinite(t)?yi(t):hi}catch{return hi}}function xi(e){try{window.localStorage.setItem(mi,String(yi(e)))}catch{}}function Si(e){return!!(e&&pi.has(e))}function Ci(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function wi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Se(n)}function Ti(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-inset text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Ei(e){let t=(0,Vn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,$.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Di(e=!1){return w(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Oi(e){let t=(0,Vn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=w(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,$.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,$.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function ki(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Ai(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function ji(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Mi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Ni(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.conversationId?t.conversationId:t.kind}function Pi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Fi(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Ii(e){let t=e.sourceChannel?.trim();return t?Li(t):``}function Li(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ri(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function zi(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Bi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Bi(e.children,t,n)}:e)}function Vi({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)([e]),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(`new`),[S,C]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(!1),[k,j]=(0,Q.useState)(!0),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(null),U=(0,Q.useCallback)(async()=>{m(!0),g(null);try{let t=await qe({limit:100});u(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,Q.useEffect)(()=>{u(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Q.useEffect)(()=>{o&&U()},[U,o]);let ee=(0,Q.useMemo)(()=>{let t=d.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=ki(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Ai(t)-Ai(e))},[e.id,l,d]),W=e=>t.statuses[e.status]??e.status,q=e=>e.description||e.brief||t.common.defaultWorkspace,J=e=>{b(e),C(``),E(``),z(null),v(!0),s(!1)},re=(0,Q.useCallback)(async(e={})=>{let t=T.trim(),n=S.trim()||(y===`directory`?ji(t):``);if(n){O(!0),z(null),V(null);try{let r=await Pt({autoUnderstand:k,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),C(``),E(``),j(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),u(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Mi(e);t?(V(t),v(!1)):z(e instanceof Error?e.message:String(e))}finally{O(!1)}}},[y,S,a,T,k]),ie=(0,Q.useCallback)(e=>{e.preventDefault(),re()},[re]),ae=(0,Q.useCallback)(()=>{re({createWorkspaceRoot:!0})},[re]),oe=(0,Q.useCallback)(()=>{V(null),v(!0)},[]),se=e=>{E(e),y===`directory`&&!S.trim()&&C(ji(e))},ce=(e,t)=>(0,$.jsxs)(`button`,{type:`button`,className:w(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,$.jsx)(c,{className:w(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:q(e)})]}),(0,$.jsx)(`span`,{className:w(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:W(e)})]},e.id);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(te,{open:o,onOpenChange:s,children:[(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:w(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:W(e)})]}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:q(e)})]}),(0,$.jsx)(Yt,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,$.jsx)(G,{children:(0,$.jsxs)(K,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(Ct,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:d,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,$.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ce(e,!0),(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,$.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&ee.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&ee.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,ee.map(e=>ce(e,!1))]}),(0,$.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>J(`new`),children:[(0,$.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>J(`directory`),children:[(0,$.jsx)(dn,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),a(`/projects`)},children:[(0,$.jsx)(rt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,$.jsx)(L,{open:_,onOpenChange:e=>!D&&v(e),children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:y===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,$.jsx)(M,{className:`mt-1 text-sm text-fg-muted`,children:y===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,$.jsxs)(`form`,{onSubmit:ie,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[R?(0,$.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:R}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,$.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:S,onChange:e=>C(e.target.value),placeholder:`xopc`})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,$.jsx)(xn,{value:T,onChange:se,disabled:D,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,$.jsx)(ue,{checked:k,onChange:j,disabled:D})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:D,children:n.cancel})}),(0,$.jsxs)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:D||!(S.trim()||y===`directory`&&ji(T)),children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,$.jsx)(L,{open:!!B,onOpenChange:e=>{e||V(null)},children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,$.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:B?Ci(n.workspaceMissingDescription,{workspace:B}):null})]}),B?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(dn,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:B})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oe,disabled:D,children:n.workspaceMissingBack}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ae,disabled:D,children:[(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Hi(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),d=O(e=>e.language),f=C(d),m=f.chat.workingDirectory,h=f.projectDetailPage,g=f.projectsPage,T=Gt(e=>e.setPageHeader),E=Gt(e=>e.clearPageHeader),[D,k]=(0,Q.useState)(null),j=(0,Q.useRef)(D);(0,Q.useLayoutEffect)(()=>{j.current=D},[D]);let[V,G]=(0,Q.useState)(null),[K,te]=(0,Q.useState)([]),[q,ne]=(0,Q.useState)(``),[J,ie]=(0,Q.useState)([]),[se,le]=(0,Q.useState)(0),[Y,ue]=(0,Q.useState)(!1),[de,me]=(0,Q.useState)(!1),[ge,ve]=(0,Q.useState)(!1),[be,xe]=(0,Q.useState)([]),[Se,Ce]=(0,Q.useState)(null),Te=(0,Q.useRef)(new Set),[Ee,De]=(0,Q.useState)(null),[ke,je]=(0,Q.useState)(null),[Fe,Le]=(0,Q.useState)(null),[Ve,Ue]=(0,Q.useState)(bi),[We,Ke]=(0,Q.useState)(!1),[qe,Je]=(0,Q.useState)(!1),[Xe,Ze]=(0,Q.useState)(``),[nt,at]=(0,Q.useState)([]),[ot,st]=(0,Q.useState)(!1),[lt,ft]=(0,Q.useState)(null),[pt,_t]=(0,Q.useState)(!1),[vt,yt]=(0,Q.useState)(null),[xt,wt]=(0,Q.useState)([]),[Tt,kt]=(0,Q.useState)(``),[Pt,Ft]=(0,Q.useState)(!0),[It,zt]=(0,Q.useState)(!1),[Bt,Vt]=(0,Q.useState)(!1),[Ut,Yt]=(0,Q.useState)(null),[Qt,en]=(0,Q.useState)(!1),[nn,rn]=(0,Q.useState)(`fixed`),[sn,ln]=(0,Q.useState)(``),[un,pn]=(0,Q.useState)(null),[mn,hn]=(0,Q.useState)(!1),[gn,_n]=(0,Q.useState)(!1),[Sn,Cn]=(0,Q.useState)(!1),[wn,Tn]=(0,Q.useState)(null),Dn=(0,Q.useRef)(null),On=(0,Q.useRef)(!1),[kn,X]=(0,Q.useState)(null),[jn,Mn]=(0,Q.useState)({title:``,reason:``}),[Nn,Pn]=(0,Q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),Fn=(0,Q.useRef)(Nn),In=`overview`,Z=n?`notes`:Si(t)?t:In,Ln=(0,Q.useMemo)(()=>b(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Rn=(0,Q.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Ln===`/projects`?n:v(n,Ln)},[Ln,e]),zn=(0,Q.useCallback)(t=>{e&&r(Rn(t))},[r,e,Rn]),Bn=(0,Q.useCallback)(()=>{if(Z===`tasks`&&Dn.current){Dn.current.openCreate();return}On.current=!0,zn(`tasks`)},[zn,Z]);(0,Q.useEffect)(()=>{Z!==`tasks`||!On.current||(On.current=!1,Dn.current?.openCreate())},[Z]);let Vn=(0,Q.useCallback)(t=>{e&&r(Rn(t),{replace:!0})},[r,e,Rn]),Hn=(0,Q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Vn(e)},[Vn]),Un=(0,Q.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Z,[Z]);(0,Q.useEffect)(()=>{!e||!t||Si(t)||r(Rn(In),{replace:!0})},[In,r,e,Rn,t]),(0,Q.useEffect)(()=>{if(!e)return;let t=!1;return Ft(!0),X(null),Promise.all([Ie(e),_e(e),Pe(e),W().catch(()=>null),Oe(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;k(e),G(n),te(r),Ce(a),wt(i?.agents??[]),kt(e.defaultAgentId??``);let o=Mr(e);Fn.current=o,Pn(o)}).catch(e=>{t||(Ce(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Ft(!1)}),()=>{t=!0}},[e]);let Wn=(0,Q.useCallback)(async()=>{e&&G(await _e(e))},[e]);(0,Q.useEffect)(()=>{if(Pt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([Ie(e),_e(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=j.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=Nr(Fn.current,i,e);Fn.current=t,Pn(t)}j.current=e,k(e),G(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(k(null),G(null),X(e.message))})};return window.addEventListener(`project-resource-changed`,r),r(new Event(`project-resource-changed`)),()=>{t=!1,window.removeEventListener(`project-resource-changed`,r)}},[e,Pt]),(0,Q.useEffect)(()=>{let t,n=n=>{let r=z.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),120))},r=n=>{let r=R.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,Wn]);let Gn=(0,Q.useCallback)(async(e,t)=>{Tn(e.id),X(null);try{let n=await Ge(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 it(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 Ne(e.id,r,n.task.version,void 0,`board`),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{Tn(null)}},[V,h.board.actionFailed,Wn]),Kn=(0,Q.useCallback)(async t=>{e&&(X(null),await qt({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:d,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await Wn())},[d,e,Wn]),qn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{return await ht(e,t,(await Ge(e)).task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{Tn(null)}},[h.board.actionFailed,Wn]),Jn=(0,Q.useCallback)(async(e,t,n,r)=>{Tn(e),X(null);try{let i=await Ge(e);return i.task.phase!==t&&(i=await Ne(e,{type:`move`,phase:t,...t===`closed`&&r?{resolution:r}:{}},i.task.version,void 0,`undo`)),await ht(e,n,i.task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{Tn(null)}},[h.board.actionFailed,Wn]),Yn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{await Lt(e,t,(await Ge(e)).task.version),await Wn()}catch(e){await Wn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed)}finally{Tn(null)}},[h.board.actionFailed,Wn]),Xn=(0,Q.useCallback)(async()=>{if(D){ue(!0),X(null);try{let e=await Re(D.id,{includeRelated:de,limit:100});ie(e.items),le(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{ue(!1)}}},[D,de]);(0,Q.useEffect)(()=>{Z===`progress`&&Xn()},[Xn,Z]);let Zn=(0,Q.useCallback)(async()=>{if(!D?.effectiveWorkspaceRoot?.trim()){xe([]),Te.current.clear(),yt(null);return}_t(!0),yt(null),Te.current.clear();try{xe(zi((await He(D.id,``)).entries)),Te.current.add(``)}catch(e){xe([]),Te.current.clear(),yt(e instanceof Error?e.message:String(e))}finally{_t(!1)}},[D]),Qn=(0,Q.useCallback)(async e=>{if(!(!D?.effectiveWorkspaceRoot?.trim()||Te.current.has(e))){Te.current.add(e),yt(null);try{let t=await He(D.id,e);xe(n=>Bi(n,e,zi(t.entries)))}catch(t){Te.current.delete(e),yt(t instanceof Error?t.message:String(t))}}},[D]),$n=(0,Q.useCallback)(async e=>{if(!D?.effectiveWorkspaceRoot?.trim())return;let t=zi((await He(D.id,e)).entries);xe(e?n=>Bi(n,e,t):t),Te.current.add(e)},[D]);(0,Q.useEffect)(()=>{Z===`files`&&Zn()},[Zn,Z]);let er=Xe.trim();(0,Q.useEffect)(()=>{if(Z!==`files`||!D||!qe||!er){at([]),st(!1),ft(null);return}let e=!1;st(!0),ft(null),at([]);let t=window.setTimeout(()=>{we(D.id,er,50).then(t=>{e||at(t)}).catch(t=>{e||ft(t instanceof Error?t.message:String(t))}).finally(()=>{e||st(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[er,D,qe,Z]);let tr=(0,Q.useCallback)(async()=>{if(!D)return;let[e,t]=await Promise.all([Ie(D.id),_e(D.id)]);G(t),k(e)},[D]),nr=(0,Q.useCallback)(async e=>{if(e.preventDefault(),!(!D||!jn.title.trim())){_n(!0),X(null);try{await ae(D.id,{title:jn.title.trim(),reason:jn.reason.trim()||void 0}),Mn({title:``,reason:``}),Cn(!1),await tr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{_n(!1)}}},[jn.reason,jn.title,D,tr]),rr=(0,Q.useMemo)(()=>(0,$.jsx)(s,{to:Ln,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ln===`/projects`?h.backToProjects:f.sidebar.back,children:(0,$.jsx)(on,{className:`size-4`,"aria-hidden":!0})}),[Ln,f.sidebar.back,h.backToProjects]),ir=(0,Q.useMemo)(()=>D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{resource:{kind:`project`,id:D.id,revision:String(D.version)},disabled:It||vi(Nn,D)}),(0,$.jsx)(yr,{projectId:D.id},D.id),(0,$.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Bn,children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),h.board.create]}),(0,$.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:fn(D.id),state:{forceNewChat:!0,agentId:D.defaultAgentId},onClick:Hn(`sessions`),children:[(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),h.common.newChat]})})]}):null,[Bn,Hn,h.board.create,h.common.newChat,D,It,Nn]);(0,Q.useLayoutEffect)(()=>(T({startExtra:rr,main:D?(0,$.jsx)(Vi,{currentProject:D,pm:h,projectsText:g,wd:m}):(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h.fallbackTitle}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:h.fallbackContext})]}),end:ir}),()=>E()),[E,ir,rr,h,D,g,T,m]);function ar(e){k(t=>t?{...t,...e}:null),kt(e.defaultAgentId??``),Oe(e.id).then(Ce).catch(()=>Ce(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function or(e=Fn.current){if(!(!D||!vi(e,D))){X(null),Yt(null);try{let t=await tt(D.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},D.version);ar(t);let n=Fn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Fn.current=r,Pn(r)}catch(e){let t=Mi(e);throw t?Yt(t):X(e instanceof Error?e.message:String(e)),e}}}function sr(e){e.preventDefault(),Tr.flush()}function cr(e,t=!1){let n={...Fn.current,...e};Fn.current=n,Pn(n),t&&Tr.saveNow(n)}let lr=(0,Q.useCallback)(()=>{if(!D)return;let e=D.workspaceRoot?.trim()??``;rn(e?`fixed`:`follow`),ln(e||D.effectiveWorkspaceRoot||``),en(!0)},[D]);async function ur(e={}){if(!D)return;let t=nn===`fixed`?sn.trim():``;if(!(nn===`fixed`&&!t)){zt(!0),X(null),Yt(null);try{let n=await tt(D.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},D.version);ar(n),cr({workspaceRoot:n.workspaceRoot??``}),en(!1),Yt(null)}catch(e){let t=Mi(e);t?(Yt(t),en(!1)):X(e instanceof Error?e.message:String(e))}finally{zt(!1)}}}async function dr(){if(!(!D||un)){pn(`pin`),X(null);try{ar(D.pinnedAt?await $e(D.id,D.version):await vn(D.id,D.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{pn(null)}}}async function fr(){if(!(!D||un)){pn(`archive`),X(null);try{let e=D.status===`archived`?await ce(D.id,D.version):await Be(D.id,D.version);ar(e),cr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{pn(null)}}}async function pr(){if(D){hn(!0),X(null);try{await Mt(D.id,D.version),Vt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{hn(!1)}}}async function mr(){if(!(!D||ge)){ve(!0),X(null);try{await et(D.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{ve(!1)}}}let hr=(0,Q.useCallback)(e=>{De(e)},[]),gr=(0,Q.useCallback)((e,t)=>{t||De(e)},[]),vr=(0,Q.useCallback)(async(e,t,n)=>{let r=D?.id;if(r)switch(e){case`preview`:t.isDirectory||De(t.path);break;case`download`:if(t.isDirectory)return;try{let e=$t(t.path);if(Jt(St(e))!==`text`){let n=await Xt(t.path,{projectId:r}),i=ee(e)??`application/octet-stream`;ut(e,await n.arrayBuffer(),i)}else{let{content:n}=await gt(t.path,{projectId:r});Wt(e,n)}}catch(e){Me(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await B(t.path)&&Me(`success`,f.workspace.pathCopied,void 0,{duration:2500})}catch{Me(`warning`,f.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await Nt(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWith`:await Nt(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await Nt(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),f.workspace.openFileFailed);break;case`revealInFolder`:await Nt(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),f.workspace.revealFileFailed);break;case`trash`:je(t);break;case`delete`:t.isDirectory||Le(t);break;default:break}},[f.clipboard.copyFailed,f.workspace.openFileFailed,f.workspace.pathCopied,f.workspace.revealFileFailed,D?.id]),br=(0,Q.useCallback)(async()=>{let e=ke;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){Me(`warning`,t?.error??f.workspace.trashFailed,void 0,{duration:4e3});return}Ee===e.path&&De(null),je(null),await Zn(),Me(`success`,f.workspace.trashSuccess,void 0,{duration:2500})},[f.workspace.trashFailed,f.workspace.trashSuccess,ke,Ee,Zn]),xr=(0,Q.useCallback)(async(e,t)=>{let n=D?.id;if(n)try{await Promise.all(e.map(e=>Rt(e,t,{projectId:n}))),await $n(t).catch(()=>void 0),Me(`success`,f.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await $n(t).catch(()=>void 0),Me(`warning`,`${f.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.uploadFailed,f.workspace.uploadSuccess,D?.id,$n]),Sr=(0,Q.useCallback)(async()=>{let e=Fe;if(e)try{await jt(e.fileId),Ee===e.path&&De(null),Le(null);let t=e.path.lastIndexOf(`/`);await $n(t<0?``:e.path.slice(0,t)).catch(()=>void 0),Me(`success`,f.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){Me(`warning`,`${f.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.deleteFailed,f.workspace.deleteSuccess,Fe,Ee,$n]),Cr=(0,Q.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Ke(!0);let r=e.clientX,i=Ve,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=yi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ke(!1),Ue(c),xi(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Ve]);(0,Q.useEffect)(()=>{Z!==`files`&&De(null)},[e,Z]);let wr=!!(D&&vi(Nn,D)),Tr=bn({value:D?Nn:null,dirty:wr,onSave:or,validate:e=>e.name.trim()?null:h.settings.nameRequired});if(Pt)return(0,$.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:h.loading});if(!D)return(0,$.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsxs)(s,{to:Ln,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,$.jsx)(on,{className:`size-4`,"aria-hidden":!0}),Ln===`/projects`?h.backToProjects:f.sidebar.back]}),(0,$.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:kn||h.notFound})]});let Er=K.slice(0,3),Or=V?.blockers??[],kr=Lr(V?.tasks??[]),Ar=V?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,jr=e=>h.statuses[e]??e,Pr=e=>Ci(h.common.messages,{count:e}),Fr=q.trim().toLowerCase(),Ir=Fr?K.filter(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=e.name?.trim()||h.sessions.fallbackTitle,i=Pr(e.messageCount??0),a=Ii(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Fr)}):K,Rr=K.length>0&&Ir.length===0,zr=xt.find(e=>e.id===D.defaultAgentId)?.name||D.defaultAgentId||h.settings.globalDefaultAgent,Br=xt.find(e=>e.id===Nn.defaultAgentId),Vr=D.workspaceRoot?.trim()||``,Hr=D.status===`archived`,Ur=!!D.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||D.effectiveWorkspaceRoot||h.common.defaultWorkspace,Kr=nn===`fixed`?sn.trim()||h.settings.workspacePlaceholder:Br?.workspace||D.effectiveWorkspaceRoot||h.common.defaultWorkspace,qr=(nn===`fixed`?sn.trim():``)!==Vr&&(nn===`follow`||!!sn.trim()),Jr=[{id:`overview`,icon:Zt,label:h.tabs.overview},{id:`tasks`,icon:oe,label:h.tabs.tasks},{id:`automations`,icon:Dt,label:h.tabs.automations},{id:`files`,icon:dn,label:h.tabs.files},{id:`notes`,icon:pe,label:h.tabs.notes},{id:`skills`,icon:Qe,label:h.tabs.skills},{id:`sessions`,icon:Ae,label:h.tabs.sessions},{id:`progress`,icon:Kt,label:h.tabs.progress}];async function Yr(){if(!Gr)return;let e=await B(Gr);Me(e?`success`:`warning`,e?f.workspace.pathCopied:f.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){Yt(null),en(!0)}return(0,$.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsx)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:(0,$.jsx)(mt,{items:[...Jr,{id:`settings`,icon:rt,label:h.tabs.settings,suffix:wr?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":h.settings.unsavedChanges}):void 0}],activeTab:Z,onChange:zn,ariaLabel:h.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`})}),kn?(0,$.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:kn}):null,(0,$.jsxs)(`div`,{className:w(`mt-3 min-h-0 flex-1`,Z===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Z===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Z===`overview`?(0,$.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,$.jsx)(cn,{projectId:D.id},D.id),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.directionTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ci(h.overview.activitySummary,{moving:Ar,attention:Or.length})})]}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:D.outcome||D.description||D.brief||h.overview.directionFallback}),V?.digest.recommendedAction?(0,$.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:Ci(h.overview.recommendedNext,{action:V.digest.recommendedAction})}):null]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void mr(),disabled:ge,children:[(0,$.jsx)(Ht,{className:`size-3.5`,"aria-hidden":!0}),ge?h.overview.savingDigest:h.overview.saveDigest]})]})}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.nextActions}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>zn(`tasks`),children:h.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:kr.length?kr.map(e=>(0,$.jsxs)(s,{to:_(Rn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsxs)(`span`,{className:w(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.attention.length?`bg-warning/10 text-warning`:`bg-surface-hover text-fg-muted`),children:[h.board.phases[e.phase],e.operationalState===`idle`?``:` · ${h.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noNextActions})})]})]}),V?.recentResults.length?(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.recentResults})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:V.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,$.jsxs)(s,{to:_(Rn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[h.overview.resultStatuses[n.status],` · `,h.board.verification[n.verification.status]]})]}),(0,$.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,$.jsx)(y,{content:n.summary,compact:!0})})]},n.runId))})]}):null,D.milestones.length||D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[D.milestones.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.milestones})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.milestones.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:h.statuses[e.status]})]},e.id))})]}):null,D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.projectUpdates})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.recentUpdates.slice(0,3).map(e=>(0,$.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,$.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.attention}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Sn,onClick:()=>Cn(e=>!e),children:[(0,$.jsx)(x,{className:w(`size-3.5 transition-transform`,Sn&&`rotate-45`),"aria-hidden":!0}),h.overview.addBlocker]})]}),Or.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Or.map(e=>{let t=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(At,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,$.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[h.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${jr(e.status)}`:``]})]});return e.href?(0,$.jsx)(s,{to:e.href,onClick:Hn(Un(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,$.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h.overview.noBlockedTasks}),Sn?(0,$.jsxs)(`form`,{onSubmit:nr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:jn.title,onChange:e=>Mn(t=>({...t,title:e.target.value})),placeholder:h.overview.blockerTitlePlaceholder}),(0,$.jsx)(H,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:gn||!jn.title.trim(),"aria-label":gn?h.overview.addingBlocker:h.overview.addBlocker,title:gn?h.overview.addingBlocker:h.overview.addBlocker,children:(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(ye,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:h.overview.recentSessions})]}),(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>zn(`sessions`),children:h.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Er.length?Er.map(e=>(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:wi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==D.defaultAgentId?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noSessions})})]})]})]}):null,Z===`tasks`?(0,$.jsx)(fi,{ref:Dn,tasks:V?.tasks??[],dependencyEdges:V?.dependencyEdges??[],returnTo:Rn(`tasks`),copy:h.board,onAction:Gn,onReorder:qn,onUndoMove:Jn,onDependenciesChange:Yn,onCreate:Kn,actionBusyId:wn}):null,Z===`automations`?(0,$.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,$.jsx)(En,{projectId:D.id,embedded:!0,title:h.automations.title,subtitle:h.automations.hint})}):null,Z===`notes`?(0,$.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,$.jsx)(_r,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(D.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:D.id,listTitle:h.notes.title,listDescription:h.notes.hint,emptyText:h.notes.emptyTitle,emptyDescription:h.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${D.id}`})}):null,Z===`skills`?(0,$.jsx)(Dr,{projectId:D.id,copy:h.skills}):null,Z===`files`?(0,$.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:D.effectiveWorkspaceRoot?(0,$.jsxs)(`div`,{"data-project-files-grid":!0,className:w(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,We&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Ve}px`},children:[(0,$.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[Se?(0,$.jsx)(fe,{resourceId:Se.fileId,displayName:Se.name}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:w(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,qe&&`bg-surface-hover text-fg`),onClick:()=>Je(!0),"aria-label":h.files.search,title:h.files.search,"aria-pressed":qe,children:(0,$.jsx)(Ct,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(bt,{className:`size-7 shrink-0 rounded-md p-0`,loading:pt,label:f.cron.refresh,onClick:()=>void Zn()})]})]}),qe?(0,$.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md bg-surface-base px-2 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,$.jsx)(Ct,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`text`,role:`searchbox`,value:Xe,onChange:e=>Ze(e.target.value),placeholder:h.files.searchPlaceholder,"aria-label":h.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":h.files.clearSearch,title:h.files.clearSearch,onClick:()=>{Ze(``),Je(!1)},children:(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,vt?(0,$.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:vt}):null,er?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:ot?(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,$.jsx)(U,{className:`h-11 w-full`}),(0,$.jsx)(U,{className:`h-11 w-full`}),(0,$.jsx)(U,{className:`h-11 w-full`})]}):lt?(0,$.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[f.workspace.loadError,`: `,lt]}):nt.length===0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:h.files.noSearchResults}):nt.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:w(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Ee===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>De(e.path),title:e.path,children:[(0,$.jsx)(pe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):pt&&be.length===0?(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.files.loading}):(0,$.jsx)(tn,{tree:be,selectedPath:Ee,onSelectFile:hr,onSelectEntry:gr,onExpandDir:e=>void Qn(e),onAction:vr,onUploadFiles:(e,t)=>void xr(e,t),uploadDropHint:f.workspace.dropToUpload,actionLabels:{preview:f.workspace.preview,download:f.workspace.download,copyPath:f.workspace.copyPath,openDefault:f.workspace.openSystemApp,openDirectory:f.workspace.openInFileManager,openWith:f.workspace.openWith,revealInFolder:f.workspace.revealInFolder,trash:f.workspace.moveToTrash,delete:f.workspace.deleteFile,recommendedApps:f.workspace.recommendedApps,desktopUpdateRequired:f.workspace.desktopUpdateRequired},emptyHint:h.files.emptyDirectory})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.files.resizeHandle,className:w(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,We&&`bg-surface-hover/70`),onPointerDown:Cr,children:(0,$.jsx)(`div`,{className:w(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,We&&`bg-accent/60`)})}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Ee?(0,$.jsx)(an,{filePath:Ee,projectId:D.id,agentId:D.defaultAgentId||Tt||void 0,onClose:()=>De(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(dn,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h.files.previewEmptyTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.files.previewEmptyDescription})]})})})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:h.files.needWorkspace}),(0,$.jsx)(`div`,{children:(0,$.jsx)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>zn(`settings`),children:h.files.openSettings})})]})})}):null,Z===`sessions`?(0,$.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[K.length?(0,$.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,$.jsx)(Ct,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:q,onChange:e=>ne(e.currentTarget.value),placeholder:h.sessions.searchPlaceholder,"aria-label":h.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),q?(0,$.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":h.sessions.clearSearch,onClick:()=>ne(``),children:(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Ir.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Ir.map(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=Ii(e),i=e.name?.trim()||h.sessions.fallbackTitle,a=Pr(e.messageCount??0);return(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,$.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,$.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.agent,`: `,n]}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,$.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.noMatches})}):(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.emptyTitle}),(0,$.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:h.sessions.emptyDescription})]})})]}):null,Z===`progress`?(0,$.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.progress.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Ci(h.progress.count,{count:se})})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:de,onChange:e=>me(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),h.progress.includeRelated]}),(0,$.jsxs)(H,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Xn(),disabled:Y,children:[(0,$.jsx)(dt,{className:w(`size-4`,Y&&`animate-spin`),"aria-hidden":!0}),h.common.refresh]})]})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Y&&J.length===0?(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.loading}):J.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge`,children:J.map(e=>{let t=h.progress.types[e.type]??e.type,n=h.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ri(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===D.id);return(0,$.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:h.progress.related}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Pi(e)]})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:wi(e.createdAt)})]}),r?(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[h.progress.actor,`: `,Ni(e)]}),(0,$.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.progress.source,`: `,Fi(e)]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.empty})})]}):null,Z===`settings`?(0,$.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:sr,onBlurCapture:Tr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,$.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.summaryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:h.settings.summaryHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,$.jsx)(`span`,{className:w(`rounded-full px-2 py-0.5 text-xs font-medium`,Ti(Nn.status)),children:h.settings.statuses[Nn.status]}),(0,$.jsx)(yn,{status:Tr.status,error:Tr.error})]})]}),(0,$.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.detailsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.detailsHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsx)(Ei,{label:h.settings.name,children:(0,$.jsx)(`input`,{className:Di(),value:Nn.name,onChange:e=>cr({name:e.target.value})})}),(0,$.jsx)(Ei,{label:h.settings.defaultAgent,children:(0,$.jsxs)(l,{className:Di(),value:Nn.defaultAgentId,onChange:e=>cr({defaultAgentId:e.target.value},!0),children:[(0,$.jsx)(u,{value:``,children:h.settings.globalDefaultAgent}),xt.map(e=>(0,$.jsx)(u,{value:e.id,children:re(e,f.agentsSettings)},e.id))]})}),(0,$.jsx)(Ei,{label:h.settings.status,children:Hr?(0,$.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-inset px-3 text-sm text-fg-muted`,children:h.settings.statuses.archived}):(0,$.jsxs)(l,{className:Di(),value:Nn.status===`archived`?`active`:Nn.status,onChange:e=>cr({status:e.target.value},!0),children:[(0,$.jsx)(u,{value:`active`,children:h.settings.statuses.active}),(0,$.jsx)(u,{value:`paused`,children:h.settings.statuses.paused})]})}),(0,$.jsx)(Ei,{label:h.settings.executionMode,hint:h.settings.executionModeHint,children:(0,$.jsxs)(l,{className:Di(),value:Nn.executionMode,onChange:e=>cr({executionMode:e.target.value},!0),children:[(0,$.jsx)(u,{value:`managed_worktree`,children:h.settings.executionModeWorktree}),(0,$.jsx)(u,{value:`local_checkout`,children:h.settings.executionModeLocal})]})}),(0,$.jsx)(Ei,{label:h.settings.description,hint:h.settings.descriptionHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.description,onChange:e=>cr({description:e.target.value})})})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.projectGuidanceTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.projectGuidanceHint})]}),(0,$.jsx)(Ei,{label:h.settings.brief,hint:h.settings.briefHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.brief,onChange:e=>cr({brief:e.target.value})})}),(0,$.jsx)(Ei,{label:h.settings.instructions,hint:h.settings.instructionsHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.instructions,onChange:e=>cr({instructions:e.target.value})})})]})]}),(0,$.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.workspaceRoot}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceIndependentHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?h.settings.workspaceModeFollow:h.settings.workspaceModeFixed}),(0,$.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),h.settings.copyWorkspacePath]}),Se?(0,$.jsx)(fe,{resourceId:Se.fileId,displayName:Se.name}):null,(0,$.jsxs)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:lr,children:[(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),h.settings.migrateWorkspace]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.currentProjectTitle}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(Oi,{label:h.settings.defaultAgent,value:zr}),(0,$.jsx)(Oi,{label:h.settings.pinState,value:Ur?h.settings.pinned:h.settings.notPinned}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Oi,{label:h.settings.createdAt,value:wi(D.createdAt)||h.common.never}),(0,$.jsx)(Oi,{label:h.settings.updatedAt,value:wi(D.updatedAt)||h.common.never})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.managementTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.managementHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?h.settings.pinnedTitle:h.settings.pinTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.pinHint})]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:un===`pin`,onClick:()=>void dr(),children:[Ur?(0,$.jsx)(Ot,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(ct,{className:`size-4`,"aria-hidden":!0}),Ur?h.settings.unpinProject:h.settings.pinProject]})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?h.settings.restoreTitle:h.settings.archiveTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?h.settings.restoreHint:h.settings.archiveHint})]}),(0,$.jsxs)(H,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:un===`archive`,onClick:()=>void fr(),children:[Hr?(0,$.jsx)(dt,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(he,{className:`size-4`,"aria-hidden":!0}),Hr?h.settings.restoreProject:h.settings.archiveProject]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:h.settings.dangerTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:h.settings.dangerHint})]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>Vt(!0),children:[(0,$.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,$.jsx)(L,{open:Bt,onOpenChange:e=>{mn||Vt(e)},children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5 shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,$.jsx)(At,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.deleteConfirmTitle}),(0,$.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:D?Ci(h.settings.deleteConfirm,{name:D.name}):h.settings.deleteConfirmFallback})]})]}),(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:mn,children:h.common.cancel})}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:mn||!D,onClick:()=>void pr(),children:[(0,$.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})}),(0,$.jsx)(Et,{open:!!ke,title:f.workspace.trashConfirmTitle,description:f.workspace.trashConfirmDescription.replace(`{{name}}`,ke?.name??``),confirmLabel:f.workspace.moveToTrash,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void br(),onCancel:()=>je(null)}),(0,$.jsx)(Et,{open:!!Fe,title:f.workspace.deleteConfirmTitle,description:f.workspace.deleteConfirmDescription.replace(`{{name}}`,Fe?.name??``),confirmLabel:f.workspace.deleteFile,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void Sr(),onCancel:()=>Le(null)}),(0,$.jsx)(L,{open:Qt,onOpenChange:e=>{It||en(e)},children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMigrationTitle}),(0,$.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.workspaceMigrationDescription})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:h.settings.workspaceMode}),(0,$.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:w(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,nn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:nn===`fixed`,onChange:()=>rn(`fixed`),disabled:It}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFixed}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceMigrationFixedHint})]})]}),(0,$.jsxs)(`label`,{className:w(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,nn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:nn===`follow`,onChange:()=>rn(`follow`),disabled:It}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFollow}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceHint})]})]})]})]}),nn===`fixed`?(0,$.jsx)(xn,{value:sn,onChange:ln,disabled:It,wd:m,placeholder:h.settings.workspacePlaceholder,inputClassName:Di(),autoFocus:!0}):null,(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:h.settings.workspaceMigrationImpact}),(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Ci(h.settings.workspaceCurrent,{workspace:Kr})})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:It,children:h.common.cancel})}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:It||!qr,onClick:()=>void ur(),children:[(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMigrationConfirm]})]})]})]})}),(0,$.jsx)(L,{open:!!Ut,onOpenChange:e=>{e||Yt(null)},children:(0,$.jsxs)(P,{children:[(0,$.jsx)(A,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(F,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMissingTitle}),(0,$.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ut?Ci(h.settings.workspaceMissingDescription,{workspace:Ut}):null})]}),Ut?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(dn,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:Ut})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:It,children:h.settings.workspaceMissingBack}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void ur({createWorkspaceRoot:!0}),disabled:It,children:[(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMissingCreate]})]})]})]})})]})}export{Hi as ProjectDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./x-B_N4OPjy.js";import{t as ee}from"./messages-D__oW2yE.js";import{t as u}from"./cn-0WouolD0.js";import{n as d}from"./locale-store-D_migb9R.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./button-aIC072nz.js";import{t as b}from"./skeleton-BI5TyibZ.js";import{Bo as x,Cd as S,Cf as C,Co as w,Ef as T,Oo as E,Ro as D,Uo as O,Vi as k,_u as A,au as j,eu as M,gu as N,ko as P,mo as F,os as te,vo as ne,wd as re,zo as ie}from"./index-D2hEKnTM.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:k(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(b,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=d(V),c,l,u,f,p,m,h,g;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,h=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),d;t[20]===o?d=t[21]:(d=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=d);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,R.jsx)(C,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=_):_=t[22];let v;t[23]===d?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[d,_]}),t[23]=d,t[24]=v),g=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,p=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=u,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g}else c=t[9],l=t[10],u=t[11],f=t[12],p=t[13],m=t[14],h=t[15],g=t[16];let _;t[25]!==l||t[26]!==u?(_=(0,R.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=_):_=t[27];let v;t[28]!==f||t[29]!==p||t[30]!==_?(v=(0,R.jsxs)(`div`,{className:f,children:[p,_]}),t[28]=f,t[29]=p,t[30]=_,t[31]=v):v=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,S;t[32]===n.pinnedAt?S=t[33]:(S=n.pinnedAt?(0,R.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(A,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=S);let w;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==S?(w=(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:S}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=S,t[39]=w):w=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,O;t[40]===n.status?O=t[41]:(O=n.status===`archived`?(0,R.jsx)(j,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=O);let k;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==O?(k=(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:O}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=O,t[47]=k):k=t[47];let M;t[48]!==w||t[49]!==k?(M=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[w,k]}),t[48]=w,t[49]=k,t[50]=M):M=t[50];let P;t[51]!==M||t[52]!==m||t[53]!==v?(P=(0,R.jsxs)(`div`,{className:m,children:[v,M]}),t[51]=M,t[52]=m,t[53]=v,t[54]=P):P=t[54];let F;return t[55]!==P||t[56]!==h||t[57]!==g?(F=(0,R.jsxs)(`article`,{className:h,children:[g,P]}),t[55]=P,t[56]=h,t[57]=g,t[58]=F):F=t[58],F}function V(e){return e.language}function H(){let e=ee(d(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=te(e=>e.setPageHeader),b=te(e=>e.clearPageHeader),[C,T]=(0,L.useState)([]),[k,A]=(0,L.useState)(!0),[j,N]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,U]=(0,L.useState)(!1),[fe,W]=(0,L.useState)(null),[G,pe]=(0,L.useState)(!1),[K,me]=(0,L.useState)(!0),[q,he]=(0,L.useState)(``),[J,ge]=(0,L.useState)(``),[Y,_e]=(0,L.useState)(``),X=ne({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(A(!0),N(null));try{let e=await D({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&T(ae(e.items))}catch(n){!e&&t===Z.current&&N(n instanceof Error?n.message:String(n))}finally{t===Z.current&&A(!1)}},[]);(0,L.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,L.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return C.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,C,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>b()),[b,ve,n.title,i]);let ye=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||G)){pe(!0),W(null);try{let e=await P({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});T(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[G,J,q,Y,K]),be=(0,L.useCallback)(async(e,t)=>{ue(e.id),N(null);try{let n;n=t===`pin`?e.pinnedAt?await O(e.id,e.version):await ie(e.id,e.version):e.status===`archived`?await x(e.id,e.version):await E(e.id,e.version),T(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){N(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===H)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,R.jsx)(v,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(h,{children:[(0,R.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(p,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:G||X.picking,children:[X.picking?(0,R.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(S,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:u(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(w,{checked:K,onChange:me,disabled:G}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(m,{asChild:!0,children:(0,R.jsx)(y,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(y,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(F,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,R.jsxs)(`div`,{className:u(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(M,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(l,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(M,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:xe.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),j?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:j}),(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,k?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(re,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,t as o}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./messages-D__oW2yE.js";import{t as p}from"./cn-0WouolD0.js";import{c as m,n as h}from"./locale-store-D_migb9R.js";import{a as g,i as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./copy-to-clipboard-HOJ79TWv.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{t as w}from"./button-aIC072nz.js";import{n as T,r as E}from"./gateway-config-swr-CTXr917C.js";import{i as D,o as O}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{$t as k,As as A,Cf as j,Dl as M,F as N,G as P,I as F,Ka as I,Kl as L,L as R,Ml as z,Ou as B,Ql as V,Wl as H,Xd as U,_o as ee,ad as te,af as W,bs as ne,du as G,en as re,fo as K,nn as ie,on as ae,rr as q,sf as J}from"./index-D2hEKnTM.js";import{n as oe,r as se,t as ce}from"./settings-page-layout-Dx5S-Msc.js";import{n as Y,r as le,t as ue}from"./settings-form-section-4nn0sb6v.js";import{_ as X,a as de,b as fe,c as pe,h as me,i as he,n as ge,o as _e,r as ve,s as ye,t as be,v as xe,y as Se}from"./tunnel-api-DOUyF9Ew.js";import{t as Ce}from"./settings-advanced-gate-Ch20Ptzp.js";var Z=e(t(),1),Q=n(),$=r();function we(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Te(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=p(`inline-flex items-center gap-1.5 text-xs font-medium`,we(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=p(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function Ee(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=h(Oe),i;t[0]===r?i=t[1]:(i=f(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!m(De),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=C(o?`exposure-status`:null,Se,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=C(o?`tunnel-status`:null,ge,l),g=E(o);if(!o)return null;let _=c?.tailscale.active===!0,v=d?.state,y=d?.enabled&&v===`connected`,b=d?.enabled&&(v===`connecting`||v===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),x=g.data?.payload?.config,S=!!(x&&typeof x==`object`&&!Array.isArray(x)&&x.gateway?.publicUrl),w=_?`active`:`off`,T=_?a.statusActive:a.statusOff,D;t[4]!==a.tailscaleCardTitle||t[5]!==w||t[6]!==T?(D={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:w,statusLabel:T},t[4]=a.tailscaleCardTitle,t[5]=w,t[6]=T,t[7]=D):D=t[7];let O=y?`active`:b?`connecting`:`off`,k=y?a.statusActive:b?a.statusConnecting:a.statusOff,A;t[8]!==a.publicCardTitle||t[9]!==O||t[10]!==k?(A={tab:`public`,icon:B,title:a.publicCardTitle,kind:O,statusLabel:k},t[8]=a.publicCardTitle,t[9]=O,t[10]=k,t[11]=A):A=t[11];let j=S?`active`:`off`,M=S?a.statusActive:a.statusOff,N;t[12]!==a.reverseProxyCardTitle||t[13]!==j||t[14]!==M?(N={tab:`reverse-proxy`,icon:L,title:a.reverseProxyCardTitle,kind:j,statusLabel:M},t[12]=a.reverseProxyCardTitle,t[13]=j,t[14]=M,t[15]=N):N=t[15];let P;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(P={tab:`ssh`,icon:z,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=P):P=t[18];let F;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(F={tab:`lan`,icon:V,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=F):F=t[21];let I;t[22]!==N||t[23]!==P||t[24]!==F||t[25]!==D||t[26]!==A?(I=[D,A,N,P,F],t[22]=N,t[23]=P,t[24]=F,t[25]=D,t[26]=A,t[27]=I):I=t[27];let R=I,H;return t[28]!==R||t[29]!==n?(H=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:p(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Te,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=R,t[29]=n,t[30]=H):H=t[30],H}function De(e){return e.conversationId}function Oe(e){return e.language}function ke(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=p(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let d;t[5]!==i||t[6]!==s?(d=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=d):d=t[7];let f;t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let m;t[11]===r?m=t[12]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=m);let h;t[13]!==f||t[14]!==m?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,m]}),t[13]=f,t[14]=m,t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(W,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=g):g=t[16];let _;return t[17]!==o||t[18]!==l||t[19]!==h?(_=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,h,g]}),t[17]=o,t[18]=l,t[19]=h,t[20]=_):_=t[20],_}function Ae(e){let t=(0,Q.c)(78),{onOpenTab:n}=e,r=h(Ne),i;t[0]===r?i=t[1]:(i=f(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!m(Me),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=C(s?`exposure-status`:null,Se,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let p=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(Ee,{onOpenTab:n}),t[7]=n,t[8]=g);let _;t[9]!==p||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(_=p.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:p.map(je)})]}):null,t[9]=p,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=_):_=t[12];let v;t[13]===o.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==y?(b=(0,$.jsx)(ke,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:y}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=y,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=()=>n(`public`),t[22]=n,t[23]=x);let S;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==x?(S=(0,$.jsx)(ke,{icon:B,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:x}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=x,t[27]=S):S=t[27];let w;t[28]===n?w=t[29]:(w=()=>n(`reverse-proxy`),t[28]=n,t[29]=w);let T;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==w?(T=(0,$.jsx)(ke,{icon:L,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:w}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=w,t[33]=T):T=t[33];let E;t[34]===n?E=t[35]:(E=()=>n(`ssh`),t[34]=n,t[35]=E);let D;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==E?(D=(0,$.jsx)(ke,{icon:z,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:E}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=E,t[39]=D):D=t[39];let O;t[40]!==a.advanced.proxyBody||t[41]!==a.advanced.proxyTitle||t[42]!==T||t[43]!==D?(O=(0,$.jsxs)(P,{title:a.advanced.proxyTitle,summary:a.advanced.proxyBody,children:[T,D]}),t[40]=a.advanced.proxyBody,t[41]=a.advanced.proxyTitle,t[42]=T,t[43]=D,t[44]=O):O=t[44];let k;t[45]===n?k=t[46]:(k=()=>n(`lan`),t[45]=n,t[46]=k);let A;t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==k?(A=(0,$.jsx)(ke,{icon:V,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:k}),t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=k,t[50]=A):A=t[50];let j;t[51]!==S||t[52]!==O||t[53]!==A||t[54]!==b?(j=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[b,S,O,A]}),t[51]=S,t[52]=O,t[53]=A,t[54]=b,t[55]=j):j=t[55];let M;t[56]!==j||t[57]!==v?(M=(0,$.jsxs)(`div`,{children:[v,j]}),t[56]=j,t[57]=v,t[58]=M):M=t[58];let N;t[59]===o.oneAtATimeHint?N=t[60]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[59]=o.oneAtATimeHint,t[60]=N);let F;t[61]===a.advanced.proxyTitle?F=t[62]:(F=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[61]=a.advanced.proxyTitle,t[62]=F);let I;t[63]===a.advanced.proxyBody?I=t[64]:(I=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[63]=a.advanced.proxyBody,t[64]=I);let R;t[65]!==r||t[66]!==a.advanced.proxyDocs?(R=(0,$.jsx)(fe,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[65]=r,t[66]=a.advanced.proxyDocs,t[67]=R):R=t[67];let H;t[68]!==F||t[69]!==I||t[70]!==R?(H=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[F,I,R]}),t[68]=F,t[69]=I,t[70]=R,t[71]=H):H=t[71];let U;return t[72]!==M||t[73]!==N||t[74]!==H||t[75]!==g||t[76]!==_?(U=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,M,N,H]}),t[72]=M,t[73]=N,t[74]=H,t[75]=g,t[76]=_,t[77]=U):U=t[77],U}function je(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Me(e){return e.conversationId}function Ne(e){return e.language}function Pe(){let e=(0,Q.c)(16),t=h(Fe),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(Y,{icon:V,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==a||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ue,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Fe(e){return e.language}function Ie(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=h(Le),a;t[0]===i?a=t[1]:(a=f(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await S(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=p):p=t[3];let m,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),g=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=m,t[5]=g):(m=t[4],g=t[5]);let _=s?o.copied:o.copy,v;t[6]===_?v=t[7]:(v=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`ghost`,onClick:m,children:[g,_]})}),t[6]=_,t[7]=v);let y;t[8]!==r||t[9]!==o.hint?(y=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=y):y=t[10];let b;t[11]!==v||t[12]!==y?(b=(0,$.jsxs)($.Fragment,{children:[p,v,y]}),t[11]=v,t[12]=y,t[13]=b):b=t[13];let x=b;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Y,{icon:z,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===x?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:x}),t[17]=x,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ue,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let C;t[22]!==o.subtitle||t[23]!==o.title?(C=(0,$.jsx)(Y,{icon:z,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=C):C=t[24];let T;t[25]===x?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:x}),t[25]=x,t[26]=T);let E;return t[27]!==C||t[28]!==T?(E=(0,$.jsxs)(ue,{children:[C,T]}),t[27]=C,t[28]=T,t[29]=E):E=t[29],E}function Le(e){return e.language}function Re(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ie,{embedded:!0}),e[0]=t):t=e[0],t}var ze=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Be(e){return e&&ze.includes(e)?e:`guide`}function Ve(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,f]=(0,Z.useState)(c??!1),m;t[0]===s?m=t[1]:(m=p(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>f(He),t[2]=h):h=t[2];let g=d&&`rotate-180`,_;t[3]===g?_=t[4]:(_=p(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[3]=g,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,$.jsx)(J,{className:_,"aria-hidden":!0}),t[5]=_,t[6]=v);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=d?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==d||t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:h,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[v,y,x]}),t[11]=d,t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=p(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==S||t[27]!==D||t[28]!==m?(O=(0,$.jsxs)(`section`,{className:m,children:[S,D]}),t[26]=S,t[27]=D,t[28]=m,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(Ce,{children:k}),t[30]=k,t[31]=e),e}return k}function He(e){return!e}function Ue(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,f]=(0,Z.useState)(!1),m;t[0]===u?m=t[1]:(m=e=>{e||(f(!1),u())},t[0]=u,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(g,{className:p(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,O)}),t[2]=h):h=t[2];let S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=p(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`,D),t[3]=S):S=t[3];let C;t[4]===r?C=t[5]:(C=(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=C);let T;t[6]===i?T=t[7]:(T=(0,$.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=T);let E;t[8]===a?E=t[9]:(E=a.map(We),t[8]=a,t[9]=E);let k;t[10]===E?k=t[11]:(k=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:E}),t[10]=E,t[11]=k);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>f(e.target.checked),t[12]=A):A=t[12];let j;t[13]===d?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:A}),t[13]=d,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(w,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=P):P=t[22];let F=!d,I;t[23]!==s||t[24]!==l||t[25]!==F?(I=(0,$.jsx)(w,{type:`button`,disabled:F,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==C||t[33]!==T||t[34]!==k?(R=(0,$.jsxs)(v,{children:[h,(0,$.jsxs)(y,{className:S,onOpenAutoFocus:Ge,children:[C,T,k,N,L]})]}),t[30]=N,t[31]=L,t[32]=C,t[33]=T,t[34]=k,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==m||t[38]!==R?(z=(0,$.jsx)(x,{open:n,onOpenChange:m,children:R}),t[36]=n,t[37]=m,t[38]=R,t[39]=z):z=t[39],z}function We(e){return(0,$.jsx)(`li`,{children:e},e)}function Ge(e){return e.preventDefault()}function Ke(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var qe=[`preparing_frpc`,`registering`,`starting_frpc`];function Je(e){return e?e===`reconnecting_frpc`?qe.indexOf(`starting_frpc`):qe.indexOf(e):-1}function Ye(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=qe.indexOf(e),i=Je(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Xe(e,t,n){let r=n.startProgress;return Ye(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ze(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Qe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function $e(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(et),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,f,m,h;if(t[6]!==n||t[7]!==r){let e=Qe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(f=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=f):f=t[19];let o=qe.map(e=>{let t=Ye(e,n),i=Xe(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(U,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:p(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ze(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:p(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[Ke(n.frpcDownload.bytesReceived),` /`,` `,Ke(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=f,t[11]=m,t[12]=h}else l=t[8],u=t[9],f=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==f||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[f,m,h,g]}),t[25]=u,t[26]=f,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function et(e){return e+1}function tt(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function nt(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function rt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function it(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function at(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:f,startDisabledReason:m,stepLabel:h,onStart:g,onStop:_}=e,v=f===void 0?!1:f,y,b,x,S,C,T,E;t[0]!==r||t[1]!==o?(E=nt(r),y=r.enabled||o,b=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=p(le(),`space-y-4`),t[9]=T):T=t[9],C=`flex flex-wrap items-start justify-between gap-3`,S=`flex items-center gap-2`,x=p(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,rt(E)),t[0]=r,t[1]=o,t[2]=y,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=T,t[8]=E):(y=t[2],b=t[3],x=t[4],S=t[5],C=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,j;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(j=p(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j):j=t[14];let N;t[15]===j?N=t[16]:(N=(0,$.jsx)(`span`,{className:j,"aria-hidden":!0}),t[15]=j,t[16]=N);let P;t[17]!==i||t[18]!==r||t[19]!==n?(P=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):tt(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=P):P=t[20];let F;t[21]!==N||t[22]!==P||t[23]!==x?(F=(0,$.jsxs)(`span`,{className:x,children:[N,P]}),t[21]=N,t[22]=P,t[23]=x,t[24]=F):F=t[24];let L;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(L=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,it(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=L):L=t[28];let R;t[29]!==F||t[30]!==L||t[31]!==S?(R=(0,$.jsxs)(`div`,{className:S,children:[F,L]}),t[29]=F,t[30]=L,t[31]=S,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(u,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=z):z=t[33];let B;t[34]!==R||t[35]!==C?(B=(0,$.jsxs)(`div`,{className:C,children:[R,z]}),t[34]=R,t[35]=C,t[36]=B):B=t[36];let V;t[37]===a?V=t[38]:(V=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=V);let H;t[39]!==c||t[40]!==n.consentExpiredBanner?(H=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=H):H=t[41];let U;t[42]!==y||t[43]!==l||t[44]!==g||t[45]!==_||t[46]!==b||t[47]!==r||t[48]!==v||t[49]!==m||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(U=y?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(I,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,b?(0,$.jsx)($e,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:s,onClick:_,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(w,{type:`button`,disabled:o,onClick:g,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(G,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:h}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),v&&m?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:m}):null,(0,$.jsxs)(w,{type:`button`,disabled:o||v,onClick:g,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(G,{className:`size-4`}),n.start]})]}),t[42]=y,t[43]=l,t[44]=g,t[45]=_,t[46]=b,t[47]=r,t[48]=v,t[49]=m,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=U):U=t[54];let ee;return t[55]!==B||t[56]!==V||t[57]!==H||t[58]!==U||t[59]!==T?(ee=(0,$.jsxs)(`section`,{className:T,children:[B,V,H,U]}),t[55]=B,t[56]=V,t[57]=H,t[58]=U,t[59]=T,t[60]=ee):ee=t[60],ee}var ot={reconfiguring:!1};function st(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:f,brokerSecretNotice:m,copyFailedLabel:h,onDraftChange:g,onSave:_,onAuthorize:v,onClear:y,sectionRef:b}=e,x=(0,Z.useId)(),S=r,C=!S,[T,E]=(0,Z.useReducer)(ee,ot),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,j;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(j={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=j):j=t[8];let M=j,N;t[9]===o?N=t[10]:(N=o.trim().length>0&&!ae(o.trim()),t[9]=o,t[10]=N);let P=N,F;t[11]===g?F=t[12]:(F=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),g(``)},t[11]=g,t[12]=F);let I=F,L=C&&`ring-1 ring-amber-500/30`,R;t[13]===L?R=t[14]:(R=p(L),t[13]=L,t[14]=R);let z=S?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:C?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,B;t[15]===z?B=t[16]:(B=p(`flex size-9 shrink-0 items-center justify-center rounded-lg`,z),t[15]=z,t[16]=B);let V;t[17]===S?V=t[18]:(V=S?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=S,t[18]=V);let H;t[19]!==B||t[20]!==V?(H=(0,$.jsx)(`span`,{className:B,children:V}),t[19]=B,t[20]=V,t[21]=H):H=t[21];let U=S?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,W;t[22]===U?W=t[23]:(W=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:U}),t[22]=U,t[23]=W);let ne=S?n.brokerSecretReadyHint:n.brokerSecretHint,G;t[24]===ne?G=t[25]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:ne}),t[24]=ne,t[25]=G);let re;t[26]!==C||t[27]!==n.brokerSecretMissingHint?(re=C?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=C,t[27]=n.brokerSecretMissingHint,t[28]=re):re=t[28];let K;t[29]!==W||t[30]!==G||t[31]!==re?(K=(0,$.jsxs)(`div`,{children:[W,G,re]}),t[29]=W,t[30]=G,t[31]=re,t[32]=K):K=t[32];let ie;t[33]!==u||t[34]!==C||t[35]!==v||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(ie=C||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||u,onClick:v,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:be,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=C,t[35]=v,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=ie):ie=t[41];let q;t[42]!==u||t[43]!==f||t[44]!==n.brokerSecretOpenAuthorization?(q=u&&f?(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=f,t[44]=n.brokerSecretOpenAuthorization,t[45]=q):q=t[45];let J;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==P||t[50]!==I||t[51]!==h||t[52]!==x||t[53]!==C||t[54]!==y||t[55]!==g||t[56]!==_||t[57]!==D||t[58]!==c||t[59]!==M||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(J=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(A,{id:x,value:a,labels:M,reveal:ct,loadFailedLabel:h||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(A,{id:x,value:o,onChange:g,placeholder:n.brokerSecretPlaceholder,labels:M,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||!P,onClick:_,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,C?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear}):null,D?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:I,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=P,t[50]=I,t[51]=h,t[52]=x,t[53]=C,t[54]=y,t[55]=g,t[56]=_,t[57]=D,t[58]=c,t[59]=M,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=J):J=t[71];let oe;t[72]===m?oe=t[73]:(oe=m?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:m}):null,t[72]=m,t[73]=oe);let se;t[74]!==K||t[75]!==ie||t[76]!==q||t[77]!==J||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[K,ie,q,J,oe]}),t[74]=K,t[75]=ie,t[76]=q,t[77]=J,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==H||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[H,se]}),t[80]=H,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==R?(Y=(0,$.jsx)(ue,{className:R,children:ce}),t[83]=ce,t[84]=R,t[85]=Y):Y=t[85];let le;return t[86]!==b||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:b,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=b,t[87]=Y,t[88]=le):le=t[88],le}function ct(){return _e().then(lt)}function lt(e){return e.registrationSecret??null}var ut={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function dt({embedded:e=!1}){let t=h(e=>e.language),n=f(t).tunnelSettings,r=!!m(e=>e.conversationId),[i,a]=(0,Z.useReducer)(ee,ut),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:g,autoStartConfirmOpen:_,releaseConfirmOpen:v,releasing:y,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O}=i,A=(0,Z.useRef)(null),{data:j}=E(r),{data:M,error:P,isLoading:I,mutate:L}=C(r?`tunnel-status`:null,ge,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),z=(0,Z.useMemo)(()=>{let e=j?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return M?.config?.autoStart===!0},[j,M?.config?.autoStart]),B=(0,Z.useMemo)(()=>{let e=j?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[j]),V=ae(B),H=M?.registrationSecret?.configured??V;(0,Z.useEffect)(()=>{let e=()=>{L()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[L]);let U=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),te=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await ye(),await L(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[L]),W=(0,Z.useCallback)(()=>{if(!H){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),A.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(M?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}te()},[H,M?.consentRequired,te,n.brokerSecretRequiredBeforeStart]),ne=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await de(),await Promise.all([L(),te()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[L,te]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await pe(),await L(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[L]),q=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ve({autoStart:e}),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),J=(0,Z.useCallback)(()=>{if(z){q(!1);return}if(M?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!M?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[q,M?.canAutoStart,M?.consentRequired,n,z]),oe=(0,Z.useCallback)(async()=>{let e=b.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),T(),await L(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[b,L,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),T(),await L()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[L,n.brokerSecretCleared]),ce=(0,Z.useCallback)(async()=>{let e=R(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await ie(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await re(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await F(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await he(),await Promise.all([L(),T()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{N(e),t&&k(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[L,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await pe({release:!0}),await L(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[L]),le=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:f(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=M??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:z,brokerUrl:`https://frp.xopc.ai/api`}},me=M?.consentRequired&&(X.enabled||z||M?.consent?.acceptedAt),_e=(0,$.jsx)(st,{t:n,brokerSecretReady:H,brokerSecretConfiguredInConfig:V,brokerSecretMaskedValue:V?B:``,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O,copyFailedLabel:f(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:A}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ue,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:U,checkboxLabel:n.consentCheckbox,confirmLabel:me?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ne(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(K,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),q(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(K,{open:v,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void Y(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:I,statusErr:P,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void G()}),(0,$.jsxs)(Ve,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:p(`flex items-center gap-3 text-sm text-fg`,!z&&!M?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!M?.canAutoStart,onChange:J}),n.autoStart]}),!M?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(Ve,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:I,statusErr:P,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void G()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ue,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:p(`flex items-center gap-3 text-sm text-fg`,!z&&!M?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!M?.canAutoStart,onChange:J}),n.autoStart]}),!M?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ft(e,t){return e.tabs[t]}function pt(e,t){return e.tabIntro[t]}function mt(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function ht(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Ae,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(xe,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(dt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(X,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Re,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Pe,{}),t[6]=e):e=t[6],e}}}function gt(){let e=(0,Q.c)(3),t=i(),n=h(vt),r=f(n).remoteAccess,o=!!m(_t),[s,c]=a(),l=q(),u=Be(s.get(`tab`)),d=s.get(`intent`)===`mobile-pairing`,p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={refreshInterval:2e3},e[0]=p):p=e[0];let g=C(d?`device-pairing-readiness`:null,me,p),_;e[1]===c?_=e[2]:(_=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=_);let v=_,y=pt(r,u),b=ze.filter(e=>l||e!==`ssh`&&e!==`reverse-proxy`||e===u).map(e=>({id:e,label:ft(r,e)}));return(0,$.jsxs)(se,{children:[(0,$.jsx)(oe,{title:r.pageTitle,meta:(0,$.jsx)(fe,{language:n,label:r.docsLink,section:mt(u),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[d?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(H,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(w,{variant:`primary`,disabled:!g.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[g.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ne,{items:b,activeTab:u,onChange:v,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ce,{id:u,activeTab:u,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ft(r,u),hint:u===`public`?void 0:y,showHeading:!1,framed:!1,children:(0,$.jsx)(ht,{tab:u,onOpenTab:v})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function _t(e){return e.conversationId}function vt(e){return e.language}export{gt as RemoteAccessHub};
@@ -1,5 +0,0 @@
1
- import{a as e,i as t,r as n}from"./locale-store-D_migb9R.js";async function r(){return e(n(`/api/runtime-tools`))}async function i(t){await e(n(`/api/runtime-tools/config`),{method:`PATCH`,body:JSON.stringify(t)})}async function a(){return(await e(n(`/api/runtime-tools/prune`),{method:`POST`})).payload}async function o(e){let r=await t(n(`/api/runtime-tools/${e.runtime}/${e.action}/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({version:e.version})});if(!r.ok||!r.body)throw Error(`HTTP ${r.status}`);let i=r.body.getReader(),a=new TextDecoder,o=``,s=!1;try{for(;!s;){let{done:t,value:n}=await i.read();if(t)break;o+=a.decode(n,{stream:!0}).replace(/\r\n/g,`
2
- `);let r=o.split(`
3
-
4
- `);o=r.pop()??``;for(let t of r){let n=``,r=``;for(let e of t.split(`
5
- `))e.startsWith(`event:`)&&(n=e.slice(6).trim()),e.startsWith(`data:`)&&(r+=e.slice(5).trimStart());if(!r)continue;let i=JSON.parse(r);if(n===`progress`&&e.onProgress(i),n===`result`&&(s=!0,!i.ok))throw Error(i.message??`${e.action} failed`)}}}finally{i.releaseLock()}if(!s)throw Error(`Runtime operation ended without a result`)}export{i,a as n,o as r,r as t};
@@ -1 +0,0 @@
1
- import{a as e,r as t}from"./locale-store-D_migb9R.js";import{d as n,g as r,h as i,i as a,l as o,p as s,r as c,s as l,t as u,u as d,v as f}from"./schemas-CObaziC7.js";import{t as p}from"./gateway-startup-retry-DD2fsxdd.js";var m=f().transform(e=>e.toLowerCase()).brand(),h=s().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),g=u([`active`,`idle`,`archived`,`pinned`]),_=d({agentId:s().optional(),source:s().optional(),accountId:s().optional(),peerKind:s().optional(),peerId:s().optional(),threadId:s().optional(),scopeId:s().optional()}).passthrough();d({agentId:s().optional(),projectId:s().optional(),key:s(),transcriptId:h.optional(),name:s().optional(),title:s().optional(),displayName:s().optional(),messageCount:o(),updatedAt:s(),sourceChannel:s().optional(),status:g.optional(),usage:d({calls:o().int().nonnegative(),unknownCostCalls:o().int().nonnegative(),totalTokens:o().int().nonnegative(),knownCostUsd:s(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:_.optional()}).passthrough();var v=d({items:c(r()),total:o(),limit:o(),offset:o(),hasMore:a()}),y=d({role:s(),content:r(),timestamp:i([s(),o()]).optional()}).passthrough(),b=d({key:s(),messages:c(y)}).passthrough(),x=d({session:b}),ee=d({session:d({key:s(),transcriptId:h.optional(),messages:c(y),name:s().optional(),status:g.optional(),sourceChannel:s().optional(),sourceChatId:s().optional(),projectId:s().optional(),customData:n(s(),r()).optional(),routing:_.optional()}).passthrough(),pagination:d({total:o(),limit:o(),offset:o(),hasMore:a(),before:s().optional(),nextBeforeCursor:s().optional(),revision:o().int().nonnegative().optional()}).passthrough()}).passthrough(),S=d({ok:l(!0),conversationId:f(),rowCount:o().int().nonnegative(),lastTurnId:s().min(1),session:b}).passthrough(),C=d({ok:a().optional(),payload:d({active:a(),runId:s().optional()}).passthrough().optional()}).passthrough(),w=d({ok:a().optional(),error:s().optional()}).passthrough(),T=w.extend({renamed:a().optional()}),E=w.extend({reset:a().optional(),transcriptId:h.optional(),previousTranscriptId:s().optional(),session:r().optional()}),D=d({totalSessions:o(),activeSessions:o(),archivedSessions:o(),pinnedSessions:o(),totalMessages:o(),totalTokens:o(),oldestSession:s().optional(),newestSession:s().optional(),byChannel:n(s(),o())}).passthrough();d({ok:a(),payload:d({conversationId:f(),transcriptId:h,session:r()}).passthrough().optional(),error:s().optional()}).passthrough();var O=d({ok:l(!0),projects:d({items:c(d({project:r(),sessions:c(r()),sessionTotal:o(),sessionHasMore:a()}).passthrough()),total:o(),limit:o(),offset:o(),hasMore:a()}),inbox:v,pinned:c(r()).default([]),layouts:n(s(),d({itemIds:c(s()),revision:o().int().nonnegative()})).default({}),childrenByConversationId:n(s(),d({total:o(),activeCount:o(),items:c(d({taskId:s(),title:s(),phase:s(),runStatus:s().optional(),activeConversationId:s().optional()}))})).default({})}).passthrough();function k(e){return x.parse(e)}function A(e){return ee.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){return O.parse(e)}function R(e){let t=M(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function z(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function B(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function H(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function U(){return`/api/sessions/stats`}function W(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function G(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function K(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function q(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var J=new Map;async function Y(e){let n=q(e),r=J.get(n);if(r)return r;let i=t(`/api/sessions${z(e)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{J.delete(n)});return J.set(n,a),a}async function X(n){return L(await e(t(W(n))))}async function Z(n){let r=await e(t(G(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Q(){return I(await e(t(U())))}async function ne(n,r){let i=k(await e(t(B(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function re(n){let r=await e(t(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function ie(n){N(await e(t(K(n,`delete`)),{method:`DELETE`}))}async function ae(n,r){return{renamed:P(await e(t(K(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function oe(n){N(await e(t(K(n,`archive`)),{method:`POST`}))}async function $(n){N(await e(t(K(n,`unarchive`)),{method:`POST`}))}async function se(n){N(await e(t(K(n,`pin`)),{method:`POST`}))}async function ce(n){N(await e(t(K(n,`unpin`)),{method:`POST`}))}async function le(n){return(await e(t(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{R as _,ne as a,F as b,se as c,Z as d,$ as f,H as g,te as h,X as i,ae as l,V as m,ie as n,Q as o,ce as p,le as r,Y as s,oe as t,re as u,j as v,m as x,A as y};