@xopcai/xopc 0.0.118 → 0.0.120

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 (503) hide show
  1. package/README.md +2 -1
  2. package/README.zh-CN.md +2 -1
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dzUrQoeZ.js → agent-avatar-dicebear-APTlX9Sq.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-CFW_FS_V.js +2 -0
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-DTKc5HHT.js +1 -0
  8. package/dist/gateway/static/root/assets/appearance-settings-BTciFrE9.js +1 -0
  9. package/dist/gateway/static/root/assets/{apps-page--wMEL00f.js → apps-page-DT52OrbM.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-Cki4SfU2.js → archive-plugin-CiHaUMII.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D-KnS2Do.js → attachment-load-t4gSrNjL.js} +1 -1
  12. package/dist/gateway/static/root/assets/automation-suggestion-card-CtysjSoQ.js +1 -0
  13. package/dist/gateway/static/root/assets/automations-page-B2YvT3ES.js +1 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-D2sgvJja.js → binary-plugins-BAbSldW5.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-DIq-4Gvb.js → block-editor-BNr_82xl.js} +28 -28
  16. package/dist/gateway/static/root/assets/browser-settings-page-BQEXPhDU.js +8 -0
  17. package/dist/gateway/static/root/assets/capability-presets-api-tzD702Gg.js +1 -0
  18. package/dist/gateway/static/root/assets/capability-presets-settings-panel-AGhTueAc.js +1 -0
  19. package/dist/gateway/static/root/assets/channel-recipient-api-DL_KzwGE.js +1 -0
  20. package/dist/gateway/static/root/assets/channels-settings-DRTutLlN.js +1 -0
  21. package/dist/gateway/static/root/assets/cn-BQ_8x0bT.js +1 -0
  22. package/dist/gateway/static/root/assets/connectors-page-DneJVuge.js +2 -0
  23. package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +2 -0
  24. package/dist/gateway/static/root/assets/dreaming-settings-BEwWA1yf.js +1 -0
  25. package/dist/gateway/static/root/assets/{extension-debug-page-DYu1KaFQ.js → extension-debug-page-Dl2kO0Sf.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-B3W6QwlZ.js → extension-page-DmbLPsx_.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-D7VQ-cxE.js → extension-settings-page-BS2rx40e.js} +1 -1
  28. package/dist/gateway/static/root/assets/{fetch-B7xDPu-R.js → fetch-B3ME5Eri.js} +1 -1
  29. package/dist/gateway/static/root/assets/format-cron-label-arqgGlVV.js +1 -0
  30. package/dist/gateway/static/root/assets/{gateway-config-api-BTBLSeUu.js → gateway-config-api-DI9_BBTo.js} +1 -1
  31. package/dist/gateway/static/root/assets/gateway-settings-DAFI_T0W.js +1 -0
  32. package/dist/gateway/static/root/assets/{gateway-startup-retry-CYj9FWCp.js → gateway-startup-retry-CSZQTz6K.js} +1 -1
  33. package/dist/gateway/static/root/assets/goal-detail-page-DLuz4jC9.js +1 -0
  34. package/dist/gateway/static/root/assets/{goals-config-api-CQQgzPr3.js → goals-config-api-Bhzqrp2w.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goals-page-BHitvJAv.js → goals-page-DTAfv9Ft.js} +2 -2
  36. package/dist/gateway/static/root/assets/goals-settings-CWN2iirQ.js +1 -0
  37. package/dist/gateway/static/root/assets/heartbeat-settings-CkkkHvOi.js +1 -0
  38. package/dist/gateway/static/root/assets/index-CnjzMw5i.js +191 -0
  39. package/dist/gateway/static/root/assets/index-E1QinYKp.css +1 -0
  40. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-kMp08SlX.js +1 -0
  41. package/dist/gateway/static/root/assets/{locale-store-DjbfSsfA.js → locale-store-Ba72bFmP.js} +1 -1
  42. package/dist/gateway/static/root/assets/{logs-page-C2Uqvae9.js → logs-page-CDXDlS_W.js} +2 -2
  43. package/dist/gateway/static/root/assets/{markdown-split-BwOFrJ2E.js → markdown-split-Bc0w40vz.js} +1 -1
  44. package/dist/gateway/static/root/assets/{media-plugins-Cnz6Q5G6.js → media-plugins-DJ_HvgIy.js} +1 -1
  45. package/dist/gateway/static/root/assets/messages-CISb1HLv.js +3 -0
  46. package/dist/gateway/static/root/assets/models-hub-panel-BTwxMIgZ.js +2 -0
  47. package/dist/gateway/static/root/assets/note-detail-page-BBfOeB0m.js +2 -0
  48. package/dist/gateway/static/root/assets/{note-image-lightbox-B-Svpmza.js → note-image-lightbox-4zntqpZq.js} +1 -1
  49. package/dist/gateway/static/root/assets/notes-page-VocWOjoK.js +1 -0
  50. package/dist/gateway/static/root/assets/{preview-open-alternatives-Bss4TiwP.js → preview-open-alternatives-BbA7sRd_.js} +1 -1
  51. package/dist/gateway/static/root/assets/remote-access-hub-CXwjuD_Q.js +1 -0
  52. package/dist/gateway/static/root/assets/{save-bar-controls-BRNjdgKq.js → save-bar-controls-Dividh61.js} +1 -1
  53. package/dist/gateway/static/root/assets/schedule-field-pRheF2CO.js +1 -0
  54. package/dist/gateway/static/root/assets/{schema-form-Dub9sy8r.js → schema-form-D6PiPxfr.js} +1 -1
  55. package/dist/gateway/static/root/assets/sessions-page-CpcVySQK.js +1 -0
  56. package/dist/gateway/static/root/assets/settings-advanced-gate-BVy_TawT.js +1 -0
  57. package/dist/gateway/static/root/assets/{settings-collapsible-section-BeFLavGi.js → settings-collapsible-section-BMCOfuE_.js} +1 -1
  58. package/dist/gateway/static/root/assets/settings-form-section-DBkGwpIN.js +1 -0
  59. package/dist/gateway/static/root/assets/settings-page-CZpNyCWn.js +1 -0
  60. package/dist/gateway/static/root/assets/settings-page-layout-NxoW5Y57.js +1 -0
  61. package/dist/gateway/static/root/assets/setup-status-panel-MVHLLu_a.js +1 -0
  62. package/dist/gateway/static/root/assets/{share-preview-page-C8glrdqe.js → share-preview-page-B0suFCfj.js} +1 -1
  63. package/dist/gateway/static/root/assets/shares-settings-C6DBbQGo.js +1 -0
  64. package/dist/gateway/static/root/assets/skill-reload-api-6hJmhwSn.js +1 -0
  65. package/dist/gateway/static/root/assets/skills-page-Im1MA0Iw.js +2 -0
  66. package/dist/gateway/static/root/assets/system-settings-panel-CrmEnyX4.js +1 -0
  67. package/dist/gateway/static/root/assets/{theme-store-CD2wtgZV.js → theme-store-Bt6vAkSB.js} +1 -1
  68. package/dist/gateway/static/root/assets/typed-models-lib-BAsGn25g.js +1 -0
  69. package/dist/gateway/static/root/assets/{use-channel-catalog-DqlWTsDb.js → use-channel-catalog-C7vcAoGb.js} +1 -1
  70. package/dist/gateway/static/root/assets/user-profile-settings-panel-QAQWGelF.js +1 -0
  71. package/dist/gateway/static/root/assets/utils-Dl9efgnV.js +1 -0
  72. package/dist/gateway/static/root/assets/{voice-api-key-field-C73IVZeC.js → voice-api-key-field-D-6XueTv.js} +1 -1
  73. package/dist/gateway/static/root/assets/{voice-player-store-C_ArLJPM.js → voice-player-store-CMC5NOJp.js} +1 -1
  74. package/dist/gateway/static/root/assets/workflow-run-setup-panel-DVPllR4k.js +3 -0
  75. package/dist/gateway/static/root/assets/workflows-page-B94WISTW.js +18 -0
  76. package/dist/gateway/static/root/index.html +8 -9
  77. package/dist/package.js +1 -1
  78. package/dist/src/agent/agent-manager.d.ts +4 -5
  79. package/dist/src/agent/agent-manager.js +4 -8
  80. package/dist/src/agent/agent-manager.js.map +1 -1
  81. package/dist/src/agent/context/workspace-templates/AGENTS.md +3 -2
  82. package/dist/src/agent/embedded/run-for-session.js +102 -14
  83. package/dist/src/agent/embedded/run-for-session.js.map +1 -1
  84. package/dist/src/agent/fallback/candidates.d.ts +0 -8
  85. package/dist/src/agent/fallback/candidates.js.map +1 -1
  86. package/dist/src/agent/index.js +1 -1
  87. package/dist/src/agent/lifecycle/handlers/compaction.d.ts +1 -3
  88. package/dist/src/agent/lifecycle/handlers/compaction.js +1 -16
  89. package/dist/src/agent/lifecycle/handlers/compaction.js.map +1 -1
  90. package/dist/src/agent/lifecycle/progress.d.ts +0 -1
  91. package/dist/src/agent/lifecycle/progress.js +1 -6
  92. package/dist/src/agent/lifecycle/progress.js.map +1 -1
  93. package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +1 -2
  94. package/dist/src/agent/lifecycle/timeout-wrapper.js +1 -7
  95. package/dist/src/agent/lifecycle/timeout-wrapper.js.map +1 -1
  96. package/dist/src/agent/memory/builtin-memory-store.d.ts +1 -1
  97. package/dist/src/agent/memory/builtin-memory-store.js +1 -1
  98. package/dist/src/agent/memory/builtin-memory-store.js.map +1 -1
  99. package/dist/src/agent/memory/builtin-provider.d.ts +2 -2
  100. package/dist/src/agent/memory/builtin-provider.js +2 -2
  101. package/dist/src/agent/memory/builtin-provider.js.map +1 -1
  102. package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -7
  103. package/dist/src/agent/memory/dreaming/light-sweep.js +16 -277
  104. package/dist/src/agent/memory/dreaming/light-sweep.js.map +1 -1
  105. package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +1 -1
  106. package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
  107. package/dist/src/agent/memory/dreaming/rem-patterns.js.map +1 -1
  108. package/dist/src/agent/memory/dreaming/short-term-store.d.ts +3 -3
  109. package/dist/src/agent/memory/dreaming/short-term-store.js +5 -5
  110. package/dist/src/agent/memory/dreaming/short-term-store.js.map +1 -1
  111. package/dist/src/agent/memory/dreaming/utils.d.ts +2 -2
  112. package/dist/src/agent/memory/dreaming/utils.js +2 -2
  113. package/dist/src/agent/memory/dreaming/utils.js.map +1 -1
  114. package/dist/src/agent/memory/index.d.ts +0 -2
  115. package/dist/src/agent/memory/index.js +1 -2
  116. package/dist/src/agent/middleware/self-verify.d.ts +0 -1
  117. package/dist/src/agent/middleware/self-verify.js +0 -2
  118. package/dist/src/agent/middleware/self-verify.js.map +1 -1
  119. package/dist/src/agent/models/index.d.ts +1 -1
  120. package/dist/src/agent/models/manager.d.ts +4 -20
  121. package/dist/src/agent/models/manager.js +9 -126
  122. package/dist/src/agent/models/manager.js.map +1 -1
  123. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -4
  124. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -9
  125. package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
  126. package/dist/src/agent/prompt/sections/memory-skills.js +11 -10
  127. package/dist/src/agent/prompt/sections/memory-skills.js.map +1 -1
  128. package/dist/src/agent/prompt/sections/tooling.js +4 -4
  129. package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
  130. package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
  131. package/dist/src/agent/prompt/service-prompt-builder.js +0 -12
  132. package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
  133. package/dist/src/agent/prompt/subagent-context.js +1 -1
  134. package/dist/src/agent/prompt/subagent-context.js.map +1 -1
  135. package/dist/src/agent/prompt/types.d.ts +1 -1
  136. package/dist/src/agent/reply/startup-context.js +6 -105
  137. package/dist/src/agent/reply/startup-context.js.map +1 -1
  138. package/dist/src/agent/service.d.ts +1 -12
  139. package/dist/src/agent/service.js +3 -81
  140. package/dist/src/agent/service.js.map +1 -1
  141. package/dist/src/agent/service.types.d.ts +2 -2
  142. package/dist/src/agent/session/session-config-service.d.ts +11 -11
  143. package/dist/src/agent/session/session-config-service.js +14 -14
  144. package/dist/src/agent/session/session-config-service.js.map +1 -1
  145. package/dist/src/agent/session/session-inspector.js +3 -2
  146. package/dist/src/agent/session/session-inspector.js.map +1 -1
  147. package/dist/src/agent/starter-agents.js +12 -12
  148. package/dist/src/agent/starter-agents.js.map +1 -1
  149. package/dist/src/agent/tools/automation-tool.d.ts +14 -0
  150. package/dist/src/agent/tools/automation-tool.js +102 -0
  151. package/dist/src/agent/tools/automation-tool.js.map +1 -0
  152. package/dist/src/agent/tools/delegate-tool.js +1 -1
  153. package/dist/src/agent/tools/delegate-tool.js.map +1 -1
  154. package/dist/src/agent/tools/factory.d.ts +3 -3
  155. package/dist/src/agent/tools/factory.js +2 -2
  156. package/dist/src/agent/tools/factory.js.map +1 -1
  157. package/dist/src/agent/tools/index.d.ts +1 -1
  158. package/dist/src/agent/tools/index.js +2 -2
  159. package/dist/src/agent/tools/memory-tool.js +2 -2
  160. package/dist/src/agent/tools/memory-tool.js.map +1 -1
  161. package/dist/src/agent-manifest/resolver.d.ts +1 -0
  162. package/dist/src/agent-manifest/resolver.js +1 -0
  163. package/dist/src/agent-manifest/resolver.js.map +1 -1
  164. package/dist/src/agent-manifest/schema.d.ts +6 -0
  165. package/dist/src/agent-manifest/schema.js +12 -3
  166. package/dist/src/agent-manifest/schema.js.map +1 -1
  167. package/dist/src/ai-assist/text-assist.d.ts +1 -1
  168. package/dist/src/ai-assist/text-assist.js +56 -0
  169. package/dist/src/ai-assist/text-assist.js.map +1 -1
  170. package/dist/src/auth/profiles/store.js.map +1 -1
  171. package/dist/src/automations/api/routes.d.ts +3 -0
  172. package/dist/src/automations/api/routes.js +193 -0
  173. package/dist/src/automations/api/routes.js.map +1 -0
  174. package/dist/src/automations/domain/index.d.ts +3 -0
  175. package/dist/src/automations/domain/index.js +3 -0
  176. package/dist/src/automations/domain/schedule.d.ts +4 -0
  177. package/dist/src/automations/domain/schedule.js +37 -0
  178. package/dist/src/automations/domain/schedule.js.map +1 -0
  179. package/dist/src/automations/domain/types.d.ts +160 -0
  180. package/dist/src/automations/domain/validation.d.ts +370 -0
  181. package/dist/src/automations/domain/validation.js +149 -0
  182. package/dist/src/automations/domain/validation.js.map +1 -0
  183. package/dist/src/automations/draft/automation-draft-prompt.d.ts +26 -0
  184. package/dist/src/automations/draft/automation-draft-prompt.js +127 -0
  185. package/dist/src/automations/draft/automation-draft-prompt.js.map +1 -0
  186. package/dist/src/automations/draft/automation-draft-service.d.ts +12 -0
  187. package/dist/src/automations/draft/automation-draft-service.js +135 -0
  188. package/dist/src/automations/draft/automation-draft-service.js.map +1 -0
  189. package/dist/src/automations/draft/automation-draft-validator.d.ts +99 -0
  190. package/dist/src/automations/draft/automation-draft-validator.js +105 -0
  191. package/dist/src/automations/draft/automation-draft-validator.js.map +1 -0
  192. package/dist/src/automations/draft/automation-draft.types.d.ts +40 -0
  193. package/dist/src/automations/draft/index.d.ts +3 -0
  194. package/dist/src/automations/draft/index.js +3 -0
  195. package/dist/src/automations/index.d.ts +3 -0
  196. package/dist/src/automations/index.js +8 -0
  197. package/dist/src/automations/product-events.d.ts +5 -0
  198. package/dist/src/automations/product-events.js +21 -0
  199. package/dist/src/automations/product-events.js.map +1 -0
  200. package/dist/src/automations/service/action-executor.d.ts +9 -0
  201. package/dist/src/automations/service/action-executor.js +157 -0
  202. package/dist/src/automations/service/action-executor.js.map +1 -0
  203. package/dist/src/automations/service/automation-service.d.ts +54 -0
  204. package/dist/src/automations/service/automation-service.js +404 -0
  205. package/dist/src/automations/service/automation-service.js.map +1 -0
  206. package/dist/src/automations/service/index.d.ts +2 -0
  207. package/dist/src/automations/service/index.js +3 -0
  208. package/dist/src/automations/storage/automation-repository.d.ts +6 -0
  209. package/dist/src/automations/storage/automation-repository.js +61 -0
  210. package/dist/src/automations/storage/automation-repository.js.map +1 -0
  211. package/dist/src/automations/storage/automation-run-repository.d.ts +17 -0
  212. package/dist/src/automations/storage/automation-run-repository.js +130 -0
  213. package/dist/src/automations/storage/automation-run-repository.js.map +1 -0
  214. package/dist/src/automations/storage/index.d.ts +2 -0
  215. package/dist/src/automations/storage/index.js +3 -0
  216. package/dist/src/channels/plugin-types.d.ts +3 -0
  217. package/dist/src/chat-commands/builtins/thinking.js.map +1 -1
  218. package/dist/src/cli/command-catalog.js +0 -39
  219. package/dist/src/cli/command-catalog.js.map +1 -1
  220. package/dist/src/cli/command-loaders.js +0 -1
  221. package/dist/src/cli/command-loaders.js.map +1 -1
  222. package/dist/src/cli/command-manifest.js +0 -4
  223. package/dist/src/cli/command-manifest.js.map +1 -1
  224. package/dist/src/cli/commands/agents.js +7 -6
  225. package/dist/src/cli/commands/agents.js.map +1 -1
  226. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  227. package/dist/src/cli/commands/doctor/checks/{cron-health.d.ts → migrations.d.ts} +1 -1
  228. package/dist/src/cli/commands/doctor/checks/migrations.js +40 -0
  229. package/dist/src/cli/commands/doctor/checks/migrations.js.map +1 -0
  230. package/dist/src/cli/commands/doctor/flow.js +2 -2
  231. package/dist/src/cli/commands/doctor/flow.js.map +1 -1
  232. package/dist/src/cli/commands/gateway/call.js +2 -2
  233. package/dist/src/cli/commands/gateway/call.js.map +1 -1
  234. package/dist/src/cli/commands/gateway/run-foreground.js +4 -2
  235. package/dist/src/cli/commands/gateway/run-foreground.js.map +1 -1
  236. package/dist/src/cli/commands/init.js +27 -9
  237. package/dist/src/cli/commands/init.js.map +1 -1
  238. package/dist/src/cli/commands/tui.js +24 -2
  239. package/dist/src/cli/commands/tui.js.map +1 -1
  240. package/dist/src/cli/templates.js +3 -2
  241. package/dist/src/cli/templates.js.map +1 -1
  242. package/dist/src/cli/utils/init-workspace-core.js +2 -0
  243. package/dist/src/cli/utils/init-workspace-core.js.map +1 -1
  244. package/dist/src/commands/agents.config.d.ts +9 -0
  245. package/dist/src/commands/agents.config.js +40 -2
  246. package/dist/src/commands/agents.config.js.map +1 -1
  247. package/dist/src/config/agent-profile.js +4 -3
  248. package/dist/src/config/agent-profile.js.map +1 -1
  249. package/dist/src/config/agent-typed-models.js.map +1 -1
  250. package/dist/src/config/config-surface.d.ts +3 -0
  251. package/dist/src/config/index.d.ts +0 -1
  252. package/dist/src/config/index.js +3 -3
  253. package/dist/src/config/index.js.map +1 -1
  254. package/dist/src/config/paths.d.ts +0 -9
  255. package/dist/src/config/paths.js +1 -14
  256. package/dist/src/config/paths.js.map +1 -1
  257. package/dist/src/config/profile.js +0 -1
  258. package/dist/src/config/profile.js.map +1 -1
  259. package/dist/src/config/rules.js +0 -5
  260. package/dist/src/config/rules.js.map +1 -1
  261. package/dist/src/config/schema.d.ts +13 -12
  262. package/dist/src/config/schema.js +22 -26
  263. package/dist/src/config/schema.js.map +1 -1
  264. package/dist/src/config/web-patch.d.ts +0 -12
  265. package/dist/src/config/web-patch.js +2 -29
  266. package/dist/src/config/web-patch.js.map +1 -1
  267. package/dist/src/extensions/api.d.ts +2 -0
  268. package/dist/src/extensions/api.js +10 -0
  269. package/dist/src/extensions/api.js.map +1 -1
  270. package/dist/src/extensions/extension-registry-impl.d.ts +4 -1
  271. package/dist/src/extensions/extension-registry-impl.js +8 -0
  272. package/dist/src/extensions/extension-registry-impl.js.map +1 -1
  273. package/dist/src/extensions/loader.d.ts +3 -3
  274. package/dist/src/extensions/loader.js +3 -3
  275. package/dist/src/extensions/loader.js.map +1 -1
  276. package/dist/src/extensions/sdk/testing.d.ts +2 -0
  277. package/dist/src/extensions/sdk/testing.js +7 -0
  278. package/dist/src/extensions/sdk/testing.js.map +1 -1
  279. package/dist/src/extensions/types/core.d.ts +10 -1
  280. package/dist/src/extensions/types/index.d.ts +1 -1
  281. package/dist/src/extensions/types/{phase4.d.ts → registration.d.ts} +2 -2
  282. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  283. package/dist/src/gateway/agent-builtin-tools.js +1 -1
  284. package/dist/src/gateway/agent-builtin-tools.js.map +1 -1
  285. package/dist/src/gateway/agents-admin.d.ts +1 -0
  286. package/dist/src/gateway/agents-admin.js +13 -15
  287. package/dist/src/gateway/agents-admin.js.map +1 -1
  288. package/dist/src/gateway/capability-presets-admin.d.ts +1 -0
  289. package/dist/src/gateway/capability-presets-admin.js +19 -10
  290. package/dist/src/gateway/capability-presets-admin.js.map +1 -1
  291. package/dist/src/gateway/dreaming-automation-reconciler.d.ts +11 -0
  292. package/dist/src/gateway/dreaming-automation-reconciler.js +105 -0
  293. package/dist/src/gateway/dreaming-automation-reconciler.js.map +1 -0
  294. package/dist/src/gateway/heartbeat/service.d.ts +0 -2
  295. package/dist/src/gateway/heartbeat/service.js +0 -7
  296. package/dist/src/gateway/heartbeat/service.js.map +1 -1
  297. package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -6
  298. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  299. package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
  300. package/dist/src/gateway/hono/routes/agents.js.map +1 -1
  301. package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
  302. package/dist/src/gateway/hono/routes/config-patch/misc.js +15 -6
  303. package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
  304. package/dist/src/gateway/hono/routes/dreaming.js +27 -37
  305. package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
  306. package/dist/src/gateway/hono/routes/home.d.ts +2 -2
  307. package/dist/src/gateway/hono/routes/home.js +34 -25
  308. package/dist/src/gateway/hono/routes/home.js.map +1 -1
  309. package/dist/src/gateway/hono/routes/lazy-bundles.js +10 -6
  310. package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
  311. package/dist/src/gateway/hono/routes/migrations.d.ts +3 -0
  312. package/dist/src/gateway/hono/routes/migrations.js +35 -0
  313. package/dist/src/gateway/hono/routes/migrations.js.map +1 -0
  314. package/dist/src/gateway/hono/routes/public-gateway.js +2 -1
  315. package/dist/src/gateway/hono/routes/public-gateway.js.map +1 -1
  316. package/dist/src/gateway/hono/routes/sessions.js +14 -0
  317. package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
  318. package/dist/src/gateway/run-loop.js +2 -0
  319. package/dist/src/gateway/run-loop.js.map +1 -1
  320. package/dist/src/gateway/security/operator-scopes.js +5 -1
  321. package/dist/src/gateway/security/operator-scopes.js.map +1 -1
  322. package/dist/src/gateway/service/config-coordinator.d.ts +4 -4
  323. package/dist/src/gateway/service/config-coordinator.js +14 -8
  324. package/dist/src/gateway/service/config-coordinator.js.map +1 -1
  325. package/dist/src/gateway/service/sessions-api.d.ts +2 -1
  326. package/dist/src/gateway/service/sessions-api.js +6 -1
  327. package/dist/src/gateway/service/sessions-api.js.map +1 -1
  328. package/dist/src/gateway/service.d.ts +7 -3
  329. package/dist/src/gateway/service.js +61 -27
  330. package/dist/src/gateway/service.js.map +1 -1
  331. package/dist/src/goals/goal-service.js +45 -4
  332. package/dist/src/goals/goal-service.js.map +1 -1
  333. package/dist/src/migrations/config/default-capability-preset.d.ts +10 -0
  334. package/dist/src/migrations/config/default-capability-preset.js +135 -0
  335. package/dist/src/migrations/config/default-capability-preset.js.map +1 -0
  336. package/dist/src/migrations/index.d.ts +4 -0
  337. package/dist/src/migrations/index.js +4 -0
  338. package/dist/src/migrations/registry.d.ts +8 -0
  339. package/dist/src/migrations/registry.js +18 -0
  340. package/dist/src/migrations/registry.js.map +1 -0
  341. package/dist/src/migrations/runner.d.ts +17 -0
  342. package/dist/src/migrations/runner.js +191 -0
  343. package/dist/src/migrations/runner.js.map +1 -0
  344. package/dist/src/migrations/types.d.ts +34 -0
  345. package/dist/src/notes/service.js +24 -1
  346. package/dist/src/notes/service.js.map +1 -1
  347. package/dist/src/providers/model-registry.d.ts +0 -1
  348. package/dist/src/providers/model-registry.js +0 -3
  349. package/dist/src/providers/model-registry.js.map +1 -1
  350. package/dist/src/routing/resolve-tui-session-key.d.ts +3 -0
  351. package/dist/src/routing/resolve-tui-session-key.js +14 -3
  352. package/dist/src/routing/resolve-tui-session-key.js.map +1 -1
  353. package/dist/src/session/transcript-outline.d.ts +47 -0
  354. package/dist/src/session/transcript-outline.js +481 -0
  355. package/dist/src/session/transcript-outline.js.map +1 -0
  356. package/dist/src/storage/sqlite/index.d.ts +0 -2
  357. package/dist/src/storage/sqlite/index.js +1 -3
  358. package/dist/src/storage/sqlite/migrations/016_automations.sql +47 -0
  359. package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +14 -0
  360. package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +1 -0
  361. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  362. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  363. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  364. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  365. package/dist/src/storage/sqlite/row-mappers.js +3 -1
  366. package/dist/src/storage/sqlite/row-mappers.js.map +1 -1
  367. package/dist/src/storage/sqlite/schema.js +1 -1
  368. package/dist/src/storage/sqlite/schema.sql +56 -46
  369. package/dist/src/tui/backends/embedded-backend.d.ts +6 -0
  370. package/dist/src/tui/backends/embedded-backend.js +19 -9
  371. package/dist/src/tui/backends/embedded-backend.js.map +1 -1
  372. package/dist/src/tui/backends/gateway-sse-backend.d.ts +3 -0
  373. package/dist/src/tui/backends/gateway-sse-backend.js +14 -0
  374. package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
  375. package/dist/src/tui/tui-backend.d.ts +4 -0
  376. package/dist/src/tui/tui-commands.d.ts +5 -0
  377. package/dist/src/tui/tui-commands.js +43 -0
  378. package/dist/src/tui/tui-commands.js.map +1 -1
  379. package/dist/src/tui/tui-transcript-tree.d.ts +1 -1
  380. package/dist/src/tui/tui-transcript-tree.js +17 -257
  381. package/dist/src/tui/tui-transcript-tree.js.map +1 -1
  382. package/dist/src/tui/tui-types.d.ts +2 -0
  383. package/dist/src/tui/tui-types.js.map +1 -1
  384. package/dist/src/tui/tui.js +7 -2
  385. package/dist/src/tui/tui.js.map +1 -1
  386. package/dist/src/workflows/domain/index.js +1 -1
  387. package/dist/src/workflows/domain/run.d.ts +7 -7
  388. package/dist/src/workflows/domain/run.js.map +1 -1
  389. package/dist/src/workflows/index.js +2 -2
  390. package/dist/src/workflows/service/workflow-run-service.d.ts +2 -0
  391. package/dist/src/workflows/service/workflow-run-service.js +31 -9
  392. package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
  393. package/dist/src/workflows/service/workflow-run-service.types.d.ts +1 -1
  394. package/package.json +4 -2
  395. package/dist/gateway/static/root/assets/agents-BCxZbkOw.js +0 -2
  396. package/dist/gateway/static/root/assets/app-management-settings-panel-bxYJVJpx.js +0 -1
  397. package/dist/gateway/static/root/assets/appearance-settings-BCIykXlI.js +0 -1
  398. package/dist/gateway/static/root/assets/browser-settings-page-DRhKdn81.js +0 -8
  399. package/dist/gateway/static/root/assets/capability-presets-api-CorhiHlg.js +0 -1
  400. package/dist/gateway/static/root/assets/capability-presets-settings-panel-qFx9Jtce.js +0 -1
  401. package/dist/gateway/static/root/assets/channels-settings-BAwAkqIA.js +0 -1
  402. package/dist/gateway/static/root/assets/cn-JdwAhgNB.js +0 -1
  403. package/dist/gateway/static/root/assets/connectors-page-BQLcfitM.js +0 -2
  404. package/dist/gateway/static/root/assets/createLucideIcon-DPHK1VkS.js +0 -1
  405. package/dist/gateway/static/root/assets/cron-api-qGwmL-24.js +0 -1
  406. package/dist/gateway/static/root/assets/cron-dreaming-jobs-nCMWCf0p.js +0 -1
  407. package/dist/gateway/static/root/assets/cron-page-BBWMAj8-.js +0 -3
  408. package/dist/gateway/static/root/assets/dreaming-settings-Dw89Obml.js +0 -1
  409. package/dist/gateway/static/root/assets/format-cron-label-BsotZDO5.js +0 -2
  410. package/dist/gateway/static/root/assets/format-interval-label-BzxafKxR.js +0 -1
  411. package/dist/gateway/static/root/assets/gateway-settings-Cmwy58rS.js +0 -1
  412. package/dist/gateway/static/root/assets/goal-detail-page-l7mu5GWX.js +0 -1
  413. package/dist/gateway/static/root/assets/goals-settings-CYVY4NGp.js +0 -1
  414. package/dist/gateway/static/root/assets/heartbeat-config-api-DriO_CN9.js +0 -1
  415. package/dist/gateway/static/root/assets/heartbeat-settings-CUQTKxg7.js +0 -1
  416. package/dist/gateway/static/root/assets/index-C17Tsd_b.css +0 -1
  417. package/dist/gateway/static/root/assets/index-Cc41r16l.js +0 -191
  418. package/dist/gateway/static/root/assets/interval-presets-DFPCKW_W.js +0 -1
  419. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CcVcqstx.js +0 -1
  420. package/dist/gateway/static/root/assets/messages-B1iSKjiw.js +0 -3
  421. package/dist/gateway/static/root/assets/models-hub-panel-BfLfcta8.js +0 -2
  422. package/dist/gateway/static/root/assets/note-detail-page-BjwOQBfT.js +0 -2
  423. package/dist/gateway/static/root/assets/notes-page-DktdBiwB.js +0 -1
  424. package/dist/gateway/static/root/assets/remote-access-hub-rfVx96fq.js +0 -1
  425. package/dist/gateway/static/root/assets/schedule-field-CUCKODde.js +0 -1
  426. package/dist/gateway/static/root/assets/sessions-page-DbtMFuuH.js +0 -1
  427. package/dist/gateway/static/root/assets/settings-advanced-gate-5re5gAnP.js +0 -1
  428. package/dist/gateway/static/root/assets/settings-form-section-dmyaPOTG.js +0 -1
  429. package/dist/gateway/static/root/assets/settings-page-D-WMyLlj.js +0 -1
  430. package/dist/gateway/static/root/assets/setup-status-panel-Cl-DEJAU.js +0 -1
  431. package/dist/gateway/static/root/assets/shares-settings-CyPVvbLt.js +0 -1
  432. package/dist/gateway/static/root/assets/skill-reload-api-CleTH1oz.js +0 -1
  433. package/dist/gateway/static/root/assets/skills-page-Ck8hdXqR.js +0 -2
  434. package/dist/gateway/static/root/assets/system-settings-panel-DI-LN_8G.js +0 -1
  435. package/dist/gateway/static/root/assets/typed-models-lib-kX9duch4.js +0 -1
  436. package/dist/gateway/static/root/assets/user-profile-settings-panel-B-UFPMXy.js +0 -1
  437. package/dist/gateway/static/root/assets/utils-Dm0hKalR.js +0 -1
  438. package/dist/gateway/static/root/assets/workflows-page-BtFGp2y_.js +0 -18
  439. package/dist/src/agent/fallback/error.d.ts +0 -22
  440. package/dist/src/agent/fallback/error.js +0 -32
  441. package/dist/src/agent/fallback/error.js.map +0 -1
  442. package/dist/src/agent/fallback/index.d.ts +0 -5
  443. package/dist/src/agent/fallback/index.js +0 -9
  444. package/dist/src/agent/fallback/index.js.map +0 -1
  445. package/dist/src/agent/memory/memory-flush.d.ts +0 -27
  446. package/dist/src/agent/memory/memory-flush.js +0 -124
  447. package/dist/src/agent/memory/memory-flush.js.map +0 -1
  448. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.d.ts +0 -29
  449. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js +0 -76
  450. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js.map +0 -1
  451. package/dist/src/agent/service/reconcile-dreaming-cron.d.ts +0 -6
  452. package/dist/src/agent/service/reconcile-dreaming-cron.js +0 -84
  453. package/dist/src/agent/service/reconcile-dreaming-cron.js.map +0 -1
  454. package/dist/src/agent/tools/cronjob-tool.d.ts +0 -29
  455. package/dist/src/agent/tools/cronjob-tool.js +0 -274
  456. package/dist/src/agent/tools/cronjob-tool.js.map +0 -1
  457. package/dist/src/cli/commands/cron-cli.d.ts +0 -2
  458. package/dist/src/cli/commands/cron-cli.js +0 -15
  459. package/dist/src/cli/commands/cron-cli.js.map +0 -1
  460. package/dist/src/cli/commands/cron.d.ts +0 -4
  461. package/dist/src/cli/commands/cron.js +0 -188
  462. package/dist/src/cli/commands/cron.js.map +0 -1
  463. package/dist/src/cli/commands/doctor/checks/cron-health.js +0 -35
  464. package/dist/src/cli/commands/doctor/checks/cron-health.js.map +0 -1
  465. package/dist/src/cron/execution-types.d.ts +0 -42
  466. package/dist/src/cron/executor.d.ts +0 -67
  467. package/dist/src/cron/executor.js +0 -669
  468. package/dist/src/cron/executor.js.map +0 -1
  469. package/dist/src/cron/index.d.ts +0 -7
  470. package/dist/src/cron/index.js +0 -7
  471. package/dist/src/cron/job-content.d.ts +0 -5
  472. package/dist/src/cron/job-content.js +0 -15
  473. package/dist/src/cron/job-content.js.map +0 -1
  474. package/dist/src/cron/run-log-store.d.ts +0 -12
  475. package/dist/src/cron/run-log-store.js +0 -58
  476. package/dist/src/cron/run-log-store.js.map +0 -1
  477. package/dist/src/cron/schedule.d.ts +0 -10
  478. package/dist/src/cron/schedule.js +0 -85
  479. package/dist/src/cron/schedule.js.map +0 -1
  480. package/dist/src/cron/service.d.ts +0 -58
  481. package/dist/src/cron/service.js +0 -419
  482. package/dist/src/cron/service.js.map +0 -1
  483. package/dist/src/cron/types.d.ts +0 -183
  484. package/dist/src/cron/validation.d.ts +0 -500
  485. package/dist/src/cron/validation.js +0 -192
  486. package/dist/src/cron/validation.js.map +0 -1
  487. package/dist/src/cron/workflow-run-completion.d.ts +0 -23
  488. package/dist/src/cron/workflow-run-completion.js +0 -72
  489. package/dist/src/cron/workflow-run-completion.js.map +0 -1
  490. package/dist/src/extensions/types/phase4.js +0 -1
  491. package/dist/src/gateway/hono/routes/cron.d.ts +0 -3
  492. package/dist/src/gateway/hono/routes/cron.js +0 -109
  493. package/dist/src/gateway/hono/routes/cron.js.map +0 -1
  494. package/dist/src/storage/sqlite/cron-job-repository.d.ts +0 -6
  495. package/dist/src/storage/sqlite/cron-job-repository.js +0 -70
  496. package/dist/src/storage/sqlite/cron-job-repository.js.map +0 -1
  497. package/dist/src/storage/sqlite/cron-run-repository.d.ts +0 -5
  498. package/dist/src/storage/sqlite/cron-run-repository.js +0 -96
  499. package/dist/src/storage/sqlite/cron-run-repository.js.map +0 -1
  500. /package/dist/src/{cron → automations/domain}/types.js +0 -0
  501. /package/dist/src/{config/defaults.d.ts → automations/draft/automation-draft.types.js} +0 -0
  502. /package/dist/src/{config/defaults.js → extensions/types/registration.js} +0 -0
  503. /package/dist/src/{cron/execution-types.js → migrations/types.js} +0 -0
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-B1iSKjiw.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{c as s,i as c,n as l}from"./fetch-B7xDPu-R.js";import{r as u}from"./toast-z0toXu32.js";import{$a as d,Ao as f,Ci as p,Di as m,Ei as h,Gi as g,Gn as _,Kn as v,Ma as y,Ni as b,Oi as x,Os as S,Ra as C,Si as w,Ti as T,Ts as E,Wo as D,Xa as O,Xi as k,Xr as A,Xs as j,Yr as M,Za as N,_o as P,aa as F,bs as I,ds as ee,ha as L,ia as R,na as z,no as te,oo as B,qi as ne,qo as re,ta as V,ts as ie,wi as H,xr as ae}from"./index-Cc41r16l.js";import{n as oe,t as se}from"./settings-form-section-dmyaPOTG.js";import{i as ce,n as le,o as ue,r as de,t as fe}from"./dist-By6Rh2ee.js";var U=e(t(),1),W=n(),G=r(),K=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`,pe=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function me(e,t){return t.some(t=>t.connectorId===e.id)}function he(){let e=(0,W.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`div`,{className:i(`size-11 shrink-0 rounded-xl`,K)}),e[0]=t):t=e[0];let n,r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:i(`h-4 min-w-0 flex-1`,K)}),(0,G.jsx)(`div`,{className:i(`h-8 w-[4.5rem] shrink-0 rounded-lg`,K)})]}),r=(0,G.jsx)(`div`,{className:i(`h-3 w-full`,K)}),a=(0,G.jsx)(`div`,{className:i(`h-3 w-[88%]`,K)}),e[1]=n,e[2]=r,e[3]=a):(n=e[1],r=e[2],a=e[3]);let o;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(`div`,{className:`flex h-full min-h-[11rem] flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 dark:border-edge-subtle`,"aria-hidden":!0,children:(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,a,(0,G.jsxs)(`div`,{className:`mt-auto flex flex-wrap gap-1.5 pt-2`,children:[(0,G.jsx)(`div`,{className:i(`h-5 w-16 rounded-full`,K)}),(0,G.jsx)(`div`,{className:i(`h-5 w-20 rounded-full`,K)}),(0,G.jsx)(`div`,{className:i(`h-5 w-14 rounded-full`,K)})]})]})]})}),e[4]=o):o=e[4],o}function ge(){let e=(0,W.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,G.jsx)(`div`,{className:i(`h-4 w-48 max-w-full`,K)}),(0,G.jsx)(`div`,{className:i(`h-3 w-72 max-w-full`,K)})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[t,(0,G.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,G.jsx)(`div`,{className:i(`h-9 w-20 rounded-lg`,K)}),(0,G.jsx)(`div`,{className:i(`h-9 w-20 rounded-lg`,K)})]})]}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,G.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[n,(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,G.jsx)(`div`,{className:i(`h-8 w-20 rounded-md`,K)}),(0,G.jsx)(`div`,{className:i(`h-8 w-24 rounded-md`,K)}),(0,G.jsx)(`div`,{className:i(`h-8 w-28 rounded-md`,K)})]}),(0,G.jsx)(`div`,{className:i(`mt-3 h-20 rounded-xl`,K)})]}),e[2]=r):r=e[2],r}function _e(e){let t=(0,W.c)(61),{connector:n,installed:r,onInstall:i}=e,a,o,s,c,l,u,d;if(t[0]!==n.capabilities||t[1]!==n.category||t[2]!==n.description||t[3]!==n.displayName||t[4]!==n.source||t[5]!==r){let e=n.capabilities.slice(0,4);a=Math.max(0,n.capabilities.length-e.length),d=`flex min-h-60 flex-col rounded-lg border border-edge bg-surface-panel p-4 shadow-surface transition-colors hover:border-accent/50`,c=`flex min-w-0 flex-1 flex-col`;let i;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent-fg`,children:(0,G.jsx)(S,{className:`size-5`,"aria-hidden":!0})}),t[13]=i):i=t[13];let f;t[14]===n.displayName?f=t[15]:(f=(0,G.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[14]=n.displayName,t[15]=f);let p;t[16]===n.category?p=t[17]:(p=(0,G.jsx)(`p`,{className:`mt-1 text-xs uppercase tracking-wide text-fg-subtle`,children:n.category}),t[16]=n.category,t[17]=p);let m;t[18]!==f||t[19]!==p?(m=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[i,(0,G.jsxs)(`div`,{className:`min-w-0`,children:[f,p]})]}),t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;t[21]===r?h=t[22]:(h=r?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,G.jsx)(I,{className:`size-3`,"aria-hidden":!0}),`Installed`]}):null,t[21]=r,t[22]=h);let g=n.source===`registry`?`Registry`:n.source,_;t[23]===g?_=t[24]:(_=(0,G.jsx)(`span`,{className:`rounded-full border border-edge bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:g}),t[23]=g,t[24]=_);let v;t[25]!==h||t[26]!==_?(v=(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[h,_]}),t[25]=h,t[26]=_,t[27]=v):v=t[27],t[28]!==m||t[29]!==v?(l=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[m,v]}),t[28]=m,t[29]=v,t[30]=l):l=t[30],t[31]===n.description?u=t[32]:(u=(0,G.jsx)(`p`,{className:`mt-4 line-clamp-3 text-sm leading-6 text-fg-muted`,children:n.description}),t[31]=n.description,t[32]=u),o=`mt-4 flex flex-wrap gap-1.5`,s=e.map(J),t[0]=n.capabilities,t[1]=n.category,t[2]=n.description,t[3]=n.displayName,t[4]=n.source,t[5]=r,t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d}else a=t[6],o=t[7],s=t[8],c=t[9],l=t[10],u=t[11],d=t[12];let f;t[33]===a?f=t[34]:(f=a>0?(0,G.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,a]}):null,t[33]=a,t[34]=f);let p;t[35]!==o||t[36]!==s||t[37]!==f?(p=(0,G.jsxs)(`div`,{className:o,children:[s,f]}),t[35]=o,t[36]=s,t[37]=f,t[38]=p):p=t[38];let m;t[39]!==c||t[40]!==l||t[41]!==u||t[42]!==p?(m=(0,G.jsxs)(`div`,{className:c,children:[l,u,p]}),t[39]=c,t[40]=l,t[41]=u,t[42]=p,t[43]=m):m=t[43];let h;t[44]===n.tags?h=t[45]:(h=n.tags?.length?(0,G.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-1.5 border-t border-edge pt-3`,children:n.tags.slice(0,4).map(q)}):null,t[44]=n.tags,t[45]=h);let g;t[46]!==n||t[47]!==i?(g=()=>i(n),t[46]=n,t[47]=i,t[48]=g):g=t[48];let _;t[49]===r?_=t[50]:(_=r?(0,G.jsx)(I,{className:`size-4`}):(0,G.jsx)(B,{className:`size-4`}),t[49]=r,t[50]=_);let v=r?`Installed`:`Install`,y;t[51]!==r||t[52]!==g||t[53]!==_||t[54]!==v?(y=(0,G.jsx)(`div`,{className:`mt-4 flex items-center justify-end`,children:(0,G.jsxs)(z,{variant:`secondary`,disabled:r,className:`w-full justify-center`,onClick:g,children:[_,v]})}),t[51]=r,t[52]=g,t[53]=_,t[54]=v,t[55]=y):y=t[55];let b;return t[56]!==h||t[57]!==y||t[58]!==d||t[59]!==m?(b=(0,G.jsxs)(`div`,{className:d,children:[m,h,y]}),t[56]=h,t[57]=y,t[58]=d,t[59]=m,t[60]=b):b=t[60],b}function q(e){return(0,G.jsx)(`span`,{className:`rounded-full border border-edge px-2 py-0.5 text-[11px] text-fg-subtle`,children:e},e)}function J(e){return(0,G.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e)}var ve=(0,U.memo)(function(e){let t=(0,W.c)(19),{loading:n,searchQuery:r,setSearchQuery:i,onReloadClick:a,onAddCustomServer:o,searchPlaceholder:s,addLabel:c,reloadLabel:l}=e,u;t[0]!==n||t[1]!==a||t[2]!==l?(u=(0,G.jsx)(ae,{className:`size-9 shrink-0 p-0`,loading:n,label:l,title:l,onClick:a}),t[0]=n,t[1]=a,t[2]=l,t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[4]=d):d=t[4];let f;t[5]===i?f=t[6]:(f=e=>i(e.currentTarget.value),t[5]=i,t[6]=f);let p;t[7]!==s||t[8]!==r||t[9]!==f?(p=(0,G.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,G.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:r,onChange:f,placeholder:s,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[7]=s,t[8]=r,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,G.jsx)(O,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[11]=m):m=t[11];let h;t[12]!==c||t[13]!==o?(h=(0,G.jsxs)(z,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:o,children:[m,c]}),t[12]=c,t[13]=o,t[14]=h):h=t[14];let g;return t[15]!==u||t[16]!==p||t[17]!==h?(g=(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,p,h]}),t[15]=u,t[16]=p,t[17]=h,t[18]=g):g=t[18],g}),Y=/^([^:=]+)[:=](.*)$/;function ye(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=Y.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function be(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function X(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function xe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function Se(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||xe(t)&&(r[e]=t);return r}function Ce(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function we(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function Te(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=Ce(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=we(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=be(e.headers);return n&&(t.headers=n),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}function Ee(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:X(a),connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0}}function De(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],connectionTimeoutMs:void 0}}function Oe(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||xe(t)?[]:[Ee(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function ke(e){return Te(e)}async function Ae(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=Te(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await l(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),M()}function je(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n==`string`){let e=n.trim();e&&t.push({name:e});continue}if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function Me(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function Ne(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function Pe(e,t){let n=await l(c(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=je(n.payload.tools),i=Me(n.payload.resources),a=Ne(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function Fe(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Ie(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function Le(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function Re({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),m=Le(e),h=(0,U.useCallback)(async()=>{o(!0),p(null);try{let t=await Pe(e.id.trim());u({toolCount:t.toolCount,resourceCount:t.resourceCount,promptCount:t.promptCount})}catch(e){p(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e.id]),g=(0,U.useCallback)(async()=>{c(!0),p(null);try{await i()}catch(e){p(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,G.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,G.jsx)(`span`,{className:`rounded-full border border-edge bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.transportLabels[e.transport]})]}),m?(0,G.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-subtle`,title:m,children:m}):null]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(z,{variant:`secondary`,disabled:a,onClick:()=>void h(),children:[a?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(d,{className:`size-4`}),t.testConnection]}),(0,G.jsxs)(z,{variant:`secondary`,onClick:r,children:[(0,G.jsx)(te,{className:`size-4`}),n.editCustomServer]}),(0,G.jsxs)(z,{variant:`ghost`,disabled:s,onClick:()=>void g(),children:[s?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(L,{className:`size-4`}),t.removeServer]})]})]}),f?(0,G.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:f}):null,l?(0,G.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[l.toolCount,` tools, `,l.resourceCount,` resources,`,` `,l.promptCount,` prompts discovered.`]}):null]})}function Z(e,t){if(!e.payload)throw Error(e.error??t);return e.payload}async function ze(){return Z(await l(c(`/api/connectors/catalog`)),`Could not load connector catalog.`).connectors}async function Be(){return Z(await l(c(`/api/connectors/catalog`)),`Could not load connector registries.`).registries??[]}async function Ve(){return Z(await l(c(`/api/connectors/installed`)),`Could not load installed connectors.`).instances}var He=new Map,Ue=300*1e3;async function We(e,t=`all`,n){let r=e.trim(),i=t.trim()||`all`,a=n?.browse??!1,o=Math.max(n?.page??1,1),s=Math.max(n?.pageSize??24,1),u=`${i}:${r}:${a?`browse`:`search`}:${o}:${s}`,d=Date.now(),f=He.get(u);if(f&&f.expiresAt>d)return f.promise;let p=new URLSearchParams;r&&p.set(`q`,r),i!==`all`&&p.set(`source`,i),a&&p.set(`browse`,`1`),p.set(`page`,String(o)),p.set(`pageSize`,String(s));let m=l(c(`/api/connectors/registry/search?${p.toString()}`)).then(e=>{let t=Z(e,`Could not search connector registries.`),n=Math.max(0,...(t.results??[]).map(e=>e.totalPages??0))||void 0;return{connectors:t.connectors,totalPages:n}});He.set(u,{expiresAt:d+Ue,promise:m});try{return await m}catch(e){throw He.delete(u),e}}async function Ge(e){return Z(await l(c(`/api/connectors/${encodeURIComponent(e)}/oauth/start`),{method:`POST`}),`Could not start connector OAuth.`).oauth}async function Ke(e,t){return Z(await l(c(`/api/connectors/${encodeURIComponent(e)}/oauth/complete`),{method:`POST`,body:JSON.stringify({deviceCode:t})}),`Could not complete connector OAuth.`).oauth}async function qe(e,t){let n=await l(c(`/api/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify(t)});return M(),Z(n,`Could not install connector.`).instance}async function Je(e){await l(c(`/api/connectors/${encodeURIComponent(e)}`),{method:`DELETE`}),M()}async function Ye(e){return Z(await l(c(`/api/connectors/${encodeURIComponent(e)}/test`),{method:`POST`}),`Connector test failed.`)}async function Xe(){return Z(await l(c(`/api/connectors/composio/connections`)),`Could not load Composio connections.`).connections}async function Ze(e){return Z(await l(c(`/api/connectors/composio/${encodeURIComponent(e)}/authorize`),{method:`POST`}),`Could not start Composio authorization.`).oauth}async function Qe(e){return Z(await l(c(`/api/connectors/composio/${encodeURIComponent(e)}/scope`)),`Could not load Composio scope.`).scope}async function $e(e,t){let n=await l(c(`/api/connectors/composio/${encodeURIComponent(e)}/scope`),{method:`POST`,body:JSON.stringify({scope:t})});return M(),Z(n,`Could not update Composio scope.`).scope}async function et(e){return Z(await l(c(`/api/connectors/composio/${encodeURIComponent(e)}/tools`)),`Could not load Composio tools.`).tools}async function tt(e=50){return Z(await l(c(`/api/connectors/composio/triggers?limit=${encodeURIComponent(String(e))}`)),`Could not load Composio trigger events.`).events}function nt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function rt(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||nt(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
2
- `).toLowerCase().includes(r)}function it(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function at(e){let t=(0,W.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:a,searchEmptyLabel:o}=e,[s,c]=(0,U.useState)(``),l;if(t[0]!==s||t[1]!==r||t[2]!==n){let e;t[4]!==s||t[5]!==r?(e=e=>rt(e,s,r),t[4]=s,t[5]=r,t[6]=e):e=t[6],l=n.filter(e),t[0]=s,t[1]=r,t[2]=n,t[3]=l}else l=t[3];let u=l,d;t[7]===s?d=t[8]:(d=s.trim(),t[7]=s,t[8]=d);let f=d.length>0,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,G.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=p):p=t[9];let m,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,V),h=e=>c(e.target.value),t[10]=m,t[11]=h):(m=t[10],h=t[11]);let g;t[12]!==s||t[13]!==a?(g=(0,G.jsxs)(`div`,{className:`relative`,children:[p,(0,G.jsx)(`input`,{type:`search`,value:s,placeholder:a,"aria-label":a,className:m,onChange:h})]}),t[12]=s,t[13]=a,t[14]=g):g=t[14];let _;t[15]!==u.length||t[16]!==f||t[17]!==n.length?(_=f?(0,G.jsxs)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:[u.length,` / `,n.length]}):null,t[15]=u.length,t[16]=f,t[17]=n.length,t[18]=_):_=t[18];let v;t[19]!==g||t[20]!==_?(v=(0,G.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[g,_]}),t[19]=g,t[20]=_,t[21]=v):v=t[21];let y;t[22]!==u||t[23]!==o||t[24]!==r?(y=(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:u.length===0?(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>{let n=e.shortName||it(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,G.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,G.jsx)(`p`,{className:`mt-1 truncate text-xs leading-relaxed text-fg-muted`,title:e.description,children:e.description}):null]},i)})})}),t[22]=u,t[23]=o,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function ot(e){let t=(0,W.c)(38),{open:n,onOpenChange:r,serverId:a,title:o,subtitle:s,searchPlaceholder:c,searchEmptyLabel:l,emptyLabel:u,closeLabel:d,tools:f,stripPrefix:g}=e,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(T,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,v)}),t[0]=y):y=t[0];let b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=i(`fixed left-1/2 top-1/2 flex max-h-[min(88vh,40rem)] w-[min(100%-2rem,min(92vw,36rem))] -translate-x-1/2 -translate-y-1/2 flex-col`,_,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=b):b=t[1];let S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,G.jsx)(F,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=S):S=t[2];let C;t[3]===o?C=t[4]:(C=(0,G.jsxs)(x,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[S,o]}),t[3]=o,t[4]=C);let E;t[5]!==a||t[6]!==s||t[7]!==f.length?(E=s.replace(`{{serverId}}`,a).replace(`{{count}}`,String(f.length)),t[5]=a,t[6]=s,t[7]=f.length,t[8]=E):E=t[8];let D;t[9]===E?D=t[10]:(D=(0,G.jsx)(H,{className:`mt-1 text-sm text-fg-muted`,children:E}),t[9]=E,t[10]=D);let O;t[11]!==C||t[12]!==D?(O=(0,G.jsxs)(`div`,{className:`min-w-0`,children:[C,D]}),t[11]=C,t[12]=D,t[13]=O):O=t[13];let k;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,G.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[14]=k):k=t[14];let A;t[15]===d?A=t[16]:(A=(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":d,children:k})}),t[15]=d,t[16]=A);let j;t[17]!==O||t[18]!==A?(j=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[O,A]}),t[17]=O,t[18]=A,t[19]=j):j=t[19];let M;t[20]!==u||t[21]!==n||t[22]!==l||t[23]!==c||t[24]!==a||t[25]!==g||t[26]!==f?(M=f.length>0?(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,G.jsx)(at,{tools:f,stripPrefix:g,searchPlaceholder:c,searchEmptyLabel:l},`${a}-${n?`open`:`closed`}`)}):(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u})}),t[20]=u,t[21]=n,t[22]=l,t[23]=c,t[24]=a,t[25]=g,t[26]=f,t[27]=M):M=t[27];let N;t[28]===d?N=t[29]:(N=(0,G.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(z,{type:`button`,variant:`secondary`,children:d})})}),t[28]=d,t[29]=N);let P;t[30]!==j||t[31]!==M||t[32]!==N?(P=(0,G.jsxs)(h,{children:[y,(0,G.jsxs)(p,{className:b,children:[j,M,N]})]}),t[30]=j,t[31]=M,t[32]=N,t[33]=P):P=t[33];let I;return t[34]!==r||t[35]!==n||t[36]!==P?(I=(0,G.jsx)(m,{open:n,onOpenChange:r,children:P}),t[34]=r,t[35]=n,t[36]=P,t[37]=I):I=t[37],I}var st=i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,V);function ct(e){return e.materialized.type===`composio`?e.connectorId.replace(/^composio-/,``):null}function lt({instance:e}){let t=ct(e),[n,r]=(0,U.useState)([]),[a,o]=(0,U.useState)([]),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)(`read`),[d,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(null),g=(0,U.useCallback)(async()=>{if(!(!t||t===`api-key`)){p(!0),h(null);try{let[e,n,i,a]=await Promise.all([Xe().catch(()=>[]),et(t).catch(()=>[]),tt(20).catch(()=>[]),Qe(t).catch(()=>`read`)]);r(e.filter(e=>e.toolkit.toLowerCase()===t.toLowerCase())),o(n),c(i.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===t.toLowerCase())),u(a)}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}},[t]);(0,U.useEffect)(()=>{g()},[g]);let _=(0,U.useCallback)(async()=>{if(t){p(!0),h(null);try{let e=await Ze(t);window.open(e.connectUrl,`_blank`,`noopener,noreferrer`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}},[t]),v=(0,U.useCallback)(async e=>{if(t){u(e);try{await $e(t,e),await g()}catch(e){h(e instanceof Error?e.message:String(e))}}},[g,t]);return t?t===`api-key`?(0,G.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:`Composio API key stored. Install a toolkit connector to manage OAuth connections and tools.`}):(0,G.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`font-medium text-fg`,children:[`Composio toolkit: `,t]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:`Curated actions are filtered by read/write/admin scope before they reach the agent.`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(`select`,{className:i(st,`h-9 w-28 py-1`),value:l,onChange:e=>void v(e.currentTarget.value),children:[(0,G.jsx)(`option`,{value:`read`,children:`Read`}),(0,G.jsx)(`option`,{value:`write`,children:`Write`}),(0,G.jsx)(`option`,{value:`admin`,children:`Admin`})]}),(0,G.jsxs)(z,{variant:`secondary`,disabled:d,onClick:()=>void _(),children:[d?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(f,{className:`size-4`}),`Connect OAuth`]}),(0,G.jsx)(z,{variant:`ghost`,disabled:d,onClick:()=>void g(),children:`Refresh`})]})]}),m?(0,G.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:m}):null,(0,G.jsxs)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:`Connections`}),n.length?n.map(e=>(0,G.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,G.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.accountEmail??e.username??e.workspace??e.id}),(0,G.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:e.status})]},e.id)):(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`No active connection loaded.`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:`Agent tools`}),a.length?a.slice(0,8).map(e=>(0,G.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,G.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,G.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[e.scope,e.curated?``:` · uncurated`]})]},e.slug)):(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`No actions available at this scope.`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:`Recent triggers`}),s.length?s.slice(0,5).map(e=>(0,G.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,G.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,G.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`No trigger events archived yet.`})]})]})]}):null}function ut({instance:e,onChanged:t}){let[n,r]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(`health`),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(null),_=(0,U.useCallback)(async()=>{r(!0),g(null);try{let n=await Ye(e.instanceId);c(n),n.toolCount>0&&u(`tools`),await t()}catch(e){g(e instanceof Error?e.message:String(e))}finally{r(!1)}},[e.instanceId,t]),v=(0,U.useCallback)(async()=>{o(!0),g(null);try{await Je(e.instanceId),await t()}catch(e){g(e instanceof Error?e.message:String(e)),o(!1)}},[e.instanceId,t]),b=s?s.toolCount:e.usage.lastToolCount;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.displayName}),(0,G.jsx)(`span`,{className:`rounded-full border border-edge bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:`catalog`})]}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.materialized.type===`mcp`?`MCP server: ${e.materialized.serverId}`:`Runtime: ${e.materialized.type}`})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[e.materialized.type===`mcp`?(0,G.jsxs)(z,{variant:`secondary`,disabled:n,onClick:()=>void _(),children:[n?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(d,{className:`size-4`}),`Test`]}):null,(0,G.jsxs)(z,{variant:`ghost`,disabled:a,onClick:()=>void v(),children:[a?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(L,{className:`size-4`}),`Remove`]})]})]}),h?(0,G.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:h}):null,(0,G.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[[`health`,y,`Health`],[`tools`,F,`Tools ${s?s.toolCount:e.usage.lastToolCount??``}`],[`resources`,ie,`Resources ${s?s.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,re,`Prompts ${s?s.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,f,`Permissions`]].map(([e,t,n])=>(0,G.jsxs)(`button`,{type:`button`,className:i(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,l===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>u(e),children:[(0,G.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,G.jsxs)(`div`,{className:`mt-3 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[l===`health`?(0,G.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,G.jsxs)(`p`,{children:[`Status:`,` `,(0,G.jsx)(`span`,{className:s?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:s?.status??e.usage.lastHealthStatus??`not tested`})]}),(0,G.jsxs)(`p`,{children:[`Last check:`,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():`never`]}),s?.action?(0,G.jsx)(`p`,{children:s.action}):null]}):null,l===`tools`?s?.tools.length?(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[s.tools.length,` tools available for this connector.`]}),(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>m(!0),children:`View all`})]}),s.tools.slice(0,8).map(e=>(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.shortName??e.name}),e.description?(0,G.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.description}):null]},e.name))]}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`text-fg-muted`,children:b?`${b} tools were found in the last health check. Run Test again to load tool details.`:`Run Test to list tools.`}),(0,G.jsxs)(z,{type:`button`,variant:`secondary`,disabled:n,onClick:()=>void _(),children:[n?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(d,{className:`size-4`}),`Test`]})]}):null,l===`resources`?s?.resources.length?(0,G.jsx)(`div`,{className:`grid gap-2`,children:s.resources.slice(0,8).map(e=>(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.title??e.name}),(0,G.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.uri})]},e.uri))}):(0,G.jsx)(`p`,{className:`text-fg-muted`,children:`Run Test to list resources exposed by this MCP server.`}):null,l===`prompts`?s?.prompts.length?(0,G.jsx)(`div`,{className:`grid gap-2`,children:s.prompts.slice(0,8).map(e=>(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.title??e.name}),e.description?(0,G.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.description}):null]},e.name))}):(0,G.jsx)(`p`,{className:`text-fg-muted`,children:`Run Test to list prompts exposed by this MCP server.`}):null,l===`permissions`?(0,G.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,G.jsxs)(`p`,{children:[`Secrets configured: `,Object.values(e.secretStatus).filter(Boolean).length]}),(0,G.jsxs)(`p`,{children:[`Runtime: `,e.materialized.type.toUpperCase(),e.materialized.type===`mcp`?` server \`${e.materialized.serverId}\``:``]}),(0,G.jsx)(`p`,{children:e.materialized.type===`mcp`?`Tool calls run through MCP and follow the agent tool policy/approval gates.`:`Tool calls follow connector scope and curated allowlist gates.`})]}):null]}),e.materialized.type===`composio`?(0,G.jsx)(lt,{instance:e}):null]}),e.materialized.type===`mcp`?(0,G.jsx)(ot,{open:p,onOpenChange:m,serverId:e.materialized.serverId,title:`${e.displayName} tools`,subtitle:`{{serverId}} exposes {{count}} MCP tools.`,searchPlaceholder:`Search tools`,searchEmptyLabel:`No tools match your search.`,emptyLabel:`Run Test to list tools.`,closeLabel:`Close`,tools:s?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null]})}var dt=i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,V),ft=i(dt,`min-h-28 font-mono`);function pt(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function mt(e){let t={};for(let n of e.setup.secrets??[])t[n.key]=``;let n={};for(let t of e.setup.config??[])n[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:t,config:n,installing:!1,error:null,result:null,health:null,oauth:{flow:null,connected:e.auth.mode!==`oauth`}}}function ht({draft:e,onChange:t,onClose:n,onInstalled:r}){let{connector:a}=e,o=e.result?`complete`:e.installing?`health`:`configure`,s=[{id:`configure`,label:`Configure`},{id:`health`,label:`Health check`},{id:`complete`,label:`Complete`}],c=(0,U.useCallback)(async()=>{t({...e,installing:!0,error:null});try{let n=await Ge(a.id);window.open(n.verificationUri,`_blank`,`noopener,noreferrer`),t({...e,installing:!1,error:null,oauth:{flow:n,connected:!1}})}catch(n){t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[a.id,e,t]),l=(0,U.useCallback)(async()=>{if(e.oauth.flow){t({...e,installing:!0,error:null});try{await Ke(a.id,e.oauth.flow.deviceCode),t({...e,installing:!1,error:null,oauth:{...e.oauth,connected:!0}})}catch(n){t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}}},[a.id,e,t]),u=(0,U.useCallback)(async()=>{t({...e,installing:!0,error:null,result:null,health:null});try{if(a.auth.mode===`oauth`&&!e.oauth.connected)throw Error(`Connect GitHub OAuth before installing this connector.`);let n={};for(let t of a.setup.config??[]){let r=pt(t.type,e.config[t.key]??``);r!==void 0&&(n[t.key]=r)}let i=await qe(a.id,{secrets:e.secrets,config:n,definition:a.source===`registry`?a:void 0}),o=null;try{o=await Ye(i.instanceId)}catch{o=null}t({...e,installing:!1,result:i,health:o}),await r()}catch(n){t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[a,e,t,r]);return(0,G.jsx)(m,{open:!0,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(h,{children:[(0,G.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,G.jsxs)(p,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(x,{className:`text-base font-semibold text-fg`,children:[`Install `,a.displayName]}),(0,G.jsx)(H,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:a.description})]}),(0,G.jsx)(w,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,className:i(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,k.focusRingPanel),"aria-label":`Close`,children:[(0,G.jsx)(R,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]}),(0,G.jsxs)(`div`,{className:`min-h-0 overflow-y-auto px-6 py-5`,children:[(0,G.jsx)(`div`,{className:`mb-5 grid grid-cols-3 gap-2`,"aria-label":`Install progress`,children:s.map((e,t)=>{let n=s.findIndex(e=>e.id===o);return(0,G.jsxs)(`div`,{className:i(`rounded-xl border px-3 py-2 text-xs font-medium`,t===n?`border-accent bg-accent-soft text-accent-fg`:t<n?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-edge bg-surface-base text-fg-muted`),children:[(0,G.jsxs)(`span`,{className:`mr-1 tabular-nums`,children:[t+1,`.`]}),e.label]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a.auth.mode===`oauth`?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,G.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:`Connect with GitHub`}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:`Authorize xopc in GitHub, then return here to finish the connection.`}),e.oauth.flow?(0,G.jsxs)(`div`,{className:`mt-3 rounded-xl bg-surface-base p-3 text-sm text-fg-muted`,children:[(0,G.jsxs)(`p`,{children:[`Open `,(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:e.oauth.flow.verificationUri}),` and enter this code:`]}),(0,G.jsx)(`p`,{className:`mt-2 font-mono text-lg font-semibold tracking-widest text-fg`,children:e.oauth.flow.userCode})]}):null,e.oauth.connected?(0,G.jsx)(`p`,{className:`mt-3 rounded-xl bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700`,children:`GitHub connected. You can install this connector now.`}):null,(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,G.jsxs)(z,{variant:`secondary`,disabled:e.installing,onClick:()=>void c(),children:[e.installing&&!e.oauth.flow?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(d,{className:`size-4`}),`Connect GitHub`]}),(0,G.jsxs)(z,{variant:`primary`,disabled:e.installing||!e.oauth.flow,onClick:()=>void l(),children:[e.installing&&e.oauth.flow?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(I,{className:`size-4`}),`I authorized GitHub`]})]})]}):null,(a.setup.secrets??[]).map(n=>(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,G.jsx)(g,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:{show:`Show`,hide:`Hide`,copy:`Copy`,copied:`Copied`},placeholder:n.required?`Required`:`Optional`})]},n.key)),(a.setup.config??[]).map(n=>(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,G.jsx)(`textarea`,{className:ft,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,G.jsx)(`input`,{className:dt,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,G.jsx)(P,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),`Installing connector and running health check…`]}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:`XOPC saves the connector, materializes its runtime, then probes exposed tools, resources, and prompts.`})]}):null,e.error?(0,G.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:e.error}):null,e.result?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`font-medium text-fg`,children:[`Installed as `,e.result.materialized.type===`mcp`?e.result.materialized.serverId:e.result.instanceId]}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[`Runtime: `,e.result.materialized.type.toUpperCase()]})]}),(0,G.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?`Healthy`:e.health?e.health.status:`Health pending`})]}),e.health?(0,G.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.toolCount}),(0,G.jsx)(`div`,{children:`Tools`})]}),(0,G.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.resourceCount}),(0,G.jsx)(`div`,{children:`Resources`})]}),(0,G.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.promptCount}),(0,G.jsx)(`div`,{children:`Prompts`})]})]}):(0,G.jsx)(`p`,{className:`mt-3`,children:`Installed. Capabilities can be tested from Installed.`}),e.health?.action?(0,G.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(z,{variant:`secondary`,children:`Done`})}),(0,G.jsxs)(z,{variant:`primary`,disabled:!!e.result||e.installing||a.auth.mode===`oauth`&&!e.oauth.connected,onClick:()=>void u(),children:[e.installing?(0,G.jsx)(P,{className:`size-4 animate-spin`}):e.result?(0,G.jsx)(I,{className:`size-4`}):(0,G.jsx)(B,{className:`size-4`}),e.result?`Installed`:`Install`]})]})]})]})})}function gt(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return De(r)}function _t(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.description,e.category,e.kind,e.source,...e.tags??[]].some(e=>e.toLowerCase().includes(n)):!0}function vt(e,t,n){return e.filter(e=>_t(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function yt(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.connectorId,e.instanceId,e.status,e.connectionStatus??``,e.materialized.type,e.materialized.type===`mcp`?e.materialized.serverId:e.materialized.id].some(e=>e.toLowerCase().includes(n)):!0}function bt(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.command??``,e.url??``,e.transport].some(e=>e.toLowerCase().includes(n)):!0}function xt(e,t,n){let r=e.key.trim();if(r)return`key:${r}`;let i=e.value.trim();return i?`value:${i}`:`empty:${n.slice(0,t).filter(e=>!e.key.trim()&&!e.value.trim()).length}`}function St(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,V)}function Ct({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:a,pasteFailed:o,keyPlaceholder:s,valuePlaceholder:c,headers:l,onChange:u}){let d=(e,t)=>{u(l.map((n,r)=>r===e?{...n,...t}:n))},f=()=>{u([...l,{key:``,value:``}])},p=e=>{let t=l.filter((t,n)=>n!==e);u(t.length>0?t:[{key:``,value:``}])},m=async()=>{try{let e=await ne();if(!e){window.alert(o);return}let t=ye(e);if(!t?.length){window.alert(o);return}u(t)}catch{window.alert(o)}};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,G.jsxs)(z,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void m(),children:[(0,G.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),a]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{className:i(St(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:s,onChange:e=>d(t,{key:e.target.value})}),(0,G.jsx)(`input`,{className:i(St(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:c,onChange:e=>d(t,{value:e.target.value})}),(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:l.length<=1&&!e.key&&!e.value,onClick:()=>p(t),"aria-label":r,children:(0,G.jsx)(L,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},xt(e,t,l)))}),(0,G.jsxs)(`button`,{type:`button`,className:i(`self-start text-sm text-accent hover:underline`,k.press),onClick:f,children:[`+ `,n]})]})}var wt=[`stdio`,`sse`,`streamable-http`];function Q(e){let t=(0,W.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,G.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,G.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function $(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,V)}function Tt(e){let t=(0,W.c)(67),{row:n,t:r,onUpdate:a,idConflictMessage:o}=e,s=r.transportLabel,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=$(),t[0]=c):c=t[0];let l=n.transport,u;t[1]===a?u=t[2]:(u=e=>a({transport:e.target.value}),t[1]=a,t[2]=u);let d;t[3]===r.transportLabels?d=t[4]:(d=wt.map(e=>(0,G.jsx)(`option`,{value:e,children:r.transportLabels[e]},e)),t[3]=r.transportLabels,t[4]=d);let f;t[5]!==n.transport||t[6]!==u||t[7]!==d?(f=(0,G.jsx)(`select`,{className:c,value:l,onChange:u,children:d}),t[5]=n.transport,t[6]=u,t[7]=d,t[8]=f):f=t[8];let p;t[9]!==r.transportLabel||t[10]!==f?(p=(0,G.jsx)(Q,{label:s,required:!0,children:f}),t[9]=r.transportLabel,t[10]=f,t[11]=p):p=t[11];let m=r.serverIdLabel,h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=$(),t[12]=h):h=t[12];let g;t[13]===a?g=t[14]:(g=e=>a({id:e.target.value}),t[13]=a,t[14]=g);let _;t[15]!==n.id||t[16]!==r.serverIdPlaceholder||t[17]!==g?(_=(0,G.jsx)(`input`,{className:h,value:n.id,placeholder:r.serverIdPlaceholder,onChange:g}),t[15]=n.id,t[16]=r.serverIdPlaceholder,t[17]=g,t[18]=_):_=t[18];let v;t[19]===o?v=t[20]:(v=o?(0,G.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:o}):null,t[19]=o,t[20]=v);let y;t[21]!==r.serverIdLabel||t[22]!==_||t[23]!==v?(y=(0,G.jsxs)(Q,{label:m,required:!0,children:[_,v]}),t[21]=r.serverIdLabel,t[22]=_,t[23]=v,t[24]=y):y=t[24];let b;t[25]!==a||t[26]!==n.argsText||t[27]!==n.command||t[28]!==n.cwd||t[29]!==n.envJson||t[30]!==n.headers||t[31]!==n.transport||t[32]!==n.url||t[33]!==r.addHeader||t[34]!==r.argsHint||t[35]!==r.argsLabel||t[36]!==r.commandLabel||t[37]!==r.cwdLabel||t[38]!==r.envHint||t[39]!==r.envLabel||t[40]!==r.headerKeyPlaceholder||t[41]!==r.headerValuePlaceholder||t[42]!==r.headersLabel||t[43]!==r.optionalSuffix||t[44]!==r.pasteHeaders||t[45]!==r.pasteHeadersFailed||t[46]!==r.removeHeader||t[47]!==r.urlLabel?(b=n.transport===`stdio`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{label:r.commandLabel,required:!0,children:(0,G.jsx)(`input`,{className:$(),value:n.command,onChange:e=>a({command:e.target.value})})}),(0,G.jsx)(Q,{label:r.argsLabel,description:r.argsHint,children:(0,G.jsx)(`input`,{className:$(),value:n.argsText,onChange:e=>a({argsText:e.target.value})})}),(0,G.jsx)(Q,{label:r.cwdLabel,children:(0,G.jsx)(`input`,{className:$(),value:n.cwd,onChange:e=>a({cwd:e.target.value})})}),(0,G.jsx)(Q,{label:r.envLabel,description:r.envHint,children:(0,G.jsx)(`textarea`,{className:i($(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>a({envJson:e.target.value})})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`md:col-span-2`,children:(0,G.jsx)(Q,{label:r.urlLabel,required:!0,children:(0,G.jsx)(`input`,{className:i($(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>a({url:e.target.value})})})}),(0,G.jsx)(Ct,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>a({headers:e})})]}),t[25]=a,t[26]=n.argsText,t[27]=n.command,t[28]=n.cwd,t[29]=n.envJson,t[30]=n.headers,t[31]=n.transport,t[32]=n.url,t[33]=r.addHeader,t[34]=r.argsHint,t[35]=r.argsLabel,t[36]=r.commandLabel,t[37]=r.cwdLabel,t[38]=r.envHint,t[39]=r.envLabel,t[40]=r.headerKeyPlaceholder,t[41]=r.headerValuePlaceholder,t[42]=r.headersLabel,t[43]=r.optionalSuffix,t[44]=r.pasteHeaders,t[45]=r.pasteHeadersFailed,t[46]=r.removeHeader,t[47]=r.urlLabel,t[48]=b):b=t[48];let x=r.timeoutLabel,S=r.timeoutHint,C;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(C=$(),t[49]=C):C=t[49];let w;t[50]===n?w=t[51]:(w=Fe(n),t[50]=n,t[51]=w);let T;t[52]===a?T=t[53]:(T=e=>a({connectionTimeoutMs:Ie(e.target.value)}),t[52]=a,t[53]=T);let E;t[54]!==r.timeoutPlaceholder||t[55]!==w||t[56]!==T?(E=(0,G.jsx)(`input`,{type:`number`,min:1,max:600,className:C,value:w,placeholder:r.timeoutPlaceholder,onChange:T}),t[54]=r.timeoutPlaceholder,t[55]=w,t[56]=T,t[57]=E):E=t[57];let D;t[58]!==r.timeoutHint||t[59]!==r.timeoutLabel||t[60]!==E?(D=(0,G.jsx)(Q,{label:x,description:S,children:E}),t[58]=r.timeoutHint,t[59]=r.timeoutLabel,t[60]=E,t[61]=D):D=t[61];let O;return t[62]!==y||t[63]!==b||t[64]!==D||t[65]!==p?(O=(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[p,y,b,D]}),t[62]=y,t[63]=b,t[64]=D,t[65]=p,t[66]=O):O=t[66],O}function Et({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:a,config:o,managedServerIds:s,t:c,cs:l,onClose:u,onSaved:f}){let[g,_]=(0,U.useState)(n),[v,y]=(0,U.useState)(!1),[b,S]=(0,U.useState)(!1),[C,E]=(0,U.useState)(null),[D,O]=(0,U.useState)({status:`idle`}),[A,j]=(0,U.useState)(null),M=n.id.trim(),N=g.id.trim()!==M&&s.has(g.id.trim())||s.has(g.id.trim())&&t===`add`?c.reservedServerId:void 0,ee=g.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===g.id.trim())?l.duplicateServerId:void 0,L=g.id.trim().length>0&&!N&&!ee&&(g.transport===`stdio`?g.command.trim().length>0:g.url.trim().length>0),te=(0,U.useCallback)(async()=>{if(g.id.trim()){S(!0),E(null),O({status:`loading`});try{O({status:`ok`,tools:(await Pe(g.id.trim(),ke(g))).tools})}catch(e){O({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{S(!1)}}},[g]),B=(0,U.useCallback)(async()=>{if(!(!L||v)){y(!0),E(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(g),await Ae({sessionIdleTtlMinutes:a,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},Se(o)),await f(),u()}catch(e){E(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[L,o,r,n.clientKey,t,u,f,M,g,v,a]);return e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m,{open:e,onOpenChange:e=>{e||u()},children:(0,G.jsxs)(h,{children:[(0,G.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,G.jsxs)(p,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(x,{className:`text-base font-semibold text-fg`,children:t===`add`?l.addCustomServerTitle:l.editCustomServerTitle}),(0,G.jsx)(H,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?l.addCustomServerHint:l.editCustomServerHint})]}),(0,G.jsx)(w,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,className:i(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,k.focusRingPanel),"aria-label":l.modalClose,children:[(0,G.jsx)(R,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`sr-only`,children:l.modalClose})]})})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(Tt,{row:g,t:c,onUpdate:e=>{_(t=>({...t,...e})),E(null)},idConflictMessage:N??ee}),D.status===`ok`?(0,G.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-base px-3 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,G.jsx)(F,{className:`size-4 text-accent`,"aria-hidden":!0}),D.tools.length===0?c.toolsEmpty:c.toolsTitle.replace(`{{count}}`,String(D.tools.length))]}),D.tools.length>0?(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>j(D.tools),children:c.viewAllTools}):null]})}):null,D.status===`error`?(0,G.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:D.message}):null,C?(0,G.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:C}):null]})}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,G.jsxs)(z,{variant:`secondary`,disabled:!g.id.trim()||b,onClick:()=>void te(),children:[b?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(d,{className:`size-4`}),c.testConnection]}),(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(z,{variant:`secondary`,children:l.modalCancel})}),(0,G.jsxs)(z,{variant:`primary`,disabled:!L||v,onClick:()=>void B(),children:[v?(0,G.jsx)(P,{className:`size-4 animate-spin`}):(0,G.jsx)(I,{className:`size-4`}),v?c.saving:l.modalSave]})]})]})]})}),A?(0,G.jsx)(ot,{open:!0,onOpenChange:e=>{e||j(null)},serverId:g.id,title:c.toolsDialogTitle,subtitle:c.toolsDialogSubtitle,searchPlaceholder:c.toolsDialogSearchPlaceholder,searchEmptyLabel:c.toolsDialogSearchEmpty,emptyLabel:c.toolsEmpty,closeLabel:c.toolsDialogClose,tools:A,stripPrefix:`${g.id.trim()}__`}):null]}):null}var Dt=`mprov`,Ot=`smithery`,kt=i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,V);function At(){let e=a(o(e=>e.language)),t=e.connectorsSettings,n=e.mcpSettings,r=s(e=>e.token),c=!!r,[l,d]=j(),f=l.get(Dt)?.trim()||Ot,[p,m]=(0,U.useState)(`marketplace`),[h,g]=(0,U.useState)({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!0,error:null}),[_,v]=(0,U.useState)(!1),[y,x]=(0,U.useState)(1),[S,C]=(0,U.useState)(void 0),[w,T]=(0,U.useState)(``),[O,M]=(0,U.useState)(f),[F,I]=(0,U.useState)(`name`),[ee,L]=(0,U.useState)(null),[R,te]=(0,U.useState)(null),[B,ne]=(0,U.useState)(void 0),[re,V]=(0,U.useState)(!1),[ie,H]=(0,U.useState)(!1),{data:ae,mutate:W}=A(c),K=ae?.payload?.config,q=(0,U.useMemo)(()=>K===void 0?null:Oe(K),[K]),J=q?.servers??[];(0,U.useEffect)(()=>{q&&ne(q.sessionIdleTtlMinutes)},[q]);let Y=(0,U.useCallback)(async()=>{if(!r){g({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:null});return}g(e=>({...e,loading:!0,error:null}));try{let[e,t,n]=await Promise.all([ze(),Ve(),Be()]);g(r=>({catalog:e,registryCatalog:r.registryCatalog,instances:t,registries:n,loading:!1,error:null}))}catch(e){g({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[r]);(0,U.useEffect)(()=>{Y()},[Y]);let ye=l.toString(),be=(0,U.useRef)(ye);(0,U.useEffect)(()=>{be.current!==ye&&(be.current=ye,M(l.get(Dt)?.trim()||Ot))},[l,ye]);let X=(0,U.useMemo)(()=>h.registries.map(e=>e.id),[h.registries]);(0,U.useEffect)(()=>{if(X.length===0||X.includes(O))return;let e=X.includes(Ot)?Ot:X[0];e&&M(e)},[O,X]),(0,U.useEffect)(()=>{if(!O||O===l.get(Dt))return;let e=new URLSearchParams(l);e.set(Dt,O),be.current=e.toString(),d(e,{replace:!0})},[O,l,d]);let xe=(0,U.useCallback)(async e=>{let t=w.trim(),n=e?.browse??!1,r=Math.max(e?.page??1,1),i=e?.append??!1;if(!(!c||!t&&!n)){v(!0),i?g(e=>({...e,error:null})):(x(1),C(void 0),g(e=>({...e,registryCatalog:[],error:null})));try{let e=await We(t,O,{browse:n,page:r});x(r),C(e.totalPages),g(t=>({...t,registryCatalog:i?[...t.registryCatalog,...e.connectors].filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t):e.connectors}))}catch(e){g(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{v(!1)}}},[c,w,O]);(0,U.useEffect)(()=>{if(p!==`marketplace`)return;let e=window.setTimeout(()=>{w.trim()?xe():O&&xe({browse:!0})},w.trim()?350:0);return()=>window.clearTimeout(e)},[O,w,xe,h.loading,p]);let Ce=(0,U.useMemo)(()=>new Set(h.instances.map(e=>e.connectorId)),[h.instances]),we=(0,U.useMemo)(()=>new Set(h.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[h.instances]),Te=(0,U.useCallback)(async e=>{if(!q||K===void 0)return;let t=J.filter(t=>t.clientKey!==e.clientKey);await Ae({sessionIdleTtlMinutes:q.sessionIdleTtlMinutes,servers:t},Se(K)),await W(),await Y()},[K,J,Y,q,W]),Ee=(0,U.useCallback)(()=>{te({mode:`add`,row:gt(J,we)})},[J,we]),De=(0,U.useCallback)(async()=>{if(!(!q||K===void 0||re)){V(!0),H(!1);try{await Ae({sessionIdleTtlMinutes:B,servers:J},Se(K)),await W(),H(!0),u({type:`success`,title:n.saved})}finally{V(!1)}}},[K,J,q,W,B,re]),ke=b(e=>e.setPageHeader),je=b(e=>e.clearPageHeader),Me=(0,U.useMemo)(()=>(0,G.jsx)(ve,{loading:h.loading||_,searchQuery:w,setSearchQuery:T,onReloadClick:Y,onAddCustomServer:Ee,searchPlaceholder:p===`marketplace`?t.marketplaceSearchPlaceholder:p===`builtin`?t.builtinSearchPlaceholder:p===`user`?t.userSearchPlaceholder:t.configSearchPlaceholder,addLabel:t.addCustomServer,reloadLabel:t.reload}),[t,Y,Ee,_,w,h.loading,p]);(0,U.useLayoutEffect)(()=>(ke({startExtra:null,main:(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:Me}),()=>je()),[je,t.title,Me,ke]);let Ne=h.instances.length+J.length,Pe=(0,U.useMemo)(()=>vt(h.catalog.filter(e=>e.source===`builtin`),w,F),[F,w,h.catalog]),Fe=(0,U.useMemo)(()=>vt(h.registryCatalog,w,F),[F,w,h.registryCatalog]),Ie=p===`marketplace`&&!!(S&&y<S),Le=(0,U.useMemo)(()=>h.instances.filter(e=>yt(e,w)),[w,h.instances]),Z=(0,U.useMemo)(()=>J.filter(e=>bt(e,w)),[J,w]),He=Le.length+Z.length;return(0,G.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[c?null:(0,G.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),(0,G.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.navAria,children:[`marketplace`,`builtin`,`user`,`config`].map(e=>(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===e,className:i(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,p===e?`text-fg after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`:`text-fg-muted hover:text-fg`),onClick:()=>m(e),children:[e===`marketplace`?t.tabMarketplace:e===`builtin`?t.tabBuiltin:e===`user`?t.tabUser:t.tabConfig,e===`builtin`?(0,G.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,Pe.length,`)`]}):null,e===`user`?(0,G.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,Ne,`)`]}):null]},e))}),(0,G.jsxs)(`div`,{className:`flex min-h-9 min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[p===`marketplace`?(0,G.jsx)(`div`,{className:`inline-flex h-9 max-w-full shrink-0 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,role:`group`,"aria-label":t.registrySourceAria,children:h.registries.map(e=>(0,G.jsx)(`button`,{type:`button`,className:i(`shrink-0 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors`,k.focusRingPanel,O===e.id?`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`:`text-fg-muted hover:text-fg`),"aria-pressed":O===e.id,onClick:()=>M(e.id),children:e.displayName},e.id))}):null,p!==`user`&&p!==`config`?(0,G.jsxs)(ce,{children:[(0,G.jsx)(ue,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,className:i(`inline-flex h-9 min-h-9 min-w-[9rem] shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,k.transition,k.focusRingPanel),children:[(0,G.jsx)(D,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:F===`name`?t.sortName:t.sortSource}),(0,G.jsx)(E,{className:`size-3.5 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0})]})}),(0,G.jsx)(de,{children:(0,G.jsxs)(fe,{className:`z-50 min-w-[10rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[(0,G.jsx)(le,{className:`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover data-[highlighted]:bg-surface-hover`,onSelect:()=>I(`name`),children:t.sortName}),(0,G.jsx)(le,{className:`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover data-[highlighted]:bg-surface-hover`,onSelect:()=>I(`source`),children:t.sortSource})]})})]}):null]})]}),h.error?(0,G.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:h.error}):null,p===`user`&&c?(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.installedTitle}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.installedHint})]}),h.loading?(0,G.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:pe.slice(0,3).map(e=>(0,G.jsx)(ge,{},e))}):Ne===0||He===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:Ne===0?t.installedEmpty:t.userEmpty}):(0,G.jsxs)(`div`,{className:`grid gap-3`,children:[Le.map(e=>(0,G.jsx)(ut,{instance:e,onChanged:Y},e.instanceId)),Z.map(e=>(0,G.jsx)(Re,{row:e,t:n,cs:t,onEdit:()=>te({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Te(e)},e.clientKey))]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.disableHint})]}):null,p===`config`&&c?(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,G.jsxs)(se,{children:[(0,G.jsx)(oe,{icon:N,title:n.globalTitle,subtitle:n.globalHint}),(0,G.jsx)(`div`,{className:`max-w-xl`,children:(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.idleTtlLabel}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,min:0,className:i(kt,`w-40 flex-none`),value:B??``,placeholder:n.idleTtlPlaceholder,onChange:e=>{let t=e.target.value.trim();ne(t===``?void 0:Number.parseInt(t,10)),H(!1)}}),(0,G.jsxs)(z,{variant:`secondary`,disabled:re,onClick:()=>void De(),children:[re?(0,G.jsx)(P,{className:`size-4 animate-spin`}):null,n.save]})]}),(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.idleTtlHint})]})})]})}):null,p===`marketplace`&&c?(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:_&&Fe.length===0?(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:pe.map(e=>(0,G.jsx)(he,{},e))}):w.trim()&&Fe.length===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}):!w.trim()&&Fe.length===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.marketplaceStartHint}):(0,G.jsxs)(`div`,{className:`relative`,children:[_?(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":t.loading,children:(0,G.jsx)(P,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:Fe.map(e=>(0,G.jsx)(_e,{connector:e,installed:Ce.has(e.id)||me(e,h.instances),onInstall:e=>L(mt(e))},e.id))}),Ie?(0,G.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,G.jsxs)(z,{type:`button`,variant:`secondary`,disabled:_,onClick:()=>void xe({browse:!w.trim(),page:y+1,append:!0}),children:[_?(0,G.jsx)(P,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})}):null,p===`builtin`&&c?(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.catalogHint}),h.loading?(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:pe.map(e=>(0,G.jsx)(he,{},e))}):Pe.length===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.builtinEmpty}):(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:Pe.map(e=>(0,G.jsx)(_e,{connector:e,installed:Ce.has(e.id)||me(e,h.instances),onInstall:e=>L(mt(e))},e.id))})]}):null]}),ee?(0,G.jsx)(ht,{draft:ee,onChange:L,onClose:()=>L(null),onInstalled:async()=>{await Y(),await W(),m(`user`)}}):null,R?(0,G.jsx)(Et,{open:!0,mode:R.mode,initialRow:R.row,existingCustomServers:J,sessionIdleTtlMinutes:B,config:K,managedServerIds:we,t:n,cs:t,onClose:()=>te(null),onSaved:async()=>{await W(),await Y(),m(`user`)}},`${R.mode}-${R.row.clientKey}`):null]})})}export{At as ConnectorsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t}from"./vendor-react-BOUWij0V.js";var n=e(t(),1),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(0,n.createContext)({}),u=()=>(0,n.useContext)(l),d=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:a,className:o=``,children:l,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=u()??{},y=a??g?Number(i??h)*24/Number(t??m):i??h;return(0,n.createElement)(`svg`,{ref:p,...s,width:t??m??s.width,height:t??m??s.height,stroke:e??_,strokeWidth:y,className:r(`lucide`,v,o),...!l&&!c(f)&&{"aria-hidden":`true`},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])}),f=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(d,{ref:c,iconNode:t,className:r(`lucide-${i(o(e))}`,`lucide-${e}`,a),...s}));return a.displayName=o(e),a};export{f as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./fetch-B7xDPu-R.js";import{Nt as n}from"./index-Cc41r16l.js";import{t as r}from"./format-cron-label-BsotZDO5.js";function i(e,t){let n=e?.trim()||``;return n?n.length<=t?n:`${n.slice(0,t-1)}…`:`—`}function a(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function o(e){return new Date(e).toLocaleString()}function s(e,t){let n=typeof e==`string`?new Date(e):e,r=new Date,i=n.getTime()-r.getTime();if(i<0)return t.overdue;if(i<6e4)return t.lessThanMinute;if(i<36e5){let e=Math.floor(i/6e4);return t.minutes.replace(`{{count}}`,String(e))}if(i<864e5){let e=Math.floor(i/36e5);return t.hours.replace(`{{count}}`,String(e))}return n.toLocaleString()}function c(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime();if(r<0||r<6e4)return t.justNow;if(r<36e5){let e=Math.floor(r/6e4);return t.minutesAgo.replace(`{{count}}`,String(e))}if(r<864e5){let e=Math.floor(r/36e5);return t.hoursAgo.replace(`{{count}}`,String(e))}if(r<6048e5){let e=Math.floor(r/864e5);return t.daysAgo.replace(`{{count}}`,String(e))}return n.toLocaleDateString()}function l(e,t){let n=c(e.lastActive,t);return e.channel===`telegram`&&e.peerId?`${e.accountId??`default`} · ${e.peerKind??``} · ${e.peerId} · ${n}`:`${e.channel}: ${e.chatId} · ${n}`}function u(e,t){if(e.delivery?.channel===`local`)return t;let n=e.delivery?.to??``,r=n.split(`:`);return r.length===3&&(r[1]===`dm`||r[1]===`group`)?`${r[0]} · ${r[1]} · ${r[2]}`:n}function d(e,t){switch(e){case`running`:return t.running;case`success`:return t.success;case`failed`:return t.failed;case`cancelled`:return t.cancelled;default:return e}}function f(e,t){if(!Number.isFinite(e)||e<=0)return`—`;let n=new Intl.RelativeTimeFormat(t,{numeric:`auto`});return e%864e5==0?n.format(e/864e5,`day`).replace(/^in\s+/i,`Every `):e%36e5==0?n.format(e/36e5,`hour`).replace(/^in\s+/i,`Every `):e%6e4==0?n.format(e/6e4,`minute`).replace(/^in\s+/i,`Every `):e%1e3==0?n.format(e/1e3,`second`).replace(/^in\s+/i,`Every `):`${e}ms`}function p(e){return e.kind===`cron`?e.tz?`${e.expr} (${e.tz})`:e.expr:e.kind===`at`?`at ${e.at}`:`every ${e.everyMs}ms${e.anchorMs?` from ${new Date(e.anchorMs).toISOString()}`:``}`}function m(e,t,n){return e.schedule.kind===`at`?new Date(e.schedule.at).toLocaleString(t):e.schedule.kind===`every`?f(e.schedule.everyMs,t):r(e.schedule.expr,t,n,{timezone:e.schedule.tz,nextRun:e.nextRunAtMs?new Date(e.nextRunAtMs).toISOString():void 0})}var h=class extends Error{status;code;runningSessionKey;constructor(e,t){super(e),this.name=`CronApiError`,this.status=t.status,this.code=t.code,this.runningSessionKey=t.runningSessionKey}};function g(e){let t=e.payload;return t.kind===`systemEvent`?t.text:t.kind===`agentTurn`?t.message:t.goal||t.definitionId}function _(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t,r=Array.isArray(n.list)?n.list:[],i=typeof n.default==`string`&&n.default.trim()?n.default.trim():``,a=r.find(e=>e&&typeof e==`object`&&e.id===i)??r.find(e=>e&&typeof e==`object`);if(!a||typeof a!=`object`)return``;let o=a.models;if(!o||typeof o!=`object`||Array.isArray(o))return``;let s=o.defaultRole,c=o.roles;if(typeof s!=`string`||!c||typeof c!=`object`||Array.isArray(c))return``;let l=c[s];if(l&&typeof l==`object`&&!Array.isArray(l)){let e=l.model;return typeof e==`string`?e.trim():``}return``}function v(e){return{kind:`cron`,expr:e.trim()}}function y(e){return{...e,nextRunAtMs:e.state?.nextRunAtMs,model:e.model??(e.payload?.kind===`agentTurn`&&e.payload.model?e.payload.model:void 0)}}async function b(e,n){let r=await t(e,n),i=await r.json().catch(()=>({}));if(!r.ok)throw new h(typeof i.error==`string`?i.error:`HTTP ${r.status}`,{status:r.status,code:i.code,runningSessionKey:i.runningSessionKey});return i}async function x(){return((await b(e(`/api/cron`))).jobs||[]).map(y)}async function S(n){let r=await t(e(`/api/cron/${encodeURIComponent(n)}`));if(r.status===404)return null;let i=await r.json().catch(()=>({}));if(!r.ok)throw Error(typeof i.error==`string`?i.error:`HTTP ${r.status}`);return i.job?y(i.job):null}async function C(t,n){return b(e(`/api/cron`),{method:`POST`,body:JSON.stringify({schedule:t,...n})})}async function w(t,n){return(await b(e(`/api/cron/${encodeURIComponent(t)}`),{method:`PATCH`,body:JSON.stringify(n)})).updated}async function T(t){return(await b(e(`/api/cron/${encodeURIComponent(t)}`),{method:`DELETE`})).removed}async function E(t,n){return(await b(e(`/api/cron/${encodeURIComponent(t)}/toggle`),{method:`POST`,body:JSON.stringify({enabled:n})})).toggled}async function D(t){return await b(e(`/api/cron/${encodeURIComponent(t)}/run`),{method:`POST`})}async function O(t,n=10){return(await b(e(`/api/cron/${encodeURIComponent(t)}/history?limit=${n}`))).history||[]}async function k(t=40){return(await b(e(`/api/cron/runs/history?limit=${t}`))).runs||[]}async function A(){return(await b(e(`/api/channels/status`))).payload?.channels||[]}async function j(){return(await n()).map(e=>({id:e.id,name:e.name,provider:e.provider}))}async function M(){let t=(await b(e(`/api/config`))).payload?.config;return{model:_(t)}}async function N(t){return(await b(e(`/api/sessions/chat-ids${t?`?channel=${encodeURIComponent(t)}`:``}`))).payload?.chatIds||[]}export{o as C,m as S,i as T,d as _,k as a,s as b,O as c,N as d,x as f,w as g,E as h,g as i,S as l,D as m,C as n,A as o,T as p,v as r,M as s,h as t,j as u,u as v,p as w,l as x,a as y};
@@ -1 +0,0 @@
1
- var e=new Set([`__xopc_memory_dreaming_light_sweep__`,`__xopc_memory_dreaming_sweep__`,`__xopc_memory_dreaming_rem_sweep__`]);function t(t){let n=t.payload;if(n?.kind!==`agentTurn`)return!1;let r=n.message;return typeof r==`string`&&e.has(r)}export{t};
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-B1iSKjiw.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{i as s}from"./theme-store-CD2wtgZV.js";import{c,i as l,n as u,t as d}from"./fetch-B7xDPu-R.js";import{r as f}from"./toast-z0toXu32.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{$i as m,$o as h,$r as g,A as _,Ci as v,Cs as y,Di as b,Ds as x,Ea as S,Ei as C,Eo as w,Es as T,Fa as E,Fi as D,Gs as O,Ho as k,Jr as A,K as j,Ki as M,Mo as N,Ni as P,Oa as F,Oi as I,Qa as L,Qi as R,Ra as z,Si as B,Ti as V,Ts as H,Wa as U,Xa as W,Xi as G,Xo as K,Xr as q,Xs as ee,Yr as te,_o as ne,at as J,ea as re,ei as ie,et as ae,fo as oe,ha as se,ia as ce,it as le,k as ue,l as de,ls as fe,mr as pe,na as Y,ot as me,qr as he,rs as ge,rt as _e,sn as ve,ta as ye,w as be,wi as xe,xi as Se,xr as Ce}from"./index-Cc41r16l.js";import{t as X}from"./markdown-editor-AssmZFx4.js";import{t as we}from"./settings-advanced-gate-5re5gAnP.js";import{n as Te,t as Ee}from"./settings-form-section-dmyaPOTG.js";import{C as De,S as Oe,T as ke,_ as Ae,a as je,b as Me,c as Ne,d as Pe,f as Fe,g as Ie,h as Le,i as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,s as Ge,t as Ke,u as qe,v as Je,w as Ye,x as Xe,y as Ze}from"./cron-api-qGwmL-24.js";import{t as Qe}from"./cron-dreaming-jobs-nCMWCf0p.js";import{r as $e}from"./interval-presets-DFPCKW_W.js";import{t as et}from"./format-interval-label-BzxafKxR.js";import{t as tt}from"./heartbeat-config-api-DriO_CN9.js";import{i as nt,n as rt,o as it,r as at,t as ot}from"./dist-By6Rh2ee.js";var Z=e(t(),1),Q=n(),$=r();function st(e){let t=(0,Q.c)(25),{open:n,onOpenChange:r,action:i,c:a,onDismiss:o,onConfirm:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(V,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),t[0]=c):c=t[0];let l=i===`delete`?a.delete:a.runNow,u;t[1]===l?u=t[2]:(u=(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:l}),t[1]=l,t[2]=u);let d=i===`delete`?a.confirmDelete:a.confirmRun,f;t[3]===d?f=t[4]:(f=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[3]=d,t[4]=f);let p;t[5]!==a.cancel||t[6]!==o?(p=(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:o,children:a.cancel}),t[5]=a.cancel,t[6]=o,t[7]=p):p=t[7];let m=i===`delete`?`bg-red-600 hover:bg-red-700`:void 0,h;t[8]===s?h=t[9]:(h=()=>void s(),t[8]=s,t[9]=h);let g=i===`delete`?a.delete:a.runNow,_;t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,$.jsx)(Y,{type:`button`,variant:`primary`,className:m,onClick:h,children:g}),t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let y;t[14]!==_||t[15]!==p?(y=(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[p,_]}),t[14]=_,t[15]=p,t[16]=y):y=t[16];let x;t[17]!==y||t[18]!==u||t[19]!==f?(x=(0,$.jsxs)(C,{children:[c,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(v,{className:`xopc-dialog-content-pane pointer-events-auto relative w-full max-w-md rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[u,f,y]})})]}),t[17]=y,t[18]=u,t[19]=f,t[20]=x):x=t[20];let S;return t[21]!==r||t[22]!==n||t[23]!==x?(S=(0,$.jsx)(b,{open:n,onOpenChange:r,children:x}),t[21]=r,t[22]=n,t[23]=x,t[24]=S):S=t[24],S}var ct={enabled:!0,maxConcurrentJobs:5,historyRetentionDays:7,enableMetrics:!0};function lt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ut(e){let t=lt(e)?e:{},n=lt(t.cron)?t.cron:{};return{enabled:n.enabled!==!1,maxConcurrentJobs:typeof n.maxConcurrentJobs==`number`&&Number.isFinite(n.maxConcurrentJobs)?Math.max(1,Math.min(100,Math.floor(n.maxConcurrentJobs))):ct.maxConcurrentJobs,historyRetentionDays:typeof n.historyRetentionDays==`number`&&Number.isFinite(n.historyRetentionDays)?Math.max(1,Math.min(365,Math.floor(n.historyRetentionDays))):ct.historyRetentionDays,enableMetrics:n.enableMetrics!==!1}}async function dt(e){await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({cron:e})}),te()}function ft(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,ye,`dark:border-edge`)}function pt(){return{form:null,baseline:null,saving:!1,error:null,saveOk:!1,dirty:!1}}function mt(e,t){switch(t.type){case`sync`:return{...e,form:structuredClone(t.parsed),baseline:structuredClone(t.parsed),saveOk:!1,dirty:!1};case`patch`:return e.form?{...e,form:{...e.form,...t.patch},dirty:!0,saveOk:!1}:e;case`discard`:return e.baseline?{...e,form:structuredClone(e.baseline),dirty:!1}:e;case`saveStart`:return{...e,saving:!0,error:null};case`saveSuccess`:return e.form?{...e,saving:!1,baseline:structuredClone(e.form),dirty:!1,saveOk:!0}:{...e,saving:!1};case`saveError`:return{...e,saving:!1,error:t.error};case`clearSaveOk`:return{...e,saveOk:!1}}}function ht({hasToken:e}){let t=a(o(e=>e.language)).cron.globals,{data:n,isLoading:r}=q(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ut(n.payload.config)),[n]),[s,c]=(0,Z.useReducer)(mt,void 0,pt),l=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{!e||i===null||s.dirty||l.current===i||(l.current=i,c({type:`sync`,parsed:i}))},[e,i,s.dirty]);let u=(0,Z.useMemo)(()=>!!(s.form&&s.baseline&&JSON.stringify(s.form)!==JSON.stringify(s.baseline)),[s.form,s.baseline]),d=(0,Z.useCallback)(e=>{c({type:`patch`,patch:e})},[]),p=(0,Z.useCallback)(async()=>{if(!(!s.form||s.saving)){c({type:`saveStart`});try{await dt(s.form),c({type:`saveSuccess`}),f({type:`success`,title:t.saved})}catch(e){c({type:`saveError`,error:e instanceof Error?e.message:t.saveError})}}},[t.saveError,s.form,s.saving]);return!e||!s.form?r?(0,$.jsx)(Ee,{children:(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ne,{className:`size-4 animate-spin`}),t.loading]})}):null:(0,$.jsxs)(Ee,{children:[(0,$.jsx)(Te,{icon:fe,title:t.title,subtitle:t.hint}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`secondary`,disabled:!u||s.saving,onClick:()=>c({type:`discard`}),children:t.discard}),(0,$.jsx)(Y,{type:`button`,variant:`primary`,disabled:!u||s.saving,onClick:()=>void p(),children:s.saving?t.saving:t.save})]}),s.error?(0,$.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:s.error}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg sm:col-span-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:s.form.enabled,onChange:e=>d({enabled:e.target.checked})}),t.enabled]}),(0,$.jsxs)(we,{children:[(0,$.jsx)(gt,{label:t.maxConcurrent,value:s.form.maxConcurrentJobs,min:1,max:100,disabled:!s.form.enabled,onChange:e=>d({maxConcurrentJobs:e})}),(0,$.jsx)(gt,{label:t.retentionDays,value:s.form.historyRetentionDays,min:1,max:365,disabled:!s.form.enabled,onChange:e=>d({historyRetentionDays:e})}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:s.form.enableMetrics,disabled:!s.form.enabled,onChange:e=>d({enableMetrics:e.target.checked})}),t.metrics]})]})]})]})}function gt(e){let t=(0,Q.c)(13),{label:n,value:r,min:a,max:o,disabled:s,text:c,onChange:l,onTextChange:u}=e,d;t[0]===n?d=t[1]:(d=(0,$.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=d);let f;t[2]!==s||t[3]!==o||t[4]!==a||t[5]!==l||t[6]!==u||t[7]!==c||t[8]!==r?(f=c?(0,$.jsx)(`input`,{className:i(ft(),`font-mono text-xs`),value:String(r),disabled:s,onChange:e=>u?.(e.target.value)}):(0,$.jsx)(`input`,{type:`number`,min:a,max:o,disabled:s,className:i(ft(),`max-w-xs font-mono text-xs`),value:typeof r==`number`?r:0,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&l&&a!==void 0&&o!==void 0&&l(Math.max(a,Math.min(o,Math.floor(t))))}}),t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=u,t[7]=c,t[8]=r,t[9]=f):f=t[9];let p;return t[10]!==d||t[11]!==f?(p=(0,$.jsxs)(`div`,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}var _t=`*/5 * * * *`;function vt(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function yt(e){let t=vt(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function bt(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function xt(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function St(e){let t=e?.trim();t&&(window.location.hash=`/workflows?run=${encodeURIComponent(t)}`)}function Ct(e){return i(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,R,e&&`cursor-not-allowed opacity-60`)}function wt(){return i(re,m)}var Tt=i(re,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),Et=i(re,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function Dt(e){return e===`settings`?`settings`:e===`system`||e===`systemTasks`?`systemTasks`:e===`history`?`history`:`myTasks`}function Ot(e){return e===`myTasks`?null:e===`systemTasks`?`system`:e===`history`?`history`:`settings`}var kt=34,At=62,jt=46;function Mt(e){return Math.max(kt,Math.min(At,e))}function Nt(e){switch(e){case`success`:return`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`;case`failed`:return`bg-red-500/15 text-red-800 dark:text-red-300`;case`running`:return`bg-accent/15 text-accent`;case`cancelled`:return`bg-surface-hover text-fg-muted`;default:return`bg-surface-hover text-fg-muted`}}function Pt(e,t){return e.payload.kind===`workflowRun`?t.taskKindWorkflowRun:e.payload.kind===`agentTurn`?t.taskKindMessage:t.modeDirectOption}function Ft(e){return e.length===0?null:e.find(e=>e.status===`failed`)?.id??e[0]?.id??null}function It(e){let t=(0,Q.c)(56),{row:n,expanded:r,onToggle:a,c:o,statusLabels:s}=e,c=n.error||n.summary||n.output||``,l;t[0]===c?l=t[1]:(l=c.trim(),t[0]=c,t[1]=l);let u=l,d=u.length>0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover`,children:(0,$.jsx)(fe,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0})}),t[2]=f):f=t[2];let p=n.startedAt,m;t[3]===n.startedAt?m=t[4]:(m=De(n.startedAt),t[3]=n.startedAt,t[4]=m);let h;t[5]!==n.startedAt||t[6]!==m?(h=(0,$.jsx)(`time`,{className:`text-sm font-medium text-fg`,dateTime:p,children:m}),t[5]=n.startedAt,t[6]=m,t[7]=h):h=t[7];let g;t[8]===n.status?g=t[9]:(g=i(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,Nt(n.status)),t[8]=n.status,t[9]=g);let _;t[10]!==n.status||t[11]!==s?(_=Ae(n.status,s),t[10]=n.status,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,$.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]===n.duration?y=t[17]:(y=Ze(n.duration),t[16]=n.duration,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:y}),t[18]=y,t[19]=b);let x;t[20]!==b||t[21]!==h||t[22]!==v?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[h,v,b]}),t[20]=b,t[21]=h,t[22]=v,t[23]=x):x=t[23];let S;t[24]!==u||t[25]!==r||t[26]!==d?(S=!r&&d?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:u}):null,t[24]=u,t[25]=r,t[26]=d,t[27]=S):S=t[27];let C;t[28]!==u||t[29]!==r||t[30]!==d?(C=r&&d?(0,$.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-edge-subtle bg-surface-panel/80 p-2.5 font-mono text-xs leading-relaxed text-fg-muted`,children:u}):null,t[28]=u,t[29]=r,t[30]=d,t[31]=C):C=t[31];let w;t[32]!==x||t[33]!==S||t[34]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[f,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S,C]})]}),t[32]=x,t[33]=S,t[34]=C,t[35]=w):w=t[35];let T;t[36]!==o||t[37]!==r||t[38]!==d||t[39]!==a?(T=d?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:a,children:[(0,$.jsx)(H,{className:i(`size-3.5 transition-transform`,r&&`rotate-180`),strokeWidth:1.75,"aria-hidden":!0}),r?o.detailCollapseRun:o.detailExpandRun]}):null,t[36]=o,t[37]=r,t[38]=d,t[39]=a,t[40]=T):T=t[40];let E;t[41]!==o||t[42]!==n.workflowRunId?(E=n.workflowRunId?.trim()?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:o.openWorkflowTitle,onClick:()=>St(n.workflowRunId),children:[(0,$.jsx)(k,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),o.openWorkflow]}):null,t[41]=o,t[42]=n.workflowRunId,t[43]=E):E=t[43];let D;t[44]!==o||t[45]!==n.sessionKey?(D=n.sessionKey?.trim()?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:o.openChatTitle,onClick:()=>xt(n.sessionKey),children:[(0,$.jsx)(oe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),o.openChat]}):null,t[44]=o,t[45]=n.sessionKey,t[46]=D):D=t[46];let O;t[47]!==E||t[48]!==D?(O=(0,$.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[E,D]}),t[47]=E,t[48]=D,t[49]=O):O=t[49];let A;t[50]!==T||t[51]!==O?(A=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle px-3 py-2 dark:border-edge-subtle`,children:[T,O]}),t[50]=T,t[51]=O,t[52]=A):A=t[52];let j;return t[53]!==w||t[54]!==A?(j=(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:[w,A]}),t[53]=w,t[54]=A,t[55]=j):j=t[55],j}function Lt(e){let t=(0,Q.c)(13),{icon:n,label:r,value:a,valueClassName:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=n,t[1]=s);let c;t[2]!==r||t[3]!==s?(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[s,r]}),t[2]=r,t[3]=s,t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=i(`mt-1 truncate text-sm font-medium text-fg`,o),t[5]=o,t[6]=l);let u;t[7]!==l||t[8]!==a?(u=(0,$.jsx)(`p`,{className:l,children:a}),t[7]=l,t[8]=a,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-2.5 dark:border-edge-subtle`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function Rt({open:e,onDismiss:t,detailJob:n,detailLoading:r,actionNotice:a,detailHistory:o,c:s,localeTag:c,scheduleBadgeLabels:l,chatWorkingDirNotSet:u,statusLabels:d,onEdit:f,onRunNow:p,onToggle:m,onDelete:h}){let[g,_]=(0,Z.useState)(null),[y,S]=(0,Z.useState)(!1),[w,D]=(0,Z.useState)(jt),[O,k]=(0,Z.useState)(!1),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>{let e=0,t=0;for(let n of o)n.status===`success`&&(e+=1),n.status===`failed`&&(t+=1);return{success:e,failed:t}},[o]),N=o[0]??null;(0,Z.useEffect)(()=>{if(!e){_(null),S(!1);return}_(Ft(o))},[e,n?.id,o]);let P=(0,Z.useCallback)(async()=>{n?.schedule&&await M(Ye(n.schedule))&&(S(!0),window.setTimeout(()=>S(!1),1500))},[n?.schedule]),F=n?Oe(n,c,l):`—`,R=(0,Z.useCallback)(e=>{e.preventDefault();let t=A.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.currentTarget,i=e.pointerId;r.setPointerCapture(i),k(!0);let a=e=>{D(Mt((e-n.left)/n.width*100))};a(e.clientX);let o=e=>{a(e.clientX)},s=()=>{try{r.releasePointerCapture(i)}catch{}k(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},[]),z=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),D(e=>Mt(e-4))):e.key===`ArrowRight`?(e.preventDefault(),D(e=>Mt(e+4))):e.key===`Home`?(e.preventDefault(),D(kt)):e.key===`End`&&(e.preventDefault(),D(At))},[]);return(0,$.jsx)(b,{open:e,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(C,{children:[(0,$.jsx)(V,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(v,{className:i(`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(86vh,46rem)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,`dark:border-edge`),"aria-describedby":void 0,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(I,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n?.name?.trim()||n?.id||`—`}),n?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:F}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[n?(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n.enabled,"aria-label":n.enabled?s.enabled:s.disabled,className:i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,n.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`),onClick:()=>m(n,!n.enabled),children:(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}):null,(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:(0,$.jsx)(ce,{className:`size-5`,strokeWidth:1.75})})})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 lg:overflow-hidden`,children:r?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(ne,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):n?(0,$.jsxs)(`div`,{className:`flex min-h-full flex-col gap-4 lg:h-full lg:min-h-0`,children:[a?(0,$.jsx)(`div`,{className:i(`rounded-xl border px-3 py-2 text-sm`,a.kind===`error`?`border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`:`border-accent/25 bg-accent/5 text-fg dark:border-accent/30 dark:bg-accent/10`),role:`alert`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{children:a.message}),a.sessionKey?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 gap-1.5 px-2.5 text-xs`,onClick:()=>xt(a.sessionKey),children:[(0,$.jsx)(oe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),s.openChat]}):null]})}):null,(0,$.jsxs)(`div`,{ref:A,className:`grid min-h-0 grid-cols-1 gap-4 lg:flex-1 lg:[grid-template-columns:minmax(0,var(--cron-detail-config-pane))_0.75rem_minmax(23rem,1fr)] lg:gap-0`,style:{"--cron-detail-config-pane":`${w}%`},children:[(0,$.jsx)(`div`,{className:`rounded-2xl border border-edge bg-surface-base/35 p-4 lg:min-h-0 lg:overflow-y-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.scheduleLabel}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-3 dark:border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-sm font-medium leading-relaxed text-fg`,children:F}),(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`size-8 shrink-0 p-0`,title:s.detailCopySchedule,"aria-label":s.detailCopySchedule,onClick:()=>void P(),children:y?(0,$.jsx)(T,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75}):(0,$.jsx)(ge,{className:`size-3.5`,strokeWidth:1.75})})]}),(0,$.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-subtle`,children:[s.detailCronTechnical,`: `]}),(0,$.jsx)(`code`,{className:`font-mono`,children:Ye(n.schedule)})]})]})]}),(0,$.jsxs)(`section`,{"aria-label":s.statsRegion,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Lt,{icon:x,label:s.nextRun,value:n.nextRunAtMs?Me(new Date(n.nextRunAtMs).toISOString(),s.timeLabels):`—`}),(0,$.jsx)(Lt,{icon:fe,label:s.detailLastRun,value:N?Ae(N.status,d):s.detailNoRecentRuns,valueClassName:N?.status===`failed`?`text-red-700 dark:text-red-300`:N?.status===`success`?`text-emerald-800 dark:text-emerald-300`:void 0})]}),o.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:s.detailRunCount.replace(`{{success}}`,String(j.success)).replace(`{{failed}}`,String(j.failed))}):null]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailWhatItDoes}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base/80 p-3 dark:border-edge-subtle`,children:[(0,$.jsx)(`div`,{className:`mb-2 inline-flex rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:Pt(n,s)}),(0,$.jsx)(`div`,{className:`min-w-0 break-words text-fg [&_.markdown-body]:text-sm [&_.markdown-body]:leading-relaxed`,children:(0,$.jsx)(pe,{content:Re(n),compact:!0,className:`text-sm`})})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(E,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailRunSettings})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:s.detailRunSettingsHint}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-3 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-3 text-sm dark:border-edge-subtle`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.mode}),(0,$.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.sessionTarget===`isolated`?s.modeAgentOption:s.modeDirectOption})]}),n.sessionTarget===`isolated`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.agentProfile}),(0,$.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.agentId?.trim()?n.agentId.trim():s.agentProfileDefault})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.workingDirectoryLabel}),(0,$.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:n.workingDirectory?.trim()?n.workingDirectory.trim():u})]})]}):null,n.delivery?.channel===`local`||n.sessionTarget===`isolated`&&!n.delivery?.to?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.deliveryTarget}),(0,$.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.delivery?.channel===`local`?s.deliveryTargetLocalChannel:s.deliveryLocalOnly})]}):n.delivery?.to?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.deliveryTarget}),(0,$.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,$.jsx)(`code`,{className:`text-xs`,children:n.delivery?.channel??``}),` → `,Je(n,s.channelLocal)]})]}):null,n.model?.trim()?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.model}),(0,$.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.model.trim()})]}):null]})]})]})}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":s.detailResizeColumns,"aria-valuemin":kt,"aria-valuemax":At,"aria-valuenow":Math.round(w),tabIndex:0,onPointerDown:R,onKeyDown:z,className:i(`group hidden h-full cursor-col-resize touch-none select-none items-stretch justify-center rounded-lg outline-none lg:flex`,`focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),children:(0,$.jsx)(`span`,{className:i(`h-full w-px bg-edge-subtle transition-colors duration-150`,`group-hover:bg-edge`,O&&`bg-edge`)})}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base/35 p-4 lg:min-h-0 lg:overflow-y-auto`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailRunHistory}),o.length>0?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:o.length}):null]}),o.length===0?(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-dashed border-edge-subtle px-4 py-8 text-center dark:border-edge-subtle`,children:[(0,$.jsx)(fe,{className:`mx-auto size-8 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:s.noRunsYet})]}):(0,$.jsx)(`ul`,{className:`mt-2 space-y-2`,children:o.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(It,{row:e,expanded:g===e.id,onToggle:()=>_(t=>t===e.id?null:e.id),c:s,statusLabels:d})},e.id))})]})]})]}):null}),n&&!r?(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,className:`gap-1.5`,onClick:()=>p(n),children:[(0,$.jsx)(L,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),s.runNow]}),(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>f(n),children:s.edit}),(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`ml-auto text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:()=>h(n),children:[(0,$.jsx)(se,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),s.delete]})]})}):null]})})]})})}function zt(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function Bt(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function Vt(e,t={}){let n=zt(e.split(`
2
- `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
- `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(Bt(n));return null}async function Ht(e,t={}){let n=await d(l(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=Vt(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=Vt(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function Ut(){let[e,t]=(0,Z.useState)(``),[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,Z.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await Ht(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,Z.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var Wt=5;function Gt(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function Kt(e){let t=(0,Q.c)(228),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:c,intent:l,locale:u,context:d,disabled:f,className:p,showLabel:m}=e,h=s===void 0?`generic.text`:s,g=c===void 0?`plain`:c,_=l===void 0?`improve`:l,y=m===void 0?!0:m,[x,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(n),[D,O]=(0,Z.useState)(`preview`),[k,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(`edit`),[N,P]=(0,Z.useState)(!0),L=(0,Z.useRef)(null),R=(0,Z.useRef)(!0),{suggestion:z,thinking:W,loading:G,error:q,generate:ee,reset:te}=Ut(),ne;t[0]===u?ne=t[1]:(ne=Gt(u),t[0]=u,t[1]=ne);let J=ne,re;t[2]!==G||t[3]!==W?(re=G&&W.trim().length>0,t[2]=G,t[3]=W,t[4]=re):re=t[4];let ie=re,ae,oe;t[5]!==x||t[6]!==n?(ae=()=>{x||E(n)},oe=[x,n],t[5]=x,t[6]=n,t[7]=ae,t[8]=oe):(ae=t[7],oe=t[8]),(0,Z.useEffect)(ae,oe);let se,le;t[9]===z?(se=t[10],le=t[11]):(le=()=>{A(z)},se=[z],t[9]=z,t[10]=se,t[11]=le),(0,Z.useEffect)(le,se);let ue,de;t[12]===W?(ue=t[13],de=t[14]):(ue=()=>{W.trim()&&P(!0)},de=[W],t[12]=W,t[13]=ue,t[14]=de),(0,Z.useEffect)(ue,de);let fe;t[15]!==ie||t[16]!==N?(fe=()=>{let e=L.current;!e||!ie||!N||R.current&&(e.scrollTop=e.scrollHeight)},t[15]=ie,t[16]=N,t[17]=fe):fe=t[17];let me;t[18]!==ie||t[19]!==W||t[20]!==N?(me=[ie,W,N],t[18]=ie,t[19]=W,t[20]=N,t[21]=me):me=t[21],(0,Z.useLayoutEffect)(fe,me);let he;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=L.current;e&&(R.current=e.scrollHeight-e.scrollTop-e.clientHeight<=Wt)},t[22]=he):he=t[22];let ge=he,_e;t[23]!==d||t[24]!==a||t[25]!==o||t[26]!==g||t[27]!==ee||t[28]!==_||t[29]!==u||t[30]!==h?(_e=async e=>{M(`edit`),P(!0),R.current=!0,await ee({intent:_,scenario:h,input:e,locale:u,field:{id:a,label:o,format:g},context:d})},t[23]=d,t[24]=a,t[25]=o,t[26]=g,t[27]=ee,t[28]=_,t[29]=u,t[30]=h,t[31]=_e):_e=t[31];let ve=_e,ye;t[32]!==ve||t[33]!==n?(ye=async()=>{E(n),O(`preview`),w(!0),await ve(n)},t[32]=ve,t[33]=n,t[34]=ye):ye=t[34];let be=ye,xe;t[35]!==T||t[36]!==ve?(xe=async()=>{await ve(T)},t[35]=T,t[36]=ve,t[37]=xe):xe=t[37];let Se=xe,Ce;t[38]!==te||t[39]!==n?(Ce=()=>{w(!1),E(n),O(`preview`),A(``),M(`edit`),P(!0),te()},t[38]=te,t[39]=n,t[40]=Ce):Ce=t[40];let X=Ce,we;t[41]!==X||t[42]!==T||t[43]!==r?(we=()=>{r(T),X()},t[41]=X,t[42]=T,t[43]=r,t[44]=we):we=t[44];let Te=we,Ee;t[45]!==X||t[46]!==k||t[47]!==r?(Ee=()=>{k.trim()&&(r(k),X())},t[45]=X,t[46]=k,t[47]=r,t[48]=Ee):Ee=t[48];let De=Ee,Oe;t[49]!==X||t[50]!==T||t[51]!==k||t[52]!==r?(Oe=()=>{if(!k.trim())return;let e=T.trimEnd();r(e?`${e}\n\n${k}`:k),X()},t[49]=X,t[50]=T,t[51]=k,t[52]=r,t[53]=Oe):Oe=t[53];let ke=Oe,Ae;t[54]!==k||t[55]!==q||t[56]!==G?(Ae=!G&&!q&&k.trim().length>0,t[54]=k,t[55]=q,t[56]=G,t[57]=Ae):Ae=t[57];let je=Ae,Me=T!==n,Ne=!y&&`size-7 p-0`,Pe;t[58]!==p||t[59]!==Ne?(Pe=i(`h-7 gap-1 px-2 text-xs`,Ne,p),t[58]=p,t[59]=Ne,t[60]=Pe):Pe=t[60];let Fe=f||G,Ie;t[61]===be?Ie=t[62]:(Ie=()=>void be(),t[61]=be,t[62]=Ie);let Le;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,$.jsx)(F,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[63]=Le):Le=t[63];let Re=y?J.buttonTitle:null,ze;t[64]!==J.buttonTitle||t[65]!==Pe||t[66]!==Fe||t[67]!==Ie||t[68]!==Re?(ze=(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:Pe,title:J.buttonTitle,"aria-label":J.buttonTitle,disabled:Fe,onClick:Ie,children:[Le,Re]}),t[64]=J.buttonTitle,t[65]=Pe,t[66]=Fe,t[67]=Ie,t[68]=Re,t[69]=ze):ze=t[69];let Be;t[70]===X?Be=t[71]:(Be=e=>e?w(!0):X(),t[70]=X,t[71]=Be);let Ve;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,$.jsx)(V,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[72]=Ve):Ve=t[72];let He;t[73]===J.title?He=t[74]:(He=(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:J.title}),t[73]=J.title,t[74]=He);let Ue;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,$.jsx)(ce,{className:`size-5`,strokeWidth:1.75}),t[75]=Ue):Ue=t[75];let We;t[76]===J.close?We=t[77]:(We=(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":J.close,children:Ue})}),t[76]=J.close,t[77]=We);let Ge;t[78]!==He||t[79]!==We?(Ge=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[He,We]}),t[78]=He,t[79]=We,t[80]=Ge):Ge=t[80];let Ke;t[81]===J.current?Ke=t[82]:(Ke=(0,$.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:J.current}),t[81]=J.current,t[82]=Ke);let qe=D===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,Je;t[83]===qe?Je=t[84]:(Je=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,qe),t[83]=qe,t[84]=Je);let Ye,Xe;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=()=>O(`edit`),Xe=(0,$.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[85]=Ye,t[86]=Xe):(Ye=t[85],Xe=t[86]);let Ze;t[87]!==J.edit||t[88]!==Je?(Ze=(0,$.jsxs)(`button`,{type:`button`,className:Je,onClick:Ye,children:[Xe,J.edit]}),t[87]=J.edit,t[88]=Je,t[89]=Ze):Ze=t[89];let Qe=D===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,$e;t[90]===Qe?$e=t[91]:($e=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Qe),t[90]=Qe,t[91]=$e);let et,tt;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>O(`preview`),tt=(0,$.jsx)(K,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[92]=et,t[93]=tt):(et=t[92],tt=t[93]);let nt;t[94]!==J.preview||t[95]!==$e?(nt=(0,$.jsxs)(`button`,{type:`button`,className:$e,onClick:et,children:[tt,J.preview]}),t[94]=J.preview,t[95]=$e,t[96]=nt):nt=t[96];let rt;t[97]!==Ze||t[98]!==nt?(rt=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Ze,nt]}),t[97]=Ze,t[98]=nt,t[99]=rt):rt=t[99];let it;t[100]!==Ke||t[101]!==rt?(it=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[Ke,rt]}),t[100]=Ke,t[101]=rt,t[102]=it):it=t[102];let at;t[103]!==T||t[104]!==D||t[105]!==g||t[106]!==J.current||t[107]!==J.empty?(at=D===`preview`?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:g===`markdown`?(0,$.jsx)(pe,{content:T||J.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:T||J.empty})}):(0,$.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:T,onChange:e=>E(e.currentTarget.value),placeholder:J.empty,"aria-label":J.current}),t[103]=T,t[104]=D,t[105]=g,t[106]=J.current,t[107]=J.empty,t[108]=at):at=t[108];let ot;t[109]!==it||t[110]!==at?(ot=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[it,at]}),t[109]=it,t[110]=at,t[111]=ot):ot=t[111];let st;t[112]===J.editedSuggestion?st=t[113]:(st=(0,$.jsx)(`span`,{children:J.editedSuggestion}),t[112]=J.editedSuggestion,t[113]=st);let ct;t[114]!==J.loading||t[115]!==G?(ct=G?(0,$.jsx)(`span`,{className:`ml-2 font-normal`,children:J.loading}):null,t[114]=J.loading,t[115]=G,t[116]=ct):ct=t[116];let lt;t[117]!==st||t[118]!==ct?(lt=(0,$.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[st,ct]}),t[117]=st,t[118]=ct,t[119]=lt):lt=t[119];let ut=j===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,dt;t[120]===ut?dt=t[121]:(dt=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ut),t[120]=ut,t[121]=dt);let ft,pt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(ft=()=>M(`edit`),pt=(0,$.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[122]=ft,t[123]=pt):(ft=t[122],pt=t[123]);let mt;t[124]!==J.edit||t[125]!==dt?(mt=(0,$.jsxs)(`button`,{type:`button`,className:dt,onClick:ft,children:[pt,J.edit]}),t[124]=J.edit,t[125]=dt,t[126]=mt):mt=t[126];let ht=j===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,gt;t[127]===ht?gt=t[128]:(gt=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ht),t[127]=ht,t[128]=gt);let _t,vt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(_t=()=>M(`preview`),vt=(0,$.jsx)(K,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[129]=_t,t[130]=vt):(_t=t[129],vt=t[130]);let yt;t[131]!==J.preview||t[132]!==gt?(yt=(0,$.jsxs)(`button`,{type:`button`,className:gt,onClick:_t,children:[vt,J.preview]}),t[131]=J.preview,t[132]=gt,t[133]=yt):yt=t[133];let bt;t[134]!==mt||t[135]!==yt?(bt=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[mt,yt]}),t[134]=mt,t[135]=yt,t[136]=bt):bt=t[136];let xt;t[137]!==lt||t[138]!==bt?(xt=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[lt,bt]}),t[137]=lt,t[138]=bt,t[139]=xt):xt=t[139];let St=ie?`opacity-100`:`pointer-events-none opacity-0`,Ct;t[140]===St?Ct=t[141]:(Ct=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,St),t[140]=St,t[141]=Ct);let wt=!ie,Tt;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>P(qt),t[142]=Tt):Tt=t[142];let Et;t[143]!==J.thinkingLoading||t[144]!==G?(Et=G?(0,$.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,J.thinkingLoading]}):null,t[143]=J.thinkingLoading,t[144]=G,t[145]=Et):Et=t[145];let Dt;t[146]!==J.thinking||t[147]!==Et?(Dt=(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J.thinking,Et]}),t[146]=J.thinking,t[147]=Et,t[148]=Dt):Dt=t[148];let Ot=N&&`rotate-180`,kt;t[149]===Ot?kt=t[150]:(kt=i(`size-3.5 shrink-0 transition-transform`,Ot),t[149]=Ot,t[150]=kt);let At;t[151]===kt?At=t[152]:(At=(0,$.jsx)(H,{className:kt,strokeWidth:1.75,"aria-hidden":!0}),t[151]=kt,t[152]=At);let jt;t[153]!==Dt||t[154]!==At?(jt=(0,$.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Tt,children:[Dt,At]}),t[153]=Dt,t[154]=At,t[155]=jt):jt=t[155];let Mt;t[156]!==W||t[157]!==N?(Mt=N?(0,$.jsx)(`pre`,{ref:L,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:ge,children:W}):null,t[156]=W,t[157]=N,t[158]=Mt):Mt=t[158];let Nt;t[159]!==jt||t[160]!==Mt?(Nt=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[jt,Mt]}),t[159]=jt,t[160]=Mt,t[161]=Nt):Nt=t[161];let Pt;t[162]!==Ct||t[163]!==wt||t[164]!==Nt?(Pt=(0,$.jsx)(`div`,{className:Ct,"aria-hidden":wt,children:Nt}),t[162]=Ct,t[163]=wt,t[164]=Nt,t[165]=Pt):Pt=t[165];let Ft=ie?`pointer-events-none opacity-0`:`opacity-100`,It;t[166]===Ft?It=t[167]:(It=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[166]=Ft,t[167]=It);let Lt;t[168]!==k||t[169]!==q||t[170]!==g||t[171]!==J.empty||t[172]!==J.loading||t[173]!==J.suggestion||t[174]!==G||t[175]!==j?(Lt=q?(0,$.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:q}):j===`preview`?(0,$.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:G&&!k.trim()?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.loading}):g===`markdown`?(0,$.jsx)(pe,{content:k||J.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:k||J.empty})}):(0,$.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:k,onChange:e=>A(e.currentTarget.value),disabled:G,placeholder:G?J.loading:J.empty,"aria-label":J.suggestion}),t[168]=k,t[169]=q,t[170]=g,t[171]=J.empty,t[172]=J.loading,t[173]=J.suggestion,t[174]=G,t[175]=j,t[176]=Lt):Lt=t[176];let Rt;t[177]!==It||t[178]!==Lt?(Rt=(0,$.jsx)(`div`,{className:It,children:Lt}),t[177]=It,t[178]=Lt,t[179]=Rt):Rt=t[179];let zt;t[180]!==Pt||t[181]!==Rt?(zt=(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Pt,Rt]}),t[180]=Pt,t[181]=Rt,t[182]=zt):zt=t[182];let Bt;t[183]!==xt||t[184]!==zt?(Bt=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[xt,zt]}),t[183]=xt,t[184]=zt,t[185]=Bt):Bt=t[185];let Vt;t[186]!==ot||t[187]!==Bt?(Vt=(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[ot,Bt]}),t[186]=ot,t[187]=Bt,t[188]=Vt):Vt=t[188];let Ht;t[189]!==X||t[190]!==J.cancel?(Ht=(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:X,children:J.cancel}),t[189]=X,t[190]=J.cancel,t[191]=Ht):Ht=t[191];let Kt=!Me,Yt;t[192]!==Te||t[193]!==J.applyCurrent||t[194]!==Kt?(Yt=(0,$.jsx)(Y,{type:`button`,variant:`secondary`,disabled:Kt,onClick:Te,children:J.applyCurrent}),t[192]=Te,t[193]=J.applyCurrent,t[194]=Kt,t[195]=Yt):Yt=t[195];let Xt;t[196]===Se?Xt=t[197]:(Xt=()=>void Se(),t[196]=Se,t[197]=Xt);let Zt;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(Zt=(0,$.jsx)(U,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[198]=Zt):Zt=t[198];let Qt;t[199]!==J.regenerate||t[200]!==G||t[201]!==Xt?(Qt=(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:G,onClick:Xt,children:[Zt,J.regenerate]}),t[199]=J.regenerate,t[200]=G,t[201]=Xt,t[202]=Qt):Qt=t[202];let $t=!je,en;t[203]!==ke||t[204]!==J.append||t[205]!==$t?(en=(0,$.jsx)(Y,{type:`button`,variant:`secondary`,disabled:$t,onClick:ke,children:J.append}),t[203]=ke,t[204]=J.append,t[205]=$t,t[206]=en):en=t[206];let tn=!je,nn;t[207]!==De||t[208]!==J.replace||t[209]!==tn?(nn=(0,$.jsx)(Y,{type:`button`,variant:`primary`,disabled:tn,onClick:De,children:J.replace}),t[207]=De,t[208]=J.replace,t[209]=tn,t[210]=nn):nn=t[210];let rn;t[211]!==Ht||t[212]!==Yt||t[213]!==Qt||t[214]!==en||t[215]!==nn?(rn=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Ht,Yt,Qt,en,nn]}),t[211]=Ht,t[212]=Yt,t[213]=Qt,t[214]=en,t[215]=nn,t[216]=rn):rn=t[216];let an;t[217]!==Ge||t[218]!==Vt||t[219]!==rn?(an=(0,$.jsxs)(C,{children:[Ve,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(v,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:Jt,children:[Ge,Vt,rn]})})]}),t[217]=Ge,t[218]=Vt,t[219]=rn,t[220]=an):an=t[220];let on;t[221]!==x||t[222]!==Be||t[223]!==an?(on=(0,$.jsx)(b,{open:x,onOpenChange:Be,children:an}),t[221]=x,t[222]=Be,t[223]=an,t[224]=on):on=t[224];let sn;return t[225]!==ze||t[226]!==on?(sn=(0,$.jsxs)($.Fragment,{children:[ze,on]}),t[225]=ze,t[226]=on,t[227]=sn):sn=t[227],sn}function qt(e){return!e}function Jt(e){return e.preventDefault()}function Yt(e){let t=(0,Q.c)(31),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,title:s,maxWidthClass:c,clearLabel:l,onClear:u}=e,d;t[0]!==r||t[1]!==n?(d={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=d):d=t[2];let f=le(d),p;t[3]===n?p=t[4]:(p=n.trim(),t[3]=n,t[4]=p);let m=p,h=s??(m?`${m}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`),g=i||f.picking,_=o??a.notSet,v;t[5]!==c||t[6]!==f.pick||t[7]!==h||t[8]!==g||t[9]!==_||t[10]!==n?(v=(0,$.jsx)(J,{value:n,onPick:f.pick,disabled:g,placeholder:_,title:h,maxWidthClass:c}),t[5]=c,t[6]=f.pick,t[7]=h,t[8]=g,t[9]=_,t[10]=n,t[11]=v):v=t[11];let y;t[12]!==l||t[13]!==i||t[14]!==u||t[15]!==f.picking||t[16]!==m?(y=l&&m&&u?(0,$.jsx)(`button`,{type:`button`,disabled:i||f.picking,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:u,children:l}):null,t[12]=l,t[13]=i,t[14]=u,t[15]=f.picking,t[16]=m,t[17]=y):y=t[17];let b;t[18]!==v||t[19]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v,y]}),t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==f.confirmPick||t[22]!==f.hasNativePicker||t[23]!==f.modalOpen||t[24]!==f.setModalOpen||t[25]!==m||t[26]!==a?(x=f.hasNativePicker?null:(0,$.jsx)(ae,{open:f.modalOpen,onOpenChange:f.setModalOpen,initialAbsolutePath:m||void 0,onConfirm:f.confirmPick,wd:a}),t[21]=f.confirmPick,t[22]=f.hasNativePicker,t[23]=f.modalOpen,t[24]=f.setModalOpen,t[25]=m,t[26]=a,t[27]=x):x=t[27];let S;return t[28]!==b||t[29]!==x?(S=(0,$.jsxs)($.Fragment,{children:[b,x]}),t[28]=b,t[29]=x,t[30]=S):S=t[30],S}function Xt(e,t){return e[t]??t}function Zt(e,t){let n=be[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function Qt(e,t){return(be[e]??[]).every(e=>!e.required||!!t[e.key]?.trim())}function $t(e){let t=(0,Q.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,$.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,$.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function en(e){let t=(0,Q.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,x,S,C;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){y=a(r).workflows;let e=be[n]??[];v=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{ue(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,x=e.map(e=>{let t=Xt(y.args,e.labelKey),a=Xt(y.args,e.placeholderKey),c=o[e.key]??``;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,$.jsx)(Kt,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,$.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,$.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),S=v&&h.length>0?(0,$.jsx)($t,{examples:h,labels:y,onSelect:_}):null,C=g?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,$.jsx)(Kt,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,$.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:y.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else _=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let w;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(w=!v&&h.length>0?(0,$.jsx)($t,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=w):w=t[27];let T;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,$.jsxs)(`div`,{className:b,children:[x,S,C,w]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}var tn=42,nn=68,rn=56;function an(e){return Math.max(tn,Math.min(nn,e))}function on(e){let t=(0,Q.c)(10),{title:n,children:r,className:a}=e,o;t[0]===a?o=t[1]:(o=i(`rounded-2xl border border-edge bg-surface-base/35 p-4`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=n?(0,$.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-fg`,children:n}):null,t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:r}),t[4]=r,t[5]=c);let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsxs)(`section`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function sn(e){let t=(0,Q.c)(301),{open:n,onRequestClose:r,c:a,chatM:s,agentsMessages:c,isDark:l,channels:u,sessionChatIds:d,cronAgentSelectOptions:f,defaultModelResolver:p,formMode:m,formJobId:h,formName:g,onFormNameChange:y,formSchedule:x,onFormScheduleChange:w,formSubmitting:T,formTaskKind:E,onFormTaskKindChange:D,workflowDefinitions:O,workflowDefinitionsLoading:k,formWorkflowDefinitionId:A,onFormWorkflowDefinitionIdChange:j,formWorkflowGoal:M,onFormWorkflowGoalChange:N,formWorkflowArgValues:P,onFormWorkflowArgValuesChange:F,formSessionTarget:L,onFormSessionTargetChange:R,formAgentLocalOnly:z,onFormAgentLocalOnlyChange:H,formModel:W,onFormModelUserChange:G,formAgentId:q,onFormAgentIdChange:ee,formWorkingDirectory:te,onFormWorkingDirectoryChange:ne,formChannel:J,onFormChannelChange:re,formChatId:ie,onFormChatIdChange:ae,formMessage:oe,onFormMessageChange:se,formMessageMdMode:le,onSetMessageMdMode:ue,messageEditorNonce:de,needsDeliveryChat:fe,showChannelPicker:he,canSubmit:ge,onSubmit:_e,onRefreshRecipients:ye}=e,be=o(pn),[xe,Se]=(0,Z.useState)(rn),[Ce,we]=(0,Z.useState)(!1),[Te,Ee]=(0,Z.useState)(0),De=(0,Z.useRef)(null),Oe,ke;if(t[0]!==A||t[1]!==be||t[2]!==O){let e;t[5]===A?e=t[6]:(e=e=>e.id===A.trim(),t[5]=A,t[6]=e),Oe=O.find(e),ke=Oe?_(Oe,be):null,t[0]=A,t[1]=be,t[2]=O,t[3]=Oe,t[4]=ke}else Oe=t[3],ke=t[4];let Ae=ke,je;t[7]!==x.everyMs||t[8]!==x.kind?(je=x.kind===`every`?Math.max(1,Math.round(x.everyMs/6e4)):60,t[7]=x.everyMs,t[8]=x.kind,t[9]=je):je=t[9];let Me=je,Ne;t[10]!==x.at||t[11]!==x.kind?(Ne=x.kind===`at`&&x.at?new Date(x.at).toISOString().slice(0,16):``,t[10]=x.at,t[11]=x.kind,t[12]=Ne):Ne=t[12];let Pe=Ne,Fe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>{e.preventDefault();let t=De.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.currentTarget,i=e.pointerId;r.setPointerCapture(i),we(!0);let a=e=>{Se(an((e-n.left)/n.width*100))};a(e.clientX);let o=e=>{a(e.clientX)},s=()=>{try{r.releasePointerCapture(i)}catch{}we(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},t[13]=Fe):Fe=t[13];let Ie=Fe,Le;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>{e.key===`ArrowLeft`?(e.preventDefault(),Se(fn)):e.key===`ArrowRight`?(e.preventDefault(),Se(dn)):e.key===`Home`?(e.preventDefault(),Se(tn)):e.key===`End`&&(e.preventDefault(),Se(nn))},t[14]=Le):Le=t[14];let Re=Le,ze;t[15]===a.agentProfile?ze=t[16]:(ze=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.agentProfile}),t[15]=a.agentProfile,t[16]=ze);let Be;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(Be=wt(),t[17]=Be):Be=t[17];let Ve;t[18]===ee?Ve=t[19]:(Ve=e=>ee(e.target.value),t[18]=ee,t[19]=Ve);let He;t[20]===a.agentProfileDefault?He=t[21]:(He=(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),t[20]=a.agentProfileDefault,t[21]=He);let Ue;if(t[22]!==c||t[23]!==f){let e;t[25]===c?e=t[26]:(e=e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} - ${ve(e,c)}`},e.id),t[25]=c,t[26]=e),Ue=f.map(e),t[22]=c,t[23]=f,t[24]=Ue}else Ue=t[24];let We;t[27]!==q||t[28]!==T||t[29]!==Ve||t[30]!==He||t[31]!==Ue?(We=(0,$.jsxs)(`select`,{className:Be,value:q,disabled:T,onChange:Ve,children:[He,Ue]}),t[27]=q,t[28]=T,t[29]=Ve,t[30]=He,t[31]=Ue,t[32]=We):We=t[32];let Ge;t[33]===a.agentProfileHint?Ge=t[34]:(Ge=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.agentProfileHint}),t[33]=a.agentProfileHint,t[34]=Ge);let Ke;t[35]!==We||t[36]!==Ge||t[37]!==ze?(Ke=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[ze,We,Ge]}),t[35]=We,t[36]=Ge,t[37]=ze,t[38]=Ke):Ke=t[38];let qe=Ke,Je;t[39]!==a.channel||t[40]!==a.channelLocal||t[41]!==a.enterManuallyOrSelect||t[42]!==a.lastActiveLabels||t[43]!==a.noRecentChats||t[44]!==a.noRecentChatsOption||t[45]!==a.recipient||t[46]!==a.recipientPlaceholder||t[47]!==a.refreshList||t[48]!==a.refreshRecipientHint||t[49]!==a.selectRecipient||t[50]!==a.workflowDeliveryHint||t[51]!==u||t[52]!==J||t[53]!==ie||t[54]!==E||t[55]!==fe||t[56]!==re||t[57]!==ae||t[58]!==ye||t[59]!==d||t[60]!==he?(Je=he?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.channel}),(0,$.jsxs)(`select`,{className:wt(),value:J,onChange:e=>re(e.target.value),children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),u.map(un)]})]}),fe?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.recipient}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ye(),children:[(0,$.jsx)(U,{className:`size-3.5`,strokeWidth:1.75}),a.refreshList]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,$.jsx)(`input`,{type:`text`,className:i(Ct(),`min-w-0 w-full sm:flex-1`),value:ie,onChange:e=>ae(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:Tt,value:ie,onChange:e=>{let t=e.target.value;t&&ae(t)},children:[(0,$.jsx)(`option`,{value:``,children:a.selectRecipient}),d.length>0?d.map(e=>(0,$.jsx)(`option`,{value:e.chatId,children:Xe(e,a.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,$.jsx)(`option`,{value:``,disabled:!0,children:a.noRecentChatsOption})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:E===`workflowRun`?a.workflowDeliveryHint:d.length>0?a.enterManuallyOrSelect:a.noRecentChats})]}):null]}):null,t[39]=a.channel,t[40]=a.channelLocal,t[41]=a.enterManuallyOrSelect,t[42]=a.lastActiveLabels,t[43]=a.noRecentChats,t[44]=a.noRecentChatsOption,t[45]=a.recipient,t[46]=a.recipientPlaceholder,t[47]=a.refreshList,t[48]=a.refreshRecipientHint,t[49]=a.selectRecipient,t[50]=a.workflowDeliveryHint,t[51]=u,t[52]=J,t[53]=ie,t[54]=E,t[55]=fe,t[56]=re,t[57]=ae,t[58]=ye,t[59]=d,t[60]=he,t[61]=Je):Je=t[61];let Ze=Je,Qe;t[62]===a.schedule?Qe=t[63]:(Qe=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.schedule}),t[62]=a.schedule,t[63]=Qe);let et;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(et=wt(),t[64]=et):et=t[64];let tt;t[65]===w?tt=t[66]:(tt=e=>{let t=e.target.value;w(t===`cron`?{kind:`cron`,expr:`*/5 * * * *`}:t===`at`?{kind:`at`,at:new Date(Date.now()+36e5).toISOString()}:{kind:`every`,everyMs:36e5})},t[65]=w,t[66]=tt);let nt,rt,it;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,$.jsx)(`option`,{value:`cron`,children:`Cron`}),rt=(0,$.jsx)(`option`,{value:`at`,children:`One-time`}),it=(0,$.jsx)(`option`,{value:`every`,children:`Interval`}),t[67]=nt,t[68]=rt,t[69]=it):(nt=t[67],rt=t[68],it=t[69]);let at;t[70]!==x.kind||t[71]!==T||t[72]!==tt?(at=(0,$.jsxs)(`select`,{className:et,value:x.kind,disabled:T,onChange:tt,children:[nt,rt,it]}),t[70]=x.kind,t[71]=T,t[72]=tt,t[73]=at):at=t[73];let ot;t[74]!==Qe||t[75]!==at?(ot=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[Qe,at]}),t[74]=Qe,t[75]=at,t[76]=ot):ot=t[76];let st;t[77]!==Pe||t[78]!==a.nextRun||t[79]!==a.scheduleBadge||t[80]!==a.schedulePicker||t[81]!==x||t[82]!==T||t[83]!==Me||t[84]!==w?(st=x.kind===`cron`?(0,$.jsx)($e,{value:x.expr,onChange:e=>w({...x,expr:e}),disabled:T,labels:a.schedulePicker}):x.kind===`at`?(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.nextRun}),(0,$.jsx)(`input`,{type:`datetime-local`,className:Ct(T),value:Pe,disabled:T,onChange:e=>{let t=new Date(e.target.value).getTime();w({kind:`at`,at:Number.isFinite(t)?new Date(t).toISOString():``})}})]}):(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.scheduleBadge.everyNMinutes.replace(`{{n}}`,``)}),(0,$.jsx)(`input`,{type:`number`,min:1,step:1,className:Ct(T),value:Me,disabled:T,onChange:e=>{let t=Number.parseInt(e.target.value,10);w({kind:`every`,everyMs:Math.max(1,Number.isFinite(t)?t:1)*6e4})}})]}),t[77]=Pe,t[78]=a.nextRun,t[79]=a.scheduleBadge,t[80]=a.schedulePicker,t[81]=x,t[82]=T,t[83]=Me,t[84]=w,t[85]=st):st=t[85];let ct;t[86]!==ot||t[87]!==st?(ct=(0,$.jsxs)($.Fragment,{children:[ot,st]}),t[86]=ot,t[87]=st,t[88]=ct):ct=t[88];let lt=ct,ut;t[89]===a.message?ut=t[90]:(ut=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.message}),t[89]=a.message,t[90]=ut);let dt;t[91]!==se||t[92]!==ue?(dt=e=>{se(e),Ee(ln),ue(`edit`)},t[91]=se,t[92]=ue,t[93]=dt):dt=t[93];let ft=a.message,pt;t[94]===x?pt=t[95]:(pt=Ye(x),t[94]=x,t[95]=pt);let mt;t[96]!==J||t[97]!==g||t[98]!==L||t[99]!==E||t[100]!==pt?(mt={page:`cron`,taskKind:E,cronName:g,scheduleSummary:pt,sessionTarget:L,deliveryChannel:J},t[96]=J,t[97]=g,t[98]=L,t[99]=E,t[100]=pt,t[101]=mt):mt=t[101];let ht;t[102]!==a.message||t[103]!==oe||t[104]!==T||t[105]!==be||t[106]!==dt||t[107]!==mt?(ht=(0,$.jsx)(Kt,{value:oe,onApply:dt,fieldId:`cron.message`,fieldLabel:ft,scenario:`cron.message`,format:`markdown`,locale:be,context:mt,disabled:T}),t[102]=a.message,t[103]=oe,t[104]=T,t[105]=be,t[106]=dt,t[107]=mt,t[108]=ht):ht=t[108];let gt=le===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`,_t;t[109]===gt?_t=t[110]:(_t=i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,gt),t[109]=gt,t[110]=_t);let vt;t[111]===ue?vt=t[112]:(vt=()=>ue(`edit`),t[111]=ue,t[112]=vt);let yt;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,$.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[113]=yt):yt=t[113];let bt;t[114]!==a.messageEdit||t[115]!==_t||t[116]!==vt?(bt=(0,$.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,a.messageEdit]}),t[114]=a.messageEdit,t[115]=_t,t[116]=vt,t[117]=bt):bt=t[117];let xt=le===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`,St;t[118]===xt?St=t[119]:(St=i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,xt),t[118]=xt,t[119]=St);let Et;t[120]===ue?Et=t[121]:(Et=()=>ue(`preview`),t[120]=ue,t[121]=Et);let Dt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,$.jsx)(K,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[122]=Dt):Dt=t[122];let Ot;t[123]!==a.messagePreview||t[124]!==St||t[125]!==Et?(Ot=(0,$.jsxs)(`button`,{type:`button`,className:St,onClick:Et,children:[Dt,a.messagePreview]}),t[123]=a.messagePreview,t[124]=St,t[125]=Et,t[126]=Ot):Ot=t[126];let kt;t[127]!==bt||t[128]!==Ot?(kt=(0,$.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[bt,Ot]}),t[127]=bt,t[128]=Ot,t[129]=kt):kt=t[129];let At;t[130]!==ht||t[131]!==kt?(At=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[ht,kt]}),t[130]=ht,t[131]=kt,t[132]=At):At=t[132];let jt;t[133]!==ut||t[134]!==At?(jt=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[ut,At]}),t[133]=ut,t[134]=At,t[135]=jt):jt=t[135];let Mt=T&&`pointer-events-none opacity-60`,Nt;t[136]===Mt?Nt=t[137]:(Nt=i(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,Mt),t[136]=Mt,t[137]=Nt);let Pt;t[138]!==Te||t[139]!==a.messagePlaceholder||t[140]!==h||t[141]!==oe||t[142]!==le||t[143]!==l||t[144]!==de||t[145]!==se?(Pt=le===`edit`?(0,$.jsx)(X,{initialContent:oe,onChange:se,isDark:l,className:`h-[min(22rem,44vh)] min-h-[16rem]`},`cron-msg-${h??`new`}-${de}-${Te}`):(0,$.jsx)(`div`,{className:`h-[min(22rem,44vh)] min-h-[16rem] max-h-[min(26rem,52vh)] overflow-y-auto px-3 py-2`,children:oe.trim()?(0,$.jsx)(pe,{content:oe,compact:!0,className:`text-sm`}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.messagePlaceholder})}),t[138]=Te,t[139]=a.messagePlaceholder,t[140]=h,t[141]=oe,t[142]=le,t[143]=l,t[144]=de,t[145]=se,t[146]=Pt):Pt=t[146];let Ft;t[147]!==Nt||t[148]!==Pt?(Ft=(0,$.jsx)(`div`,{className:Nt,children:Pt}),t[147]=Nt,t[148]=Pt,t[149]=Ft):Ft=t[149];let It;t[150]===a.messageMarkdownHint?It=t[151]:(It=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.messageMarkdownHint}),t[150]=a.messageMarkdownHint,t[151]=It);let Lt;t[152]!==jt||t[153]!==Ft||t[154]!==It?(Lt=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[jt,Ft,It]}),t[152]=jt,t[153]=Ft,t[154]=It,t[155]=Lt):Lt=t[155];let Rt=Lt,zt;t[156]===r?zt=t[157]:(zt=e=>!e&&r(),t[156]=r,t[157]=zt);let Bt;t[158]===Symbol.for(`react.memo_cache_sentinel`)?(Bt=(0,$.jsx)(V,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[158]=Bt):Bt=t[158];let Vt=m===`edit`?a.editJob:a.addJob,Ht;t[159]===Vt?Ht=t[160]:(Ht=(0,$.jsx)(I,{className:`text-base font-semibold text-fg`,children:Vt}),t[159]=Vt,t[160]=Ht);let Ut;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(Ut=(0,$.jsx)(ce,{className:`size-5`,strokeWidth:1.75}),t[161]=Ut):Ut=t[161];let Wt;t[162]===a.close?Wt=t[163]:(Wt=(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:Ut})}),t[162]=a.close,t[163]=Wt);let Gt;t[164]!==Ht||t[165]!==Wt?(Gt=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Ht,Wt]}),t[164]=Ht,t[165]=Wt,t[166]=Gt):Gt=t[166];let qt=!Ce&&`lg:transition-[grid-template-columns] lg:duration-200 lg:ease-out`,Jt;t[167]===qt?Jt=t[168]:(Jt=i(`grid min-h-full grid-cols-1 gap-4 lg:h-full lg:min-h-0 lg:[grid-template-columns:minmax(0,var(--cron-form-primary-pane))_0.75rem_minmax(22rem,1fr)] lg:gap-0`,qt),t[167]=qt,t[168]=Jt);let Xt=`${xe}%`,Zt;t[169]===Xt?Zt=t[170]:(Zt={"--cron-form-primary-pane":Xt},t[169]=Xt,t[170]=Zt);let Qt=Zt,$t;t[171]===a.name?$t=t[172]:($t=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.name}),t[171]=a.name,t[172]=$t);let sn;t[173]===Symbol.for(`react.memo_cache_sentinel`)?(sn=Ct(),t[173]=sn):sn=t[173];let mn;t[174]===y?mn=t[175]:(mn=e=>y(e.target.value),t[174]=y,t[175]=mn);let hn;t[176]!==a.namePlaceholder||t[177]!==g||t[178]!==mn?(hn=(0,$.jsx)(`input`,{type:`text`,className:sn,value:g,onChange:mn,placeholder:a.namePlaceholder}),t[176]=a.namePlaceholder,t[177]=g,t[178]=mn,t[179]=hn):hn=t[179];let gn;t[180]!==$t||t[181]!==hn?(gn=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[$t,hn]}),t[180]=$t,t[181]=hn,t[182]=gn):gn=t[182];let _n;t[183]===a.taskKind?_n=t[184]:(_n=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.taskKind}),t[183]=a.taskKind,t[184]=_n);let vn;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(vn=wt(),t[185]=vn):vn=t[185];let yn;t[186]===D?yn=t[187]:(yn=e=>D(e.target.value),t[186]=D,t[187]=yn);let bn;t[188]===a.taskKindMessage?bn=t[189]:(bn=(0,$.jsx)(`option`,{value:`message`,children:a.taskKindMessage}),t[188]=a.taskKindMessage,t[189]=bn);let xn;t[190]===a.taskKindWorkflowRun?xn=t[191]:(xn=(0,$.jsx)(`option`,{value:`workflowRun`,children:a.taskKindWorkflowRun}),t[190]=a.taskKindWorkflowRun,t[191]=xn);let Sn;t[192]!==T||t[193]!==E||t[194]!==yn||t[195]!==bn||t[196]!==xn?(Sn=(0,$.jsxs)(`select`,{className:vn,value:E,disabled:T,onChange:yn,children:[bn,xn]}),t[192]=T,t[193]=E,t[194]=yn,t[195]=bn,t[196]=xn,t[197]=Sn):Sn=t[197];let Cn;t[198]!==_n||t[199]!==Sn?(Cn=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[_n,Sn]}),t[198]=_n,t[199]=Sn,t[200]=Cn):Cn=t[200];let wn;t[201]!==lt||t[202]!==gn||t[203]!==Cn?(wn=(0,$.jsxs)(on,{children:[gn,lt,Cn]}),t[201]=lt,t[202]=gn,t[203]=Cn,t[204]=wn):wn=t[204];let Tn;t[205]!==a.message||t[206]!==a.workflowDefinition||t[207]!==a.workflowDefinitionCustom||t[208]!==a.workflowDefinitionMissing||t[209]!==a.workflowDefinitionPlaceholder||t[210]!==a.workflowDefinitionsEmpty||t[211]!==a.workflowDefinitionsLoading||t[212]!==g||t[213]!==x||t[214]!==T||t[215]!==E||t[216]!==P||t[217]!==A||t[218]!==M||t[219]!==be||t[220]!==Rt||t[221]!==F||t[222]!==j||t[223]!==N||t[224]!==Oe||t[225]!==Ae||t[226]!==O||t[227]!==k?(Tn=E===`workflowRun`?(0,$.jsxs)(on,{title:a.workflowDefinition,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workflowDefinition}),(0,$.jsxs)(`select`,{className:wt(),value:A,disabled:T||k,onChange:e=>j(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:k?a.workflowDefinitionsLoading:a.workflowDefinitionPlaceholder}),A.trim()&&!O.some(e=>e.id===A.trim())?(0,$.jsx)(`option`,{value:A,children:A}):null,O.map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.title,e.metadata.source===`user`?` (${a.workflowDefinitionCustom})`:``]},e.id))]}),!k&&O.length===0?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workflowDefinitionsEmpty}):null,Ae?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:Ae.description}):A.trim()&&!Oe?(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:a.workflowDefinitionMissing}):null]}),A.trim()?(0,$.jsx)(en,{workflowName:A.trim(),language:be,argValues:P,onArgValuesChange:F,goal:M,onGoalChange:N,examplePrompts:Ae?.examplePrompts??[],inputClassName:Ct(),aiAssist:{disabled:T,context:{page:`cron`,taskKind:E,cronName:g,scheduleSummary:Ye(x),workflowDefinitionId:A.trim(),workflowDescription:Ae?.description??``}}}):null]}):(0,$.jsx)(on,{title:a.message,children:Rt}),t[205]=a.message,t[206]=a.workflowDefinition,t[207]=a.workflowDefinitionCustom,t[208]=a.workflowDefinitionMissing,t[209]=a.workflowDefinitionPlaceholder,t[210]=a.workflowDefinitionsEmpty,t[211]=a.workflowDefinitionsLoading,t[212]=g,t[213]=x,t[214]=T,t[215]=E,t[216]=P,t[217]=A,t[218]=M,t[219]=be,t[220]=Rt,t[221]=F,t[222]=j,t[223]=N,t[224]=Oe,t[225]=Ae,t[226]=O,t[227]=k,t[228]=Tn):Tn=t[228];let En;t[229]!==wn||t[230]!==Tn?(En=(0,$.jsx)(`div`,{className:`lg:min-h-0 lg:overflow-y-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[wn,Tn]})}),t[229]=wn,t[230]=Tn,t[231]=En):En=t[231];let Dn=a.detailResizeColumns,On;t[232]===xe?On=t[233]:(On=Math.round(xe),t[232]=xe,t[233]=On);let kn;t[234]===Symbol.for(`react.memo_cache_sentinel`)?(kn=i(`group hidden h-full cursor-col-resize touch-none select-none items-stretch justify-center rounded-lg outline-none lg:flex`,`focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[234]=kn):kn=t[234];let An=Ce&&`bg-edge`,jn;t[235]===An?jn=t[236]:(jn=i(`h-full w-px bg-edge-subtle transition-colors duration-150`,`group-hover:bg-edge`,An),t[235]=An,t[236]=jn);let Mn;t[237]===jn?Mn=t[238]:(Mn=(0,$.jsx)(`span`,{className:jn}),t[237]=jn,t[238]=Mn);let Nn;t[239]!==a.detailResizeColumns||t[240]!==On||t[241]!==Mn?(Nn=(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":Dn,"aria-valuemin":tn,"aria-valuemax":nn,"aria-valuenow":On,tabIndex:0,onPointerDown:Ie,onKeyDown:Re,className:kn,children:Mn}),t[239]=a.detailResizeColumns,t[240]=On,t[241]=Mn,t[242]=Nn):Nn=t[242];let Pn;t[243]!==qe||t[244]!==a.agentLocalOnly||t[245]!==a.agentLocalOnlyHint||t[246]!==a.detailRunSettings||t[247]!==a.mode||t[248]!==a.modeAgent||t[249]!==a.modeAgentOption||t[250]!==a.modeDirect||t[251]!==a.modeDirectOption||t[252]!==a.model||t[253]!==a.workflowLocalOnly||t[254]!==a.workflowLocalOnlyHint||t[255]!==a.workingDirectoryHint||t[256]!==a.workingDirectoryLabel||t[257]!==a.workingDirectoryReset||t[258]!==s||t[259]!==p||t[260]!==z||t[261]!==W||t[262]!==L||t[263]!==T||t[264]!==E||t[265]!==te||t[266]!==H||t[267]!==G||t[268]!==R||t[269]!==ne?(Pn=E===`message`?(0,$.jsxs)(on,{title:a.detailRunSettings,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.mode}),(0,$.jsxs)(`select`,{className:wt(),value:L,onChange:e=>{let t=e.target.value;R(t,p,W.trim())},children:[(0,$.jsx)(`option`,{value:`main`,children:a.modeDirectOption}),(0,$.jsx)(`option`,{value:`isolated`,children:a.modeAgentOption})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:L===`main`?a.modeDirect:a.modeAgent})]}),L===`isolated`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.model}),(0,$.jsx)(me,{value:W,placeholder:s.modelPlaceholder,searchPlaceholder:s.modelSearchPlaceholder,noMatches:s.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:G})]}),qe,(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workingDirectoryLabel}),(0,$.jsx)(Yt,{value:te,onChange:ne,disabled:T,wd:s.workingDirectory,placeholder:s.workingDirectory.notSet,maxWidthClass:`max-w-[min(18rem,52vw)]`,clearLabel:a.workingDirectoryReset,onClear:()=>ne(``)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workingDirectoryHint})]}),(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-hover/45 px-3 py-2 dark:bg-surface-hover/30`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:i(`ui-checkbox`,`mt-0.5`),checked:z,onChange:e=>H(e.target.checked),"aria-label":a.agentLocalOnly}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.agentLocalOnly}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.agentLocalOnlyHint})]})]})]}):null]}):(0,$.jsxs)(on,{title:a.detailRunSettings,children:[qe,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-hover/45 px-3 py-2 dark:bg-surface-hover/30`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:i(`ui-checkbox`,`mt-0.5`),checked:z,onChange:e=>H(e.target.checked),"aria-label":a.workflowLocalOnly}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.workflowLocalOnly}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.workflowLocalOnlyHint})]})]})]}),t[243]=qe,t[244]=a.agentLocalOnly,t[245]=a.agentLocalOnlyHint,t[246]=a.detailRunSettings,t[247]=a.mode,t[248]=a.modeAgent,t[249]=a.modeAgentOption,t[250]=a.modeDirect,t[251]=a.modeDirectOption,t[252]=a.model,t[253]=a.workflowLocalOnly,t[254]=a.workflowLocalOnlyHint,t[255]=a.workingDirectoryHint,t[256]=a.workingDirectoryLabel,t[257]=a.workingDirectoryReset,t[258]=s,t[259]=p,t[260]=z,t[261]=W,t[262]=L,t[263]=T,t[264]=E,t[265]=te,t[266]=H,t[267]=G,t[268]=R,t[269]=ne,t[270]=Pn):Pn=t[270];let Fn;t[271]!==a.deliveryTarget||t[272]!==Ze?(Fn=Ze?(0,$.jsx)(on,{title:a.deliveryTarget,children:Ze}):null,t[271]=a.deliveryTarget,t[272]=Ze,t[273]=Fn):Fn=t[273];let In;t[274]!==Pn||t[275]!==Fn?(In=(0,$.jsx)(`aside`,{className:`lg:min-h-0 lg:overflow-y-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[Pn,Fn]})}),t[274]=Pn,t[275]=Fn,t[276]=In):In=t[276];let Ln;t[277]!==Jt||t[278]!==Qt||t[279]!==En||t[280]!==Nn||t[281]!==In?(Ln=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 lg:overflow-hidden`,children:(0,$.jsxs)(`div`,{ref:De,className:Jt,style:Qt,children:[En,Nn,In]})}),t[277]=Jt,t[278]=Qt,t[279]=En,t[280]=Nn,t[281]=In,t[282]=Ln):Ln=t[282];let Rn;t[283]!==a.cancel||t[284]!==r?(Rn=(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:r,children:a.cancel}),t[283]=a.cancel,t[284]=r,t[285]=Rn):Rn=t[285];let zn=T||!ge,Bn=T?a.loading:m===`edit`?a.save:a.create,Vn;t[286]!==_e||t[287]!==zn||t[288]!==Bn?(Vn=(0,$.jsx)(Y,{type:`button`,variant:`primary`,disabled:zn,onClick:_e,children:Bn}),t[286]=_e,t[287]=zn,t[288]=Bn,t[289]=Vn):Vn=t[289];let Hn;t[290]!==Rn||t[291]!==Vn?(Hn=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Rn,Vn]}),t[290]=Rn,t[291]=Vn,t[292]=Hn):Hn=t[292];let Un;t[293]!==Gt||t[294]!==Ln||t[295]!==Hn?(Un=(0,$.jsxs)(C,{children:[Bt,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(v,{className:`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(86vh,46rem)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,onOpenAutoFocus:cn,children:[Gt,Ln,Hn]})})]}),t[293]=Gt,t[294]=Ln,t[295]=Hn,t[296]=Un):Un=t[296];let Wn;return t[297]!==n||t[298]!==zt||t[299]!==Un?(Wn=(0,$.jsx)(b,{open:n,onOpenChange:zt,children:Un}),t[297]=n,t[298]=zt,t[299]=Un,t[300]=Wn):Wn=t[300],Wn}function cn(e){return e.preventDefault()}function ln(e){return e+1}function un(e){return(0,$.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name)}function dn(e){return an(e+4)}function fn(e){return an(e-4)}function pn(e){return e.language}function mn(e){let t=(0,Q.c)(76),{c:n,mainTab:r,onMainTabChange:a,jobSort:o,onJobSortChange:s,historyRange:c,onHistoryRangeChange:l,historyJobFilter:u,onHistoryJobFilterChange:d,historyStatusFilter:f,onHistoryStatusFilterChange:p,jobs:m}=e,h=n.title,_=r===`myTasks`,v=r===`myTasks`?`text-fg`:`text-fg-muted hover:text-fg`,y;t[0]===v?y=t[1]:(y=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,v),t[0]=v,t[1]=y);let b;t[2]===a?b=t[3]:(b=()=>a(`myTasks`),t[2]=a,t[3]=b);let x;t[4]!==n.tabMyTasks||t[5]!==_||t[6]!==y||t[7]!==b?(x=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":_,className:y,onClick:b,children:n.tabMyTasks}),t[4]=n.tabMyTasks,t[5]=_,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S=r===`systemTasks`,C=r===`systemTasks`?`text-fg`:`text-fg-muted hover:text-fg`,w;t[9]===C?w=t[10]:(w=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,C),t[9]=C,t[10]=w);let T;t[11]===a?T=t[12]:(T=()=>a(`systemTasks`),t[11]=a,t[12]=T);let E;t[13]!==n.tabSystemTasks||t[14]!==T||t[15]!==S||t[16]!==w?(E=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S,className:w,onClick:T,children:n.tabSystemTasks}),t[13]=n.tabSystemTasks,t[14]=T,t[15]=S,t[16]=w,t[17]=E):E=t[17];let D=r===`history`,O=r===`history`?`text-fg`:`text-fg-muted hover:text-fg`,k;t[18]===O?k=t[19]:(k=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,O),t[18]=O,t[19]=k);let A;t[20]===a?A=t[21]:(A=()=>a(`history`),t[20]=a,t[21]=A);let j;t[22]!==n.tabRunHistory||t[23]!==D||t[24]!==k||t[25]!==A?(j=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":D,className:k,onClick:A,children:n.tabRunHistory}),t[22]=n.tabRunHistory,t[23]=D,t[24]=k,t[25]=A,t[26]=j):j=t[26];let M=r===`settings`,N=r===`settings`?`text-fg`:`text-fg-muted hover:text-fg`,P;t[27]===N?P=t[28]:(P=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,N),t[27]=N,t[28]=P);let F;t[29]===a?F=t[30]:(F=()=>a(`settings`),t[29]=a,t[30]=F);let I;t[31]!==n.globals.title||t[32]!==M||t[33]!==P||t[34]!==F?(I=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":M,className:P,onClick:F,children:n.globals.title}),t[31]=n.globals.title,t[32]=M,t[33]=P,t[34]=F,t[35]=I):I=t[35];let L;t[36]!==n.title||t[37]!==E||t[38]!==j||t[39]!==I||t[40]!==x?(L=(0,$.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":h,children:[x,E,j,I]}),t[36]=n.title,t[37]=E,t[38]=j,t[39]=I,t[40]=x,t[41]=L):L=t[41];let R=r===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`,z;t[42]===R?z=t[43]:(z=i(`flex min-w-0 items-center gap-2`,R),t[42]=R,t[43]=z);let B;t[44]!==n.sortCreatedAsc||t[45]!==n.sortCreatedDesc||t[46]!==o||t[47]!==r||t[48]!==s?(B=r===`myTasks`||r===`systemTasks`?(0,$.jsxs)(`select`,{className:Et,value:o,onChange:e=>s(e.target.value),"aria-label":n.sortCreatedDesc,children:[(0,$.jsx)(`option`,{value:`created_desc`,children:n.sortCreatedDesc}),(0,$.jsx)(`option`,{value:`created_asc`,children:n.sortCreatedAsc})]}):null,t[44]=n.sortCreatedAsc,t[45]=n.sortCreatedDesc,t[46]=o,t[47]=r,t[48]=s,t[49]=B):B=t[49];let V;t[50]!==n.execStatusCancelled||t[51]!==n.execStatusFailed||t[52]!==n.execStatusRunning||t[53]!==n.execStatusSuccess||t[54]!==n.filterAllStatuses||t[55]!==n.filterAllTasks||t[56]!==n.historyRangeDay||t[57]!==n.historyRangeMonth||t[58]!==n.historyRangeWeek||t[59]!==n.runHistoryTitle||t[60]!==u||t[61]!==c||t[62]!==f||t[63]!==m||t[64]!==r||t[65]!==d||t[66]!==l||t[67]!==p?(V=r===`history`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:i(ie,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,$.jsx)(`button`,{type:`button`,className:i(g,`px-2.5 py-1`,c===e&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,c===e&&`text-fg`),onClick:()=>l(e),children:e===`day`?n.historyRangeDay:e===`week`?n.historyRangeWeek:n.historyRangeMonth},e))}),(0,$.jsxs)(`select`,{className:Et,value:u,onChange:e=>d(e.target.value),"aria-label":n.filterAllTasks,children:[(0,$.jsx)(`option`,{value:``,children:n.filterAllTasks}),m.map(hn)]}),(0,$.jsxs)(`select`,{className:Et,value:f,onChange:e=>p(e.target.value),"aria-label":n.filterAllStatuses,children:[(0,$.jsx)(`option`,{value:``,children:n.filterAllStatuses}),(0,$.jsx)(`option`,{value:`success`,children:n.execStatusSuccess}),(0,$.jsx)(`option`,{value:`failed`,children:n.execStatusFailed}),(0,$.jsx)(`option`,{value:`cancelled`,children:n.execStatusCancelled}),(0,$.jsx)(`option`,{value:`running`,children:n.execStatusRunning})]})]}):null,t[50]=n.execStatusCancelled,t[51]=n.execStatusFailed,t[52]=n.execStatusRunning,t[53]=n.execStatusSuccess,t[54]=n.filterAllStatuses,t[55]=n.filterAllTasks,t[56]=n.historyRangeDay,t[57]=n.historyRangeMonth,t[58]=n.historyRangeWeek,t[59]=n.runHistoryTitle,t[60]=u,t[61]=c,t[62]=f,t[63]=m,t[64]=r,t[65]=d,t[66]=l,t[67]=p,t[68]=V):V=t[68];let H;t[69]!==z||t[70]!==B||t[71]!==V?(H=(0,$.jsxs)(`div`,{className:z,children:[B,V]}),t[69]=z,t[70]=B,t[71]=V,t[72]=H):H=t[72];let U;return t[73]!==L||t[74]!==H?(U=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[L,H]}),t[73]=L,t[74]=H,t[75]=U):U=t[75],U}function hn(e){return(0,$.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id)}function gn(e){let t=(0,Q.c)(16),{c:n,loading:r,runHistoryLoading:i,onRefresh:a,onOpenTemplatePicker:o,onAddJob:s}=e,c=r||i,l;t[0]!==c||t[1]!==n.refresh||t[2]!==a?(l=(0,$.jsx)(Ce,{className:`size-9 shrink-0 p-0`,loading:c,label:n.refresh,onClick:a}),t[0]=c,t[1]=n.refresh,t[2]=a,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(w,{className:`size-4`,strokeWidth:1.75}),t[4]=u):u=t[4];let d;t[5]!==n.fromTemplate||t[6]!==o?(d=(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:o,children:[u,n.fromTemplate]}),t[5]=n.fromTemplate,t[6]=o,t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(W,{className:`size-4`,strokeWidth:1.75}),t[8]=f):f=t[8];let p;t[9]!==n.addJob||t[10]!==s?(p=(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`gap-2`,onClick:s,children:[f,n.addJob]}),t[9]=n.addJob,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==l||t[13]!==d||t[14]!==p?(m=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,d,p]}),t[12]=l,t[13]=d,t[14]=p,t[15]=m):m=t[15],m}function _n(e){let t=(0,Q.c)(39),{c:n,runHistoryLoading:r,runHistory:a,filteredRunHistory:o,jobs:s,onRefreshHistory:c,onOpenJobDetail:l,statusLabels:u}=e,d;t[0]===n.tabRunHistory?d=t[1]:(d=(0,$.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:n.tabRunHistory}),t[0]=n.tabRunHistory,t[1]=d);let f;t[2]===n.runHistoryHint?f=t[3]:(f=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.runHistoryHint}),t[2]=n.runHistoryHint,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,$.jsxs)(`div`,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m;t[7]!==n.refresh||t[8]!==c||t[9]!==r?(m=(0,$.jsx)(Ce,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:c}),t[7]=n.refresh,t[8]=c,t[9]=r,t[10]=m):m=t[10];let h;t[11]!==p||t[12]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[p,m]}),t[11]=p,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==n.colChat||t[15]!==n.colDetail||t[16]!==n.colDuration||t[17]!==n.colJob||t[18]!==n.colStarted||t[19]!==n.colWorkflow||t[20]!==n.emptyHistoryHint||t[21]!==n.emptyHistoryTitle||t[22]!==n.noRunsYet||t[23]!==n.openChat||t[24]!==n.openChatTitle||t[25]!==n.openWorkflow||t[26]!==n.openWorkflowTitle||t[27]!==n.runHistoryHint||t[28]!==n.status||t[29]!==o||t[30]!==s||t[31]!==l||t[32]!==a||t[33]!==r||t[34]!==u?(g=r&&a.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(ne,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):o.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-edge-subtle px-6 py-16 text-center dark:border-edge-subtle`,children:[(0,$.jsx)(fe,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:a.length===0?n.emptyHistoryTitle:n.noRunsYet}),(0,$.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:a.length===0?n.emptyHistoryHint:n.runHistoryHint})]}):(0,$.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colStarted}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colJob}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.status}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDuration}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDetail}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colWorkflow}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colChat})]})}),(0,$.jsx)(`tbody`,{children:o.map(e=>(0,$.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,$.jsx)(`time`,{dateTime:e.startedAt,children:De(e.startedAt)})}),(0,$.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:s.some(t=>t.id===e.jobId)?(0,$.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let t=s.find(t=>t.id===e.jobId);t&&l(t)},children:e.jobName||e.jobId}):(0,$.jsx)(`span`,{className:`text-fg-muted`,children:e.jobName||e.jobId})}),(0,$.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,$.jsx)(`span`,{className:i(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,e.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,e.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`,e.status===`running`&&`bg-accent/15 text-accent`,e.status===`cancelled`&&`bg-surface-hover text-fg-muted`),children:Ae(e.status,u)})}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:Ze(e.duration)}),(0,$.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:e.summary||e.error||``,children:ke(e.summary||e.error,96)}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.workflowRunId?.trim()?(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openWorkflowTitle,"aria-label":n.openWorkflowTitle,onClick:()=>St(e.workflowRunId),children:n.openWorkflow}):(0,$.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.sessionKey?.trim()?(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>xt(e.sessionKey),children:n.openChat}):(0,$.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})}),t[14]=n.colChat,t[15]=n.colDetail,t[16]=n.colDuration,t[17]=n.colJob,t[18]=n.colStarted,t[19]=n.colWorkflow,t[20]=n.emptyHistoryHint,t[21]=n.emptyHistoryTitle,t[22]=n.noRunsYet,t[23]=n.openChat,t[24]=n.openChatTitle,t[25]=n.openWorkflow,t[26]=n.openWorkflowTitle,t[27]=n.runHistoryHint,t[28]=n.status,t[29]=o,t[30]=s,t[31]=l,t[32]=a,t[33]=r,t[34]=u,t[35]=g):g=t[35];let _;return t[36]!==h||t[37]!==g?(_=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[h,g]}),t[36]=h,t[37]=g,t[38]=_):_=t[38],_}function vn(e){let t=(0,Q.c)(77),{job:n,c:r,localeTag:a,scheduleBadgeLabels:o,absorbCardClickJobIdRef:s,scheduleAbsorbNextMenuCardClick:c,onOpenDetail:l,onToggle:u,onEdit:d,onRunNow:f,onDelete:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`flex h-full min-h-0 cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-base text-left transition-colors duration-150 ease-out dark:border-edge-subtle`,`hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[0]=m):m=t[0];let g,_;t[1]!==s||t[2]!==n||t[3]!==l?(g=()=>{if(s.current===n.id){s.current=null;return}l(n)},_=e=>{if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),s.current===n.id){s.current=null;return}l(n)}},t[1]=s,t[2]=n,t[3]=l,t[4]=g,t[5]=_):(g=t[4],_=t[5]);let v=n.enabled,y=n.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`,b;t[6]===y?b=t[7]:(b=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,y),t[6]=y,t[7]=b);let x;t[8]!==n||t[9]!==u?(x=e=>{e.stopPropagation(),u(n,!n.enabled)},t[8]=n,t[9]=u,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[11]=S):S=t[11];let C;t[12]!==n.enabled||t[13]!==b||t[14]!==x?(C=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":v,className:b,onClick:x,children:S}),t[12]=n.enabled,t[13]=b,t[14]=x,t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(h,{className:`size-4`,strokeWidth:1.75}),t[16]=w):w=t[16];let T;t[17]===r.jobCardMenuAria?T=t[18]:(T=(0,$.jsx)(it,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":r.jobCardMenuAria,onClick:bn,children:w})}),t[17]=r.jobCardMenuAria,t[18]=T);let E;t[19]!==n||t[20]!==d||t[21]!==c?(E=()=>{c(n.id),d(n)},t[19]=n,t[20]=d,t[21]=c,t[22]=E):E=t[22];let D;t[23]!==r.edit||t[24]!==E?(D=(0,$.jsx)(rt,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:E,children:r.edit}),t[23]=r.edit,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==n||t[27]!==f||t[28]!==c?(O=()=>{c(n.id),f(n)},t[26]=n,t[27]=f,t[28]=c,t[29]=O):O=t[29];let k;t[30]!==r.runNow||t[31]!==O?(k=(0,$.jsx)(rt,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:O,children:r.runNow}),t[30]=r.runNow,t[31]=O,t[32]=k):k=t[32];let A;t[33]!==n||t[34]!==p||t[35]!==c?(A=()=>{c(n.id),p(n)},t[33]=n,t[34]=p,t[35]=c,t[36]=A):A=t[36];let j;t[37]!==r.delete||t[38]!==A?(j=(0,$.jsx)(rt,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-red-600 outline-none data-highlighted:bg-red-500/10 dark:text-red-400`,onSelect:A,children:r.delete}),t[37]=r.delete,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==D||t[41]!==k||t[42]!==j?(M=(0,$.jsx)(at,{children:(0,$.jsxs)(ot,{className:`z-50 min-w-[10rem] rounded-xl border border-edge-subtle bg-surface-panel p-1 shadow-elevated dark:border-edge-subtle`,sideOffset:4,align:`end`,onCloseAutoFocus:yn,children:[D,k,j]})}),t[40]=D,t[41]=k,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==T||t[45]!==M?(N=(0,$.jsxs)(nt,{children:[T,M]}),t[44]=T,t[45]=M,t[46]=N):N=t[46];let P;t[47]!==N||t[48]!==C?(P=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[C,N]}),t[47]=N,t[48]=C,t[49]=P):P=t[49];let F=n.name||n.id,I;t[50]===F?I=t[51]:(I=(0,$.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:F}),t[50]=F,t[51]=I);let L;t[52]===n?L=t[53]:(L=Re(n),t[52]=n,t[53]=L);let R;t[54]===n?R=t[55]:(R=Re(n),t[54]=n,t[55]=R);let z;t[56]===R?z=t[57]:(z=(0,$.jsx)(pe,{content:R,compact:!0}),t[56]=R,t[57]=z);let B;t[58]!==L||t[59]!==z?(B=(0,$.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:L,children:z}),t[58]=L,t[59]=z,t[60]=B):B=t[60];let V;t[61]!==I||t[62]!==B?(V=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[I,B]}),t[61]=I,t[62]=B,t[63]=V):V=t[63];let H;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[64]=H):H=t[64];let U;t[65]!==n||t[66]!==a||t[67]!==o?(U=Oe(n,a,o),t[65]=n,t[66]=a,t[67]=o,t[68]=U):U=t[68];let W;t[69]===U?W=t[70]:(W=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 border-t border-edge-subtle/90 px-4 py-2.5 text-xs text-fg-muted dark:border-edge-subtle`,children:[H,(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:U})]}),t[69]=U,t[70]=W);let G;return t[71]!==g||t[72]!==P||t[73]!==V||t[74]!==_||t[75]!==W?(G=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,className:m,onClick:g,onKeyDown:_,children:[P,V,W]}),t[71]=g,t[72]=P,t[73]=V,t[74]=_,t[75]=W,t[76]=G):G=t[76],G}function yn(e){return e.preventDefault()}function bn(e){return e.stopPropagation()}function xn(e){let t=(0,Q.c)(134),{c:n,language:r,localeTag:o,scheduleBadgeLabels:s,loading:c,sortedSystemJobs:l,heartbeat:u,keepAwake:d,wakeSupported:f,onWakeUnsupportedClick:p,onKeepAwakeToggle:m,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:b,onRunNow:x,onDelete:S}=e,C,w,T,E,D,k,A,j,M,P,F,I;if(t[0]!==n.disabled||t[1]!==n.enabled||t[2]!==n.keepAwake||t[3]!==n.systemHeartbeatEvery||t[4]!==n.systemHeartbeatHint||t[5]!==n.systemHeartbeatInterval||t[6]!==n.systemHeartbeatSettingsLink||t[7]!==n.systemHeartbeatStatus||t[8]!==n.systemHeartbeatTitle||t[9]!==n.systemTasksIntro||t[10]!==n.tabSystemTasks||t[11]!==n.wakeBanner||t[12]!==n.wakeLockUnavailable||t[13]!==u.enabled||t[14]!==u.intervalMs||t[15]!==d||t[16]!==r||t[17]!==o||t[18]!==m||t[19]!==p||t[20]!==f){let e=et(u.intervalMs,o,a(r).heartbeatSettings.intervalPresets);F=`cron-system-tasks-panel`,I=`flex flex-col gap-4`,t[33]===n.tabSystemTasks?w=t[34]:(w=(0,$.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:n.tabSystemTasks}),t[33]=n.tabSystemTasks,t[34]=w),t[35]===n.systemTasksIntro?T=t[36]:(T=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.systemTasksIntro}),t[35]=n.systemTasksIntro,t[36]=T);let s;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(N,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[37]=s):s=t[37];let c;t[38]===n.wakeBanner?c=t[39]:(c=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[s,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[38]=n.wakeBanner,t[39]=c);let l;t[40]===n.keepAwake?l=t[41]:(l=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[40]=n.keepAwake,t[41]=l);let h=!f,g=f?void 0:n.wakeLockUnavailable,_=d?`justify-end bg-accent`:`justify-start bg-surface-hover`,v=!f&&`cursor-not-allowed opacity-50`,b;t[42]!==_||t[43]!==v?(b=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,_,v),t[42]=_,t[43]=v,t[44]=b):b=t[44];let x;t[45]!==m||t[46]!==p||t[47]!==f?(x=()=>{f?m():p()},t[45]=m,t[46]=p,t[47]=f,t[48]=x):x=t[48];let S;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[49]=S):S=t[49];let L;t[50]!==d||t[51]!==h||t[52]!==g||t[53]!==b||t[54]!==x?(L=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:h,title:g,className:b,onClick:x,children:S}),t[50]=d,t[51]=h,t[52]=g,t[53]=b,t[54]=x,t[55]=L):L=t[55];let R;t[56]!==l||t[57]!==L?(R=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[l,L]}),t[56]=l,t[57]=L,t[58]=R):R=t[58],t[59]!==c||t[60]!==R?(E=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[c,R]}),t[59]=c,t[60]=R,t[61]=E):E=t[61],M=`rounded-xl border border-edge bg-surface-base p-4 dark:bg-surface-hover/20`;let z;t[62]===n.systemHeartbeatTitle?z=t[63]:(z=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemHeartbeatTitle}),t[62]=n.systemHeartbeatTitle,t[63]=z);let B;t[64]===n.systemHeartbeatHint?B=t[65]:(B=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.systemHeartbeatHint}),t[64]=n.systemHeartbeatHint,t[65]=B);let V;t[66]!==z||t[67]!==B?(V=(0,$.jsxs)(`div`,{children:[z,B]}),t[66]=z,t[67]=B,t[68]=V):V=t[68];let H;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(y,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[69]=H):H=t[69];let U;t[70]===n.systemHeartbeatSettingsLink?U=t[71]:(U=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(O,{to:`/settings/heartbeat`,children:[n.systemHeartbeatSettingsLink,H]})}),t[70]=n.systemHeartbeatSettingsLink,t[71]=U),t[72]!==V||t[73]!==U?(P=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[V,U]}),t[72]=V,t[73]=U,t[74]=P):P=t[74],A=`mt-3 grid gap-2 text-sm sm:grid-cols-2`;let W;t[75]===n.systemHeartbeatStatus?W=t[76]:(W=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatStatus}),t[75]=n.systemHeartbeatStatus,t[76]=W);let G=u.enabled?n.enabled:n.disabled,K;t[77]===G?K=t[78]:(K=(0,$.jsx)(`dd`,{className:`text-fg`,children:G}),t[77]=G,t[78]=K),t[79]!==W||t[80]!==K?(j=(0,$.jsxs)(`div`,{children:[W,K]}),t[79]=W,t[80]=K,t[81]=j):j=t[81],t[82]===n.systemHeartbeatInterval?k=t[83]:(k=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatInterval}),t[82]=n.systemHeartbeatInterval,t[83]=k),C=`text-fg`;let q;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(q=/\{\{value\}\}/g,t[84]=q):q=t[84],D=n.systemHeartbeatEvery.replace(q,e),t[0]=n.disabled,t[1]=n.enabled,t[2]=n.keepAwake,t[3]=n.systemHeartbeatEvery,t[4]=n.systemHeartbeatHint,t[5]=n.systemHeartbeatInterval,t[6]=n.systemHeartbeatSettingsLink,t[7]=n.systemHeartbeatStatus,t[8]=n.systemHeartbeatTitle,t[9]=n.systemTasksIntro,t[10]=n.tabSystemTasks,t[11]=n.wakeBanner,t[12]=n.wakeLockUnavailable,t[13]=u.enabled,t[14]=u.intervalMs,t[15]=d,t[16]=r,t[17]=o,t[18]=m,t[19]=p,t[20]=f,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=k,t[27]=A,t[28]=j,t[29]=M,t[30]=P,t[31]=F,t[32]=I}else C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],k=t[26],A=t[27],j=t[28],M=t[29],P=t[30],F=t[31],I=t[32];let L;t[85]!==C||t[86]!==D?(L=(0,$.jsx)(`dd`,{className:C,children:D}),t[85]=C,t[86]=D,t[87]=L):L=t[87];let R;t[88]!==L||t[89]!==k?(R=(0,$.jsxs)(`div`,{children:[k,L]}),t[88]=L,t[89]=k,t[90]=R):R=t[90];let z;t[91]!==R||t[92]!==A||t[93]!==j?(z=(0,$.jsxs)(`dl`,{className:A,children:[j,R]}),t[91]=R,t[92]=A,t[93]=j,t[94]=z):z=t[94];let B;t[95]!==z||t[96]!==M||t[97]!==P?(B=(0,$.jsxs)(`div`,{className:M,children:[P,z]}),t[95]=z,t[96]=M,t[97]=P,t[98]=B):B=t[98];let V;t[99]===n.systemDreamingTitle?V=t[100]:(V=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemDreamingTitle}),t[99]=n.systemDreamingTitle,t[100]=V);let H;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(y,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[101]=H):H=t[101];let U;t[102]===n.systemDreamingSettingsLink?U=t[103]:(U=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(O,{to:`/settings/dreams`,children:[n.systemDreamingSettingsLink,H]})}),t[102]=n.systemDreamingSettingsLink,t[103]=U);let W;t[104]!==V||t[105]!==U?(W=(0,$.jsxs)(`div`,{className:`mb-2 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[V,U]}),t[104]=V,t[105]=U,t[106]=W):W=t[106];let G;t[107]===n.systemDreamingHint?G=t[108]:(G=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n.systemDreamingHint}),t[107]=n.systemDreamingHint,t[108]=G);let K;t[109]!==h||t[110]!==n||t[111]!==c||t[112]!==o||t[113]!==S||t[114]!==b||t[115]!==_||t[116]!==x||t[117]!==v||t[118]!==g||t[119]!==s||t[120]!==l?(K=c&&l.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-12`,"aria-busy":`true`,children:(0,$.jsx)(ne,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):l.length===0?(0,$.jsx)(`p`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/30 px-3 py-4 text-sm text-fg-muted dark:border-edge-subtle`,children:n.systemDreamingEmpty}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-[repeat(auto-fill,minmax(280px,1fr))]`,children:l.map(e=>(0,$.jsx)(vn,{job:e,c:n,localeTag:o,scheduleBadgeLabels:s,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:b,onRunNow:x,onDelete:S},e.id))}),t[109]=h,t[110]=n,t[111]=c,t[112]=o,t[113]=S,t[114]=b,t[115]=_,t[116]=x,t[117]=v,t[118]=g,t[119]=s,t[120]=l,t[121]=K):K=t[121];let q;t[122]!==W||t[123]!==G||t[124]!==K?(q=(0,$.jsxs)(`div`,{children:[W,G,K]}),t[122]=W,t[123]=G,t[124]=K,t[125]=q):q=t[125];let ee;return t[126]!==w||t[127]!==T||t[128]!==E||t[129]!==B||t[130]!==q||t[131]!==F||t[132]!==I?(ee=(0,$.jsxs)(`section`,{"aria-labelledby":F,className:I,children:[w,T,E,B,q]}),t[126]=w,t[127]=T,t[128]=E,t[129]=B,t[130]=q,t[131]=F,t[132]=I,t[133]=ee):ee=t[133],ee}function Sn(e,t){let n=e.templates;if(!n||typeof n!=`object`)return;let r=n[t];if(!r||typeof r!=`object`)return;let i=r.title?.trim(),a=r.prompt?.trim();if(!(!i||!a))return{title:i,description:(r.description??``).trim(),prompt:a}}var Cn=[`daily`,`monitoring`,`reports`,`automation`],wn=[{templateId:`morning_briefing`,category:`daily`,defaultSchedule:`0 7 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`standup_prep`,category:`daily`,defaultSchedule:`0 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`meeting_prep`,category:`daily`,defaultSchedule:`0 9 * * 1-5`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`meeting_prep`},{templateId:`end_of_day_wrap_up`,category:`daily`,defaultSchedule:`0 18 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`inbox_triage`,category:`daily`,defaultSchedule:`30 8 * * 1-5`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`inbox_triage`},{templateId:`competitor_watch`,category:`monitoring`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`competitor_scan`},{templateId:`trending_topics_monitor`,category:`monitoring`,defaultSchedule:`0 10 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`tech_radar_stack`,category:`monitoring`,defaultSchedule:`0 11 * * 3`,defaultSessionTarget:`isolated`},{templateId:`dependency_check_audit`,category:`monitoring`,defaultSchedule:`0 9 * * 0`,defaultSessionTarget:`isolated`},{templateId:`weekly_review`,category:`reports`,defaultSchedule:`0 17 * * 5`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`weekly_review`},{templateId:`code_quality_report`,category:`reports`,defaultSchedule:`0 14 * * 1`,defaultSessionTarget:`isolated`},{templateId:`git_activity_summary`,category:`reports`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`user_feedback_digest`,category:`reports`,defaultSchedule:`0 16 * * 5`,defaultSessionTarget:`isolated`},{templateId:`content_repurpose`,category:`reports`,defaultSchedule:`0 11 * * 4`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`content_repurpose`},{templateId:`stale_todo_or_issue_sweep`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`},{templateId:`release_notes_or_changelog_draft`,category:`automation`,defaultSchedule:`0 10 * * 4`,defaultSessionTarget:`isolated`},{templateId:`client_proposal`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`client_proposal`},{templateId:`offer_design`,category:`automation`,defaultSchedule:`0 14 1 * *`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`offer_design`},{templateId:`decision_compare`,category:`automation`,defaultSchedule:`0 15 * * 3`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`decision_compare`},{templateId:`workspace_cleanup_suggestions`,category:`automation`,defaultSchedule:`30 18 * * 5`,defaultSessionTarget:`isolated`},{templateId:`smoke_or_ci_health_reminder`,category:`automation`,defaultSchedule:`0 8 * * 1`,defaultSessionTarget:`isolated`}];function Tn(e){return wn.find(t=>t.templateId===e)}function En(e,t,n){let r=t.trim().toLowerCase();return wn.filter(t=>{if(n!==`all`&&t.category!==n)return!1;if(!r)return!0;let i=Sn(e,t.templateId);return[t.templateId,i?.title,i?.description,e.templateCategories[t.category]].filter(Boolean).join(` `).toLowerCase().includes(r)})}function Dn(e){let t=new Map;for(let n of e){let e=t.get(n.category)??[];e.push(n),t.set(n.category,e)}return Cn.flatMap(e=>{let n=t.get(e);return n?.length?[{category:e,items:n}]:[]})}function On(e){let t=(0,Q.c)(23),{template:n,cron:r,localeTag:a,scheduleBadgeLabels:o,onSelectTemplate:s}=e,c;t[0]!==r||t[1]!==n.templateId?(c=Sn(r,n.templateId),t[0]=r,t[1]=n.templateId,t[2]=c):c=t[2];let l=c;if(!l)return null;let u;t[3]!==a||t[4]!==o||t[5]!==n.defaultSchedule?(u=Oe({schedule:We(n.defaultSchedule),nextRunAtMs:void 0},a,o),t[3]=a,t[4]=o,t[5]=n.defaultSchedule,t[6]=u):u=t[6];let d=u,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=i(`flex h-full flex-col gap-1.5 rounded-xl border border-edge-subtle bg-surface-base p-4 text-left transition-colors`,`hover:border-accent/40 hover:bg-surface-hover`,G.focusRingPanel),t[7]=f):f=t[7];let p;t[8]!==s||t[9]!==n.templateId?(p=()=>s(n.templateId),t[8]=s,t[9]=n.templateId,t[10]=p):p=t[10];let m=`${r.templateCategories[n.category]} — ${l.title}`,h;t[11]===l.title?h=t[12]:(h=(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:l.title}),t[11]=l.title,t[12]=h);let g;t[13]===l.description?g=t[14]:(g=(0,$.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:l.description}),t[13]=l.description,t[14]=g);let _;t[15]===d?_=t[16]:(_=(0,$.jsx)(`span`,{className:`mt-auto flex items-center gap-1 pt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`span`,{className:`tabular-nums`,children:d})}),t[15]=d,t[16]=_);let v;return t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,$.jsxs)(`button`,{type:`button`,className:f,onClick:p,"aria-label":m,children:[h,g,_]}),t[17]=p,t[18]=m,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}function kn(e){let t=(0,Q.c)(49),{cron:n,localeTag:r,scheduleBadgeLabels:a,categoryFilter:o,onCategoryFilterChange:s,onSelectTemplate:c,variant:l}=e,u=l===void 0?`embedded`:l,[d,f]=(0,Z.useState)(``),p;t[0]!==o||t[1]!==n||t[2]!==d?(p=En(n,d,o),t[0]=o,t[1]=n,t[2]=d,t[3]=p):p=t[3];let m=p,h;t[4]===m?h=t[5]:(h=Dn(m),t[4]=m,t[5]=h);let g=h,_;t[6]!==o||t[7]!==d?(_=o===`all`&&!d.trim(),t[6]=o,t[7]=d,t[8]=_):_=t[8];let v=_,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=y):y=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>f(e.target.value),t[10]=b):b=t[10];let x=n.templateSearchPlaceholder,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=i(`h-10 w-full rounded-xl border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,G.focusRingPanel),t[11]=S):S=t[11];let C;t[12]!==n.templateSearchPlaceholder||t[13]!==d?(C=(0,$.jsxs)(`div`,{className:`relative`,children:[y,(0,$.jsx)(`input`,{value:d,onChange:b,placeholder:x,className:S})]}),t[12]=n.templateSearchPlaceholder,t[13]=d,t[14]=C):C=t[14];let w=n.fromTemplate,T=o===`all`?`secondary`:`ghost`,E;t[15]===s?E=t[16]:(E=()=>s(`all`),t[15]=s,t[16]=E);let D;t[17]!==n.templateFilterAll||t[18]!==T||t[19]!==E?(D=(0,$.jsx)(Y,{type:`button`,variant:T,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:E,children:n.templateFilterAll}),t[17]=n.templateFilterAll,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O;t[21]!==o||t[22]!==n.templateCategories||t[23]!==s?(O=Cn.map(e=>(0,$.jsx)(Y,{type:`button`,variant:o===e?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>s(e),children:n.templateCategories[e]},e)),t[21]=o,t[22]=n.templateCategories,t[23]=s,t[24]=O):O=t[24];let k;t[25]!==n.fromTemplate||t[26]!==D||t[27]!==O?(k=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":w,children:[D,O]}),t[25]=n.fromTemplate,t[26]=D,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==k||t[30]!==C?(A=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[C,k]}),t[29]=k,t[30]=C,t[31]=A):A=t[31];let j=A,M;t[32]!==n||t[33]!==m||t[34]!==g||t[35]!==r||t[36]!==c||t[37]!==a||t[38]!==v||t[39]!==u?(M=m.length===0?(0,$.jsx)(`div`,{className:i(`text-center text-sm text-fg-muted`,u===`dialog`&&`flex h-full flex-col items-center justify-center px-4 py-12`),children:n.templatesEmptyHint}):v?(0,$.jsx)(`div`,{className:`flex flex-col gap-6 pb-1`,children:g.map(e=>(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n.templateCategories[e.category]}),(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:e.items.map(e=>(0,$.jsx)(On,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:a,onSelectTemplate:c},e.templateId))})]},e.category))}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pb-1 sm:grid-cols-2 xl:grid-cols-3`,children:m.map(e=>(0,$.jsx)(On,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:a,onSelectTemplate:c},e.templateId))}),t[32]=n,t[33]=m,t[34]=g,t[35]=r,t[36]=c,t[37]=a,t[38]=v,t[39]=u,t[40]=M):M=t[40];let N=M;if(u===`dialog`){let e;t[41]===N?e=t[42]:(e=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:N}),t[41]=N,t[42]=e);let n;return t[43]!==j||t[44]!==e?(n=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[j,e]}),t[43]=j,t[44]=e,t[45]=n):n=t[45],n}let P;return t[46]!==j||t[47]!==N?(P=(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[j,N]}),t[46]=j,t[47]=N,t[48]=P):P=t[48],P}function An(e){let t=(0,Q.c)(49),{c:n,localeTag:r,scheduleBadgeLabels:a,loading:o,jobsCount:s,sortedJobs:c,templateCategoryFilter:l,onTemplateCategoryFilterChange:u,onSelectTemplate:d,keepAwake:f,wakeSupported:p,onWakeUnsupportedClick:m,onKeepAwakeToggle:h,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:v,onToggle:y,onEdit:b,onAddJob:x,onRunNow:S,onDelete:C}=e,w;t[0]===n.tabMyTasks?w=t[1]:(w=(0,$.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),t[0]=n.tabMyTasks,t[1]=w);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(N,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=T):T=t[2];let E;t[3]===n.wakeBanner?E=t[4]:(E=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[T,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[3]=n.wakeBanner,t[4]=E);let D;t[5]===n.keepAwake?D=t[6]:(D=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[5]=n.keepAwake,t[6]=D);let O=!p,k=p?void 0:n.wakeLockUnavailable,A=f?`justify-end bg-accent`:`justify-start bg-surface-hover`,j=!p&&`cursor-not-allowed opacity-50`,M;t[7]!==A||t[8]!==j?(M=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,A,j),t[7]=A,t[8]=j,t[9]=M):M=t[9];let P;t[10]!==h||t[11]!==m||t[12]!==p?(P=()=>{p?h():m()},t[10]=h,t[11]=m,t[12]=p,t[13]=P):P=t[13];let F;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[14]=F):F=t[14];let I;t[15]!==f||t[16]!==P||t[17]!==O||t[18]!==k||t[19]!==M?(I=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":f,disabled:O,title:k,className:M,onClick:P,children:F}),t[15]=f,t[16]=P,t[17]=O,t[18]=k,t[19]=M,t[20]=I):I=t[20];let L;t[21]!==I||t[22]!==D?(L=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[D,I]}),t[21]=I,t[22]=D,t[23]=L):L=t[23];let R;t[24]!==L||t[25]!==E?(R=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[E,L]}),t[24]=L,t[25]=E,t[26]=R):R=t[26];let z;t[27]!==g||t[28]!==n||t[29]!==s||t[30]!==o||t[31]!==r||t[32]!==x||t[33]!==C||t[34]!==b||t[35]!==v||t[36]!==S||t[37]!==d||t[38]!==u||t[39]!==y||t[40]!==_||t[41]!==a||t[42]!==c||t[43]!==l?(z=o&&s===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,$.jsx)(ne,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):s===0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-6 rounded-2xl bg-surface-base px-4 py-8 dark:bg-surface-hover/25 sm:px-6 sm:py-10`,children:[(0,$.jsx)(`div`,{className:`w-full max-w-6xl`,children:(0,$.jsx)(kn,{cron:n,localeTag:r,scheduleBadgeLabels:a,categoryFilter:l,onCategoryFilterChange:u,onSelectTemplate:d})}),(0,$.jsx)(`div`,{className:`flex justify-center`,children:(0,$.jsx)(Y,{type:`button`,variant:`primary`,onClick:x,children:n.emptyStateCta})})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-[repeat(auto-fill,minmax(280px,1fr))]`,children:c.map(e=>(0,$.jsx)(vn,{job:e,c:n,localeTag:r,scheduleBadgeLabels:a,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:e=>void v(e),onToggle:(e,t)=>void y(e,t),onEdit:b,onRunNow:S,onDelete:C},e.id))}),t[27]=g,t[28]=n,t[29]=s,t[30]=o,t[31]=r,t[32]=x,t[33]=C,t[34]=b,t[35]=v,t[36]=S,t[37]=d,t[38]=u,t[39]=y,t[40]=_,t[41]=a,t[42]=c,t[43]=l,t[44]=z):z=t[44];let B;return t[45]!==w||t[46]!==R||t[47]!==z?(B=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[w,R,z]}),t[45]=w,t[46]=R,t[47]=z,t[48]=B):B=t[48],B}function jn(e){let t=(0,Q.c)(29),{open:n,onOpenChange:r,c:a,localeTag:o,scheduleBadgeLabels:s,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(V,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=i(`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(90vh,840px)] w-full max-w-5xl flex-col`,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,G.focusRingPanel),t[1]=f):f=t[1];let p;t[2]===a.fromTemplate?p=t[3]:(p=(0,$.jsx)(I,{className:`text-lg font-semibold text-fg`,children:a.fromTemplate}),t[2]=a.fromTemplate,t[3]=p);let m;t[4]===a.templatePickerHint?m=t[5]:(m=(0,$.jsx)(xe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.templatePickerHint}),t[4]=a.templatePickerHint,t[5]=m);let h;t[6]!==p||t[7]!==m?(h=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(ce,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=g):g=t[9];let _;t[10]===a.close?_=t[11]:(_=(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:g})}),t[10]=a.close,t[11]=_);let y;t[12]!==h||t[13]!==_?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge-subtle px-6 py-5`,children:[h,_]}),t[12]=h,t[13]=_,t[14]=y):y=t[14];let x;t[15]!==a||t[16]!==c||t[17]!==o||t[18]!==l||t[19]!==u||t[20]!==s?(x=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-6 py-5`,children:(0,$.jsx)(kn,{variant:`dialog`,cron:a,localeTag:o,scheduleBadgeLabels:s,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u})}),t[15]=a,t[16]=c,t[17]=o,t[18]=l,t[19]=u,t[20]=s,t[21]=x):x=t[21];let S;t[22]!==y||t[23]!==x?(S=(0,$.jsxs)(C,{children:[d,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(v,{className:f,onOpenAutoFocus:Mn,children:[y,x]})})]}),t[22]=y,t[23]=x,t[24]=S):S=t[24];let w;return t[25]!==r||t[26]!==n||t[27]!==S?(w=(0,$.jsx)(b,{open:n,onOpenChange:r,children:S}),t[25]=r,t[26]=n,t[27]=S,t[28]=w):w=t[28],w}function Mn(e){return e.preventDefault()}function Nn(){return{formOpen:!1,formMode:`add`,formJobId:null,formName:``,formSchedule:We(_t),formChannel:`local`,formChatId:``,formMessage:``,formMessageMdMode:`edit`,formTaskKind:`message`,formWorkflowDefinitionId:``,formWorkflowGoal:``,formWorkflowArgValues:{},messageEditorNonce:0,formSessionTarget:`main`,formAgentId:``,formAgentLocalOnly:!1,formWorkingDirectory:``,formModel:``,formSubmitting:!1}}function Pn(e,t){switch(t.type){case`patch`:return{...e,...t.patch};case`replace`:return t.state;case`setMessageMdMode`:return{...e,formMessageMdMode:t.mode,messageEditorNonce:t.mode===`edit`?e.messageEditorNonce+1:e.messageEditorNonce}}}function Fn(e,t){let n=Nn();if(n.formOpen=!0,n.formMode=e?`edit`:`add`,n.formJobId=e?.id??null,!e)return n.formModel=t(),n;if(n.formName=e.name||``,n.formSchedule=e.schedule,n.formMessage=Re(e)??``,e.payload.kind===`workflowRun`){n.formTaskKind=`workflowRun`,n.formWorkflowDefinitionId=e.payload.definitionId,n.formWorkflowGoal=e.payload.goal||``,n.formWorkflowArgValues=Zt(e.payload.definitionId,e.payload.inputEnvelope?.payload??e.payload.input??{});let t=e.payload.agentId?.trim().toLowerCase();t&&(n.formAgentId=t)}n.formSessionTarget=e.sessionTarget===`isolated`?`isolated`:`main`,n.formAgentId=(e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``,n.formWorkingDirectory=(e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``;let r=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;n.formModel=e.model?.trim()||r||t();let i=e.delivery?.channel===`local`;return n.formAgentLocalOnly=(e.sessionTarget||`main`)===`isolated`&&!i&&(!e.delivery?.to||e.delivery.mode===`none`),i?(n.formChannel=`local`,n.formChatId=``):e.delivery&&e.delivery.mode!==`none`&&e.delivery.to?(n.formChannel=e.delivery.channel||`telegram`,n.formChatId=e.delivery.to||``):(n.formChannel=`telegram`,n.formChatId=``),n.formMessageMdMode=`edit`,n.messageEditorNonce=1,n}function In(e){let{m:t,defaultModelForForm:n,channels:r,chatAgents:i}=e,[a,o]=(0,Z.useReducer)(Pn,void 0,Nn),s=(0,Z.useRef)(!1),c=(0,Z.useMemo)(()=>new Set([`local`,...r.map(e=>e.name)]),[r]);if(a.formOpen&&a.formMode===`add`&&!c.has(a.formChannel)&&o({type:`patch`,patch:{formChannel:`local`}}),a.formOpen&&a.formMode===`add`&&!s.current){let e=n();e&&e!==a.formModel&&o({type:`patch`,patch:{formModel:e}})}let l=Se(()=>Pe(a.formChannel),[a.formChannel],{enabled:a.formOpen&&a.formChannel!==`local`,initial:[],errorData:[]}),u=a.formChannel===`local`?[]:l.data,d=(0,Z.useMemo)(()=>{let e=new Set(i.map(e=>e.id)),t=[...i],n=a.formAgentId.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[i,a.formAgentId]),f=a.formChannel!==`local`&&(a.formTaskKind===`message`&&(a.formSessionTarget===`main`||a.formSessionTarget===`isolated`&&!a.formAgentLocalOnly)||a.formTaskKind===`workflowRun`&&!a.formAgentLocalOnly),p=a.formTaskKind===`workflowRun`?!a.formAgentLocalOnly:a.formTaskKind===`message`&&(a.formSessionTarget===`main`||a.formSessionTarget===`isolated`&&!a.formAgentLocalOnly),m=a.formTaskKind===`workflowRun`?!!a.formWorkflowDefinitionId.trim()&&Qt(a.formWorkflowDefinitionId.trim(),a.formWorkflowArgValues):!!a.formMessage.trim(),h=a.formSchedule.kind===`cron`?!!a.formSchedule.expr.trim():a.formSchedule.kind===`at`?!!a.formSchedule.at.trim():Number.isFinite(a.formSchedule.everyMs)&&a.formSchedule.everyMs>0,g=!!a.formName.trim()&&h&&m&&(!f||!!a.formChatId.trim()),_=(0,Z.useCallback)(e=>{s.current=!1,o({type:`replace`,state:Fn(e,n)})},[n]),v=(0,Z.useCallback)(e=>{o({type:`setMessageMdMode`,mode:e})},[]),y=(0,Z.useCallback)(e=>{let r=Tn(e),i=r?Sn(t.cron,e):void 0;if(!r||!i)return!1;let a=r.taskKind===`workflowRun`&&!!r.workflowDefinitionId;return s.current=!1,o({type:`replace`,state:{...Nn(),formOpen:!0,formMode:`add`,formName:i.title,formSchedule:We(r.defaultSchedule),formMessage:a?``:i.prompt,formTaskKind:a?`workflowRun`:`message`,formWorkflowDefinitionId:a?r.workflowDefinitionId:``,formWorkflowGoal:a?i.description:``,formSessionTarget:r.defaultSessionTarget,formModel:n(),formAgentLocalOnly:a,messageEditorNonce:1}}),!0},[n,t.cron]),b=(0,Z.useCallback)(()=>{s.current=!1,o({type:`replace`,state:Nn()})},[]),x=(0,Z.useCallback)((e,t,n)=>{let r={formSessionTarget:e};e===`main`?(r.formAgentLocalOnly=!1,r.formAgentId=``,r.formWorkingDirectory=``):e===`isolated`&&!n&&(r.formModel=t()),o({type:`patch`,patch:r})},[]),S=(0,Z.useCallback)(e=>{o({type:`patch`,patch:{formChannel:e,formChatId:``,...e===`local`?{formAgentLocalOnly:!1}:{}}})},[]),C=(0,Z.useCallback)(e=>{s.current=!0,o({type:`patch`,patch:{formModel:e}})},[]),w=(0,Z.useCallback)(()=>{Pe(a.formChannel).then(l.setData)},[a.formChannel,l.setData]),T=(0,Z.useCallback)(e=>{o({type:`patch`,patch:e})},[]);return{formOpen:a.formOpen,formMode:a.formMode,formJobId:a.formJobId,formName:a.formName,formSchedule:a.formSchedule,formChannel:a.formChannel,formChatId:a.formChatId,formMessage:a.formMessage,formMessageMdMode:a.formMessageMdMode,formTaskKind:a.formTaskKind,formWorkflowDefinitionId:a.formWorkflowDefinitionId,formWorkflowGoal:a.formWorkflowGoal,formWorkflowArgValues:a.formWorkflowArgValues,messageEditorNonce:a.messageEditorNonce,formSessionTarget:a.formSessionTarget,formAgentId:a.formAgentId,formAgentLocalOnly:a.formAgentLocalOnly,formWorkingDirectory:a.formWorkingDirectory,formModel:a.formModel,formSubmitting:a.formSubmitting,sessionChatIds:u,setFormName:e=>T({formName:e}),setFormSchedule:e=>T({formSchedule:e}),setFormChatId:e=>T({formChatId:e}),setFormMessage:e=>T({formMessage:e}),setFormTaskKind:e=>T(e===`workflowRun`?{formTaskKind:e,formSessionTarget:`isolated`,formAgentLocalOnly:!1}:{formTaskKind:e}),setFormWorkflowDefinitionId:e=>T({formWorkflowDefinitionId:e,formWorkflowArgValues:{}}),setFormWorkflowGoal:e=>T({formWorkflowGoal:e}),setFormWorkflowArgValues:e=>T({formWorkflowArgValues:e}),setFormAgentId:e=>T({formAgentId:e}),setFormAgentLocalOnly:e=>T({formAgentLocalOnly:e}),setFormWorkingDirectory:e=>T({formWorkingDirectory:e}),setFormSubmitting:e=>T({formSubmitting:e}),canSubmit:g,needsDeliveryChat:f,showChannelPicker:p,cronAgentSelectOptions:d,openForm:_,closeForm:b,applyCronTemplate:y,setMessageMdMode:v,handleFormSessionTargetChange:x,handleFormChannelChange:S,handleFormModelUserChange:C,refreshRecipientsList:w}}function Ln(e){let{onUnavailable:t}=e,[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(`none`),o=(0,Z.useRef)(n),s=typeof navigator<`u`&&`wakeLock`in navigator,c=s||D(),l=(0,Z.useCallback)(async()=>{if(a.current===`electron`){try{await window.electronAPI?.cron?.setDisplaySleepPrevented?.(!1)}catch{}a.current=`none`;return}try{await i.current?.release()}catch{}i.current=null,a.current=`none`},[]),u=(0,Z.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.cron?.setDisplaySleepPrevented:void 0;if(e)try{await e(!0),a.current=`electron`;return}catch{t(),r(!1);return}if(s)try{let e=await navigator.wakeLock.request(`screen`);i.current=e,a.current=`navigator`,e.addEventListener(`release`,()=>{i.current=null,a.current=`none`})}catch{t(),r(!1)}},[t,s]);return o.current=n,(0,Z.useEffect)(()=>{if(!n){l();return}u();let e=()=>{document.visibilityState===`visible`&&o.current&&u()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),l()}},[n,u,l]),{keepAwake:n,setKeepAwake:r,featureAvailable:c}}function Rn(e){let{hasToken:t,failMessages:n,isHistoryTab:r}=e,[i,a]=(0,Z.useState)([]),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)([]),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)([]),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)([]),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),w=(0,Z.useCallback)(async()=>{x(!0),C(null);try{a(await Fe())}catch(e){C(e instanceof Error?e.message:n.failedToLoadJobs)}finally{x(!1)}},[n.failedToLoadJobs]),T=(0,Z.useCallback)(async()=>{try{let[e,t,n,r,i]=await Promise.all([He(),qe(),Ge(),A(),he().catch(()=>null)]);s(e),l(t),d(n.model||``),h(r.payload?.config??null),i&&p(i.items)}catch{}},[]),E=(0,Z.useCallback)(async()=>{y(!0);try{_(await je(400))}catch{}finally{y(!1)}},[]);return(0,Z.useEffect)(()=>{t&&(w(),T())},[t,w,T]),(0,Z.useEffect)(()=>{if(!t)return;let e=()=>{A().then(e=>{h(e.payload?.config??null)})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[t]),(0,Z.useEffect)(()=>{!t||!r||E()},[t,r,E]),{jobs:i,channels:o,availableModels:c,defaultModel:u,chatAgents:f,gatewayConfigRaw:m,runHistory:g,runHistoryLoading:v,loading:b,error:S,setError:C,userCronJobs:(0,Z.useMemo)(()=>i.filter(e=>!Qe(e)),[i]),systemCronJobs:(0,Z.useMemo)(()=>i.filter(e=>Qe(e)),[i]),heartbeatFromConfig:(0,Z.useMemo)(()=>tt(m),[m]),loadJobs:w,loadAux:T,loadRunHistoryOnly:E,refreshAll:(0,Z.useCallback)(()=>{w(),T(),E()},[w,T,E])}}function zn(e,t){let n=[...e];return n.sort((e,n)=>{let r=e.createdAtMs,i=n.createdAtMs;return t===`created_desc`?i-r:r-i}),n}function Bn(e,t,n,r){let i=new Date,a=t===`day`?vt(i):t===`week`?yt(i):bt(i);return e.filter(e=>!(new Date(e.startedAt)<a||n&&e.jobId!==n||r&&e.status!==r))}var Vn={mainTab:`myTasks`,jobSort:`created_desc`,historyRange:`day`,historyJobFilter:``,historyStatusFilter:``,detailOpen:!1,detailJob:null,detailHistory:[],detailLoading:!1,detailActionNotice:null,confirmOpen:!1,templatePickerOpen:!1,templateCategoryFilter:`all`};function Hn(){let e=o(e=>e.language),t=a(e),n=t.cron,r=t.chat,i=c(e=>e.token),l=!!i,u=s(e=>e.resolved)===`dark`,d=e===`zh`?`zh-CN`:`en-US`,[f,m]=ee(),[h,g]=(0,Z.useReducer)(_e,f,e=>({...Vn,mainTab:Dt(e.get(`tab`))})),{mainTab:_,jobSort:v,historyRange:y,historyJobFilter:b,historyStatusFilter:x,detailOpen:S,detailJob:C,detailHistory:w,detailLoading:T,detailActionNotice:E,confirmOpen:D,templatePickerOpen:O,templateCategoryFilter:k}=h,A=Dt(f.get(`tab`));(0,Z.useEffect)(()=>{A!==_&&g({type:`patch`,patch:{mainTab:A}})},[A,_]);let M=(0,Z.useCallback)(e=>{g({type:`patch`,patch:{mainTab:e}}),m(t=>{let n=new URLSearchParams(t),r=Ot(e);return r?n.set(`tab`,r):n.delete(`tab`),n},{replace:!0})},[m]),N=Rn({hasToken:l,failMessages:{failedToLoadJobs:n.failedToLoadJobs},isHistoryTab:_===`history`}),{setError:P}=N,F=Ln({onUnavailable:()=>P(n.wakeLockUnavailable)}),I=(0,Z.useCallback)(()=>N.defaultModel||(N.availableModels.length>0?N.availableModels[0].id:``),[N.defaultModel,N.availableModels]),L=In({m:t,defaultModelForForm:I,channels:N.channels,chatAgents:N.chatAgents}),R=p(l&&L.formOpen?[`workflow-definitions-cron`,i]:null,j,{revalidateOnFocus:!1}),z=R.data??[],B=(0,Z.useRef)(null),V=(0,Z.useRef)(null),H=(0,Z.useCallback)((e,t)=>{B.current=e,V.current=t,g({type:`patch`,patch:{confirmOpen:!0}})},[]),U=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{confirmOpen:!1}}),V.current=null,B.current=null},[]),W=(0,Z.useRef)(null),G=(0,Z.useCallback)(e=>{W.current=e,window.setTimeout(()=>{W.current===e&&(W.current=null)},400)},[]),K=(0,Z.useCallback)(e=>{L.applyCronTemplate(e)&&g({type:`patch`,patch:{templatePickerOpen:!1}})},[L]),q=async()=>{if(!L.formName.trim()){P(n.nameRequired);return}if(L.formSchedule.kind===`cron`&&!L.formSchedule.expr.trim()||L.formSchedule.kind===`at`&&!L.formSchedule.at.trim()||L.formSchedule.kind===`every`&&(!Number.isFinite(L.formSchedule.everyMs)||L.formSchedule.everyMs<=0)){P(n.scheduleRequired);return}if(L.formTaskKind===`message`&&!L.formMessage.trim()){P(n.scheduleRequired);return}if(L.formTaskKind===`workflowRun`&&!L.formWorkflowDefinitionId.trim()){P(n.workflowDefinitionRequired);return}if(L.formTaskKind===`workflowRun`&&!Qt(L.formWorkflowDefinitionId.trim(),L.formWorkflowArgValues)){P(n.workflowArgsRequired);return}if(L.needsDeliveryChat&&!L.formChatId.trim()){P(n.chatIdRequired);return}L.setFormSubmitting(!0),P(null);try{let e=L.formMessage.trim(),t=L.formModel.trim(),n=L.formAgentId.trim().toLowerCase(),r=L.formWorkingDirectory.trim(),i=L.formTaskKind===`workflowRun`,a=L.formTaskKind===`message`&&L.formSessionTarget===`isolated`,o=i?`isolated`:L.formSessionTarget,s;s=i?L.formAgentLocalOnly?{mode:`none`}:L.formChannel===`local`?{mode:`announce`,channel:`local`}:{mode:`announce`,channel:L.formChannel,to:L.formChatId.trim()}:L.formSessionTarget===`isolated`&&L.formAgentLocalOnly?{mode:`none`}:L.formChannel===`local`?{mode:`announce`,channel:`local`}:{mode:`announce`,channel:L.formChannel,to:L.formChatId.trim()};let c;if(i){let e=L.formWorkflowDefinitionId.trim(),t=de(L.formWorkflowArgValues);c={kind:`workflowRun`,definitionId:e,...t===void 0?{}:{inputEnvelope:{payload:t}},...L.formWorkflowGoal.trim()?{goal:L.formWorkflowGoal.trim()}:{},...n?{agentId:n}:{}}}else c=a?{kind:`agentTurn`,message:e,...t?{model:t}:{}}:{kind:`systemEvent`,text:e};let l=o===`main`?null:n||null,u={name:L.formName.trim(),schedule:L.formSchedule,sessionTarget:o,delivery:s,payload:c,...L.formMode===`edit`?{...l?{agentId:l}:{},...a&&r?{workingDirectory:r}:{}}:{...o===`isolated`&&n?{agentId:n}:{},...a&&r?{workingDirectory:r}:{}}};if(L.formMode===`edit`&&L.formJobId)await Ie(L.formJobId,u);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=u;await Ve(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}L.closeForm(),await N.loadJobs()}catch(e){P(e instanceof Error?e.message:L.formMode===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{L.setFormSubmitting(!1)}},te=async e=>{g({type:`patch`,patch:{detailOpen:!0,detailJob:e,detailLoading:!0,detailHistory:[],detailActionNotice:null}});try{let t=await ze(e.id);t&&g({type:`patch`,patch:{detailJob:t,detailHistory:await Ne(e.id,20)}})}catch{}finally{g({type:`patch`,patch:{detailLoading:!1}})}},ne=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{detailOpen:!1,detailJob:null,detailActionNotice:null}})},[]),J=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{templateCategoryFilter:`all`,templatePickerOpen:!0}})},[]),re=async(e,t)=>{try{await Le(e.id,t),C?.id===e.id&&g({type:`patch`,patch:{detailJob:{...C,enabled:t}}}),await Promise.all([N.loadJobs(),N.loadAux()])}catch(e){P(e instanceof Error?e.message:n.failedToToggleJob)}},ie=async()=>{let e=V.current,t=B.current;if(!(!e||!t)){U();try{if(t===`run`){let t=await Be(e);C?.id===e&&g({type:`patch`,patch:{detailJob:t.job??await ze(e),detailHistory:t.history??await Ne(e,20),detailActionNotice:{kind:`info`,message:n.runStarted}}})}else await Ue(e),C?.id===e&&g({type:`patch`,patch:{detailOpen:!1,detailJob:null}});await Promise.all([N.loadJobs(),N.loadAux(),N.loadRunHistoryOnly()])}catch(r){let i=r instanceof Error?r.message:n.actionFailed;if(t===`run`&&C?.id===e){let t=await ze(e).catch(()=>null),a=await Ne(e,20).catch(()=>w),o=r instanceof Ke&&r.code===`job_already_running`?r.runningSessionKey||t?.state?.runningSessionKey||a.find(e=>e.status===`running`)?.sessionKey:t?.state?.runningSessionKey||a.find(e=>e.status===`running`)?.sessionKey;g({type:`patch`,patch:{...t?{detailJob:t}:{},detailHistory:a,detailActionNotice:{kind:`error`,message:i.includes(`already running`)?n.jobAlreadyRunning:i,...o?{sessionKey:o}:{}}}})}else P(i)}}};(0,Z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(L.formOpen?L.closeForm():S&&g({type:`patch`,patch:{detailOpen:!1,detailJob:null}}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[L,S]);let ae=(0,Z.useMemo)(()=>({running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled}),[n.execStatusCancelled,n.execStatusFailed,n.execStatusRunning,n.execStatusSuccess]),oe=(0,Z.useMemo)(()=>zn(N.userCronJobs,v),[N.userCronJobs,v]),se=(0,Z.useMemo)(()=>zn(N.systemCronJobs,v),[N.systemCronJobs,v]),ce=(0,Z.useMemo)(()=>Bn(N.runHistory,y,b,x),[N.runHistory,y,b,x]),le=n.scheduleBadge;return l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Un,{hasToken:l,c:n,loading:N.loading,runHistoryLoading:N.runHistoryLoading,onRefresh:N.refreshAll,onOpenTemplatePicker:J,onAddJob:()=>L.openForm()}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[N.error?(0,$.jsx)(`div`,{className:`rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,role:`alert`,children:N.error}):null,(0,$.jsx)(mn,{c:n,mainTab:_,onMainTabChange:M,jobSort:v,onJobSortChange:e=>g({type:`patch`,patch:{jobSort:e}}),historyRange:y,onHistoryRangeChange:e=>g({type:`patch`,patch:{historyRange:e}}),historyJobFilter:b,onHistoryJobFilterChange:e=>g({type:`patch`,patch:{historyJobFilter:e}}),historyStatusFilter:x,onHistoryStatusFilterChange:e=>g({type:`patch`,patch:{historyStatusFilter:e}}),jobs:N.jobs}),_===`myTasks`?(0,$.jsx)(An,{c:n,localeTag:d,scheduleBadgeLabels:le,loading:N.loading,jobsCount:N.userCronJobs.length,sortedJobs:oe,templateCategoryFilter:k,onTemplateCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K,keepAwake:F.keepAwake,wakeSupported:F.featureAvailable,onWakeUnsupportedClick:()=>P(n.wakeLockUnavailable),onKeepAwakeToggle:()=>F.setKeepAwake(e=>!e),absorbCardClickJobIdRef:W,scheduleAbsorbNextMenuCardClick:G,onOpenDetail:e=>void te(e),onToggle:(e,t)=>void re(e,t),onEdit:e=>L.openForm(e),onAddJob:()=>L.openForm(),onRunNow:e=>H(`run`,e.id),onDelete:e=>H(`delete`,e.id)}):_===`systemTasks`?(0,$.jsx)(xn,{c:n,language:e,localeTag:d,scheduleBadgeLabels:le,loading:N.loading,sortedSystemJobs:se,heartbeat:N.heartbeatFromConfig,keepAwake:F.keepAwake,wakeSupported:F.featureAvailable,onWakeUnsupportedClick:()=>P(n.wakeLockUnavailable),onKeepAwakeToggle:()=>F.setKeepAwake(e=>!e),absorbCardClickJobIdRef:W,scheduleAbsorbNextMenuCardClick:G,onOpenDetail:e=>void te(e),onToggle:(e,t)=>void re(e,t),onEdit:e=>L.openForm(e),onRunNow:e=>H(`run`,e.id),onDelete:e=>H(`delete`,e.id)}):_===`history`?(0,$.jsx)(_n,{c:n,runHistoryLoading:N.runHistoryLoading,runHistory:N.runHistory,filteredRunHistory:ce,jobs:N.jobs,onRefreshHistory:()=>void N.loadRunHistoryOnly(),onOpenJobDetail:e=>void te(e),statusLabels:ae}):(0,$.jsx)(ht,{hasToken:l})]}),(0,$.jsx)(sn,{open:L.formOpen,onRequestClose:L.closeForm,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:u,channels:N.channels,sessionChatIds:L.sessionChatIds,cronAgentSelectOptions:L.cronAgentSelectOptions,defaultModelResolver:I,formMode:L.formMode,formJobId:L.formJobId,formName:L.formName,onFormNameChange:L.setFormName,formSchedule:L.formSchedule,onFormScheduleChange:L.setFormSchedule,formSubmitting:L.formSubmitting,formTaskKind:L.formTaskKind,onFormTaskKindChange:L.setFormTaskKind,workflowDefinitions:z,workflowDefinitionsLoading:R.isLoading,formWorkflowDefinitionId:L.formWorkflowDefinitionId,onFormWorkflowDefinitionIdChange:L.setFormWorkflowDefinitionId,formWorkflowGoal:L.formWorkflowGoal,onFormWorkflowGoalChange:L.setFormWorkflowGoal,formWorkflowArgValues:L.formWorkflowArgValues,onFormWorkflowArgValuesChange:L.setFormWorkflowArgValues,formSessionTarget:L.formSessionTarget,onFormSessionTargetChange:L.handleFormSessionTargetChange,formAgentLocalOnly:L.formAgentLocalOnly,onFormAgentLocalOnlyChange:L.setFormAgentLocalOnly,formModel:L.formModel,onFormModelUserChange:L.handleFormModelUserChange,formAgentId:L.formAgentId,onFormAgentIdChange:L.setFormAgentId,formWorkingDirectory:L.formWorkingDirectory,onFormWorkingDirectoryChange:L.setFormWorkingDirectory,formChannel:L.formChannel,onFormChannelChange:L.handleFormChannelChange,formChatId:L.formChatId,onFormChatIdChange:L.setFormChatId,formMessage:L.formMessage,onFormMessageChange:L.setFormMessage,formMessageMdMode:L.formMessageMdMode,onSetMessageMdMode:L.setMessageMdMode,messageEditorNonce:L.messageEditorNonce,needsDeliveryChat:L.needsDeliveryChat,showChannelPicker:L.showChannelPicker,canSubmit:L.canSubmit,onSubmit:()=>void q(),onRefreshRecipients:L.refreshRecipientsList}),(0,$.jsx)(jn,{open:O,onOpenChange:e=>{g({type:`patch`,patch:{templatePickerOpen:e,...e?{templateCategoryFilter:`all`}:{}}})},c:n,localeTag:d,scheduleBadgeLabels:le,categoryFilter:k,onCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K}),(0,$.jsx)(Rt,{open:S,onDismiss:ne,detailJob:C,detailLoading:T,actionNotice:E,detailHistory:w,c:n,localeTag:d,scheduleBadgeLabels:le,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:ae,onEdit:e=>{L.openForm(e),window.requestAnimationFrame(()=>ne())},onRunNow:e=>H(`run`,e.id),onToggle:(e,t)=>void re(e,t),onDelete:e=>H(`delete`,e.id)}),(0,$.jsx)(st,{open:D,onOpenChange:e=>g({type:`patch`,patch:{confirmOpen:e}}),action:B.current,c:n,onDismiss:U,onConfirm:ie})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Un,{hasToken:l,c:n,loading:N.loading,runHistoryLoading:N.runHistoryLoading,onRefresh:N.refreshAll,onOpenTemplatePicker:J,onAddJob:()=>L.openForm()}),(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-16 text-center text-sm text-fg-muted sm:px-8`,children:n.needToken})]})}function Un(e){let t=(0,Q.c)(14),{hasToken:n,c:r,loading:i,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}=e,l=P(Gn),u=P(Wn),d;t[0]!==r||t[1]!==i||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==a?(d=(0,$.jsx)(gn,{c:r,loading:i,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}),t[0]=r,t[1]=i,t[2]=c,t[3]=s,t[4]=o,t[5]=a,t[6]=d):d=t[6];let f=d,p,m;return t[7]!==r.title||t[8]!==u||t[9]!==f||t[10]!==n||t[11]!==l?(p=()=>n?(l({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:f}),()=>u()):(u(),()=>u()),m=[r.title,u,f,n,l],t[7]=r.title,t[8]=u,t[9]=f,t[10]=n,t[11]=l,t[12]=p,t[13]=m):(p=t[12],m=t[13]),(0,Z.useLayoutEffect)(p,m),null}function Wn(e){return e.clearPageHeader}function Gn(e){return e.setPageHeader}export{Hn as CronPage};