@xopcai/xopc 0.0.248 → 0.0.249

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 (452) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-etpmyV7S.js → activity-store-B759R_qf.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BmKxSM1k.js → agent-avatar-dicebear-BUu7EnwM.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C1rXNUAG.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-DK9HjHO0.js +1 -0
  7. package/dist/gateway/static/root/assets/{api-B0-hLuZ1.js → api-Cg0v7Lpn.js} +1 -1
  8. package/dist/gateway/static/root/assets/app-management-settings-panel-C9DkCW_d.js +1 -0
  9. package/dist/gateway/static/root/assets/appearance-settings-CFggS95Y.js +1 -0
  10. package/dist/gateway/static/root/assets/apps-page-jOvT-fzU.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-BnMSgZvR.js → archive-plugin-BQrilVVv.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-CejsQMev.js → attachment-load-BG0BliqV.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-RC8EyoAf.js → automations-page-Bo4RiTkh.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-BKjKTlW8.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-DGjppLSG.js → binary-plugins-BCnyNU0C.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-CWdP4bUc.js → block-editor-Db8DlVvg.js} +50 -50
  17. package/dist/gateway/static/root/assets/browser-settings-page-Dzq18pO1.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-BQ1Ilw_o.js → browser-workflow-inputs-C71vfl0b.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-CJh4NyxT.js → browser-workflows-page-vvmSYKsO.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DW4SBQf4.js +7 -0
  21. package/dist/gateway/static/root/assets/channels-settings-57OGuewD.js +1 -0
  22. package/dist/gateway/static/root/assets/{channels-status-swr-Ohhee4vm.js → channels-status-swr-CKyV3jY5.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-BOtoKTK3.js → chat-terminal-dock-B1Xd6OFB.js} +2 -2
  24. package/dist/gateway/static/root/assets/connectors-page-CT_I3kbR.js +2 -0
  25. package/dist/gateway/static/root/assets/{cron-expression-DTj1V3Sw.js → cron-expression-D-F9vjtE.js} +1 -1
  26. package/dist/gateway/static/root/assets/{date-picker-Yr6OCvGL.js → date-picker-B2OoYvic.js} +1 -1
  27. package/dist/gateway/static/root/assets/dependency-picker-BiGx9Sbj.js +1 -0
  28. package/dist/gateway/static/root/assets/{desktop-pet-DbGzggPF.js → desktop-pet-BNMRqipe.js} +1 -1
  29. package/dist/gateway/static/root/assets/desktop-pet-settings-DeYbIV7A.js +1 -0
  30. package/dist/gateway/static/root/assets/{extension-debug-page-DgTtk4KC.js → extension-debug-page-COyn05ub.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-DtQeiP6f.js → extension-page-oH43chS2.js} +1 -1
  32. package/dist/gateway/static/root/assets/extension-settings-page-BMO59994.js +1 -0
  33. package/dist/gateway/static/root/assets/gateway-config-api-cimpViGk.js +1 -0
  34. package/dist/gateway/static/root/assets/{gateway-config-swr-DXuXtU1w.js → gateway-config-swr-BGdHwT4e.js} +1 -1
  35. package/dist/gateway/static/root/assets/gateway-settings-BHJtnSic.js +1 -0
  36. package/dist/gateway/static/root/assets/{gateway-startup-retry-CzBzglzQ.js → gateway-startup-retry-CuaM3b4c.js} +1 -1
  37. package/dist/gateway/static/root/assets/heartbeat-settings-DNhrZHqx.js +1 -0
  38. package/dist/gateway/static/root/assets/home-page-BiHwiBnQ.js +1 -0
  39. package/dist/gateway/static/root/assets/{image-generation-api-TIgsn04n.js → image-generation-api-D7duj7Uj.js} +1 -1
  40. package/dist/gateway/static/root/assets/index-DGeGmj4k.css +2 -0
  41. package/dist/gateway/static/root/assets/index-aBs0EfQB.js +72 -0
  42. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-wsWuoa8p.js → keyboard-shortcuts-settings-D8Zw_lYd.js} +1 -1
  43. package/dist/gateway/static/root/assets/{local-app-workbench-page-CpyvYyrb.js → local-app-workbench-page-eBFVWmtH.js} +2 -2
  44. package/dist/gateway/static/root/assets/{local-apps-page-CXrbrGo8.js → local-apps-page-CvPDPRwb.js} +1 -1
  45. package/dist/gateway/static/root/assets/{locale-store-BJFLQY8O.js → locale-store-zEL8bkwx.js} +1 -1
  46. package/dist/gateway/static/root/assets/logs-page-ClvcWlL6.js +2 -0
  47. package/dist/gateway/static/root/assets/{management-settings-BdJZFR7U.js → management-settings-D8moh99U.js} +1 -1
  48. package/dist/gateway/static/root/assets/{markdown-split-NK3ACVG2.js → markdown-split-D7V3j0vE.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-view-DTF9v1gg.js → markdown-view-DGRN-8wP.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-F0jcUxyl.js → media-plugins-BLaE5b1Y.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-W5P19VTF.js +11 -0
  52. package/dist/gateway/static/root/assets/mobile-pairing-wizard-DiVDuCxl.js +1 -0
  53. package/dist/gateway/static/root/assets/note-detail-panel-CEEvR-fV.js +5 -0
  54. package/dist/gateway/static/root/assets/notes-page-BLqgXNCx.js +8 -0
  55. package/dist/gateway/static/root/assets/page-tabs-BFMGjA60.js +1 -0
  56. package/dist/gateway/static/root/assets/preview-open-alternatives-DNEWZN7H.js +1 -0
  57. package/dist/gateway/static/root/assets/{product-open-page-CxGGlWA8.js → product-open-page-Co5u7asH.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-CIiFJ5tk.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-B3UF-Pfm.js +1 -0
  60. package/dist/gateway/static/root/assets/{registry-api-CIsNlSBi.js → registry-api-Cg92zSod.js} +1 -1
  61. package/dist/gateway/static/root/assets/remote-access-hub-BUtpkJPG.js +1 -0
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-YkjhiQfA.js → runtime-tools-settings-panel-C0ByNmlV.js} +2 -2
  63. package/dist/gateway/static/root/assets/{schema-form-oFGf3G3s.js → schema-form-Dq_VQpuY.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-UgJmG-V4.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-DDCzpdkl.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-form-section-CZu6FX4k.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-page-C7VWs0IT.js → settings-page-S8ekeUZd.js} +1 -1
  68. package/dist/gateway/static/root/assets/setup-status-panel-BdVmwXMv.js +1 -0
  69. package/dist/gateway/static/root/assets/{share-preview-page-t5oz18rh.js → share-preview-page-D2fEidbn.js} +1 -1
  70. package/dist/gateway/static/root/assets/shares-settings-BdsqnCYj.js +1 -0
  71. package/dist/gateway/static/root/assets/skill-reload-api-ghzAQKna.js +1 -0
  72. package/dist/gateway/static/root/assets/skills-page-AYiPlgZE.js +2 -0
  73. package/dist/gateway/static/root/assets/{skills-page.utils-DEDTYs2W.js → skills-page.utils-DGzl-ib-.js} +1 -1
  74. package/dist/gateway/static/root/assets/system-settings-panel-5Xd5mIiR.js +1 -0
  75. package/dist/gateway/static/root/assets/task-detail-page-BQAUaCDD.js +1 -0
  76. package/dist/gateway/static/root/assets/{theme-store-O597U8q_.js → theme-store-ZVClZKQ0.js} +1 -1
  77. package/dist/gateway/static/root/assets/tunnel-api-CdZN1Jin.js +1 -0
  78. package/dist/gateway/static/root/assets/{use-autosave-B5eUJ6Zq.js → use-autosave-czRI0NBc.js} +1 -1
  79. package/dist/gateway/static/root/assets/user-model-page-W3GTm6nA.js +2 -0
  80. package/dist/gateway/static/root/assets/{voice-api-key-field-CMKSwz4C.js → voice-api-key-field-8YEvA3cU.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-config-api-q7B6fOFB.js → voice-config-api-CopF64lY.js} +1 -1
  82. package/dist/gateway/static/root/assets/work-discovery-overlay-keLtqYYJ.js +1 -0
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DZmvLZjb.js → workflow-run-setup-panel-Dy5WgYMO.js} +2 -2
  84. package/dist/gateway/static/root/assets/workflows-page-BbAV3h7n.js +5 -0
  85. package/dist/gateway/static/root/index.html +10 -26
  86. package/dist/package.js +1 -1
  87. package/dist/src/agent/agent-instance-gateway.d.ts +2 -2
  88. package/dist/src/agent/agent-manager.d.ts +4 -4
  89. package/dist/src/agent/agent-manager.js +31 -15
  90. package/dist/src/agent/background-review/coordinator.d.ts +2 -4
  91. package/dist/src/agent/background-review/coordinator.js +5 -30
  92. package/dist/src/agent/background-review/prompts.d.ts +4 -2
  93. package/dist/src/agent/background-review/prompts.js +24 -19
  94. package/dist/src/agent/background-review/run-background-review.d.ts +6 -7
  95. package/dist/src/agent/background-review/run-background-review.js +47 -41
  96. package/dist/src/agent/background-review/settings.d.ts +0 -1
  97. package/dist/src/agent/background-review/settings.js +6 -7
  98. package/dist/src/agent/context/audit.d.ts +36 -0
  99. package/dist/src/agent/context/audit.js +97 -0
  100. package/dist/src/agent/context/coordinator.d.ts +26 -0
  101. package/dist/src/agent/context/coordinator.js +72 -0
  102. package/dist/src/agent/context/execution-context.d.ts +54 -0
  103. package/dist/src/agent/context/execution-context.js +147 -0
  104. package/dist/src/agent/context/execution-scope.js +1 -1
  105. package/dist/src/agent/context/prepend.d.ts +2 -0
  106. package/dist/src/agent/context/prepend.js +28 -0
  107. package/dist/src/agent/context/project-context.d.ts +3 -3
  108. package/dist/src/agent/context/project-context.js +26 -23
  109. package/dist/src/agent/embedded/index.js +1 -1
  110. package/dist/src/agent/embedded/run-for-session.js +1 -0
  111. package/dist/src/agent/embedded/run-turn.js +22 -2
  112. package/dist/src/agent/embedded/types.d.ts +1 -25
  113. package/dist/src/agent/external-tools/composio-provider.js +87 -92
  114. package/dist/src/agent/external-tools/gateway-tools.d.ts +4 -1
  115. package/dist/src/agent/external-tools/gateway-tools.js +153 -41
  116. package/dist/src/agent/external-tools/index.js +1 -1
  117. package/dist/src/agent/external-tools/search-error.d.ts +12 -0
  118. package/dist/src/agent/external-tools/search-error.js +29 -0
  119. package/dist/src/agent/external-tools/service.d.ts +4 -0
  120. package/dist/src/agent/external-tools/service.js +22 -2
  121. package/dist/src/agent/memory/compaction-policy.js +1 -1
  122. package/dist/src/agent/memory/compaction-promotion.js +45 -77
  123. package/dist/src/agent/memory/create-memory-manager.js +1 -3
  124. package/dist/src/agent/memory/index.d.ts +0 -5
  125. package/dist/src/agent/memory/index.js +2 -5
  126. package/dist/src/agent/memory/manager.d.ts +0 -16
  127. package/dist/src/agent/memory/manager.js +11 -40
  128. package/dist/src/agent/memory/memory-config.js +1 -1
  129. package/dist/src/agent/memory/runtime.d.ts +2 -2
  130. package/dist/src/agent/memory/runtime.js +9 -19
  131. package/dist/src/agent/memory/types.d.ts +1 -1
  132. package/dist/src/agent/orchestration/agent-orchestrator.js +13 -21
  133. package/dist/src/agent/prompt/sections/memory-skills.js +25 -36
  134. package/dist/src/agent/prompt/sections/tooling.js +10 -4
  135. package/dist/src/agent/prompt/service-prompt-builder.js +4 -3
  136. package/dist/src/agent/service/direct-turn-helpers.js +6 -23
  137. package/dist/src/agent/service/process-direct-streaming.js +5 -3
  138. package/dist/src/agent/service.js +4 -3
  139. package/dist/src/agent/tasks/task-judge-service.js +1 -1
  140. package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
  141. package/dist/src/agent/tools/delegate-tool.js +5 -2
  142. package/dist/src/agent/tools/factory.js +36 -19
  143. package/dist/src/agent/tools/index.d.ts +3 -2
  144. package/dist/src/agent/tools/index.js +4 -3
  145. package/dist/src/agent/tools/knowledge-memory-tool.d.ts +9 -0
  146. package/dist/src/agent/tools/knowledge-memory-tool.js +129 -0
  147. package/dist/src/agent/tools/{dreaming-tool.d.ts → memory-maintenance-tool.d.ts} +2 -2
  148. package/dist/src/agent/tools/memory-maintenance-tool.js +31 -0
  149. package/dist/src/agent/tools/user-context-tool.d.ts +8 -0
  150. package/dist/src/agent/tools/user-context-tool.js +81 -0
  151. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  152. package/dist/src/chat-commands/builtins/understanding.js +24 -6
  153. package/dist/src/cli/commands/connectors.js +1 -1
  154. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  155. package/dist/src/config/schema.d.ts +68 -75
  156. package/dist/src/config/schema.js +29 -18
  157. package/dist/src/config/web-patch.d.ts +1 -1
  158. package/dist/src/connectors/auth-provider-registry.js +1 -1
  159. package/dist/src/connectors/composio-managed-client.js +6 -2
  160. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  161. package/dist/src/connectors/connected-source-understanding.d.ts +1 -3
  162. package/dist/src/connectors/connected-source-understanding.js +86 -99
  163. package/dist/src/connectors/connection-candidates.d.ts +11 -0
  164. package/dist/src/connectors/connection-candidates.js +58 -0
  165. package/dist/src/connectors/connection-capabilities.d.ts +4 -0
  166. package/dist/src/connectors/connection-capabilities.js +37 -0
  167. package/dist/src/connectors/connection-recovery-service.d.ts +42 -0
  168. package/dist/src/connectors/connection-recovery-service.js +396 -0
  169. package/dist/src/connectors/health.js +1 -1
  170. package/dist/src/connectors/learning-coordinator.d.ts +0 -2
  171. package/dist/src/connectors/learning-coordinator.js +6 -7
  172. package/dist/src/connectors/principal.d.ts +5 -0
  173. package/dist/src/connectors/principal.js +18 -0
  174. package/dist/src/gateway/agent-builtin-tools.d.ts +28 -10
  175. package/dist/src/gateway/agent-builtin-tools.js +30 -9
  176. package/dist/src/gateway/chat-stream/mapper.js +1 -28
  177. package/dist/src/gateway/chat-stream/protocol.d.ts +2 -24
  178. package/dist/src/gateway/clarify-bridge.d.ts +4 -0
  179. package/dist/src/gateway/clarify-bridge.js +9 -4
  180. package/dist/src/gateway/heartbeat/service.js +1 -1
  181. package/dist/src/gateway/hono/lib/config-payload.d.ts +52 -30
  182. package/dist/src/gateway/hono/lib/config-payload.js +4 -4
  183. package/dist/src/gateway/hono/middleware/auth.js +1 -2
  184. package/dist/src/gateway/hono/routes/capabilities.js +1 -1
  185. package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
  186. package/dist/src/gateway/hono/routes/config-patch/misc.js +72 -28
  187. package/dist/src/gateway/hono/routes/connection-waits.d.ts +3 -0
  188. package/dist/src/gateway/hono/routes/connection-waits.js +58 -0
  189. package/dist/src/gateway/hono/routes/connectors.js +7 -15
  190. package/dist/src/gateway/hono/routes/context-sources.d.ts +4 -0
  191. package/dist/src/gateway/hono/routes/context-sources.js +159 -0
  192. package/dist/src/gateway/hono/routes/index.js +4 -2
  193. package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -4
  194. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  195. package/dist/src/gateway/hono/routes/notes.js +22 -7
  196. package/dist/src/gateway/hono/routes/projects.js +36 -44
  197. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
  198. package/dist/src/gateway/hono/routes/side-chats.js +13 -2
  199. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  200. package/dist/src/gateway/hono/routes/user-model.d.ts +3 -0
  201. package/dist/src/gateway/hono/routes/user-model.js +480 -0
  202. package/dist/src/gateway/memory-maintenance-automation-reconciler.d.ts +11 -0
  203. package/dist/src/gateway/memory-maintenance-automation-reconciler.js +72 -0
  204. package/dist/src/gateway/service/agent-runner.d.ts +9 -1
  205. package/dist/src/gateway/service/agent-runner.js +25 -1
  206. package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
  207. package/dist/src/gateway/service/config-coordinator.js +4 -4
  208. package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
  209. package/dist/src/gateway/service/run-gateway-agent.js +18 -14
  210. package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
  211. package/dist/src/gateway/service/session-input-coordinator.js +12 -2
  212. package/dist/src/gateway/service.d.ts +3 -1
  213. package/dist/src/gateway/service.js +45 -14
  214. package/dist/src/gateway/side-chat/manager.d.ts +16 -3
  215. package/dist/src/gateway/side-chat/manager.js +117 -28
  216. package/dist/src/gateway/side-chat/run-service.d.ts +2 -0
  217. package/dist/src/gateway/side-chat/run-service.js +28 -5
  218. package/dist/src/gateway/side-chat/types.d.ts +9 -1
  219. package/dist/src/heartbeat/index.js +1 -1
  220. package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +0 -2
  221. package/dist/src/knowledge/connected-knowledge-pipeline.js +46 -217
  222. package/dist/src/knowledge-memory/domain.d.ts +35 -0
  223. package/dist/src/knowledge-memory/index.d.ts +2 -0
  224. package/dist/src/knowledge-memory/index.js +2 -0
  225. package/dist/src/knowledge-memory/repository.d.ts +45 -0
  226. package/dist/src/knowledge-memory/repository.js +154 -0
  227. package/dist/src/memory-maintenance/index.d.ts +2 -0
  228. package/dist/src/memory-maintenance/index.js +3 -0
  229. package/dist/src/memory-maintenance/schedule.d.ts +13 -0
  230. package/dist/src/memory-maintenance/schedule.js +51 -0
  231. package/dist/src/memory-maintenance/service.d.ts +28 -0
  232. package/dist/src/memory-maintenance/service.js +216 -0
  233. package/dist/src/notes/service.d.ts +1 -0
  234. package/dist/src/notes/service.js +7 -1
  235. package/dist/src/notes/types.d.ts +16 -0
  236. package/dist/src/proactive/execution/context.d.ts +2 -2
  237. package/dist/src/proactive/execution/context.js +16 -11
  238. package/dist/src/proactive/index.d.ts +1 -1
  239. package/dist/src/proactive/index.js +2 -2
  240. package/dist/src/projects/index.d.ts +1 -1
  241. package/dist/src/projects/index.js +2 -2
  242. package/dist/src/projects/knowledge-bind.d.ts +1 -0
  243. package/dist/src/projects/knowledge-bind.js +15 -0
  244. package/dist/src/projects/project-loop.d.ts +3 -3
  245. package/dist/src/projects/project-loop.js +4 -4
  246. package/dist/src/projects/project-store.js +2 -1
  247. package/dist/src/realtime/runtime.js +1 -0
  248. package/dist/src/runtime-tools/manager.js +1 -1
  249. package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +17 -0
  250. package/dist/src/storage/sqlite/collaboration-rule-repository.js +54 -0
  251. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +30 -0
  252. package/dist/src/storage/sqlite/connection-wait-repository.js +338 -0
  253. package/dist/src/storage/sqlite/connector-account-repository.js +1 -1
  254. package/dist/src/storage/sqlite/context-evidence-repository.d.ts +24 -0
  255. package/dist/src/storage/sqlite/context-evidence-repository.js +52 -0
  256. package/dist/src/storage/sqlite/index.d.ts +3 -5
  257. package/dist/src/storage/sqlite/index.js +4 -6
  258. package/dist/src/storage/sqlite/knowledge-repository.d.ts +0 -19
  259. package/dist/src/storage/sqlite/knowledge-repository.js +1 -90
  260. package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +554 -0
  261. package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +18 -0
  262. package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +47 -0
  263. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  264. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  265. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  266. package/dist/src/storage/sqlite/notes-repository.d.ts +2 -1
  267. package/dist/src/storage/sqlite/notes-repository.js +37 -3
  268. package/dist/src/storage/sqlite/schema.js +1 -1
  269. package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -2
  270. package/dist/src/storage/sqlite/session-input-repository.js +16 -13
  271. package/dist/src/storage/sqlite/session-repository.js +4 -1
  272. package/dist/src/storage/sqlite/transcript-repository.js +1 -1
  273. package/dist/src/tasks/index.js +2 -2
  274. package/dist/src/tasks/project-operating-view-service.js +1 -1
  275. package/dist/src/tasks/task-application-service.js +6 -1
  276. package/dist/src/tasks/task-context-assembler.js +1 -1
  277. package/dist/src/tasks/task-context-repository.d.ts +0 -1
  278. package/dist/src/tasks/task-context-repository.js +1 -1
  279. package/dist/src/tasks/task-deletion-service.js +1 -1
  280. package/dist/src/tasks/task-handoff-service.js +1 -1
  281. package/dist/src/tasks/task-read-model-projector.js +1 -1
  282. package/dist/src/tasks/task-run-coordinator.js +1 -1
  283. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  284. package/dist/src/tasks/task-run-repository.js +1 -0
  285. package/dist/src/tasks/task-signal-service.js +1 -1
  286. package/dist/src/tui/tool-summary.js +2 -1
  287. package/dist/src/tui/tui-startup-resources.js +1 -1
  288. package/dist/src/user-context/changes.d.ts +1 -1
  289. package/dist/src/user-context/config.d.ts +135 -153
  290. package/dist/src/user-context/config.js +94 -99
  291. package/dist/src/user-context/relationship-continuity.d.ts +2 -2
  292. package/dist/src/user-context/relationship-continuity.js +34 -24
  293. package/dist/src/user-context/sources/activity-clustering.d.ts +9 -3
  294. package/dist/src/user-context/sources/index.js +2 -2
  295. package/dist/src/user-context/sources/repository.d.ts +1 -21
  296. package/dist/src/user-context/sources/repository.js +1 -183
  297. package/dist/src/user-context/sources/types.d.ts +0 -23
  298. package/dist/src/user-model/capture/executor.d.ts +40 -0
  299. package/dist/src/user-model/capture/executor.js +134 -0
  300. package/dist/src/user-model/capture/index.d.ts +2 -0
  301. package/dist/src/user-model/capture/index.js +3 -0
  302. package/dist/src/user-model/capture/semantic.d.ts +21 -0
  303. package/dist/src/user-model/capture/semantic.js +197 -0
  304. package/dist/src/user-model/domain.d.ts +93 -0
  305. package/dist/src/user-model/domain.js +33 -0
  306. package/dist/src/user-model/goals.d.ts +58 -0
  307. package/dist/src/user-model/goals.js +89 -0
  308. package/dist/src/user-model/importance.d.ts +11 -0
  309. package/dist/src/user-model/importance.js +17 -0
  310. package/dist/src/user-model/index.d.ts +5 -0
  311. package/dist/src/user-model/index.js +6 -0
  312. package/dist/src/user-model/repository.d.ts +23 -0
  313. package/dist/src/user-model/repository.js +268 -0
  314. package/dist/src/user-model/temporal.d.ts +10 -0
  315. package/dist/src/user-model/temporal.js +44 -0
  316. package/dist/src/voice/realtime/memory-context.d.ts +7 -2
  317. package/dist/src/voice/realtime/memory-context.js +39 -51
  318. package/dist/src/work-discovery/service.d.ts +3 -14
  319. package/dist/src/work-discovery/service.js +138 -99
  320. package/dist/src/work-discovery/types.d.ts +3 -3
  321. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  322. package/dist/src/workflows/service/workflow-session-bridge.js +12 -20
  323. package/package.json +1 -1
  324. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CUXApfcE.js +0 -1
  325. package/dist/gateway/static/root/assets/agents-DNq_GKuc.js +0 -1
  326. package/dist/gateway/static/root/assets/app-management-settings-panel-qfwAgyhQ.js +0 -1
  327. package/dist/gateway/static/root/assets/appearance-settings-DqQVUpCC.js +0 -1
  328. package/dist/gateway/static/root/assets/apps-page-dwIqYmXk.js +0 -1
  329. package/dist/gateway/static/root/assets/automations-workspace-SkdcSZ0i.js +0 -6
  330. package/dist/gateway/static/root/assets/browser-settings-page-CKCa6TvG.js +0 -8
  331. package/dist/gateway/static/root/assets/capabilities-settings-panel-DSp--zIZ.js +0 -7
  332. package/dist/gateway/static/root/assets/channels-settings-CMd2dDrI.js +0 -1
  333. package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
  334. package/dist/gateway/static/root/assets/connectors-page-udWs5Kdm.js +0 -2
  335. package/dist/gateway/static/root/assets/dependency-picker-DpN3XZg9.js +0 -1
  336. package/dist/gateway/static/root/assets/desktop-pet-settings-DinCToZh.js +0 -1
  337. package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +0 -1
  338. package/dist/gateway/static/root/assets/extension-settings-page-DcguCgsH.js +0 -1
  339. package/dist/gateway/static/root/assets/eye-CABVeTq0.js +0 -1
  340. package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +0 -1
  341. package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +0 -1
  342. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
  343. package/dist/gateway/static/root/assets/gateway-config-api-Br7lSf6H.js +0 -1
  344. package/dist/gateway/static/root/assets/gateway-settings-CdPoDMuj.js +0 -1
  345. package/dist/gateway/static/root/assets/heartbeat-settings-DHk1hawP.js +0 -1
  346. package/dist/gateway/static/root/assets/home-page-YGipe_W6.js +0 -1
  347. package/dist/gateway/static/root/assets/index-D5TQQpeb.js +0 -71
  348. package/dist/gateway/static/root/assets/index-DReBaaTX.css +0 -2
  349. package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +0 -1
  350. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
  351. package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
  352. package/dist/gateway/static/root/assets/local-context-graph-BjUf7fQ9.js +0 -1
  353. package/dist/gateway/static/root/assets/logs-page-CXKy6E_l.js +0 -2
  354. package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
  355. package/dist/gateway/static/root/assets/messages-CHNYp8EQ.js +0 -3
  356. package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
  357. package/dist/gateway/static/root/assets/mobile-pairing-wizard-3NKCniSp.js +0 -1
  358. package/dist/gateway/static/root/assets/models-hub-cache-nCfkBN8M.js +0 -1
  359. package/dist/gateway/static/root/assets/notes-page-DuqLahi6.js +0 -1
  360. package/dist/gateway/static/root/assets/notes-workbench-C7j9EdQk.js +0 -5
  361. package/dist/gateway/static/root/assets/oauth-api-8lP_qJpq.js +0 -1
  362. package/dist/gateway/static/root/assets/oauth-authorization-window-Cdolr2wE.js +0 -1
  363. package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +0 -1
  364. package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
  365. package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +0 -1
  366. package/dist/gateway/static/root/assets/project-detail-page-CfebYVX0.js +0 -1
  367. package/dist/gateway/static/root/assets/projects-page-48GvzSVa.js +0 -1
  368. package/dist/gateway/static/root/assets/remote-access-hub-64xj_s2m.js +0 -1
  369. package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
  370. package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
  371. package/dist/gateway/static/root/assets/sessions-page-CcwcdRN8.js +0 -1
  372. package/dist/gateway/static/root/assets/settings-advanced-gate-BaN84CyW.js +0 -1
  373. package/dist/gateway/static/root/assets/settings-form-section-DjWzRk4z.js +0 -1
  374. package/dist/gateway/static/root/assets/setup-status-panel-DVVOCNbr.js +0 -1
  375. package/dist/gateway/static/root/assets/shares-settings-DUYbYLi7.js +0 -1
  376. package/dist/gateway/static/root/assets/skill-reload-api-BGyD0gB9.js +0 -1
  377. package/dist/gateway/static/root/assets/skills-page-CjF8DTsN.js +0 -2
  378. package/dist/gateway/static/root/assets/system-settings-panel-BSYuRgFI.js +0 -1
  379. package/dist/gateway/static/root/assets/task-detail-page-YZYSTJH7.js +0 -1
  380. package/dist/gateway/static/root/assets/tunnel-api-FKUi9wDL.js +0 -1
  381. package/dist/gateway/static/root/assets/user-context-page-BCyiduKd.js +0 -2
  382. package/dist/gateway/static/root/assets/work-discovery-overlay-jhT2EzeH.js +0 -1
  383. package/dist/gateway/static/root/assets/workflows-page-DQC0TpMa.js +0 -5
  384. package/dist/src/agent/memory/builtin-provider.d.ts +0 -37
  385. package/dist/src/agent/memory/builtin-provider.js +0 -225
  386. package/dist/src/agent/memory/context/types.d.ts +0 -40
  387. package/dist/src/agent/memory/understanding/quality.d.ts +0 -8
  388. package/dist/src/agent/memory/understanding/quality.js +0 -18
  389. package/dist/src/agent/memory/understanding/service.d.ts +0 -19
  390. package/dist/src/agent/memory/understanding/service.js +0 -209
  391. package/dist/src/agent/memory/understanding/types.d.ts +0 -34
  392. package/dist/src/agent/memory/understanding/types.js +0 -1
  393. package/dist/src/agent/memory/user-context-coordinator.d.ts +0 -23
  394. package/dist/src/agent/memory/user-context-coordinator.js +0 -113
  395. package/dist/src/agent/tools/dreaming-tool.js +0 -37
  396. package/dist/src/agent/tools/memory-tool.d.ts +0 -9
  397. package/dist/src/agent/tools/memory-tool.js +0 -119
  398. package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -11
  399. package/dist/src/gateway/dreaming-automation-reconciler.js +0 -63
  400. package/dist/src/gateway/hono/routes/understanding-sources.d.ts +0 -21
  401. package/dist/src/gateway/hono/routes/understanding-sources.js +0 -387
  402. package/dist/src/gateway/hono/routes/you.d.ts +0 -3
  403. package/dist/src/gateway/hono/routes/you.js +0 -457
  404. package/dist/src/projects/memory-bind.d.ts +0 -1
  405. package/dist/src/projects/memory-bind.js +0 -14
  406. package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +0 -37
  407. package/dist/src/storage/sqlite/context-consolidation-repository.js +0 -64
  408. package/dist/src/storage/sqlite/memory-records-repository.d.ts +0 -217
  409. package/dist/src/storage/sqlite/memory-records-repository.js +0 -715
  410. package/dist/src/storage/sqlite/remote-context-repository.d.ts +0 -3
  411. package/dist/src/storage/sqlite/remote-context-repository.js +0 -40
  412. package/dist/src/storage/sqlite/understanding-focus-exclusions.d.ts +0 -2
  413. package/dist/src/storage/sqlite/understanding-focus-exclusions.js +0 -24
  414. package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +0 -49
  415. package/dist/src/storage/sqlite/user-context-quality-repository.js +0 -118
  416. package/dist/src/storage/sqlite/user-context-repository.d.ts +0 -85
  417. package/dist/src/storage/sqlite/user-context-repository.js +0 -535
  418. package/dist/src/user-context/automatic-context.d.ts +0 -17
  419. package/dist/src/user-context/automatic-context.js +0 -85
  420. package/dist/src/user-context/consolidation.d.ts +0 -27
  421. package/dist/src/user-context/consolidation.js +0 -187
  422. package/dist/src/user-context/context-objects.d.ts +0 -17
  423. package/dist/src/user-context/context-objects.js +0 -99
  424. package/dist/src/user-context/evaluation/harness.d.ts +0 -13
  425. package/dist/src/user-context/evaluation/harness.js +0 -31
  426. package/dist/src/user-context/extraction/executor.d.ts +0 -22
  427. package/dist/src/user-context/extraction/executor.js +0 -142
  428. package/dist/src/user-context/extraction/repair.d.ts +0 -19
  429. package/dist/src/user-context/extraction/repair.js +0 -71
  430. package/dist/src/user-context/extraction/semantic.d.ts +0 -18
  431. package/dist/src/user-context/extraction/semantic.js +0 -148
  432. package/dist/src/user-context/focus-lifecycle.d.ts +0 -2
  433. package/dist/src/user-context/focus-lifecycle.js +0 -26
  434. package/dist/src/user-context/manual-understanding.d.ts +0 -12
  435. package/dist/src/user-context/manual-understanding.js +0 -37
  436. package/dist/src/user-context/planner.d.ts +0 -17
  437. package/dist/src/user-context/planner.js +0 -465
  438. package/dist/src/user-context/relationships/indexer.d.ts +0 -13
  439. package/dist/src/user-context/relationships/indexer.js +0 -185
  440. package/dist/src/user-context/relationships/service.d.ts +0 -22
  441. package/dist/src/user-context/relationships/service.js +0 -50
  442. package/dist/src/user-context/retriever.d.ts +0 -15
  443. package/dist/src/user-context/retriever.js +0 -124
  444. package/dist/src/user-context/scope.d.ts +0 -7
  445. package/dist/src/user-context/scope.js +0 -9
  446. package/dist/src/user-context/selection-policy.d.ts +0 -20
  447. package/dist/src/user-context/selection-policy.js +0 -33
  448. package/dist/src/user-context/understanding.d.ts +0 -15
  449. package/dist/src/user-context/understanding.js +0 -24
  450. package/dist/src/user-context/understandingQuality.d.ts +0 -5
  451. package/dist/src/user-context/understandingQuality.js +0 -48
  452. /package/dist/src/{agent/memory/context/types.js → knowledge-memory/domain.js} +0 -0
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./message-square-plus-XP0tGdlV.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./x-B_N4OPjy.js";import{n as g,s as _}from"./locale-store-BJFLQY8O.js";import{t as v}from"./cn-JdwAhgNB.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{t as b}from"./button-CtTvuElV.js";import{t as x}from"./skeleton-BwbyijEw.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as w}from"./settings-shell-layer-context-DCp6ykjQ.js";import{Ds as T,Gt as E,Hs as D,Jt as O,Kt as k,P as A,Pi as j,il as M,ql as N,qt as P,tc as F,xs as I}from"./index-D5TQQpeb.js";import{n as ee,r as L}from"./settings-page-layout-BRQNel6r.js";var R=n(),z=e(t(),1),B=r(),te=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],V=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function H(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function U(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function W(e){let t=(0,R.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,B.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function G(e){let t=(0,R.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,B.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,B.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,B.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function K(e){let t=(0,R.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,B.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,B.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,B.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function q(e){let t=(0,R.c)(56),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,onChange:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=i!=null,f;t[0]===n?f=t[1]:(f=(0,B.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=f);let p;t[2]!==i||t[3]!==a?(p=i===void 0?(0,B.jsx)(W,{children:a?`继承`:`Inherited`}):null,t[2]=i,t[3]=a,t[4]=p):p=t[4];let m;t[5]!==u||t[6]!==i||t[7]!==a?(m=i===null?(0,B.jsx)(W,{children:u?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[5]=u,t[6]=i,t[7]=a,t[8]=m):m=t[8];let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==r?.primary||t[14]!==i||t[15]!==a?(g=i===void 0?(0,B.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[13]=r?.primary,t[14]=i,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==c||t[21]!==i||t[22]!==a?(v=i===void 0?null:(0,B.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(void 0),children:a?`继承`:`Inherit`}),t[20]=c,t[21]=i,t[22]=a,t[23]=v):v=t[23];let y;t[24]!==l||t[25]!==c||t[26]!==i||t[27]!==a?(y=l&&i!==null?(0,B.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`使用 Chat`:`Use Chat`}):null,t[24]=l,t[25]=c,t[26]=i,t[27]=a,t[28]=y):y=t[28];let x;t[29]!==u||t[30]!==c||t[31]!==i||t[32]!==a?(x=u&&i!==null?(0,B.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`禁用`:`Disable`}):null,t[29]=u,t[30]=c,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;t[34]!==d||t[35]!==r?.fallbacks||t[36]!==r?.primary||t[37]!==c||t[38]!==a?(S=d?null:(0,B.jsx)(b,{className:`px-2 py-1 text-xs`,onClick:()=>c({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[34]=d,t[35]=r?.fallbacks,t[36]=r?.primary,t[37]=c,t[38]=a,t[39]=S):S=t[39];let C;t[40]!==y||t[41]!==x||t[42]!==S||t[43]!==v?(C=(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[v,y,x,S]}),t[40]=y,t[41]=x,t[42]=S,t[43]=v,t[44]=C):C=t[44];let w;t[45]!==C||t[46]!==_?(w=(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[_,C]}),t[45]=C,t[46]=_,t[47]=w):w=t[47];let T;t[48]!==d||t[49]!==c||t[50]!==i||t[51]!==a?(T=d?(0,B.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`主模型`:`Primary model`,(0,B.jsx)(`input`,{className:`${V} mt-1.5 font-mono`,value:i.primary,onChange:e=>c({...i,primary:e.target.value})})]}),(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`回退模型`:`Fallbacks`,(0,B.jsx)(`input`,{className:`${V} mt-1.5 font-mono`,value:i.fallbacks.join(`, `),onChange:e=>c({...i,fallbacks:H(e.target.value)}),placeholder:a?`逗号分隔`:`Comma separated`})]})]}):null,t[48]=d,t[49]=c,t[50]=i,t[51]=a,t[52]=T):T=t[52];let E;return t[53]!==w||t[54]!==T?(E=(0,B.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[w,T]}),t[53]=w,t[54]=T,t[55]=E):E=t[55],E}function J(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Y({agent:e,toolIds:t,zh:n,externalError:r,onDirtyChange:i,onClose:a,onOpenDefaults:o,onChat:s,onDelete:c}){let[l,u]=(0,z.useState)(`overview`),[d,f]=(0,z.useState)(()=>structuredClone(e.override)),[m,h]=(0,z.useState)(!1),[g,_]=(0,z.useState)(null),y=JSON.stringify(d)!==JSON.stringify(e.override),x=[d.models?.chat,...Object.values(d.models?.intents??{}),d.models?.imageUnderstanding,d.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,z.useEffect)(()=>i(y),[y,i]);let S=(0,z.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(d.tools??{})])].sort(),[e.effective.tools,d.tools,t]),C=[d.models?n?`模型`:`Models`:null,d.skills?n?`技能`:`Skills`:null,d.tools?n?`工具权限`:`Tool access`:null,d.runtime||d.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),w=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,E=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,k=async()=>{h(!0),_(null);try{let t=(await O(e.id,{workspace:d.workspace??null,profile:d.profile,models:d.models??null,skills:d.skills??null,tools:d.tools??null,workflows:d.workflows??null,runtime:d.runtime??null})).agents.find(t=>t.id===e.id);t&&f(structuredClone(t.override))}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},A=async()=>{h(!0),_(null);try{await O(e.id,{setDefault:!0})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},j=(e,t)=>{let n={...d.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},f({...d,tools:Object.keys(n).length>0?n:void 0})},P=(e,t)=>{let n={...d.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,f({...d,models:Object.keys(n).length>0?n:void 0})};return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,B.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,B.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:M},{id:`profile`,label:n?`个性`:`Profile`,icon:I},{id:`models`,label:n?`模型`:`Models`,icon:D},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:N},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:M},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:T}].map(({id:e,label:t,icon:n})=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:v(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,l===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,B.jsx)(n,{className:`size-4`}),t]},e))})}),(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,B.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[g||r?(0,B.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:g??r}):null,l===`overview`?(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(G,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。Agent 未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,B.jsxs)(b,{onClick:s,children:[(0,B.jsx)(p,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:C.length>0?n?`已自定义:${C.join(`、`)}`:`Customized: ${C.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:C.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个 Agent 会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,B.jsx)(b,{onClick:o,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsx)(K,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:d.models?.chat?n?`Agent 覆盖`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,B.jsx)(K,{label:n?`技能`:`Skills`,value:E,detail:d.skills?n?`Agent 覆盖`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,B.jsx)(K,{label:n?`工具权限`:`Tool access`,value:w>0?n?`${w} 个禁用`:`${w} denied`:n?`全部可用`:`All available`,detail:d.tools?n?`${Object.keys(d.tools).length} 个本地覆盖`:`${Object.keys(d.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,B.jsx)(K,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:d.workspace?n?`Agent 自定义`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,B.jsx)(b,{onClick:()=>void A(),disabled:m,children:n?`设为默认 Agent`:`Make default agent`})]}):null,l===`profile`?(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(G,{title:n?`个性与工作区`:`Profile and workspace`,description:n?`这里只放这个 Agent 独有的身份、表达方式和工作目录。`:`Keep only this agent’s identity, behavior, and workspace here.`}),(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,B.jsx)(`input`,{className:`${V} mt-1.5`,value:d.profile?.name??``,onChange:e=>f({...d,profile:{name:e.target.value,...d.profile?.instructions?{instructions:d.profile.instructions}:{}}})})]}),(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n?`工作区`:`Workspace`,d.workspace?null:(0,B.jsx)(W,{children:n?`自动`:`Automatic`})]}),(0,B.jsx)(`input`,{className:`${V} mt-1.5 font-mono`,value:d.workspace??``,placeholder:e.effective.workspace,onChange:e=>f({...d,workspace:e.target.value||void 0})})]})]}),(0,B.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`个性指令`:`Personality instructions`,(0,B.jsx)(`textarea`,{rows:10,className:`${V} mt-1.5 resize-y leading-6`,value:d.profile?.instructions??``,onChange:t=>f({...d,profile:{name:d.profile?.name||e.name,instructions:t.target.value||void 0}}),placeholder:n?`描述角色、语气、判断偏好和工作方式`:`Describe the role, tone, judgment preferences, and working style`})]})]}):null,l===`models`?(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(G,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:d.models?(0,B.jsxs)(b,{variant:`ghost`,onClick:()=>f({...d,models:void 0}),children:[(0,B.jsx)(F,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,B.jsx)(q,{label:`Chat`,inherited:e.effective.models.chat,value:d.models?.chat,zh:n,onChange:e=>{let t={...d.models??{}};e?t.chat=e:delete t.chat,f({...d,models:Object.keys(t).length>0?t:void 0})}}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,B.jsx)(`div`,{className:`space-y-3`,children:te.map(t=>(0,B.jsx)(q,{label:t,inherited:e.effective.models.intents[t]??e.effective.models.chat,value:d.models?.intents?.[t],zh:n,allowChatFallback:!0,onChange:e=>P(t,e)},t))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(q,{label:n?`图片理解`:`Image understanding`,inherited:e.effective.models.imageUnderstanding,value:d.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...d.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,f({...d,models:Object.keys(t).length>0?t:void 0})}}),(0,B.jsx)(q,{label:n?`图片生成`:`Image generation`,inherited:e.effective.models.imageGeneration,value:d.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...d.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:d.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:d.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},f({...d,models:Object.keys(n).length>0?n:void 0})}}),d.models?.imageGeneration?(0,B.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,B.jsx)(`input`,{type:`number`,min:1,className:`${V} mt-1.5`,value:d.models.imageGeneration.timeoutMs??``,onChange:e=>f({...d,models:{...d.models,imageGeneration:{...d.models.imageGeneration,timeoutMs:U(e.target.value)}}})})]}),(0,B.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,B.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,B.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>f({...d,models:{...d.models,imageGeneration:{...d.models.imageGeneration,autoProviderFallback:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,l===`capabilities`?(0,B.jsxs)(`div`,{className:`space-y-7`,children:[(0,B.jsx)(G,{title:n?`技能与工具`:`Skills and tools`,description:n?`保持继承即可获得全局能力;只有确实不同的 Agent 才需要覆盖。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:d.skills?n?`当前使用 Agent 覆盖`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),d.skills?(0,B.jsxs)(b,{variant:`ghost`,onClick:()=>f({...d,skills:void 0}),children:[(0,B.jsx)(F,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,B.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,B.jsx)(b,{variant:d.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>f({...d,skills:{mode:`merge`,add:[],remove:[]}}),children:`Merge`}),(0,B.jsx)(b,{variant:d.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>f({...d,skills:{mode:`replace`,include:[]}}),children:`Replace`})]}),d.skills?.mode===`merge`?(0,B.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,B.jsx)(`input`,{className:`${V} mt-1.5`,value:d.skills.add.join(`, `),onChange:e=>f({...d,skills:{mode:`merge`,add:H(e.target.value),remove:d.skills?.mode===`merge`?d.skills.remove:[]}})})]}),(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,B.jsx)(`input`,{className:`${V} mt-1.5`,value:d.skills.remove.join(`, `),onChange:e=>f({...d,skills:{mode:`merge`,add:d.skills?.mode===`merge`?d.skills.add:[],remove:H(e.target.value)}})})]})]}):null,d.skills?.mode===`replace`?(0,B.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,B.jsx)(`input`,{className:`${V} mt-1.5`,value:d.skills.include.join(`, `),onChange:e=>f({...d,skills:{mode:`replace`,include:H(e.target.value)}})})]}):null]}),(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),d.tools?(0,B.jsxs)(b,{variant:`ghost`,onClick:()=>f({...d,tools:void 0}),children:[(0,B.jsx)(F,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),(0,B.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:S.map(t=>{let r=d.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,B.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`Agent 覆盖`:`Agent override`:`${n?`继承`:`Inherits`} ${i}`})]}),(0,B.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>j(t,e),className:v(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e},e))})]},t)})})]})]}):null,l===`runtime`?(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(G,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。这里适合为特殊 Agent 收紧或放宽执行边界。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:d.runtime||d.workflows?(0,B.jsxs)(b,{variant:`ghost`,onClick:()=>f({...d,runtime:void 0,workflows:void 0}),children:[(0,B.jsx)(F,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,B.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,d.runtime?.[t]===void 0?(0,B.jsx)(W,{children:n?`继承`:`Inherited`}):null]}),(0,B.jsx)(`input`,{type:`number`,min:1,className:`${V} mt-1.5`,value:d.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=J({...d.runtime??{},[t]:U(e.target.value)});f({...d,runtime:n})}})]},t))}),(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,B.jsx)(`input`,{className:`${V} mt-1.5`,value:d.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=J({...d.workflows??{},default:e.target.value||void 0});f({...d,workflows:t})}})]}),(0,B.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,B.jsx)(`input`,{className:`${V} mt-1.5`,value:d.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=H(e.target.value),n=J({...d.workflows??{},allowed:t.length>0?t:void 0});f({...d,workflows:n})}})]})]})]}),(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:d.runtime?.promptCache?n?`使用 Agent 覆盖`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),d.runtime?.promptCache?(0,B.jsxs)(b,{variant:`ghost`,onClick:()=>{let e=J({...d.runtime??{},promptCache:void 0});f({...d,runtime:e})},children:[(0,B.jsx)(F,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),d.runtime?.promptCache?(0,B.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,B.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,B.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...d.runtime.promptCache,mode:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e},e))})]}),(0,B.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,B.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,B.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...d.runtime.promptCache,lifetime:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e},e))})]})]}):(0,B.jsx)(b,{className:`mt-4`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,l===`danger`?(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(G,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除 Agent。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认 Agent`:`Make default agent`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个 Agent。`:`New sessions and unspecified routes will use this agent.`})]}),(0,B.jsx)(b,{disabled:m,onClick:()=>void A(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,B.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认 Agent 不能删除,请先将其他 Agent 设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除 Agent`:`Delete agent`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,B.jsxs)(b,{variant:`ghost`,className:`text-red-600`,onClick:c,children:[(0,B.jsx)(T,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,B.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x?n?`请补全自定义模型`:`Complete the custom model reference`:y?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(b,{onClick:a,children:n?`关闭`:`Close`}),(0,B.jsx)(b,{variant:`primary`,disabled:m||!y||x||d.profile!==void 0&&!d.profile.name.trim(),onClick:()=>void k(),children:m?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function ne(e){let t=(0,R.c)(29),{agent:n,open:r,onOpenChange:i,children:a}=e,[p,m]=(0,z.useState)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,B.jsx)(o,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=g):g=t[0];let _;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=v(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,S,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=_):_=t[1];let y;t[2]!==n.avatar||t[3]!==n.id?(y=(0,B.jsx)(A,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=y):y=t[4];let b;t[5]===n.name?b=t[6]:(b=(0,B.jsx)(d,{className:`truncate text-base font-semibold text-fg`,children:n.name}),t[5]=n.name,t[6]=b);let x;t[7]===n.id?x=t[8]:(x=(0,B.jsx)(s,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[7]=n.id,t[8]=x);let T;t[9]!==b||t[10]!==x?(T=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[9]=b,t[10]=x,t[11]=T):T=t[11];let E;t[12]===n.isDefault?E=t[13]:(E=n.isDefault?(0,B.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:`DEFAULT`}):null,t[12]=n.isDefault,t[13]=E);let D;t[14]!==y||t[15]!==T||t[16]!==E?(D=(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[y,T,E]}),t[14]=y,t[15]=T,t[16]=E,t[17]=D):D=t[17];let O;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,B.jsx)(c,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":`Close`,children:(0,B.jsx)(h,{className:`size-4`})})}),t[18]=O):O=t[18];let k;t[19]===D?k=t[20]:(k=(0,B.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[D,O]}),t[19]=D,t[20]=k);let j;t[21]!==a||t[22]!==p||t[23]!==k?(j=(0,B.jsxs)(l,{children:[g,(0,B.jsx)(u,{ref:m,className:_,onOpenAutoFocus:X,children:(0,B.jsxs)(w,{layer:`modal`,portalContainer:p,children:[k,a]})})]}),t[21]=a,t[22]=p,t[23]=k,t[24]=j):j=t[24];let M;return t[25]!==i||t[26]!==r||t[27]!==j?(M=(0,B.jsx)(f,{open:r,onOpenChange:i,children:j}),t[25]=i,t[26]=r,t[27]=j,t[28]=M):M=t[28],M}function X(e){return e.preventDefault()}function Z(e,t){let n=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,r=e.effective.skills;return[r.mode===`selected`?t?`${r.include.length} 个技能`:`${r.include.length} skills`:r.exclude.length>0?t?`全部技能,排除 ${r.exclude.length}`:`All skills, ${r.exclude.length} excluded`:t?`全部技能`:`All skills`,n>0?t?`${n} 个工具禁用`:`${n} tools denied`:t?`工具全部可用`:`All tools available`]}function Q(e){let t=(0,R.c)(13),{agents:n,busy:r,zh:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i){let e;t[6]!==r||t[7]!==o||t[8]!==a||t[9]!==i?(e=e=>{let t=Z(e,i);return(0,B.jsx)(`li`,{className:`min-h-0`,children:(0,B.jsxs)(`article`,{className:v(`group relative flex min-h-64 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition duration-150 hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35`),children:[(0,B.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i?`配置 ${e.name}`:`Configure ${e.name}`,onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,B.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,B.jsx)(A,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:e.id})]})]}),(0,B.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?`DEFAULT`:i?`自定义`:`CUSTOM`})]}),(0,B.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:e.description||e.override.profile?.instructions||(i?`继承全局能力,仅保存这个 Agent 的差异。`:`Inherits global capabilities and stores only this agent’s differences.`)}),(0,B.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,B.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i?`当前模型`:`Current model`}),(0,B.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,B.jsx)(`div`,{className:`pointer-events-none relative z-10 mt-3 flex flex-wrap gap-1.5`,children:t.map($)}),(0,B.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,B.jsxs)(b,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,B.jsx)(p,{className:`size-4`}),i?`与这个 Agent 对话`:`Chat with this agent`]})})]})},e.id)},t[6]=r,t[7]=o,t[8]=a,t[9]=i,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,B.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}function $(e){return(0,B.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e)}var re=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function ie(e){let t=(0,R.c)(59),{open:n,busy:r,error:i,name:a,instructions:p,zh:m,onNameChange:g,onInstructionsChange:_,onCreate:y,onOpenChange:x}=e,w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,B.jsx)(o,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=w):w=t[0];let T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=v(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(92vw,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,S),t[1]=T):T=t[1];let E=m?`新建 Agent`:`Create agent`,D;t[2]===E?D=t[3]:(D=(0,B.jsx)(d,{className:`text-base font-semibold text-fg`,children:E}),t[2]=E,t[3]=D);let O=m?`只设置身份即可开始,所有能力自动继承全局配置。`:`Set its identity and start. Every capability inherits globally.`,k;t[4]===O?k=t[5]:(k=(0,B.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[4]=O,t[5]=k);let A;t[6]!==D||t[7]!==k?(A=(0,B.jsxs)(`div`,{children:[D,k]}),t[6]=D,t[7]=k,t[8]=A):A=t[8];let j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,B.jsx)(c,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover`,"aria-label":`Close`,children:(0,B.jsx)(h,{className:`size-4`})})}),t[9]=j):j=t[9];let M;t[10]===A?M=t[11]:(M=(0,B.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,j]}),t[10]=A,t[11]=M);let N;t[12]===i?N=t[13]:(N=i?(0,B.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[12]=i,t[13]=N);let P=m?`名称`:`Name`,F=m?`Agent 名称`:`Agent name`,I;t[14]===g?I=t[15]:(I=e=>g(e.target.value),t[14]=g,t[15]=I);let ee=m?`例如:数据分析师`:`For example: Data analyst`,L;t[16]!==a||t[17]!==F||t[18]!==I||t[19]!==ee?(L=(0,B.jsx)(`input`,{id:`create-agent-name`,"aria-label":F,className:`${re} mt-1.5`,value:a,onChange:I,placeholder:ee}),t[16]=a,t[17]=F,t[18]=I,t[19]=ee,t[20]=L):L=t[20];let z;t[21]!==P||t[22]!==L?(z=(0,B.jsxs)(`label`,{htmlFor:`create-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[P,L]}),t[21]=P,t[22]=L,t[23]=z):z=t[23];let te=m?`个性与工作方式(可选)`:`Personality and working style (optional)`,V=m?`个性与工作方式`:`Personality and working style`,H;t[24]===_?H=t[25]:(H=e=>_(e.target.value),t[24]=_,t[25]=H);let U=m?`描述角色、语气和偏好的工作方式`:`Describe its role, tone, and preferred way of working`,W;t[26]!==p||t[27]!==V||t[28]!==H||t[29]!==U?(W=(0,B.jsx)(`textarea`,{id:`create-agent-instructions`,"aria-label":V,rows:4,className:`${re} mt-1.5 resize-none`,value:p,onChange:H,placeholder:U}),t[26]=p,t[27]=V,t[28]=H,t[29]=U,t[30]=W):W=t[30];let G;t[31]!==te||t[32]!==W?(G=(0,B.jsxs)(`label`,{htmlFor:`create-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[te,W]}),t[31]=te,t[32]=W,t[33]=G):G=t[33];let K;t[34]!==N||t[35]!==z||t[36]!==G?(K=(0,B.jsxs)(`div`,{className:`space-y-4 p-5`,children:[N,z,G]}),t[34]=N,t[35]=z,t[36]=G,t[37]=K):K=t[37];let q=m?`取消`:`Cancel`,J;t[38]!==r||t[39]!==q?(J=(0,B.jsx)(c,{asChild:!0,children:(0,B.jsx)(b,{disabled:r,children:q})}),t[38]=r,t[39]=q,t[40]=J):J=t[40];let Y;t[41]!==r||t[42]!==a?(Y=r||!a.trim(),t[41]=r,t[42]=a,t[43]=Y):Y=t[43];let ne=r?m?`创建中…`:`Creating…`:m?`创建 Agent`:`Create agent`,X;t[44]!==y||t[45]!==Y||t[46]!==ne?(X=(0,B.jsx)(b,{variant:`primary`,disabled:Y,onClick:y,children:ne}),t[44]=y,t[45]=Y,t[46]=ne,t[47]=X):X=t[47];let Z;t[48]!==J||t[49]!==X?(Z=(0,B.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[J,X]}),t[48]=J,t[49]=X,t[50]=Z):Z=t[50];let Q;t[51]!==K||t[52]!==Z||t[53]!==M?(Q=(0,B.jsxs)(l,{children:[w,(0,B.jsxs)(u,{className:T,children:[M,K,Z]})]}),t[51]=K,t[52]=Z,t[53]=M,t[54]=Q):Q=t[54];let $;return t[55]!==x||t[56]!==n||t[57]!==Q?($=(0,B.jsx)(f,{open:n,onOpenChange:x,children:Q}),t[55]=x,t[56]=n,t[57]=Q,t[58]=$):$=t[58],$}function ae(){let e=(0,R.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(x,{className:`h-7 w-28`}),(0,B.jsx)(x,{className:`h-4 w-80 max-w-full`})]}),(0,B.jsx)(x,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,B.jsxs)(L,{gap:`gap-5`,children:[t,(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(oe)})]}),e[1]=n):n=e[1],n}function oe(e){return(0,B.jsx)(x,{className:`h-64 rounded-2xl`},e)}function se(){let e=_(e=>e.token),t=g(e=>e.language)===`zh`,n=a(),{agentId:r}=i(),{data:o,error:s,isLoading:c,mutate:l}=y(e?`settings-gateway-agents`:null,P),[u,d]=(0,z.useState)({open:!1,name:``,instructions:``}),[f,p]=(0,z.useState)(!1),[h,v]=(0,z.useState)(null),x=(0,z.useRef)(!1),S=o?.agents.find(e=>e.id===r),C=async()=>{p(!0),v(null);try{let e=await E({profile:{name:u.name.trim(),...u.instructions.trim()?{instructions:u.instructions.trim()}:{}}});d({open:!1,name:``,instructions:``}),n(`/agents/${e.createdAgentId}`)}catch(e){v(e instanceof Error?e.message:String(e))}finally{p(!1)}},w=async e=>{if(window.confirm(t?`删除 ${e.name}?此操作无法撤销。`:`Delete ${e.name}? This cannot be undone.`)){p(!0),v(null);try{await k(e.id),n(`/agents`)}catch(e){v(e instanceof Error?e.message:String(e))}finally{p(!1)}}},T=e=>{j(e),n(`/chat/new`)},D=e=>{x.current=!1,window.setTimeout(()=>n(`/agents/${e}`),0)},O=()=>{x.current&&!window.confirm(t?`放弃未保存的更改?`:`Discard unsaved changes?`)||(x.current=!1,n(`/agents`))},A=()=>{x.current&&!window.confirm(t?`放弃未保存的更改?`:`Discard unsaved changes?`)||(x.current=!1,n(`/settings/agent-defaults`))},M=(0,z.useCallback)(e=>{x.current=e},[]);return e?s&&!o?(0,B.jsxs)(L,{children:[(0,B.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(s)}),(0,B.jsx)(b,{onClick:()=>void l(),children:t?`重试`:`Retry`})]}):c||!o?(0,B.jsx)(ae,{}):(0,B.jsxs)(L,{gap:`gap-5`,children:[(0,B.jsx)(ee,{title:`Agents`,subtitle:t?`所有 Agent 默认继承全局能力;这里只配置身份和必要差异。`:`Every agent inherits global capabilities; configure only identity and necessary differences here.`,actions:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(b,{onClick:()=>n(`/settings/agent-defaults`),children:t?`全局默认配置`:`Global defaults`}),(0,B.jsxs)(b,{variant:`primary`,onClick:()=>{v(null),d(e=>({...e,open:!0}))},children:[(0,B.jsx)(m,{className:`size-4`}),t?`新建 Agent`:`New agent`]})]})}),(s||h)&&!S?(0,B.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:h??String(s)}):null,(0,B.jsx)(Q,{agents:o.agents,busy:f,zh:t,onOpen:D,onChat:T}),S?(0,B.jsx)(ne,{agent:S,open:!0,onOpenChange:e=>{e||O()},children:(0,B.jsx)(Y,{agent:S,toolIds:o.builtinToolIds,zh:t,externalError:h,onDirtyChange:M,onClose:O,onOpenDefaults:A,onChat:()=>T(S.id),onDelete:()=>void w(S)},S.id)}):null,(0,B.jsx)(ie,{open:u.open,busy:f,error:h,name:u.name,instructions:u.instructions,zh:t,onNameChange:e=>d(t=>({...t,name:e})),onInstructionsChange:e=>d(t=>({...t,instructions:e})),onCreate:()=>void C(),onOpenChange:e=>{f||(d(t=>({...t,open:e})),e||v(null))}})]}):(0,B.jsx)(L,{children:(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Gateway token required.`})})}export{se as AgentsSettingsPanel};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-CHNYp8EQ.js";import{a as p,n as m,r as h}from"./locale-store-BJFLQY8O.js";import{t as g}from"./cn-JdwAhgNB.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CtTvuElV.js";import{n as y}from"./interaction-BmQogeqz.js";import{t as b}from"./skeleton-BwbyijEw.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as C}from"./electron-env-DH5wF8X8.js";import{Ri as w,vc as T}from"./index-D5TQQpeb.js";import{n as E,r as D}from"./settings-page-layout-BRQNel6r.js";import{t as O}from"./settings-loading-skeleton-CAmWMaOT.js";import{r as k,t as A}from"./settings-form-section-DjWzRk4z.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,f]=(0,M.useReducer)(w,L),{info:p,loadError:m,actionError:h,copiedField:_,clearDialogOpen:b,clearConfirmChecked:C,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){f({type:`patch`,patch:{loadError:null}});try{f({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await d(e)){f({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>f({type:`patch`,patch:{copiedField:null}}),2e3);return}f({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(m)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:m});if(!p)return(0,N.jsx)(O,{rows:2});let H=!p.packaged,U=j||p.pendingUpdate||H,W=!H&&p.uninstallMode!==`unsupported`,G=I(p,t),K=C&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,h?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,p.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(p.appPath,`app`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(p.dataPath,`data`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(p.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,y.press),onClick:()=>{f({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,y.press),onClick:()=>{f({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(l,{open:b,onOpenChange:e=>{e||f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:C,onChange:e=>f({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:g(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder: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`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>f({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(l,{open:D,onOpenChange:e=>{e||f({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>f({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>f({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await p(h(`/api/migrations/status`))).payload}async function B(){await p(h(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(b,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(b,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=m(U),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!C()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let o;e[18]===i.title?o=e[19]:(o=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=o);let s;e[20]===i.migrations?s=e[21]:(s=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=s);let c;e[22]===i?c=e[23]:(c=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=c);let l;return e[24]!==o||e[25]!==s||e[26]!==c?(l=(0,N.jsxs)(D,{gap:`gap-6`,children:[o,s,c]}),e[24]=o,e[25]=s,e[26]=c,e[27]=l):l=e[27],l}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-C-Hj-nXR.js";import{t as o}from"./messages-CHNYp8EQ.js";import{a as s,n as c,r as l}from"./locale-store-BJFLQY8O.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d}from"./interaction-BmQogeqz.js";import{n as f,r as p}from"./gateway-config-swr-DXuXtU1w.js";import{i as m}from"./theme-store-O597U8q_.js";import{t as h}from"./skeleton-BwbyijEw.js";import{Er as g,Qa as _}from"./index-D5TQQpeb.js";import{n as v,r as y}from"./settings-page-layout-BRQNel6r.js";import{t as b}from"./settings-advanced-gate-BaN84CyW.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await s(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(){return u(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function k(e){let t=(0,S.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(18),t=c(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),s;e[2]===r.colorSchemeTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.colorSchemeTitle}),e[2]=r.colorSchemeTitle,e[3]=s);let l;e[4]===r.colorSchemeDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.colorSchemeDescription}),e[4]=r.colorSchemeDescription,e[5]=l);let f;e[6]!==s||e[7]!==l?(f=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,l]}),e[6]=s,e[7]=l,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==i||e[11]!==a?(p=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:u(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,d.pressCard,o?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:u(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[9]=r,e[10]=i,e[11]=a,e[12]=p):p=e[12];let h;e[13]===p?h=e[14]:(h=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:p}),e[13]=p,e[14]=h);let g;return e[15]!==f||e[16]!==h?(g=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[f,h]}),e[15]=f,e[16]=h,e[17]=g):g=e[17],g}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(31),t=c(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:l}=p(!0),d=s?.payload?.config,f;e[2]===d?f=e[3]:(f=w(d),e[2]=d,e[3]=f);let m=f,[g,_]=(0,x.useState)(m),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===m?(D=e[5],O=e[6]):(D=()=>_(m),O=[m],e[4]=m,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]===r.activityDetailDefaultDescription?M=e[12]:(M=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.activityDetailDefaultDescription}),e[11]=r.activityDetailDefaultDescription,e[12]=M);let N;e[13]!==j||e[14]!==M?(N=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),e[13]=j,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==r.activityDetailLevels||e[17]!==A||e[18]!==l||e[19]!==g||e[20]!==v?(P=l?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-sm`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`sm:max-w-sm`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[16]=r.activityDetailLevels,e[17]=A,e[18]=l,e[19]=g,e[20]=v,e[21]=P):P=e[21];let F=b?`text-red-600 dark:text-red-400`:`text-fg-subtle`,I;e[22]===F?I=e[23]:(I=u(`min-h-4 text-xs`,F),e[22]=F,e[23]=I);let R=b?r.activityDetailSaveError:v?r.activityDetailSaving:r.activityDetailDefaultHint,z;e[24]!==I||e[25]!==R?(z=(0,E.jsx)(`p`,{className:I,children:R}),e[24]=I,e[25]=R,e[26]=z):z=e[26];let B;return e[27]!==z||e[28]!==N||e[29]!==P?(B=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[N,P,z]}),e[27]=z,e[28]=N,e[29]=P,e[30]=B):B=e[30],B}function L(e){return e.language}function R(){let e=(0,S.c)(27),t=c(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(B),a=g(z),s;e[2]===r.developerGroupTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.developerGroupTitle}),e[2]=r.developerGroupTitle,e[3]=s);let l;e[4]===r.developerGroupDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.developerGroupDescription}),e[4]=r.developerGroupDescription,e[5]=l);let u;e[6]!==s||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,l]}),e[6]=s,e[7]=l,e[8]=u):u=e[8];let d;e[9]===r.showRawToolDataTitle?d=e[10]:(d=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[9]=r.showRawToolDataTitle,e[10]=d);let f;e[11]===r.showRawToolDataDescription?f=e[12]:(f=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[11]=r.showRawToolDataDescription,e[12]=f);let p;e[13]!==d||e[14]!==f?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15];let m;e[16]===a?m=e[17]:(m=e=>a(e.target.checked),e[16]=a,e[17]=m);let h;e[18]!==i||e[19]!==m?(h=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:m}),e[18]=i,e[19]=m,e[20]=h):h=e[20];let _;e[21]!==p||e[22]!==h?(_=(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[p,h]}),e[21]=p,e[22]=h,e[23]=_):_=e[23];let v;return e[24]!==u||e[25]!==_?(v=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[u,_]}),e[24]=u,e[25]=_,e[26]=v):v=e[26],v}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(30),t=c(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]!==r.pageTitle||e[3]!==r.subtitle?(i=(0,E.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[2]=r.pageTitle,e[3]=r.subtitle,e[4]=i):i=e[4];let a;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=D(),e[5]=a):a=e[5];let s;e[6]===r.languageTitle?s=e[7]:(s=(0,E.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:r.languageTitle}),e[6]=r.languageTitle,e[7]=s);let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(_,{variant:`page`,sections:[`language`]}),e[8]=l):l=e[8];let u;e[9]===s?u=e[10]:(u=(0,E.jsxs)(`section`,{className:a,"aria-labelledby":`pref-language-heading`,children:[s,l]}),e[9]=s,e[10]=u);let d;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=D(),e[11]=d):d=e[11];let f;e[12]===r.themeTitle?f=e[13]:(f=(0,E.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:r.themeTitle}),e[12]=r.themeTitle,e[13]=f);let p,m,h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),h=(0,E.jsx)(M,{}),p=(0,E.jsx)(I,{}),e[14]=p,e[15]=m,e[16]=h):(p=e[14],m=e[15],h=e[16]);let g;e[17]===f?g=e[18]:(g=(0,E.jsxs)(`section`,{className:d,"aria-labelledby":`pref-appearance-heading`,children:[f,m,h,p]}),e[17]=f,e[18]=g);let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=D(),e[19]=x):x=e[19];let C;e[20]===r.developerGroupTitle?C=e[21]:(C=(0,E.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:r.developerGroupTitle}),e[20]=r.developerGroupTitle,e[21]=C);let w;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(R,{}),e[22]=w):w=e[22];let T;e[23]===C?T=e[24]:(T=(0,E.jsx)(b,{children:(0,E.jsxs)(`section`,{className:x,"aria-labelledby":`pref-developer-heading`,children:[C,w]})}),e[23]=C,e[24]=T);let O;return e[25]!==i||e[26]!==g||e[27]!==T||e[28]!==u?(O=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,u,g,T]}),e[25]=i,e[26]=g,e[27]=T,e[28]=u,e[29]=O):O=e[29],O}function U(e){return e.language}export{H as AppearanceSettingsPanel};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as o,i as s,o as c,r as l,s as u,t as d}from"./dist-CpzYSoz7.js";import{t as f}from"./check-DUBLcKHA.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./markdown-view-DTF9v1gg.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./search-DA7gz22f.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./messages-CHNYp8EQ.js";import{a as b,i as x,n as S,r as C,s as w}from"./locale-store-BJFLQY8O.js";import{t as T}from"./cn-JdwAhgNB.js";import{a as E,i as D}from"./vendor-swr-BIWyz7Rc.js";import{t as O}from"./button-CtTvuElV.js";import{t as k}from"./skeleton-BwbyijEw.js";import{$i as A,Ds as j,Ji as ee,Kl as M,Os as N,Pl as P,Qi as F,Ri as I,Xi as L,Xs as R,Zi as z,na as B,nu as te,qs as ne,sa as V,vc as H}from"./index-D5TQQpeb.js";import{t as U}from"./page-tabs-BaEQMYm_.js";var W=e(t(),1),G=n();function K(e){return e===`builtin`||e===`user`?e:`marketplace`}async function q(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function re(e){let t=await x(C(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await x(C(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function Y(e){let t=await x(C(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function X(e){let t=await x(C(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Z=r();function ie(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Q={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function $({className:e}){let t=y(S(e=>e.language)).extensionsPage,n=w(e=>!!e.token),r=L(),{mutate:i}=E(),[a,o]=(0,W.useReducer)(I,Q),{q:s,debounced:c,detailPkg:l,rowBusy:u,actionError:d,restartHint:f}=a,p=n?`marketplace-${c}`:null;(0,W.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:m,isLoading:g,error:v}=D(p,async()=>b(c.length>0?C(`/api/marketplace?q=${encodeURIComponent(c)}`):C(`/api/marketplace`)),{revalidateOnFocus:!1}),x=(0,W.useCallback)(()=>{i(`gateway-extensions-list`),B()},[i]),O=(0,W.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await J({name:e,overwrite:n});x(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,x]),A=(0,W.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await X(e);x(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,x]),j=m?.extensions??[];return(0,Z.jsxs)(`div`,{className:T(`flex flex-col gap-4`,e),children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(_,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:s,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),v?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v instanceof Error?v.message:t.marketplaceLoadFailed}):null,d?(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}):null,f?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f}):null,g&&!m?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Z.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Z.jsx)(k,{className:`h-5 w-40`}),(0,Z.jsx)(k,{className:`h-4 w-full max-w-xl`}),(0,Z.jsx)(k,{className:`h-4 w-2/3 max-w-md`})]}),(0,Z.jsx)(k,{className:`h-8 w-20`})]})},e))}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:j.length===0?(0,Z.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):j.map(e=>{let n=ie(r,e.id),i=u===e.id;return(0,Z.jsx)(`li`,{className:`list-none`,children:(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:T(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Z.jsx)(P,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Z.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Z.jsx)(H,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Z.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Z.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&A(e.id).catch(()=>{})},className:T(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Z.jsx)(h,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(N,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:T(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),l?(0,Z.jsx)(ae,{packageName:l,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:O,onUninstall:A}):null]})}function ae(e){let t=(0,G.c)(102),{packageName:n,copy:r,extensions:i,onClose:s,onInstall:f,onUninstall:p}=e,[g,_]=(0,W.useState)(!1),[y,b]=(0,W.useState)(!1),x=w(ue)?`ext-mp-detail-${n}`:null,S;t[0]===n?S=t[1]:(S=async()=>re(n),t[0]=n,t[1]=S);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[2]=C):C=t[2];let{data:E,error:O,isLoading:A}=D(x,S,C),ee;t[3]!==i||t[4]!==n?(ee=ie(i,n),t[3]=i,t[4]=n,t[5]=ee):ee=t[5];let M=ee,P=M===`user`,F=E?.manifest?.permissions,I,L,R,z,B,V,H,U,K,q,J;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==E||t[29]!==O||t[30]!==M||t[31]!==A||t[32]!==s||t[33]!==F||t[34]!==y){let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==E?(n=E?.readme?.trim()||(E?.description?.trim()?`### ${E.name}\n\n${E.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=E,t[48]=n):n=t[48];let i=n;R=d,z=!0,t[49]===s?B=t[50]:(B=e=>!e&&s(),t[49]=s,t[50]=B),L=c,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=J):J=t[51],I=l,U=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,K=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(te,{className:`size-5`}),t[52]=a):a=t[52];let f;t[53]!==r.detailBack||t[54]!==s?(f=(0,Z.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=s,t[55]=f):f=t[55];let p;t[56]===r.marketplaceDetailTitle?p=t[57]:(p=(0,Z.jsx)(u,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=p);let h;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(v,{className:`size-5`}),t[58]=h):h=t[58];let g;t[59]!==r.detailClose||t[60]!==s?(g=(0,Z.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:h}),t[59]=r.detailClose,t[60]=s,t[61]=g):g=t[61],t[62]!==f||t[63]!==p||t[64]!==g?(q=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[f,p,g]}),t[62]=f,t[63]=p,t[64]=g,t[65]=q):q=t[65],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=A&&!E?(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Z.jsx)(k,{className:`h-6 w-48`}),(0,Z.jsx)(k,{className:`h-4 w-28`}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)(k,{className:`h-12`}),(0,Z.jsx)(k,{className:`h-12`})]}),(0,Z.jsx)(k,{className:`h-28 w-full`}),(0,Z.jsx)(k,{className:`h-36 w-full`})]}):O?(0,Z.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:r.marketplaceLoadFailed})]}):E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:E.name}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:E.id})}),(0,Z.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Z.jsx)(`dd`,{children:E.author.username})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Z.jsx)(`dd`,{children:E.latestVersion.version})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Z.jsx)(`dd`,{children:E.downloads})]})]}),M===`bundled`?null:(0,Z.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[E.installability.available?(0,Z.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Z.jsx)(j,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:E.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:E.installability.available?r.marketplaceCodeRisk:E.installability.reason??r.marketplaceUnavailableBody})]})]}),E.installability.available?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Z.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Z.jsx)(`dd`,{children:E.packageSummary?.dependencyCount??0})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,Z.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(E.packageSummary?.lifecycleScripts.length??0)>0?(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,E.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Z.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),E.readme?.trim()?(0,Z.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Z.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Z.jsx)(m,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=E,t[29]=O,t[30]=M,t[31]=A,t[32]=s,t[33]=F,t[34]=y,t[35]=I,t[36]=L,t[37]=R,t[38]=z,t[39]=B,t[40]=V,t[41]=H,t[42]=U,t[43]=K,t[44]=q,t[45]=J}else I=t[35],L=t[36],R=t[37],z=t[38],B=t[39],V=t[40],H=t[41],U=t[42],K=t[43],q=t[44],J=t[45];let Y;t[66]!==V||t[67]!==H?(Y=(0,Z.jsx)(`div`,{className:V,children:H}),t[66]=V,t[67]=H,t[68]=Y):Y=t[68];let X;t[69]!==g||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==E||t[78]!==M||t[79]!==s||t[80]!==f||t[81]!==p||t[82]!==n||t[83]!==y||t[84]!==P?(X=E?(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:M===`bundled`?(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Z.jsx)(a,{to:`/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:g||!E.installability.available||!y,onClick:()=>{P&&!window.confirm(r.marketplaceReinstallConfirm)||(_(!0),f(n,P).catch(se).finally(()=>_(!1)))},className:T(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[g?(0,Z.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?r.marketplaceReinstall:r.marketplaceInstall]}),P?(0,Z.jsxs)(`button`,{type:`button`,disabled:g,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(_(!0),p(n).then(()=>s()).catch(oe).finally(()=>_(!1)))},className:T(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Z.jsx)(N,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=g,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=E,t[78]=M,t[79]=s,t[80]=f,t[81]=p,t[82]=n,t[83]=y,t[84]=P,t[85]=X):X=t[85];let Q;t[86]!==I||t[87]!==Y||t[88]!==X||t[89]!==U||t[90]!==K||t[91]!==q?(Q=(0,Z.jsxs)(I,{className:U,onOpenAutoFocus:K,children:[q,Y,X]}),t[86]=I,t[87]=Y,t[88]=X,t[89]=U,t[90]=K,t[91]=q,t[92]=Q):Q=t[92];let $;t[93]!==L||t[94]!==Q||t[95]!==J?($=(0,Z.jsxs)(L,{children:[J,Q]}),t[93]=L,t[94]=Q,t[95]=J,t[96]=$):$=t[96];let ae;return t[97]!==R||t[98]!==z||t[99]!==B||t[100]!==$?(ae=(0,Z.jsx)(R,{defaultOpen:z,onOpenChange:B,children:$}),t[97]=R,t[98]=z,t[99]=B,t[100]=$,t[101]=ae):ae=t[101],ae}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,Z.jsxs)(`li`,{className:`break-words`,children:[(0,Z.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=S(e=>e.language),t=y(e),n=V(e=>e.setPageHeader),r=V(e=>e.clearPageHeader),o=L(),s=z(),[c,l]=i(),u=K(c.get(`tab`)),d=c.get(`q`)??``,[f,p]=(0,W.useState)(u),[m,h]=(0,W.useState)(d),[v,b]=(0,W.useState)(null),x=c.toString(),C=(0,W.useRef)(x);if(C.current!==x){C.current=x;let e=K(c.get(`tab`)),t=c.get(`q`)??``;p(t=>t===e?t:e),h(e=>e===t?e:t)}(0,W.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=m.trim();return n?t.set(`q`,n):t.delete(`q`),f===`marketplace`?t.delete(`tab`):t.set(`tab`,f),t.toString()===e.toString()?e:t},{replace:!0})},[f,m,l]);let w=(0,W.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),T=(0,W.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),E=f===`builtin`?w:T,D=(0,W.useMemo)(()=>{let t=m.trim().toLowerCase(),n=E;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[E,m,e]);if((0,W.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,W.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(O,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Z.jsx)(M,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Z.jsx)(O,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps/new`,children:[(0,Z.jsx)(g,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&f!==`marketplace`)return(0,Z.jsx)(ye,{});let k=f!==`marketplace`&&E.length>0;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(U,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:w.length},{id:`user`,label:t.extensionsPage.tabUser,count:T.length}],activeTab:f,onChange:p,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),k?(0,Z.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Z.jsx)(_,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),f===`marketplace`?(0,Z.jsx)($,{}):f===`builtin`&&w.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):f===`user`&&T.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyUser}):D.length===0?(0,Z.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,Z.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:f===`user`,onOpen:()=>b(e)},e.id))})]}),v?(0,Z.jsx)(_e,{extension:v,copy:t.extensionsPage,onClose:()=>b(null)},v.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,G.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,o;t[0]===n?o=t[1]:(o=fe(n),t[0]=n,t[1]=o);let s=o,c=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=T(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=l):l=t[2];let u=n.name||n.id,d;t[3]===u?d=t[4]:(d=u.charAt(0).toUpperCase(),t[3]=u,t[4]=d);let p;t[5]===d?p=t[6]:(p=(0,Z.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:d}),t[5]=d,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let h;t[9]===n.version?h=t[10]:(h=n.version?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=h);let _;t[11]!==m||t[12]!==h?(_=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==s?(v=s?(0,Z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Z.jsx)(f,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Z.jsx)(g,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=s,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==c?(C=(0,Z.jsx)(`span`,{title:c,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=c,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,Z.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=w):w=t[31];let E;t[32]!==C||t[33]!==w?(E=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=E):E=t[34];let D;t[35]!==y||t[36]!==x||t[37]!==E?(D=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,E]}),t[35]=y,t[36]=x,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==p?(O=(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[p,D]}),t[39]=D,t[40]=p,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:l,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=E(),[i,f]=(0,W.useState)(!1),[m,g]=(0,W.useState)(null),[_,y]=(0,W.useState)(!1),b=e.activationEligible===!0,x=(0,W.useCallback)(async()=>{if(e.source===`bundled`){g(null),y(!1),f(!0);try{let{requiresGatewayRestart:t}=await Y({extensionId:e.id,enabled:!b});await r(`gateway-extensions-list`),B(),y(t)}catch(e){g(e instanceof Error?e.message:t.builtinToggleFailed)}finally{f(!1)}}},[b,t.builtinToggleFailed,e.id,e.source,r]),S=e.ui?.contributions?.pages??[],C=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],D=e.ui?.contributions?.sidebarPanels??[],k=S.find(e=>e.showInNav)??S[0],j=C[0],M=k?ee(e.id,k):null,N=j?`/settings/ext/${e.id}/${j.id}`:e.hasConfigSchema||F(e)?`/settings/ext/${e.id}`:null;return(0,Z.jsx)(d,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Z.jsxs)(l,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Z.jsx)(te,{className:`size-5`})}),(0,Z.jsx)(u,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Z.jsxs)(s,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Z.jsx)(v,{className:`size-5`})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Z.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Z.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Z.jsx)(O,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void x(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):b?t.builtinToggleDisable:t.builtinToggleEnable})]}),m?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:m}):null,_?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(S.length>0||C.length>0||w.length>0)?(0,Z.jsxs)(`section`,{className:`mt-8`,children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsx)(ve,{template:t.badgePages,count:S.length,hidden:S.length===0}),(0,Z.jsx)(ve,{template:t.badgeSettings,count:C.length,hidden:C.length===0}),(0,Z.jsx)(ve,{template:t.badgeWidgets,count:w.length,hidden:w.length===0}),(0,Z.jsx)(ve,{template:t.badgeSidebar,count:D.length,hidden:D.length===0})]})]}):null,A(e)&&(M||N)?(0,Z.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[M?(0,Z.jsxs)(a,{to:M,onClick:n,className:T(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(p,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,N?(0,Z.jsxs)(a,{to:N,onClick:n,className:T(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(R,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Z.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,G.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Z.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,G.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Z.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Z.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Z.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,Z.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,G.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
@@ -1,6 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as o,n as s,o as c,r as l,s as u,t as d}from"./dist-CpzYSoz7.js";import{n as f,r as p}from"./popover-select-C-Hj-nXR.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as m}from"./ellipsis-0k4rZLoy.js";import{t as h}from"./markdown-view-DTF9v1gg.js";import{t as g}from"./pencil-DmIY3Oa-.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as te}from"./search-DA7gz22f.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./messages-CHNYp8EQ.js";import{n as b}from"./locale-store-BJFLQY8O.js";import{t as x}from"./cn-JdwAhgNB.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{t as C}from"./button-CtTvuElV.js";import{t as w}from"./skeleton-BwbyijEw.js";import{Ec as ne,Ei as re,Fl as ie,Hl as T,Hs as ae,Ki as oe,Ll as E,Os as D,Wt as O,an as k,hc as se,in as A,jc as j,l as M,ln as ce,ms as N,nc as P,on as le,ou as ue,qs as F,ri as I,rl as L,sa as R,sn as de,uc as fe,v as z,zl as pe}from"./index-D5TQQpeb.js";import{a as B,i as V,o as H,r as U}from"./cron-expression-DTj1V3Sw.js";import{a as W,i as me,n as he,r as ge,t as _e}from"./workflow-run-setup-panel-DZmvLZjb.js";import{i as ve,n as ye,r as be,t as G}from"./browser-workflow-inputs-BQ1Ilw_o.js";var K=e(t(),1),xe=n(),Se=B();function q(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function Ce(e,t){let n=e===7?0:e;return new Date(Date.UTC(2023,0,1)+n*864e5).toLocaleDateString(t,{weekday:`short`,timeZone:`UTC`})}function we(e,t){return e.length<=1?e[0]??``:t.startsWith(`zh`)?e.join(`、`):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function Te(e){return e.length===5&&e.every((e,t)=>e===t+1)}function Ee(e){if(e.length!==2)return!1;let t=[...e].toSorted((e,t)=>e-t);return t[0]===0&&t[1]===6}function De(e,t,n,r){try{let i=Se.CronExpressionParser.parse(e,{...r?.timezone?{tz:r.timezone}:{}}).fields,a=U(i.minute.values),o=U(i.hour.values),s=U(i.dayOfWeek.values),c=U(i.dayOfMonth.values);if(a.length===60&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.everyMinute;if(!i.minute.isWildcard&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&a.length>1){let e=V(a);if(e!=null&&e>0)return n.everyNMinutes.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length>1&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard){let e=V(o);if(e!=null&&e>0)return n.everyNHours.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&o.length===24)return n.hourly;let l=!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length===1?q(o[0],a[0],t):``;if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.dailyAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Te(s))return n.weekdaysAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Ee(s))return n.weekendsAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length===1){let e=Ce(s[0],t);return n.weeklyOn.replace(`{{day}}`,e).replace(`{{time}}`,l)}if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length>1){let e=we(s.map(e=>Ce(e,t)),t);return n.daysAt.replace(`{{days}}`,e).replace(`{{time}}`,l)}return l&&!i.dayOfMonth.isWildcard&&c.length===1&&i.month.isWildcard&&i.dayOfWeek.isWildcard?n.monthlyAt.replace(`{{day}}`,String(c[0])).replace(`{{time}}`,l):n.customSchedule}catch{return null}}function J(e,t,n,r){let i=e.trim();return i?De(i,t,n,r)||Oe(r?.nextRun,t)||n.customSchedule:Oe(r?.nextRun,t)||`—`}function Oe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleString(t,{weekday:`short`,hour:`numeric`,minute:`2-digit`})}var ke=1e3,Y=60*ke,X=60*Y,Ae=24*X,je=7*Ae,Me=new Intl.ListFormat(`en-US`,{type:`conjunction`}),Ne=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),Pe={en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},Fe={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Ie={minute:Y,hour:X,day:Ae,week:je};function Le(e){return e===`zh`?`zh-CN`:`en-US`}function Re(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:Ne[String(t)].format(e)}function ze(e,t){return t===`zh`?e.join(` `):Me.format(e)}function Be(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(Y,Math.round((Number.isFinite(n)&&n>0?n:1)*Ie[t]))}function Ve(e,t,n){let r=typeof e==`number`?e:Number.parseFloat(e),i=Number.isFinite(r)&&r>0?r:1;return String(Number.parseFloat((i*Ie[t]/Ie[n]).toFixed(6)))}function He(e,t){let n=Math.max(ke,Math.round(e)),r=n===Ae?[{unit:`hour`,ms:X}]:n>=je&&n%je===0?[{unit:`week`,ms:je}]:n>=Ae?[{unit:`day`,ms:Ae},{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=X?[{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=Y?[{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:[{unit:`second`,ms:ke}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(Re(r,e,t)),i%=n)}return ze(a,t)}function Ue(e,t){let n=He(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function We(e,t){return Pe[t].format(new Date(e))}function Ge(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function Ke(e,t,n=Date.now()){let r=new Date(e),i=Math.round((Ge(r)-Ge(new Date(n)))/Ae),a=Fe[t].format(r);return i===0?t===`zh`?`今天 ${a}`:`today at ${a}`:i===1?t===`zh`?`明天 ${a}`:`tomorrow at ${a}`:i===-1?t===`zh`?`昨天 ${a}`:`yesterday at ${a}`:We(e,t)}function qe(e,t){return e.eventType===`task.attention_required.v2`&&e.payloadMatch?.reason===`blocked`?t.trigger.taskBlockedWhen:e.eventType===`note.created`?t.trigger.noteCreatedWhen:e.eventType===`workflow.run.completed`&&e.payloadMatch?.status===`failed`?t.trigger.workflowFailedWhen:e.eventType===`session.transcript.updated`?t.trigger.sessionUpdatedWhen:t.trigger.eventWithType.replace(`{type}`,e.eventType)}function Je(e,t,n,r){if(e.kind===`manual`)return t.trigger.manualWhen;if(e.kind===`webhook`)return t.trigger.webhookWhen;if(e.kind===`event`)return qe(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,Ke(Date.parse(i.at),r)):i.kind===`interval`?Ue(i.everyMs,r):J(i.expr,Le(r),n.scheduleBadge,{timezone:i.tz})}function Ye(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?Ke(e.state.nextRunAtMs,n,r):e.trigger.kind===`manual`?t.info.noAutomaticTrigger:e.trigger.kind===`event`||e.trigger.kind===`webhook`?t.info.waitingForTrigger:t.info.noUpcomingRun:t.info.pausedNoAutomaticRuns}function Xe(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=Ke(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var Ze={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserWorkflowId:``,browserWorkflowInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,completionWebhookUrl:``,disableAfterFailures:`3`},Qe=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function $e(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)o={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Be(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=ge(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_recipe`?`auto_apply`:e.safetyMode,u;return u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{}}:e.actionMode===`browser_recipe`?{kind:`browser_recipe`,recipeId:e.browserWorkflowId.trim(),args:e.browserWorkflowInputs}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:o,action:u,safety:{mode:l},conversationMode:e.conversationMode,notificationPolicy:e.notificationPolicy,...l===`auto_apply`&&e.completionWebhookUrl.trim()?{completionWebhookUrl:e.completionWebhookUrl.trim()}:{},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function et(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:Ze.time,weekday:Ze.weekday,cronExpr:e}}function tt(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function nt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function rt(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function it(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function at(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function ot(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=rt(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=et(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...tt(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:nt(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?it(r.input):{},o=e.reliability?.executionTimeoutSeconds??r.timeoutSeconds??e.reliability?.timeoutSeconds??(r.kind===`browser_recipe`?600:1800);return{...Ze,...n,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:r.kind,agentId:r.kind===`browser_recipe`?``:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserWorkflowId:r.kind===`browser_recipe`?r.recipeId:``,browserWorkflowInputs:r.kind===`browser_recipe`?r.args??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?he(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(o),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.notificationPolicy??`attention`,completionWebhookUrl:e.completionWebhookUrl??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function st(e,t,n){let r=$e(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;return e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId}:e.action.kind===`workflow`&&r.action.kind===`workflow`?a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}:e.action.kind===`browser_recipe`&&r.action.kind===`browser_recipe`&&(a={...e.action,...r.action}),{...r,description:t.description.trim(),projectId:t.projectId.trim(),completionWebhookUrl:t.completionWebhookUrl.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function ct(e,t,n){return e?We(e,n):t.never}function lt(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_recipe`?`Browser automation: ${e.recipeId}`:e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function ut(e){return e.safety?.mode??`auto_apply`}function dt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function ft(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function pt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function mt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function ht(e,t){if((e.state.consecutiveFailures??0)>0)return!0;let n=t.reduce((t,n)=>n.automationId===e.id&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0);return n?mt(n):!1}function gt(e,t){return e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`&&e.action.goal?.trim()||lt(e.action,t)}function _t(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function vt(e){return!!_t(e)}function yt(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function bt(e){return pt(e)?0:mt(e)?1:e.status===`succeeded`?2:3}function xt(e){return[...e].sort((e,t)=>{let n=bt(e)-bt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function St(){let e=(0,xe.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Z.jsx)(w,{className:`h-4 w-36`}),(0,Z.jsx)(w,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(w,{className:`h-7 w-20 rounded-full`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[t,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(Ct)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(w,{className:`h-4 w-32`}),i=(0,Z.jsx)(w,{className:`mt-4 h-24 rounded-lg`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[n,(0,Z.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[r,i,(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,Z.jsx)(w,{className:`h-12 rounded-lg`}),(0,Z.jsx)(w,{className:`h-12 rounded-lg`}),(0,Z.jsx)(w,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function Ct(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(w,{className:`size-4 rounded-full`}),(0,Z.jsx)(w,{className:`h-4 w-32`}),(0,Z.jsx)(w,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(w,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(w,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(w,{className:`h-8 w-24 rounded-md`})]})},t)}function wt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let a=b(e=>e.language),ee=y(a),h=ee.automations,g=ee.cron,w=R(e=>e.setPageHeader),ne=R(e=>e.clearPageHeader),[ie,T]=i(),ae=ie.get(`run`)?.trim()??``,E=ie.get(`automation`)?.trim()??``,D=ie.get(`draft`)?.trim()??``,O=ie.get(`action`)?.trim()??``,se=ie.get(`projectId`)?.trim()??``,j=e?.trim()||se,P=!!e?.trim(),ue=ie.get(`autogenerate`)===`1`,F=(0,K.useRef)(``),[L,fe]=(0,K.useState)(`all`),[pe,B]=(0,K.useState)(``),[V,H]=(0,K.useState)(!1),[U,W]=(0,K.useState)(`blank`),[he,ge]=(0,K.useState)(null),[_e,be]=(0,K.useState)(!1),[G,xe]=(0,K.useState)(Ze),[Se,q]=(0,K.useState)(null),[Ce,we]=(0,K.useState)(null),[Te,Ee]=(0,K.useState)(!1),[De,J]=(0,K.useState)(null),[Oe,ke]=(0,K.useState)(``),[Y,X]=(0,K.useState)(null),[Ae,je]=(0,K.useState)(!1),[Me,Ne]=(0,K.useState)(!1),[Pe,Fe]=(0,K.useState)(j),[Ie,Le]=(0,K.useState)(`new_session`),[Re,ze]=(0,K.useState)(`attention`),[Be,Ve]=(0,K.useState)(null),[He,Ue]=(0,K.useState)(!1),[We,Ge]=(0,K.useState)(!1),[Ke,qe]=(0,K.useState)(!1),[Ye,Xe]=(0,K.useState)(null),Qe=S([`automations`,j],()=>M.list(j?{projectId:j}:void 0),{refreshInterval:15e3}),et=S([`automation-runs`,j],()=>M.runs(50,void 0,j?{projectId:j}:void 0),{refreshInterval:1e4}),tt=S(Ce?`automation-run-events:${Ce}`:null,()=>M.runEvents(Ce),{refreshInterval:5e3}),nt=S(`automation-workflow-definitions`,z),rt=S(`automation-browser-workflows`,()=>ve.list()),it=S(`automation-chat-agents`,oe),ct=S(`automation-projects`,()=>re({sortBy:`name`,sortOrder:`asc`,limit:200})),lt=Qe.isLoading&&!Qe.data||et.isLoading&&!et.data,ut=Qe.data?.automations??[],dt=(0,K.useMemo)(()=>xt(et.data?.runs??[]),[et.data?.runs]),ft=(0,K.useMemo)(()=>ut.filter(e=>!vt(e)),[ut]),mt=(0,K.useMemo)(()=>ut.filter(vt),[ut]),ht=(0,K.useMemo)(()=>new Set(mt.map(e=>e.id)),[mt]),_t=(0,K.useMemo)(()=>dt.filter(e=>!ht.has(e.automationId)),[dt,ht]),bt=(0,K.useMemo)(()=>dt.find(e=>e.id===Ce)??null,[dt,Ce]),Ct=(0,K.useMemo)(()=>ut.find(e=>e.id===De)??null,[ut,De]),wt=(0,K.useMemo)(()=>ut.find(e=>e.id===he)??null,[ut,he]),Et=(0,K.useMemo)(()=>dt.filter(e=>e.automationId===De).sort((e,t)=>t.createdAtMs-e.createdAtMs),[dt,De]),Dt=tt.data?.events??[],Ot=(0,K.useMemo)(()=>_t.filter(e=>!pt(e)&&e.readAtMs==null),[_t]),At=pe.trim().toLocaleLowerCase(),jt=(0,K.useMemo)(()=>(L===`system`?mt:ft).filter(e=>L===`active`&&!e.enabled||L===`paused`&&e.enabled?!1:At?[e.name,yt(e),gt(e,h),Je(e.trigger,h,g,a)].some(e=>e.toLocaleLowerCase().includes(At)):!0),[g,L,h,a,At,mt,ft,_t]),Mt=(0,K.useMemo)(()=>nt.data??[],[nt.data]),Nt=(0,K.useMemo)(()=>(rt.data?.workflows??[]).filter(e=>e.enabled),[rt.data]),It=it.data?.items??[],Lt=ct.data?.items??[],Rt=(0,K.useMemo)(()=>Mt.find(e=>e.id===G.workflowId.trim())??null,[G.workflowId,Mt]),zt=(0,K.useMemo)(()=>Nt.find(e=>e.id===G.browserWorkflowId.trim())??null,[Nt,G.browserWorkflowId]),Bt=G.actionMode===`workflow`&&(!G.workflowId.trim()||Mt.length>0&&!Mt.some(e=>e.id===G.workflowId)),Vt=G.actionMode===`workflow`&&Rt?!me(Rt,G.workflowInput,G.workflowInputValid).valid:!1,Ht=!!G.name.trim()&&(G.triggerMode!==`once`||Number.isFinite(new Date(G.onceAt).getTime()))&&(G.triggerMode!==`event`||!!G.eventType.trim()&&at(G.eventPayloadMatch))&&(G.actionMode===`workflow`?!Bt&&!Vt:G.actionMode===`browser_recipe`?zt!==null&&ye(zt,G.browserWorkflowInputs):!!G.instruction.trim()),Gt=(0,K.useMemo)(()=>[{name:h.templates.dailyAgent.name,description:h.templates.dailyAgent.description,form:{...Ze,name:h.templates.dailyAgent.name,instruction:h.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:h.templates.morningWorkflow.name,description:h.templates.morningWorkflow.description,form:{...Ze,name:h.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:Mt[0]?.id??``}},{name:h.templates.webhookAgent.name,description:h.templates.webhookAgent.description,form:{...Ze,name:h.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:h.templates.blockedTask.name,description:h.templates.blockedTask.description,form:{...Ze,name:h.templates.blockedTask.formName,triggerMode:`taskBlocked`,instruction:h.templates.blockedTask.instruction}},{name:h.templates.noteCreated.name,description:h.templates.noteCreated.description,form:{...Ze,name:h.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:h.templates.noteCreated.instruction}}],[h,Mt]);(0,K.useEffect)(()=>{if(jt.length===0){J(null);return}De&&jt.some(e=>e.id===De)||J(jt[0].id)},[jt,De]);let Kt=(0,K.useCallback)(async()=>{await Promise.all([Qe.mutate(),et.mutate(),tt.mutate()])},[Qe.mutate,tt.mutate,et.mutate]),qt=(0,K.useCallback)(e=>{if(P){J(null),we(null);return}T(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),J(null),we(null)},[P,T]);(0,K.useEffect)(()=>{P&&(Fe(j),xe(e=>e.projectId===j?e:{...e,projectId:j}))},[j,P]);let $=(0,K.useCallback)(e=>{if(ge(null),be(!1),W(e),H(!0),e===`blank`){xe({...Ze,projectId:j});return}ke(``),X(null),Ne(!1),Fe(j),Le(`new_session`),ze(`attention`)},[j]),Jt=(0,K.useCallback)(e=>{xe(ot(e,Mt)),ge(e.id),be(!1),J(null),W(`blank`),H(!0)},[Mt]),Yt=(0,K.useCallback)(()=>{Y&&(xe({...ot(Y.automation,Mt),projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),ge(null),be(!0),W(`blank`))},[Y,Ie,Re,Pe,Mt]),Xt=(0,K.useCallback)(async()=>{qe(!0),q(null);try{await Kt()}catch(e){q(e instanceof Error?e.message:String(e))}finally{qe(!1)}},[h.feedback.actionFailed,Kt]);(0,K.useEffect)(()=>{if(!E)return;let e=ut.find(e=>e.id===E);e&&(fe(vt(e)?`system`:`all`),J(e.id),T(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[E,ut,T]),(0,K.useEffect)(()=>{O===`create`&&($(`blank`),T(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[O,$,T]),(0,K.useEffect)(()=>{if(!D)return;let e=`${a}:${ue?`auto`:`seed`}:${D}`;F.current!==e&&(F.current=e,ke(D),X(null),Ne(!1),Fe(j),W(`draft`),H(!0),T(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),ue&&(q(null),je(!0),M.draft({prompt:D,language:a}).then(e=>{X(e.draft),Ne(!1)}).catch(e=>{q(e instanceof Error?e.message:String(e))}).finally(()=>{je(!1)})))},[ue,D,a,j,T]);let Zt=(0,K.useCallback)(e=>{let t=dt.find(t=>t.id===e);if(!t||pt(t)||t.readAtMs!=null)return;let n=Date.now();et.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),M.markRunRead(e).catch(e=>{q(e instanceof Error?e.message:String(e)),et.mutate()})},[dt,et.mutate]),Qt=(0,K.useCallback)(e=>{Zt(e),we(e),Ee(!0),T(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Zt,T]),$t=(0,K.useCallback)(e=>{J(e);let t=dt.find(t=>t.automationId===e);t&&t.readAtMs==null&&!pt(t)&&Zt(t.id)},[Zt,dt]);(0,K.useEffect)(()=>{ae&&(Zt(ae),we(ae),Ee(!0))},[Zt,ae]),(0,K.useEffect)(()=>{Ve(null),Ge(!1)},[Ce]);async function en(){if(q(null),Ht){if(_e&&Y){Xe(`draft:edit`);try{let e=$e(G,Rt),{simulation:t}=await M.simulate(e);X({...Y,automation:e,simulation:t}),Fe(G.projectId),Le(G.conversationMode),ze(G.notificationPolicy),Ne(!1),be(!1),W(`draft`)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Xe(null)}return}if(wt){let e=wt.id;await tn(`automation:${e}:edit`,()=>M.update(e,st(wt,G,Rt)))&&(H(!1),ge(null),J(e));return}try{let e=$e(G,Rt),{automation:t}=await M.create(e);xe(Ze),H(!1),fe(`all`),B(``),qt(t.projectId??``),await Kt(),J(t.id)}catch(e){q(e instanceof Error?e.message:String(e))}}}async function tn(e,t){q(null),Xe(e);try{return await t(),await Kt(),!0}catch(e){return q(e instanceof Error?e.message:String(e)),!1}finally{Xe(null)}}async function nn(){await tn(`runs:read-all`,()=>M.markAllRunsRead(j||void 0))}async function rn(){let e=Oe.trim();if(e){q(null),je(!0);try{X((await M.draft({prompt:e,language:a})).draft),Ne(!1)}catch(e){q(e instanceof Error?e.message:String(e))}finally{je(!1)}}}async function an(){if(!Y)return;let e=``,t=``;await tn(`draft:publish`,async()=>{let{automation:n}=await M.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re});X(null),ke(``),Ne(!1),H(!1),fe(`all`),B(``),e=n.id,t=n.projectId??``})&&e&&(qt(t),J(e))}async function on(){if(!Y)return;let e=``,t=``,n=``;await tn(`draft:test`,async()=>{let{automation:r}=await M.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re,enabled:!1}),{run:i}=await M.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,X(null),ke(``),Ne(!1),H(!1),fe(`all`),B(``)})&&e&&n&&(qt(t),J(e),Qt(n))}async function sn(e){q(null),Ue(!0),Ve(null),Ge(!1);try{Ve((await M.repairDraft(e.id,{language:a})).repair)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}async function cn(e){Be&&await tn(`run:${e.id}:repair`,async()=>{await M.update(e.automationId,Be.patch),Ve(null),Ge(!1)})}let ln=(0,K.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{className:`size-9 shrink-0 p-0`,loading:Ke,label:h.refresh,onClick:Xt}),(0,Z.jsxs)(C,{variant:`primary`,onClick:()=>$(`draft`),children:[(0,Z.jsx)(_,{className:`size-4`}),h.new]})]}),[h.new,h.refresh,$,Ke,Xt]);return(0,K.useLayoutEffect)(()=>{if(!t)return w({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:h.subtitle})]}),end:ln}),()=>ne()},[ne,t,ln,h.subtitle,h.title,w]),(0,Z.jsxs)(`div`,{className:x(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,Z.jsxs)(`div`,{className:x(`flex w-full flex-col gap-4`,t?`py-1`:`px-3 py-5 sm:px-5 xl:px-6`),children:[t?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(N,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||h.title})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||h.subtitle})]}),ln]}):null,Se?(0,Z.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:Se}):null,lt?(0,Z.jsx)(St,{}):(0,Z.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[20rem_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle p-3`,children:[P?null:(0,Z.jsxs)(f,{"aria-label":h.filters.project,className:Q,value:j,onChange:e=>qt(e.target.value),children:[(0,Z.jsx)(p,{value:``,children:h.filters.allProjects}),Lt.map(e=>(0,Z.jsx)(p,{value:e.id,children:e.name},e.id))]}),(0,Z.jsxs)(`label`,{className:x(`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg-muted focus-within:border-accent`,!P&&`mt-2`),children:[(0,Z.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:pe,onChange:e=>B(e.target.value),placeholder:h.filters.search})]}),(0,Z.jsxs)(`nav`,{className:`mt-3 flex items-center gap-1`,"aria-label":h.filters.status,children:[[{id:`all`,label:h.filters.all},{id:`active`,label:h.filters.active},{id:`paused`,label:h.paused}].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:x(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,L===e.id&&`bg-surface-hover text-fg`),onClick:()=>fe(e.id),children:e.label},e.id)),(0,Z.jsxs)(de,{children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:x(`ml-auto rounded-md p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,L===`system`&&`bg-surface-hover text-fg`),"aria-label":h.system.title,children:(0,Z.jsx)(m,{className:`size-4`})})}),(0,Z.jsx)(le,{children:(0,Z.jsx)(A,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,Z.jsxs)(k,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>fe(`system`),children:[h.system.title,` `,mt.length]})})})]})]}),Ot.length>0&&L!==`system`?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 rounded-md bg-accent/8 px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,Z.jsxs)(`span`,{children:[h.filters.unread,` · `,Ot.length]}),(0,Z.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:Ye===`runs:read-all`,onClick:()=>void nn(),children:h.filters.markAllRead})]}):null]}),(0,Z.jsx)(kt,{automations:jt,runs:L===`system`?dt:_t,labels:h,cronLabels:g,language:a,selectedAutomationId:De,onOpenDetails:$t})]}),Ct?(0,Z.jsx)(Ft,{automation:Ct,runs:Et,labels:h,cronLabels:g,language:a,projects:Lt,busyAction:Ye,onEdit:Jt,onSelectRun:Qt,onAction:tn}):(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(N,{className:`size-5`}),title:h.empty.filtered})]})]}),(0,Z.jsx)(d,{open:V,onOpenChange:e=>{H(e),e||(ge(null),be(!1))},children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(l,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(u,{className:`text-base font-semibold text-fg`,children:U===`draft`?h.draft.title:wt?h.editTitle:_e?h.draft.editTitle:h.createTitle}),(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,"aria-label":h.close,children:(0,Z.jsx)(v,{className:`size-4`})})})]}),U===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(Tt,{labels:h,prompt:Oe,draft:Y,loading:Ae,approved:Me,publishBusy:Ye===`draft:publish`,testBusy:Ye===`draft:test`,templates:Gt,projects:Lt,projectId:Pe,conversationMode:Ie,notificationPolicy:Re,onPromptChange:ke,onGenerate:rn,onEdit:Yt,onPublish:an,onTest:on,onProjectChange:Fe,onConversationModeChange:Le,onNotificationPolicyChange:ze,projectLocked:P,onApprovedChange:Ne,onDiscard:()=>{X(null),Ne(!1)},onTemplateSelect:e=>{xe({...e,projectId:Pe}),W(`blank`)},onOpenAdvanced:()=>{xe({...Ze,projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),W(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wt,{form:G,labels:h,setForm:xe,projects:Lt,workflowDefinitions:Mt,selectedWorkflow:Rt,workflowsLoading:nt.isLoading,browserWorkflows:Nt,selectedBrowserWorkflow:zt,browserWorkflowsLoading:rt.isLoading,agentOptions:It,agentsLoading:it.isLoading,language:a,projectLocked:P}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[_e?(0,Z.jsx)(C,{variant:`ghost`,onClick:()=>{be(!1),W(`draft`)},children:h.cancel}):(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,children:h.cancel})}),(0,Z.jsx)(C,{variant:`primary`,onClick:en,disabled:!Ht||Ye===`draft:edit`||!!(wt&&Ye),children:Ye===`draft:edit`||wt&&Ye===`automation:${wt.id}:edit`?h.feedback.working:wt||_e?h.save:h.create})]})]})]})]})}),(0,Z.jsx)(d,{open:Te&&!!bt,onOpenChange:e=>{Ee(e),!e&&T(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(l,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(u,{className:`truncate text-base font-semibold text-fg`,children:bt?.automationName??h.dashboard.result}),(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,"aria-label":h.close,children:(0,Z.jsx)(v,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(Pt,{className:`rounded-none border-0`,run:bt,events:Dt,labels:h,cronLabels:g,language:a,loading:tt.isLoading,repairDraft:Be,repairLoading:He,repairApproved:We,busyAction:Ye,onRepairApprovedChange:Ge,onSuggestRepair:sn,onApplyRepair:cn})})]})]})})]})}function Tt(e){let t=(0,xe.c)(108),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,testBusy:c,templates:l,projects:u,projectId:d,conversationMode:ee,notificationPolicy:m,onPromptChange:h,onGenerate:_,onEdit:te,onPublish:v,onTest:y,onProjectChange:b,onConversationModeChange:S,onNotificationPolicyChange:w,onApprovedChange:ne,onDiscard:re,onTemplateSelect:ie,onOpenAdvanced:T,projectLocked:oe}=e,E=s===void 0?!1:s,D=c===void 0?!1:c,O=oe===void 0?!1:oe,k=!!(i&&i.simulation.requiredConfirmations.length>0),se;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(ae,{className:`size-4 text-accent`}),t[0]=se):se=t[0];let A;t[1]===n.draft.title?A=t[2]:(A=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[se,n.draft.title]}),t[1]=n.draft.title,t[2]=A);let j;t[3]===n.draft.subtitle?j=t[4]:(j=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=j);let M;t[5]!==A||t[6]!==j?(M=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[A,j]}),t[5]=A,t[6]=j,t[7]=M):M=t[7];let ce;t[8]!==a||t[9]!==r?(ce=a||!r.trim(),t[8]=a,t[9]=r,t[10]=ce):ce=t[10];let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ae,{className:`size-4`}),t[11]=N):N=t[11];let P=a?n.draft.generating:n.draft.generate,le;t[12]!==_||t[13]!==P||t[14]!==ce?(le=(0,Z.jsxs)(C,{variant:`primary`,onClick:_,disabled:ce,children:[N,P]}),t[12]=_,t[13]=P,t[14]=ce,t[15]=le):le=t[15];let ue;t[16]!==le||t[17]!==M?(ue=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[M,le]}),t[16]=le,t[17]=M,t[18]=ue):ue=t[18];let F;t[19]===h?F=t[20]:(F=e=>h(e.target.value),t[19]=h,t[20]=F);let I;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==F?(I=(0,Z.jsx)(`textarea`,{className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:F,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=F,t[24]=I):I=t[24];let L=O?`sm:grid-cols-2`:`sm:grid-cols-3`,R;t[25]===L?R=t[26]:(R=x(`mt-3 grid gap-3`,L),t[25]=L,t[26]=R);let de;t[27]!==n.draft.noProject||t[28]!==n.draft.project||t[29]!==b||t[30]!==d||t[31]!==O||t[32]!==u?(de=O?null:(0,Z.jsx)($,{label:n.draft.project,children:(0,Z.jsxs)(f,{className:Q,value:d,onChange:e=>b(e.target.value),children:[(0,Z.jsx)(p,{value:``,children:n.draft.noProject}),u.map(Et)]})}),t[27]=n.draft.noProject,t[28]=n.draft.project,t[29]=b,t[30]=d,t[31]=O,t[32]=u,t[33]=de):de=t[33];let z;t[34]===S?z=t[35]:(z=e=>S(e.target.value),t[34]=S,t[35]=z);let pe;t[36]===n.draft.newConversation?pe=t[37]:(pe=(0,Z.jsx)(p,{value:`new_session`,children:n.draft.newConversation}),t[36]=n.draft.newConversation,t[37]=pe);let B;t[38]===n.draft.continuousConversation?B=t[39]:(B=(0,Z.jsx)(p,{value:`continuous`,children:n.draft.continuousConversation}),t[38]=n.draft.continuousConversation,t[39]=B);let V;t[40]!==ee||t[41]!==z||t[42]!==pe||t[43]!==B?(V=(0,Z.jsxs)(f,{className:Q,value:ee,onChange:z,children:[pe,B]}),t[40]=ee,t[41]=z,t[42]=pe,t[43]=B,t[44]=V):V=t[44];let H;t[45]!==n.draft.conversation||t[46]!==V?(H=(0,Z.jsx)($,{label:n.draft.conversation,children:V}),t[45]=n.draft.conversation,t[46]=V,t[47]=H):H=t[47];let U;t[48]===w?U=t[49]:(U=e=>w(e.target.value),t[48]=w,t[49]=U);let W;t[50]===n.draft.notifyAttention?W=t[51]:(W=(0,Z.jsx)(p,{value:`attention`,children:n.draft.notifyAttention}),t[50]=n.draft.notifyAttention,t[51]=W);let me;t[52]===n.draft.notifyAll?me=t[53]:(me=(0,Z.jsx)(p,{value:`all`,children:n.draft.notifyAll}),t[52]=n.draft.notifyAll,t[53]=me);let he;t[54]===n.draft.notifyNone?he=t[55]:(he=(0,Z.jsx)(p,{value:`none`,children:n.draft.notifyNone}),t[54]=n.draft.notifyNone,t[55]=he);let ge;t[56]!==m||t[57]!==U||t[58]!==W||t[59]!==me||t[60]!==he?(ge=(0,Z.jsxs)(f,{className:Q,value:m,onChange:U,children:[W,me,he]}),t[56]=m,t[57]=U,t[58]=W,t[59]=me,t[60]=he,t[61]=ge):ge=t[61];let _e;t[62]!==n.draft.notifications||t[63]!==ge?(_e=(0,Z.jsx)($,{label:n.draft.notifications,children:ge}),t[62]=n.draft.notifications,t[63]=ge,t[64]=_e):_e=t[64];let ve;t[65]!==R||t[66]!==de||t[67]!==H||t[68]!==_e?(ve=(0,Z.jsxs)(`div`,{className:R,children:[de,H,_e]}),t[65]=R,t[66]=de,t[67]=H,t[68]=_e,t[69]=ve):ve=t[69];let ye;t[70]!==i||t[71]!==n.draft.advancedCreate||t[72]!==n.draft.suggestions||t[73]!==n.draft.suggestionsDescription||t[74]!==T||t[75]!==ie||t[76]!==l?(ye=i?null:(0,Z.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,Z.jsx)(C,{variant:`ghost`,onClick:T,children:n.draft.advancedCreate})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.slice(0,4).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>ie(e.form),children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]},e.name))})]}),t[70]=i,t[71]=n.draft.advancedCreate,t[72]=n.draft.suggestions,t[73]=n.draft.suggestionsDescription,t[74]=T,t[75]=ie,t[76]=l,t[77]=ye):ye=t[77];let be;t[78]!==o||t[79]!==i||t[80]!==n.draft.approval||t[81]!==n.draft.assumptions||t[82]!==n.draft.discard||t[83]!==n.draft.edit||t[84]!==n.draft.publish||t[85]!==n.draft.review||t[86]!==n.draft.risks||t[87]!==n.draft.safety||t[88]!==n.draft.testOnce||t[89]!==n.draft.testing||t[90]!==n.feedback||t[91]!==n.info||t[92]!==n.none||t[93]!==ne||t[94]!==re||t[95]!==te||t[96]!==v||t[97]!==y||t[98]!==E||t[99]!==k||t[100]!==D?(be=i?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,Z.jsx)(Ht,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(Ht,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,Z.jsx)(Dt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.risks,items:i.risks,empty:n.none}),k?(0,Z.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>ne(e.target.checked)}),(0,Z.jsx)(`span`,{children:n.draft.approval})]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(C,{variant:`ghost`,onClick:re,children:n.draft.discard}),(0,Z.jsxs)(C,{variant:`secondary`,onClick:te,children:[(0,Z.jsx)(g,{className:`size-4`}),n.draft.edit]}),(0,Z.jsxs)(C,{variant:`secondary`,onClick:y,disabled:D||E||k&&!o,children:[(0,Z.jsx)(fe,{className:`size-4`}),D?n.draft.testing:n.draft.testOnce]}),(0,Z.jsx)(C,{variant:`primary`,onClick:v,disabled:E||k&&!o,children:E?n.feedback.working:n.draft.publish})]})]})]}):null,t[78]=o,t[79]=i,t[80]=n.draft.approval,t[81]=n.draft.assumptions,t[82]=n.draft.discard,t[83]=n.draft.edit,t[84]=n.draft.publish,t[85]=n.draft.review,t[86]=n.draft.risks,t[87]=n.draft.safety,t[88]=n.draft.testOnce,t[89]=n.draft.testing,t[90]=n.feedback,t[91]=n.info,t[92]=n.none,t[93]=ne,t[94]=re,t[95]=te,t[96]=v,t[97]=y,t[98]=E,t[99]=k,t[100]=D,t[101]=be):be=t[101];let G;return t[102]!==ue||t[103]!==I||t[104]!==ve||t[105]!==ye||t[106]!==be?(G=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[ue,I,ve,ye,be]}),t[102]=ue,t[103]=I,t[104]=ve,t[105]=ye,t[106]=be,t[107]=G):G=t[107],G}function Et(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}function Dt(e){let t=(0,xe.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(Ot):(0,Z.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Ot(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function kt(e){let t=(0,xe.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:c}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(N,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,Z.jsx)(Ut,{className:`rounded-none border-0 shadow-none`,icon:e,title:i.empty.filtered}),t[1]=i.empty.filtered,t[2]=n),n}let l;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(At),n=t.find(pt),l=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:x(`block w-full p-3 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,s===e.id&&`bg-surface-hover`),onClick:()=>c(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:x(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:ht(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),l&&l.readAtMs==null&&!pt(l)?(0,Z.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,Z.jsx)(`div`,{className:`mt-1 truncate pl-4 text-xs text-fg-muted`,children:Je(e.trigger,i,a,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center justify-between gap-2 pl-4 text-xs text-fg-subtle`,children:[(0,Z.jsx)(`span`,{className:x(`truncate`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.enabled?`${i.next}: ${ct(e.state.nextRunAtMs,i,o)}`:i.paused}),l?.status?(0,Z.jsx)(`span`,{className:x(`shrink-0 rounded-full px-1.5 py-0.5`,dt(l.status)),children:i.status[l.status]}):null]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=c,t[15]=r,t[16]=s,t[17]=e):e=t[17],l=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=s,t[10]=l}else l=t[10];let u;return t[18]===l?u=t[19]:(u=(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:l}),t[18]=l,t[19]=u),u}function At(e,t){return t.createdAtMs-e.createdAtMs}function jt(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`completion_hook.started`:return n.completionHookStarted;case`completion_hook.completed`:return n.completionHookCompleted;case`completion_hook.failed`:return n.completionHookFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Mt(e){let t=(0,xe.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,K.useState)(a===void 0?!1:a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
2
- `),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`
3
- `).slice(0,10).join(`
4
- `).trimEnd()}...`:l,t[4]=f,t[5]=l,t[6]=p):p=t[6];let ee=p,m;t[7]!==o||t[8]!==f||t[9]!==r||t[10]!==i?(m=f?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Nt),"aria-expanded":o,children:[(0,Z.jsx)(`span`,{children:i}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,Z.jsx)(pe,{className:x(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=f,t[9]=r,t[10]=i,t[11]=m):m=t[11];let h=o||!f?l:ee,g;t[12]===h?g=t[13]:(g=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:h}),t[12]=h,t[13]=g);let _;return t[14]!==m||t[15]!==g?(_=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[m,g]}),t[14]=m,t[15]=g,t[16]=_):_=t[16],_}function Nt(e){return!e}function Pt(e){let t=(0,xe.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:c,loading:l,repairDraft:u,repairLoading:d,repairApproved:f,busyAction:p,onRepairApprovedChange:m,onSuggestRepair:g,onApplyRepair:_}=e;if(!r){let e;t[0]===n?e=t[1]:(e=x(`flex min-h-64 flex-col justify-center rounded-lg border border-edge-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(ue,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===o.selectRun?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`mt-2`,children:o.selectRun}),t[3]=o.selectRun,t[4]=i);let a;return t[5]!==e||t[6]!==i?(a=(0,Z.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=a):a=t[7],a}let te=r.error||r.summary,v=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,y=r.sessionKey?o.runDetail.openConversation:o.runDetail.openWorkflow,b=r.sessionKey?ne:L,S=pt(r)?ue:mt(r)?ie:ee,re;t[8]===n?re=t[9]:(re=x(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=re);let T;t[10]===r.automationName?T=t[11]:(T=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=T);let oe;t[12]===r.id?oe=t[13]:(oe=r.id.slice(0,8),t[12]=r.id,t[13]=oe);let D;t[14]===oe?D=t[15]:(D=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:oe}),t[14]=oe,t[15]=D);let O;t[16]!==T||t[17]!==D?(O=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[T,D]}),t[16]=T,t[17]=D,t[18]=O):O=t[18];let k;t[19]===r.status?k=t[20]:(k=x(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(r.status)),t[19]=r.status,t[20]=k);let se=o.status[r.status],A;t[21]!==k||t[22]!==se?(A=(0,Z.jsx)(`span`,{className:k,children:se}),t[21]=k,t[22]=se,t[23]=A):A=t[23];let M;t[24]!==O||t[25]!==A?(M=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[O,A]}),t[24]=O,t[25]=A,t[26]=M):M=t[26];let ce;t[27]!==o||t[28]!==c||t[29]!==r.createdAtMs?(ce=ct(r.createdAtMs,o,c),t[27]=o,t[28]=c,t[29]=r.createdAtMs,t[30]=ce):ce=t[30];let N;t[31]===ce?N=t[32]:(N=(0,Z.jsx)(`span`,{children:ce}),t[31]=ce,t[32]=N);let P;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=P):P=t[33];let le=o.details.duration,F;t[34]!==o||t[35]!==r.durationMs?(F=ft(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=F):F=t[36];let I;t[37]!==o.details.duration||t[38]!==F?(I=(0,Z.jsxs)(`span`,{children:[le,` `,F]}),t[37]=o.details.duration,t[38]=F,t[39]=I):I=t[39];let R;t[40]!==N||t[41]!==I?(R=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[N,P,I]}),t[40]=N,t[41]=I,t[42]=R):R=t[42];let de;t[43]!==o.repair||t[44]!==g||t[45]!==d||t[46]!==r?(de=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(C,{variant:`secondary`,onClick:()=>g(r),disabled:d,children:[(0,Z.jsx)(ae,{className:`size-4`}),d?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=g,t[45]=d,t[46]=r,t[47]=de):de=t[47];let fe;t[48]!==R||t[49]!==de||t[50]!==M?(fe=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[M,R,de]}),t[48]=R,t[49]=de,t[50]=M,t[51]=fe):fe=t[51];let z;t[52]===r?z=t[53]:(z=pt(r)?`text-blue-500`:mt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=z);let B;t[54]===z?B=t[55]:(B=x(`size-4`,z),t[54]=z,t[55]=B);let V;t[56]!==S||t[57]!==B?(V=(0,Z.jsx)(S,{className:B}),t[56]=S,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==o.runDetail.resultTitle||t[60]!==V?(H=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[V,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=V,t[61]=H):H=t[61];let U;t[62]!==b||t[63]!==y||t[64]!==v?(U=v?(0,Z.jsx)(C,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:v,children:[(0,Z.jsx)(b,{className:`size-3.5`}),y,(0,Z.jsx)(E,{className:`size-3.5`})]})}):null,t[62]=b,t[63]=y,t[64]=v,t[65]=U):U=t[65];let W;t[66]!==H||t[67]!==U?(W=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[H,U]}),t[66]=H,t[67]=U,t[68]=W):W=t[68];let me=r.error&&`border-red-500/25 bg-red-500/5`,he;t[69]===me?he=t[70]:(he=x(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,me),t[69]=me,t[70]=he);let ge;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==te||t[74]!==r?(ge=te?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:te}):(0,Z.jsx)(h,{content:te,compact:!0,className:`text-sm`}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:pt(r)?o.runDetail.resultPending:o.runDetail.noResult}),t[71]=o.runDetail.noResult,t[72]=o.runDetail.resultPending,t[73]=te,t[74]=r,t[75]=ge):ge=t[75];let _e;t[76]!==he||t[77]!==ge?(_e=(0,Z.jsx)(`div`,{className:he,children:ge}),t[76]=he,t[77]=ge,t[78]=_e):_e=t[78];let ve;t[79]!==W||t[80]!==_e?(ve=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[W,_e]}),t[79]=W,t[80]=_e,t[81]=ve):ve=t[81];let ye;t[82]===o.runDetail.runInfo?ye=t[83]:(ye=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=ye);let be;t[84]!==s||t[85]!==o||t[86]!==c||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(be=r.manual?o.trigger.manual:Je(r.triggerSnapshot,o,s,c),t[84]=s,t[85]=o,t[86]=c,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=be):be=t[89];let G;t[90]!==o.explain.whyRan||t[91]!==be?(G=(0,Z.jsx)(Bt,{label:o.explain.whyRan,value:be}),t[90]=o.explain.whyRan,t[91]=be,t[92]=G):G=t[92];let K=o.details.started,Se;t[93]!==o||t[94]!==c||t[95]!==r.startedAtMs?(Se=ct(r.startedAtMs,o,c),t[93]=o,t[94]=c,t[95]=r.startedAtMs,t[96]=Se):Se=t[96];let q;t[97]!==o.details.started||t[98]!==Se?(q=(0,Z.jsx)(Bt,{label:K,value:Se}),t[97]=o.details.started,t[98]=Se,t[99]=q):q=t[99];let Ce;t[100]!==o.details.model||t[101]!==r.model?(Ce=r.model?(0,Z.jsx)(Bt,{label:o.details.model,value:r.model}):null,t[100]=o.details.model,t[101]=r.model,t[102]=Ce):Ce=t[102];let we;t[103]!==G||t[104]!==q||t[105]!==Ce?(we=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[G,q,Ce]}),t[103]=G,t[104]=q,t[105]=Ce,t[106]=we):we=t[106];let Te;t[107]!==ye||t[108]!==we?(Te=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ye,we]}),t[107]=ye,t[108]=we,t[109]=Te):Te=t[109];let Ee;t[110]!==p||t[111]!==o||t[112]!==_||t[113]!==m||t[114]!==f||t[115]!==u||t[116]!==r?(Ee=u?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:u.explanation}),u.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:u.expectedEffect}):null,(0,Z.jsx)(Dt,{title:o.repair.risks,items:u.risks,empty:o.none}),(0,Z.jsx)(Mt,{value:u.patch,labels:o,title:o.details.repairPatch}),u.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:f,onChange:e=>m(e.target.checked)}),(0,Z.jsx)(`span`,{children:o.repair.approval})]}):null,(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsx)(C,{variant:`primary`,onClick:()=>_(r),disabled:p===`run:${r.id}:repair`||u.requiresApproval&&!f,children:p===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=p,t[111]=o,t[112]=_,t[113]=m,t[114]=f,t[115]=u,t[116]=r,t[117]=Ee):Ee=t[117];let De;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(j,{className:`size-4 shrink-0`}),t[118]=De):De=t[118];let J;t[119]===o.runDetail.technicalEvents?J=t[120]:(J=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[De,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=J);let Oe;t[121]!==i.length||t[122]!==o.runDetail.eventCount?(Oe=o.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=o.runDetail.eventCount,t[123]=Oe):Oe=t[123];let ke;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(pe,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=ke):ke=t[124];let Y;t[125]===Oe?Y=t[126]:(Y=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[Oe,ke]}),t[125]=Oe,t[126]=Y);let X;t[127]!==J||t[128]!==Y?(X=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[J,Y]}),t[127]=J,t[128]=Y,t[129]=X):X=t[129];let Ae;t[130]===o.runDetail.technicalEventsDescription?Ae=t[131]:(Ae=(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:o.runDetail.technicalEventsDescription}),t[130]=o.runDetail.technicalEventsDescription,t[131]=Ae);let je;t[132]!==i||t[133]!==o||t[134]!==c||t[135]!==l?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:l?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":o.loading,children:[(0,Z.jsx)(w,{className:`h-10 w-full`}),(0,Z.jsx)(w,{className:`h-10 w-4/5`}),(0,Z.jsx)(w,{className:`h-10 w-11/12`})]}):i.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,Z.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,Z.jsx)(`span`,{className:x(`mt-1 size-2 rounded-full`,Vt(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:jt(e,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[ct(e.createdAtMs,o,c),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[o.details.eventData,(0,Z.jsx)(pe,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,Z.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=o,t[134]=c,t[135]=l,t[136]=je):je=t[136];let Me;t[137]!==X||t[138]!==Ae||t[139]!==je?(Me=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[X,Ae,je]}),t[137]=X,t[138]=Ae,t[139]=je,t[140]=Me):Me=t[140];let Ne;return t[141]!==re||t[142]!==fe||t[143]!==ve||t[144]!==Te||t[145]!==Ee||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:re,children:[fe,ve,Te,Ee,Me]}),t[141]=re,t[142]=fe,t[143]=ve,t[144]=Te,t[145]=Ee,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Ft(e){let t=(0,xe.c)(83),{automation:n,runs:r,labels:i,cronLabels:a,language:o,projects:s,busyAction:c,onEdit:l,onSelectRun:u,onAction:d}=e,f=c===`automation:${n.id}:run`,p=c===`automation:${n.id}:toggle`,_=c===`automation:${n.id}:delete`,te;t[0]===n?te=t[1]:(te=vt(n),t[0]=n,t[1]=te);let v=te,y;t[2]===n.name?y=t[3]:(y=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=y);let b=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,S;t[4]===b?S=t[5]:(S=x(`shrink-0 rounded-full px-2 py-0.5 text-xs`,b),t[4]=b,t[5]=S);let w=n.enabled?i.enabled:i.paused,ne;t[6]!==S||t[7]!==w?(ne=(0,Z.jsx)(`span`,{className:S,children:w}),t[6]=S,t[7]=w,t[8]=ne):ne=t[8];let re;t[9]!==y||t[10]!==ne?(re=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[y,ne]}),t[9]=y,t[10]=ne,t[11]=re):re=t[11];let ie;t[12]===n?ie=t[13]:(ie=yt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:yt(n)}):null,t[12]=n,t[13]=ie);let T;t[14]!==re||t[15]!==ie?(T=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[re,ie]}),t[14]=re,t[15]=ie,t[16]=T):T=t[16];let ae;t[17]!==n||t[18]!==c||t[19]!==_||t[20]!==i.dashboard.delete||t[21]!==i.dashboard.deleted||t[22]!==i.dashboard.pause||t[23]!==i.dashboard.resume||t[24]!==i.dashboard.resumed||t[25]!==i.dashboard.runNow||t[26]!==i.details||t[27]!==i.edit||t[28]!==i.feedback||t[29]!==d||t[30]!==l||t[31]!==v||t[32]!==f||t[33]!==p?(ae=v?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(C,{variant:`secondary`,disabled:c!==null,onClick:()=>void d(`automation:${n.id}:toggle`,()=>n.enabled?M.pause(n.id):M.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[p?(0,Z.jsx)(P,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(se,{className:`size-4`}):(0,Z.jsx)(fe,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(C,{variant:`primary`,disabled:c!==null,onClick:()=>void d(`automation:${n.id}:run`,()=>M.runNow(n.id),i.feedback.rerunQueued),children:[f?(0,Z.jsx)(P,{className:`size-4 animate-spin`}):(0,Z.jsx)(fe,{className:`size-4`}),i.dashboard.runNow]}),(0,Z.jsxs)(de,{children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,className:`size-9 p-0`,"aria-label":i.details.moreActions,children:(0,Z.jsx)(m,{className:`size-4`})})}),(0,Z.jsx)(le,{children:(0,Z.jsxs)(A,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(k,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>l(n),children:[(0,Z.jsx)(g,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(k,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-red-700 outline-none hover:bg-red-500/10 dark:text-red-300`,disabled:c!==null,onSelect:()=>void d(`automation:${n.id}:delete`,()=>M.remove(n.id),i.dashboard.deleted),children:[_?(0,Z.jsx)(P,{className:`size-4 animate-spin`}):(0,Z.jsx)(D,{className:`size-4`}),i.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=c,t[19]=_,t[20]=i.dashboard.delete,t[21]=i.dashboard.deleted,t[22]=i.dashboard.pause,t[23]=i.dashboard.resume,t[24]=i.dashboard.resumed,t[25]=i.dashboard.runNow,t[26]=i.details,t[27]=i.edit,t[28]=i.feedback,t[29]=d,t[30]=l,t[31]=v,t[32]=f,t[33]=p,t[34]=ae):ae=t[34];let oe;t[35]!==ae||t[36]!==T?(oe=(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[T,ae]}),t[35]=ae,t[36]=T,t[37]=oe):oe=t[37];let E;t[38]===i.info.task?E=t[39]:(E=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.info.task}),t[38]=i.info.task,t[39]=E);let O;t[40]!==n||t[41]!==i?(O=gt(n,i),t[40]=n,t[41]=i,t[42]=O):O=t[42];let j;t[43]===O?j=t[44]:(j=(0,Z.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsx)(h,{content:O,compact:!0})}),t[43]=O,t[44]=j);let N;t[45]!==E||t[46]!==j?(N=(0,Z.jsxs)(`section`,{children:[E,j]}),t[45]=E,t[46]=j,t[47]=N):N=t[47];let F;t[48]!==n||t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==s?(F=(0,Z.jsx)(Lt,{automation:n,labels:i,cronLabels:a,language:o,projects:s}),t[48]=n,t[49]=a,t[50]=i,t[51]=o,t[52]=s,t[53]=F):F=t[53];let I;t[54]===i.dashboard.runHistory?I=t[55]:(I=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),t[54]=i.dashboard.runHistory,t[55]=I);let L;t[56]===i.dashboard.runHistoryDescription?L=t[57]:(L=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription}),t[56]=i.dashboard.runHistoryDescription,t[57]=L);let R;t[58]!==I||t[59]!==L?(R=(0,Z.jsxs)(`div`,{children:[I,L]}),t[58]=I,t[59]=L,t[60]=R):R=t[60];let z;t[61]===r.length?z=t[62]:(z=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[61]=r.length,t[62]=z);let pe;t[63]!==R||t[64]!==z?(pe=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[R,z]}),t[63]=R,t[64]=z,t[65]=pe):pe=t[65];let B;t[66]!==i||t[67]!==o||t[68]!==u||t[69]!==r?(B=r.length===0?(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(ue,{className:`size-5`}),title:i.empty.runs}):(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:r.slice(0,8).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`block w-full p-3 text-left hover:bg-surface-hover`,onClick:()=>u(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,Z.jsx)(ee,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(ue,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:ct(e.createdAtMs,i,o)})]}),(0,Z.jsx)(`span`,{className:x(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:x(`mt-1 line-clamp-2 pl-6 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||lt(e.actionSnapshot,i)})]},e.id))}),t[66]=i,t[67]=o,t[68]=u,t[69]=r,t[70]=B):B=t[70];let V;t[71]!==pe||t[72]!==B?(V=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[pe,B]}),t[71]=pe,t[72]=B,t[73]=V):V=t[73];let H;t[74]!==F||t[75]!==V?(H=(0,Z.jsxs)(`div`,{className:`grid items-start gap-5 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[F,V]}),t[74]=F,t[75]=V,t[76]=H):H=t[76];let U;t[77]!==N||t[78]!==H?(U=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[N,H]}),t[77]=N,t[78]=H,t[79]=U):U=t[79];let W;return t[80]!==oe||t[81]!==U?(W=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[oe,U]}),t[80]=oe,t[81]=U,t[82]=W):W=t[82],W}function It(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Lt(e){let t=(0,xe.c)(146),{automation:n,labels:r,cronLabels:i,language:a,projects:o}=e,s,c,l,u,d,f,p,ee,m,h,g;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=ut(n),o;t[15]!==n||t[16]!==r||t[17]!==a?(o=Ye(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=o):o=t[18];let _=o,te;t[19]!==n.state.nextRunAtMs||t[20]!==a?(te=n.state.nextRunAtMs?We(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=te):te=t[21];let v=te;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(g=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],g.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],g.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=We(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],g.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],g.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],g.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],g.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],g.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],g.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],g.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=g}else g=t[39];m=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?h=t[71]:(h=(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=h),f=`grid gap-4 p-4`;let y;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[72]=y):y=t[72];let b=r.info.schedule,x;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(x=Je(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=x):x=t[77];let S=n.enabled?`${r.info.nextRun}:${_}`:_;t[78]!==r.info.schedule||t[79]!==v||t[80]!==x||t[81]!==S?(p=(0,Z.jsx)(zt,{icon:y,label:b,value:x,description:S,descriptionTitle:v}),t[78]=r.info.schedule,t[79]=v,t[80]=x,t[81]=S,t[82]=p):p=t[82];let C;t[83]===n.action.kind?C=t[84]:(C=n.action.kind===`workflow`?(0,Z.jsx)(L,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_recipe`?(0,Z.jsx)(j,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=C);let w=r.info.action,ne;t[85]!==n.action||t[86]!==r?(ne=lt(n.action,r),t[85]=n.action,t[86]=r,t[87]=ne):ne=t[87],t[88]!==r.info.action||t[89]!==C||t[90]!==ne?(ee=(0,Z.jsx)(zt,{icon:C,label:w,value:ne}),t[88]=r.info.action,t[89]=C,t[90]=ne,t[91]=ee):ee=t[91],s=zt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[92]=c):c=t[92],l=r.info.permission,u=r.safety[e],d=It(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=ee,t[12]=m,t[13]=h,t[14]=g}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],ee=t[11],m=t[12],h=t[13],g=t[14];let _;t[93]!==s||t[94]!==c||t[95]!==l||t[96]!==u||t[97]!==d?(_=(0,Z.jsx)(s,{icon:c,label:l,value:u,description:d}),t[93]=s,t[94]=c,t[95]=l,t[96]=u,t[97]=d,t[98]=_):_=t[98];let te;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(L,{className:`size-4`,"aria-hidden":!0}),t[99]=te):te=t[99];let v;t[100]!==n.projectId||t[101]!==r.info.noProject||t[102]!==o?(v=o.find(e=>e.id===n.projectId)?.name??r.info.noProject,t[100]=n.projectId,t[101]=r.info.noProject,t[102]=o,t[103]=v):v=t[103];let y;t[104]!==r.info.project||t[105]!==v?(y=(0,Z.jsx)(zt,{icon:te,label:r.info.project,value:v}),t[104]=r.info.project,t[105]=v,t[106]=y):y=t[106];let b;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[107]=b):b=t[107];let x=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,S;t[108]!==r.info.conversation||t[109]!==x?(S=(0,Z.jsx)(zt,{icon:b,label:r.info.conversation,value:x}),t[108]=r.info.conversation,t[109]=x,t[110]=S):S=t[110];let C;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[111]=C):C=t[111];let w=n.notificationPolicy===`all`?r.info.notifyAll:n.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,re;t[112]!==r.info.notifications||t[113]!==w?(re=(0,Z.jsx)(zt,{icon:C,label:r.info.notifications,value:w}),t[112]=r.info.notifications,t[113]=w,t[114]=re):re=t[114];let ae;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t[115]=ae):ae=t[115];let oe=r.info.lastRun,E;t[116]!==n||t[117]!==r||t[118]!==a?(E=Xe(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=E):E=t[119];let D=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,O;t[120]!==r.info.lastRun||t[121]!==E||t[122]!==D?(O=(0,Z.jsx)(zt,{icon:ae,label:oe,value:E,valueTone:D}),t[120]=r.info.lastRun,t[121]=E,t[122]=D,t[123]=O):O=t[123];let k;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(k=n.state.consecutiveFailures?(0,Z.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[124]=n.state.consecutiveFailures,t[125]=n.state.lastError,t[126]=r.dashboard,t[127]=k):k=t[127];let se;t[128]!==r.info.technicalDetails||t[129]!==g?(se=g.length>0?(0,Z.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,Z.jsx)(`span`,{children:r.info.technicalDetails}),(0,Z.jsx)(pe,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:g.map(Rt)})]}):null,t[128]=r.info.technicalDetails,t[129]=g,t[130]=se):se=t[130];let A;t[131]!==_||t[132]!==y||t[133]!==S||t[134]!==re||t[135]!==O||t[136]!==k||t[137]!==se||t[138]!==f||t[139]!==p||t[140]!==ee?(A=(0,Z.jsxs)(`div`,{className:f,children:[p,ee,_,y,S,re,O,k,se]}),t[131]=_,t[132]=y,t[133]=S,t[134]=re,t[135]=O,t[136]=k,t[137]=se,t[138]=f,t[139]=p,t[140]=ee,t[141]=A):A=t[141];let M;return t[142]!==A||t[143]!==m||t[144]!==h?(M=(0,Z.jsxs)(`aside`,{className:m,children:[h,A]}),t[142]=A,t[143]=m,t[144]=h,t[145]=M):M=t[145],M}function Rt(e){return(0,Z.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function zt(e){let t=(0,xe.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,c=s===void 0?`default`:s,l;t[0]===n?l=t[1]:(l=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=u);let d=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,f;t[4]===d?f=t[5]:(f=x(`mt-1 text-sm font-medium leading-5`,d),t[4]=d,t[5]=f);let p;t[6]!==f||t[7]!==i?(p=(0,Z.jsx)(`div`,{className:f,children:i}),t[6]=f,t[7]=i,t[8]=p):p=t[8];let ee;t[9]!==a||t[10]!==o?(ee=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=ee):ee=t[11];let m;t[12]!==u||t[13]!==p||t[14]!==ee?(m=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,p,ee]}),t[12]=u,t[13]=p,t[14]=ee,t[15]=m):m=t[15];let h;return t[16]!==l||t[17]!==m?(h=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,m]}),t[16]=l,t[17]=m,t[18]=h):h=t[18],h}function Bt(e){let t=(0,xe.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Vt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Ht(e){let t=(0,xe.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ut(e){let t=(0,xe.c)(8),{className:n,icon:r,title:i}=e,a;t[0]===n?a=t[1]:(a=x(`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge-subtle bg-surface-base text-fg-muted shadow-surface`,n),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:i}),t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`div`,{className:a,children:[r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Wt(e){let t=(0,xe.c)(274),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:o,selectedWorkflow:s,workflowsLoading:c,browserWorkflows:l,selectedBrowserWorkflow:u,browserWorkflowsLoading:d,agentOptions:ee,agentsLoading:m,language:h,projectLocked:g}=e,_=g===void 0?!1:g,te=y(h).agentsSettings,v;t[0]===i?v=t[1]:(v=e=>i(t=>({...t,...e})),t[0]=i,t[1]=v);let b=v,S=Be(n.intervalValue,n.intervalUnit),C=Date.now(),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=[1,2,3],t[2]=w):w=t[2];let ne;t[3]!==S||t[4]!==C||t[5]!==h?(ne=w.map(e=>Ke(C+S*e,h,C)),t[3]=S,t[4]=C,t[5]=h,t[6]=ne):ne=t[6];let re=ne,ie,T;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==o?(ie=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=o[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},T=[n.actionMode,n.workflowId,i,o],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=o,t[11]=ie,t[12]=T):(ie=t[11],T=t[12]),(0,K.useEffect)(ie,T);let ae,oe;t[13]!==l||t[14]!==n.actionMode||t[15]!==n.browserWorkflowId||t[16]!==i?(ae=()=>{if(n.actionMode!==`browser_recipe`||n.browserWorkflowId.trim())return;let e=l[0];e&&i(t=>({...t,browserWorkflowId:e.id,browserWorkflowInputs:be(e)}))},oe=[l,n.actionMode,n.browserWorkflowId,i],t[13]=l,t[14]=n.actionMode,t[15]=n.browserWorkflowId,t[16]=i,t[17]=ae,t[18]=oe):(ae=t[17],oe=t[18]),(0,K.useEffect)(ae,oe);let E;t[19]===b?E=t[20]:(E=e=>b({name:e.target.value}),t[19]=b,t[20]=E);let D;t[21]!==n.name||t[22]!==E?(D=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:E}),t[21]=n.name,t[22]=E,t[23]=D):D=t[23];let k;t[24]!==r.form.name||t[25]!==D?(k=(0,Z.jsx)($,{label:r.form.name,children:D}),t[24]=r.form.name,t[25]=D,t[26]=k):k=t[26];let se;t[27]===b?se=t[28]:(se=e=>b({description:e.target.value}),t[27]=b,t[28]=se);let A;t[29]!==n.description||t[30]!==se?(A=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:se}),t[29]=n.description,t[30]=se,t[31]=A):A=t[31];let j;t[32]!==r.form.description||t[33]!==A?(j=(0,Z.jsx)($,{label:r.form.description,children:A}),t[32]=r.form.description,t[33]=A,t[34]=j):j=t[34];let M;t[35]!==n.projectId||t[36]!==r.form.noProject||t[37]!==r.form.project||t[38]!==_||t[39]!==a||t[40]!==b?(M=_?null:(0,Z.jsx)($,{label:r.form.project,children:(0,Z.jsxs)(f,{className:Q,value:n.projectId,onChange:e=>b({projectId:e.target.value}),children:[(0,Z.jsx)(p,{value:``,children:r.form.noProject}),a.map(qt)]})}),t[35]=n.projectId,t[36]=r.form.noProject,t[37]=r.form.project,t[38]=_,t[39]=a,t[40]=b,t[41]=M):M=t[41];let ce;t[42]===r.form.trigger?ce=t[43]:(ce=(0,Z.jsx)(Jt,{title:r.form.trigger}),t[42]=r.form.trigger,t[43]=ce);let N;t[44]===b?N=t[45]:(N=e=>b({triggerMode:e.target.value}),t[44]=b,t[45]=N);let P;t[46]===r.trigger.manual?P=t[47]:(P=(0,Z.jsx)(p,{value:`manual`,children:r.trigger.manual}),t[46]=r.trigger.manual,t[47]=P);let le;t[48]===r.trigger.once?le=t[49]:(le=(0,Z.jsx)(p,{value:`once`,children:r.trigger.once}),t[48]=r.trigger.once,t[49]=le);let ue;t[50]===r.trigger.daily?ue=t[51]:(ue=(0,Z.jsx)(p,{value:`daily`,children:r.trigger.daily}),t[50]=r.trigger.daily,t[51]=ue);let F;t[52]===r.trigger.weekly?F=t[53]:(F=(0,Z.jsx)(p,{value:`weekly`,children:r.trigger.weekly}),t[52]=r.trigger.weekly,t[53]=F);let I;t[54]===r.trigger.interval?I=t[55]:(I=(0,Z.jsx)(p,{value:`interval`,children:r.trigger.interval}),t[54]=r.trigger.interval,t[55]=I);let L;t[56]===r.trigger.customCron?L=t[57]:(L=(0,Z.jsx)(p,{value:`cron`,children:r.trigger.customCron}),t[56]=r.trigger.customCron,t[57]=L);let R;t[58]===r.trigger.webhook?R=t[59]:(R=(0,Z.jsx)(p,{value:`webhook`,children:r.trigger.webhook}),t[58]=r.trigger.webhook,t[59]=R);let de;t[60]===r.trigger.taskBlocked?de=t[61]:(de=(0,Z.jsx)(p,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[60]=r.trigger.taskBlocked,t[61]=de);let fe;t[62]===r.trigger.noteCreated?fe=t[63]:(fe=(0,Z.jsx)(p,{value:`noteCreated`,children:r.trigger.noteCreated}),t[62]=r.trigger.noteCreated,t[63]=fe);let z;t[64]===r.trigger.workflowFailed?z=t[65]:(z=(0,Z.jsx)(p,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[64]=r.trigger.workflowFailed,t[65]=z);let B;t[66]===r.trigger.sessionUpdated?B=t[67]:(B=(0,Z.jsx)(p,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[66]=r.trigger.sessionUpdated,t[67]=B);let V;t[68]===r.trigger.customEvent?V=t[69]:(V=(0,Z.jsx)(p,{value:`event`,children:r.trigger.customEvent}),t[68]=r.trigger.customEvent,t[69]=V);let U;t[70]!==n.triggerMode||t[71]!==N||t[72]!==P||t[73]!==le||t[74]!==ue||t[75]!==F||t[76]!==I||t[77]!==L||t[78]!==R||t[79]!==de||t[80]!==fe||t[81]!==z||t[82]!==B||t[83]!==V?(U=(0,Z.jsxs)(f,{className:Q,value:n.triggerMode,onChange:N,children:[P,le,ue,F,I,L,R,de,fe,z,B,V]}),t[70]=n.triggerMode,t[71]=N,t[72]=P,t[73]=le,t[74]=ue,t[75]=F,t[76]=I,t[77]=L,t[78]=R,t[79]=de,t[80]=fe,t[81]=z,t[82]=B,t[83]=V,t[84]=U):U=t[84];let me;t[85]!==n.onceAt||t[86]!==n.triggerMode||t[87]!==r.form.onceAt||t[88]!==b?(me=n.triggerMode===`once`?(0,Z.jsx)($,{label:r.form.onceAt,children:(0,Z.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>b({onceAt:e.target.value})})}):null,t[85]=n.onceAt,t[86]=n.triggerMode,t[87]=r.form.onceAt,t[88]=b,t[89]=me):me=t[89];let he;t[90]!==n.time||t[91]!==n.triggerMode||t[92]!==n.weekday||t[93]!==r.form.day||t[94]!==r.form.time||t[95]!==r.weekdays||t[96]!==b?(he=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.time,children:(0,Z.jsx)(H,{value:n.time,onChange:e=>b({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(f,{className:Q,value:n.weekday,onChange:e=>b({weekday:e.target.value}),children:[(0,Z.jsx)(p,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(p,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(p,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(p,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(p,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(p,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(p,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[90]=n.time,t[91]=n.triggerMode,t[92]=n.weekday,t[93]=r.form.day,t[94]=r.form.time,t[95]=r.weekdays,t[96]=b,t[97]=he):he=t[97];let ge=n.triggerMode===`interval`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsx)($,{label:r.form.intervalEvery,children:(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Z.jsx)(`input`,{className:Q,type:`number`,min:6e4/Be(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>b({intervalValue:e.target.value})}),(0,Z.jsxs)(f,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;b({intervalValue:Ve(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(p,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(p,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(p,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(p,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Qe.map(e=>{let t=Be(e.value,e.unit),n=t===S;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:x(`rounded-full border px-2.5 py-1 text-xs transition-colors`,n?`border-accent bg-accent/10 text-accent`:`border-edge-subtle text-fg-muted hover:border-edge hover:bg-surface-hover hover:text-fg`),onClick:()=>b({intervalValue:e.value,intervalUnit:e.unit}),children:He(t,h)},`${e.value}:${e.unit}`)})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:Ue(S,h)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,re.join(h===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,ve;t[98]!==n.cronExpr||t[99]!==n.triggerMode||t[100]!==r.form.expression||t[101]!==b?(ve=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>b({cronExpr:e.target.value})})}):null,t[98]=n.cronExpr,t[99]=n.triggerMode,t[100]=r.form.expression,t[101]=b,t[102]=ve):ve=t[102];let ye;t[103]!==n.triggerMode||t[104]!==n.webhookSecretId||t[105]!==r.form.secretId||t[106]!==b?(ye=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>b({webhookSecretId:e.target.value})})}):null,t[103]=n.triggerMode,t[104]=n.webhookSecretId,t[105]=r.form.secretId,t[106]=b,t[107]=ye):ye=t[107];let Se;t[108]!==n.eventPayloadMatch||t[109]!==n.eventSource||t[110]!==n.eventType||t[111]!==n.triggerMode||t[112]!==r.form.eventPayloadMatch||t[113]!==r.form.eventSource||t[114]!==r.form.eventType||t[115]!==r.form.invalidJsonObject||t[116]!==b?(Se=n.triggerMode===`event`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.eventType,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>b({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>b({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:x(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>b({eventPayloadMatch:e.target.value}),placeholder:`{
5
- "status": "blocked"
6
- }`}),at(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[108]=n.eventPayloadMatch,t[109]=n.eventSource,t[110]=n.eventType,t[111]=n.triggerMode,t[112]=r.form.eventPayloadMatch,t[113]=r.form.eventSource,t[114]=r.form.eventType,t[115]=r.form.invalidJsonObject,t[116]=b,t[117]=Se):Se=t[117];let q;t[118]===r.form.action?q=t[119]:(q=(0,Z.jsx)(Jt,{title:r.form.action}),t[118]=r.form.action,t[119]=q);let Ce;t[120]!==n.timeoutSeconds||t[121]!==n.workflowId||t[122]!==b||t[123]!==o?(Ce=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);b({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_recipe`?`600`:`1800`}:{},...t===`browser_recipe`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&o[0]?{workflowId:o[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[120]=n.timeoutSeconds,t[121]=n.workflowId,t[122]=b,t[123]=o,t[124]=Ce):Ce=t[124];let we;t[125]===r.action.runAgent?we=t[126]:(we=(0,Z.jsx)(p,{value:`agent`,children:r.action.runAgent}),t[125]=r.action.runAgent,t[126]=we);let Te;t[127]===r.action.runWorkflow?Te=t[128]:(Te=(0,Z.jsx)(p,{value:`workflow`,children:r.action.runWorkflow}),t[127]=r.action.runWorkflow,t[128]=Te);let Ee=h===`zh`?`浏览器自动化`:`Browser automation`,De;t[129]===Ee?De=t[130]:(De=(0,Z.jsx)(p,{value:`browser_recipe`,children:Ee}),t[129]=Ee,t[130]=De);let J;t[131]!==n.actionMode||t[132]!==Ce||t[133]!==we||t[134]!==Te||t[135]!==De?(J=(0,Z.jsxs)(f,{className:Q,value:n.actionMode,onChange:Ce,children:[we,Te,De]}),t[131]=n.actionMode,t[132]=Ce,t[133]=we,t[134]=Te,t[135]=De,t[136]=J):J=t[136];let Oe=n.actionMode===`browser_recipe`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(f,{className:Q,value:n.agentId,onChange:e=>b({agentId:e.target.value}),children:[(0,Z.jsx)(p,{value:``,children:m?r.form.loadingAgents:r.form.defaultAgent}),ee.map(e=>(0,Z.jsx)(p,{value:e.id,children:O(e,te)},e.id))]})}),ke;t[137]!==l||t[138]!==d||t[139]!==n.actionMode||t[140]!==n.agentId||t[141]!==n.browserWorkflowId||t[142]!==n.browserWorkflowInputs||t[143]!==n.description||t[144]!==n.instruction||t[145]!==n.name||t[146]!==n.triggerMode||t[147]!==n.workflowId||t[148]!==n.workflowInput||t[149]!==r.form.instruction||t[150]!==r.form.loadingWorkflows||t[151]!==r.form.noWorkflows||t[152]!==r.form.triggeredRun||t[153]!==r.form.workflow||t[154]!==h||t[155]!==u||t[156]!==s||t[157]!==b||t[158]!==o||t[159]!==c?(ke=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(W,{value:n.instruction,onApply:e=>b({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:h,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:x(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>b({instruction:e.target.value})})]}):n.actionMode===`workflow`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(f,{className:Q,value:n.workflowId,onChange:e=>b({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:c||o.length===0,children:[c?(0,Z.jsx)(p,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,Z.jsx)(p,{value:``,children:r.form.noWorkflows}):null,o.map(Kt)]})}),s?(0,Z.jsx)(_e,{definition:s,language:h,value:n.workflowInput,onChange:e=>b({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>b({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:s.id,workflowTitle:s.title,workflowDescription:s.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:h===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(f,{className:Q,value:n.browserWorkflowId,onChange:e=>{let t=l.find(t=>t.id===e.target.value);b({browserWorkflowId:e.target.value,browserWorkflowInputs:t?be(t):{}})},disabled:d||l.length===0,children:[l.length===0?(0,Z.jsx)(p,{value:``,children:h===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,l.map(Gt)]})}),u&&Object.keys(u.inputs).length>0?(0,Z.jsx)($,{label:h===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(G,{workflow:u,values:n.browserWorkflowInputs,language:h,onChange:e=>b({browserWorkflowInputs:e})})}):null]}),t[137]=l,t[138]=d,t[139]=n.actionMode,t[140]=n.agentId,t[141]=n.browserWorkflowId,t[142]=n.browserWorkflowInputs,t[143]=n.description,t[144]=n.instruction,t[145]=n.name,t[146]=n.triggerMode,t[147]=n.workflowId,t[148]=n.workflowInput,t[149]=r.form.instruction,t[150]=r.form.loadingWorkflows,t[151]=r.form.noWorkflows,t[152]=r.form.triggeredRun,t[153]=r.form.workflow,t[154]=h,t[155]=u,t[156]=s,t[157]=b,t[158]=o,t[159]=c,t[160]=ke):ke=t[160];let Y;t[161]===r.form.advancedDescription?Y=t[162]:(Y=(0,Z.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[161]=r.form.advancedDescription,t[162]=Y);let X;t[163]!==r.form.advanced||t[164]!==Y?(X=(0,Z.jsxs)(`span`,{children:[r.form.advanced,Y]}),t[163]=r.form.advanced,t[164]=Y,t[165]=X):X=t[165];let Ae;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(pe,{className:`size-4 transition-transform group-open:rotate-180`}),t[166]=Ae):Ae=t[166];let je;t[167]===X?je=t[168]:(je=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[X,Ae]}),t[167]=X,t[168]=je);let Me;t[169]!==n.actionMode||t[170]!==n.safetyMode||t[171]!==r.form.safety||t[172]!==r.safety||t[173]!==b?(Me=n.actionMode===`browser_recipe`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jt,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(f,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;b({safetyMode:t})},children:[(0,Z.jsx)(p,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(p,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(p,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription})]})]}),t[169]=n.actionMode,t[170]=n.safetyMode,t[171]=r.form.safety,t[172]=r.safety,t[173]=b,t[174]=Me):Me=t[174];let Ne;t[175]===r.form.results?Ne=t[176]:(Ne=(0,Z.jsx)(Jt,{title:r.form.results}),t[175]=r.form.results,t[176]=Ne);let Pe;t[177]===b?Pe=t[178]:(Pe=e=>b({conversationMode:e.target.value}),t[177]=b,t[178]=Pe);let Fe;t[179]===r.form.newConversation?Fe=t[180]:(Fe=(0,Z.jsx)(p,{value:`new_session`,children:r.form.newConversation}),t[179]=r.form.newConversation,t[180]=Fe);let Ie;t[181]===r.form.continuousConversation?Ie=t[182]:(Ie=(0,Z.jsx)(p,{value:`continuous`,children:r.form.continuousConversation}),t[181]=r.form.continuousConversation,t[182]=Ie);let Le;t[183]!==n.conversationMode||t[184]!==Pe||t[185]!==Fe||t[186]!==Ie?(Le=(0,Z.jsxs)(f,{className:Q,value:n.conversationMode,onChange:Pe,children:[Fe,Ie]}),t[183]=n.conversationMode,t[184]=Pe,t[185]=Fe,t[186]=Ie,t[187]=Le):Le=t[187];let Re;t[188]!==r.form.conversation||t[189]!==Le?(Re=(0,Z.jsx)($,{label:r.form.conversation,children:Le}),t[188]=r.form.conversation,t[189]=Le,t[190]=Re):Re=t[190];let ze;t[191]===b?ze=t[192]:(ze=e=>b({notificationPolicy:e.target.value}),t[191]=b,t[192]=ze);let We;t[193]===r.form.notifyAttention?We=t[194]:(We=(0,Z.jsx)(p,{value:`attention`,children:r.form.notifyAttention}),t[193]=r.form.notifyAttention,t[194]=We);let Ge;t[195]===r.form.notifyAll?Ge=t[196]:(Ge=(0,Z.jsx)(p,{value:`all`,children:r.form.notifyAll}),t[195]=r.form.notifyAll,t[196]=Ge);let qe;t[197]===r.form.notifyNone?qe=t[198]:(qe=(0,Z.jsx)(p,{value:`none`,children:r.form.notifyNone}),t[197]=r.form.notifyNone,t[198]=qe);let Je;t[199]!==n.notificationPolicy||t[200]!==ze||t[201]!==We||t[202]!==Ge||t[203]!==qe?(Je=(0,Z.jsxs)(f,{className:Q,value:n.notificationPolicy,onChange:ze,children:[We,Ge,qe]}),t[199]=n.notificationPolicy,t[200]=ze,t[201]=We,t[202]=Ge,t[203]=qe,t[204]=Je):Je=t[204];let Ye;t[205]!==r.form.notifications||t[206]!==Je?(Ye=(0,Z.jsx)($,{label:r.form.notifications,children:Je}),t[205]=r.form.notifications,t[206]=Je,t[207]=Ye):Ye=t[207];let Xe;t[208]!==n.completionWebhookUrl||t[209]!==n.safetyMode||t[210]!==r.form.completionWebhook||t[211]!==b?(Xe=n.safetyMode===`auto_apply`?(0,Z.jsx)($,{label:r.form.completionWebhook,children:(0,Z.jsx)(`input`,{className:Q,value:n.completionWebhookUrl,onChange:e=>b({completionWebhookUrl:e.target.value})})}):null,t[208]=n.completionWebhookUrl,t[209]=n.safetyMode,t[210]=r.form.completionWebhook,t[211]=b,t[212]=Xe):Xe=t[212];let Ze;t[213]===r.form.reliability?Ze=t[214]:(Ze=(0,Z.jsx)(Jt,{title:r.form.reliability}),t[213]=r.form.reliability,t[214]=Ze);let $e;t[215]===b?$e=t[216]:($e=e=>b({timeoutSeconds:e.target.value}),t[215]=b,t[216]=$e);let et;t[217]!==n.timeoutSeconds||t[218]!==$e?(et=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:$e}),t[217]=n.timeoutSeconds,t[218]=$e,t[219]=et):et=t[219];let tt;t[220]!==r.form.timeoutSeconds||t[221]!==et?(tt=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:et}),t[220]=r.form.timeoutSeconds,t[221]=et,t[222]=tt):tt=t[222];let nt;t[223]===b?nt=t[224]:(nt=e=>b({disableAfterFailures:e.target.value}),t[223]=b,t[224]=nt);let rt;t[225]!==n.disableAfterFailures||t[226]!==nt?(rt=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:nt}),t[225]=n.disableAfterFailures,t[226]=nt,t[227]=rt):rt=t[227];let it;t[228]!==r.form.disableAfterFailures||t[229]!==rt?(it=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:rt}),t[228]=r.form.disableAfterFailures,t[229]=rt,t[230]=it):it=t[230];let ot;t[231]!==tt||t[232]!==it?(ot=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[tt,it]}),t[231]=tt,t[232]=it,t[233]=ot):ot=t[233];let st;t[234]===r.form.effectivePolicy?st=t[235]:(st=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[234]=r.form.effectivePolicy,t[235]=st);let ct=n.timeoutSeconds||`—`,lt;t[236]!==r.form.executionDeadline||t[237]!==ct?(lt=(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,ct,`s`]}),t[236]=r.form.executionDeadline,t[237]=ct,t[238]=lt):lt=t[238];let ut;t[239]===r.form.downstreamTimeoutHint?ut=t[240]:(ut=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[239]=r.form.downstreamTimeoutHint,t[240]=ut);let dt;t[241]!==st||t[242]!==lt||t[243]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-muted/40 px-3 py-2.5`,children:[st,lt,ut]}),t[241]=st,t[242]=lt,t[243]=ut,t[244]=dt):dt=t[244];let ft;t[245]!==Me||t[246]!==Ne||t[247]!==Re||t[248]!==Ye||t[249]!==Xe||t[250]!==Ze||t[251]!==ot||t[252]!==dt?(ft=(0,Z.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[Me,Ne,Re,Ye,Xe,Ze,ot,dt]}),t[245]=Me,t[246]=Ne,t[247]=Re,t[248]=Ye,t[249]=Xe,t[250]=Ze,t[251]=ot,t[252]=dt,t[253]=ft):ft=t[253];let pt;t[254]!==je||t[255]!==ft?(pt=(0,Z.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[je,ft]}),t[254]=je,t[255]=ft,t[256]=pt):pt=t[256];let mt;return t[257]!==k||t[258]!==j||t[259]!==M||t[260]!==ce||t[261]!==U||t[262]!==me||t[263]!==he||t[264]!==ge||t[265]!==ve||t[266]!==ye||t[267]!==Se||t[268]!==q||t[269]!==J||t[270]!==Oe||t[271]!==ke||t[272]!==pt?(mt=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[k,j,M,ce,U,me,he,ge,ve,ye,Se,q,J,Oe,ke,pt]})}),t[257]=k,t[258]=j,t[259]=M,t[260]=ce,t[261]=U,t[262]=me,t[263]=he,t[264]=ge,t[265]=ve,t[266]=ye,t[267]=Se,t[268]=q,t[269]=J,t[270]=Oe,t[271]=ke,t[272]=pt,t[273]=mt):mt=t[273],mt}function Gt(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}function Kt(e){return(0,Z.jsx)(p,{value:e.id,children:e.title||e.name},e.id)}function qt(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,xe.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Jt(e){let t=(0,xe.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(L,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{wt as t};