@xopcai/xopc 0.0.121 → 0.0.123

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 (309) hide show
  1. package/README.md +23 -3
  2. package/README.zh-CN.md +23 -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-4AW4JgSU.js → agent-avatar-dicebear-Bicr3ZBg.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-CxDSFHGx.js +2 -0
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-CE6GkGU2.js → app-management-settings-panel-CbEy9sR1.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BmaUjghw.js → appearance-settings-CTHja6n9.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-CyZdgqvm.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-CX4_KWut.js → archive-plugin-Bpy64GjU.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-jf-PIIUU.js → attachment-load-DMkp4xSb.js} +1 -1
  12. package/dist/gateway/static/root/assets/automation-suggestion-card-KnYaP7NT.js +1 -0
  13. package/dist/gateway/static/root/assets/automations-page-8VLKM4au.js +1 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-DG9XQikd.js → binary-plugins-DA9C5mCw.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Up_VIxLJ.js → block-editor-CiSXk_YC.js} +6 -6
  16. package/dist/gateway/static/root/assets/browser-settings-page-5tPg0DcP.js +8 -0
  17. package/dist/gateway/static/root/assets/{capability-presets-api-CGM4OyMw.js → capability-presets-api-CEJ44WCU.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CzWt0LBb.js → capability-presets-settings-panel-BJW3aVST.js} +1 -1
  19. package/dist/gateway/static/root/assets/{channel-recipient-api-BEByL4_o.js → channel-recipient-api-CDhrhfhN.js} +1 -1
  20. package/dist/gateway/static/root/assets/channels-settings-CorUCTrs.js +1 -0
  21. package/dist/gateway/static/root/assets/connectors-page-VKstC3sP.js +2 -0
  22. package/dist/gateway/static/root/assets/directory-picker-path-field-7jKfbH0J.js +1 -0
  23. package/dist/gateway/static/root/assets/dreaming-settings-m1-wmz4o.js +1 -0
  24. package/dist/gateway/static/root/assets/{extension-debug-page-DZxa_j7-.js → extension-debug-page-C9qQQrBS.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-page-CseziW53.js → extension-page-DcBBMEGl.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-settings-page-B_9J-xyo.js → extension-settings-page-BQ-jMMP9.js} +1 -1
  27. package/dist/gateway/static/root/assets/{fetch-Cs4ck8zA.js → fetch-Dtpbbe0s.js} +1 -1
  28. package/dist/gateway/static/root/assets/{gateway-config-api-Dl223a7r.js → gateway-config-api-BN6pyX2c.js} +1 -1
  29. package/dist/gateway/static/root/assets/gateway-settings-hQtgVmSR.js +1 -0
  30. package/dist/gateway/static/root/assets/{gateway-startup-retry-IvePwjFE.js → gateway-startup-retry-BIET2x3y.js} +1 -1
  31. package/dist/gateway/static/root/assets/goal-create-dialog-BuIMDx6C.js +1 -0
  32. package/dist/gateway/static/root/assets/goal-detail-page-FEypCq74.js +1 -0
  33. package/dist/gateway/static/root/assets/{goals-config-api-CUCP6yCl.js → goals-config-api-CQm2r1Ty.js} +1 -1
  34. package/dist/gateway/static/root/assets/goals-page-C4-2_MLG.js +2 -0
  35. package/dist/gateway/static/root/assets/{goals-settings-Dj87qPxv.js → goals-settings-DDrdRMxB.js} +1 -1
  36. package/dist/gateway/static/root/assets/heartbeat-settings-BJVok3Sl.js +1 -0
  37. package/dist/gateway/static/root/assets/index-CBDr5xjB.css +1 -0
  38. package/dist/gateway/static/root/assets/index-T0SaNd5a.js +191 -0
  39. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DJgYw0nB.js → keyboard-shortcuts-settings-C2TuQppb.js} +1 -1
  40. package/dist/gateway/static/root/assets/logs-page-DwkwPgid.js +2 -0
  41. package/dist/gateway/static/root/assets/{markdown-split-gnQ_EiGo.js → markdown-split-DhONQ81k.js} +1 -1
  42. package/dist/gateway/static/root/assets/{media-plugins-CQV-mgJn.js → media-plugins-DS44pJzr.js} +1 -1
  43. package/dist/gateway/static/root/assets/messages-avfvyZuQ.js +3 -0
  44. package/dist/gateway/static/root/assets/models-hub-panel-huNY4A1G.js +2 -0
  45. package/dist/gateway/static/root/assets/notes-page-DdfGuEZ1.js +1 -0
  46. package/dist/gateway/static/root/assets/notes-workbench-B0bT9Hqa.js +2 -0
  47. package/dist/gateway/static/root/assets/{preview-open-alternatives-BPMXC-2u.js → preview-open-alternatives-Dej6zHnr.js} +1 -1
  48. package/dist/gateway/static/root/assets/project-detail-page-CjxhPorG.js +1 -0
  49. package/dist/gateway/static/root/assets/projects-page-C4Z5OJMF.js +1 -0
  50. package/dist/gateway/static/root/assets/remote-access-hub-CVCOPUVd.js +1 -0
  51. package/dist/gateway/static/root/assets/{save-bar-controls-BEHqwZjz.js → save-bar-controls-Zu1FzH6z.js} +1 -1
  52. package/dist/gateway/static/root/assets/{schedule-field-CMY25m97.js → schedule-field-BW78mKc0.js} +1 -1
  53. package/dist/gateway/static/root/assets/{schema-form-CxjxsFfg.js → schema-form-Cc-IOydE.js} +1 -1
  54. package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +1 -0
  55. package/dist/gateway/static/root/assets/sessions-page-B4qExXHC.js +1 -0
  56. package/dist/gateway/static/root/assets/settings-advanced-gate-Ce8yLTBi.js +1 -0
  57. package/dist/gateway/static/root/assets/{settings-collapsible-section-s-kiLAxP.js → settings-collapsible-section-DIpIYht_.js} +1 -1
  58. package/dist/gateway/static/root/assets/{settings-form-section-CIxIEYxU.js → settings-form-section-BFxBNxOG.js} +1 -1
  59. package/dist/gateway/static/root/assets/settings-page-C4fivemT.js +1 -0
  60. package/dist/gateway/static/root/assets/settings-page-layout-CLx4o2PN.js +1 -0
  61. package/dist/gateway/static/root/assets/setup-status-panel-Kyc4eUf0.js +1 -0
  62. package/dist/gateway/static/root/assets/share-preview-page-ZswWCrDu.js +2 -0
  63. package/dist/gateway/static/root/assets/shares-settings-Bu76CMiC.js +1 -0
  64. package/dist/gateway/static/root/assets/skill-reload-api-D-CFg86j.js +1 -0
  65. package/dist/gateway/static/root/assets/skills-page-CUU4f6Ss.js +2 -0
  66. package/dist/gateway/static/root/assets/{system-settings-panel-Czjf0kLJ.js → system-settings-panel-3ZNcGRhS.js} +1 -1
  67. package/dist/gateway/static/root/assets/{typed-models-lib-Cmt8SYdI.js → typed-models-lib-bpzZjiVF.js} +1 -1
  68. package/dist/gateway/static/root/assets/{use-channel-catalog-DyM-ckEQ.js → use-channel-catalog-BCjZLZ3O.js} +1 -1
  69. package/dist/gateway/static/root/assets/{user-profile-settings-panel-BygLv8vm.js → user-profile-settings-panel-CIXafITi.js} +1 -1
  70. package/dist/gateway/static/root/assets/{utils-CloW8coB.js → utils-DXMtz5j_.js} +1 -1
  71. package/dist/gateway/static/root/assets/voice-api-key-field-C1MrQD8R.js +1 -0
  72. package/dist/gateway/static/root/assets/workflow-run-setup-panel-DqizIcY5.js +3 -0
  73. package/dist/gateway/static/root/assets/workflow-start-dialog-B4sZpTDQ.js +1 -0
  74. package/dist/gateway/static/root/assets/workflows-page-B3sVNPFk.js +18 -0
  75. package/dist/gateway/static/root/index.html +5 -5
  76. package/dist/package.js +1 -1
  77. package/dist/src/agent/agent-manager.d.ts +2 -0
  78. package/dist/src/agent/agent-manager.js +47 -7
  79. package/dist/src/agent/agent-manager.js.map +1 -1
  80. package/dist/src/agent/context/project-context.d.ts +19 -0
  81. package/dist/src/agent/context/project-context.js +90 -0
  82. package/dist/src/agent/context/project-context.js.map +1 -0
  83. package/dist/src/agent/goals/goal-locale.js +2 -2
  84. package/dist/src/agent/memory/types.d.ts +1 -0
  85. package/dist/src/agent/prompt/service-prompt-builder.d.ts +1 -0
  86. package/dist/src/agent/prompt/service-prompt-builder.js +2 -0
  87. package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
  88. package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -0
  89. package/dist/src/agent/prompt/system-prompt-params.js +1 -0
  90. package/dist/src/agent/prompt/system-prompt-params.js.map +1 -1
  91. package/dist/src/agent/prompt/system-prompt.d.ts +1 -0
  92. package/dist/src/agent/prompt/system-prompt.js +2 -1
  93. package/dist/src/agent/prompt/system-prompt.js.map +1 -1
  94. package/dist/src/agent/service.js +4 -3
  95. package/dist/src/agent/service.js.map +1 -1
  96. package/dist/src/agent/session/session-config-service.js +6 -1
  97. package/dist/src/agent/session/session-config-service.js.map +1 -1
  98. package/dist/src/agent/session/session-hydrator.js +7 -3
  99. package/dist/src/agent/session/session-hydrator.js.map +1 -1
  100. package/dist/src/agent/session/session-inspector.js +9 -5
  101. package/dist/src/agent/session/session-inspector.js.map +1 -1
  102. package/dist/src/agent/starter-agents.js +5 -34
  103. package/dist/src/agent/starter-agents.js.map +1 -1
  104. package/dist/src/agent/tools/factory.js +1 -1
  105. package/dist/src/agent/tools/factory.js.map +1 -1
  106. package/dist/src/agent/tools/goal-tool.d.ts +5 -1
  107. package/dist/src/agent/tools/goal-tool.js +8 -2
  108. package/dist/src/agent/tools/goal-tool.js.map +1 -1
  109. package/dist/src/agent/tools/index.d.ts +1 -1
  110. package/dist/src/agent/workflow/index.js +2 -2
  111. package/dist/src/agent/workflow/runtime.js +1 -1
  112. package/dist/src/automations/api/routes.js +13 -2
  113. package/dist/src/automations/api/routes.js.map +1 -1
  114. package/dist/src/automations/domain/types.d.ts +2 -0
  115. package/dist/src/automations/domain/validation.d.ts +3 -0
  116. package/dist/src/automations/domain/validation.js +1 -0
  117. package/dist/src/automations/domain/validation.js.map +1 -1
  118. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -0
  119. package/dist/src/automations/service/action-executor.js +3 -1
  120. package/dist/src/automations/service/action-executor.js.map +1 -1
  121. package/dist/src/automations/service/automation-service.d.ts +4 -1
  122. package/dist/src/automations/service/automation-service.js +2 -2
  123. package/dist/src/automations/service/automation-service.js.map +1 -1
  124. package/dist/src/automations/storage/automation-repository.d.ts +3 -1
  125. package/dist/src/automations/storage/automation-repository.js +7 -5
  126. package/dist/src/automations/storage/automation-repository.js.map +1 -1
  127. package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
  128. package/dist/src/automations/storage/automation-run-repository.js +12 -1
  129. package/dist/src/automations/storage/automation-run-repository.js.map +1 -1
  130. package/dist/src/chat-commands/builtins/goal.js +4 -1
  131. package/dist/src/chat-commands/builtins/goal.js.map +1 -1
  132. package/dist/src/chat-commands/context.js +2 -1
  133. package/dist/src/chat-commands/context.js.map +1 -1
  134. package/dist/src/cli/command-loaders.js +1 -0
  135. package/dist/src/cli/command-loaders.js.map +1 -1
  136. package/dist/src/cli/command-manifest.js +4 -0
  137. package/dist/src/cli/command-manifest.js.map +1 -1
  138. package/dist/src/cli/commands/agent.js +2 -2
  139. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  140. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  141. package/dist/src/cli/commands/goal.js +27 -4
  142. package/dist/src/cli/commands/goal.js.map +1 -1
  143. package/dist/src/cli/commands/models.js +1 -1
  144. package/dist/src/cli/commands/onboard.js +1 -1
  145. package/dist/src/cli/commands/profile.js +1 -1
  146. package/dist/src/cli/commands/project.d.ts +4 -0
  147. package/dist/src/cli/commands/project.js +239 -0
  148. package/dist/src/cli/commands/project.js.map +1 -0
  149. package/dist/src/cli/commands/tunnel.js +1 -1
  150. package/dist/src/cli/commands/update.js +1 -1
  151. package/dist/src/cli/extension-cli-register.js +1 -1
  152. package/dist/src/config/index.js +1 -1
  153. package/dist/src/gateway/hono/routes/goals.js +51 -4
  154. package/dist/src/gateway/hono/routes/goals.js.map +1 -1
  155. package/dist/src/gateway/hono/routes/index.js +2 -0
  156. package/dist/src/gateway/hono/routes/index.js.map +1 -1
  157. package/dist/src/gateway/hono/routes/memory.js +5 -1
  158. package/dist/src/gateway/hono/routes/memory.js.map +1 -1
  159. package/dist/src/gateway/hono/routes/notes.js +5 -0
  160. package/dist/src/gateway/hono/routes/notes.js.map +1 -1
  161. package/dist/src/gateway/hono/routes/projects.d.ts +3 -0
  162. package/dist/src/gateway/hono/routes/projects.js +662 -0
  163. package/dist/src/gateway/hono/routes/projects.js.map +1 -0
  164. package/dist/src/gateway/hono/routes/sessions.js +47 -7
  165. package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
  166. package/dist/src/gateway/hono/routes/workflows.js +27 -4
  167. package/dist/src/gateway/hono/routes/workflows.js.map +1 -1
  168. package/dist/src/gateway/run-loop.js +1 -1
  169. package/dist/src/gateway/service.d.ts +3 -0
  170. package/dist/src/gateway/service.js +10 -3
  171. package/dist/src/gateway/service.js.map +1 -1
  172. package/dist/src/goals/goal-service.d.ts +1 -1
  173. package/dist/src/goals/goal-service.js +2 -1
  174. package/dist/src/goals/goal-service.js.map +1 -1
  175. package/dist/src/goals/goal-store.d.ts +1 -1
  176. package/dist/src/goals/goal-store.js +12 -6
  177. package/dist/src/goals/goal-store.js.map +1 -1
  178. package/dist/src/goals/goal-workflow-judge.js +1 -1
  179. package/dist/src/goals/types.d.ts +3 -0
  180. package/dist/src/i18n/goals-bundle.js +1 -1
  181. package/dist/src/i18n/index.js +1 -1
  182. package/dist/src/i18n/share-tool-bundle.js +2 -2
  183. package/dist/src/notes/agent-context.js +2 -2
  184. package/dist/src/projects/automation-bind.d.ts +1 -0
  185. package/dist/src/projects/automation-bind.js +16 -0
  186. package/dist/src/projects/automation-bind.js.map +1 -0
  187. package/dist/src/projects/goal-bind.d.ts +4 -0
  188. package/dist/src/projects/goal-bind.js +40 -0
  189. package/dist/src/projects/goal-bind.js.map +1 -0
  190. package/dist/src/projects/index.d.ts +12 -0
  191. package/dist/src/projects/index.js +12 -0
  192. package/dist/src/projects/memory-bind.d.ts +1 -0
  193. package/dist/src/projects/memory-bind.js +16 -0
  194. package/dist/src/projects/memory-bind.js.map +1 -0
  195. package/dist/src/projects/project-agent.d.ts +10 -0
  196. package/dist/src/projects/project-agent.js +27 -0
  197. package/dist/src/projects/project-agent.js.map +1 -0
  198. package/dist/src/projects/project-loop.d.ts +58 -0
  199. package/dist/src/projects/project-loop.js +118 -0
  200. package/dist/src/projects/project-loop.js.map +1 -0
  201. package/dist/src/projects/project-service.d.ts +40 -0
  202. package/dist/src/projects/project-service.js +187 -0
  203. package/dist/src/projects/project-service.js.map +1 -0
  204. package/dist/src/projects/project-store.d.ts +31 -0
  205. package/dist/src/projects/project-store.js +193 -0
  206. package/dist/src/projects/project-store.js.map +1 -0
  207. package/dist/src/projects/session-bind.d.ts +5 -0
  208. package/dist/src/projects/session-bind.js +46 -0
  209. package/dist/src/projects/session-bind.js.map +1 -0
  210. package/dist/src/projects/types.d.ts +62 -0
  211. package/dist/src/projects/types.js +1 -0
  212. package/dist/src/projects/workflow-bind.d.ts +1 -0
  213. package/dist/src/projects/workflow-bind.js +16 -0
  214. package/dist/src/projects/workflow-bind.js.map +1 -0
  215. package/dist/src/projects/workspace-project.d.ts +22 -0
  216. package/dist/src/projects/workspace-project.js +143 -0
  217. package/dist/src/projects/workspace-project.js.map +1 -0
  218. package/dist/src/projects/workspace.d.ts +5 -0
  219. package/dist/src/projects/workspace.js +25 -0
  220. package/dist/src/projects/workspace.js.map +1 -0
  221. package/dist/src/session/index.d.ts +1 -1
  222. package/dist/src/session/index.js +3 -3
  223. package/dist/src/session/session-workspace.d.ts +4 -2
  224. package/dist/src/session/session-workspace.js +10 -3
  225. package/dist/src/session/session-workspace.js.map +1 -1
  226. package/dist/src/session/types.d.ts +3 -0
  227. package/dist/src/session/types.js.map +1 -1
  228. package/dist/src/storage/sqlite/memory-records-repository.d.ts +3 -0
  229. package/dist/src/storage/sqlite/memory-records-repository.js +16 -5
  230. package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -1
  231. package/dist/src/storage/sqlite/migrations/019_projects.sql +40 -0
  232. package/dist/src/storage/sqlite/migrations/020_project_default_agent.sql +1 -0
  233. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  234. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  235. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  236. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  237. package/dist/src/storage/sqlite/notes-repository.js +20 -4
  238. package/dist/src/storage/sqlite/notes-repository.js.map +1 -1
  239. package/dist/src/storage/sqlite/row-mappers.d.ts +2 -0
  240. package/dist/src/storage/sqlite/row-mappers.js +2 -0
  241. package/dist/src/storage/sqlite/row-mappers.js.map +1 -1
  242. package/dist/src/storage/sqlite/schema.js +1 -1
  243. package/dist/src/storage/sqlite/session-repository.js +10 -5
  244. package/dist/src/storage/sqlite/session-repository.js.map +1 -1
  245. package/dist/src/storage/sqlite/transcript-repository.js +8 -0
  246. package/dist/src/storage/sqlite/transcript-repository.js.map +1 -1
  247. package/dist/src/tui/backends/embedded-backend.d.ts +7 -1
  248. package/dist/src/tui/backends/embedded-backend.js +41 -2
  249. package/dist/src/tui/backends/embedded-backend.js.map +1 -1
  250. package/dist/src/tui/backends/gateway-sse-backend.d.ts +7 -1
  251. package/dist/src/tui/backends/gateway-sse-backend.js +22 -0
  252. package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
  253. package/dist/src/tui/tui-backend.d.ts +16 -0
  254. package/dist/src/tui/tui-commands.js +145 -0
  255. package/dist/src/tui/tui-commands.js.map +1 -1
  256. package/dist/src/tui/tui.js +21 -0
  257. package/dist/src/tui/tui.js.map +1 -1
  258. package/dist/src/workflows/domain/run.d.ts +1 -0
  259. package/dist/src/workflows/domain/run.js.map +1 -1
  260. package/dist/src/workflows/index.js +1 -1
  261. package/dist/src/workflows/service/workflow-run-service.d.ts +1 -0
  262. package/dist/src/workflows/service/workflow-run-service.js +18 -4
  263. package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
  264. package/dist/src/workflows/service/workflow-run-service.types.d.ts +2 -0
  265. package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
  266. package/dist/src/workflows/service/workflow-session-bridge.js +3 -0
  267. package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
  268. package/dist/src/workflows/store/run-index-store.d.ts +1 -0
  269. package/dist/src/workflows/store/run-index-store.js +13 -3
  270. package/dist/src/workflows/store/run-index-store.js.map +1 -1
  271. package/dist/src/workflows/store/run-store.d.ts +3 -1
  272. package/dist/src/workflows/store/run-store.js +5 -2
  273. package/dist/src/workflows/store/run-store.js.map +1 -1
  274. package/package.json +10 -1
  275. package/dist/gateway/static/root/assets/agents-2SVUUPlp.js +0 -2
  276. package/dist/gateway/static/root/assets/apps-page-BWeQ1I49.js +0 -1
  277. package/dist/gateway/static/root/assets/automation-suggestion-card-BHk5rtJz.js +0 -1
  278. package/dist/gateway/static/root/assets/automations-page-QHotl53D.js +0 -1
  279. package/dist/gateway/static/root/assets/browser-settings-page-Cmwi6IIQ.js +0 -8
  280. package/dist/gateway/static/root/assets/channels-settings-BOMCUe2J.js +0 -1
  281. package/dist/gateway/static/root/assets/connectors-page-C-Dexk_F.js +0 -2
  282. package/dist/gateway/static/root/assets/dreaming-settings-WPEj8pir.js +0 -1
  283. package/dist/gateway/static/root/assets/gateway-settings-DdzbtW9R.js +0 -1
  284. package/dist/gateway/static/root/assets/goal-detail-page-Dxldogms.js +0 -1
  285. package/dist/gateway/static/root/assets/goals-page-DU5Nd6Xp.js +0 -2
  286. package/dist/gateway/static/root/assets/heartbeat-settings-Cgm5JmwH.js +0 -1
  287. package/dist/gateway/static/root/assets/index-BU1pvxmS.js +0 -191
  288. package/dist/gateway/static/root/assets/index-l54WfSqe.css +0 -1
  289. package/dist/gateway/static/root/assets/logs-page-C10aS4XO.js +0 -2
  290. package/dist/gateway/static/root/assets/messages-C6Kc4Jhf.js +0 -3
  291. package/dist/gateway/static/root/assets/models-hub-panel-B35CAfg6.js +0 -2
  292. package/dist/gateway/static/root/assets/note-detail-page-Brlwse8x.js +0 -2
  293. package/dist/gateway/static/root/assets/note-image-lightbox-BthwKjLA.js +0 -1
  294. package/dist/gateway/static/root/assets/note-time-hm6JO_Wi.js +0 -1
  295. package/dist/gateway/static/root/assets/notes-page-CoAwRc7L.js +0 -1
  296. package/dist/gateway/static/root/assets/remote-access-hub-B36RQ05h.js +0 -1
  297. package/dist/gateway/static/root/assets/sessions-page-73THChnj.js +0 -1
  298. package/dist/gateway/static/root/assets/settings-advanced-gate-CR9VsY-R.js +0 -1
  299. package/dist/gateway/static/root/assets/settings-page-BJ1AhfKI.js +0 -1
  300. package/dist/gateway/static/root/assets/settings-page-layout--6qT7ZJa.js +0 -1
  301. package/dist/gateway/static/root/assets/setup-status-panel-C1TtS1vJ.js +0 -1
  302. package/dist/gateway/static/root/assets/share-preview-page-BZADSbS1.js +0 -2
  303. package/dist/gateway/static/root/assets/shares-settings-gqC8Rmhy.js +0 -1
  304. package/dist/gateway/static/root/assets/skill-reload-api-C9P-WYvS.js +0 -1
  305. package/dist/gateway/static/root/assets/skills-page-CEpSvOhF.js +0 -2
  306. package/dist/gateway/static/root/assets/voice-api-key-field-BsoqJba6.js +0 -1
  307. package/dist/gateway/static/root/assets/voice-player-store-DduWlJYV.js +0 -1
  308. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CcQeX6l5.js +0 -3
  309. package/dist/gateway/static/root/assets/workflows-page-CeA8A9Ef.js +0 -18
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-avfvyZuQ.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{$ as s,$a as c,Ai as l,Ba as u,Ca as ee,Ci as te,Dc as ne,Do as d,E as f,Fs as re,H as ie,Ic as ae,Io as p,K as m,Lc as h,Mc as oe,Ms as se,Nc as g,Po as _,Qo as v,Qs as y,Sa as b,Si as ce,So as x,Ta as le,To as S,Va as C,Vo as ue,_i as de,aa as fe,at as pe,bi as w,c as T,dc as E,ea as me,et as he,fc as ge,fi as _e,gi as ve,hc as ye,hi as be,ia as xe,js as D,lc as Se,lo as Ce,mc as we,mi as Te,na as Ee,nt as De,oa as Oe,pi as O,ps as k,ra as ke,rn as Ae,ro as je,sa as Me,ta as Ne,vi as Pe,vo as A,wa as Fe,wi as Ie,xi as Le,yi as Re,zn as ze}from"./index-T0SaNd5a.js";import{t as Be}from"./notes-workbench-B0bT9Hqa.js";import{t as Ve}from"./directory-picker-path-field-7jKfbH0J.js";import{t as He}from"./goals-config-api-CQm2r1Ty.js";import{n as Ue,t as We}from"./goal-create-dialog-BuIMDx6C.js";import{t as Ge}from"./workflow-start-dialog-B4sZpTDQ.js";var Ke=n(),j=e(t(),1),M=r(),qe=[{id:`overview`,icon:k},{id:`sessions`,icon:v},{id:`goals`,icon:je},{id:`workflows`,icon:p},{id:`files`,icon:D},{id:`automations`,icon:C},{id:`notes`,icon:re},{id:`settings`,icon:A}],Je=qe.map(e=>e.id),Ye=new Set(qe.map(e=>e.id)),Xe=`xopc.projectTabs.`;function Ze(e){return!!(e&&Ye.has(e))}function Qe(e){return`${Xe}${e}`}function $e(e){let t=Array.isArray(e)?e:[],n=new Set,r=[];for(let e of t)!Ze(e)||n.has(e)||(n.add(e),r.push(e));for(let e of Je)n.has(e)||r.push(e);return r}function et(e){if(!e)return Je;try{let t=window.localStorage.getItem(Qe(e));return $e(t?JSON.parse(t):null)}catch{return Je}}function N(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function P(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function tt(e){if(e===void 0)return``;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function F(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function nt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function I(e){let t=(0,Ke.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,M.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,M.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function L(e=!1){return i(`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 rt(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function it(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function at(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function ot(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function st({currentProject:e,pm:t,projectsText:n,wd:r}){let a=ae(),[o,s]=(0,j.useState)(!1),[c,l]=(0,j.useState)([e]),[te,ne]=(0,j.useState)(``),[d,f]=(0,j.useState)(!1),[re,ie]=(0,j.useState)(null),[p,m]=(0,j.useState)(!1),[h,oe]=(0,j.useState)(`new`),[g,v]=(0,j.useState)(``),[y,S]=(0,j.useState)(``),[C,ue]=(0,j.useState)(!1),[de,pe]=(0,j.useState)(null),[w,T]=(0,j.useState)(null),E=(0,j.useCallback)(async()=>{f(!0),ie(null);try{let t=await ce({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){ie(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,j.useEffect)(()=>{l(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,j.useEffect)(()=>{o&&E()},[E,o]);let he=(0,j.useMemo)(()=>{let t=te.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=rt(e);return t.every(e=>n.includes(e))}).sort((e,t)=>it(t)-it(e))},[e.id,c,te]),ge=e=>t.statuses[e.status]??e.status,_e=e=>e.workspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ve=e=>{oe(e),v(``),S(``),pe(null),m(!0),s(!1)},be=(0,j.useCallback)(async(e={})=>{let t=y.trim(),n=g.trim()||(h===`directory`?at(t):``);if(n){ue(!0),pe(null),T(null);try{let r=await O({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});m(!1),v(``),S(``),l(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=ot(e);t?(T(t),m(!1)):pe(e instanceof Error?e.message:String(e))}finally{ue(!1)}}},[h,g,a,y]),Se=(0,j.useCallback)(e=>{e.preventDefault(),be()},[be]),Ce=(0,j.useCallback)(()=>{be({createWorkspaceRoot:!0})},[be]),Te=(0,j.useCallback)(()=>{T(null),m(!0)},[]),De=e=>{S(e),h===`directory`&&!g.trim()&&v(at(e))},k=(e,t)=>(0,M.jsxs)(`button`,{type:`button`,className:i(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 py-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,M.jsx)(ye,{className:i(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,M.jsxs)(`span`,{className:`min-w-0`,children:[(0,M.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,M.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:_e(e)})]}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,F(e.status)),children:ge(e)})]},e.id);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(Fe,{open:o,onOpenChange:s,children:[(0,M.jsx)(le,{asChild:!0,children:(0,M.jsxs)(`button`,{type:`button`,className:`group -ml-2 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,M.jsxs)(`span`,{className:`min-w-0`,children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,F(e.status)),children:ge(e)})]}),(0,M.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:_e(e)})]}),(0,M.jsx)(we,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,M.jsx)(ee,{children:(0,M.jsxs)(b,{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,M.jsxs)(`label`,{className:`relative block`,children:[(0,M.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,M.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:te,onChange:e=>ne(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,M.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,M.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),k(e,!0),(0,M.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),re?(0,M.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:re}):null,d&&he.length===0?(0,M.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!d&&he.length===0?(0,M.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,he.map(e=>k(e,!1))]}),(0,M.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,M.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:()=>ve(`new`),children:[(0,M.jsx)(_,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,M.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:()=>ve(`directory`),children:[(0,M.jsx)(D,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,M.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,M.jsx)(A,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,M.jsx)(fe,{open:p,onOpenChange:e=>!C&&m(e),children:(0,M.jsxs)(xe,{children:[(0,M.jsx)(ke,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,M.jsxs)(Ne,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,M.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,M.jsx)(Oe,{className:`text-base font-semibold text-fg`,children:h===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,M.jsx)(Ee,{className:`mt-1 text-sm text-fg-muted`,children:h===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,M.jsxs)(`form`,{onSubmit:Se,className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[de?(0,M.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:de}):null,(0,M.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,M.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,M.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:g,onChange:e=>v(e.target.value),placeholder:`xopc`,autoFocus:!0})]}),(0,M.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,M.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,M.jsx)(Ve,{value:y,onChange:De,disabled:C,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,M.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,M.jsx)(me,{asChild:!0,children:(0,M.jsx)(u,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:C,children:n.cancel})}),(0,M.jsxs)(u,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:C||!(g.trim()||h===`directory`&&at(y)),children:[(0,M.jsx)(_,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,M.jsx)(fe,{open:!!w,onOpenChange:e=>{e||T(null)},children:(0,M.jsxs)(xe,{children:[(0,M.jsx)(ke,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,M.jsxs)(Ne,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,M.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,M.jsx)(Oe,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,M.jsx)(Ee,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:w?N(n.workspaceMissingDescription,{workspace:w}):null})]}),w?(0,M.jsx)(`div`,{className:`px-5 py-4`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,M.jsx)(D,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:w})]})}):null,(0,M.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,M.jsx)(u,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Te,disabled:C,children:n.workspaceMissingBack}),(0,M.jsxs)(u,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:Ce,disabled:C,children:[(0,M.jsx)(se,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ct(){let{projectId:e=``,tabId:t,noteId:n}=h(),r=ae(),ee=o(e=>e.language),b=a(ee),ce=b.chat.workingDirectory,x=b.projectDetailPage,le=b.projectsPage,ye=Me(e=>e.setPageHeader),we=Me(e=>e.clearPageHeader),[O,k]=(0,j.useState)(null),[A,Fe]=(0,j.useState)(null),[Ke,Ye]=(0,j.useState)([]),[Xe,rt]=(0,j.useState)([]),[it,at]=(0,j.useState)([]),[ct,lt]=(0,j.useState)([]),[ut,dt]=(0,j.useState)([]),[ft,pt]=(0,j.useState)([]),[mt,ht]=(0,j.useState)(!1),[gt,_t]=(0,j.useState)(null),[vt,yt]=(0,j.useState)(!1),[R,z]=(0,j.useState)(``),[bt,xt]=(0,j.useState)([]),[St,Ct]=(0,j.useState)(null),[wt,Tt]=(0,j.useState)(!1),[Et,Dt]=(0,j.useState)(null),[Ot,kt]=(0,j.useState)([]),[B,At]=(0,j.useState)(``),[jt,Mt]=(0,j.useState)(!0),[Nt,Pt]=(0,j.useState)(!1),[Ft,It]=(0,j.useState)(!1),[V,Lt]=(0,j.useState)(null),[Rt,zt]=(0,j.useState)(!1),[Bt,Vt]=(0,j.useState)(!1),[Ht,Ut]=(0,j.useState)(!1),[Wt,Gt]=(0,j.useState)(!1),[Kt,qt]=(0,j.useState)(null),[H,Jt]=(0,j.useState)(null),[Yt,Xt]=(0,j.useState)(!1),[Zt,Qt]=(0,j.useState)(!1),[$t,en]=(0,j.useState)(!1),[tn,U]=(0,j.useState)(null),[nn,rn]=(0,j.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[W,an]=(0,j.useState)({title:``,reason:``}),[on,sn]=(0,j.useState)(()=>et(e)),[G,K]=(0,j.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),cn=on[0]??Je[0],q=n?`notes`:Ze(t)?t:cn,J=(0,j.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),ln=(0,j.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),un=(0,j.useCallback)(t=>{e&&r(ln(t),{replace:!0})},[r,e,ln]),Y=(0,j.useCallback)((e,t)=>{un(e),r(t)},[r,un]),X=(0,j.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||un(e)},[un]),dn=(0,j.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:q,[q]);(0,j.useEffect)(()=>{!e||!t||Ze(t)||r(`/projects/${encodeURIComponent(e)}/${cn}`,{replace:!0})},[cn,r,e,t]),(0,j.useEffect)(()=>{sn(et(e))},[e]);let fn=(0,j.useCallback)((t,n,r=`before`)=>{t!==n&&sn(i=>{let a=$e(i),o=a.indexOf(t),s=a.indexOf(n);if(o<0||s<0)return a;let[c]=a.splice(o,1),l=a.indexOf(n);return l<0?$e(i):(a.splice(r===`after`?l+1:l,0,c),e&&window.localStorage.setItem(Qe(e),JSON.stringify(a)),a)})},[e]);(0,j.useEffect)(()=>{if(!e)return;let t=!1;return Mt(!0),U(null),Promise.all([w(e),Le(e),Re(e),ze().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;k(a),Fe(e),Ye(n),rt(r),kt(i?.agents??[]),At(a.defaultAgentId??``),K({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||U(e instanceof Error?e.message:String(e))}).finally(()=>{t||Mt(!1)}),()=>{t=!0}},[e]),(0,j.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([ze(),Ae(),l()]);e||rn(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=O?.defaultAgentId||B||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?He(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[O?.defaultAgentId,B]);let Z=(0,j.useCallback)(async()=>{if(O){Ut(!0),U(null);try{let[e,t]=await Promise.all([s(),he(100,{ownerAgentId:B||void 0,projectId:O.id})]);at(e),lt(t)}catch(e){U(e instanceof Error?e.message:String(e))}finally{Ut(!1)}}},[O,B]);(0,j.useEffect)(()=>{O&&Z()},[O,Z]);let Q=(0,j.useCallback)(async()=>{if(O){ht(!0),U(null);try{let[e,t]=await Promise.all([T.list({projectId:O.id}),T.runs(50,void 0,{projectId:O.id})]);dt(e.automations),pt(t.runs)}catch(e){U(e instanceof Error?e.message:String(e))}finally{ht(!1)}}},[O]);(0,j.useEffect)(()=>{q===`automations`&&Q()},[Q,q]);let pn=(0,j.useCallback)(async e=>{_t(`run:${e.id}`),U(null);try{await T.runNow(e.id),await Q()}catch(e){U(e instanceof Error?e.message:String(e))}finally{_t(null)}},[Q]),mn=(0,j.useCallback)(async e=>{_t(`toggle:${e.id}`),U(null);try{e.enabled?await T.pause(e.id):await T.resume(e.id),await Q()}catch(e){U(e instanceof Error?e.message:String(e))}finally{_t(null)}},[Q]),hn=(0,j.useCallback)(async()=>{if(!O?.workspaceRoot?.trim()){xt([]),Ct(null),Dt(null);return}Tt(!0),Dt(null);try{let e=await Pe(O.id,R);xt(e.entries),z(e.path),Ct(e.parentPath)}catch(e){xt([]),Ct(null),Dt(e instanceof Error?e.message:String(e))}finally{Tt(!1)}},[R,O]);(0,j.useEffect)(()=>{q===`files`&&hn()},[hn,q]);let gn=(0,j.useCallback)(async()=>{if(O){Vt(!0),U(null);try{let e=await ve(O.id,B||void 0);Y(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{Vt(!1)}}},[Y,O,B]),_n=(0,j.useCallback)(async()=>{if(!O)return;let[e,t]=await Promise.all([w(O.id),Re(O.id)]);Fe(e),k(e.project),rt(t)},[O]),vn=(0,j.useCallback)(async e=>{if(!O||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;Xt(!0),U(null);try{let r=await be(O.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0});for(let t of Ue(e.checklist))await _e(r.id,t);en(!1),J(`goals`),await _n()}catch(e){throw U(e instanceof Error?e.message:String(e)),e}finally{Xt(!1)}},[J,O,_n]),yn=(0,j.useCallback)(async e=>{if(e.preventDefault(),!(!O||!W.title.trim())){Qt(!0),U(null);try{await Te(O.id,{title:W.title.trim(),reason:W.reason.trim()||void 0}),an({title:``,reason:``}),await _n()}catch(e){U(e instanceof Error?e.message:String(e))}finally{Qt(!1)}}},[W.reason,W.title,O,_n]),bn=(0,j.useCallback)(async e=>{if(!(!O||!H)){Gt(!0),U(null);try{let t=await pe({definitionId:H.id,projectId:O.id,agentId:B||void 0,goal:e.goal,input:e.input,concurrency:e.concurrency,maxSubagents:e.maxSubagents});Jt(null),await Z(),Y(`workflows`,f(t.runId))}catch(e){U(e instanceof Error?e.message:String(e))}finally{Gt(!1)}}},[Y,O,Z,B,H]),xn=(0,j.useCallback)(async e=>{if(O){qt(`retry:${e.id}`),U(null);try{let t=await De(e.id,{ownerAgentId:B||e.metadata?.agentId,projectId:e.metadata?.projectId||O.id});await Z(),Y(`workflows`,f(t.runId))}catch(e){U(e instanceof Error?e.message:String(e))}finally{qt(null)}}},[Y,O,Z,B]),Sn=(0,j.useCallback)(async e=>{qt(`cancel:${e.id}`),U(null);try{await m(e.id,{ownerAgentId:B||e.metadata?.agentId}),await Z()}catch(e){U(e instanceof Error?e.message:String(e))}finally{qt(null)}},[Z,B]),Cn=(0,j.useMemo)(()=>(0,M.jsx)(g,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":x.backToProjects,children:(0,M.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),[x.backToProjects]),wn=(0,j.useMemo)(()=>O?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`select`,{className:`h-9 rounded-lg border border-edge bg-surface-muted px-3 text-sm text-fg outline-none focus:border-accent`,value:B,onChange:e=>At(e.target.value),"aria-label":x.common.agent,children:[(0,M.jsx)(`option`,{value:``,children:x.common.defaultAgent}),Ot.map(e=>(0,M.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))]}),(0,M.jsxs)(u,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void gn(),disabled:Bt,children:[(0,M.jsx)(v,{className:`size-4`,"aria-hidden":!0}),x.common.newChat]})]}):null,[Ot,x.common.agent,x.common.defaultAgent,x.common.newChat,O,B,gn,Bt]);(0,j.useLayoutEffect)(()=>(ye({startExtra:Cn,main:O?(0,M.jsx)(st,{currentProject:O,pm:x,projectsText:le,wd:ce}):(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:x.fallbackTitle}),(0,M.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x.fallbackContext})]}),end:wn}),()=>we()),[we,wn,Cn,x,O,le,ye,ce]);async function Tn(e={}){if(!(!O||!G.name.trim())){Pt(!0),U(null),Lt(null);try{let t=await Ie(O.id,{name:G.name.trim(),status:G.status,description:G.description,defaultAgentId:G.defaultAgentId,workspaceRoot:G.workspaceRoot,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{},brief:G.brief,instructions:G.instructions});k(e=>e?{...e,...t}:null),Fe(e=>e?{...e,project:{...e.project,...t}}:null),At(t.defaultAgentId??``)}catch(e){let t=ot(e);t?Lt(t):U(e instanceof Error?e.message:String(e))}finally{Pt(!1)}}}function En(e){e.preventDefault(),Tn()}async function Dn(){if(O){zt(!0),U(null);try{await de(O.id),It(!1),r(`/projects`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{zt(!1)}}}async function On(){if(!(!O||vt)){yt(!0),U(null);try{await te(O.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{yt(!1)}}}if(jt)return(0,M.jsx)(`main`,{className:`w-full flex-1 px-3 py-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:x.loading});if(!O)return(0,M.jsxs)(`main`,{className:`w-full flex-1 px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,M.jsxs)(g,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,M.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),x.backToProjects]}),(0,M.jsx)(`p`,{className:`mt-6 rounded-lg border border-edge bg-surface-panel p-4 text-sm text-fg-muted`,children:tn||x.notFound})]});let kn=A?.recentSessions.length?A.recentSessions:O.recentSessions,An=A?.recentWorkflowRuns.length?A.recentWorkflowRuns:O.recentWorkflowRuns,jn=A?.attentionItems??[],Mn=A?.timeline??[],Nn=R?R.split(`/`).filter(Boolean):[],$=e=>x.statuses[e]??e,Pn=e=>N(x.common.messages,{count:e});return(0,M.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,M.jsx)(ie,{items:on.map(e=>{let t=qe.find(t=>t.id===e);return{...t,label:x.tabs[t.id]}}),activeTab:q,onChange:J,onReorder:fn,ariaLabel:x.navAria,tabIdPrefix:`project-tab`,panelIdPrefix:`project-panel`,className:`shrink-0`}),tn?(0,M.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:tn}):null,(0,M.jsxs)(`div`,{className:i(`mt-3 min-h-0 flex-1`,q===`overview`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[q===`overview`?(0,M.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-tab-overview`,className:`grid h-full min-h-0 overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,M.jsxs)(`div`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.directionTitle}),(0,M.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:A?.digest?.summary||A?.recommendedAction||O.description||O.brief||x.overview.directionFallback}),A?.digest?.nextAction?(0,M.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:N(x.overview.recommendedNext,{action:A.digest.nextAction})}):null]}),(0,M.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,M.jsxs)(u,{type:`button`,variant:`secondary`,onClick:()=>void On(),disabled:vt,children:[(0,M.jsx)(S,{className:`size-4`,"aria-hidden":!0}),vt?x.overview.savingDigest:x.overview.saveDigest]})})]}),(0,M.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-2 sm:grid-cols-2 lg:grid-cols-5`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 rounded-md border border-edge bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,M.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:x.overview.sessions})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xl font-semibold text-fg`,children:A?.stats.sessionCount??O.sessionCount})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-md border border-edge bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,M.jsx)(je,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:x.overview.activeGoals})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xl font-semibold text-fg`,children:A?.stats.activeGoalCount??O.activeGoalCount})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-md border border-edge bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,M.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:x.overview.attention})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xl font-semibold text-fg`,children:A?.stats.attentionCount??jn.length})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-md border border-edge bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,M.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:x.overview.staleGoals})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xl font-semibold text-fg`,children:A?.stats.staleGoalCount??A?.staleGoals?.length??0})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-md border border-edge bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,M.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:x.overview.recentWorkflowRuns})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xl font-semibold text-fg`,children:A?.stats.recentWorkflowRunCount??O.recentWorkflowRuns.length})]})]})]}),(0,M.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.nextActions}),(0,M.jsxs)(u,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>en(!0),children:[(0,M.jsx)(_,{className:`size-4`,"aria-hidden":!0}),x.overview.goal]})]}),(0,M.jsx)(`div`,{className:`divide-y divide-edge`,children:A?.nextActions.length?A.nextActions.map(e=>(0,M.jsxs)(g,{to:`/goals/${encodeURIComponent(e.goalId)}`,onClick:X(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,F(e.status)),children:$(e.status)})]}),(0,M.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noNextActions})})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.activeGoals}),(0,M.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>J(`goals`),children:x.common.viewAll})]}),(0,M.jsx)(`div`,{className:`divide-y divide-edge`,children:A?.activeGoals.length?A.activeGoals.map(e=>(0,M.jsxs)(g,{to:`/goals/${encodeURIComponent(e.id)}`,onClick:X(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,F(e.status)),children:$(e.status)})]}),(0,M.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.nextAction||e.description||x.overview.noNextAction})]},e.id)):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noActiveGoals})})]})]}),(0,M.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-edge px-4 py-3`,children:[(0,M.jsx)(y,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.recentSessions})]}),(0,M.jsx)(`div`,{className:`divide-y divide-edge`,children:kn.length?kn.map(e=>(0,M.jsxs)(g,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:X(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:P(e.updatedAt)})]}),(0,M.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||x.common.agent})]},e.key)):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noSessions})})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-edge px-4 py-3`,children:[(0,M.jsx)(Se,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.workflowRuns})]}),(0,M.jsx)(`div`,{className:`divide-y divide-edge`,children:An.length?An.map(e=>(0,M.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.definitionId}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,nt(e.status)),children:$(e.status)})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:P(e.createdAt)})]},e.runId)):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noWorkflowRuns})})]})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-edge px-4 py-3`,children:[(0,M.jsx)(oe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.timeline})]}),(0,M.jsx)(`div`,{className:`divide-y divide-edge`,children:Mn.length?Mn.map(e=>{let t=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:P(e.timestamp)})]}),(0,M.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[x.overview.timelineKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:``]})]});return e.href?(0,M.jsx)(g,{to:e.href,onClick:X(dn(e.href)),className:`block px-4 py-3 hover:bg-surface-hover`,children:t},e.id):(0,M.jsx)(`div`,{className:`px-4 py-3`,children:t},e.id)}):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noTimeline})})]})]}),(0,M.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.workspace}),(0,M.jsx)(`p`,{className:`mt-2 break-all text-sm leading-5 text-fg-muted`,children:O.workspaceRoot||x.common.defaultWorkspace}),(0,M.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:N(x.common.updated,{time:P(O.updatedAt)})})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.brief}),(0,M.jsx)(`p`,{className:`mt-2 break-words whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:O.brief||x.overview.noBrief})]}),(0,M.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.attention}),jn.length?(0,M.jsx)(`div`,{className:`mt-3 grid gap-3`,children:jn.map(e=>{let t=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(E,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,M.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[x.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${$(e.status)}`:``]})]});return e.href?(0,M.jsx)(g,{to:e.href,onClick:X(dn(e.href)),className:`min-w-0 rounded-md border border-edge bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,M.jsx)(`div`,{className:`min-w-0 rounded-md border border-edge bg-surface-base p-3`,children:t},e.id)})}):(0,M.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:x.overview.noBlockedGoals}),(0,M.jsxs)(`form`,{onSubmit:yn,className:`mt-4 grid gap-2 border-t border-edge pt-4`,children:[(0,M.jsx)(`input`,{className:`min-h-9 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:W.title,onChange:e=>an(t=>({...t,title:e.target.value})),placeholder:x.overview.blockerTitlePlaceholder}),(0,M.jsx)(`textarea`,{className:`min-h-20 rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:W.reason,onChange:e=>an(t=>({...t,reason:e.target.value})),placeholder:x.overview.blockerReasonPlaceholder}),(0,M.jsxs)(u,{type:`submit`,variant:`secondary`,className:`justify-self-start rounded-lg`,disabled:Zt||!W.title.trim(),children:[(0,M.jsx)(_,{className:`size-4`,"aria-hidden":!0}),Zt?x.overview.addingBlocker:x.overview.addBlocker]})]})]})]})]}):null,q===`workflows`?(0,M.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,M.jsx)(`div`,{className:`min-h-0`,children:(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.workflows.runsTitle}),(0,M.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x.workflows.runsHint})]}),(0,M.jsxs)(u,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Z(),disabled:Ht,children:[(0,M.jsx)(d,{className:`size-4`,"aria-hidden":!0}),x.common.refresh]})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Ht&&ct.length===0?(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.workflows.loadingRuns}):ct.length?ct.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,M.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>Y(`workflows`,f(e.id)),children:e.title||e.definitionId}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,nt(e.status)),children:$(e.status)})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:N(x.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:P(e.createdAtMs)})}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>Y(`workflows`,f(e.id)),children:x.common.open}),n?(0,M.jsxs)(u,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Kt===`retry:${e.id}`,onClick:()=>void xn(e),children:[(0,M.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),x.common.retry]}):null,t?(0,M.jsxs)(u,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Kt===`cancel:${e.id}`,onClick:()=>void Sn(e),children:[(0,M.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),x.common.cancel]}):null]})]})]},e.id)}):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.workflows.emptyRuns})})]})}),(0,M.jsx)(`aside`,{className:`min-h-0`,children:(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.workflows.startTitle}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:x.workflows.startHint})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,M.jsx)(`div`,{className:`grid gap-2`,children:it.length?it.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md border border-edge bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>Jt(e),children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,M.jsx)(p,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,M.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,M.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:x.workflows.emptyDefinitions})})})]})})]}):null,q===`automations`?(0,M.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,M.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.automations.title}),(0,M.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x.automations.hint})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(u,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Q(),disabled:mt,children:[(0,M.jsx)(d,{className:`size-4`,"aria-hidden":!0}),x.common.refresh]}),(0,M.jsxs)(u,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>Y(`automations`,`/automations?projectId=${encodeURIComponent(O.id)}&action=create`),children:[(0,M.jsx)(_,{className:`size-4`,"aria-hidden":!0}),x.common.new]})]})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:mt&&ut.length===0?(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.automations.loading}):ut.length?ut.map(e=>{let t=ft.find(t=>t.automationId===e.id),n=e.state.runningRunId?ft.find(t=>t.id===e.state.runningRunId):null;return(0,M.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>Y(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?x.automations.enabled:x.automations.paused})]}),(0,M.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:N(x.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?P(t.createdAtMs):x.common.never})}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsxs)(u,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:gt===`run:${e.id}`||!!n,onClick:()=>void pn(e),children:[(0,M.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),x.automations.run]}),(0,M.jsxs)(u,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:gt===`toggle:${e.id}`,onClick:()=>void mn(e),children:[e.enabled?(0,M.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}):(0,M.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?x.automations.pause:x.automations.resume]})]})]})]},e.id)}):(0,M.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,M.jsx)(`p`,{children:x.automations.empty}),(0,M.jsx)(`div`,{children:(0,M.jsxs)(u,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Y(`automations`,`/automations?projectId=${encodeURIComponent(O.id)}&action=create`),children:[(0,M.jsx)(C,{className:`size-4`,"aria-hidden":!0}),x.automations.create]})})]})})]}),(0,M.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,M.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.automations.recentRuns})}),(0,M.jsx)(`div`,{className:`divide-y divide-edge`,children:ft.length?ft.slice(0,8).map(e=>(0,M.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,nt(e.status)),children:$(e.status)})]}),(0,M.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:P(e.createdAtMs)})]},e.id)):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.automations.emptyRuns})})]}),(0,M.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.automations.contextTitle}),(0,M.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:x.automations.contextHint}),(0,M.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:O.workspaceRoot||x.common.defaultWorkspace})]})]})]}):null,q===`notes`?(0,M.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:(0,M.jsx)(Be,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(O.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${O.id}`,captureTags:[`project:${O.id}`,O.slug],listTitle:x.notes.title,listDescription:x.notes.hint,emptyText:x.notes.emptyTitle,emptyDescription:x.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${O.id}`})}):null,q===`files`?(0,M.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-tab-files`,className:`h-full min-h-[28rem]`,children:(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.files.title}),(0,M.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:O.workspaceRoot||x.files.noWorkspace}),(0,M.jsx)(`p`,{className:`mt-1 max-w-3xl text-xs leading-5 text-fg-subtle`,children:x.files.boundaryHint})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,M.jsxs)(u,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void hn(),disabled:wt||!O.workspaceRoot,children:[(0,M.jsx)(d,{className:`size-4`,"aria-hidden":!0}),x.common.refresh]}),(0,M.jsxs)(u,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>J(`workflows`),children:[(0,M.jsx)(p,{className:`size-4`,"aria-hidden":!0}),x.tabs.workflows]})]})]}),O.workspaceRoot?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`flex min-h-10 flex-wrap items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 py-1.5 text-sm`,children:[(0,M.jsx)(`button`,{type:`button`,className:i(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,!R&&`bg-surface-hover text-fg`),onClick:()=>z(``),children:x.common.root}),Nn.map((e,t)=>{let n=Nn.slice(0,t+1).join(`/`);return(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,M.jsx)(ge,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),(0,M.jsx)(`button`,{type:`button`,className:i(`max-w-40 truncate rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,t===Nn.length-1&&`bg-surface-hover text-fg`),onClick:()=>z(n),children:e})]},n)})]}),Et?(0,M.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Et}):null,(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[St===null?null:(0,M.jsxs)(`button`,{type:`button`,className:`grid h-8 w-full grid-cols-[minmax(0,1fr)_5rem] items-center gap-3 px-3 text-left text-sm hover:bg-surface-hover sm:grid-cols-[minmax(0,1fr)_8rem_10rem]`,onClick:()=>z(St),children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-fg`,children:[(0,M.jsx)(ge,{className:`size-3.5 shrink-0 rotate-180 text-fg-subtle`,"aria-hidden":!0}),(0,M.jsx)(D,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`truncate font-medium`,children:`..`})]}),(0,M.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:x.common.folder}),(0,M.jsx)(`span`,{className:`hidden sm:block`})]}),wt&&bt.length===0?(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.files.loading}):bt.length?bt.map(e=>{let t=e.type===`directory`,n=t?D:re;return(0,M.jsxs)(`button`,{type:`button`,className:i(`grid h-8 w-full grid-cols-[minmax(0,1fr)_5rem] items-center gap-3 px-3 text-left text-sm sm:grid-cols-[minmax(0,1fr)_8rem_10rem]`,t?`hover:bg-surface-hover`:`cursor-default`),onClick:()=>{t&&z(e.path)},children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-fg`,children:[(0,M.jsx)(ge,{className:i(`size-3.5 shrink-0 text-fg-subtle`,!t&&`opacity-0`),"aria-hidden":!0}),(0,M.jsx)(n,{className:i(`size-4 shrink-0`,t?`text-accent-fg`:`text-fg-muted`),"aria-hidden":!0}),(0,M.jsx)(`span`,{className:i(`truncate`,t&&`font-medium`),children:e.name})]}),(0,M.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:t?x.common.folder:tt(e.size)}),(0,M.jsx)(`span`,{className:`hidden truncate text-right text-xs text-fg-subtle sm:block`,children:P(e.updatedAt)})]},e.path)}):(0,M.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.files.emptyDirectory})]})]}):(0,M.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,M.jsx)(`p`,{children:x.files.needWorkspace}),(0,M.jsx)(`div`,{children:(0,M.jsx)(u,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>J(`settings`),children:x.files.openSettings})})]})]})}):null,q===`sessions`?(0,M.jsx)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-tab-sessions`,className:`grid min-h-full content-start`,children:(0,M.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:Ke.length?Ke.map(e=>{let t=P(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=t?N(x.sessions.metaWithTime,{agent:n,messages:Pn(e.messageCount??0),time:t}):N(x.sessions.meta,{agent:n,messages:Pn(e.messageCount??0)});return(0,M.jsx)(`article`,{className:`grid gap-3 border-b border-edge px-4 py-3 transition-colors last:border-b-0 hover:bg-surface-hover/50 sm:grid-cols-[minmax(0,1fr)_auto]`,children:(0,M.jsxs)(g,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:X(`sessions`),className:`min-w-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:col-span-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),t?(0,M.jsx)(`span`,{className:`hidden shrink-0 text-xs text-fg-subtle md:block`,children:t}):null]}),(0,M.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:r})]})},e.key)}):(0,M.jsx)(`div`,{className:`grid gap-1 px-4 py-8 text-center`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x.sessions.emptyTitle}),(0,M.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:x.sessions.emptyDescription})]})})})}):null,q===`goals`?(0,M.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`div`,{children:(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.goals.title})}),(0,M.jsxs)(u,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:Yt,onClick:()=>en(!0),children:[(0,M.jsx)(_,{className:`size-4`,"aria-hidden":!0}),x.goals.new]})]}),(0,M.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:Xe.length?Xe.map(e=>(0,M.jsxs)(g,{to:`/goals/${encodeURIComponent(e.id)}`,onClick:X(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,M.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,F(e.status)),children:$(e.status)})]}),(0,M.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||x.goals.noNextAction})]},e.id)):(0,M.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:x.goals.empty})})]}):null,q===`settings`?(0,M.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-tab-settings`,onSubmit:En,className:`grid min-h-full content-start gap-4 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,M.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,M.jsx)(I,{label:x.settings.name,children:(0,M.jsx)(`input`,{className:L(),value:G.name,onChange:e=>K(t=>({...t,name:e.target.value}))})}),(0,M.jsx)(I,{label:x.settings.status,children:(0,M.jsxs)(`select`,{className:L(),value:G.status,onChange:e=>K(t=>({...t,status:e.target.value})),children:[(0,M.jsx)(`option`,{value:`active`,children:x.settings.statuses.active}),(0,M.jsx)(`option`,{value:`paused`,children:x.settings.statuses.paused}),(0,M.jsx)(`option`,{value:`archived`,children:x.settings.statuses.archived})]})}),(0,M.jsx)(I,{label:x.settings.defaultAgent,children:(0,M.jsxs)(`select`,{className:L(),value:G.defaultAgentId,onChange:e=>K(t=>({...t,defaultAgentId:e.target.value})),children:[(0,M.jsx)(`option`,{value:``,children:x.settings.globalDefaultAgent}),Ot.map(e=>(0,M.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))]})})]}),(0,M.jsx)(I,{label:x.settings.description,children:(0,M.jsx)(`input`,{className:L(),value:G.description,onChange:e=>K(t=>({...t,description:e.target.value}))})}),(0,M.jsx)(I,{label:x.settings.workspaceRoot,children:(0,M.jsx)(Ve,{value:G.workspaceRoot,onChange:e=>K(t=>({...t,workspaceRoot:e})),disabled:Nt,wd:ce,placeholder:x.settings.workspacePlaceholder,inputClassName:L()})}),(0,M.jsx)(I,{label:x.settings.brief,children:(0,M.jsx)(`textarea`,{className:L(!0),value:G.brief,onChange:e=>K(t=>({...t,brief:e.target.value}))})}),(0,M.jsx)(I,{label:x.settings.instructions,children:(0,M.jsx)(`textarea`,{className:L(!0),value:G.instructions,onChange:e=>K(t=>({...t,instructions:e.target.value}))})}),(0,M.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2 border-t border-edge pt-4`,children:[(0,M.jsxs)(u,{type:`button`,variant:`ghost`,onClick:()=>It(!0),children:[(0,M.jsx)(c,{className:`size-4`,"aria-hidden":!0}),x.common.delete]}),(0,M.jsxs)(u,{type:`submit`,variant:`primary`,disabled:Nt||!G.name.trim(),children:[(0,M.jsx)(S,{className:`size-4`,"aria-hidden":!0}),x.common.save]})]})]}):null]}),(0,M.jsx)(fe,{open:Ft,onOpenChange:e=>{Rt||It(e)},children:(0,M.jsxs)(xe,{children:[(0,M.jsx)(ke,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,M.jsxs)(Ne,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.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,M.jsx)(E,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(Oe,{className:`text-base font-semibold text-fg`,children:x.settings.deleteConfirmTitle}),(0,M.jsx)(Ee,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O?N(x.settings.deleteConfirm,{name:O.name}):x.settings.deleteConfirmFallback})]})]}),(0,M.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,M.jsx)(me,{asChild:!0,children:(0,M.jsx)(u,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Rt,children:x.common.cancel})}),(0,M.jsxs)(u,{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:Rt||!O,onClick:()=>void Dn(),children:[(0,M.jsx)(c,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})}),(0,M.jsx)(fe,{open:!!V,onOpenChange:e=>{e||Lt(null)},children:(0,M.jsxs)(xe,{children:[(0,M.jsx)(ke,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,M.jsxs)(Ne,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,M.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,M.jsx)(Oe,{className:`text-base font-semibold text-fg`,children:x.settings.workspaceMissingTitle}),(0,M.jsx)(Ee,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?N(x.settings.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,M.jsx)(`div`,{className:`px-5 py-4`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,M.jsx)(D,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,M.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,M.jsx)(u,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>Lt(null),disabled:Nt,children:x.settings.workspaceMissingBack}),(0,M.jsxs)(u,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Tn({createWorkspaceRoot:!0}),disabled:Nt,children:[(0,M.jsx)(se,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMissingCreate]})]})]})]})}),(0,M.jsx)(We,{open:$t,t:b.goalsPage,chat:b.chat,busy:Yt,options:nn,onClose:()=>!Yt&&en(!1),onCreate:vn}),(0,M.jsx)(Ge,{open:!!H,definition:H,language:ee,starting:Wt,onClose:()=>!Wt&&Jt(null),onStart:e=>void bn(e)})]})}export{ct 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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-avfvyZuQ.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{Ba as s,Ec as c,Ic as l,Ms as u,Nc as d,Po as f,Ps as p,Si as m,So as h,aa as g,ea as _,ia as v,na as y,oa as b,pi as x,ra as S,sa as C,ta as w}from"./index-T0SaNd5a.js";import{t as T}from"./directory-picker-path-field-7jKfbH0J.js";var E=n(),D=e(t(),1),O=r(),ee=[`all`,`active`,`paused`,`archived`];function k(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function te(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function ne(e){let t=e?.body;return t?.code===`workspace_already_bound`&&t.project?t.project:null}function re(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function j(e,t){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function M(e){let t=(0,E.c)(37),{project:n,t:r}=e,a=r.statuses[n.status],o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===n.name?s=t[1]:(s=(0,O.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=s);let c;t[2]===n.slug?c=t[3]:(c=(0,O.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.slug}),t[2]=n.slug,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,O.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===n.status?u=t[8]:(u=i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,k(n.status)),t[7]=n.status,t[8]=u);let f;t[9]!==a||t[10]!==u?(f=(0,O.jsx)(`span`,{className:u,children:a}),t[9]=a,t[10]=u,t[11]=f):f=t[11];let p;t[12]!==l||t[13]!==f?(p=(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[l,f]}),t[12]=l,t[13]=f,t[14]=p):p=t[14];let m=n.description||n.brief||r.noDescription,h;t[15]===m?h=t[16]:(h=(0,O.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:m}),t[15]=m,t[16]=h);let g=n.workspaceRoot||r.agentDefault,_;t[17]!==r.workspaceLabel||t[18]!==g?(_=A(r.workspaceLabel,{workspace:g}),t[17]=r.workspaceLabel,t[18]=g,t[19]=_):_=t[19];let v;t[20]===_?v=t[21]:(v=(0,O.jsx)(`div`,{className:`truncate`,children:_}),t[20]=_,t[21]=v);let y;t[22]!==n.lastActiveAt||t[23]!==n.updatedAt||t[24]!==r.lastActive||t[25]!==r.never?(y=A(r.lastActive,{time:j(n.lastActiveAt??n.updatedAt,r.never)}),t[22]=n.lastActiveAt,t[23]=n.updatedAt,t[24]=r.lastActive,t[25]=r.never,t[26]=y):y=t[26];let b;t[27]===y?b=t[28]:(b=(0,O.jsx)(`div`,{children:y}),t[27]=y,t[28]=b);let x;t[29]!==v||t[30]!==b?(x=(0,O.jsxs)(`div`,{className:`mt-auto grid gap-1 pt-4 text-xs text-fg-subtle`,children:[v,b]}),t[29]=v,t[30]=b,t[31]=x):x=t[31];let S;return t[32]!==o||t[33]!==x||t[34]!==p||t[35]!==h?(S=(0,O.jsxs)(d,{to:o,className:`group flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4 transition-colors hover:border-accent/50 hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[p,h,x]}),t[32]=o,t[33]=x,t[34]=p,t[35]=h,t[36]=S):S=t[36],S}function N(){let e=l(),t=a(o(e=>e.language)),n=t.chat.workingDirectory,r=t.projectsPage,d=C(e=>e.setPageHeader),E=C(e=>e.clearPageHeader),[k,j]=(0,D.useState)([]),[N,ie]=(0,D.useState)(`all`),[P,ae]=(0,D.useState)(``),[F,I]=(0,D.useState)(!0),[L,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(``),[V,H]=(0,D.useState)(``),[oe,U]=(0,D.useState)(!1),[W,G]=(0,D.useState)(!1),[K,q]=(0,D.useState)(null),[J,Y]=(0,D.useState)(null);(0,D.useEffect)(()=>{let e=!1;return I(!0),R(null),m({...N===`all`?{}:{status:N},...P.trim()?{search:P}:{},limit:100}).then(t=>{e||j(t.items)}).catch(t=>{e||R(t instanceof Error?t.message:String(t))}).finally(()=>{e||I(!1)}),()=>{e=!0}},[P,N]);let X=(0,D.useMemo)(()=>({active:k.filter(e=>e.status===`active`),paused:k.filter(e=>e.status===`paused`),archived:k.filter(e=>e.status===`archived`)}),[k]),Z=(0,D.useCallback)(async(e={})=>{let t=z.trim(),n=V.trim();if(!(!t&&!n)){G(!0),R(null),Y(null);try{let r=await x({...t?{name:t}:{},...n?{workspaceRoot:n}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});j(e=>[r,...e]),B(``),H(``),U(!1)}catch(e){let t=ne(e);if(t)j(e=>[t,...e.filter(e=>e.id!==t.id)]),q(t),U(!1);else{let t=re(e);t?(Y(t),U(!1)):R(e instanceof Error?e.message:String(e))}}finally{G(!1)}}},[z,V]),se=(0,D.useCallback)(e=>{e.preventDefault(),Z()},[Z]),ce=(0,D.useCallback)(()=>{if(!K)return;let t=K.id;q(null),e(`/projects/${encodeURIComponent(t)}`)},[e,K]),le=(0,D.useCallback)(()=>{q(null),U(!0)},[]),ue=(0,D.useCallback)(()=>{Z({createWorkspaceRoot:!0})},[Z]),Q=(0,D.useCallback)(()=>{Y(null),U(!0)},[]),$=(0,D.useMemo)(()=>(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,O.jsx)(h,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`input`,{className:`h-9 w-40 rounded-lg border border-edge bg-surface-muted pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent sm:w-56 lg:w-72`,value:P,onChange:e=>ae(e.target.value),placeholder:r.searchPlaceholder,"aria-label":r.searchPlaceholder})]}),(0,O.jsxs)(s,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(e=>!e),children:[(0,O.jsx)(f,{className:`size-4`,"aria-hidden":!0}),r.create]})]}),[P,r.create,r.searchPlaceholder]);(0,D.useLayoutEffect)(()=>(d({startExtra:null,main:(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:A(r.summary,{count:k.length})})]}),end:$}),()=>E()),[E,$,k.length,d,r.summary,r.title]);let de=N===`all`?[[r.statuses.active,X.active],[r.statuses.paused,X.paused],[r.statuses.archived,X.archived]]:[[r.statuses[N],k]];return(0,O.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,O.jsx)(g,{open:oe,onOpenChange:U,children:(0,O.jsxs)(v,{children:[(0,O.jsx)(S,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(w,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,O.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,O.jsx)(b,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,O.jsx)(y,{className:`mt-1 text-sm text-fg-muted`,children:r.createDescription})]}),(0,O.jsxs)(`form`,{onSubmit:se,className:`flex min-h-0 flex-1 flex-col`,children:[(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,O.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.projectName}),(0,O.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:z,onChange:e=>B(e.target.value),placeholder:V.trim()&&te(V)||`xopc`,autoFocus:!0})]}),(0,O.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.workspaceRoot}),(0,O.jsx)(T,{value:V,onChange:H,disabled:W,wd:n,placeholder:r.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,O.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.workspaceHint})]})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,O.jsx)(_,{asChild:!0,children:(0,O.jsx)(s,{type:`button`,variant:`ghost`,className:`rounded-lg`,children:r.cancel})}),(0,O.jsxs)(s,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:W||!(z.trim()||V.trim()),children:[(0,O.jsx)(f,{className:`size-4`,"aria-hidden":!0}),r.create]})]})]})]})]})}),(0,O.jsx)(g,{open:!!K,onOpenChange:e=>{e||q(null)},children:(0,O.jsxs)(v,{children:[(0,O.jsx)(S,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(w,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,O.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,O.jsx)(b,{className:`text-base font-semibold text-fg`,children:r.workspaceConflictTitle}),(0,O.jsx)(y,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:K?A(r.workspaceConflictDescription,{projectName:K.name}):null})]}),K?(0,O.jsx)(`div`,{className:`space-y-3 px-5 py-4`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,O.jsx)(p,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`span`,{className:`min-w-0 truncate`,children:A(r.workspaceConflictPath,{workspace:K.workspaceRoot||r.agentDefault})})]})}):null,(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,O.jsx)(s,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:le,children:r.workspaceConflictBack}),(0,O.jsxs)(s,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ce,children:[(0,O.jsx)(c,{className:`size-4`,"aria-hidden":!0}),r.workspaceConflictOpen]})]})]})]})}),(0,O.jsx)(g,{open:!!J,onOpenChange:e=>{e||Y(null)},children:(0,O.jsxs)(v,{children:[(0,O.jsx)(S,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(w,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,O.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,O.jsx)(b,{className:`text-base font-semibold text-fg`,children:r.workspaceMissingTitle}),(0,O.jsx)(y,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:J?A(r.workspaceMissingDescription,{workspace:J}):null})]}),J?(0,O.jsx)(`div`,{className:`px-5 py-4`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,O.jsx)(p,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,O.jsx)(`span`,{className:`min-w-0 truncate`,children:J})]})}):null,(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,O.jsx)(s,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Q,disabled:W,children:r.workspaceMissingBack}),(0,O.jsxs)(s,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ue,disabled:W,children:[(0,O.jsx)(u,{className:`size-4`,"aria-hidden":!0}),r.workspaceMissingCreate]})]})]})]})}),(0,O.jsxs)(`section`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-lg border border-edge bg-surface-panel p-1`,children:ee.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>ie(e),className:i(`rounded-md px-3 py-1.5 text-sm font-medium transition-colors`,N===e?`bg-accent text-white`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e===`all`?r.all:r.statuses[e]},e))}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,O.jsx)(p,{className:`size-4`,"aria-hidden":!0}),r.optionalContext]})]}),L?(0,O.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:L}):null,F?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.loading}):null,!F&&k.length===0?(0,O.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel p-8 text-center`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.emptyTitle}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.emptyHint})]}):null,de.map(([e,t])=>t.length?(0,O.jsxs)(`section`,{className:`space-y-3`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wide text-fg-subtle`,children:e}),(0,O.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:t.map(e=>(0,O.jsx)(M,{project:e,t:r},e.id))})]},e):null)]})}export{N as ProjectsPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-avfvyZuQ.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{a as s,c,i as l,n as u,o as d,t as f}from"./fetch-Dtpbbe0s.js";import{a as p,i as m}from"./vendor-swr-BIWyz7Rc.js";import{$i as h,Aa as g,Ba as _,Bs as v,Dr as y,Ds as b,H as x,Ko as S,Ks as C,Mi as w,Nc as T,No as E,Oo as D,Qa as O,Rc as k,Yt as A,aa as j,ar as M,ba as N,bo as P,cr as F,dr as I,f as L,fc as R,fr as z,hc as B,ho as V,hs as H,ia as U,ir as W,ji as G,ka as ee,lr as K,mr as te,na as q,nc as J,no as Y,nr as ne,ns as re,oa as ie,or as ae,pa as oe,po as X,pr as se,ra as ce,rr as le,sr as ue,ta as de,ur as fe,ut as pe,ya as me,za as he}from"./index-T0SaNd5a.js";import{t as ge}from"./settings-collapsible-section-DIpIYht_.js";import{n as _e,r as ve,t as ye}from"./settings-form-section-BFxBNxOG.js";import{t as be}from"./browser-BLJWD7WI.js";import{n as xe,r as Se,t as Ce}from"./settings-page-layout-CLx4o2PN.js";var Z=n(),Q=e(t(),1);function we(e,t){let{mutate:n}=p(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useCallback)(async()=>{await Promise.all([n(`tunnel-pair-context`),n(`tunnel-pair`),n(`tunnel-status`),G()])},[n]);return{busy:r,error:a,confirmOpen:s,setConfirmOpen:c,runEnableLanPairing:(0,Q.useCallback)(async()=>{if(!(!e||r)){i(!0),o(null);try{let n=await ae();if(!n.ok)throw Error(`Failed to enable LAN pairing`);if(n.requiresRestart){let t=await ne();if(!t.ok)throw Error(t.message??`Gateway restart failed`);if(!await le(e))throw Error(`Gateway did not come back online in time`)}let r=n.requiresRestart?await W():n.context;if(!r?.pairingReady)throw Error(`LAN pairing is still not ready after restart`);return await l(),t?.(r),c(!1),r}catch(e){return o(e instanceof Error?e.message:`Enable LAN pairing failed`),null}finally{i(!1)}}},[r,e,t,l]),clearError:()=>o(null)}}var $=r();function Te(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,he,`dark:border-edge`)}function Ee(e){let t=(0,Z.c)(122),{pairQr:n,gatewayToken:r,streamlined:s,lanOnly:c,onRefreshQr:l}=e,u=s===void 0?!1:s,d=c===void 0?!1:c,f=o(ke),p;t[0]===f?p=t[1]:(p=a(f),t[0]=f,t[1]=p);let m=p,h=m.tunnelSettings,g=d?m.remoteAccess.lan:null,v;t[2]!==m.clipboard.copyFailed||t[3]!==h.pairCopied||t[4]!==h.pairCopyLink?(v={copy:h.pairCopyLink,copied:h.pairCopied,copyFailed:m.clipboard.copyFailed},t[2]=m.clipboard.copyFailed,t[3]=h.pairCopied,t[4]=h.pairCopyLink,t[5]=v):v=t[5];let b=v,{tunnelActive:x,tunnelStatus:S,tunnelQr:C,pairContext:w,pairBaseUrl:E,setPairBaseUrl:O,applySuggestedPairUrl:k,applyCandidateUrl:A,resetPairBaseFromContext:j,baseOk:M,localhostWarn:N,pairingBlocked:P,deepLink:F,qrPayload:I,qrDataUrl:R,qrGenFailed:z,encoding:B}=n,V;t[6]===j?V=t[7]:(V=e=>{j(e.recommended.url)},t[6]=j,t[7]=V);let H=we(r,V),U,W,G,ee,K;if(t[8]!==A||t[9]!==k||t[10]!==M||t[11]!==H||t[12]!==r||t[13]!==g||t[14]!==d||t[15]!==N||t[16]!==l||t[17]!==E||t[18]!==w?.candidates||t[19]!==w?.recommended||t[20]!==P||t[21]!==O||t[22]!==u||t[23]!==h.pairBaseUrlHint||t[24]!==h.pairBaseUrlLabel||t[25]!==h.pairBaseUrlPlaceholder||t[26]!==h.pairBlockedLoopbackBody||t[27]!==h.pairBlockedNextSteps||t[28]!==h.pairBlockedTitle||t[29]!==h.pairCandidatesTitle||t[30]!==h.pairEnableLanButton||t[31]!==h.pairEnableLanEnabling||t[32]!==h.pairEnableLanSecurityAuditLink||t[33]!==h.pairInvalidBaseUrl||t[34]!==h.pairLocalhostWarning||t[35]!==h.pairSelectCandidateHint||t[36]!==h.pairSelectCandidateTitle||t[37]!==h.pairSubtitle||t[38]!==h.pairSuggestedLanLabel||t[39]!==h.pairTitle||t[40]!==h.pairTunnelActive||t[41]!==h.pairTunnelLanUrl||t[42]!==h.pairTunnelPublicUrl||t[43]!==h.pairUseSuggestedUrl||t[44]!==h.pairWaitingForTunnel||t[45]!==h.refreshQr||t[46]!==x||t[47]!==C||t[48]!==S?.publicUrl){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=w?.candidates.filter(Oe)??[],n=d?(e.find(De)?.url??e[0]?.url??``).trim():w?.recommended.url?.trim()??``,a=(d||!x)&&e.length>1,o=function(t){if(e.length===0)return null;let n=t===`amber`?`text-amber-950 dark:text-amber-100`:`text-fg`,r=t===`amber`?`text-amber-950/80 dark:text-amber-200/90`:`text-fg-muted`;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:i(`text-xs font-medium`,r),children:a?h.pairSelectCandidateTitle:h.pairCandidatesTitle}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:i(`w-full rounded-md border px-2 py-1.5 text-left font-mono text-[11px] transition-colors`,t===`amber`?`border-amber-300/70 hover:bg-amber-100/80 dark:border-amber-800 dark:hover:bg-amber-950/50`:`border-edge hover:bg-surface-panel`,E.trim()===e.url&&`border-accent bg-accent/5`,n),onClick:()=>A(e.url),children:[e.label?`${e.label}: `:``,e.url]})},e.url))}),a?(0,$.jsx)(`p`,{className:i(`mt-1 text-[11px] leading-relaxed`,r),children:h.pairSelectCandidateHint}):null]})};if(U=u&&!d,U&&!x){let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(X,{className:`size-4 text-accent`,strokeWidth:1.75}),t[54]=e):e=t[54];let n;t[55]===h.pairTitle?n=t[56]:(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[e,h.pairTitle]}),t[55]=h.pairTitle,t[56]=n);let r;t[57]===h.pairWaitingForTunnel?r=t[58]:(r=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h.pairWaitingForTunnel}),t[57]=h.pairWaitingForTunnel,t[58]=r);let i;t[59]!==n||t[60]!==r?(i=(0,$.jsxs)(ye,{children:[n,r]}),t[59]=n,t[60]=r,t[61]=i):i=t[61],K=i;break bb0}let s=g?.pairTitle??h.pairTitle,c=d?g?.pairSubtitle??h.pairSubtitle:x?h.pairTunnelActive:h.pairSubtitle,f=!!(l&&(d||u&&x)),p=U?`mb-2`:`mb-3`,m;t[62]===p?m=t[63]:(m=i(`flex flex-wrap items-start justify-between gap-2`,p),t[62]=p,t[63]=m);let v;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(X,{className:`size-4 text-accent`,strokeWidth:1.75}),t[64]=v):v=t[64];let y;t[65]===s?y=t[66]:(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[v,s]}),t[65]=s,t[66]=y);let b;t[67]!==U||t[68]!==c||t[69]!==h.pairSubtitle?(b=U?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:h.pairSubtitle}):(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c}),t[67]=U,t[68]=c,t[69]=h.pairSubtitle,t[70]=b):b=t[70];let j;t[71]!==y||t[72]!==b?(j=(0,$.jsxs)(`div`,{children:[y,b]}),t[71]=y,t[72]=b,t[73]=j):j=t[73];let F;t[74]!==l||t[75]!==f||t[76]!==h.refreshQr?(F=f?(0,$.jsxs)(_,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void l(),children:[(0,$.jsx)(D,{className:`size-4`}),h.refreshQr]}):null,t[74]=l,t[75]=f,t[76]=h.refreshQr,t[77]=F):F=t[77],t[78]!==m||t[79]!==j||t[80]!==F?(W=(0,$.jsxs)(`div`,{className:m,children:[j,F]}),t[78]=m,t[79]=j,t[80]=F,t[81]=W):W=t[81],G=P?(0,$.jsxs)(`div`,{className:`mb-3 space-y-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-3 dark:border-amber-900/50 dark:bg-amber-950/30`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-amber-950 dark:text-amber-100`,children:h.pairBlockedTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:h.pairBlockedLoopbackBody})]}),n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-amber-950/80 dark:text-amber-200/90`,children:h.pairSuggestedLanLabel}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-amber-950 dark:text-amber-100`,children:n})]}),(0,$.jsx)(_,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:k,children:h.pairUseSuggestedUrl})]}):null,e.length>0?o(`amber`):null,(0,$.jsx)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:(0,$.jsxs)(_,{type:`button`,className:`w-full sm:w-auto`,disabled:H.busy||!r,onClick:()=>H.setConfirmOpen(!0),children:[H.busy?(0,$.jsx)(re,{className:`size-3.5 animate-spin`}):null,H.busy?h.pairEnableLanEnabling:h.pairEnableLanButton]})}),H.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:H.error}):null,(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:d?g?.pairBlockedNextSteps??h.pairBlockedNextSteps:h.pairBlockedNextSteps}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(T,{to:`/settings/gateway`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:h.pairEnableLanSecurityAuditLink}),d&&g?.pairPublicTabLink?(0,$.jsx)(T,{to:`/settings/remote-access?tab=public`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:g.pairPublicTabLink}):null]})]}):null,ee=x&&!d?U?null:(0,$.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg border border-edge bg-surface-panel px-3 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.pairTunnelPublicUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:S?.publicUrl})]}),C?.lanUrl?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.pairTunnelLanUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:C.lanUrl})]}):null]}):(0,$.jsxs)(`div`,{className:`mb-3 space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`tunnel-mobile-pair-base`,children:h.pairBaseUrlLabel}),(0,$.jsx)(`input`,{id:`tunnel-mobile-pair-base`,className:i(Te(),`font-mono text-xs`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:n||h.pairBaseUrlPlaceholder,value:E,onChange:e=>O(e.target.value)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:h.pairBaseUrlHint}),!M&&E.trim()?(0,$.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:h.pairInvalidBaseUrl}):null,N?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:h.pairLocalhostWarning}):null,a?o(`neutral`):null]})}t[8]=A,t[9]=k,t[10]=M,t[11]=H,t[12]=r,t[13]=g,t[14]=d,t[15]=N,t[16]=l,t[17]=E,t[18]=w?.candidates,t[19]=w?.recommended,t[20]=P,t[21]=O,t[22]=u,t[23]=h.pairBaseUrlHint,t[24]=h.pairBaseUrlLabel,t[25]=h.pairBaseUrlPlaceholder,t[26]=h.pairBlockedLoopbackBody,t[27]=h.pairBlockedNextSteps,t[28]=h.pairBlockedTitle,t[29]=h.pairCandidatesTitle,t[30]=h.pairEnableLanButton,t[31]=h.pairEnableLanEnabling,t[32]=h.pairEnableLanSecurityAuditLink,t[33]=h.pairInvalidBaseUrl,t[34]=h.pairLocalhostWarning,t[35]=h.pairSelectCandidateHint,t[36]=h.pairSelectCandidateTitle,t[37]=h.pairSubtitle,t[38]=h.pairSuggestedLanLabel,t[39]=h.pairTitle,t[40]=h.pairTunnelActive,t[41]=h.pairTunnelLanUrl,t[42]=h.pairTunnelPublicUrl,t[43]=h.pairUseSuggestedUrl,t[44]=h.pairWaitingForTunnel,t[45]=h.refreshQr,t[46]=x,t[47]=C,t[48]=S?.publicUrl,t[49]=U,t[50]=W,t[51]=G,t[52]=ee,t[53]=K}else U=t[49],W=t[50],G=t[51],ee=t[52],K=t[53];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let te;t[82]===h.pairSecurityNote?te=t[83]:(te=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:h.pairSecurityNote}),t[82]=h.pairSecurityNote,t[83]=te);let q;t[84]!==b||t[85]!==F||t[86]!==B||t[87]!==P||t[88]!==R||t[89]!==z||t[90]!==h.pairEncoding||t[91]!==h.pairImageError||t[92]!==h.pairQrDisabled?(q=F?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[R&&!z?(0,$.jsx)(`img`,{src:R,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,B?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.pairEncoding}):null,z?(0,$.jsx)(`p`,{className:`text-center text-sm text-fg-muted sm:text-left`,children:h.pairImageError}):null,(0,$.jsx)(y,{text:F,labels:b})]}):P?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.pairQrDisabled}):null,t[84]=b,t[85]=F,t[86]=B,t[87]=P,t[88]=R,t[89]=z,t[90]=h.pairEncoding,t[91]=h.pairImageError,t[92]=h.pairQrDisabled,t[93]=q):q=t[93];let J;t[94]!==U||t[95]!==I||t[96]!==h.deeplinkTitle?(J=I&&!U?(0,$.jsxs)(`details`,{className:`mt-3 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:h.deeplinkTitle}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:I})]}):null,t[94]=U,t[95]=I,t[96]=h.deeplinkTitle,t[97]=J):J=t[97];let Y;t[98]!==U||t[99]!==h.pairMobileProbeHint||t[100]!==h.pairSchemeHint?(Y=U?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-3 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:h.pairSchemeHint}),(0,$.jsx)(`p`,{className:`mt-1 text-[10px] leading-relaxed text-fg-subtle`,children:h.pairMobileProbeHint})]}),t[98]=U,t[99]=h.pairMobileProbeHint,t[100]=h.pairSchemeHint,t[101]=Y):Y=t[101];let ne,ie;t[102]===H?(ne=t[103],ie=t[104]):(ne=()=>void H.runEnableLanPairing(),ie=()=>{H.busy||H.setConfirmOpen(!1)},t[102]=H,t[103]=ne,t[104]=ie);let ae;t[105]!==H.confirmOpen||t[106]!==h.consentCancel||t[107]!==h.pairEnableLanButton||t[108]!==h.pairEnableLanConfirmBody||t[109]!==h.pairEnableLanConfirmTitle||t[110]!==ne||t[111]!==ie?(ae=(0,$.jsx)(L,{open:H.confirmOpen,title:h.pairEnableLanConfirmTitle,description:h.pairEnableLanConfirmBody,confirmLabel:h.pairEnableLanButton,cancelLabel:h.consentCancel,onConfirm:ne,onCancel:ie}),t[105]=H.confirmOpen,t[106]=h.consentCancel,t[107]=h.pairEnableLanButton,t[108]=h.pairEnableLanConfirmBody,t[109]=h.pairEnableLanConfirmTitle,t[110]=ne,t[111]=ie,t[112]=ae):ae=t[112];let oe;return t[113]!==te||t[114]!==q||t[115]!==J||t[116]!==Y||t[117]!==ae||t[118]!==W||t[119]!==G||t[120]!==ee?(oe=(0,$.jsx)(ye,{children:(0,$.jsxs)($.Fragment,{children:[W,G,ee,te,q,J,Y,ae]})}),t[113]=te,t[114]=q,t[115]=J,t[116]=Y,t[117]=ae,t[118]=W,t[119]=G,t[120]=ee,t[121]=oe):oe=t[121],oe}function De(e){return e.reachable}function Oe(e){return e.kind===`lan`}function ke(e){return e.language}function Ae(e){let t=(0,Z.c)(40),{open:n,title:r,intro:a,bullets:o,checkboxLabel:s,confirmLabel:c,cancelLabel:l,onConfirm:u,onCancel:d}=e,[f,p]=(0,Q.useState)(!1),m;t[0]===d?m=t[1]:(m=e=>{e||(p(!1),d())},t[0]=d,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(ce,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,N)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=i(`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-panel p-6 shadow-popover outline-none dark:border-edge`,me),t[3]=g):g=t[3];let v;t[4]===r?v=t[5]:(v=(0,$.jsx)(ie,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=v);let y;t[6]===a?y=t[7]:(y=(0,$.jsx)(q,{className:`mt-2 text-sm text-fg-muted`,children:a}),t[6]=a,t[7]=y);let b;t[8]===o?b=t[9]:(b=o.map(je),t[8]=o,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:b}),t[10]=b,t[11]=x);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>p(e.target.checked),t[12]=S):S=t[12];let C;t[13]===f?C=t[14]:(C=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:f,onChange:S}),t[13]=f,t[14]=C);let w;t[15]===s?w=t[16]:(w=(0,$.jsx)(`span`,{children:s}),t[15]=s,t[16]=w);let T;t[17]!==w||t[18]!==C?(T=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[C,w]}),t[17]=w,t[18]=C,t[19]=T):T=t[19];let E;t[20]!==l||t[21]!==d?(E=(0,$.jsx)(_,{type:`button`,variant:`secondary`,onClick:d,children:l}),t[20]=l,t[21]=d,t[22]=E):E=t[22];let D=!f,O;t[23]!==c||t[24]!==u||t[25]!==D?(O=(0,$.jsx)(_,{type:`button`,disabled:D,onClick:u,children:c}),t[23]=c,t[24]=u,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==E||t[28]!==O?(k=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[E,O]}),t[27]=E,t[28]=O,t[29]=k):k=t[29];let A;t[30]!==T||t[31]!==k||t[32]!==v||t[33]!==y||t[34]!==x?(A=(0,$.jsxs)(U,{children:[h,(0,$.jsxs)(de,{className:g,onOpenAutoFocus:Me,children:[v,y,x,T,k]})]}),t[30]=T,t[31]=k,t[32]=v,t[33]=y,t[34]=x,t[35]=A):A=t[35];let M;return t[36]!==n||t[37]!==m||t[38]!==A?(M=(0,$.jsx)(j,{open:n,onOpenChange:m,children:A}),t[36]=n,t[37]=m,t[38]=A,t[39]=M):M=t[39],M}function je(e){return(0,$.jsx)(`li`,{children:e},e)}function Me(e){return e.preventDefault()}function Ne(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Pe=[`preparing_frpc`,`registering`,`starting_frpc`];function Fe(e){return e?e===`reconnecting_frpc`?Pe.indexOf(`starting_frpc`):Pe.indexOf(e):-1}function Ie(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Pe.indexOf(e),i=Fe(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Le(e,t,n){let r=n.startProgress;return Ie(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 Re(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function ze(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 Be(e){let t=(0,Z.c)(31),{status:n,t:r}=e,[,a]=(0,Q.useState)(0),o;t[0]!==a||t[1]!==n.state?(o=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>a(Ve),1e3);return()=>window.clearInterval(e)},t[0]=a,t[1]=n.state,t[2]=o):o=t[2];let s=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==s?(c=[n.state,s],t[3]=n.state,t[4]=s,t[5]=c):c=t[5],(0,Q.useEffect)(o,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,d,f,p;if(t[6]!==n||t[7]!==r){let e=ze(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-3`;let a;t[13]===r.startProgressTitle?a=t[14]:(a=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=a);let o;t[15]===r.startProgressHint?o=t[16]:(o=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=o),t[17]!==a||t[18]!==o?(d=(0,$.jsxs)(`div`,{children:[a,o]}),t[17]=a,t[18]=o,t[19]=d):d=t[19];let s=Pe.map(e=>{let t=Ie(e,n),a=Le(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)(B,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(re,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(J,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:i(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Re(r,e)}),a?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:a}):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:i(`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:[Ne(n.frpcDownload.bytesReceived),` /`,` `,Ne(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]===s?f=t[21]:(f=(0,$.jsx)(`ol`,{className:`space-y-2`,children:s}),t[20]=s,t[21]=f),p=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]=d,t[11]=f,t[12]=p}else l=t[8],u=t[9],d=t[10],f=t[11],p=t[12];let m;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(m=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m?(h=(0,$.jsxs)(`div`,{className:u,children:[d,f,p,m]}),t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h):h=t[30],h}function Ve(e){return e+1}function He(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 Ue(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function We(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 Ge(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 Ke(e){let t=(0,Z.c)(61),{t:n,status:r,isLoading:a,statusErr:o,starting:s,stopping:c,showConsentExpired:l,copyLabels:u,startDisabled:d,startDisabledReason:f,stepLabel:p,onStart:m,onStop:h}=e,g=d===void 0?!1:d,v,x,S,C,w,T,D;t[0]!==r||t[1]!==s?(D=Ue(r),v=r.enabled||s,x=s||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=i(ve(),`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=i(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,We(D)),t[0]=r,t[1]=s,t[2]=v,t[3]=x,t[4]=S,t[5]=C,t[6]=w,t[7]=T,t[8]=D):(v=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],D=t[8]);let k=D===`connected`&&`bg-emerald-500`,A=D===`progress`&&`bg-amber-500 animate-pulse`,j=D===`error`&&`bg-red-500`,M=D===`off`&&`bg-fg-subtle`,N;t[10]!==k||t[11]!==A||t[12]!==j||t[13]!==M?(N=i(`size-1.5 rounded-full`,k,A,j,M),t[10]=k,t[11]=A,t[12]=j,t[13]=M,t[14]=N):N=t[14];let P;t[15]===N?P=t[16]:(P=(0,$.jsx)(`span`,{className:N,"aria-hidden":!0}),t[15]=N,t[16]=P);let F;t[17]!==a||t[18]!==r||t[19]!==n?(F=a&&!r.enabled?n.loading:He(n,r),t[17]=a,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,` `,Ge(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)(b,{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]===o?V=t[38]:(V=o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o instanceof Error?o.message:String(o)}):null,t[37]=o,t[38]=V);let H;t[39]!==l||t[40]!==n.consentExpiredBanner?(H=l?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=l,t[40]=n.consentExpiredBanner,t[41]=H):H=t[41];let U;t[42]!==v||t[43]!==u||t[44]!==m||t[45]!==h||t[46]!==x||t[47]!==r||t[48]!==g||t[49]!==f||t[50]!==s||t[51]!==p||t[52]!==c||t[53]!==n?(U=v?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-3 py-3`,children:(0,$.jsx)(y,{label:n.publicUrlLabel,text:r.publicUrl,labels:u})}):null,x?(0,$.jsx)(Be,{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)(_,{type:`button`,variant:`secondary`,disabled:c,onClick:h,children:[c?(0,$.jsx)(re,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(_,{type:`button`,disabled:s,onClick:m,children:[s?(0,$.jsx)(re,{className:`size-4 animate-spin`}):(0,$.jsx)(E,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[p?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:p}):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 border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(O,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),g&&f?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:f}):null,(0,$.jsxs)(_,{type:`button`,disabled:s||g,onClick:m,className:`w-full sm:w-auto`,children:[s?(0,$.jsx)(re,{className:`size-4 animate-spin`}):(0,$.jsx)(E,{className:`size-4`}),n.start]})]}),t[42]=v,t[43]=u,t[44]=m,t[45]=h,t[46]=x,t[47]=r,t[48]=g,t[49]=f,t[50]=s,t[51]=p,t[52]=c,t[53]=n,t[54]=U):U=t[54];let W;return t[55]!==B||t[56]!==V||t[57]!==H||t[58]!==U||t[59]!==T?(W=(0,$.jsxs)(`section`,{className:T,children:[B,V,H,U]}),t[55]=B,t[56]=V,t[57]=H,t[58]=U,t[59]=T,t[60]=W):W=t[60],W}var qe=`https://console.xopc.ai/keys/tunnel`,Je={reconfiguring:!1};function Ye(e){let t=(0,Z.c)(84),{t:n,brokerSecretFromEnv:r,brokerSecretMissing:a,brokerSecretConfiguredInConfig:o,brokerSecretMaskedValue:s,brokerSecretDraft:c,savingBrokerSecret:l,brokerSecretNotice:u,copyFailedLabel:d,onDraftChange:f,onSave:p,onClear:m,sectionRef:h}=e,g=(0,Q.useId)(),y=a&&!r,b=!y,[x,S]=(0,Q.useReducer)(pe,Je),{reconfiguring:C}=x,w;t[0]!==o||t[1]!==c||t[2]!==r||t[3]!==C?(w=o&&!r&&!C&&!c.trim(),t[0]=o,t[1]=c,t[2]=r,t[3]=C,t[4]=w):w=t[4];let T=w,E;t[5]!==n.copied||t[6]!==n.copyKey||t[7]!==n.hideKey||t[8]!==n.showKey?(E={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[5]=n.copied,t[6]=n.copyKey,t[7]=n.hideKey,t[8]=n.showKey,t[9]=E):E=t[9];let D=E,O;t[10]===c?O=t[11]:(O=c.trim().length>0&&!A(c.trim()),t[10]=c,t[11]=O);let k=O,j;t[12]===f?j=t[13]:(j=()=>{S({type:`patch`,patch:{reconfiguring:!1}}),f(``)},t[12]=f,t[13]=j);let M=j,N=y&&`ring-1 ring-amber-500/30`,P;t[14]===N?P=t[15]:(P=i(N),t[14]=N,t[15]=P);let F=b?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:y?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,I;t[16]===F?I=t[17]:(I=i(`flex size-9 shrink-0 items-center justify-center rounded-lg`,F),t[16]=F,t[17]=I);let L;t[18]===b?L=t[19]:(L=b?(0,$.jsx)(B,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(H,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[18]=b,t[19]=L);let R;t[20]!==I||t[21]!==L?(R=(0,$.jsx)(`span`,{className:I,children:L}),t[20]=I,t[21]=L,t[22]=R):R=t[22];let z=b?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,V;t[23]===z?V=t[24]:(V=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:z}),t[23]=z,t[24]=V);let U=b?n.brokerSecretReadyHint:n.brokerSecretHint,W;t[25]===U?W=t[26]:(W=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:U}),t[25]=U,t[26]=W);let G;t[27]!==y||t[28]!==n.brokerSecretMissingHint?(G=y?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[27]=y,t[28]=n.brokerSecretMissingHint,t[29]=G):G=t[29];let K;t[30]!==V||t[31]!==W||t[32]!==G?(K=(0,$.jsxs)(`div`,{children:[V,W,G]}),t[30]=V,t[31]=W,t[32]=G,t[33]=K):K=t[33];let te;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(v,{className:`size-3`,"aria-hidden":!0}),t[34]=te):te=t[34];let q;t[35]===n.brokerSecretConsoleLink?q=t[36]:(q=(0,$.jsxs)(`a`,{href:qe,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,te]}),t[35]=n.brokerSecretConsoleLink,t[36]=q);let J;t[37]!==r||t[38]!==n.brokerSecretEnvHint?(J=r?(0,$.jsx)(`p`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-xs text-fg-muted`,children:n.brokerSecretEnvHint}):null,t[37]=r,t[38]=n.brokerSecretEnvHint,t[39]=J):J=t[39];let Y;t[40]!==o||t[41]!==c||t[42]!==r||t[43]!==s||t[44]!==k||t[45]!==M||t[46]!==d||t[47]!==g||t[48]!==y||t[49]!==m||t[50]!==f||t[51]!==p||t[52]!==C||t[53]!==l||t[54]!==D||t[55]!==T||t[56]!==n.brokerSecretCancelReconfigure||t[57]!==n.brokerSecretClear||t[58]!==n.brokerSecretMaskedHelp||t[59]!==n.brokerSecretNotInConfigFile||t[60]!==n.brokerSecretPlaceholder||t[61]!==n.brokerSecretReconfigure||t[62]!==n.brokerSecretRevealFailed||t[63]!==n.brokerSecretSave||t[64]!==n.brokerSecretSaveAndContinue||t[65]!==n.brokerSecretTitle?(Y=T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:g,children:n.brokerSecretTitle}),(0,$.jsx)(ee,{id:g,value:s,labels:D,reveal:Xe,loadFailedLabel:d||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(_,{type:`button`,variant:`secondary`,disabled:l,onClick:()=>{S({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(_,{type:`button`,variant:`ghost`,disabled:l,onClick:m,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:g,children:n.brokerSecretTitle}),(0,$.jsx)(ee,{id:g,value:c,onChange:f,placeholder:n.brokerSecretPlaceholder,labels:D,disabled:l}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(_,{type:`button`,disabled:l||!k,onClick:p,children:[l?(0,$.jsx)(re,{className:`size-4 animate-spin`}):null,y?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),o||r?(0,$.jsx)(_,{type:`button`,variant:`ghost`,disabled:l,onClick:m,children:n.brokerSecretClear}):null,C?(0,$.jsx)(_,{type:`button`,variant:`ghost`,disabled:l,onClick:M,children:n.brokerSecretCancelReconfigure}):null]})]}),t[40]=o,t[41]=c,t[42]=r,t[43]=s,t[44]=k,t[45]=M,t[46]=d,t[47]=g,t[48]=y,t[49]=m,t[50]=f,t[51]=p,t[52]=C,t[53]=l,t[54]=D,t[55]=T,t[56]=n.brokerSecretCancelReconfigure,t[57]=n.brokerSecretClear,t[58]=n.brokerSecretMaskedHelp,t[59]=n.brokerSecretNotInConfigFile,t[60]=n.brokerSecretPlaceholder,t[61]=n.brokerSecretReconfigure,t[62]=n.brokerSecretRevealFailed,t[63]=n.brokerSecretSave,t[64]=n.brokerSecretSaveAndContinue,t[65]=n.brokerSecretTitle,t[66]=Y):Y=t[66];let ne;t[67]===u?ne=t[68]:(ne=u?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:u}):null,t[67]=u,t[68]=ne);let ie;t[69]!==K||t[70]!==q||t[71]!==J||t[72]!==Y||t[73]!==ne?(ie=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[K,q,J,Y,ne]}),t[69]=K,t[70]=q,t[71]=J,t[72]=Y,t[73]=ne,t[74]=ie):ie=t[74];let ae;t[75]!==R||t[76]!==ie?(ae=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[R,ie]}),t[75]=R,t[76]=ie,t[77]=ae):ae=t[77];let oe;t[78]!==ae||t[79]!==P?(oe=(0,$.jsx)(ye,{className:P,children:ae}),t[78]=ae,t[79]=P,t[80]=oe):oe=t[80];let X;return t[81]!==h||t[82]!==oe?(X=(0,$.jsx)(`div`,{ref:h,id:`tunnel-broker-secret-setup`,children:oe}),t[81]=h,t[82]=oe,t[83]=X):X=t[83],X}function Xe(){return z().then(Ze)}function Ze(e){return e.registrationSecret??null}function Qe(e){let t=(0,Z.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=oe(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=i(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(v,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==s||t[8]!==c?(u=(0,$.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:c,children:[r,l]}),t[6]=r,t[7]=s,t[8]=c,t[9]=u):u=t[9],u}var $e=e(be(),1),et={width:216,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function tt(e){return $e.toDataURL(e,et)}function nt(e){let t=e?.candidates??[],n=t.find(e=>e.kind===`lan`&&e.reachable),r=t.find(e=>e.kind===`lan`);return(n??r)?.url?.trim()??``}function rt(e,t){let n=t.trim();return!n||!e?!1:e.candidates.some(e=>e.kind===`tunnel`&&e.url.trim()===n)}function it(e,t){return e?t?nt(e)||e.recommended.url?.trim()||``:e.recommended.url?.trim()||``:``}function at(e,t){let n=t?.preferLan===!0,r=!!e,{mutate:i}=p(),a=(0,Q.useRef)(!1),{data:o}=m(r?`tunnel-status`:null,K,{refreshInterval:6e4}),{data:c,mutate:l}=m(r?`tunnel-pair-context`:null,ue,{refreshInterval:6e4});(0,Q.useEffect)(()=>{let e=()=>{i(`tunnel-status`),i(`tunnel-qr`),i(`tunnel-pair`),i(`tunnel-pair-context`)};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[i]);let u=o?.state===`connected`&&!!o.publicUrl?.trim(),f=u&&!n,{data:g,mutate:_}=m(f&&r?`tunnel-qr`:null,F,{refreshInterval:4*6e4}),{data:v,mutate:y}=m(!f&&r&&c?.pairingReady?`tunnel-pair`:null,M,{refreshInterval:4*6e4}),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)({pairContext:void 0,preferLan:n});if(!a.current&&(c!==w.pairContext||n!==w.preferLan)){T({pairContext:c,preferLan:n});let e=it(c,n);b!==e&&x(e)}let E=(0,Q.useCallback)(e=>{a.current=!0,x(e)},[]),D=(0,Q.useCallback)(()=>{let e=it(c,n);e&&(a.current=!0,x(e))},[c,n]),O=(0,Q.useCallback)(e=>{let t=e.trim();t&&(a.current=!0,x(t))},[]),k=(0,Q.useCallback)(e=>{a.current=!1,x(e?.trim()||it(c,n))},[c,n]),A=b.trim(),j=(0,Q.useMemo)(()=>{try{let e=new URL(A);return e.protocol===`http:`||e.protocol===`https:`}catch{return!1}},[A]),N=j&&d(A),P=!f&&!!(c&&!c.pairingReady&&c.blockReason===`GATEWAY_LOOPBACK_ONLY`),I=!f&&j&&!N&&!!v?.pairingSecret&&(c?.pairingReady===!0||!P),L=(0,Q.useMemo)(()=>{let e=nt(c);return n?e||(A&&!rt(c,A)?A:``):A},[c,n,A]),R=(0,Q.useMemo)(()=>{if(!e)return``;if(S.trim())return S.trim();if(f&&g?.qrPayload?.trim())return g.qrPayload.trim();if(!I||!v?.pairingSecret)return``;let t=c?.candidates.find(e=>e.kind===`tunnel`&&e.reachable),r=c?.candidates.find(e=>e.kind===`lan`&&e.reachable),i=n?L:t?.url??A;return i?s({baseUrl:i,pairingSecret:v.pairingSecret,lanUrl:n?null:t&&r?r.url:null}):``},[e,L,v?.pairingSecret,I,S,n,A,f,g?.qrPayload,c?.candidates]),z=h(()=>tt(R),[R],{enabled:!!R,initial:null,errorData:null}),B=R?z.data:null,V=!!(R&&z.error!==null&&!z.loading);return{tunnelActive:u,tunnelStatus:o,tunnelQr:g,pairContext:c,pairBaseUrl:b,setPairBaseUrl:E,applySuggestedPairUrl:D,applyCandidateUrl:O,baseOk:j,localhostWarn:N,pairingBlocked:P,deepLink:R,qrPayload:R,qrDataUrl:B,qrGenFailed:V,encoding:!!(R&&!B&&!V),refreshQr:(0,Q.useCallback)(async e=>{if(e?.trim()){C(e.trim()),_({qrPayload:e.trim(),publicUrl:o?.publicUrl??``,lanUrl:g?.lanUrl??null},!1);return}C(``),await l(),f?await _():c?.pairingReady&&await y()},[y,l,_,c?.pairingReady,g?.lanUrl,o?.publicUrl,f]),resetPairBaseFromContext:k}}var ot={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,brokerSecretNotice:null};function st({embedded:e=!1}){let t=o(e=>e.language),n=a(t).tunnelSettings,r=c(e=>e.token),s=!!r,[l,u]=(0,Q.useReducer)(pe,ot),{actionError:d,starting:f,stopping:p,savingAutoStart:h,consentOpen:g,autoStartConfirmOpen:v,releaseConfirmOpen:y,releasing:x,brokerSecretDraft:S,savingBrokerSecret:C,brokerSecretNotice:T}=l,E=(0,Q.useRef)(null),D=at(r??``),{data:O}=w(s),{data:k,error:j,isLoading:M,mutate:N}=m(s?`tunnel-status`:null,K,{refreshInterval:e=>f?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),P=(0,Q.useMemo)(()=>{let e=O?.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 k?.config?.autoStart===!0},[O,k?.config?.autoStart]),F=(0,Q.useMemo)(()=>{let e=O?.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``},[O]),R=A(F),z=k?.registrationSecret?.source===`env`,B=k?.registrationSecret?.source===`missing`,V=k?.registrationSecret?.configured===!0;(0,Q.useEffect)(()=>{let e=()=>{N()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[N]);let H=(0,Q.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),U=(0,Q.useCallback)(async()=>{u({type:`patch`,patch:{actionError:null}}),u({type:`patch`,patch:{starting:!0}});try{let e=await se();await N(),G(),await D.refreshQr(e.qrPayload)}catch(e){u({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{starting:!1}})}},[N,D.refreshQr]),W=(0,Q.useCallback)(()=>{if(!V){u({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),E.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(k?.consentRequired){u({type:`patch`,patch:{consentOpen:!0}});return}U()},[V,k?.consentRequired,U,n.brokerSecretRequiredBeforeStart]),ee=(0,Q.useCallback)(async()=>{u({type:`patch`,patch:{consentOpen:!1}}),u({type:`patch`,patch:{actionError:null}});try{await I(),await Promise.all([N(),U()])}catch(e){u({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[N,U]),q=(0,Q.useCallback)(async()=>{u({type:`patch`,patch:{actionError:null}}),u({type:`patch`,patch:{stopping:!0}});try{await te(),await Promise.all([D.refreshQr(),N()]),G()}catch(e){u({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{stopping:!1}})}},[N,D.refreshQr]),J=(0,Q.useCallback)(async e=>{u({type:`patch`,patch:{savingAutoStart:!0}}),u({type:`patch`,patch:{actionError:null}});try{await fe({autoStart:e}),G()}catch(e){u({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{savingAutoStart:!1}})}},[]),Y=(0,Q.useCallback)(()=>{if(P){J(!1);return}if(k?.consentRequired){u({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!k?.canAutoStart){u({type:`patch`,patch:{actionError:n.autoStartHint}});return}u({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[J,k?.canAutoStart,k?.consentRequired,n,P]),ne=(0,Q.useCallback)(async()=>{let e=S.trim();if(e){u({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await fe({registrationSecret:e}),u({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),G(),await N(),u({type:`patch`,patch:{actionError:null}})}catch(e){u({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[S,N,n.brokerSecretSaved]),ie=(0,Q.useCallback)(async()=>{u({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await fe({registrationSecret:null}),u({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),G(),await N()}catch(e){u({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{savingBrokerSecret:!1}})}},[N,n.brokerSecretCleared]),ae=(0,Q.useCallback)(async()=>{u({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await te({release:!0}),await Promise.all([D.refreshQr(),N()]),G()}catch(e){u({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{releasing:!1}})}},[N,D.refreshQr]),oe=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:a(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!s)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=k??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:P,brokerUrl:`https://frp.xopc.ai/api`}},ce=k?.consentRequired&&(X.enabled||P||k?.consent?.acceptedAt),le=(0,$.jsx)(Ye,{t:n,brokerSecretFromEnv:z,brokerSecretMissing:B,brokerSecretConfiguredInConfig:R,brokerSecretMaskedValue:R?F:``,brokerSecretDraft:S,savingBrokerSecret:C,brokerSecretNotice:T,copyFailedLabel:a(t).clipboard.copyFailed,onDraftChange:e=>u({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void ne(),onClear:()=>void ie(),sectionRef:E}),ue=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ae,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:H,checkboxLabel:n.consentCheckbox,confirmLabel:ce?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ee(),onCancel:()=>u({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(L,{open:v,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{u({type:`patch`,patch:{autoStartConfirmOpen:!1}}),J(!0)},onCancel:()=>u({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(L,{open:y,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void ae(),onCancel:()=>u({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[d?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}):null,le,(0,$.jsx)(Ke,{t:n,status:X,isLoading:M,statusErr:j,starting:f,stopping:p,showConsentExpired:!!ce,copyLabels:oe,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void q()}),(0,$.jsx)(Ee,{pairQr:D,gatewayToken:r??``,streamlined:!0,onRefreshQr:()=>void D.refreshQr()}),(0,$.jsxs)(ge,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:i(`flex items-center gap-3 text-sm text-fg`,!P&&!k?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:P,disabled:h||!P&&!k?.canAutoStart,onChange:Y}),n.autoStart]}),!k?.canAutoStart&&!P?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(_,{type:`button`,variant:`secondary`,disabled:x||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>u({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[x?(0,$.jsx)(re,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(ge,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(b,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Qe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),ue]}):(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})]}),d?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}):null,le,(0,$.jsx)(Ke,{t:n,status:X,isLoading:M,statusErr:j,starting:f,stopping:p,showConsentExpired:!!ce,copyLabels:oe,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void q()}),(0,$.jsx)(Ee,{pairQr:D,gatewayToken:r??``}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(_,{type:`button`,variant:`secondary`,disabled:x||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>u({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[x?(0,$.jsx)(re,{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)(ye,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:i(`flex items-center gap-3 text-sm text-fg`,!P&&!k?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:P,disabled:h||!P&&!k?.canAutoStart,onChange:Y}),n.autoStart]}),!k?.canAutoStart&&!P?(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 border border-edge-subtle bg-surface-panel px-3 py-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(b,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Qe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),ue]})}async function ct(){let e=await f(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function lt(e=`serve`){let t=await f(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function ut(){let e=await f(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var dt=`https://tailscale.com/download`;function ft(e){let t=(0,Z.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`a`,{href:dt,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function pt({embedded:e=!1}){let t=o(e=>e.language),n=a(t).remoteAccess.tailscale,r=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:a(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!c(e=>e.token),[s,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),{data:f,mutate:p,isLoading:h}=m(i?`exposure-status`:null,ct,{refreshInterval:3e4}),g=f?.tailscale.hostname,v=f?.tailscale.active===!0,x=f?.tailscale.cliAvailable!==!1,S=g?`https://${g}/`:null,C=(0,Q.useCallback)(async()=>{l(!0),d(null);try{await lt(`serve`),await p()}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},[p]),w=(0,Q.useCallback)(async()=>{l(!0),d(null);try{await ut(),await p()}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},[p]);if(!i)return null;let T=(0,$.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,$.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,$.jsxs)(`span`,{children:[n.stepInstallBefore,(0,$.jsx)(ft,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,$.jsx)(`span`,{children:n.stepEnable})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,$.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&f?.tailscale.cliAvailable===!1?(0,$.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,$.jsx)(ft,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,h&&!f?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ye,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:v?n.statusActive:n.statusOff}),S?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(y,{text:S,labels:r})}):null,u?(0,$.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:v?(0,$.jsxs)(_,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void w(),children:[s?(0,$.jsx)(re,{className:`mr-1 h-4 w-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(_,{type:`button`,disabled:s||!x,onClick:()=>void C(),children:[s?(0,$.jsx)(re,{className:`mr-1 h-4 w-4 animate-spin`}):(0,$.jsx)(E,{className:`mr-1 h-4 w-4`}),n.enableServe]})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,$.jsx)(Qe,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?T:(0,$.jsxs)(ye,{children:[(0,$.jsx)(_e,{icon:b,title:n.title,subtitle:n.subtitle}),T]})}function mt(){let e=(0,Z.c)(26),t=o(gt),n=c(ht),r;e[0]===t?r=e[1]:(r=a(t),e[0]=t,e[1]=r);let i=r.remoteAccess.lan,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={preferLan:!0},e[2]=s):s=e[2];let l=at(n??``,s),u;e[3]!==i.subtitle||e[4]!==i.title?(u=(0,$.jsx)(_e,{icon:P,title:i.title,subtitle:i.subtitle}),e[3]=i.subtitle,e[4]=i.title,e[5]=u):u=e[5];let d;e[6]===i.body?d=e[7]:(d=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.body}),e[6]=i.body,e[7]=d);let f;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),e[8]=f):f=e[8];let p;e[9]===i.link?p=e[10]:(p=(0,$.jsxs)(T,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[i.link,f]}),e[9]=i.link,e[10]=p);let m;e[11]!==d||e[12]!==p?(m=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[d,p]}),e[11]=d,e[12]=p,e[13]=m):m=e[13];let h;e[14]!==u||e[15]!==m?(h=(0,$.jsxs)(ye,{children:[u,m]}),e[14]=u,e[15]=m,e[16]=h):h=e[16];let g=n??``,_;e[17]===l?_=e[18]:(_=()=>void l.refreshQr(),e[17]=l,e[18]=_);let y;e[19]!==l||e[20]!==g||e[21]!==_?(y=(0,$.jsx)(Ee,{pairQr:l,gatewayToken:g,lanOnly:!0,onRefreshQr:_}),e[19]=l,e[20]=g,e[21]=_,e[22]=y):y=e[22];let b;return e[23]!==y||e[24]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,y]}),e[23]=y,e[24]=h,e[25]=b):b=e[25],b}function ht(e){return e.token}function gt(e){return e.language}function _t(e){let t=(0,Z.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=o(vt),s;t[0]===i?s=t[1]:(s=a(i),t[0]=i,t[1]=s);let c=s.remoteAccess.ssh,[l,u]=(0,Q.useState)(!1),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=async()=>{await g(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(u(!0),setTimeout(()=>u(!1),2e3))},t[2]=d):d=t[2];let f=d,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=p):p=t[3];let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void f(),h=(0,$.jsx)(C,{className:`mr-1 h-4 w-4`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let v=l?c.copied:c.copy,y;t[6]===v?y=t[7]:(y=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(_,{type:`button`,variant:`ghost`,onClick:m,children:[h,v]})}),t[6]=v,t[7]=y);let b;t[8]!==r||t[9]!==c.hint?(b=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:c.hint}):null,t[8]=r,t[9]=c.hint,t[10]=b):b=t[10];let x;t[11]!==y||t[12]!==b?(x=(0,$.jsxs)($.Fragment,{children:[p,y,b]}),t[11]=y,t[12]=b,t[13]=x):x=t[13];let S=x;if(r){let e;t[14]!==c.subtitle||t[15]!==c.title?(e=(0,$.jsx)(_e,{icon:Y,title:c.title,subtitle:c.subtitle}),t[14]=c.subtitle,t[15]=c.title,t[16]=e):e=t[16];let n;t[17]===S?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:S}),t[17]=S,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ye,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let w;t[22]!==c.subtitle||t[23]!==c.title?(w=(0,$.jsx)(_e,{icon:Y,title:c.title,subtitle:c.subtitle}),t[22]=c.subtitle,t[23]=c.title,t[24]=w):w=t[24];let T;t[25]===S?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:S}),t[25]=S,t[26]=T);let E;return t[27]!==w||t[28]!==T?(E=(0,$.jsxs)(ye,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function vt(e){return e.language}function yt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(_t,{embedded:!0}),e[0]=t):t=e[0],t}function bt(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function xt(e){let t=(0,Z.c)(5),{label:n,kind:r}=e,a;t[0]===r?a=t[1]:(a=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,bt(r)),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,$.jsx)(`span`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function St(e){let t=(0,Z.c)(32),{onOpenTab:n}=e,r=o(Tt),s;t[0]===r?s=t[1]:(s=a(r),t[0]=r,t[1]=s);let l=s.remoteAccess.guide,u=!!c(wt),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:3e4},t[2]=d):d=t[2];let{data:f}=m(u?`exposure-status`:null,ct,d),p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p={refreshInterval:15e3},t[3]=p):p=t[3];let{data:h}=m(u?`tunnel-status`:null,K,p),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={refreshInterval:6e4},t[4]=g):g=t[4];let{data:_}=m(u?`tunnel-pair-context`:null,ue,g);if(!u)return null;let v=f?.tailscale.active===!0,y=h?.state,x=h?.enabled&&y===`connected`,C=h?.enabled&&(y===`connecting`||y===`reconnecting`||!!h?.startProgress||!!h?.frpcDownload),w=(_?.candidates??[]).some(Ct),T=v?`active`:`off`,E=v?l.statusActive:l.statusOff,D;t[5]!==l.tailscaleCardTitle||t[6]!==T||t[7]!==E?(D={tab:`tailscale`,icon:b,title:l.tailscaleCardTitle,kind:T,statusLabel:E},t[5]=l.tailscaleCardTitle,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O=x?`active`:C?`connecting`:`off`,k=x?l.statusActive:C?l.statusConnecting:l.statusOff,A;t[9]!==l.publicCardTitle||t[10]!==O||t[11]!==k?(A={tab:`public`,icon:S,title:l.publicCardTitle,kind:O,statusLabel:k},t[9]=l.publicCardTitle,t[10]=O,t[11]=k,t[12]=A):A=t[12];let j=w?`active`:`off`,M=w?l.statusActive:l.statusOff,N;t[13]!==l.reverseProxyCardTitle||t[14]!==j||t[15]!==M?(N={tab:`reverse-proxy`,icon:V,title:l.reverseProxyCardTitle,kind:j,statusLabel:M},t[13]=l.reverseProxyCardTitle,t[14]=j,t[15]=M,t[16]=N):N=t[16];let F;t[17]!==l.sshCardStatus||t[18]!==l.sshCardTitle?(F={tab:`ssh`,icon:Y,title:l.sshCardTitle,kind:`off`,statusLabel:l.sshCardStatus},t[17]=l.sshCardStatus,t[18]=l.sshCardTitle,t[19]=F):F=t[19];let I;t[20]!==l.lanCardStatus||t[21]!==l.lanCardTitle?(I={tab:`lan`,icon:P,title:l.lanCardTitle,kind:`off`,statusLabel:l.lanCardStatus},t[20]=l.lanCardStatus,t[21]=l.lanCardTitle,t[22]=I):I=t[22];let L;t[23]!==A||t[24]!==N||t[25]!==F||t[26]!==I||t[27]!==D?(L=[D,A,N,F,I],t[23]=A,t[24]=N,t[25]=F,t[26]=I,t[27]=D,t[28]=L):L=t[28];let R=L,z;return t[29]!==R||t[30]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:i(`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-base px-3 py-2.5 text-left transition-colors`,`hover:border-edge hover:bg-surface-hover/50`,`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 rounded-lg bg-surface-hover/90 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)(xt,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[29]=R,t[30]=n,t[31]=z):z=t[31],z}function Ct(e){return e.kind===`reverse-proxy`}function wt(e){return e.token}function Tt(e){return e.language}function Et(e){let t=(0,Z.c)(26),{title:n,description:r,recommended:a,icon:o,onOpen:s,openLabel:c,recommendedLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-2xl bg-surface-base px-4 py-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=o,t[2]=d);let f;t[3]===n?f=t[4]:(f=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=f);let p;t[5]!==a||t[6]!==l?(p=a&&l?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:l}):null,t[5]=a,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==f||t[9]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p]}),t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r?h=t[12]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[d,g,_]}),t[17]=d,t[18]=g,t[19]=v):v=t[19];let y;t[20]===c?y=t[21]:(y=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:c}),t[20]=c,t[21]=y);let b;return t[22]!==s||t[23]!==y||t[24]!==v?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:s,className:u,children:[v,y]}),t[22]=s,t[23]=y,t[24]=v,t[25]=b):b=t[25],b}function Dt(e){let t=(0,Z.c)(83),{onOpenTab:n}=e,r=o(At),i;t[0]===r?i=t[1]:(i=a(r),t[0]=r,t[1]=i);let s=i.remoteAccess,l=s.guide,u=!!c(kt),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:3e4},t[2]=d):d=t[2];let{data:f}=m(u?`exposure-status`:null,ct,d),p;t[3]===f?.conflicts?p=t[4]:(p=f?.conflicts??[],t[3]=f?.conflicts,t[4]=p);let h=p;if(!u){let e;return t[5]===l.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l.needToken}),t[5]=l.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(St,{onOpenTab:n}),t[7]=n,t[8]=g);let _;t[9]!==h||t[10]!==l.conflictsHint||t[11]!==l.conflictsTitle?(_=h.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:l.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:l.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:h.map(Ot)})]}):null,t[9]=h,t[10]=l.conflictsHint,t[11]=l.conflictsTitle,t[12]=_):_=t[12];let v;t[13]===l.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:l.pickMethod}),t[13]=l.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let x;t[17]!==l.configure||t[18]!==l.recommended||t[19]!==l.tailscaleCardDesc||t[20]!==l.tailscaleCardTitle||t[21]!==y?(x=(0,$.jsx)(Et,{icon:b,title:l.tailscaleCardTitle,description:l.tailscaleCardDesc,recommended:!0,recommendedLabel:l.recommended,openLabel:l.configure,onOpen:y}),t[17]=l.configure,t[18]=l.recommended,t[19]=l.tailscaleCardDesc,t[20]=l.tailscaleCardTitle,t[21]=y,t[22]=x):x=t[22];let C;t[23]===n?C=t[24]:(C=()=>n(`public`),t[23]=n,t[24]=C);let w;t[25]!==l.configure||t[26]!==l.publicCardDesc||t[27]!==l.publicCardTitle||t[28]!==C?(w=(0,$.jsx)(Et,{icon:S,title:l.publicCardTitle,description:l.publicCardDesc,openLabel:l.configure,onOpen:C}),t[25]=l.configure,t[26]=l.publicCardDesc,t[27]=l.publicCardTitle,t[28]=C,t[29]=w):w=t[29];let T;t[30]===n?T=t[31]:(T=()=>n(`reverse-proxy`),t[30]=n,t[31]=T);let E;t[32]!==l.configure||t[33]!==l.reverseProxyCardDesc||t[34]!==l.reverseProxyCardTitle||t[35]!==T?(E=(0,$.jsx)(Et,{icon:V,title:l.reverseProxyCardTitle,description:l.reverseProxyCardDesc,openLabel:l.configure,onOpen:T}),t[32]=l.configure,t[33]=l.reverseProxyCardDesc,t[34]=l.reverseProxyCardTitle,t[35]=T,t[36]=E):E=t[36];let D;t[37]===n?D=t[38]:(D=()=>n(`ssh`),t[37]=n,t[38]=D);let O;t[39]!==l.configure||t[40]!==l.sshCardDesc||t[41]!==l.sshCardTitle||t[42]!==D?(O=(0,$.jsx)(Et,{icon:Y,title:l.sshCardTitle,description:l.sshCardDesc,openLabel:l.configure,onOpen:D}),t[39]=l.configure,t[40]=l.sshCardDesc,t[41]=l.sshCardTitle,t[42]=D,t[43]=O):O=t[43];let k;t[44]===n?k=t[45]:(k=()=>n(`lan`),t[44]=n,t[45]=k);let A;t[46]!==l.configure||t[47]!==l.lanCardDesc||t[48]!==l.lanCardTitle||t[49]!==k?(A=(0,$.jsx)(Et,{icon:P,title:l.lanCardTitle,description:l.lanCardDesc,openLabel:l.configure,onOpen:k}),t[46]=l.configure,t[47]=l.lanCardDesc,t[48]=l.lanCardTitle,t[49]=k,t[50]=A):A=t[50];let j;t[51]!==w||t[52]!==E||t[53]!==O||t[54]!==A||t[55]!==x?(j=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[x,w,E,O,A]}),t[51]=w,t[52]=E,t[53]=O,t[54]=A,t[55]=x,t[56]=j):j=t[56];let M;t[57]!==j||t[58]!==v?(M=(0,$.jsxs)(`div`,{children:[v,j]}),t[57]=j,t[58]=v,t[59]=M):M=t[59];let N;t[60]===l.oneAtATimeHint?N=t[61]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:l.oneAtATimeHint}),t[60]=l.oneAtATimeHint,t[61]=N);let F;t[62]===s.advanced.proxyTitle?F=t[63]:(F=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.advanced.proxyTitle}),t[62]=s.advanced.proxyTitle,t[63]=F);let I;t[64]===s.advanced.proxyBody?I=t[65]:(I=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s.advanced.proxyBody}),t[64]=s.advanced.proxyBody,t[65]=I);let L;t[66]!==r||t[67]!==s.advanced.proxyDocs?(L=(0,$.jsx)(Qe,{language:r,label:s.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=s.advanced.proxyDocs,t[68]=L):L=t[68];let R;t[69]!==F||t[70]!==I||t[71]!==L?(R=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[F,I,L]}),t[69]=F,t[70]=I,t[71]=L,t[72]=R):R=t[72];let z;t[73]!==l.docsLink||t[74]!==r?(z=(0,$.jsx)(Qe,{language:r,label:l.docsLink}),t[73]=l.docsLink,t[74]=r,t[75]=z):z=t[75];let B;return t[76]!==M||t[77]!==N||t[78]!==R||t[79]!==z||t[80]!==g||t[81]!==_?(B=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,M,N,R,z]}),t[76]=M,t[77]=N,t[78]=R,t[79]=z,t[80]=g,t[81]=_,t[82]=B):B=t[82],B}function Ot(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function kt(e){return e.token}function At(e){return e.language}async function jt(e){let t=await f(l(`/api/tunnel/pair/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function Mt(e){await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function Nt(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function Pt(){return(0,Q.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||Nt(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function Ft(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,he,`dark:border-edge`)}function It(e){return(e?.candidates.find(e=>e.kind===`reverse-proxy`))?.url?.trim()||null}function Lt(e){return(e?.candidates.find(e=>e.kind===`lan`&&e.reachable))?.url?.trim()||null}function Rt(){let e=o(e=>e.language),t=a(e).remoteAccess.reverseProxy,n=!!c(e=>e.token),r=Pt(),{mutate:l}=p(),{data:u,mutate:d}=m(n?`tunnel-pair-context`:null,ue,{refreshInterval:6e4}),f=It(u),[g,v]=(0,Q.useState)(``),[x,S]=(0,Q.useState)({busy:!1,result:null}),[C,w]=(0,Q.useState)({busy:!1,error:null});(0,Q.useEffect)(()=>{g||(f?v(f):r&&v(r))},[f,r,g]);let T=(0,Q.useMemo)(()=>g.trim()||(f??r??``),[f,r,g]),E=!f&&!!r&&T===r,O=Lt(u),{data:k,mutate:A}=m(n&&T?[`reverse-proxy-pair`,T]:null,()=>M(),{refreshInterval:4*6e4,revalidateOnFocus:!1}),j=(0,Q.useMemo)(()=>!T||!k?.pairingSecret?``:s({baseUrl:T,pairingSecret:k.pairingSecret,lanUrl:O}),[T,O,k?.pairingSecret]),N=h(()=>tt(j),[j],{enabled:!!j,initial:null,errorData:null}),P=(0,Q.useCallback)(async()=>{let e=g.trim()||T;if(e){S({busy:!0,result:null});try{S({busy:!1,result:await jt(e)})}catch(e){S({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:e instanceof Error?e.message:String(e)}})}}},[g,T]),F=(0,Q.useCallback)(async()=>{let e=T.trim();if(e){w({busy:!0,error:null});try{await Mt(e),await d(),await l(`tunnel-pair-context`),w({busy:!1,error:null})}catch(e){w({busy:!1,error:e instanceof Error?e.message:String(e)})}}},[T,l,d]),I=(0,Q.useCallback)(async()=>{w({busy:!0,error:null});try{await Mt(null),await d(),await l(`tunnel-pair-context`),v(``),S({busy:!1,result:null}),w({busy:!1,error:null})}catch(e){w({busy:!1,error:e instanceof Error?e.message:String(e)})}},[l,d]),L=(0,Q.useCallback)(async()=>{await A()},[A]);return n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(ye,{children:[(0,$.jsx)(_e,{icon:b,title:t.title,subtitle:t.subtitle}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:t.urlLabel}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[(0,$.jsx)(`input`,{id:`reverse-proxy-url`,className:i(Ft(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:t.urlPlaceholder,value:g,onChange:e=>{v(e.target.value),S({busy:!1,result:null})}}),(0,$.jsxs)(_,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:()=>void P(),disabled:x.busy||!g.trim(),children:[x.busy?(0,$.jsx)(re,{className:`size-3.5 animate-spin`}):null,x.busy?t.probing:t.probeButton]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.urlHint}),E&&r?(0,$.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:t.autoDetectedTitle}),(0,$.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:r}),(0,$.jsx)(`p`,{className:`mt-1`,children:t.autoDetectedHint})]}):null,x.result?(0,$.jsx)(zt,{result:x.result,labels:t.probeStatus}):null,(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[T&&f!==T?(0,$.jsxs)(_,{type:`button`,onClick:()=>void F(),disabled:C.busy,children:[C.busy?(0,$.jsx)(re,{className:`size-3.5 animate-spin`}):null,C.busy?t.saving:t.saveAsDefault]}):null,f?(0,$.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>void I(),disabled:C.busy,children:t.clear}):null]}),C.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:C.error}):null,(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:t.certWarning})]})]}),(0,$.jsxs)(ye,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:t.qrTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.qrSubtitle})]}),j?(0,$.jsxs)(_,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void L(),children:[(0,$.jsx)(D,{className:`size-4`}),t.refreshQr]}):null]}),T?k?.pairingSecret?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[(0,$.jsxs)(`div`,{className:`break-all font-mono text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`baseUrl:`}),` `,T,O?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`br`,{}),(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`lanUrl:`}),` `,O]}):null]}),N.data?(0,$.jsx)(`img`,{src:N.data,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):N.loading?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.encoding}):null,(0,$.jsx)(y,{text:j,labels:{copy:t.copyLink,copied:t.copied,copyFailed:a(e).clipboard.copyFailed}})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.mintingSecret}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noUrlYet})]})]}):null}function zt(e){let t=(0,Z.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,$.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.mobileReady||t[5]!==n.mobilePairing?(a=n.mobilePairing?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(`span`,{children:r.mobileReady})]}):null,t[4]=r.mobileReady,t[5]=n.mobilePairing,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,$.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,$.jsxs)($.Fragment,{children:[` — `,(0,$.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}var Bt=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Vt(e){return e&&Bt.includes(e)?e:`guide`}function Ht(e,t){return e.tabs[t]}function Ut(e,t){return e.tabIntro[t]}function Wt(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 Gt(e){let t=(0,Z.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Dt,{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)(pt,{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)(st,{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)(Rt,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(yt,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(mt,{}),t[6]=e):e=t[6],e}}}function Kt(){let e=(0,Z.c)(2),t=o(Jt),n=a(t).remoteAccess,r=!!c(qt),[i,s]=k(),l=Vt(i.get(`tab`)),u;e[0]===s?u=e[1]:(u=e=>{s(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[0]=s,e[1]=u);let d=u,f=Ut(n,l),p=Bt.map(e=>({id:e,label:Ht(n,e)}));return(0,$.jsxs)(Ce,{children:[(0,$.jsx)(xe,{title:n.pageTitle,subtitle:n.pageSubtitle,meta:(0,$.jsx)(Qe,{language:t,label:n.docsLink,section:Wt(l),className:`mt-1`})}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x,{items:p,activeTab:l,onChange:d,ariaLabel:n.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(Se,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:Ht(n,l),hint:l===`public`?void 0:f,children:(0,$.jsx)(Gt,{tab:l,onOpenTab:d})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.guide.needToken})]})}function qt(e){return e.token}function Jt(e){return e.language}export{Kt as RemoteAccessHub};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-C6Kc4Jhf.js";import{c as o,n as s}from"./locale-store-Ba72bFmP.js";import{Oa as c,Uo as l}from"./index-BU1pvxmS.js";var u=e(t(),1);function d(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var f=o((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...d(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...d(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...d(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...d(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}}));function p({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=f(e=>e.registerSection),c=f(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}var m=n(),h=r();function g(){let e=(0,m.c)(26),t=a(s(S)).modelsHub.saveBar,n=f(x),r=f(b),o=f(y),d=f(v),p=f(_),g;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],e[0]=g):g=e[0];let[C,w]=(0,u.useState)(g),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===d?D=e[2]:(D=async()=>{w([]),E(!1);let e=await d();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=d,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,h.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===p?M=e[5]:(M=()=>p(),e[4]=p,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,h.jsx)(c,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,h.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,h.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,h.jsxs)(c,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,h.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(o)):T?t.savedSummary:t.cleanSummary}),B]})}function _(e){return e.discardAll}function v(e){return e.saveAll}function y(e){return e.dirtyCount}function b(e){return e.anySaving}function x(e){return e.anyDirty}function S(e){return e.language}export{p as n,g as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-avfvyZuQ.js";import{c as o,n as s}from"./locale-store-Ba72bFmP.js";import{Ba as c,ns as l}from"./index-T0SaNd5a.js";var u=e(t(),1);function d(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var f=o((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...d(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...d(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...d(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...d(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}}));function p({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=f(e=>e.registerSection),c=f(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}var m=n(),h=r();function g(){let e=(0,m.c)(26),t=a(s(S)).modelsHub.saveBar,n=f(x),r=f(b),o=f(y),d=f(v),p=f(_),g;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],e[0]=g):g=e[0];let[C,w]=(0,u.useState)(g),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===d?D=e[2]:(D=async()=>{w([]),E(!1);let e=await d();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=d,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,h.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===p?M=e[5]:(M=()=>p(),e[4]=p,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,h.jsx)(c,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,h.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,h.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,h.jsxs)(c,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,h.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(o)):T?t.savedSummary:t.cleanSummary}),B]})}function _(e){return e.discardAll}function v(e){return e.saveAll}function y(e){return e.dirtyCount}function b(e){return e.anySaving}function x(e){return e.anyDirty}function S(e){return e.language}export{p as n,g as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{Ea as a,Oa as o,ia as s,oa as c,wa as l}from"./index-BU1pvxmS.js";import{n as u,t as d}from"./cron-expression-B3B1eqnr.js";var f=n(),p=e(t(),1),m=r(),h=Array.from({length:60},(e,t)=>t),g=i(a,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),_=i(`h-9 min-w-[6.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,l,`dark:bg-surface-panel`),v=i(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,l),y=i(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,l),b=i(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,l);function x(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function S(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function C(e,t){switch(t.type){case`reset`:return x(t.state);case`replace`:return t.state}}function w({value:e,onChange:t,labels:n,disabled:r,showHeading:a=!0}){let o=(0,p.useMemo)(()=>u(e),[e]),[l,f]=(0,p.useReducer)(C,o,x),w=(0,p.useRef)(e);w.current!==e&&(w.current=e,f({type:`reset`,state:o}));let T=(0,p.useCallback)(e=>{let n={...l,...e};f({type:`replace`,state:n});let r=S(n),i=S(l);Object.keys(r).some(e=>r[e]!==i[e])&&t(d(r))},[t,l]),{mode:E,intervalKind:D,onceDate:O,intervalMinutes:k,intervalHours:A,minute:j,hour:M,weekDays:N,dayOfMonth:P,rawCron:F,intervalMinutesDraft:I,intervalHoursDraft:L}=l,R=`${String(M).padStart(2,`0`)}:${String(j).padStart(2,`0`)}`,z=e=>{let t=e.target.value;if(!t)return;let[n,r]=t.split(`:`).map(e=>parseInt(e,10));Number.isNaN(n)||Number.isNaN(r)||T({minute:r,hour:n})},B=(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,m.jsxs)(s,{className:g,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,m.jsx)(c,{value:`no_repeat`,children:n.modeNoRepeat}),(0,m.jsx)(c,{value:`interval`,children:n.modeInterval}),(0,m.jsx)(c,{value:`hourly`,children:n.modeHourly}),(0,m.jsx)(c,{value:`daily`,children:n.modeDaily}),(0,m.jsx)(c,{value:`weekly`,children:n.modeWeekly}),(0,m.jsx)(c,{value:`monthly`,children:n.modeMonthly}),(0,m.jsx)(c,{value:`custom`,children:n.modeCustom})]}),E===`no_repeat`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`date`,disabled:r,className:v,value:O,onChange:e=>{T({onceDate:e.target.value})},"aria-label":n.modeNoRepeat}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`interval`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(s,{className:i(g,`w-auto min-w-[5rem]`),disabled:r,value:D,onChange:e=>{let t=e.target.value;T({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,m.jsx)(c,{value:`minutes`,children:n.intervalKindMinutes}),(0,m.jsx)(c,{value:`hours`,children:n.intervalKindHours})]}),D===`minutes`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:y,value:I??String(k),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),T(r)},onBlur:()=>{if(I===null)return;let e=parseInt(I,10);T({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:y,value:L??String(A),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),T(r)},onBlur:()=>{if(L===null)return;let e=parseInt(L,10);T({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,m.jsx)(s,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),E===`daily`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`weekly`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`monthly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(s,{className:i(g,`w-auto min-w-[4.5rem]`),disabled:r,value:P,onChange:e=>{T({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,m.jsx)(c,{value:e,children:e},e))}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`hourly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(s,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),V=E===`weekly`?(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=N[t];return(0,m.jsx)(`button`,{type:`button`,disabled:r,className:i(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...N];e[t]=!e[t],T({weekDays:e})},children:e},e)})}):null,H=E===`custom`?(0,m.jsxs)(`div`,{className:`pt-1`,children:[(0,m.jsx)(`textarea`,{disabled:r,className:b,rows:2,spellCheck:!1,value:F,placeholder:`*/5 * * * *`,onChange:e=>{T({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,m.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,B,V,H]})}var T=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5],E=new Set(T),D=i(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,l),O=i(a,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function k(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function A({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=T,minSeconds:a=1}){let o=(0,p.useMemo)(()=>new Set(i),[i]),l=(0,p.useMemo)(()=>o.has(e)?String(e):``,[o,e]),[u,d]=(0,p.useState)(null),f=(0,p.useRef)(e);f.current!==e&&(f.current=e,d(null));let h=Math.max(a,Math.round(e/1e3)),g=u===null?String(h):u;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`input`,{type:`number`,min:a,step:1,disabled:r,className:D,value:g,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=a&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<a?a*1e3:e*1e3),d(null)}}),(0,m.jsxs)(s,{className:O,disabled:r,value:l,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,m.jsx)(c,{value:``,children:n.presets.custom}),i.map(e=>(0,m.jsx)(c,{value:String(e),children:k(e,n.presets)},e))]})]})]})}var j=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,l),M=()=>({start:`09:00`,end:`22:00`,timezone:``});function N(e){let t=(0,f.c)(55),{value:n,onChange:r,labels:i,disabled:a}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(M()),t[0]=r,t[1]=e);let n;return t[2]!==a||t[3]!==i.add||t[4]!==e?(n=(0,m.jsx)(o,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:a,onClick:e,children:i.add}),t[2]=a,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let s;t[6]===i.start?s=t[7]:(s=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=s);let c;t[8]!==r||t[9]!==n?(c=e=>r({...n,start:e.target.value}),t[8]=r,t[9]=n,t[10]=c):c=t[10];let l;t[11]!==a||t[12]!==c||t[13]!==n.start?(l=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:a,className:j,value:n.start,onChange:c}),t[11]=a,t[12]=c,t[13]=n.start,t[14]=l):l=t[14];let u;t[15]!==s||t[16]!==l?(u=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[s,l]}),t[15]=s,t[16]=l,t[17]=u):u=t[17];let d;t[18]===i.end?d=t[19]:(d=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[18]=i.end,t[19]=d);let p;t[20]!==r||t[21]!==n?(p=e=>r({...n,end:e.target.value}),t[20]=r,t[21]=n,t[22]=p):p=t[22];let h;t[23]!==a||t[24]!==p||t[25]!==n.end?(h=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:a,className:j,value:n.end,onChange:p}),t[23]=a,t[24]=p,t[25]=n.end,t[26]=h):h=t[26];let g;t[27]!==d||t[28]!==h?(g=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[d,h]}),t[27]=d,t[28]=h,t[29]=g):g=t[29];let _;t[30]===i.timezone?_=t[31]:(_=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[30]=i.timezone,t[31]=_);let v;t[32]!==r||t[33]!==n?(v=e=>r({...n,timezone:e.target.value}),t[32]=r,t[33]=n,t[34]=v):v=t[34];let y;t[35]!==a||t[36]!==v||t[37]!==n.timezone?(y=(0,m.jsx)(`input`,{type:`text`,disabled:a,className:j,value:n.timezone,onChange:v,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[35]=a,t[36]=v,t[37]=n.timezone,t[38]=y):y=t[38];let b;t[39]!==y||t[40]!==_?(b=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[_,y]}),t[39]=y,t[40]=_,t[41]=b):b=t[41];let x;t[42]!==b||t[43]!==u||t[44]!==g?(x=(0,m.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[u,g,b]}),t[42]=b,t[43]=u,t[44]=g,t[45]=x):x=t[45];let S;t[46]===r?S=t[47]:(S=()=>r(null),t[46]=r,t[47]=S);let C;t[48]!==a||t[49]!==i.clear||t[50]!==S?(C=(0,m.jsx)(o,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:S,children:i.clear}),t[48]=a,t[49]=i.clear,t[50]=S,t[51]=C):C=t[51];let w;return t[52]!==x||t[53]!==C?(w=(0,m.jsxs)(`div`,{className:`space-y-2`,children:[x,C]}),t[52]=x,t[53]=C,t[54]=w):w=t[54],w}function P(e){let t=(0,f.c)(34),{disabled:n,label:r,hint:a,className:o}=e,s;t[0]===o?s=t[1]:(s=i(`flex flex-col gap-2`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(l=e.kind===`cron`?(0,m.jsx)(w,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=l):l=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,m.jsx)(A,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??T,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,m.jsx)(N,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let p;t[25]===a?p=t[26]:(p=a?(0,m.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[25]=a,t[26]=p);let h;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(h=(0,m.jsxs)(`div`,{className:s,children:[c,l,u,d,p]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=h):h=t[33],h}export{E as n,P as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{Ba as a,Ia as o,Ra as s,ga as c,va as l}from"./index-T0SaNd5a.js";import{n as u,t as d}from"./cron-expression-B3B1eqnr.js";var f=n(),p=e(t(),1),m=r(),h=Array.from({length:60},(e,t)=>t),g=i(s,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),_=i(`h-9 min-w-[6.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,o,`dark:bg-surface-panel`),v=i(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,o),y=i(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,o),b=i(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,o);function x(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function S(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function C(e,t){switch(t.type){case`reset`:return x(t.state);case`replace`:return t.state}}function w({value:e,onChange:t,labels:n,disabled:r,showHeading:a=!0}){let o=(0,p.useMemo)(()=>u(e),[e]),[s,f]=(0,p.useReducer)(C,o,x),w=(0,p.useRef)(e);w.current!==e&&(w.current=e,f({type:`reset`,state:o}));let T=(0,p.useCallback)(e=>{let n={...s,...e};f({type:`replace`,state:n});let r=S(n),i=S(s);Object.keys(r).some(e=>r[e]!==i[e])&&t(d(r))},[t,s]),{mode:E,intervalKind:D,onceDate:O,intervalMinutes:k,intervalHours:A,minute:j,hour:M,weekDays:N,dayOfMonth:P,rawCron:F,intervalMinutesDraft:I,intervalHoursDraft:L}=s,R=`${String(M).padStart(2,`0`)}:${String(j).padStart(2,`0`)}`,z=e=>{let t=e.target.value;if(!t)return;let[n,r]=t.split(`:`).map(e=>parseInt(e,10));Number.isNaN(n)||Number.isNaN(r)||T({minute:r,hour:n})},B=(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,m.jsxs)(c,{className:g,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,m.jsx)(l,{value:`no_repeat`,children:n.modeNoRepeat}),(0,m.jsx)(l,{value:`interval`,children:n.modeInterval}),(0,m.jsx)(l,{value:`hourly`,children:n.modeHourly}),(0,m.jsx)(l,{value:`daily`,children:n.modeDaily}),(0,m.jsx)(l,{value:`weekly`,children:n.modeWeekly}),(0,m.jsx)(l,{value:`monthly`,children:n.modeMonthly}),(0,m.jsx)(l,{value:`custom`,children:n.modeCustom})]}),E===`no_repeat`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`date`,disabled:r,className:v,value:O,onChange:e=>{T({onceDate:e.target.value})},"aria-label":n.modeNoRepeat}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`interval`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(c,{className:i(g,`w-auto min-w-[5rem]`),disabled:r,value:D,onChange:e=>{let t=e.target.value;T({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,m.jsx)(l,{value:`minutes`,children:n.intervalKindMinutes}),(0,m.jsx)(l,{value:`hours`,children:n.intervalKindHours})]}),D===`minutes`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:y,value:I??String(k),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),T(r)},onBlur:()=>{if(I===null)return;let e=parseInt(I,10);T({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:y,value:L??String(A),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),T(r)},onBlur:()=>{if(L===null)return;let e=parseInt(L,10);T({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,m.jsx)(c,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(l,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),E===`daily`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`weekly`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`monthly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(c,{className:i(g,`w-auto min-w-[4.5rem]`),disabled:r,value:P,onChange:e=>{T({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,m.jsx)(l,{value:e,children:e},e))}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`hourly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(c,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(l,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),V=E===`weekly`?(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=N[t];return(0,m.jsx)(`button`,{type:`button`,disabled:r,className:i(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...N];e[t]=!e[t],T({weekDays:e})},children:e},e)})}):null,H=E===`custom`?(0,m.jsxs)(`div`,{className:`pt-1`,children:[(0,m.jsx)(`textarea`,{disabled:r,className:b,rows:2,spellCheck:!1,value:F,placeholder:`*/5 * * * *`,onChange:e=>{T({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,m.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,B,V,H]})}var T=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5],E=new Set(T),D=i(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,o),O=i(s,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function k(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function A({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=T,minSeconds:a=1}){let o=(0,p.useMemo)(()=>new Set(i),[i]),s=(0,p.useMemo)(()=>o.has(e)?String(e):``,[o,e]),[u,d]=(0,p.useState)(null),f=(0,p.useRef)(e);f.current!==e&&(f.current=e,d(null));let h=Math.max(a,Math.round(e/1e3)),g=u===null?String(h):u;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`input`,{type:`number`,min:a,step:1,disabled:r,className:D,value:g,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=a&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<a?a*1e3:e*1e3),d(null)}}),(0,m.jsxs)(c,{className:O,disabled:r,value:s,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,m.jsx)(l,{value:``,children:n.presets.custom}),i.map(e=>(0,m.jsx)(l,{value:String(e),children:k(e,n.presets)},e))]})]})]})}var j=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,o),M=()=>({start:`09:00`,end:`22:00`,timezone:``});function N(e){let t=(0,f.c)(55),{value:n,onChange:r,labels:i,disabled:o}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(M()),t[0]=r,t[1]=e);let n;return t[2]!==o||t[3]!==i.add||t[4]!==e?(n=(0,m.jsx)(a,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:o,onClick:e,children:i.add}),t[2]=o,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let s;t[6]===i.start?s=t[7]:(s=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=s);let c;t[8]!==r||t[9]!==n?(c=e=>r({...n,start:e.target.value}),t[8]=r,t[9]=n,t[10]=c):c=t[10];let l;t[11]!==o||t[12]!==c||t[13]!==n.start?(l=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:o,className:j,value:n.start,onChange:c}),t[11]=o,t[12]=c,t[13]=n.start,t[14]=l):l=t[14];let u;t[15]!==s||t[16]!==l?(u=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[s,l]}),t[15]=s,t[16]=l,t[17]=u):u=t[17];let d;t[18]===i.end?d=t[19]:(d=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[18]=i.end,t[19]=d);let p;t[20]!==r||t[21]!==n?(p=e=>r({...n,end:e.target.value}),t[20]=r,t[21]=n,t[22]=p):p=t[22];let h;t[23]!==o||t[24]!==p||t[25]!==n.end?(h=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:o,className:j,value:n.end,onChange:p}),t[23]=o,t[24]=p,t[25]=n.end,t[26]=h):h=t[26];let g;t[27]!==d||t[28]!==h?(g=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[d,h]}),t[27]=d,t[28]=h,t[29]=g):g=t[29];let _;t[30]===i.timezone?_=t[31]:(_=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[30]=i.timezone,t[31]=_);let v;t[32]!==r||t[33]!==n?(v=e=>r({...n,timezone:e.target.value}),t[32]=r,t[33]=n,t[34]=v):v=t[34];let y;t[35]!==o||t[36]!==v||t[37]!==n.timezone?(y=(0,m.jsx)(`input`,{type:`text`,disabled:o,className:j,value:n.timezone,onChange:v,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[35]=o,t[36]=v,t[37]=n.timezone,t[38]=y):y=t[38];let b;t[39]!==y||t[40]!==_?(b=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[_,y]}),t[39]=y,t[40]=_,t[41]=b):b=t[41];let x;t[42]!==b||t[43]!==u||t[44]!==g?(x=(0,m.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[u,g,b]}),t[42]=b,t[43]=u,t[44]=g,t[45]=x):x=t[45];let S;t[46]===r?S=t[47]:(S=()=>r(null),t[46]=r,t[47]=S);let C;t[48]!==o||t[49]!==i.clear||t[50]!==S?(C=(0,m.jsx)(a,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:S,children:i.clear}),t[48]=o,t[49]=i.clear,t[50]=S,t[51]=C):C=t[51];let w;return t[52]!==x||t[53]!==C?(w=(0,m.jsxs)(`div`,{className:`space-y-2`,children:[x,C]}),t[52]=x,t[53]=C,t[54]=w):w=t[54],w}function P(e){let t=(0,f.c)(34),{disabled:n,label:r,hint:a,className:o}=e,s;t[0]===o?s=t[1]:(s=i(`flex flex-col gap-2`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(l=e.kind===`cron`?(0,m.jsx)(w,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=l):l=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,m.jsx)(A,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??T,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,m.jsx)(N,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let p;t[25]===a?p=t[26]:(p=a?(0,m.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[25]=a,t[26]=p);let h;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(h=(0,m.jsxs)(`div`,{className:s,children:[c,l,u,d,p]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=h):h=t[33],h}export{E as n,P as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{_a as i,ia as a,ma as o,oa as s}from"./index-BU1pvxmS.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:r,value:s,onChange:u,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===u?i=t[3]:(i=e=>u(e.target.value),t[2]=u,t[3]=i);let o;t[4]===r.enum?o=t[5]:(o=r.enum.map(_),t[4]=r.enum,t[5]=o);let c;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==s?(c=(0,l.jsx)(a,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:s,disabled:d,onChange:i,children:o}),t[6]=d,t[7]=n,t[8]=i,t[9]=o,t[10]=s,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==s?(n=(0,l.jsx)(i,{value:s,onChange:u,placeholder:p,labels:o,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=s,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==s?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:s,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=s,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(s,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=i,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=i,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{Ea as i,ga as a,ka as o,va as s}from"./index-T0SaNd5a.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:r,value:s,onChange:u,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===u?i=t[3]:(i=e=>u(e.target.value),t[2]=u,t[3]=i);let o;t[4]===r.enum?o=t[5]:(o=r.enum.map(_),t[4]=r.enum,t[5]=o);let c;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==s?(c=(0,l.jsx)(a,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:s,disabled:d,onChange:i,children:o}),t[6]=d,t[7]=n,t[8]=i,t[9]=o,t[10]=s,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==s?(n=(0,l.jsx)(o,{value:s,onChange:u,placeholder:p,labels:i,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=s,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==s?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:s,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=s,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(s,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=i,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=i,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
@@ -0,0 +1 @@
1
+ var e=`inline-flex items-center gap-px rounded-pill border border-edge bg-surface-hover p-1 dark:border-edge`,t=`inline-flex shrink-0 items-center justify-center rounded-pill text-xs font-medium leading-none transition-[color,background-color,box-shadow] duration-150 ease-out text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel active:scale-100`,n=`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`;export{t as n,e as r,n as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-avfvyZuQ.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{c as s,i as c,n as l}from"./fetch-Dtpbbe0s.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$a as d,$r as f,Ac as ee,Ba as p,Gr as m,H as h,Ha as g,Jr as _,Kr as v,Mi as y,Na as b,Ns as x,Pa as S,Rc as C,Ro as te,So as w,Us as ne,Va as T,Ws as E,Xr as D,Yr as O,Zo as k,Zr as A,aa as re,ba as j,ct as M,ds as N,ea as P,ei as F,fs as I,ga as L,ia as R,jc as z,ji as B,ki as ie,lt as ae,ms as V,nc as oe,ni as H,ns as U,oa as W,qr as se,ra as ce,ri as G,ta as K,ti as q,ut as le,va as J,vo as ue,ya as de,za as Y,zo as fe}from"./index-T0SaNd5a.js";import{n as pe,t as X}from"./settings-form-section-BFxBNxOG.js";import{n as me,r as he}from"./segmented-styles-BL8oLBEp.js";var Z=e(t(),1),ge=n(),Q=r();function _e(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function ve(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ye(e){let t=(0,ge.c)(105),{session:n,variant:r,labels:a,sessionAgentId:o,sessionAgentAvatar:s,onOpen:c,onAction:l}=e,u;t[0]!==a.unnamedSession||t[1]!==n.name?(u=n.name?.trim()||a.unnamedSession,t[0]=a.unnamedSession,t[1]=n.name,t[2]=u):u=t[2];let f=u,p;t[3]===n.name?p=t[4]:(p=n.name?.trim(),t[3]=n.name,t[4]=p);let m=!!p,h=n.status===`archived`,g=n.status===`pinned`,_=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,v;t[5]===_?v=t[6]:(v=i(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,_),t[5]=_,t[6]=v);let y;t[7]===c?y=t[8]:(y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[7]=c,t[8]=y);let x=r===`list`&&`sm:py-3`,S;t[9]===x?S=t[10]:(S=i(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,x),t[9]=x,t[10]=S);let C;t[11]===n.sourceChannel?C=t[12]:(C=(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=C);let w;t[13]===g?w=t[14]:(w=g?(0,Q.jsx)(fe,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=g,t[14]=w);let E;t[15]===n.updatedAt?E=t[16]:(E=_e(n.updatedAt),t[15]=n.updatedAt,t[16]=E);let D;t[17]===E?D=t[18]:(D=(0,Q.jsx)(`span`,{children:E}),t[17]=E,t[18]=D);let O;t[19]!==D||t[20]!==w?(O=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[w,D]}),t[19]=D,t[20]=w,t[21]=O):O=t[21];let A;t[22]!==O||t[23]!==S||t[24]!==C?(A=(0,Q.jsxs)(`div`,{className:S,children:[C,O]}),t[22]=O,t[23]=S,t[24]=C,t[25]=A):A=t[25];let re=r===`list`&&`sm:py-3`,j;t[26]===re?j=t[27]:(j=i(`min-w-0 flex-1 px-3 py-2`,re),t[26]=re,t[27]=j);let M=r===`list`&&`sm:items-start`,N;t[28]===M?N=t[29]:(N=i(`flex gap-3`,M),t[28]=M,t[29]=N);let P;t[30]!==s||t[31]!==o?(P=(0,Q.jsx)(G,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=s,t[31]=o,t[32]=P):P=t[32];let F;t[33]===f?F=t[34]:(F=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[33]=f,t[34]=F);let I;t[35]!==n.key||t[36]!==m?(I=m?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[35]=n.key,t[36]=m,t[37]=I):I=t[37];let L;t[38]!==F||t[39]!==I?(L=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[F,I]}),t[38]=F,t[39]=I,t[40]=L):L=t[40];let R;t[41]!==N||t[42]!==P||t[43]!==L?(R=(0,Q.jsxs)(`div`,{className:N,children:[P,L]}),t[41]=N,t[42]=P,t[43]=L,t[44]=R):R=t[44];let B;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(k,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=B):B=t[45];let ie;t[46]===n.messageCount?ie=t[47]:(ie=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[B,n.messageCount]}),t[46]=n.messageCount,t[47]=ie);let ae;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(T,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=ae):ae=t[48];let V;t[49]===n.estimatedTokens?V=t[50]:(V=ve(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=V);let oe;t[51]===V?oe=t[52]:(oe=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[ae,V]}),t[51]=V,t[52]=oe);let H;t[53]!==ie||t[54]!==oe?(H=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[ie,oe]}),t[53]=ie,t[54]=oe,t[55]=H):H=t[55];let U;t[56]===n.tags?U=t[57]:(U=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Se),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=U);let W;t[58]!==j||t[59]!==R||t[60]!==H||t[61]!==U?(W=(0,Q.jsxs)(`div`,{className:j,children:[R,H,U]}),t[58]=j,t[59]=R,t[60]=H,t[61]=U,t[62]=W):W=t[62];let se;t[63]===l?se=t[64]:(se=()=>l(`continue`),t[63]=l,t[64]=se);let ce;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Q.jsx)(k,{className:`size-4`,strokeWidth:1.75}),t[65]=ce):ce=t[65];let K;t[66]!==a.continueChat||t[67]!==se?(K=(0,Q.jsx)(`button`,{type:`button`,className:b,title:a.continueChat,"aria-label":a.continueChat,onClick:se,children:ce}),t[66]=a.continueChat,t[67]=se,t[68]=K):K=t[68];let q;t[69]!==h||t[70]!==a.archive||t[71]!==a.unarchive||t[72]!==l?(q=h?(0,Q.jsx)(`button`,{type:`button`,className:b,title:a.unarchive,"aria-label":a.unarchive,onClick:()=>l(`unarchive`),children:(0,Q.jsx)(z,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:b,title:a.archive,"aria-label":a.archive,onClick:()=>l(`archive`),children:(0,Q.jsx)(ee,{className:`size-4`,strokeWidth:1.75})}),t[69]=h,t[70]=a.archive,t[71]=a.unarchive,t[72]=l,t[73]=q):q=t[73];let le;t[74]!==g||t[75]!==a.pin||t[76]!==a.unpin||t[77]!==l?(le=g?(0,Q.jsx)(`button`,{type:`button`,className:b,title:a.unpin,"aria-label":a.unpin,onClick:()=>l(`unpin`),children:(0,Q.jsx)(te,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:b,title:a.pin,"aria-label":a.pin,onClick:()=>l(`pin`),children:(0,Q.jsx)(fe,{className:`size-4`,strokeWidth:1.75})}),t[74]=g,t[75]=a.pin,t[76]=a.unpin,t[77]=l,t[78]=le):le=t[78];let J;t[79]===l?J=t[80]:(J=()=>l(`export`),t[79]=l,t[80]=J);let ue;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Q.jsx)(ne,{className:`size-4`,strokeWidth:1.75}),t[81]=ue):ue=t[81];let de;t[82]!==a.export||t[83]!==J?(de=(0,Q.jsx)(`button`,{type:`button`,className:b,title:a.export,"aria-label":a.export,onClick:J,children:ue}),t[82]=a.export,t[83]=J,t[84]=de):de=t[84];let Y;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Y=i(b,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=Y):Y=t[85];let pe;t[86]===l?pe=t[87]:(pe=()=>l(`delete`),t[86]=l,t[87]=pe);let X;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(d,{className:`size-4`,strokeWidth:1.75}),t[88]=X):X=t[88];let me;t[89]!==a.delete||t[90]!==pe?(me=(0,Q.jsx)(`button`,{type:`button`,className:Y,title:a.delete,"aria-label":a.delete,onClick:pe,children:X}),t[89]=a.delete,t[90]=pe,t[91]=me):me=t[91];let he;t[92]!==K||t[93]!==q||t[94]!==le||t[95]!==de||t[96]!==me?(he=(0,Q.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:xe,onKeyDown:be,children:[K,q,le,de,me]}),t[92]=K,t[93]=q,t[94]=le,t[95]=de,t[96]=me,t[97]=he):he=t[97];let Z;return t[98]!==c||t[99]!==A||t[100]!==W||t[101]!==v||t[102]!==he||t[103]!==y?(Z=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:v,onClick:c,onKeyDown:y,children:[A,W,he]}),t[98]=c,t[99]=A,t[100]=W,t[101]=v,t[102]=he,t[103]=y,t[104]=Z):Z=t[104],Z}function be(e){return e.stopPropagation()}function xe(e){return e.stopPropagation()}function Se(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ce(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function we(e){let t=$(e)?e:{},n=$(t.session)?t.session:{},r=$(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:Ce(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Te(e){await l(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),B()}function Ee(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,Y,`dark:border-edge`)}var De=M();function Oe({hasToken:e}){let t=a(o(e=>e.language)).sessions.config,{data:n,isLoading:r}=y(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:we(n.payload.config),[n]),[s,c]=(0,Z.useReducer)(De,{form:null,baseline:null}),l=s.form,u=s.baseline,[d,f]=(0,Z.useState)(!1),[ee,m]=(0,Z.useState)(null),h=(0,Z.useRef)(!1),g=(0,Z.useRef)(null);ae({enabled:e,parsed:i,dirty:h.current,trackedParsedRef:g,dispatch:c,onResetDirty:()=>{h.current=!1}});let _=l&&u&&JSON.stringify(l)!==JSON.stringify(u),v=(0,Z.useCallback)(e=>{h.current=!0,c({type:`patch`,patch:e})},[]);return!e||!l?r?(0,Q.jsx)(X,{children:(0,Q.jsx)(U,{className:`size-4 animate-spin text-fg-muted`})}):null:(0,Q.jsxs)(X,{children:[(0,Q.jsx)(pe,{icon:E,title:t.title,subtitle:t.hint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex justify-end gap-2`,children:[(0,Q.jsx)(p,{type:`button`,variant:`secondary`,disabled:!_||d,onClick:()=>c({type:`discard`}),children:t.discard}),(0,Q.jsx)(p,{type:`button`,variant:`primary`,disabled:!_||d,onClick:()=>{(async()=>{f(!0),m(null);try{await Te(l),h.current=!1,c({type:`saved`,value:l})}catch(e){m(e instanceof Error?e.message:t.saveError)}finally{f(!1)}})()},children:d?t.saving:t.save})]}),ee?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:ee}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(L,{className:Ee(),value:l.dmScope,onChange:e=>v({dmScope:e.target.value}),children:[(0,Q.jsx)(J,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(J,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(J,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(J,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(`input`,{type:`number`,min:0,className:Ee(),value:l.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();v({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(`input`,{type:`number`,min:1,className:Ee(),value:l.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();v({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function ke(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function Ae(e){let t=(0,ge.c)(60),{open:n,loading:r,session:a,sessionAgentId:o,sessionAgentAvatar:s,labels:c,onClose:l,onArchive:u,onUnarchive:d,onPin:f,onUnpin:ee,onExport:m,onDelete:h}=e,_=a?.status===`archived`,v=a?.status===`pinned`,y;t[0]===l?y=t[1]:(y=e=>!e&&l(),t[0]=l,t[1]=y);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ce,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,j)}),t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=i(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,de,`dark:border-edge`),t[3]=x):x=t[3];let S;t[4]!==a||t[5]!==s||t[6]!==o?(S=a&&o?(0,Q.jsx)(G,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=a,t[5]=s,t[6]=o,t[7]=S):S=t[7];let C;t[8]!==c.unnamedSession||t[9]!==a?.name?(C=a?.name?.trim()||c.unnamedSession,t[8]=c.unnamedSession,t[9]=a?.name,t[10]=C):C=t[10];let te;t[11]===C?te=t[12]:(te=(0,Q.jsx)(W,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:C}),t[11]=C,t[12]=te);let w;t[13]!==S||t[14]!==te?(w=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[S,te]}),t[13]=S,t[14]=te,t[15]=w):w=t[15];let ne;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(g,{className:`size-5`,strokeWidth:1.75}),t[16]=ne):ne=t[16];let T;t[17]===c.close?T=t[18]:(T=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(p,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":c.close,children:ne})}),t[17]=c.close,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]!==c.detailLoading||t[23]!==c.detailMessages||t[24]!==r||t[25]!==a?(D=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.detailLoading}):a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:a.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[a.messageCount,` msgs · `,a.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:c.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:a.messages.map(je)})]}):null,t[22]=c.detailLoading,t[23]=c.detailMessages,t[24]=r,t[25]=a,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:D}),t[27]=D,t[28]=O);let k;t[29]!==c.detailExport||t[30]!==m?(k=(0,Q.jsx)(p,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:c.detailExport}),t[29]=c.detailExport,t[30]=m,t[31]=k):k=t[31];let A;t[32]!==_||t[33]!==c.archive||t[34]!==c.unarchive||t[35]!==u||t[36]!==d?(A=_?(0,Q.jsx)(p,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:c.unarchive}):(0,Q.jsx)(p,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:u,children:c.archive}),t[32]=_,t[33]=c.archive,t[34]=c.unarchive,t[35]=u,t[36]=d,t[37]=A):A=t[37];let M;t[38]!==v||t[39]!==c.pin||t[40]!==c.unpin||t[41]!==f||t[42]!==ee?(M=v?(0,Q.jsx)(p,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:ee,children:c.unpin}):(0,Q.jsx)(p,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:c.pin}),t[38]=v,t[39]=c.pin,t[40]=c.unpin,t[41]=f,t[42]=ee,t[43]=M):M=t[43];let N;t[44]!==c.delete||t[45]!==h?(N=(0,Q.jsx)(p,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:h,children:c.delete}),t[44]=c.delete,t[45]=h,t[46]=N):N=t[46];let F;t[47]!==k||t[48]!==A||t[49]!==M||t[50]!==N?(F=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k,A,M,N]})}),t[47]=k,t[48]=A,t[49]=M,t[50]=N,t[51]=F):F=t[51];let I;t[52]!==E||t[53]!==O||t[54]!==F?(I=(0,Q.jsxs)(R,{children:[b,(0,Q.jsxs)(K,{className:x,"aria-describedby":void 0,children:[E,O,F]})]}),t[52]=E,t[53]=O,t[54]=F,t[55]=I):I=t[55];let L;return t[56]!==n||t[57]!==y||t[58]!==I?(L=(0,Q.jsx)(re,{open:n,onOpenChange:y,children:I}),t[56]=n,t[57]=y,t[58]=I,t[59]=L):L=t[59],L}function je(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ke(e.content)})]},`${e.timestamp??``}-${e.role}-${ke(e.content).slice(0,24)}`)}var Me=20;function Ne(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var Pe=new Set([`all`,`active`,`pinned`,`archived`]),Fe=new Set([`grid`,`list`]),Ie=[`sessions`,`settings`];function Le(e){return e&&Ie.includes(e)?e:`sessions`}function Re(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function ze(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function Be(e){let t=(0,ge.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Ie.map(e=>({id:e,label:Re(n,e),icon:e===`sessions`?V:ue})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(h,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function Ve(e){let t=(0,ge.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-2xl border border-edge bg-surface-base px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:Re(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:ze(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function He(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:Pe.has(t)?t:`all`,viewMode:Fe.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function Ue(){let e=a(o(e=>e.language)),t=e.sessions,n=s(e=>e.token),r=!!n,{data:c,mutate:l}=u(r?[`gateway-chat-agents`,n]:null,ie,{revalidateOnFocus:!1}),d=c?.defaultId??`main`,h=c?.items??[],[g,y]=C(),b=Le(g.get(`tab`)),te=(0,Z.useCallback)(e=>{let t=new URLSearchParams(g);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),y(t,{replace:!0})},[g,y]),[ne,T]=(0,Z.useReducer)(le,g,He),{searchInput:E,debouncedSearch:k,statusFilter:M,viewMode:P,channelFilter:L,sessions:z,loading:B,error:ae,hasMore:U,stats:G,detailOpen:J,detailLoading:ue,detailSession:Y,confirmOpen:pe,confirmKey:X}=ne;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=E.trim();k!==e&&T({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[E,k]);let ge=g.toString(),_e=(0,Z.useRef)(ge);if(_e.current!==ge){_e.current=ge;let e=g.get(`q`)??``,t=g.get(`status`),n=g.get(`view`),r=(g.get(`channel`)??``).trim(),i=Pe.has(t)?t:`all`,a=Fe.has(n)?n:`grid`,o=e.trim();T({type:`patch`,patch:{...E===e?{}:{searchInput:e},...k===o?{}:{debouncedSearch:o},...M===i?{}:{statusFilter:i},...P===a?{}:{viewMode:a},...L===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(g),t=k.trim();t?e.set(`q`,t):e.delete(`q`),M===`all`?e.delete(`status`):e.set(`status`,M),P===`grid`?e.delete(`view`):e.set(`view`,P),L?e.set(`channel`,L):e.delete(`channel`),e.toString()!==g.toString()&&y(e,{replace:!0})},[k,g,y,M,P,L]),(0,Z.useEffect)(()=>{if(!r||b!==`sessions`)return;let e=!1;return(async()=>{T({type:`patch`,patch:{loading:!0,error:null}});try{let t=await D({limit:Me,offset:0,...k?{search:k}:{},...M===`all`?{}:{status:M},...L?{channel:L}:{}});if(e)return;T({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||T({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||T({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,b,k,M,L,t.loadError]),(0,Z.useEffect)(()=>{!r||b!==`sessions`||O().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,b]),(0,Z.useEffect)(()=>{if(!r||b!==`sessions`)return;let e=()=>void l();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,b,l]),(0,Z.useEffect)(()=>{if(!r||b!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||T({type:`patch`,patch:{sessions:z.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:Y&&Y.key===t.key?{...Y,name:t.name}:Y}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,b,z,Y]);let ve=(0,Z.useCallback)(async()=>{if(!(!r||B||!U)){T({type:`patch`,patch:{loading:!0,error:null}});try{let e=await D({limit:Me,offset:z.length,...k?{search:k}:{},...M===`all`?{}:{status:M},...L?{channel:L}:{}});T({type:`patch`,patch:{sessions:[...z,...e.items],hasMore:e.hasMore}})}catch(e){T({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{T({type:`patch`,patch:{loading:!1}})}}},[r,B,U,z.length,k,M,L,t.loadError]),be=(0,Z.useCallback)((e,t)=>{T({type:`patch`,patch:{sessions:z.map(n=>n.key===e?{...n,status:t}:n),detailSession:Y&&Y.key===e?{...Y,status:t}:Y}})},[z,Y]),xe=(0,Z.useCallback)(async e=>{T({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{T({type:`patch`,patch:{detailSession:await _(e)}})}catch{T({type:`patch`,patch:{detailOpen:!1}})}finally{T({type:`patch`,patch:{detailLoading:!1}})}},[]),Se=e=>{xe(e)},$=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){T({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await m(e),be(e,`archived`);break;case`unarchive`:await f(e),be(e,`active`);break;case`pin`:await A(e),be(e,`pinned`);break;case`unpin`:await F(e),be(e,`active`);break;case`export`:{let t=await se(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}O().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce=async e=>{try{await v(e),T({type:`patch`,patch:{sessions:z.filter(t=>t.key!==e),detailSession:Y?.key===e?null:Y,...Y?.key===e?{detailOpen:!1}:{}}}),O().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},we={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},Te={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Ee=[{key:`all`,label:t.filterAll,icon:V},{key:`active`,label:t.filterActive,icon:oe},{key:`pinned`,label:t.filterPinned,icon:fe},{key:`archived`,label:t.filterArchived,icon:ee}],De=(()=>{let e=Object.entries(G?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Q.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Q.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Q.jsx)(Be,{s:t,activeTab:b,onChange:te}),(0,Q.jsx)(Ve,{s:t,id:`settings`,activeTab:b,plain:!0,children:(0,Q.jsx)(Oe,{hasToken:r})}),(0,Q.jsxs)(Ve,{s:t,id:`sessions`,activeTab:b,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ee.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":M===e,onClick:()=>T({type:`patch`,patch:{statusFilter:e}}),className:i(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,S.transition,S.focusRingPanel,M===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(w,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:E,onChange:e=>T({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":k||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!L,onClick:()=>T({type:`patch`,patch:{channelFilter:``}}),className:i(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,S.transition,S.focusRingPanel,L?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),De.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":L===e,onClick:()=>T({type:`patch`,patch:{channelFilter:e}}),className:i(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,S.transition,S.focusRingPanel,L===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,G?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:G.byChannel[e]})]},e))]}),G?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[G.totalSessions,t.totalSessions],[G.activeSessions,t.activeSessions],[G.pinnedSessions,t.pinnedSessions],[G.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,ae?(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:ae}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Ne(t.sessionCount,{count:z.length})}),(0,Q.jsxs)(`div`,{className:he,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Q.jsx)(p,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":P===`grid`,onClick:()=>T({type:`patch`,patch:{viewMode:`grid`}}),className:i(me,`size-7 p-0`,P===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,P===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(I,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(p,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":P===`list`,onClick:()=>T({type:`patch`,patch:{viewMode:`list`}}),className:i(me,`size-9 p-0`,P===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,P===`list`&&`text-accent-fg`),children:(0,Q.jsx)(N,{className:`size-3.5`,strokeWidth:1.5})})]})]}),B&&z.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):z.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(x,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(p,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:i(`grid min-w-0 gap-3`,P===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":k||void 0,children:z.map(e=>{let t=H(e,d);return(0,Q.jsx)(ye,{session:e,variant:P,labels:we,sessionAgentId:t,sessionAgentAvatar:q(t,h),onOpen:()=>Se(e.key),onAction:t=>void $(e.key,t)},e.key)})}),U?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(p,{type:`button`,variant:`secondary`,disabled:B,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(Ae,{open:J,loading:ue,session:Y,sessionAgentId:Y?H(Y,d):void 0,sessionAgentAvatar:Y?q(H(Y,d),h):void 0,labels:Te,onClose:()=>{T({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>Y&&void $(Y.key,`archive`),onUnarchive:()=>Y&&void $(Y.key,`unarchive`),onPin:()=>Y&&void $(Y.key,`pin`),onUnpin:()=>Y&&void $(Y.key,`unpin`),onExport:()=>Y&&void $(Y.key,`export`),onDelete:()=>Y&&T({type:`patch`,patch:{confirmKey:Y.key,confirmOpen:!0}})}),(0,Q.jsx)(re,{open:pe,onOpenChange:e=>T({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)(ce,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,j)}),(0,Q.jsxs)(K,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,de),children:[(0,Q.jsx)(W,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:X?Ne(t.deleteSessionMessage,{name:z.find(e=>e.key===X)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(p,{type:`button`,variant:`secondary`,onClick:()=>T({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(p,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{X&&Ce(X),T({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{Ue as SessionsPage};
@@ -0,0 +1 @@
1
+ import{Qn as e}from"./index-T0SaNd5a.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};