@xopcai/xopc 0.0.324 → 0.0.329

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 (325) hide show
  1. package/README.md +4 -3
  2. package/README.zh-CN.md +4 -3
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B-Gczr_A.js → agent-avatar-dicebear-Bs1qnnhD.js} +1 -1
  6. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHJyAT7t.js +1 -0
  7. package/dist/gateway/static/root/assets/agent-plugin-dialog-DLKj_iIh.js +1 -0
  8. package/dist/gateway/static/root/assets/agents-SXZ5O0g4.js +70 -0
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-BwWdVRlb.js → app-management-settings-panel-BrIji9B5.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-EoXNDO1j.js → appearance-settings-Uts-MQ7K.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-DcclVdxW.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-B_T0uMvL.js → archive-plugin-_EzRfBuI.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-D9DDwxd2.js → attachment-load-CHg7_XFl.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-jI9vNr2r.js → automations-page-CGMErk_w.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-Cc4yqiF6.js +7 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-Dzsxh9OL.js → binary-plugins-D3WB-tVn.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-CWUUgWWk.js → block-editor-Cm1W-14I.js} +53 -53
  18. package/dist/gateway/static/root/assets/box-DvYoGszj.js +1 -0
  19. package/dist/gateway/static/root/assets/braces-Cfmtagno.js +1 -0
  20. package/dist/gateway/static/root/assets/{browser-automation-inputs-DSWXq9lI.js → browser-automation-inputs-VnvK-GQP.js} +1 -1
  21. package/dist/gateway/static/root/assets/browser-automations-page-CZYCvSSU.js +3 -0
  22. package/dist/gateway/static/root/assets/browser-settings-page-DDz9PE6m.js +3 -0
  23. package/dist/gateway/static/root/assets/calendar-clock-D-quYVPe.js +1 -0
  24. package/dist/gateway/static/root/assets/capabilities-page-DH3aDk53.js +2 -0
  25. package/dist/gateway/static/root/assets/capabilities-settings-panel-C8jMZAJl.js +8 -0
  26. package/dist/gateway/static/root/assets/capability-discover-page-CgGvsf3t.js +1 -0
  27. package/dist/gateway/static/root/assets/capability-header-actions-C3chJDQu.js +1 -0
  28. package/dist/gateway/static/root/assets/capability-icon-BYm2-nS-.js +1 -0
  29. package/dist/gateway/static/root/assets/channels-CuVS_KsY.js +1 -0
  30. package/dist/gateway/static/root/assets/{chat-terminal-dock-WXZrEB3K.js → chat-terminal-dock-ClbmjCL2.js} +2 -2
  31. package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +1 -0
  32. package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
  33. package/dist/gateway/static/root/assets/computer-settings-page-BfZaf516.js +1 -0
  34. package/dist/gateway/static/root/assets/connector-service-page-F-fYNIx8.js +1 -0
  35. package/dist/gateway/static/root/assets/connectors-page-B4SLpvSL.js +2 -0
  36. package/dist/gateway/static/root/assets/date-picker-DXQTsUJn.js +1 -0
  37. package/dist/gateway/static/root/assets/dependency-picker-B_z3zihW.js +1 -0
  38. package/dist/gateway/static/root/assets/{desktop-pet-DPVPqFlh.js → desktop-pet-C1TZzKS3.js} +1 -1
  39. package/dist/gateway/static/root/assets/desktop-pet-settings-B5JGIfqn.js +1 -0
  40. package/dist/gateway/static/root/assets/device-pairing-wizard-DFYK_Ywf.js +1 -0
  41. package/dist/gateway/static/root/assets/directory-picker-path-field-BfxaNwMB.js +1 -0
  42. package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
  43. package/dist/gateway/static/root/assets/{extension-debug-page-cuG5Lnwf.js → extension-debug-page-Bs8_FYCm.js} +1 -1
  44. package/dist/gateway/static/root/assets/extension-marketplace-api-DqV4YRYs.js +1 -0
  45. package/dist/gateway/static/root/assets/{extension-page-BCTAXdyE.js → extension-page-DH5vFbBw.js} +1 -1
  46. package/dist/gateway/static/root/assets/{extension-settings-page-kadW_icu.js → extension-settings-page-hGKovxxC.js} +1 -1
  47. package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +1 -0
  48. package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
  49. package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +1 -0
  50. package/dist/gateway/static/root/assets/{gateway-config-swr-CoQVulMd.js → gateway-config-swr-BYMrbKZE.js} +1 -1
  51. package/dist/gateway/static/root/assets/gateway-settings-BIsiP-JI.js +1 -0
  52. package/dist/gateway/static/root/assets/{gateway-startup-retry-B5GJ-CQV.js → gateway-startup-retry-DMqYXHAn.js} +1 -1
  53. package/dist/gateway/static/root/assets/gauge-C78eD2BA.js +1 -0
  54. package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
  55. package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +1 -0
  56. package/dist/gateway/static/root/assets/home-page-CoBivEvx.js +1 -0
  57. package/dist/gateway/static/root/assets/image-Cwyalflz.js +1 -0
  58. package/dist/gateway/static/root/assets/{image-generation-api-DvWDkbk1.js → image-generation-api-D1sQGaJz.js} +1 -1
  59. package/dist/gateway/static/root/assets/imports-page-rssb4rjP.js +1 -0
  60. package/dist/gateway/static/root/assets/inbox-DNoSz682.js +1 -0
  61. package/dist/gateway/static/root/assets/index-C4QN4gCi.css +1 -0
  62. package/dist/gateway/static/root/assets/index-Cr4SINLG.js +121 -0
  63. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
  64. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C1fKIjz4.js → keyboard-shortcuts-settings-CMitbles.js} +1 -1
  65. package/dist/gateway/static/root/assets/layout-grid-CEVZdVFU.js +1 -0
  66. package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
  67. package/dist/gateway/static/root/assets/list-BBGUdmkF.js +1 -0
  68. package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +1 -0
  69. package/dist/gateway/static/root/assets/local-app-workbench-page-Di82Oacm.js +1 -0
  70. package/dist/gateway/static/root/assets/local-apps-page-CCvA9d9L.js +1 -0
  71. package/dist/gateway/static/root/assets/{locale-store-BPZR8x9b.js → locale-store-BSkKhYkc.js} +1 -1
  72. package/dist/gateway/static/root/assets/lock-keyhole-DEK5kH0u.js +1 -0
  73. package/dist/gateway/static/root/assets/logs-page-BK8ol1q0.js +2 -0
  74. package/dist/gateway/static/root/assets/management-settings-CebXkEtB.js +1 -0
  75. package/dist/gateway/static/root/assets/{markdown-view-Dft8ASFD.js → markdown-view-DXubGEic.js} +2 -2
  76. package/dist/gateway/static/root/assets/{media-plugins-Cjj-fidX.js → media-plugins-DLJrmU9J.js} +1 -1
  77. package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +1 -0
  78. package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
  79. package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +1 -0
  80. package/dist/gateway/static/root/assets/messages-D0G_sZvA.js +3 -0
  81. package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +1 -0
  82. package/dist/gateway/static/root/assets/models-hub-cache-B0EUPwTv.js +1 -0
  83. package/dist/gateway/static/root/assets/network-BUQLY1BV.js +1 -0
  84. package/dist/gateway/static/root/assets/note-detail-panel-xsKDIJdK.js +5 -0
  85. package/dist/gateway/static/root/assets/note-image-lightbox-1qg2v-9j.js +1 -0
  86. package/dist/gateway/static/root/assets/notes-page-BFm7XnWH.js +8 -0
  87. package/dist/gateway/static/root/assets/page-context-capture-button-C3JiQEKD.js +1 -0
  88. package/dist/gateway/static/root/assets/paperclip-f1HujQY1.js +1 -0
  89. package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +1 -0
  90. package/dist/gateway/static/root/assets/power-ZI-pBczI.js +1 -0
  91. package/dist/gateway/static/root/assets/preview-open-alternatives-buk_gdip.js +1 -0
  92. package/dist/gateway/static/root/assets/{product-open-page-DlpCi5zT.js → product-open-page-DwEEO0Ak.js} +1 -1
  93. package/dist/gateway/static/root/assets/project-detail-page-CRQGCRSU.js +1 -0
  94. package/dist/gateway/static/root/assets/projects-page-DcqylysA.js +1 -0
  95. package/dist/gateway/static/root/assets/{registry-api-DWWO6ajd.js → registry-api-tx8XCHOs.js} +1 -1
  96. package/dist/gateway/static/root/assets/remote-access-hub-Cq5MaiRW.js +1 -0
  97. package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
  98. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BT_ANpaT.js → runtime-tools-settings-panel-De7HmmBu.js} +2 -2
  99. package/dist/gateway/static/root/assets/scenes-page-GXJ-b3dO.js +2 -0
  100. package/dist/gateway/static/root/assets/{schema-form-BcqsqSsV.js → schema-form-DPMEuj5D.js} +1 -1
  101. package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
  102. package/dist/gateway/static/root/assets/server-BlHCBjiE.js +1 -0
  103. package/dist/gateway/static/root/assets/sessions-page-C6FwYIRA.js +1 -0
  104. package/dist/gateway/static/root/assets/settings-advanced-gate-BEyQiZs0.js +1 -0
  105. package/dist/gateway/static/root/assets/settings-form-section-DM0D-BQ_.js +1 -0
  106. package/dist/gateway/static/root/assets/{settings-page-B65vii9U.js → settings-page-CWS9yOH3.js} +1 -1
  107. package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
  108. package/dist/gateway/static/root/assets/setup-status-panel-BhGKiTPf.js +1 -0
  109. package/dist/gateway/static/root/assets/{share-preview-page-BS8o58NJ.js → share-preview-page-CcRi2yGy.js} +1 -1
  110. package/dist/gateway/static/root/assets/shares-settings-DNmcCBfX.js +1 -0
  111. package/dist/gateway/static/root/assets/skill-api-BCAV_F1P.js +1 -0
  112. package/dist/gateway/static/root/assets/skill-card-icon-BrrpZ3Mw.js +1 -0
  113. package/dist/gateway/static/root/assets/skill-reload-api-BEV2WXGk.js +1 -0
  114. package/dist/gateway/static/root/assets/skills-page-C8zOGpKw.js +2 -0
  115. package/dist/gateway/static/root/assets/star-BUWJqJ5c.js +1 -0
  116. package/dist/gateway/static/root/assets/stethoscope-DRqTAtjD.js +1 -0
  117. package/dist/gateway/static/root/assets/store-SzD1Jvgm.js +1 -0
  118. package/dist/gateway/static/root/assets/system-settings-panel-C_lajq9u.js +1 -0
  119. package/dist/gateway/static/root/assets/task-detail-page-Dk8Bmlhw.js +1 -0
  120. package/dist/gateway/static/root/assets/tunnel-api-CYvKiE_f.js +1 -0
  121. package/dist/gateway/static/root/assets/upload-rrb46c3c.js +1 -0
  122. package/dist/gateway/static/root/assets/use-autosave-ZTHe1zCM.js +1 -0
  123. package/dist/gateway/static/root/assets/user-model-page-C_SPNZbP.js +2 -0
  124. package/dist/gateway/static/root/assets/user-round-C9jxPhMR.js +1 -0
  125. package/dist/gateway/static/root/assets/{voice-api-key-field-DJV-qERt.js → voice-api-key-field-C8Kpkct-.js} +1 -1
  126. package/dist/gateway/static/root/assets/voice-config-api-BvzxINUk.js +1 -0
  127. package/dist/gateway/static/root/assets/wand-sparkles-DWuJz5ya.js +1 -0
  128. package/dist/gateway/static/root/assets/{work-discovery-overlay-DcHhy54L.js → work-discovery-overlay-ClB6T-dm.js} +1 -1
  129. package/dist/gateway/static/root/assets/workflow-run-setup-panel-X0Cyh2AR.js +3 -0
  130. package/dist/gateway/static/root/assets/workflows-page-BrL6dzf0.js +6 -0
  131. package/dist/gateway/static/root/connector-icons/SOURCES.md +1 -0
  132. package/dist/gateway/static/root/connector-icons/wecom.svg +9 -0
  133. package/dist/gateway/static/root/index.html +26 -8
  134. package/dist/package.js +1 -1
  135. package/dist/src/agent/agent-instance-gateway.d.ts +2 -2
  136. package/dist/src/agent/agent-manager.d.ts +4 -2
  137. package/dist/src/agent/agent-manager.js +58 -19
  138. package/dist/src/agent/background-review/coordinator.d.ts +2 -7
  139. package/dist/src/agent/background-review/coordinator.js +17 -34
  140. package/dist/src/agent/background-review/prompts.d.ts +13 -5
  141. package/dist/src/agent/background-review/prompts.js +17 -12
  142. package/dist/src/agent/background-review/run-background-review.d.ts +3 -3
  143. package/dist/src/agent/background-review/run-background-review.js +58 -43
  144. package/dist/src/agent/context/execution-context.js +5 -2
  145. package/dist/src/agent/mcp/index.js +1 -1
  146. package/dist/src/agent/mcp/mcp-transport.js +2 -2
  147. package/dist/src/agent/mcp/oauth/index.js +1 -1
  148. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +2 -2
  149. package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +1 -1
  150. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  151. package/dist/src/agent/prompt/sections/tooling.js +3 -0
  152. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  153. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +12 -0
  154. package/dist/src/agent/tools/user-context-tool.js +29 -4
  155. package/dist/src/automations/domain/types.d.ts +7 -1
  156. package/dist/src/automations/service/action-executor.d.ts +2 -2
  157. package/dist/src/automations/service/action-executor.js +36 -13
  158. package/dist/src/automations/service/automation-service.js +2 -1
  159. package/dist/src/browser/automations/index.js +2 -2
  160. package/dist/src/browser/automations/service.d.ts +11 -2
  161. package/dist/src/browser/automations/service.js +19 -5
  162. package/dist/src/capabilities/readiness/from-config.d.ts +0 -1
  163. package/dist/src/capabilities/readiness/from-config.js +2 -4
  164. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  165. package/dist/src/cli/commands/extension-agent-plugin.js +2 -1
  166. package/dist/src/config/schema.js +4 -4
  167. package/dist/src/connectors/china-catalog.js +5 -1
  168. package/dist/src/connectors/connected-source-ingestion.js +6 -1
  169. package/dist/src/connectors/connected-source-observations.d.ts +10 -0
  170. package/dist/src/connectors/connected-source-observations.js +80 -0
  171. package/dist/src/connectors/connected-source-understanding.js +198 -8
  172. package/dist/src/connectors/learning-coordinator.js +63 -26
  173. package/dist/src/connectors/learning-recipes.js +19 -2
  174. package/dist/src/discussions/audio-repair.d.ts +1 -1
  175. package/dist/src/discussions/live-worker.js +1 -3
  176. package/dist/src/discussions/recording.js +2 -2
  177. package/dist/src/discussions/sealer.js +2 -2
  178. package/dist/src/extensions/agent-plugins/auth.d.ts +2 -2
  179. package/dist/src/extensions/agent-plugins/auth.js +6 -35
  180. package/dist/src/extensions/agent-plugins/credentials.d.ts +2 -0
  181. package/dist/src/extensions/agent-plugins/credentials.js +37 -0
  182. package/dist/src/extensions/agent-plugins/plugin-oauth-scope.d.ts +1 -0
  183. package/dist/src/extensions/agent-plugins/plugin-oauth-scope.js +8 -0
  184. package/dist/src/extensions/marketplace.d.ts +4 -0
  185. package/dist/src/extensions/marketplace.js +4 -0
  186. package/dist/src/gateway/file-space-service.d.ts +9 -2
  187. package/dist/src/gateway/hono/routes/agent-plugins.js +2 -1
  188. package/dist/src/gateway/hono/routes/config.js +0 -3
  189. package/dist/src/gateway/hono/routes/connectors.js +3 -10
  190. package/dist/src/gateway/hono/routes/context-sources.d.ts +0 -1
  191. package/dist/src/gateway/hono/routes/context-sources.js +12 -15
  192. package/dist/src/gateway/hono/routes/status.js +0 -1
  193. package/dist/src/gateway/hono/routes/user-model.js +21 -3
  194. package/dist/src/gateway/hono/routes/voice.js +0 -67
  195. package/dist/src/gateway/service.js +6 -4
  196. package/dist/src/media-understanding/types.d.ts +1 -1
  197. package/dist/src/memory-maintenance/service.d.ts +1 -0
  198. package/dist/src/memory-maintenance/service.js +13 -0
  199. package/dist/src/migrations/retired-local-stt.d.ts +2 -0
  200. package/dist/src/migrations/retired-local-stt.js +52 -0
  201. package/dist/src/migrations/runner.js +2 -1
  202. package/dist/src/session/turn-outcome-projector.js +1 -1
  203. package/dist/src/storage/sqlite/connection.js +1 -0
  204. package/dist/src/storage/sqlite/migrations/207_user_model_policy_contract.sql +121 -0
  205. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  206. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  207. package/dist/src/storage/sqlite/schema.js +1 -1
  208. package/dist/src/storage/sqlite/sql-assets.d.ts +1 -0
  209. package/dist/src/storage/sqlite/sql-assets.js +7 -4
  210. package/dist/src/tasks/index.js +2 -2
  211. package/dist/src/tasks/task-application-service.d.ts +1 -0
  212. package/dist/src/tasks/task-application-service.js +4 -2
  213. package/dist/src/tasks/task-context-assembler.js +10 -1
  214. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  215. package/dist/src/tasks/task-run-dispatcher.js +15 -2
  216. package/dist/src/user-context/sources/consent-repository.d.ts +7 -0
  217. package/dist/src/user-context/sources/consent-repository.js +81 -0
  218. package/dist/src/user-context/sources/index.d.ts +1 -0
  219. package/dist/src/user-context/sources/index.js +2 -1
  220. package/dist/src/user-context/sources/repository.js +73 -1
  221. package/dist/src/user-context/sources/types.d.ts +16 -0
  222. package/dist/src/user-model/action-rule-suggestions.d.ts +11 -0
  223. package/dist/src/user-model/action-rule-suggestions.js +29 -0
  224. package/dist/src/user-model/bootstrap.js +1 -1
  225. package/dist/src/user-model/capture/executor.js +83 -7
  226. package/dist/src/user-model/capture/semantic.d.ts +5 -2
  227. package/dist/src/user-model/capture/semantic.js +27 -11
  228. package/dist/src/user-model/domain.d.ts +26 -0
  229. package/dist/src/user-model/domain.js +40 -2
  230. package/dist/src/user-model/index.d.ts +2 -0
  231. package/dist/src/user-model/index.js +6 -4
  232. package/dist/src/user-model/maintenance-policy.d.ts +1 -0
  233. package/dist/src/user-model/maintenance-policy.js +13 -0
  234. package/dist/src/user-model/observation-repository.d.ts +48 -0
  235. package/dist/src/user-model/observation-repository.js +100 -0
  236. package/dist/src/user-model/repository.d.ts +5 -0
  237. package/dist/src/user-model/repository.js +121 -10
  238. package/dist/src/user-model/usage-policy.d.ts +5 -2
  239. package/dist/src/user-model/usage-policy.js +2 -2
  240. package/dist/src/voice/audio/normalize.d.ts +1 -1
  241. package/dist/src/voice/audio/normalize.js +1 -1
  242. package/dist/src/voice/{local → audio}/wav.js +1 -1
  243. package/dist/src/voice/language-profile.js +10 -16
  244. package/dist/src/voice/metadata/builtin.js +0 -46
  245. package/dist/src/voice/stt/providers/index.d.ts +0 -1
  246. package/dist/src/voice/stt/providers/index.js +1 -2
  247. package/dist/src/voice/stt/types.js +3 -4
  248. package/dist/src/voice/tts/merge-config.js +1 -1
  249. package/dist/src/voice/tts/speech-registry.d.ts +1 -1
  250. package/dist/src/voice/tts/types.d.ts +1 -1
  251. package/dist/src/work-discovery/analyzer.js +6 -5
  252. package/dist/src/work-discovery/service.js +2 -2
  253. package/dist/src/work-discovery/types.d.ts +1 -1
  254. package/dist/src/workflows/context/workflow-context.js +5 -1
  255. package/dist/src/workflows/index.js +2 -2
  256. package/dist/src/workflows/service/workflow-run-service.d.ts +1 -0
  257. package/dist/src/workflows/service/workflow-run-service.js +13 -4
  258. package/package.json +13 -17
  259. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CxcIHW_Z.js +0 -1
  260. package/dist/gateway/static/root/assets/agent-plugin-dialog-CNuqJcHQ.js +0 -1
  261. package/dist/gateway/static/root/assets/agents-CPpmkx7O.js +0 -1
  262. package/dist/gateway/static/root/assets/apps-page-6xEgLDv8.js +0 -1
  263. package/dist/gateway/static/root/assets/automations-workspace-rztQnZDk.js +0 -7
  264. package/dist/gateway/static/root/assets/browser-automations-page-D96o3bDY.js +0 -3
  265. package/dist/gateway/static/root/assets/browser-settings-page-DUQzQ3ic.js +0 -3
  266. package/dist/gateway/static/root/assets/capabilities-settings-panel-CKWtXof8.js +0 -8
  267. package/dist/gateway/static/root/assets/channels-settings-C8ducWB7.js +0 -1
  268. package/dist/gateway/static/root/assets/computer-settings-page-uy9YDwxJ.js +0 -1
  269. package/dist/gateway/static/root/assets/connector-service-page-BpF0SjB9.js +0 -1
  270. package/dist/gateway/static/root/assets/connectors-page-eZTfIMWI.js +0 -2
  271. package/dist/gateway/static/root/assets/date-picker-Do1dl0La.js +0 -1
  272. package/dist/gateway/static/root/assets/dependency-picker-BhS8s080.js +0 -1
  273. package/dist/gateway/static/root/assets/desktop-pet-settings-Dv3vG9HZ.js +0 -1
  274. package/dist/gateway/static/root/assets/device-pairing-wizard-DdvO1O6W.js +0 -1
  275. package/dist/gateway/static/root/assets/gateway-settings-CLZyN-u9.js +0 -1
  276. package/dist/gateway/static/root/assets/home-page-BSqg-JE9.js +0 -1
  277. package/dist/gateway/static/root/assets/imports-page-_pddpuej.js +0 -1
  278. package/dist/gateway/static/root/assets/index-BKL5tg2f.css +0 -1
  279. package/dist/gateway/static/root/assets/index-CJuypaNt.js +0 -121
  280. package/dist/gateway/static/root/assets/local-app-workbench-page-DXFnYiA0.js +0 -1
  281. package/dist/gateway/static/root/assets/local-apps-page-CkXKS5xe.js +0 -1
  282. package/dist/gateway/static/root/assets/logs-page-C33z-ife.js +0 -2
  283. package/dist/gateway/static/root/assets/management-settings-8eDZb0uS.js +0 -1
  284. package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +0 -3
  285. package/dist/gateway/static/root/assets/note-detail-panel-C95RtLuL.js +0 -5
  286. package/dist/gateway/static/root/assets/notes-page-kFxknjMR.js +0 -8
  287. package/dist/gateway/static/root/assets/page-context-capture-button-OUL3fEYh.js +0 -1
  288. package/dist/gateway/static/root/assets/page-tabs-CVbY7_N5.js +0 -1
  289. package/dist/gateway/static/root/assets/preview-open-alternatives-CKiIby0r.js +0 -1
  290. package/dist/gateway/static/root/assets/project-detail-page-LPAxUszX.js +0 -1
  291. package/dist/gateway/static/root/assets/projects-page-Cbyb4hyy.js +0 -1
  292. package/dist/gateway/static/root/assets/remote-access-hub-BtDFZc6g.js +0 -1
  293. package/dist/gateway/static/root/assets/scenes-page-CJlc-mg1.js +0 -2
  294. package/dist/gateway/static/root/assets/sessions-page-CUo6-iV2.js +0 -1
  295. package/dist/gateway/static/root/assets/settings-advanced-gate-XeSxPjP7.js +0 -1
  296. package/dist/gateway/static/root/assets/settings-form-section-Dol9j_pF.js +0 -1
  297. package/dist/gateway/static/root/assets/settings-page-layout-eqTUTW2L.js +0 -1
  298. package/dist/gateway/static/root/assets/setup-status-panel-BCt__prc.js +0 -1
  299. package/dist/gateway/static/root/assets/shares-settings-BsjSqEnw.js +0 -1
  300. package/dist/gateway/static/root/assets/skill-reload-api-evN7gs0S.js +0 -1
  301. package/dist/gateway/static/root/assets/skills-page-BifYwEhe.js +0 -2
  302. package/dist/gateway/static/root/assets/skills-page.utils-DOk-iOvN.js +0 -1
  303. package/dist/gateway/static/root/assets/system-settings-panel-CcSvoHfY.js +0 -1
  304. package/dist/gateway/static/root/assets/task-detail-page-pCRG7Jb3.js +0 -1
  305. package/dist/gateway/static/root/assets/tunnel-api-DDGMf44u.js +0 -1
  306. package/dist/gateway/static/root/assets/use-autosave-DiIkxIq7.js +0 -1
  307. package/dist/gateway/static/root/assets/user-model-page-CvYeM0Ml.js +0 -2
  308. package/dist/gateway/static/root/assets/voice-config-api-BaxITrwZ.js +0 -1
  309. package/dist/gateway/static/root/assets/workflow-run-setup-panel-DbVtLh0R.js +0 -3
  310. package/dist/gateway/static/root/assets/workflows-page-CT8ouKcB.js +0 -6
  311. package/dist/src/voice/local/model-files.d.ts +0 -14
  312. package/dist/src/voice/local/model-files.js +0 -92
  313. package/dist/src/voice/local/model-manager.d.ts +0 -18
  314. package/dist/src/voice/local/model-manager.js +0 -133
  315. package/dist/src/voice/local/models.d.ts +0 -28
  316. package/dist/src/voice/local/models.js +0 -99
  317. package/dist/src/voice/local/provider-switch.d.ts +0 -4
  318. package/dist/src/voice/local/provider-switch.js +0 -36
  319. package/dist/src/voice/local/runtime-client.d.ts +0 -28
  320. package/dist/src/voice/local/runtime-client.js +0 -183
  321. package/dist/src/voice/local/runtime-worker.d.ts +0 -1
  322. package/dist/src/voice/local/runtime-worker.js +0 -271
  323. package/dist/src/voice/stt/providers/local-transcription.d.ts +0 -2
  324. package/dist/src/voice/stt/providers/local-transcription.js +0 -53
  325. /package/dist/src/voice/{local → audio}/wav.d.ts +0 -0
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./createLucideIcon-DPHK1VkS.js";import{a as l,i as u,n as d,r as f,t as p}from"./note-detail-panel-xsKDIJdK.js";import{t as m}from"./calendar-clock-D-quYVPe.js";import{t as h}from"./check-DUBLcKHA.js";import{t as g}from"./chevron-left-DqFhpbvK.js";import{n as _,r as v,t as y}from"./popover-select-DcsFzD_i.js";import{t as b}from"./circle-check-C23XjkUj.js";import{t as x}from"./copy-Dv6d4Dvw.js";import{t as S}from"./download-Dk-ZjtO6.js";import{t as C}from"./external-link-DjqjBmc3.js";import{f as w,m as T,t as E}from"./markdown-view-DXubGEic.js";import{t as D}from"./git-branch-Dh9uxTot.js";import{t as O}from"./image-Cwyalflz.js";import{t as k}from"./layout-grid-CEVZdVFU.js";import{t as A}from"./automations-workspace-Cc4yqiF6.js";import{t as j}from"./loader-circle-CifKLtgG.js";import{t as M}from"./lock-keyhole-DEK5kH0u.js";import{t as N}from"./message-square-plus-XP0tGdlV.js";import{t as P}from"./paperclip-f1HujQY1.js";import{t as F}from"./plus-Q2yW6OE7.js";import{t as I}from"./search-DA7gz22f.js";import{t as L}from"./store-SzD1Jvgm.js";import{t as R}from"./upload-rrb46c3c.js";import{t as z}from"./user-round-C9jxPhMR.js";import{t as B}from"./x-B_N4OPjy.js";import{t as ee}from"./messages-D0G_sZvA.js";import{t as V}from"./cn-JdwAhgNB.js";import{a as H,c as U,f as W,n as te,r as G}from"./locale-store-BSkKhYkc.js";import{a as ne,i as K,n as re,o as ie,r as ae,s as oe,t as se}from"./dist-BGTk37IG.js";import{i as ce,t as le}from"./tasks-CDR_RVbQ.js";import{t as ue}from"./copy-to-clipboard-HOJ79TWv.js";import{i as de}from"./vendor-swr-BIWyz7Rc.js";import{t as q}from"./button-CS04eWY9.js";import{a as fe,i as pe,n as J,o as me,r as Y}from"./dist-3h6cXXhT.js";import{t as he}from"./skeleton-BwbyijEw.js";import{$c as ge,$l as _e,Ba as ve,Bc as ye,Bn as be,Ca as xe,Cc as Se,Co as Ce,Da as we,Di as Te,Ea as Ee,Eo as De,Fl as Oe,Ga as ke,Gc as Ae,Hc as je,Hl as Me,Hn as Ne,Ic as Pe,Jt as Fe,Ka as Ie,Kc as Le,Lr as Re,Ml as ze,Na as Be,Nc as Ve,Oa as He,Oc as Ue,Pc as We,Qc as Ge,Ql as Ke,Ri as qe,Rn as Je,Rr as Ye,Sa as Xe,So as Ze,Ta as Qe,Tn as $e,Ua as et,Ul as tt,Un as nt,Vi as rt,Vn as it,Wc as at,Wi as ot,Wl as st,Wn as ct,Xc as lt,Xl as ut,Yi as dt,Yn as ft,Zi as pt,_a as mt,_l as ht,_o as gt,_r as _t,ba as vt,bl as yt,bo as bt,co as xt,cr as St,do as Ct,ec as wt,el as Tt,eu as Et,fl as Dt,fo as Ot,gc as kt,go as At,hc as jt,ho as Mt,ir as Nt,ka as Pt,ll as Ft,ls as It,mo as Lt,mr as Rt,nl as zt,oc as Bt,oo as Vt,or as Ht,pi as Ut,po as Wt,qn as Gt,rc as Kt,so as qt,sr as Jt,tc as Yt,ts as Xt,uo as Zt,va as Qt,vl as $t,vo as en,wa as tn,wl as nn,xa as rn,xl as an,xn as on,xo as sn,yc as cn,yo as ln,zl as un,zn as dn,zo as fn}from"./index-Cr4SINLG.js";import{o as pn}from"./skill-api-BCAV_F1P.js";import{n as mn,t as hn}from"./use-autosave-ZTHe1zCM.js";import{t as gn}from"./page-context-capture-button-C3JiQEKD.js";import{t as _n}from"./directory-picker-path-field-BfxaNwMB.js";import{a as vn,t as yn}from"./skill-card-icon-BrrpZ3Mw.js";import{t as bn}from"./date-picker-DXQTsUJn.js";import{t as xn}from"./dependency-picker-B_z3zihW.js";import{c as Sn,l as Cn,n as wn,o as Tn,r as En,t as Dn}from"./style-TIDOdKy0.js";var On=c(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),kn=c(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),An=c(`focus`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]),X=c(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),jn=c(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Mn=c(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Nn=n(),Z=e(t(),1),Q=r();function Pn(e){let t=(0,Nn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Z.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ye(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=V(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(ht,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Q.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=V(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,Q.jsx)(_t,{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 Fn(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 In(e){let t=(0,Nn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Re(),f=Re($),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=V(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=V(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,Q.jsx)(j,{className:`size-3.5 animate-spin`}):m?(0,Q.jsx)(Tt,{className:`size-3.5`}):(0,Q.jsx)(lt,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,Q.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(0,Q.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:k}})}),t[23]=k,t[24]=A);let M;t[25]!==_||t[26]!==p||t[27]!==g?(M=Fn(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==A||t[32]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,N]}),t[31]=A,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==C||t[36]!==O?(F=(0,Q.jsxs)(`div`,{className:C,onClick:Ln,children:[O,P]}),t[34]=P,t[35]=C,t[36]=O,t[37]=F):F=t[37],F}function Ln(e){return e.stopPropagation()}function $(e){return e.toggle}function Rn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function zn(e){let t=(0,Nn.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,d=r===void 0?!1:r,f;t[0]!==c||t[1]!==n?(f=Rn(n,c),t[0]=c,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,Z.useState)(Kn),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==l?(g=u(n.createdAt,h,l),t[3]=n.createdAt,t[4]=h,t[5]=l,t[6]=g):g=t[6];let _=g,v,y;t[7]!==n.id||t[8]!==i?(v=()=>i(n.id),y=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b=d?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,x;t[11]===b?x=t[12]:(x=V(`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`,b),t[11]=b,t[12]=x);let S=d?`true`:void 0,C;t[13]===d?C=t[14]:(C=d?(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=d,t[14]=C);let w;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(w=n.coverAttachmentId?(0,Q.jsx)(Pn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Q.jsx)(In,{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]=w):w=t[20];let T;t[21]===n.title?T=t[22]:(T=n.title&&(0,Q.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=T);let E=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=V(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let O;t[25]!==p||t[26]!==D?(O=(0,Q.jsx)(`p`,{className:D,children:p}),t[25]=p,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==T||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,O]}),t[28]=T,t[29]=O,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(kn,{className:`size-4`}),t[31]=A):A=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,Q.jsx)(ct,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:Gn,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:A})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(Un)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,Q.jsx)(Ge,{className:`size-4`}):(0,Q.jsx)(ge,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,Q.jsxs)(be,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Hn)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(Et,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,Q.jsxs)(be,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(nt,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Vn)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(Ue,{className:`size-4`}),t[55]=ee):ee=t[55];let H;t[56]!==c.delete||t[57]!==B?(H=(0,Q.jsxs)(be,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[ee,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=H):H=t[58];let U;t[59]!==F||t[60]!==R||t[61]!==H?(U=(0,Q.jsx)(it,{children:(0,Q.jsxs)(dn,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:Wn,children:[F,R,z,H]})}),t[59]=F,t[60]=R,t[61]=H,t[62]=U):U=t[62];let W;t[63]!==j||t[64]!==U?(W=(0,Q.jsxs)(Ne,{children:[j,U]}),t[63]=j,t[64]=U,t[65]=W):W=t[65];let te;t[66]!==w||t[67]!==k||t[68]!==W?(te=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[w,k,W]}),t[66]=w,t[67]=k,t[68]=W,t[69]=te):te=t[69];let G;t[70]===n.pinned?G=t[71]:(G=n.pinned&&(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,Q.jsx)(ge,{className:`size-3`})}),t[70]=n.pinned,t[71]=G);let ne;t[72]===n.tags?ne=t[73]:(ne=n.tags?.slice(0,2).map(Bn),t[72]=n.tags,t[73]=ne);let K;t[74]===_?K=t[75]:(K=(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:_}),t[74]=_,t[75]=K);let re;t[76]!==G||t[77]!==ne||t[78]!==K?(re=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[G,ne,K]}),t[76]=G,t[77]=ne,t[78]=K,t[79]=re):re=t[79];let ie;return t[80]!==te||t[81]!==re||t[82]!==v||t[83]!==y||t[84]!==x||t[85]!==S||t[86]!==C?(ie=(0,Q.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:v,onKeyDown:y,className:x,"aria-current":S,children:[C,te,re]}),t[80]=te,t[81]=re,t[82]=v,t[83]=y,t[84]=x,t[85]=S,t[86]=C,t[87]=ie):ie=t[87],ie}function Bn(e){return(0,Q.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function Vn(){}function Hn(){}function Un(){}function Wn(e){return e.stopPropagation()}function Gn(e){return e.stopPropagation()}function Kn(){return Date.now()}var qn=3e4;function Jn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Yn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(0),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(null),E=(0,Z.useRef)(null),D=(0,Z.useRef)(null),k=(0,Z.useRef)([]),A=(0,Z.useRef)(0),j=(0,Z.useRef)(null),M=(0,Z.useRef)(null),N=(0,Z.useCallback)(()=>{j.current&&=(clearInterval(j.current),null),M.current&&=(clearTimeout(M.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,k.current=[],b(!1),S(0)},[]);(0,Z.useEffect)(()=>()=>N(),[N]);let P=(0,Z.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-A.current)/1e3)),n=e.mimeType||Jn()||`audio/webm`,r=new Blob(k.current,{type:n});if(N(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{w(!1)}return}w(!1)},[N,c]),I=(0,Z.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=Jn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,k.current=[],A.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&k.current.push(e.data)},n.start(),b(!0),S(0),j.current=setInterval(()=>{S(Math.round((Date.now()-A.current)/1e3))},250),M.current=setTimeout(()=>{P()},qn)}catch{N(),l?.()}}},[N,c,l,y,P,C]),L=(0,Z.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),R=(0,Z.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||C,B=!!(s||c||p);return(0,Q.jsxs)(`div`,{className:V(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[y?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void P(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,Q.jsx)(We,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(ct,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,disabled:z,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":n,title:n,children:(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(it,{children:(0,Q.jsxs)(dn,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,Q.jsxs)(be,{disabled:d,onSelect:s,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(O,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,Q.jsxs)(be,{disabled:f,onSelect:()=>void I(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(Ft,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,Q.jsxs)(be,{onSelect:p,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(ut,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,Q.jsx)(`textarea`,{ref:T,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,Q.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:V(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,Q.jsx)(at,{className:`size-4`,"aria-hidden":!0})})]})}var Xn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Zn=240,Qn=320,$n=520,er=560;function tr(e){if(globalThis.localStorage===void 0)return Qn;try{let t=globalThis.localStorage.getItem(e);if(!t)return Qn;let n=Number(t);return Number.isFinite(n)?n:Qn}catch{return Qn}}function nr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var rr={thought:Ve,todo:Mn,voice:Ft,media:O,bookmark:l,mixed:Ve,task:Mn};function ir(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function ar(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function or(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function sr({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:l,emptyDescription:m,listWidthStorageKey:h=`xopc.notes.listWidth`}){let g=te(e=>e.language),y=ee(g).notes,b=!!U(e=>e.conversationId),[x,S]=(0,Z.useReducer)(Be,Xn),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(``),[D,O]=(0,Z.useState)(0),[k,A]=(0,Z.useState)(()=>tr(h)),[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(!1),[z,H]=(0,Z.useState)(null),[G,ce]=(0,Z.useState)(null),le=(0,Z.useRef)(null),ue=(0,Z.useRef)(null),[q]=(0,Z.useState)(()=>Date.now()),fe=i(),pe=(0,Z.useCallback)(e=>{let t=le.current?.clientWidth??window.innerWidth,n=Math.max(Zn,t-er);return Math.max(Zn,Math.min(Math.min($n,n),e))},[]),J=(0,Z.useCallback)(e=>{let t=pe(e);A(t),nr(h,t)},[pe,h]);(0,Z.useLayoutEffect)(()=>{A(e=>pe(e))},[pe]);let{data:me,mutate:Y,isLoading:he}=de((0,Z.useMemo)(()=>b?[`notes-list`,o,x.statusFilter,x.kindFilter,x.pinnedOnly]:null,[b,o,x.statusFilter,x.kindFilter,x.pinnedOnly]),()=>Nt({status:x.statusFilter===`all`?void 0:x.statusFilter,kind:x.kindFilter===`all`?void 0:x.kindFilter,projectId:o,pinned:x.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ge=he&&!me,_e=me?.items??[],ve=me?.total??0,ye=T.trim(),{data:be,isLoading:xe}=de(b&&C&&ye?[`notes-search`,o,ye]:null,()=>Nt({search:ye,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),Se=be?.items??[],Ce=e?_e.some(t=>t.id===e):!0;(0,Z.useEffect)(()=>{O(0)},[ye]),(0,Z.useEffect)(()=>{D>=Se.length&&O(Math.max(0,Se.length-1))},[D,Se.length]),(0,Z.useEffect)(()=>{let e=()=>{Y().catch(e=>{H(`${y.refreshFailed}: ${e instanceof Error?e.message:y.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,y.quickCaptureFailedHint,y.refreshFailed]);let we=De(e=>e.setPageHeader),Te=De(e=>e.clearPageHeader),Ee=y.noteCount.replace(`{{count}}`,String(ve)),Oe=!r&&ve===0&&c?c:Ee,ke=y.searchDialogTitle,Ae=y.searchClose,je=y.searchClear,Me=(0,Z.useMemo)(()=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>w(!0),className:V(`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`,Xt),"aria-label":ke,children:[(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:ke})]}),[ke]);(0,Z.useLayoutEffect)(()=>{if(n)return b?(we({startExtra:null,main:(0,Q.jsxs)(`div`,{className:V(`flex min-w-0 items-center gap-2`,Xt),children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??y.title}),Ee?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Ee}):null]}),end:Me}),()=>Te()):(Te(),()=>Te())},[Te,b,Me,s,n,y.title,Ee,e,we]);let Ne=(0,Z.useMemo)(()=>({justNow:y.justNow,minutesAgo:y.minutesAgo,today:y.today,yesterday:y.yesterday,daysAgo:y.daysAgo,locale:W(g)}),[g,y.justNow,y.minutesAgo,y.today,y.yesterday,y.daysAgo]),Pe=(0,Z.useMemo)(()=>[{id:`recent`,label:y.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:y.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:y.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:y.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:y.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:y.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:y.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:y.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:y.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[y.filterArchived,y.filterInbox,y.filterProcessed,y.kindBookmark,y.kindMedia,y.kindVoice,y.pinned,y.viewRecent,y.viewTasks]),Fe=Pe.find(e=>ar(x,e))??Pe[0],Ie=s??Fe.label,Le=(0,Z.useCallback)(async e=>{H(null);try{let n=o?await Gt({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Ht(e,`web`);await Y(),fe(or(t,n.id))}catch(e){throw H(`${y.quickCaptureFailed}: ${e instanceof Error?e.message:y.quickCaptureFailedHint}`),e}},[t,Y,y.quickCaptureFailed,y.quickCaptureFailedHint,fe,o]),Re=(0,Z.useCallback)(async()=>{if(!L){R(!0),H(null);try{let e=await Gt({markdown:``,kind:`thought`,projectId:o,channel:`web`});S({type:`patch`,patch:Xn}),await Y(),ce(e.id),fe(or(t,e.id))}catch(e){H(`${y.createBlankFailed}: ${e instanceof Error?e.message:y.createBlankFailedHint}`)}finally{R(!1)}}},[t,L,Y,y.createBlankFailed,y.createBlankFailedHint,fe,o]),ze=(0,Z.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{H(null),await Jt(t,`web`),await Y()}catch(e){H(`${y.imageUploadFailed}: ${e instanceof Error?e.message:y.imageUploadFailedHint}`)}},e.click()},[Y,y.imageUploadFailed,y.imageUploadFailedHint]),He=(0,Z.useCallback)(async(e,t)=>{try{H(null),await St(e,t,`web`),await Y()}catch(e){H(`${y.voiceUploadFailed}: ${e instanceof Error?e.message:y.voiceUploadFailedHint}`)}},[Y,y.voiceUploadFailed,y.voiceUploadFailedHint]),Ue=(0,Z.useCallback)(()=>{H(`${y.voiceCaptureFailed}: ${y.voiceCaptureFailedHint}`)},[y.voiceCaptureFailed,y.voiceCaptureFailedHint]),We=(0,Z.useCallback)(async(e,t)=>{H(null);try{await Rt(e,{pinned:t}),await Y()}catch(e){H(`${y.actionFailed}: ${e instanceof Error?e.message:y.quickCaptureFailedHint}`)}},[Y,y.actionFailed,y.quickCaptureFailedHint]),Ge=(0,Z.useCallback)(async e=>{H(null);try{await Rt(e,{status:`archived`}),await Y()}catch(e){H(`${y.actionFailed}: ${e instanceof Error?e.message:y.quickCaptureFailedHint}`)}},[Y,y.actionFailed,y.quickCaptureFailedHint]),Ke=(0,Z.useCallback)(async e=>{H(null);try{await ft(e),await Y()}catch(e){H(`${y.actionFailed}: ${e instanceof Error?e.message:y.quickCaptureFailedHint}`)}},[Y,y.actionFailed,y.quickCaptureFailedHint]),qe=(0,Z.useCallback)(e=>{fe(or(t,e))},[t,fe]),Ye=(0,Z.useCallback)(e=>{fe(or(t,e)),w(!1)},[t,fe]),Xe=(0,Z.useCallback)(e=>{if(Se.length){if(e.key===`ArrowDown`)e.preventDefault(),O(e=>Math.min(Se.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),O(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=Se[D]??Se[0];t&&Ye(t.id)}}},[D,Ye,Se]),Ze=(0,Z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ue.current;t.setPointerCapture(e.pointerId),M(!0);let r=le.current?.clientWidth??window.innerWidth,i=Math.max(Zn,r-er),a=Math.min($n,i),o=e=>Math.max(Zn,Math.min(a,e)),s=e.clientX,c=o(k),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}M(!1),le.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),A(f),nr(h,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[h,k]);(0,Z.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Re())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Re]);let Qe=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),J(k-16)):e.key===`ArrowRight`?(e.preventDefault(),J(k+16)):e.key===`Home`?(e.preventDefault(),J(Zn)):e.key===`End`&&(e.preventDefault(),J($n))},[J,k]);return b?(0,Q.jsxs)(`div`,{ref:le,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${k}px`},children:[(0,Q.jsxs)(`section`,{ref:ue,className:V(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!j&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,N?`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":N?!0:void 0,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[z?(0,Q.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:z}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,Q.jsx)(_,{value:Fe.id,onChange:e=>{let t=Pe.find(t=>t.id===e.target.value);t&&S({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":y.libraryTitle,children:Pe.map(e=>(0,Q.jsx)(v,{value:e.id,children:e.label},e.id))}):(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Ie}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Oe})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>P(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":y.collapseNotesList,title:y.collapseNotesList,children:(0,Q.jsx)(zt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:Re,disabled:L,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":y.createBlankNote,title:y.createBlankShortcut,children:(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>w(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":y.searchDialogTitle,title:y.searchDialogTitle,children:(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:ge?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Q.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):_e.length===0?(0,Q.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,Q.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,Q.jsx)(Ve,{className:`size-6`,"aria-hidden":!0})}),(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Ce?y.noteOutsideCurrentView:l??y.noNotes}),e&&!Ce?null:(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m??y.noNotesDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ce?(0,Q.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:y.noteOutsideCurrentView}):null,_e.map((t,n)=>{let r=n>0?d(_e[n-1].createdAt):null;return(0,Q.jsxs)(`div`,{children:[d(t.createdAt)!==r&&(0,Q.jsx)(`div`,{className:V(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:f(t.createdAt,q,Ne)}),(0,Q.jsx)(zn,{note:t,selected:t.id===e,onPress:qe,onPin:We,onArchive:Ge,onDelete:Ke,timeLabels:Ne,labels:{pin:y.pin,unpin:y.unpin,archive:y.archive,delete:y.delete,actions:y.noteActions,imageNote:y.imageNote,noText:y.noText}})]},t.id)})]})}),(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,Q.jsx)(Yn,{placeholder:y.quickCapturePlaceholder,submitLabel:y.quickCaptureSubmit,actionsLabel:y.quickCaptureActions,imageLabel:y.quickCaptureImage,voiceLabel:y.quickCaptureVoice,stopRecordingLabel:y.stopRecording,onCapture:Le,onImagePick:a?ze:void 0,onVoiceCapture:a?He:void 0,onVoiceError:Ue,recordingLabel:y.recording,discussionCaptureLabel:y.discussionCapture.title,onDiscussionCapture:()=>Je(o)})})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":y.resizeNotesList,"aria-valuemin":Zn,"aria-valuemax":$n,"aria-valuenow":Math.round(k),tabIndex:0,onPointerDown:Ze,onDoubleClick:()=>J(Qn),onKeyDown:Qe,title:y.resizeNotesList,className:V(`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`,N?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,Q.jsx)(`span`,{"aria-hidden":!0,className:V(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,j&&`bg-accent scale-x-[2]`)})}),(0,Q.jsxs)(`section`,{className:V(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[N?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>P(!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":y.expandNotesList,title:y.expandNotesList,children:(0,Q.jsx)(zt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Q.jsx)(p,{noteId:e,onBack:()=>fe(t),onSaved:()=>{Y().catch(e=>{H(`${y.refreshFailed}: ${e instanceof Error?e.message:y.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>w(!0),autoFocus:e===G,onAutoFocusConsumed:()=>ce(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(Ve,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:y.emptyEditorTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:y.emptyEditorDescription}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Re,disabled:L,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),L?y.creatingBlankNote:y.createBlankNote]})]})})]}),(0,Q.jsx)(se,{open:C,onOpenChange:w,children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(oe,{className:`text-sm font-semibold text-fg`,children:ke}),(0,Q.jsx)(K,{className:`sr-only`,children:y.searchPlaceholder}),(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Ae,children:(0,Q.jsx)(B,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:T,onChange:e=>E(e.target.value),onKeyDown:Xe,placeholder:y.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,Q.jsx)(`button`,{type:`button`,onClick:()=>E(``),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":je,children:(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:ye?xe&&!be?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):Se.length===0?(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(Ve,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:y.searchNoResults}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y.searchNoResultsDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:y.searchResultsCount.replace(`{{count}}`,String(be?.total??Se.length))}),Se.map((e,t)=>{let n=rr[e.kind]||Ve,r=ir(e,{imageNote:y.imageNote,noText:y.noText});return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>Ye(e.id),onMouseEnter:()=>O(t),className:V(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===D?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Q.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:u(e.updatedAt,q,Ne)})]}),e.title?(0,Q.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Q.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Q.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(I,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:y.searchEmptyTitle}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y.searchEmptyDescription})]})})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Q.jsx)(Ve,{className:`size-10 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y.needToken})]})}function cr(e){return H(G(`/api/projects/${encodeURIComponent(e)}/skills`))}function lr(e,t){return H(G(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function ur(e,t){return H(G(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function dr(e,t){let n=new FormData;return n.set(`file`,t),H(G(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function fr(e,t,n={}){return H(G(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function pr(e,t){return H(G(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function mr(e,t){return H(G(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function hr({projectId:e,copy:t}){let n=te(e=>e.language),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)([]),[s,c]=(0,Z.useState)([]),[l,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(null),[h,_]=(0,Z.useState)(!1),[v,b]=(0,Z.useState)(!0),[x,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(null),[E,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(null),[j,N]=(0,Z.useState)(null),[P,z]=(0,Z.useState)(``),[ee,H]=(0,Z.useState)(1),[U,W]=(0,Z.useState)(null),[G,K]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(``),[ue,de]=(0,Z.useState)(``),J=(0,Z.useRef)(null),ge=(0,Z.useCallback)(async()=>{b(!0),O(``);try{let t=await cr(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){O(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,Z.useEffect)(()=>{ge()},[ge]),(0,Z.useEffect)(()=>{let t=!1;return At(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Z.useEffect)(()=>{if(!d){m(null);return}let e=l.find(e=>e.key===d),t=!1;return m(null),O(``),_(!0),rt(e?.agentId??e?.routing?.agentId,d,!0).then(e=>{t||m(e)}).catch(e=>{t||O(e instanceof Error?e.message:String(e))}).finally(()=>{t||_(!1)}),()=>{t=!0}},[d,l]),(0,Z.useEffect)(()=>{if(k!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{K(!0),le(``),pn({q:P,page:ee,pageSize:8,sort:`downloads`,signal:e.signal}).then(W).catch(t=>{e.signal.aborted||le(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||K(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[k,ee,P]);async function _e(e,t){C(!0),T(t??null),O(``);try{await e(),A(null),de(``),await ge()}catch(e){O(e instanceof Error?e.message:String(e))}finally{C(!1),T(null)}}async function ve(t){O(``);try{N((await lr(e,t)).skill)}catch(e){O(e instanceof Error?e.message:String(e))}}async function be(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){C(!0);try{await mr(e,n.directoryId),await ge()}catch(e){O(e instanceof Error?e.message:String(e))}finally{C(!1)}}}async function xe(){C(!0),O(``);try{await ur(e,!0),await ge()}catch(e){O(e instanceof Error?e.message:String(e))}finally{C(!1)}}let Se=s.find(e=>e.origin===`agents-workspace`),Ce=new Map(p?.skills.map(e=>[e.name,e]));return(0,Q.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(me,{asChild:!0,children:(0,Q.jsxs)(q,{type:`button`,children:[(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Q.jsx)(st,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Q.jsx)(pe,{children:(0,Q.jsxs)(Y,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Q.jsx)(yr,{icon:L,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>A(`marketplace`)}),(0,Q.jsx)(yr,{icon:D,title:t.source,hint:t.sourceHint,onClick:()=>A(`source`)}),(0,Q.jsx)(yr,{icon:R,title:t.upload,hint:t.uploadHint,onClick:()=>J.current?.click()})]})})]}),(0,Q.jsx)(`input`,{ref:J,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&_e(()=>dr(e,n)),t.target.value=``}})]})}),E?(0,Q.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:E}):null,Se?.state===`untrusted`?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,disabled:x,onClick:()=>void xe(),children:[(0,Q.jsx)(ye,{className:`size-4`,"aria-hidden":!0}),x?t.trusting:t.trustAction]})]}):null,l.length?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h?t.sessionLoading:d?p?.agentId:t.sessionViewAll})]}),(0,Q.jsx)(y,{value:d,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:f})]}):null,v?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Q.jsx)(he,{className:`h-36 rounded-lg`},e))}):r.length?(0,Q.jsx)(gr,{title:t.localTitle,items:r,copy:t,busy:x,availabilityByName:Ce,onPreview:ve,onRemove:be}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!v&&a.length?(0,Q.jsx)(gr,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:x,availabilityByName:Ce,onPreview:ve,onRemove:be}):null,(0,Q.jsx)(se,{open:k!==null,onOpenChange:e=>{e||A(null)},children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:V(`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`,k===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:k===`marketplace`?t.marketplace:t.source}),(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(B,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:k===`marketplace`?(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Q.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Q.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:P,onChange:e=>{z(e.target.value),H(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),ce?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:ce}):null,G&&!U?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Q.jsx)(he,{className:`h-32 rounded-lg`},e))}):U?.items.length?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:U.items.map(i=>{let a=ot(i,n),o=i.providerId??U.provider,s=vn(i,o),c=r.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===i.id||e.directoryId===s||e.name===i.name)),l=w===s;return(0,Q.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(yn,{name:i.name,className:`size-10`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,Q.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,Q.jsx)(q,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:x||c,onClick:()=>void _e(()=>fr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):G?null:(0,Q.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),U&&U.meta.totalPages>1?(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(U.meta.page)).replace(`{{total}}`,String(U.meta.totalPages))}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:G||ee<=1,onClick:()=>H(e=>Math.max(1,e-1)),children:[(0,Q.jsx)(g,{className:`size-4`}),t.marketplacePrevious]}),(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:G||ee>=U.meta.totalPages,onClick:()=>H(e=>e+1),children:[t.marketplaceNext,(0,Q.jsx)(tt,{className:`size-4`})]})]})]}):null]}):(0,Q.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Q.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:ue,onChange:e=>de(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`secondary`,children:t.close})}),(0,Q.jsx)(q,{type:`button`,disabled:x||!ue.trim(),onClick:()=>void _e(()=>pr(e,ue.trim())),children:x?t.installing:t.install})]})]})})]})]})}),(0,Q.jsx)(se,{open:!!j,onOpenChange:e=>{e||N(null)},children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-xl`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:j?.name}),(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(B,{className:`size-4`})})})]}),(0,Q.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:j?.bodyMarkdown})]})]})})]})}function gr(e){let t=(0,Nn.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,Q.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,Q.jsxs)(`article`,{className:V(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Et,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Q.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:_r(a,e.origin)}),e.writable?null:(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Q.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,Q.jsx)(`span`,{className:V(`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:vr(a,t)}):null]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Q.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,Q.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function _r(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 vr(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 yr(e){let t=(0,Nn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Q.jsx)(J,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function br(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 xr(e,t,n){let r=br(t),i=br(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var Sr={active:0,review:1,ready:2,backlog:3,closed:4},Cr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},wr={critical:0,high:1,normal:2,low:3};function Tr(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=Cr[e.operationalState]-Cr[t.operationalState];if(r!==0)return r;let i=Sr[e.phase]-Sr[t.phase];if(i!==0)return i;let a=wr[e.priority]-wr[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Er=[`backlog`,`ready`,`active`,`review`,`closed`];function Dr(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 Or(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function kr(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 Ar(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 jr(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Ar(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 Mr(e,t){let{incoming:n}=Ar(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 Nr(e,t){let{incoming:n,outgoing:r}=Ar(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 Pr={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 Fr(e){let t=(0,Nn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Pr[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=V(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(En,{type:`target`,position:Cn.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,Q.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Q.jsx)(X,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Q.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Q.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(En,{type:`source`,position:Cn.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,Q.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var Ir={taskNode:Fr};function Lr(e){let t=(0,Nn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(),[m,h]=(0,Z.useState)(),g=(0,Z.useRef)(null),_;t[0]!==r||t[1]!==n?(_=Mr(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Gr),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x;t[8]===b?x=t[9]:(x=new Set(b.map(Wr)),t[8]=b,t[9]=x);let S=x,w;if(t[10]!==r||t[11]!==S){let e;t[13]===S?e=t[14]:(e=e=>S.has(e.dependencyTaskId)&&S.has(e.dependentTaskId),t[13]=S,t[14]=e),w=r.filter(e),t[10]=r,t[11]=S,t[12]=w}else w=t[12];let T=w,E;t[15]!==T||t[16]!==b?(E=jr(b,T),t[15]=T,t[16]=b,t[17]=E):E=t[17];let D=E,O;t[18]!==f||t[19]!==T?(O=f?Nr(f,T):void 0,t[18]=f,t[19]=T,t[20]=O):O=t[20];let k=O,A;t[21]===f?A=t[22]:(A=e=>e.id===f,t[21]=f,t[22]=A);let j=b.find(A),M;t[23]===b?M=t[24]:(M=new Map(b.map(Ur)),t[23]=b,t[24]=M);let N=M,P;if(t[25]!==a.phases||t[26]!==D||t[27]!==k||t[28]!==b){let e;t[30]!==a.phases||t[31]!==D||t[32]!==k?(e=e=>({id:e.id,type:`taskNode`,position:D.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(k&&!k.has(e.id))}}),t[30]=a.phases,t[31]=D,t[32]=k,t[33]=e):e=t[33],P=b.map(e),t[25]=a.phases,t[26]=D,t[27]=k,t[28]=b,t[29]=P}else P=t[29];let F=P,I;if(t[34]!==k||t[35]!==N||t[36]!==T){let e;t[38]!==k||t[39]!==N?(e=e=>{let t=N.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(k&&(!k.has(e.dependencyTaskId)||!k.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Sn.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]=k,t[39]=N,t[40]=e):e=t[40],I=T.map(e),t[34]=k,t[35]=N,t[36]=T,t[37]=I}else I=t[37];let L=I,R,z;t[41]!==f||t[42]!==S?(R=()=>{f&&!S.has(f)&&p(void 0)},z=[f,S],t[41]=f,t[42]=S,t[43]=R,t[44]=z):(R=t[43],z=t[44]),(0,Z.useEffect)(R,z);let B,ee;t[45]!==L||t[46]!==m?(B=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},ee=[L,m],t[45]=L,t[46]=m,t[47]=B,t[48]=ee):(B=t[47],ee=t[48]),(0,Z.useEffect)(B,ee);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=H):H=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==b.length?(U=[u,c,b.length],t[50]=u,t[51]=c,t[52]=b.length,t[53]=U):U=t[53],(0,Z.useEffect)(H,U);let W;t[54]===f?W=t[55]:(W=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=W);let te=W,G;t[56]!==r||t[57]!==o?(G=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Hr);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=G):G=t[58];let ne=G,K;t[59]!==r||t[60]!==o||t[61]!==m?(K=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(Vr)))},t[59]=r,t[60]=o,t[61]=m,t[62]=K):K=t[62];let re=K,ie;t[63]===a.connectHint?ie=t[64]:(ie=(0,Q.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(Br),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,Q.jsx)(q,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(zr),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=j?(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:te,children:[(0,Q.jsx)(An,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,pe;t[75]!==a.removeDependency||t[76]!==re||t[77]!==m?(pe=m?(0,Q.jsx)(q,{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]=pe):pe=t[78];let J;t[79]!==ce||t[80]!==de||t[81]!==fe||t[82]!==pe?(J=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,fe,pe]}),t[79]=ce,t[80]=de,t[81]=fe,t[82]=pe,t[83]=J):J=t[83];let me;t[84]!==ie||t[85]!==J?(me=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[ie,J]}),t[84]=ie,t[85]=J,t[86]=me):me=t[86];let Y=b.length>0?(0,Q.jsxs)(`div`,{className:V(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,j&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Q.jsxs)(Tn,{nodes:F,edges:L,nodeTypes:Ir,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:ne,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Q.jsx)(Dn,{color:`var(--color-edge)`,gap:22,size:1}),(0,Q.jsx)(wn,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),j?(0,Q.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[j.phase]}),(0,Q.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:j.title}),j.operationalState===`blocked`&&j.blockedBy.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(j.blockedBy.length))}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:j.blockedBy.map(Rr)})]}):null,(0,Q.jsxs)(s,{to:cn(i,j.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Q.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),he;return t[87]!==me||t[88]!==Y?(he=(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,Y]}),t[87]=me,t[88]=Y,t[89]=he):he=t[89],he}function Rr(e){return(0,Q.jsx)(`li`,{children:e.title},e.id)}function zr(e){return!e}function Br(e){return!e}function Vr(e){return e.dependencyTaskId}function Hr(e){return e.dependencyTaskId}function Ur(e){return[e.id,e]}function Wr(e){return e.id}function Gr(e){return e.phase!==`closed`}function Kr(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var qr={backlog:un,ready:un,active:Dt,review:z,closed:b},Jr={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 Yr(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Xr(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 Zr(e){let t=(0,Nn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,h,g,_,v,y,x,S,C,w,T,E,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(h=kr(n),g=h!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?b:Oe,v=n.priority!==`normal`,_=v||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?w=t[24]:(w=()=>c(``),t[23]=c,t[24]=w),T=$r,t[25]!==l||t[26]!==n.id?(E=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=E):E=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=cn(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],x=V(`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]=f,t[7]=p,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19]);let O=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=V(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,Q.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=V(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,Q.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Q.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Q.jsx)(X,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Qr).join(`、`)})]}):n.attention[0]?(0,Q.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(Me,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==_||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=_?(0,Q.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Q.jsx)(`span`,{className:V(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,Q.jsx)(`span`,{className:V(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Yr(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Q.jsx)(`span`,{className:V(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Xr(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Q.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,Q.jsx)(Dt,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Q.jsxs)(`span`,{className:V(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,Q.jsx)(m,{className:`size-3`,"aria-hidden":!0}),Ut(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Q.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,Q.jsx)(m,{className:`size-3`,"aria-hidden":!0}),Ut(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=_,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==x?(L=(0,Q.jsxs)(u,{to:y,className:x,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=x,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==h||t[71]!==g||t[72]!==n?(R=h?(0,Q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[g?(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[g],title:i.actions[g],children:(0,Q.jsx)(z,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,Q.jsx)(Ke,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=h,t[71]=g,t[72]=n,t[73]=R):R=t[73];let B;return t[74]!==L||t[75]!==R||t[76]!==S||t[77]!==C||t[78]!==w||t[79]!==T||t[80]!==E||t[81]!==D?(B=(0,Q.jsxs)(`article`,{draggable:S,onDragStart:C,onDragEnd:w,onDragOver:T,onDrop:E,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=S,t[77]=C,t[78]=w,t[79]=T,t[80]=E,t[81]=D,t[82]=B):B=t[82],B}function Qr(e){return e.title}function $r(e){e.preventDefault(),e.stopPropagation()}function ei({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:l,ref:u}){let d=(0,Z.useRef)(null),f=(0,Z.useRef)(null),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(`board`),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(()=>crypto.randomUUID()),[O,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(`normal`),[N,F]=(0,Z.useState)(``),[I,L]=(0,Z.useState)([]),[R,z]=(0,Z.useState)(!1),[B,H]=(0,Z.useState)(null),U=te(e=>e.language),W=Te({chat:ee(U).chat}),G=Dr(e),ce=e.filter(e=>e.phase!==`closed`),le=(e,t)=>void i(e,t),ue=async(t,n)=>{let r=e.find(e=>e.id===p);if(m(null),!r||r.id===n)return;let o=G[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=Or(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})},de=async e=>{e.preventDefault();let t=O.trim();if(!(!t||R)){z(!0),H(null);try{let e=N?new Date(`${N}T23:59:59.999`).getTime():void 0;await c({requestId:T,objective:t,priority:j,dependsOnTaskIds:I,attachments:W.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),A(``),M(`normal`),F(``),L([]),W.clearAttachments(),E(crypto.randomUUID()),w(!1)}catch(e){H(e instanceof Error?e.message:r.createFailed)}finally{z(!1)}}},fe=()=>{E(crypto.randomUUID()),A(``),M(`normal`),F(``),L([]),W.clearAttachments(),H(null),w(!0)};(0,Z.useImperativeHandle)(u,()=>({openCreate:fe})),(0,Z.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[y]);let pe=(0,Z.useCallback)(e=>{let t=f.current;!t||t.pointerId!==e.pointerId||(f.current=null,g(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),J=(0,Z.useCallback)(e=>{if(e.button!==0||Kr(e.target))return;let t=d.current;t&&(f.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),me=(0,Z.useCallback)(e=>{let t=f.current,n=d.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,g(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Q.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,Q.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:V(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:V(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,Q.jsx)(`div`,{ref:d,className:V(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,h?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:J,onPointerMove:me,onPointerUp:pe,onPointerCancel:pe,onLostPointerCapture:e=>{f.current?.pointerId===e.pointerId&&(f.current=null,g(!1))},children:(0,Q.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Er.map(t=>{let i=qr[t],a=G[t];return(0,Q.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===p);r&&(r.phase===t||Or(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),ue(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-inset/70 p-2.5`,children:[(0,Q.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Q.jsxs)(`div`,{className:V(`flex items-center gap-1.5 rounded-md px-2 py-1`,Jr[t]),children:[(0,Q.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Q.jsx)(Zr,{task:e,returnTo:n,copy:r,busy:l===e.id,onAction:le,onDragStart:m,onDropBefore:e=>void ue(t,e)},e.id))})})]},t)})})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Lr,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,Q.jsx)(se,{open:C,onOpenChange:e=>{R||w(e)},children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,Q.jsx)(K,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void de(e),children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,Q.jsxs)(`div`,{className:V(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,W.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),R||W.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||W.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),W.setIsDragging(!1),R||W.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Q.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:O,onChange:e=>{A(e.target.value),H(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:R}),(0,Q.jsx)(qe,{attachments:W.attachments,topPadded:!1,onRemove:e=>{R||W.removeAttachment(e)}}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:R,onClick:()=>W.fileInputRef.current?.click(),children:[(0,Q.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,Q.jsx)(`input`,{ref:W.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{W.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,Q.jsx)(_,{value:j,onChange:e=>M(e.target.value),disabled:R,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Q.jsx)(v,{value:e,children:r.priorityOptions[e]},e))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(bn,{className:`min-h-10 bg-surface-base`,value:N,onChange:F,disabled:R,ariaLabel:r.dueDate})]})]}),(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,Q.jsx)(xn,{candidates:ce,selectedIds:I,disabled:R,onChange:L,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),B?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:B}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:R,children:r.cancel})}),(0,Q.jsx)(q,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:R||!O.trim(),children:R?r.creating:U===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),y?(0,Q.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Q.jsx)(`span`,{children:r.moved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=y;b(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:r.undo})]}):null]})}var ti=new Set([{id:`overview`,icon:jn},{id:`tasks`,icon:On},{id:`automations`,icon:Se},{id:`files`,icon:yt},{id:`notes`,icon:nn},{id:`skills`,icon:Pe},{id:`sessions`,icon:N},{id:`progress`,icon:$t},{id:`settings`,icon:je}].map(e=>e.id)),ni=`xopc.projectFiles.panelWidthPx`,ri=320,ii=220,ai=560;function oi(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 si(e){return Math.min(ai,Math.max(ii,Math.round(e)))}function ci(){try{let e=window.localStorage.getItem(ni);if(e==null)return ri;let t=Number.parseInt(e,10);return Number.isFinite(t)?si(t):ri}catch{return ri}}function li(e){try{window.localStorage.setItem(ni,String(si(e)))}catch{}}function ui(e){return!!(e&&ti.has(e))}function di(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function fi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ut(n)}function pi(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 mi(e){let t=(0,Nn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Q.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function hi(e=!1){return V(`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 gi(e){let t=(0,Nn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=V(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Q.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function _i(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function vi(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function yi(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function bi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function xi(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 Si(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Ci(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 wi(e){let t=e.sourceChannel?.trim();return t?Ti(t):``}function Ti(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ei(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 Di(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 Oi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Oi(e.children,t,n)}:e)}function ki({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)([e]),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(!1),[m,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(`new`),[x,S]=(0,Z.useState)(``),[C,w]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!0),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(null),N=(0,Z.useCallback)(async()=>{p(!0),g(null);try{let t=await gt({limit:100});l(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{p(!1)}},[e]);(0,Z.useEffect)(()=>{l(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Z.useEffect)(()=>{o&&N()},[N,o]);let P=(0,Z.useMemo)(()=>{let t=u.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=_i(e);return t.every(e=>n.includes(e))}).sort((e,t)=>vi(t)-vi(e))},[e.id,c,u]),L=e=>t.statuses[e.status]??e.status,R=e=>e.description||e.brief||t.common.defaultWorkspace,z=e=>{b(e),S(``),w(``),A(null),v(!0),s(!1)},B=(0,Z.useCallback)(async(e={})=>{let t=C.trim(),n=x.trim()||(y===`directory`?yi(t):``);if(n){E(!0),A(null),M(null);try{let r=await qt({autoUnderstand:D,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),S(``),w(``),O(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),l(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=bi(e);t?(M(t),v(!1)):A(e instanceof Error?e.message:String(e))}finally{E(!1)}}},[y,x,a,C,D]),ee=(0,Z.useCallback)(e=>{e.preventDefault(),B()},[B]),H=(0,Z.useCallback)(()=>{B({createWorkspaceRoot:!0})},[B]),U=(0,Z.useCallback)(()=>{M(null),v(!0)},[]),W=e=>{w(e),y===`directory`&&!x.trim()&&S(yi(e))},te=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:V(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Q.jsx)(h,{className:V(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:R(e)})]}),(0,Q.jsx)(`span`,{className:V(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,pi(e.status)),children:L(e)})]},e.id);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(fe,{open:o,onOpenChange:s,children:[(0,Q.jsx)(me,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:V(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,pi(e.status)),children:L(e)})]}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:R(e)})]}),(0,Q.jsx)(st,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Q.jsx)(pe,{children:(0,Q.jsxs)(Y,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:u,onChange:e=>d(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Q.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),te(e,!0),(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),m?(0,Q.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:m}):null,f&&P.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!f&&P.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,P.map(e=>te(e,!1))]}),(0,Q.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>z(`new`),children:[(0,Q.jsx)(F,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>z(`directory`),children:[(0,Q.jsx)(yt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),a(`/projects`)},children:[(0,Q.jsx)(je,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Q.jsx)(se,{open:_,onOpenChange:e=>!T&&v(e),children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:y===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Q.jsx)(K,{className:`mt-1 text-sm text-fg-muted`,children:y===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Q.jsxs)(`form`,{onSubmit:ee,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[k?(0,Q.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:k}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Q.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:x,onChange:e=>S(e.target.value),placeholder:`xopc`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Q.jsx)(_n,{value:C,onChange:W,disabled:T,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,Q.jsx)(ke,{checked:D,onChange:O,disabled:T})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:T,children:n.cancel})}),(0,Q.jsxs)(q,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:T||!(x.trim()||y===`directory`&&yi(C)),children:[(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Q.jsx)(se,{open:!!j,onOpenChange:e=>{e||M(null)},children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Q.jsx)(K,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:j?di(n.workspaceMissingDescription,{workspace:j}):null})]}),j?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(yt,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:j})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:U,disabled:T,children:n.workspaceMissingBack}),(0,Q.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:H,disabled:T,children:[(0,Q.jsx)(an,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Ai(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),l=te(e=>e.language),u=ee(l),d=u.chat.workingDirectory,f=u.projectDetailPage,p=u.projectsPage,m=De(e=>e.setPageHeader),h=De(e=>e.clearPageHeader),[g,y]=(0,Z.useState)(null),b=(0,Z.useRef)(g);(0,Z.useLayoutEffect)(()=>{b.current=g},[g]);let[S,C]=(0,Z.useState)(null),[O,k]=(0,Z.useState)([]),[j,M]=(0,Z.useState)(``),[P,L]=(0,Z.useState)([]),[R,z]=(0,Z.useState)(0),[H,U]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(!1),[de,fe]=(0,Z.useState)(!1),[pe,J]=(0,Z.useState)([]),[me,Y]=(0,Z.useState)(null),ye=(0,Z.useRef)(new Set),[be,Te]=(0,Z.useState)(null),[Oe,ke]=(0,Z.useState)(null),[Ne,Re]=(0,Z.useState)(null),[Be,Ve]=(0,Z.useState)(ci),[We,Ke]=(0,Z.useState)(!1),[qe,Je]=(0,Z.useState)(!1),[Ye,tt]=(0,Z.useState)(``),[nt,rt]=(0,Z.useState)([]),[it,at]=(0,Z.useState)(!1),[ot,st]=(0,Z.useState)(null),[ct,lt]=(0,Z.useState)(!1),[ut,ft]=(0,Z.useState)(null),[ht,gt]=(0,Z.useState)([]),[_t,St]=(0,Z.useState)(``),[Tt,Dt]=(0,Z.useState)(!0),[Nt,Ft]=(0,Z.useState)(!1),[Rt,zt]=(0,Z.useState)(!1),[Ht,Ut]=(0,Z.useState)(null),[Gt,qt]=(0,Z.useState)(!1),[Jt,Xt]=(0,Z.useState)(`fixed`),[un,dn]=(0,Z.useState)(``),[pn,vn]=(0,Z.useState)(null),[yn,bn]=(0,Z.useState)(!1),[xn,Sn]=(0,Z.useState)(!1),[Cn,wn]=(0,Z.useState)(!1),[Tn,En]=(0,Z.useState)(null),Dn=(0,Z.useRef)(null),kn=(0,Z.useRef)(!1),[An,X]=(0,Z.useState)(null),[Mn,Nn]=(0,Z.useState)({title:``,reason:``}),[Pn,Fn]=(0,Z.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),In=(0,Z.useRef)(Pn),Ln=`overview`,$=n?`notes`:ui(t)?t:Ln,Rn=(0,Z.useMemo)(()=>w(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),zn=(0,Z.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Rn===`/projects`?n:T(n,Rn)},[Rn,e]),Bn=(0,Z.useCallback)(t=>{e&&r(zn(t))},[r,e,zn]),Vn=(0,Z.useCallback)(()=>{if($===`tasks`&&Dn.current){Dn.current.openCreate();return}kn.current=!0,Bn(`tasks`)},[Bn,$]);(0,Z.useEffect)(()=>{$!==`tasks`||!kn.current||(kn.current=!1,Dn.current?.openCreate())},[$]);let Hn=(0,Z.useCallback)(t=>{e&&r(zn(t),{replace:!0})},[r,e,zn]),Un=(0,Z.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Hn(e)},[Hn]),Wn=(0,Z.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,Z.useEffect)(()=>{!e||!t||ui(t)||r(zn(Ln),{replace:!0})},[Ln,r,e,zn,t]),(0,Z.useEffect)(()=>{if(!e)return;let t=!1;return Dt(!0),X(null),Promise.all([Ct(e),Lt(e),At(e),on().catch(()=>null),Mt(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;y(e),C(n),k(r),Y(a),gt(i?.agents??[]),St(e.defaultAgentId??``);let o=br(e);In.current=o,Fn(o)}).catch(e=>{t||(Y(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Dt(!1)}),()=>{t=!0}},[e]);let Gn=(0,Z.useCallback)(async()=>{e&&C(await Lt(e))},[e]);(0,Z.useEffect)(()=>{if(Tt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([Ct(e),Lt(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=b.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=xr(In.current,i,e);In.current=t,Fn(t)}b.current=e,y(e),C(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(y(null),C(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,Tt]),(0,Z.useEffect)(()=>{let t,n=n=>{let r=le.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),120))},r=n=>{let r=ce.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,Gn]);let Kn=(0,Z.useCallback)(async(e,t)=>{En(e.id),X(null);try{let n=await Bt(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 Kt(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 wt(e.id,r,n.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:f.board.actionFailed),!1}finally{En(null)}},[S,f.board.actionFailed,Gn]),qn=(0,Z.useCallback)(async t=>{e&&(X(null),await Yt({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await Gn())},[l,e,Gn]),Jn=(0,Z.useCallback)(async(e,t)=>{En(e),X(null);try{return await jt(e,t,(await Bt(e)).task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:f.board.actionFailed),!1}finally{En(null)}},[f.board.actionFailed,Gn]),Yn=(0,Z.useCallback)(async(e,t,n)=>{En(e),X(null);try{let r=await Bt(e);return r.task.phase!==t&&(r=await wt(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await jt(e,n,r.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:f.board.actionFailed),!1}finally{En(null)}},[f.board.actionFailed,Gn]),Xn=(0,Z.useCallback)(async(e,t)=>{En(e),X(null);try{await kt(e,t,(await Bt(e)).task.version),await Gn()}catch(e){await Gn().catch(()=>void 0),X(e instanceof Error?e.message:f.board.actionFailed)}finally{En(null)}},[f.board.actionFailed,Gn]),Zn=(0,Z.useCallback)(async()=>{if(g){U(!0),X(null);try{let e=await Ot(g.id,{includeRelated:W,limit:100});L(e.items),z(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{U(!1)}}},[g,W]);(0,Z.useEffect)(()=>{$===`progress`&&Zn()},[Zn,$]);let Qn=(0,Z.useCallback)(async()=>{if(!g?.effectiveWorkspaceRoot?.trim()){J([]),ye.current.clear(),ft(null);return}lt(!0),ft(null),ye.current.clear();try{J(Di((await Wt(g.id,``)).entries)),ye.current.add(``)}catch(e){J([]),ye.current.clear(),ft(e instanceof Error?e.message:String(e))}finally{lt(!1)}},[g]),$n=(0,Z.useCallback)(async e=>{if(!(!g?.effectiveWorkspaceRoot?.trim()||ye.current.has(e))){ye.current.add(e),ft(null);try{let t=await Wt(g.id,e);J(n=>Oi(n,e,Di(t.entries)))}catch(t){ye.current.delete(e),ft(t instanceof Error?t.message:String(t))}}},[g]),er=(0,Z.useCallback)(async e=>{if(!g?.effectiveWorkspaceRoot?.trim())return;let t=Di((await Wt(g.id,e)).entries);J(e?n=>Oi(n,e,t):t),ye.current.add(e)},[g]);(0,Z.useEffect)(()=>{$===`files`&&Qn()},[Qn,$]);let tr=Ye.trim();(0,Z.useEffect)(()=>{if($!==`files`||!g||!qe||!tr){rt([]),at(!1),st(null);return}let e=!1;at(!0),st(null),rt([]);let t=window.setTimeout(()=>{sn(g.id,tr,50).then(t=>{e||rt(t)}).catch(t=>{e||st(t instanceof Error?t.message:String(t))}).finally(()=>{e||at(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[tr,g,qe,$]);let nr=(0,Z.useCallback)(async()=>{if(!g)return;let[e,t]=await Promise.all([Ct(g.id),Lt(g.id)]);C(t),y(e)},[g]),rr=(0,Z.useCallback)(async e=>{if(e.preventDefault(),!(!g||!Mn.title.trim())){Sn(!0),X(null);try{await xt(g.id,{title:Mn.title.trim(),reason:Mn.reason.trim()||void 0}),Nn({title:``,reason:``}),wn(!1),await nr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{Sn(!1)}}},[Mn.reason,Mn.title,g,nr]),ir=(0,Z.useMemo)(()=>(0,Q.jsx)(s,{to:Rn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Rn===`/projects`?f.backToProjects:u.sidebar.back,children:(0,Q.jsx)(_e,{className:`size-4`,"aria-hidden":!0})}),[Rn,u.sidebar.back,f.backToProjects]),ar=(0,Z.useMemo)(()=>g?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gn,{resource:{kind:`project`,id:g.id,revision:String(g.version)},disabled:Nt||oi(Pn,g)}),(0,Q.jsx)(q,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(g.id)}`,children:[(0,Q.jsx)(D,{className:`size-4`,"aria-hidden":!0}),f.common.runWorkflow]})}),(0,Q.jsxs)(q,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Vn,children:[(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),f.board.create]}),(0,Q.jsx)(q,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:et(g.id),state:{forceNewChat:!0,agentId:g.defaultAgentId},onClick:Un(`sessions`),children:[(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),f.common.newChat]})})]}):null,[Vn,Un,f.board.create,f.common.newChat,f.common.runWorkflow,g,Nt,Pn]);(0,Z.useLayoutEffect)(()=>(m({startExtra:ir,main:g?(0,Q.jsx)(ki,{currentProject:g,pm:f,projectsText:p,wd:d}):(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:f.fallbackTitle}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:f.fallbackContext})]}),end:ar}),()=>h()),[h,ar,ir,f,g,p,m,d]);function or(e){y(t=>t?{...t,...e}:null),St(e.defaultAgentId??``),Mt(e.id).then(Y).catch(()=>Y(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function cr(e=In.current){if(!(!g||!oi(e,g))){X(null),Ut(null);try{let t=await Ce(g.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},g.version);or(t);let n=In.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};In.current=r,Fn(r)}catch(e){let t=bi(e);throw t?Ut(t):X(e instanceof Error?e.message:String(e)),e}}}function lr(e){e.preventDefault(),kr.flush()}function ur(e,t=!1){let n={...In.current,...e};In.current=n,Fn(n),t&&kr.saveNow(n)}let dr=(0,Z.useCallback)(()=>{if(!g)return;let e=g.workspaceRoot?.trim()??``;Xt(e?`fixed`:`follow`),dn(e||g.effectiveWorkspaceRoot||``),qt(!0)},[g]);async function fr(e={}){if(!g)return;let t=Jt===`fixed`?un.trim():``;if(!(Jt===`fixed`&&!t)){Ft(!0),X(null),Ut(null);try{let n=await Ce(g.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},g.version);or(n),ur({workspaceRoot:n.workspaceRoot??``}),qt(!1),Ut(null)}catch(e){let t=bi(e);t?(Ut(t),qt(!1)):X(e instanceof Error?e.message:String(e))}finally{Ft(!1)}}}async function pr(){if(!(!g||pn)){vn(`pin`),X(null);try{or(g.pinnedAt?await Ze(g.id,g.version):await en(g.id,g.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(null)}}}async function mr(){if(!(!g||pn)){vn(`archive`),X(null);try{let e=g.status===`archived`?await ln(g.id,g.version):await Vt(g.id,g.version);or(e),ur({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(null)}}}async function gr(){if(g){bn(!0),X(null);try{await Zt(g.id,g.version),zt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{bn(!1)}}}async function _r(){if(!(!g||de)){fe(!0),X(null);try{await bt(g.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{fe(!1)}}}let vr=(0,Z.useCallback)(e=>{Te(e)},[]),yr=(0,Z.useCallback)((e,t)=>{t||Te(e)},[]),Sr=(0,Z.useCallback)(async(e,t,n)=>{let r=g?.id;if(r)switch(e){case`preview`:t.isDirectory||Te(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Qt(t.path);if(vt(mt(e))!==`text`){let n=await tn(t.path,{projectId:r}),i=ve(e)??`application/octet-stream`;Xe(e,await n.arrayBuffer(),i)}else{let{content:n}=await Qe(t.path,{projectId:r});xe(e,n)}}catch(e){It(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await ue(t.path)&&It(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{It(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await pt(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),u.workspace.openFileFailed);break;case`openWith`:await pt(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),u.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await pt(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),u.workspace.openFileFailed);break;case`revealInFolder`:await pt(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),u.workspace.revealFileFailed);break;case`trash`:ke(t);break;case`delete`:t.isDirectory||Re(t);break;default:break}},[u.clipboard.copyFailed,u.workspace.openFileFailed,u.workspace.pathCopied,u.workspace.revealFileFailed,g?.id]),Cr=(0,Z.useCallback)(async()=>{let e=Oe;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){It(`warning`,t?.error??u.workspace.trashFailed,void 0,{duration:4e3});return}be===e.path&&Te(null),ke(null),await Qn(),It(`success`,u.workspace.trashSuccess,void 0,{duration:2500})},[u.workspace.trashFailed,u.workspace.trashSuccess,Oe,be,Qn]),wr=(0,Z.useCallback)(async(e,t)=>{let n=g?.id;if(n)try{await Promise.all(e.map(e=>Ee(e,t,{projectId:n}))),await er(t).catch(()=>void 0),It(`success`,u.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await er(t).catch(()=>void 0),It(`warning`,`${u.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[u.workspace.uploadFailed,u.workspace.uploadSuccess,g?.id,er]),Er=(0,Z.useCallback)(async()=>{let e=Ne;if(e)try{await rn(e.fileId),be===e.path&&Te(null),Re(null);let t=e.path.lastIndexOf(`/`);await er(t<0?``:e.path.slice(0,t)).catch(()=>void 0),It(`success`,u.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){It(`warning`,`${u.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[u.workspace.deleteFailed,u.workspace.deleteSuccess,Ne,be,er]),Dr=(0,Z.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Ke(!0);let r=e.clientX,i=Be,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=si(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ke(!1),Ve(c),li(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Be]);(0,Z.useEffect)(()=>{$!==`files`&&Te(null)},[e,$]);let Or=!!(g&&oi(Pn,g)),kr=hn({value:g?Pn:null,dirty:Or,onSave:cr,validate:e=>e.name.trim()?null:f.settings.nameRequired});if(Tt)return(0,Q.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:f.loading});if(!g)return(0,Q.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Q.jsxs)(s,{to:Rn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Q.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),Rn===`/projects`?f.backToProjects:u.sidebar.back]}),(0,Q.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:An||f.notFound})]});let Ar=O.slice(0,3),jr=S?.blockers??[],Mr=Tr(S?.tasks??[]),Nr=S?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Pr=e=>f.statuses[e]??e,Fr=e=>di(f.common.messages,{count:e}),Ir=j.trim().toLowerCase(),Lr=Ir?O.filter(e=>{let t=fi(e.updatedAt),n=e.routing?.agentId||e.agentId||f.common.agent,r=e.name?.trim()||f.sessions.fallbackTitle,i=Fr(e.messageCount??0),a=wi(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Ir)}):O,Rr=O.length>0&&Lr.length===0,zr=ht.find(e=>e.id===g.defaultAgentId)?.name||g.defaultAgentId||f.settings.globalDefaultAgent,Br=ht.find(e=>e.id===Pn.defaultAgentId),Vr=g.workspaceRoot?.trim()||``,Hr=g.status===`archived`,Ur=!!g.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||g.effectiveWorkspaceRoot||f.common.defaultWorkspace,Kr=Jt===`fixed`?un.trim()||f.settings.workspacePlaceholder:Br?.workspace||g.effectiveWorkspaceRoot||f.common.defaultWorkspace,qr=(Jt===`fixed`?un.trim():``)!==Vr&&(Jt===`follow`||!!un.trim()),Jr=[{id:`overview`,icon:jn,label:f.tabs.overview},{id:`tasks`,icon:On,label:f.tabs.tasks},{id:`automations`,icon:Se,label:f.tabs.automations},{id:`files`,icon:yt,label:f.tabs.files},{id:`notes`,icon:nn,label:f.tabs.notes},{id:`skills`,icon:Pe,label:f.tabs.skills},{id:`sessions`,icon:N,label:f.tabs.sessions},{id:`progress`,icon:$t,label:f.tabs.progress}];async function Yr(){if(!Gr)return;let e=await ue(Gr);It(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){Ut(null),qt(!0)}return(0,Q.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Q.jsx)(fn,{items:Jr,activeTab:$,onChange:Bn,ariaLabel:f.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Q.jsxs)(q,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Bn(`settings`),children:[(0,Q.jsx)(je,{className:`size-4`,"aria-hidden":!0}),f.tabs.settings,Or?(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":f.settings.unsavedChanges}):null]})]}),An?(0,Q.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:An}):null,(0,Q.jsxs)(`div`,{className:V(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,Q.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Q.jsx)(Ie,{projectId:g.id},g.id),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`p-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.overview.directionTitle}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:di(f.overview.activitySummary,{moving:Nr,attention:jr.length})})]}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:g.outcome||g.description||g.brief||f.overview.directionFallback}),S?.digest.recommendedAction?(0,Q.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:di(f.overview.recommendedNext,{action:S.digest.recommendedAction})}):null]}),(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void _r(),disabled:de,children:[(0,Q.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),de?f.overview.savingDigest:f.overview.saveDigest]})]})}),(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.overview.nextActions}),(0,Q.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Bn(`tasks`),children:f.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Mr.length?Mr.map(e=>(0,Q.jsxs)(s,{to:cn(zn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsxs)(`span`,{className:V(`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:[f.board.phases[e.phase],e.operationalState===`idle`?``:` · ${f.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:f.overview.noNextActions})})]})]}),S?.recentResults.length?(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.overview.recentResults})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:S.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Q.jsxs)(s,{to:cn(zn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[f.overview.resultStatuses[n.status],` · `,f.board.verification[n.verification.status]]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,Q.jsx)(E,{content:n.summary,compact:!0})})]},n.runId))})]}):null,g.milestones.length||g.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[g.milestones.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.overview.milestones})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:g.milestones.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:f.statuses[e.status]})]},e.id))})]}):null,g.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.overview.projectUpdates})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:g.recentUpdates.slice(0,3).map(e=>(0,Q.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,Q.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.overview.attention}),(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Cn,onClick:()=>wn(e=>!e),children:[(0,Q.jsx)(F,{className:V(`size-3.5 transition-transform`,Cn&&`rotate-45`),"aria-hidden":!0}),f.overview.addBlocker]})]}),jr.length?(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3`,children:jr.map(e=>{let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Me,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Q.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[f.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Pr(e.status)}`:``]})]});return e.href?(0,Q.jsx)(s,{to:e.href,onClick:Un(Wn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Q.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:f.overview.noBlockedTasks}),Cn?(0,Q.jsxs)(`form`,{onSubmit:rr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,Q.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Mn.title,onChange:e=>Nn(t=>({...t,title:e.target.value})),placeholder:f.overview.blockerTitlePlaceholder}),(0,Q.jsx)(q,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:xn||!Mn.title.trim(),"aria-label":xn?f.overview.addingBlocker:f.overview.addBlocker,title:xn?f.overview.addingBlocker:f.overview.addBlocker,children:(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(ze,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:f.overview.recentSessions})]}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Bn(`sessions`),children:f.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Ar.length?Ar.map(e=>(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:fi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==g.defaultAgentId?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:f.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Q.jsx)(ei,{ref:Dn,tasks:S?.tasks??[],dependencyEdges:S?.dependencyEdges??[],returnTo:zn(`tasks`),copy:f.board,onAction:Kn,onReorder:Jn,onUndoMove:Yn,onDependenciesChange:Xn,onCreate:qn,actionBusyId:Tn}):null,$===`automations`?(0,Q.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Q.jsx)(A,{projectId:g.id,embedded:!0,title:f.automations.title,subtitle:f.automations.hint})}):null,$===`notes`?(0,Q.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Q.jsx)(sr,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(g.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:g.id,listTitle:f.notes.title,listDescription:f.notes.hint,emptyText:f.notes.emptyTitle,emptyDescription:f.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${g.id}`})}):null,$===`skills`?(0,Q.jsx)(hr,{projectId:g.id,copy:f.skills}):null,$===`files`?(0,Q.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:g.effectiveWorkspaceRoot?(0,Q.jsxs)(`div`,{"data-project-files-grid":!0,className:V(`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":`${Be}px`},children:[(0,Q.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[me?(0,Q.jsx)(dt,{resourceId:me.fileId,displayName:me.name}):null,(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,className:V(`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":f.files.search,title:f.files.search,"aria-pressed":qe,children:(0,Q.jsx)(I,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(He,{className:`size-7 shrink-0 rounded-md p-0`,loading:ct,label:u.cron.refresh,onClick:()=>void Qn()})]})]}),qe?(0,Q.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,Q.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md bg-surface-base px-2 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,Q.jsx)(I,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`text`,role:`searchbox`,value:Ye,onChange:e=>tt(e.target.value),placeholder:f.files.searchPlaceholder,"aria-label":f.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Q.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":f.files.clearSearch,title:f.files.clearSearch,onClick:()=>{tt(``),Je(!1)},children:(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,ut?(0,Q.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:ut}):null,tr?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:it?(0,Q.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Q.jsx)(he,{className:`h-11 w-full`}),(0,Q.jsx)(he,{className:`h-11 w-full`}),(0,Q.jsx)(he,{className:`h-11 w-full`})]}):ot?(0,Q.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,ot]}):nt.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:f.files.noSearchResults}):nt.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:V(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,be===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Te(e.path),title:e.path,children:[(0,Q.jsx)(nn,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):ct&&pe.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:f.files.loading}):(0,Q.jsx)(we,{tree:pe,selectedPath:be,onSelectFile:vr,onSelectEntry:yr,onExpandDir:e=>void $n(e),onAction:Sr,onUploadFiles:(e,t)=>void wr(e,t),uploadDropHint:u.workspace.dropToUpload,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openDirectory:u.workspace.openInFileManager,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,trash:u.workspace.moveToTrash,delete:u.workspace.deleteFile,recommendedApps:u.workspace.recommendedApps,desktopUpdateRequired:u.workspace.desktopUpdateRequired},emptyHint:f.files.emptyDirectory})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":f.files.resizeHandle,className:V(`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:Dr,children:(0,Q.jsx)(`div`,{className:V(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,We&&`bg-accent/60`)})}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:be?(0,Q.jsx)(Fe,{filePath:be,projectId:g.id,agentId:g.defaultAgentId||_t||void 0,onClose:()=>Te(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(yt,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:f.files.previewEmptyTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:f.files.previewEmptyDescription})]})})})]}):(0,Q.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:f.files.needWorkspace}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Bn(`settings`),children:f.files.openSettings})})]})})}):null,$===`sessions`?(0,Q.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[O.length?(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Q.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:j,onChange:e=>M(e.currentTarget.value),placeholder:f.sessions.searchPlaceholder,"aria-label":f.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`}),j?(0,Q.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":f.sessions.clearSearch,onClick:()=>M(``),children:(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Lr.length?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Lr.map(e=>{let t=fi(e.updatedAt),n=e.routing?.agentId||e.agentId||f.common.agent,r=wi(e),i=e.name?.trim()||f.sessions.fallbackTitle,a=Fr(e.messageCount??0);return(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Q.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[f.sessions.agent,`: `,n]}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Q.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[f.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.sessions.noMatches})}):(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.sessions.emptyTitle}),(0,Q.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:f.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Q.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.progress.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:di(f.progress.count,{count:R})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:W,onChange:e=>G(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),f.progress.includeRelated]}),(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Zn(),disabled:H,children:[(0,Q.jsx)(Le,{className:V(`size-4`,H&&`animate-spin`),"aria-hidden":!0}),f.common.refresh]})]})]}),(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:H&&P.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:f.progress.loading}):P.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:P.map(e=>{let t=f.progress.types[e.type]??e.type,n=f.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ei(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===g.id);return(0,Q.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:f.progress.related}):null]}),(0,Q.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Si(e)]})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:fi(e.createdAt)})]}),r?(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[f.progress.actor,`: `,xi(e)]}),(0,Q.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[f.progress.source,`: `,Ci(e)]})]})]},e.id)})}):(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:f.progress.empty})})]}):null,$===`settings`?(0,Q.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:lr,onBlurCapture:kr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Q.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.settings.summaryTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:f.settings.summaryHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Q.jsx)(`span`,{className:V(`rounded-full px-2 py-0.5 text-xs font-medium`,pi(Pn.status)),children:f.settings.statuses[Pn.status]}),(0,Q.jsx)(mn,{status:kr.status,error:kr.error})]})]}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.settings.detailsTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:f.settings.detailsHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(mi,{label:f.settings.name,children:(0,Q.jsx)(`input`,{className:hi(),value:Pn.name,onChange:e=>ur({name:e.target.value})})}),(0,Q.jsx)(mi,{label:f.settings.defaultAgent,children:(0,Q.jsxs)(_,{className:hi(),value:Pn.defaultAgentId,onChange:e=>ur({defaultAgentId:e.target.value},!0),children:[(0,Q.jsx)(v,{value:``,children:f.settings.globalDefaultAgent}),ht.map(e=>(0,Q.jsx)(v,{value:e.id,children:$e(e,u.agentsSettings)},e.id))]})}),(0,Q.jsx)(mi,{label:f.settings.status,children:Hr?(0,Q.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-inset px-3 text-sm text-fg-muted`,children:f.settings.statuses.archived}):(0,Q.jsxs)(_,{className:hi(),value:Pn.status===`archived`?`active`:Pn.status,onChange:e=>ur({status:e.target.value},!0),children:[(0,Q.jsx)(v,{value:`active`,children:f.settings.statuses.active}),(0,Q.jsx)(v,{value:`paused`,children:f.settings.statuses.paused})]})}),(0,Q.jsx)(mi,{label:f.settings.executionMode,hint:f.settings.executionModeHint,children:(0,Q.jsxs)(_,{className:hi(),value:Pn.executionMode,onChange:e=>ur({executionMode:e.target.value},!0),children:[(0,Q.jsx)(v,{value:`managed_worktree`,children:f.settings.executionModeWorktree}),(0,Q.jsx)(v,{value:`local_checkout`,children:f.settings.executionModeLocal})]})}),(0,Q.jsx)(mi,{label:f.settings.description,hint:f.settings.descriptionHint,children:(0,Q.jsx)(`textarea`,{className:hi(!0),value:Pn.description,onChange:e=>ur({description:e.target.value})})})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.settings.projectGuidanceTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:f.settings.projectGuidanceHint})]}),(0,Q.jsx)(mi,{label:f.settings.brief,hint:f.settings.briefHint,children:(0,Q.jsx)(`textarea`,{className:hi(!0),value:Pn.brief,onChange:e=>ur({brief:e.target.value})})}),(0,Q.jsx)(mi,{label:f.settings.instructions,hint:f.settings.instructionsHint,children:(0,Q.jsx)(`textarea`,{className:hi(!0),value:Pn.instructions,onChange:e=>ur({instructions:e.target.value})})})]})]}),(0,Q.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.settings.workspaceRoot}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:f.settings.workspaceIndependentHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?f.settings.workspaceModeFollow:f.settings.workspaceModeFixed}),(0,Q.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),f.settings.copyWorkspacePath]}),me?(0,Q.jsx)(dt,{resourceId:me.fileId,displayName:me.name}):null,(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:dr,children:[(0,Q.jsx)(an,{className:`size-4`,"aria-hidden":!0}),f.settings.migrateWorkspace]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.settings.currentProjectTitle}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(gi,{label:f.settings.defaultAgent,value:zr}),(0,Q.jsx)(gi,{label:f.settings.pinState,value:Ur?f.settings.pinned:f.settings.notPinned}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Q.jsx)(gi,{label:f.settings.createdAt,value:fi(g.createdAt)||f.common.never}),(0,Q.jsx)(gi,{label:f.settings.updatedAt,value:fi(g.updatedAt)||f.common.never})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.settings.managementTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:f.settings.managementHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?f.settings.pinnedTitle:f.settings.pinTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:f.settings.pinHint})]}),(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:pn===`pin`,onClick:()=>void pr(),children:[Ur?(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(ge,{className:`size-4`,"aria-hidden":!0}),Ur?f.settings.unpinProject:f.settings.pinProject]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?f.settings.restoreTitle:f.settings.archiveTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?f.settings.restoreHint:f.settings.archiveHint})]}),(0,Q.jsxs)(q,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:pn===`archive`,onClick:()=>void mr(),children:[Hr?(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Et,{className:`size-4`,"aria-hidden":!0}),Hr?f.settings.restoreProject:f.settings.archiveProject]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:f.settings.dangerTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:f.settings.dangerHint})]}),(0,Q.jsxs)(q,{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:()=>zt(!0),children:[(0,Q.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),f.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Q.jsx)(se,{open:Rt,onOpenChange:e=>{yn||zt(e)},children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5 shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Q.jsx)(Me,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:f.settings.deleteConfirmTitle}),(0,Q.jsx)(K,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:g?di(f.settings.deleteConfirm,{name:g.name}):f.settings.deleteConfirmFallback})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:yn,children:f.common.cancel})}),(0,Q.jsxs)(q,{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:yn||!g,onClick:()=>void gr(),children:[(0,Q.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),f.settings.deleteConfirmAction]})]})]})]})}),(0,Q.jsx)(Pt,{open:!!Oe,title:u.workspace.trashConfirmTitle,description:u.workspace.trashConfirmDescription.replace(`{{name}}`,Oe?.name??``),confirmLabel:u.workspace.moveToTrash,cancelLabel:u.workspace.cancel,destructive:!0,onConfirm:()=>void Cr(),onCancel:()=>ke(null)}),(0,Q.jsx)(Pt,{open:!!Ne,title:u.workspace.deleteConfirmTitle,description:u.workspace.deleteConfirmDescription.replace(`{{name}}`,Ne?.name??``),confirmLabel:u.workspace.deleteFile,cancelLabel:u.workspace.cancel,destructive:!0,onConfirm:()=>void Er(),onCancel:()=>Re(null)}),(0,Q.jsx)(se,{open:Gt,onOpenChange:e=>{Nt||qt(e)},children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:f.settings.workspaceMigrationTitle}),(0,Q.jsx)(K,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:f.settings.workspaceMigrationDescription})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.settings.workspaceMode}),(0,Q.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:V(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Jt===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Jt===`fixed`,onChange:()=>Xt(`fixed`),disabled:Nt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:f.settings.workspaceModeFixed}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:f.settings.workspaceMigrationFixedHint})]})]}),(0,Q.jsxs)(`label`,{className:V(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Jt===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Jt===`follow`,onChange:()=>Xt(`follow`),disabled:Nt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:f.settings.workspaceModeFollow}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:f.settings.workspaceHint})]})]})]})]}),Jt===`fixed`?(0,Q.jsx)(_n,{value:un,onChange:dn,disabled:Nt,wd:d,placeholder:f.settings.workspacePlaceholder,inputClassName:hi(),autoFocus:!0}):null,(0,Q.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:f.settings.workspaceMigrationImpact}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:di(f.settings.workspaceCurrent,{workspace:Kr})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Nt,children:f.common.cancel})}),(0,Q.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Nt||!qr,onClick:()=>void fr(),children:[(0,Q.jsx)(an,{className:`size-4`,"aria-hidden":!0}),f.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Q.jsx)(se,{open:!!Ht,onOpenChange:e=>{e||Ut(null)},children:(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(ne,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ae,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(oe,{className:`text-base font-semibold text-fg`,children:f.settings.workspaceMissingTitle}),(0,Q.jsx)(K,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ht?di(f.settings.workspaceMissingDescription,{workspace:Ht}):null})]}),Ht?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(yt,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:Ht})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:Nt,children:f.settings.workspaceMissingBack}),(0,Q.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void fr({createWorkspaceRoot:!0}),disabled:Nt,children:[(0,Q.jsx)(an,{className:`size-4`,"aria-hidden":!0}),f.settings.workspaceMissingCreate]})]})]})]})})]})}export{Ai as ProjectDetailPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as a,r as o}from"./popover-select-DcsFzD_i.js";import{t as s}from"./folder-open-CyzJ19I9.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as l}from"./plus-Q2yW6OE7.js";import{t as u}from"./search-DA7gz22f.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-D0G_sZvA.js";import{t as p}from"./cn-JdwAhgNB.js";import{n as m}from"./locale-store-BSkKhYkc.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./button-CS04eWY9.js";import{t as C}from"./skeleton-BwbyijEw.js";import{$c as w,Aa as T,Eo as E,Ga as D,Kc as O,Pa as k,Qc as ee,Ql as A,Sl as te,So as j,_o as M,eu as N,fi as P,oo as F,so as ne,vo as re,yo as ie}from"./index-Cr4SINLG.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:P(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(C,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=m(V),c,l,u,d,p,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=f(s).projectsPage;c=e.management,g=`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)(te,{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]})]}),m;t[20]===o?m=t[21]:(m=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=m);let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,R.jsx)(A,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=v):v=t[22];let y;t[23]===m?y=t[24]:(y=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[m,v]}),t[23]=m,t[24]=y),_=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[y,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),h=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,d=`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]=d,t[13]=p,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],u=t[11],d=t[12],p=t[13],h=t[14],g=t[15],_=t[16];let v;t[25]!==l||t[26]!==u?(v=(0,R.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==d||t[29]!==p||t[30]!==v?(y=(0,R.jsxs)(`div`,{className:d,children:[p,v]}),t[28]=d,t[29]=p,t[30]=v,t[31]=y):y=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,C;t[32]===n.pinnedAt?C=t[33]:(C=n.pinnedAt?(0,R.jsx)(ee,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=C);let T;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==C?(T=(0,R.jsx)(S,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:C}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=C,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,k;t[40]===n.status?k=t[41]:(k=n.status===`archived`?(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=k);let j;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==k?(j=(0,R.jsx)(S,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:k}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=k,t[47]=j):j=t[47];let M;t[48]!==T||t[49]!==j?(M=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,j]}),t[48]=T,t[49]=j,t[50]=M):M=t[50];let P;t[51]!==M||t[52]!==h||t[53]!==y?(P=(0,R.jsxs)(`div`,{className:h,children:[y,M]}),t[51]=M,t[52]=h,t[53]=y,t[54]=P):P=t[54];let F;return t[55]!==P||t[56]!==g||t[57]!==_?(F=(0,R.jsxs)(`article`,{className:g,children:[_,P]}),t[55]=P,t[56]=g,t[57]=_,t[58]=F):F=t[58],F}function V(e){return e.language}function H(){let e=f(m(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=E(e=>e.setPageHeader),C=E(e=>e.clearPageHeader),[w,O]=(0,L.useState)([]),[ee,A]=(0,L.useState)(!0),[N,P]=(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=k({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(A(!0),P(null));try{let e=await M({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&O(ae(e.items))}catch(n){!e&&t===Z.current&&P(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 w.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,w,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(S,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(l,{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}),()=>C()),[C,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 ne({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});O(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),P(null);try{let n;n=t===`pin`?e.pinnedAt?await j(e.id,e.version):await re(e.id,e.version):e.status===`archived`?await ie(e.id,e.version):await F(e.id,e.version),O(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){P(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-6xl flex-1 flex-col gap-5 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,R.jsx)(x,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(v,{children:[(0,R.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(y,{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)(b,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(g,{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)(c,{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:p(`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)(D,{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)(_,{asChild:!0,children:(0,R.jsx)(S,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(S,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(T,{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:p(`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)(u,{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)(d,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(S,{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)(u,{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))})]})]}),N?(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:N}),(0,R.jsx)(S,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,ee?(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)(te,{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,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{r as t}from"./locale-store-BPZR8x9b.js";import{t as n}from"./gateway-startup-retry-B5GJ-CQV.js";async function r(){let e=await n(t(`/api/models`));if(!e.ok)throw Error(`Models: HTTP ${e.status}`);return(await e.json()).payload?.models??[]}var i=null,a=0,o=null,s=6e4,c=`gateway-configured-models`;async function l(){i=null,a=0;let{mutate:t}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await t(c)}async function u(e=!1){if(!e&&i&&Date.now()<a)return i;if(e){let e=await r();return i=e,a=Date.now()+s,e}return o||(o=r().then(e=>(i=e,a=Date.now()+s,e)).finally(()=>{o=null}),o)}export{u as n,l as r,c as t};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{r as t}from"./locale-store-BSkKhYkc.js";import{t as n}from"./gateway-startup-retry-DMqYXHAn.js";async function r(){let e=await n(t(`/api/models`));if(!e.ok)throw Error(`Models: HTTP ${e.status}`);return(await e.json()).payload?.models??[]}var i=null,a=0,o=null,s=6e4,c=`gateway-configured-models`;async function l(){i=null,a=0;let{mutate:t}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await t(c)}async function u(e=!1){if(!e&&i&&Date.now()<a)return i;if(e){let e=await r();return i=e,a=Date.now()+s,e}return o||(o=r().then(e=>(i=e,a=Date.now()+s,e)).finally(()=>{o=null}),o)}export{u as n,l as r,c as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,t as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./network-BUQLY1BV.js";import{t as p}from"./power-ZI-pBczI.js";import{t as m}from"./server-BlHCBjiE.js";import{t as h}from"./messages-D0G_sZvA.js";import{t as g}from"./cn-JdwAhgNB.js";import{c as _,n as v}from"./locale-store-BSkKhYkc.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{t as T}from"./copy-to-clipboard-HOJ79TWv.js";import{i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-CS04eWY9.js";import{n as O,r as k}from"./gateway-config-swr-BYMrbKZE.js";import{i as A,o as j}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{At as M,Dc as N,Fl as P,Ft as F,Lc as I,Lt as L,Na as R,Pt as z,Ql as B,Ul as V,Vt as ee,Wl as H,Yo as U,hl as te,jc as W,jt as ne,ka as re,kt as ie,ma as G,zc as K,zo as q}from"./index-Cr4SINLG.js";import{n as J,r as ae,t as oe}from"./settings-page-layout-X1x-2Cp9.js";import{n as Y,r as se,t as ce}from"./settings-form-section-DM0D-BQ_.js";import{_ as le,a as ue,b as de,c as fe,h as pe,i as me,n as he,o as X,r as ge,s as _e,t as ve,v as ye,y as be}from"./tunnel-api-CYvKiE_f.js";import{t as xe}from"./settings-advanced-gate-BEyQiZs0.js";var Z=e(t(),1),Q=n(),$=r();function Se(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Ce(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=g(`inline-flex items-center gap-1.5 text-xs font-medium`,Se(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=g(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function we(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=v(Ee),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!_(Te),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=E(o?`exposure-status`:null,be,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=E(o?`tunnel-status`:null,he,l),p=k(o);if(!o)return null;let y=c?.tailscale.active===!0,b=d?.state,x=d?.enabled&&b===`connected`,S=d?.enabled&&(b===`connecting`||b===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),C=p.data?.payload?.config,w=!!(C&&typeof C==`object`&&!Array.isArray(C)&&C.gateway?.publicUrl),T=y?`active`:`off`,D=y?a.statusActive:a.statusOff,O;t[4]!==a.tailscaleCardTitle||t[5]!==T||t[6]!==D?(O={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:T,statusLabel:D},t[4]=a.tailscaleCardTitle,t[5]=T,t[6]=D,t[7]=O):O=t[7];let A=x?`active`:S?`connecting`:`off`,j=x?a.statusActive:S?a.statusConnecting:a.statusOff,M;t[8]!==a.publicCardTitle||t[9]!==A||t[10]!==j?(M={tab:`public`,icon:f,title:a.publicCardTitle,kind:A,statusLabel:j},t[8]=a.publicCardTitle,t[9]=A,t[10]=j,t[11]=M):M=t[11];let N=w?`active`:`off`,P=w?a.statusActive:a.statusOff,F;t[12]!==a.reverseProxyCardTitle||t[13]!==N||t[14]!==P?(F={tab:`reverse-proxy`,icon:K,title:a.reverseProxyCardTitle,kind:N,statusLabel:P},t[12]=a.reverseProxyCardTitle,t[13]=N,t[14]=P,t[15]=F):F=t[15];let I;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(I={tab:`ssh`,icon:W,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=I):I=t[18];let L;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(L={tab:`lan`,icon:m,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=L):L=t[21];let R;t[22]!==F||t[23]!==I||t[24]!==L||t[25]!==O||t[26]!==M?(R=[O,M,F,I,L],t[22]=F,t[23]=I,t[24]=L,t[25]=O,t[26]=M,t[27]=R):R=t[27];let z=R,B;return t[28]!==z||t[29]!==n?(B=(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:z.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:g(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Ce,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=z,t[29]=n,t[30]=B):B=t[30],B}function Te(e){return e.conversationId}function Ee(e){return e.language}function De(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=g(`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 p;t[11]===r?p=t[12]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(V,{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]=h):h=t[16];let _;return t[17]!==o||t[18]!==l||t[19]!==m?(_=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,m,h]}),t[17]=o,t[18]=l,t[19]=m,t[20]=_):_=t[20],_}function Oe(e){let t=(0,Q.c)(74),{onOpenTab:n}=e,r=v(je),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!_(Ae),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=E(s?`exposure-status`:null,be,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let p=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(we,{onOpenTab:n}),t[7]=n,t[8]=g);let y;t[9]!==p||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(y=p.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:p.map(ke)})]}):null,t[9]=p,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=y):y=t[12];let b;t[13]===o.pickMethod?b=t[14]:(b=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=b);let x;t[15]===n?x=t[16]:(x=()=>n(`tailscale`),t[15]=n,t[16]=x);let S;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==x?(S=(0,$.jsx)(De,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:x}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=x,t[21]=S):S=t[21];let C;t[22]===n?C=t[23]:(C=()=>n(`public`),t[22]=n,t[23]=C);let w;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==C?(w=(0,$.jsx)(De,{icon:f,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:C}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=C,t[27]=w):w=t[27];let T;t[28]===n?T=t[29]:(T=()=>n(`reverse-proxy`),t[28]=n,t[29]=T);let D;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==T?(D=(0,$.jsx)(De,{icon:K,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:T}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=T,t[33]=D):D=t[33];let O;t[34]===n?O=t[35]:(O=()=>n(`ssh`),t[34]=n,t[35]=O);let k;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==O?(k=(0,$.jsx)(De,{icon:W,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:O}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=O,t[39]=k):k=t[39];let A;t[40]===n?A=t[41]:(A=()=>n(`lan`),t[40]=n,t[41]=A);let j;t[42]!==o.lanCardDesc||t[43]!==o.lanCardTitle||t[44]!==A?(j=(0,$.jsx)(De,{icon:m,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:A}),t[42]=o.lanCardDesc,t[43]=o.lanCardTitle,t[44]=A,t[45]=j):j=t[45];let M;t[46]!==w||t[47]!==D||t[48]!==k||t[49]!==j||t[50]!==S?(M=(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:[S,w,D,k,j]}),t[46]=w,t[47]=D,t[48]=k,t[49]=j,t[50]=S,t[51]=M):M=t[51];let N;t[52]!==M||t[53]!==b?(N=(0,$.jsxs)(`div`,{children:[b,M]}),t[52]=M,t[53]=b,t[54]=N):N=t[54];let P;t[55]===o.oneAtATimeHint?P=t[56]:(P=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[55]=o.oneAtATimeHint,t[56]=P);let F;t[57]===a.advanced.proxyTitle?F=t[58]:(F=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[57]=a.advanced.proxyTitle,t[58]=F);let I;t[59]===a.advanced.proxyBody?I=t[60]:(I=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[59]=a.advanced.proxyBody,t[60]=I);let L;t[61]!==r||t[62]!==a.advanced.proxyDocs?(L=(0,$.jsx)(de,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[61]=r,t[62]=a.advanced.proxyDocs,t[63]=L):L=t[63];let R;t[64]!==F||t[65]!==I||t[66]!==L?(R=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[F,I,L]}),t[64]=F,t[65]=I,t[66]=L,t[67]=R):R=t[67];let z;return t[68]!==N||t[69]!==P||t[70]!==R||t[71]!==g||t[72]!==y?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,y,N,P,R]}),t[68]=N,t[69]=P,t[70]=R,t[71]=g,t[72]=y,t[73]=z):z=t[73],z}function ke(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Ae(e){return e.conversationId}function je(e){return e.language}function Me(){let e=(0,Q.c)(16),t=v(Ne),n;e[0]===t?n=e[1]:(n=h(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:m,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==a||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ce,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Ne(e){return e.language}function Pe(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=v(Fe),a;t[0]===i?a=t[1]:(a=h(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 T(`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,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(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]=f):f=t[3];let p,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>void d(),m=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=p,t[5]=m):(p=t[4],m=t[5]);let g=s?o.copied:o.copy,_;t[6]===g?_=t[7]:(_=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(D,{type:`button`,variant:`ghost`,onClick:p,children:[m,g]})}),t[6]=g,t[7]=_);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]!==_||t[12]!==y?(b=(0,$.jsxs)($.Fragment,{children:[f,_,y]}),t[11]=_,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:W,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===x?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:x}),t[17]=x,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ce,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let S;t[22]!==o.subtitle||t[23]!==o.title?(S=(0,$.jsx)(Y,{icon:W,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=S):S=t[24];let C;t[25]===x?C=t[26]:(C=(0,$.jsx)(`div`,{className:`mt-4`,children:x}),t[25]=x,t[26]=C);let w;return t[27]!==S||t[28]!==C?(w=(0,$.jsxs)(ce,{children:[S,C]}),t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function Fe(e){return e.language}function Ie(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Pe,{embedded:!0}),e[0]=t):t=e[0],t}var Le=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Re(e){return e&&Le.includes(e)?e:`guide`}function ze(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,f]=(0,Z.useState)(c??!1),p;t[0]===s?p=t[1]:(p=g(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(Be),t[2]=m):m=t[2];let h=d&&`rotate-180`,_;t[3]===h?_=t[4]:(_=g(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[3]=h,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,$.jsx)(H,{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:m,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=g(`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]!==p?(O=(0,$.jsxs)(`section`,{className:p,children:[S,D]}),t[26]=S,t[27]=D,t[28]=p,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(xe,{children:k}),t[30]=k,t[31]=e),e}return k}function Be(e){return!e}function Ve(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,f]=(0,Z.useState)(!1),p;t[0]===u?p=t[1]:(p=e=>{e||(f(!1),u())},t[0]=u,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(y,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,j)}),t[2]=m):m=t[2];let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=g(`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`,A),t[3]=h):h=t[3];let _;t[4]===r?_=t[5]:(_=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=_);let v;t[6]===i?v=t[7]:(v=(0,$.jsx)(b,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=v);let T;t[8]===a?T=t[9]:(T=a.map(He),t[8]=a,t[9]=T);let E;t[10]===T?E=t[11]:(E=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:T}),t[10]=T,t[11]=E);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>f(e.target.checked),t[12]=O):O=t[12];let k;t[13]===d?k=t[14]:(k=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:O}),t[13]=d,t[14]=k);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]!==k?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[k,M]}),t[17]=M,t[18]=k,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(D,{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)(D,{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]!==_||t[33]!==v||t[34]!==E?(R=(0,$.jsxs)(x,{children:[m,(0,$.jsxs)(S,{className:h,onOpenAutoFocus:Ue,children:[_,v,E,N,L]})]}),t[30]=N,t[31]=L,t[32]=_,t[33]=v,t[34]=E,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==p||t[38]!==R?(z=(0,$.jsx)(w,{open:n,onOpenChange:p,children:R}),t[36]=n,t[37]=p,t[38]=R,t[39]=z):z=t[39],z}function He(e){return(0,$.jsx)(`li`,{children:e},e)}function Ue(e){return e.preventDefault()}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ge=[`preparing_frpc`,`registering`,`starting_frpc`];function Ke(e){return e?e===`reconnecting_frpc`?Ge.indexOf(`starting_frpc`):Ge.indexOf(e):-1}function qe(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Ge.indexOf(e),i=Ke(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Je(e,t,n){let r=n.startProgress;return qe(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ye(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Xe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Ze(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(Qe),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,f,p,m;if(t[6]!==n||t[7]!==r){let e=Xe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(f=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=f):f=t[19];let o=Ge.map(e=>{let t=qe(e,n),i=Je(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(P,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:g(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ye(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:g(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[We(n.frpcDownload.bytesReceived),` /`,` `,We(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?p=t[21]:(p=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=p),m=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]=p,t[12]=m}else l=t[8],u=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(h=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=h):h=t[24];let _;return t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h?(_=(0,$.jsxs)(`div`,{className:u,children:[f,p,m,h]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=_):_=t[30],_}function Qe(e){return e+1}function $e(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function et(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function tt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function nt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function rt(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:f,startDisabledReason:m,stepLabel:h,onStart:_,onStop:v}=e,y=f===void 0?!1:f,b,x,S,C,w,T,E;t[0]!==r||t[1]!==o?(E=et(r),b=r.enabled||o,x=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=g(se(),`space-y-4`),t[9]=T):T=t[9],w=`flex flex-wrap items-start justify-between gap-3`,C=`flex items-center gap-2`,S=g(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,tt(E)),t[0]=r,t[1]=o,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=w,t[7]=T,t[8]=E):(b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8]);let O=E===`connected`&&`bg-emerald-500`,k=E===`progress`&&`bg-amber-500 animate-pulse`,A=E===`error`&&`bg-red-500`,j=E===`off`&&`bg-fg-subtle`,M;t[10]!==O||t[11]!==k||t[12]!==A||t[13]!==j?(M=g(`size-1.5 rounded-full`,O,k,A,j),t[10]=O,t[11]=k,t[12]=A,t[13]=j,t[14]=M):M=t[14];let P;t[15]===M?P=t[16]:(P=(0,$.jsx)(`span`,{className:M,"aria-hidden":!0}),t[15]=M,t[16]=P);let F;t[17]!==i||t[18]!==r||t[19]!==n?(F=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):$e(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=F):F=t[20];let I;t[21]!==P||t[22]!==F||t[23]!==S?(I=(0,$.jsxs)(`span`,{className:S,children:[P,F]}),t[21]=P,t[22]=F,t[23]=S,t[24]=I):I=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,` `,nt(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]!==I||t[30]!==L||t[31]!==C?(R=(0,$.jsxs)(`div`,{className:C,children:[I,L]}),t[29]=I,t[30]=L,t[31]=C,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]!==w?(B=(0,$.jsxs)(`div`,{className:w,children:[R,z]}),t[34]=R,t[35]=w,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 ee;t[39]!==c||t[40]!==n.consentExpiredBanner?(ee=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]=ee):ee=t[41];let H;t[42]!==b||t[43]!==l||t[44]!==_||t[45]!==v||t[46]!==x||t[47]!==r||t[48]!==y||t[49]!==m||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(H=b?(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)(G,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,x?(0,$.jsx)(Ze,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(D,{type:`button`,variant:`secondary`,disabled:s,onClick:v,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(D,{type:`button`,disabled:o,onClick:_,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(p,{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)(N,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),y&&m?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:m}):null,(0,$.jsxs)(D,{type:`button`,disabled:o||y,onClick:_,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(p,{className:`size-4`}),n.start]})]}),t[42]=b,t[43]=l,t[44]=_,t[45]=v,t[46]=x,t[47]=r,t[48]=y,t[49]=m,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=H):H=t[54];let U;return t[55]!==B||t[56]!==V||t[57]!==ee||t[58]!==H||t[59]!==T?(U=(0,$.jsxs)(`section`,{className:T,children:[B,V,ee,H]}),t[55]=B,t[56]=V,t[57]=ee,t[58]=H,t[59]=T,t[60]=U):U=t[60],U}var it={reconfiguring:!1};function at(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:f,brokerSecretNotice:p,copyFailedLabel:m,onDraftChange:h,onSave:_,onAuthorize:v,onClear:y,sectionRef:b}=e,x=(0,Z.useId)(),S=r,C=!S,[w,T]=(0,Z.useReducer)(R,it),{reconfiguring:E}=w,O;t[0]!==i||t[1]!==o||t[2]!==E?(O=i&&!E&&!o.trim(),t[0]=i,t[1]=o,t[2]=E,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let j=A,M;t[9]===o?M=t[10]:(M=o.trim().length>0&&!ee(o.trim()),t[9]=o,t[10]=M);let N=M,P;t[11]===h?P=t[12]:(P=()=>{T({type:`patch`,patch:{reconfiguring:!1}}),h(``)},t[11]=h,t[12]=P);let F=P,I=C&&`ring-1 ring-amber-500/30`,L;t[13]===I?L=t[14]:(L=g(I),t[13]=I,t[14]=L);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=g(`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 W=S?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,ne;t[22]===W?ne=t[23]:(ne=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:W}),t[22]=W,t[23]=ne);let re=S?n.brokerSecretReadyHint:n.brokerSecretHint,ie;t[24]===re?ie=t[25]:(ie=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:re}),t[24]=re,t[25]=ie);let G;t[26]!==C||t[27]!==n.brokerSecretMissingHint?(G=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]=G):G=t[28];let K;t[29]!==ne||t[30]!==ie||t[31]!==G?(K=(0,$.jsxs)(`div`,{children:[ne,ie,G]}),t[29]=ne,t[30]=ie,t[31]=G,t[32]=K):K=t[32];let q;t[33]!==u||t[34]!==C||t[35]!==v||t[36]!==E||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(q=C||E?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(D,{type:`button`,disabled:c||u,onClick:v,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:ve,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=C,t[35]=v,t[36]=E,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=q):q=t[41];let J;t[42]!==u||t[43]!==f||t[44]!==n.brokerSecretOpenAuthorization?(J=u&&f?(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=f,t[44]=n.brokerSecretOpenAuthorization,t[45]=J):J=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==N||t[50]!==F||t[51]!==m||t[52]!==x||t[53]!==C||t[54]!==y||t[55]!==h||t[56]!==_||t[57]!==E||t[58]!==c||t[59]!==j||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(ae=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(U,{id:x,value:a,labels:j,reveal:ot,loadFailedLabel:m||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(D,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{T({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(D,{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)(U,{id:x,value:o,onChange:h,placeholder:n.brokerSecretPlaceholder,labels:j,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(D,{type:`button`,disabled:c||!N,onClick:_,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,C?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(D,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear}):null,E?(0,$.jsx)(D,{type:`button`,variant:`ghost`,disabled:c,onClick:F,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=N,t[50]=F,t[51]=m,t[52]=x,t[53]=C,t[54]=y,t[55]=h,t[56]=_,t[57]=E,t[58]=c,t[59]=j,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=ae):ae=t[71];let oe;t[72]===p?oe=t[73]:(oe=p?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:p}):null,t[72]=p,t[73]=oe);let Y;t[74]!==K||t[75]!==q||t[76]!==J||t[77]!==ae||t[78]!==oe?(Y=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[K,q,J,ae,oe]}),t[74]=K,t[75]=q,t[76]=J,t[77]=ae,t[78]=oe,t[79]=Y):Y=t[79];let se;t[80]!==H||t[81]!==Y?(se=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[H,Y]}),t[80]=H,t[81]=Y,t[82]=se):se=t[82];let le;t[83]!==se||t[84]!==L?(le=(0,$.jsx)(ce,{className:L,children:se}),t[83]=se,t[84]=L,t[85]=le):le=t[85];let ue;return t[86]!==b||t[87]!==le?(ue=(0,$.jsx)(`div`,{ref:b,id:`tunnel-broker-secret-setup`,children:le}),t[86]=b,t[87]=le,t[88]=ue):ue=t[88],ue}function ot(){return X().then(st)}function st(e){return e.registrationSecret??null}var ct={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function lt({embedded:e=!1}){let t=v(e=>e.language),n=h(t).tunnelSettings,r=!!_(e=>e.conversationId),[i,a]=(0,Z.useReducer)(R,ct),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:f,autoStartConfirmOpen:p,releaseConfirmOpen:m,releasing:y,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:C,brokerSecretNotice:w}=i,T=(0,Z.useRef)(null),{data:A}=k(r),{data:j,error:N,isLoading:P,mutate:I}=E(r?`tunnel-status`:null,he,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),B=(0,Z.useMemo)(()=>{let e=A?.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 j?.config?.autoStart===!0},[A,j?.config?.autoStart]),V=(0,Z.useMemo)(()=>{let e=A?.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``},[A]),H=ee(V),U=j?.registrationSecret?.configured??H;(0,Z.useEffect)(()=>{let e=()=>{I()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[I]);let te=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),W=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await _e(),await I(),O()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[I]),G=(0,Z.useCallback)(()=>{if(!U){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),T.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(j?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}W()},[U,j?.consentRequired,W,n.brokerSecretRequiredBeforeStart]),K=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await ue(),await Promise.all([I(),W()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[I,W]),q=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await fe(),await I(),O()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[I]),J=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ge({autoStart:e}),O()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),ae=(0,Z.useCallback)(()=>{if(B){J(!1);return}if(j?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!j?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[J,j?.canAutoStart,j?.consentRequired,n,B]),oe=(0,Z.useCallback)(async()=>{let e=b.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),O(),await I(),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,I,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),O(),await I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[I,n.brokerSecretCleared]),se=(0,Z.useCallback)(async()=>{let e=ne(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await L(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await F(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await M(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await me(),await Promise.all([I(),O()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{ie(e),t&&z(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[I,n.brokerSecretSaved]),le=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await fe({release:!0}),await I(),O()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[I]),pe=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:h(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=j??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:B,brokerUrl:`https://frp.xopc.ai/api`}},ve=j?.consentRequired&&(X.enabled||B||j?.consent?.acceptedAt),ye=(0,$.jsx)(at,{t:n,brokerSecretReady:U,brokerSecretConfiguredInConfig:H,brokerSecretMaskedValue:H?V:``,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:C,brokerSecretNotice:w,copyFailedLabel:h(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void se(),onClear:()=>void Y(),sectionRef:T}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ve,{open:f,title:n.consentTitle,intro:n.consentIntro,bullets:te,checkboxLabel:n.consentCheckbox,confirmLabel:ve?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void K(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},f?`consent-open`:`consent-closed`),(0,$.jsx)(re,{open:p,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),J(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(re,{open:m,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void le(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:P,statusErr:N,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:pe,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:G,onStop:()=>void q()}),(0,$.jsxs)(ze,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:g(`flex items-center gap-3 text-sm text-fg`,!B&&!j?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!j?.canAutoStart,onChange:ae}),n.autoStart]}),!j?.canAutoStart&&!B?(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)(D,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(ze,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:P,statusErr:N,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:pe,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,onStart:G,onStop:()=>void q()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(D,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ce,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:g(`flex items-center gap-3 text-sm text-fg`,!B&&!j?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!j?.canAutoStart,onChange:ae}),n.autoStart]}),!j?.canAutoStart&&!B?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ut(e,t){return e.tabs[t]}function dt(e,t){return e.tabIntro[t]}function ft(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function pt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Oe,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ye,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(lt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(le,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ie,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Me,{}),t[6]=e):e=t[6],e}}}function mt(){let e=(0,Q.c)(3),t=i(),n=v(gt),r=h(n).remoteAccess,o=!!_(ht),[s,c]=a(),l=Re(s.get(`tab`)),u=s.get(`intent`)===`mobile-pairing`,d;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:2e3},e[0]=d):d=e[0];let f=E(u?`device-pairing-readiness`:null,pe,d),p;e[1]===c?p=e[2]:(p=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]=p);let m=p,g=dt(r,l),y=Le.map(e=>({id:e,label:ut(r,e)}));return(0,$.jsxs)(ae,{children:[(0,$.jsx)(J,{title:r.pageTitle,meta:(0,$.jsx)(de,{language:n,label:r.docsLink,section:ft(l),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(I,{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:f.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(D,{variant:`primary`,disabled:!f.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[f.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(q,{items:y,activeTab:l,onChange:m,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(oe,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ut(r,l),hint:l===`public`?void 0:g,showHeading:!1,framed:!1,children:(0,$.jsx)(pt,{tab:l,onOpenTab:m})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function ht(e){return e.conversationId}function gt(e){return e.language}export{mt as RemoteAccessHub};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);export{t};