@xopcai/xopc 0.0.397 → 0.0.398

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 (230) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CIEGrioy.js → agent-avatar-dicebear-Q-lKLSrc.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CobxTBV_.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-Bgmmue5K.js +77 -0
  7. package/dist/gateway/static/root/assets/{agents-admin-api-BjGOUrAf.js → agents-admin-api-DvSe10zu.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-DIJ0ii-n.js → app-management-settings-panel-CB_W2ano.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-BGnyHS-p.js → appearance-settings-B-ppSGBm.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-3qUgsGui.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-CR8FcRAa.js → archive-plugin-CeQrQ693.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-BLInZo7N.js → automations-page-Cc9vZanv.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-Bc4c_AEq.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-DW9pu205.js → binary-plugins-BqaVBv1R.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-ClgTc5v8.js → block-editor-B4ij8nZi.js} +40 -40
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-Bn7kDuUB.js → browser-automation-inputs-DngvcZH9.js} +1 -1
  17. package/dist/gateway/static/root/assets/browser-automations-page-CdqwXyYq.js +3 -0
  18. package/dist/gateway/static/root/assets/browser-settings-page-CJT0rB-I.js +3 -0
  19. package/dist/gateway/static/root/assets/{capabilities-CTfLd_UE.js → capabilities-glv1DeRI.js} +1 -1
  20. package/dist/gateway/static/root/assets/capabilities-page-C56VsP0Y.js +2 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-DZiA8JIq.js +8 -0
  22. package/dist/gateway/static/root/assets/{capability-header-actions-9ZG71-BO.js → capability-header-actions-Cu-ATcJq.js} +1 -1
  23. package/dist/gateway/static/root/assets/capability-links--dcwUjgv.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-gIjZtYnV.js +1 -0
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-x1W2_hwc.js → chat-terminal-dock-COdvmTgN.js} +2 -2
  26. package/dist/gateway/static/root/assets/computer-settings-page-C1XHsuI8.js +1 -0
  27. package/dist/gateway/static/root/assets/{connector-service-page-Kf8kaNm_.js → connector-service-page-Cv2bhnQ5.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-SmKItq0N.js +1 -0
  29. package/dist/gateway/static/root/assets/{date-picker-d5kiPUG0.js → date-picker-CCnqYwy0.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dependency-picker-BcH76tQC.js → dependency-picker-nt5ruIio.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-B-925tPX.js → desktop-pet-Bn8xj1v3.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-settings-3XJ4qR65.js → desktop-pet-settings-Cbl1J_VE.js} +1 -1
  33. package/dist/gateway/static/root/assets/device-pairing-wizard-Tadg9co1.js +1 -0
  34. package/dist/gateway/static/root/assets/{directory-picker-path-field-B-qZCjGR.js → directory-picker-path-field-DuE5ez1E.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-debug-page-BlQu1u6X.js → extension-debug-page-jsNxwqNi.js} +1 -1
  36. package/dist/gateway/static/root/assets/extension-page-N_rBjYX8.js +1 -0
  37. package/dist/gateway/static/root/assets/extension-settings-page-7qAdvlRB.js +1 -0
  38. package/dist/gateway/static/root/assets/{gateway-config-swr-Di9g6pE8.js → gateway-config-swr-DAir1JsW.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-realtime-2-o7qk92.js → gateway-realtime-dE0XrVAT.js} +1 -1
  40. package/dist/gateway/static/root/assets/gateway-realtime-store-CPlVuu0d.js +1 -0
  41. package/dist/gateway/static/root/assets/gateway-settings-ViqOhx_m.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-BCUswcVy.js → gateway-startup-retry-CqyGHM2M.js} +1 -1
  43. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-Czdbbi0H.js → highlighted-body-KQOG7T2V-XrkWdmrk.js} +1 -1
  44. package/dist/gateway/static/root/assets/home-page-C_Xn_Kkz.js +2 -0
  45. package/dist/gateway/static/root/assets/{image-generation-api-DPFPJ2ps.js → image-generation-api-CmHdM2uL.js} +1 -1
  46. package/dist/gateway/static/root/assets/{imports-page-Bwyotfbt.js → imports-page-B-dnvHP_.js} +1 -1
  47. package/dist/gateway/static/root/assets/index-DWzv8ZoO.css +1 -0
  48. package/dist/gateway/static/root/assets/{index-Dsp_gNdl.js → index-DvKDT-RQ.js} +11 -11
  49. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C20gl-l7.js → keyboard-shortcuts-settings-mCs9cDgv.js} +1 -1
  50. package/dist/gateway/static/root/assets/{local-app-workbench-page-o0M_OSjC.js → local-app-workbench-page-B7AtlfWQ.js} +1 -1
  51. package/dist/gateway/static/root/assets/{local-apps-page-DoWJCmOq.js → local-apps-page-CIJE7jME.js} +1 -1
  52. package/dist/gateway/static/root/assets/{local-session-drafts-BjwlkAKA.js → local-session-drafts-fhip41-L.js} +1 -1
  53. package/dist/gateway/static/root/assets/{locale-store-Djl2FW6_.js → locale-store-Jnhw2WMv.js} +1 -1
  54. package/dist/gateway/static/root/assets/{logs-page-BFTL93RX.js → logs-page-HawXUKF2.js} +2 -2
  55. package/dist/gateway/static/root/assets/management-settings-DByEh6rq.js +1 -0
  56. package/dist/gateway/static/root/assets/{markdown-view-DyO7Q0Ms.js → markdown-view-B58RypQ4.js} +1 -1
  57. package/dist/gateway/static/root/assets/{media-plugins-DLrTRF0a.js → media-plugins-B8BLxQgj.js} +1 -1
  58. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CZjPT7xE.js +1 -0
  59. package/dist/gateway/static/root/assets/messages-DBvKzlCl.js +3 -0
  60. package/dist/gateway/static/root/assets/note-detail-panel-hQHB5fCs.js +5 -0
  61. package/dist/gateway/static/root/assets/notes-page-BEusEk31.js +8 -0
  62. package/dist/gateway/static/root/assets/{page-context-capture-button-YTVWZ02-.js → page-context-capture-button-42bq8N6-.js} +1 -1
  63. package/dist/gateway/static/root/assets/personal-page-DPR5gzhf.js +1 -0
  64. package/dist/gateway/static/root/assets/plugin-details-dialog-D8dKKIY9.js +1 -0
  65. package/dist/gateway/static/root/assets/plugin-presentation-BrQpVvjC.js +1 -0
  66. package/dist/gateway/static/root/assets/{preview-open-alternatives-DzA__S54.js → preview-open-alternatives-DKyLVLpX.js} +1 -1
  67. package/dist/gateway/static/root/assets/{product-open-page-DvlMKj0T.js → product-open-page-DcGH0AXN.js} +1 -1
  68. package/dist/gateway/static/root/assets/{product-preview-content-qdFyo4NG.js → product-preview-content-Ck6OzP09.js} +1 -1
  69. package/dist/gateway/static/root/assets/project-detail-page-BHoQ10Eo.js +1 -0
  70. package/dist/gateway/static/root/assets/projects-page-DYsq_OLJ.js +1 -0
  71. package/dist/gateway/static/root/assets/{registry-api-BwR2CiR5.js → registry-api-BbUEMGcj.js} +1 -1
  72. package/dist/gateway/static/root/assets/remote-access-hub-CU3EChY0.js +1 -0
  73. package/dist/gateway/static/root/assets/{runtime-tools-api-C_VOMhLI.js → runtime-tools-api-D0xtCTXr.js} +1 -1
  74. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BCHLh-KQ.js → runtime-tools-settings-panel-Bfs5zKDg.js} +1 -1
  75. package/dist/gateway/static/root/assets/{schema-form-CJvaVHkx.js → schema-form-BbI2BuSU.js} +1 -1
  76. package/dist/gateway/static/root/assets/{session-api-DbNNQps9.js → session-api-CAKgrbgz.js} +1 -1
  77. package/dist/gateway/static/root/assets/{session-manager-DfVviLTK.js → session-manager-D_N7qha7.js} +1 -1
  78. package/dist/gateway/static/root/assets/sessions-page-CjB2GOTs.js +1 -0
  79. package/dist/gateway/static/root/assets/settings-advanced-gate-jbVx8gcF.js +1 -0
  80. package/dist/gateway/static/root/assets/{settings-form-section-B3eODxNv.js → settings-form-section-BfBBJlr-.js} +1 -1
  81. package/dist/gateway/static/root/assets/{settings-page-Dg86uCnr.js → settings-page-9yu4SN1j.js} +1 -1
  82. package/dist/gateway/static/root/assets/setup-status-panel-DhWB3feW.js +1 -0
  83. package/dist/gateway/static/root/assets/{share-preview-page-DCy1f25V.js → share-preview-page-B6lQl5xb.js} +1 -1
  84. package/dist/gateway/static/root/assets/shares-settings-UJGjdz3F.js +1 -0
  85. package/dist/gateway/static/root/assets/{skill-api-RisyPAMA.js → skill-api-y2m3k_R4.js} +1 -1
  86. package/dist/gateway/static/root/assets/skill-reload-api-Bk9FqsVa.js +1 -0
  87. package/dist/gateway/static/root/assets/skills-page-DLd4O-Fo.js +2 -0
  88. package/dist/gateway/static/root/assets/{style-CwMX73G7.js → style-C2ptQg95.js} +1 -1
  89. package/dist/gateway/static/root/assets/{system-settings-panel-Cma37Pfm.js → system-settings-panel-DYzcLnVk.js} +1 -1
  90. package/dist/gateway/static/root/assets/task-detail-page-DLGtmHAH.js +2 -0
  91. package/dist/gateway/static/root/assets/{task-expandable-content-D3i_51Oc.js → task-expandable-content-HdEeV_0-.js} +1 -1
  92. package/dist/gateway/static/root/assets/{tracing-settings-page-DC-kLysq.js → tracing-settings-page-DKQYmzFn.js} +1 -1
  93. package/dist/gateway/static/root/assets/{tunnel-api-BgdhbR1L.js → tunnel-api-C2VY_HTy.js} +1 -1
  94. package/dist/gateway/static/root/assets/usage-page-CjzunQtj.js +1 -0
  95. package/dist/gateway/static/root/assets/{use-autosave-iKvZ1pvC.js → use-autosave-BElgnGMt.js} +1 -1
  96. package/dist/gateway/static/root/assets/user-model-page-DsOGCDTR.js +2 -0
  97. package/dist/gateway/static/root/assets/{voice-api-key-field-CESbtuwM.js → voice-api-key-field-FVjX0qhn.js} +1 -1
  98. package/dist/gateway/static/root/assets/{voice-config-api-Ceo_hqZC.js → voice-config-api-T3nM4buh.js} +1 -1
  99. package/dist/gateway/static/root/assets/{work-discovery-overlay-dtPpmYyh.js → work-discovery-overlay-B2S2NZuK.js} +1 -1
  100. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DmFn3E_B.js → workflow-run-setup-panel-2Gq34KQk.js} +2 -2
  101. package/dist/gateway/static/root/assets/workflows-page-CjeFD3mk.js +6 -0
  102. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DTZnabfg.js → xopc-cloud-account-card-BZMIZxWg.js} +1 -1
  103. package/dist/gateway/static/root/index.html +15 -15
  104. package/dist/package.js +1 -1
  105. package/dist/src/agent/agent-manager.d.ts +8 -0
  106. package/dist/src/agent/agent-manager.js +3 -3
  107. package/dist/src/agent/background-review/run-background-review.js +1 -1
  108. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  109. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  110. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  111. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  112. package/dist/src/agent/service.js +2 -2
  113. package/dist/src/agent/skills/index.js +1 -1
  114. package/dist/src/agent/skills/managed-store.js +1 -1
  115. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  116. package/dist/src/agent/tools/factory.js +1 -1
  117. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  118. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  119. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  120. package/dist/src/agent-catalog/capabilities.js +2 -2
  121. package/dist/src/automations/capabilities/drafts.js +1 -1
  122. package/dist/src/automations/service/action-executor.js +2 -2
  123. package/dist/src/bootstrap/application-state.js +1 -1
  124. package/dist/src/browser/native-messaging-host.js +1 -1
  125. package/dist/src/browser/providers/browser-ext-install.js +2 -2
  126. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  127. package/dist/src/capabilities/runtime/product.js +1 -1
  128. package/dist/src/channels/index.js +1 -1
  129. package/dist/src/channels/manager.js +1 -1
  130. package/dist/src/chat-commands/agent-edit.js +1 -1
  131. package/dist/src/cli/commands/agent.js +1 -1
  132. package/dist/src/cli/commands/agents.js +1 -1
  133. package/dist/src/cli/commands/channels.js +1 -1
  134. package/dist/src/cli/commands/connectors.js +1 -1
  135. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  136. package/dist/src/cli/commands/models.js +2 -2
  137. package/dist/src/cli/commands/onboard/model.js +1 -1
  138. package/dist/src/cli/commands/onboard.js +1 -1
  139. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  140. package/dist/src/config/agent-model-intents.js +1 -1
  141. package/dist/src/config/agent-profile.js +2 -2
  142. package/dist/src/config/loader.js +1 -1
  143. package/dist/src/config/models-json.js +1 -1
  144. package/dist/src/config/schema.js +2 -2
  145. package/dist/src/extensions/agent-plugins/branding.d.ts +6 -0
  146. package/dist/src/extensions/agent-plugins/branding.js +11 -1
  147. package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +11 -0
  148. package/dist/src/extensions/agent-plugins/cli-authorization.js +11 -6
  149. package/dist/src/extensions/agent-plugins/inventory.d.ts +12 -0
  150. package/dist/src/extensions/agent-plugins/inventory.js +3 -2
  151. package/dist/src/extensions/agent-plugins/setup-contract.d.ts +20 -0
  152. package/dist/src/extensions/agent-plugins/setup-contract.js +20 -1
  153. package/dist/src/extensions/agent-plugins/setup.d.ts +8 -0
  154. package/dist/src/extensions/agent-plugins/setup.js +10 -5
  155. package/dist/src/extensions/agent-plugins/skill-catalog.d.ts +14 -0
  156. package/dist/src/extensions/agent-plugins/skill-catalog.js +95 -0
  157. package/dist/src/extensions/agent-plugins/store.js +1 -1
  158. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  159. package/dist/src/extensions/sdk/index.js +1 -1
  160. package/dist/src/gateway/agents-admin.js +2 -2
  161. package/dist/src/gateway/hono/app.js +1 -1
  162. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  163. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  164. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  165. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  166. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  167. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  168. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  169. package/dist/src/gateway/hono/routes/notes.js +2 -2
  170. package/dist/src/gateway/hono/routes/projects.js +2 -2
  171. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  172. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  173. package/dist/src/gateway/image-generation-setup.js +1 -1
  174. package/dist/src/gateway/lock.js +1 -1
  175. package/dist/src/gateway/service/marketplace-service.js +4 -2
  176. package/dist/src/gateway/service.js +9 -9
  177. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  178. package/dist/src/home-intelligence/host.js +2 -2
  179. package/dist/src/local-apps/service.js +1 -1
  180. package/dist/src/personal-agent/proactivity/service.js +1 -1
  181. package/dist/src/personal-agent/service.js +2 -2
  182. package/dist/src/providers/model-catalog-persistence.js +1 -1
  183. package/dist/src/routing/resolve-route.js +1 -1
  184. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  185. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  186. package/dist/src/tasks/capabilities/read.js +2 -2
  187. package/dist/src/tasks/capabilities/write.js +1 -1
  188. package/dist/src/tasks/task-handoff-service.js +1 -1
  189. package/dist/src/tui/backends/embedded-backend.js +2 -2
  190. package/dist/src/voice/realtime/persona-context.js +1 -1
  191. package/package.json +3 -3
  192. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CzKNVkRn.js +0 -1
  193. package/dist/gateway/static/root/assets/agent-plugin-dialog-mpA9rwYd.js +0 -1
  194. package/dist/gateway/static/root/assets/agents-7VMa7Rzo.js +0 -77
  195. package/dist/gateway/static/root/assets/apps-page-CvqDUvof.js +0 -1
  196. package/dist/gateway/static/root/assets/automations-workspace-DvTSHLt3.js +0 -6
  197. package/dist/gateway/static/root/assets/browser-automations-page-CJGBhDnv.js +0 -3
  198. package/dist/gateway/static/root/assets/browser-settings-page-tsi5W-cJ.js +0 -3
  199. package/dist/gateway/static/root/assets/capabilities-page-CfbGk8q_.js +0 -2
  200. package/dist/gateway/static/root/assets/capabilities-settings-panel-BkO7QEyA.js +0 -8
  201. package/dist/gateway/static/root/assets/channels-D0CwJktG.js +0 -1
  202. package/dist/gateway/static/root/assets/computer-settings-page-D_b_bFVz.js +0 -1
  203. package/dist/gateway/static/root/assets/connectors-page-DlpfL2Rc.js +0 -1
  204. package/dist/gateway/static/root/assets/device-pairing-wizard-12m5Z9-8.js +0 -1
  205. package/dist/gateway/static/root/assets/extension-page-CXxM1M62.js +0 -1
  206. package/dist/gateway/static/root/assets/extension-settings-page-AF5nvsPP.js +0 -1
  207. package/dist/gateway/static/root/assets/gateway-realtime-store-DQ6-whg-.js +0 -1
  208. package/dist/gateway/static/root/assets/gateway-settings-ABXvW_yL.js +0 -1
  209. package/dist/gateway/static/root/assets/home-page-LXGxGwVl.js +0 -2
  210. package/dist/gateway/static/root/assets/index-BKHxJaGD.css +0 -1
  211. package/dist/gateway/static/root/assets/management-settings-C52cuMg1.js +0 -1
  212. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CPYJsRUJ.js +0 -1
  213. package/dist/gateway/static/root/assets/messages-DPxcWxfD.js +0 -3
  214. package/dist/gateway/static/root/assets/note-detail-panel-CNN41byS.js +0 -5
  215. package/dist/gateway/static/root/assets/notes-page-BsfBp_8z.js +0 -8
  216. package/dist/gateway/static/root/assets/personal-page-N4KoCZYG.js +0 -1
  217. package/dist/gateway/static/root/assets/plugin-details-page-DcrrzQI-.js +0 -1
  218. package/dist/gateway/static/root/assets/project-detail-page-y67s_fA8.js +0 -1
  219. package/dist/gateway/static/root/assets/projects-page-D5iYgi0O.js +0 -1
  220. package/dist/gateway/static/root/assets/remote-access-hub-DeFF7Re-.js +0 -1
  221. package/dist/gateway/static/root/assets/sessions-page-DZ93_D5M.js +0 -1
  222. package/dist/gateway/static/root/assets/settings-advanced-gate-F1WX7vxq.js +0 -1
  223. package/dist/gateway/static/root/assets/setup-status-panel-ruFzAArp.js +0 -1
  224. package/dist/gateway/static/root/assets/shares-settings-DeIVZvpJ.js +0 -1
  225. package/dist/gateway/static/root/assets/skill-reload-api-Dwkm1Fof.js +0 -1
  226. package/dist/gateway/static/root/assets/skills-page-UiTLsrFc.js +0 -2
  227. package/dist/gateway/static/root/assets/task-detail-page-BKOF_kxS.js +0 -2
  228. package/dist/gateway/static/root/assets/usage-page-BSlFg3Xj.js +0 -1
  229. package/dist/gateway/static/root/assets/user-model-page-D4GB8QsM.js +0 -2
  230. package/dist/gateway/static/root/assets/workflows-page-DEtaRuxH.js +0 -6
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,g as o,t as s}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./markdown-view-B58RypQ4.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-DBvKzlCl.js";import{t as m}from"./cn-0WouolD0.js";import{c as h,i as g,n as _,r as v}from"./locale-store-Jnhw2WMv.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{o as D}from"./gateway-realtime-dE0XrVAT.js";import{$l as O,Al as k,Bo as A,Df as ee,Du as j,Go as M,Gu as N,Ho as P,Ic as F,Rc as I,Vo as L,Wc as R,Zl as te,ar as z,er as ne,gf as B,is as V,jl as re,jo as H,no as U,nr as W,of as G,rr as K,tr as q,zo as J}from"./index-DvKDT-RQ.js";import{t as Y}from"./capability-links--dcwUjgv.js";import{n as X,t as Z}from"./capability-header-actions-Cu-ATcJq.js";import{t as ie}from"./capability-icon-DVoZxEgW.js";import{n as ae,t as oe}from"./plugin-presentation-BrQpVvjC.js";var se=n(),ce=`grid grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-start gap-4`,le=`relative min-w-0 rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover/30`,ue=`absolute inset-0 cursor-pointer rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Q=e(t(),1);function de(e){return e===`builtin`||e===`user`?e:`marketplace`}async function fe(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await pe(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function pe(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function me(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await pe(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function he(e){let t=await g(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await pe(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ge(e){let t=await g(v(`/api/extensions/${encodeURIComponent(e.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e.enabled})});if(!t.ok)throw Error(await pe(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function _e(e){let t=await g(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await pe(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function ve(e,t){let n=e.find(e=>e.id===t||e.pluginId===t||e.provenance?.packageName===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var ye={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function be({className:e,query:t}){let n=a(),r=i(),o=_(e=>e.language),s=p(o).extensionsPage,c=h(e=>!!e.conversationId),l=J(),{mutate:u}=T(),[d,f]=(0,Q.useReducer)(U,ye),{debounced:g,detailPkg:v,quickInstallPkg:y,rowBusy:b,actionError:x,restartHint:S}=d,C=c?`marketplace-${g}`:null;(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>f({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:w,isLoading:O,error:k}=E(C,()=>fe(g),{revalidateOnFocus:!1}),A=(0,Q.useCallback)(()=>{u(`gateway-extensions-list`),D()},[u]),ee=(0,Q.useCallback)(async(e,t)=>{f({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await he({name:e,overwrite:t});A(),n.requiresGatewayRestart&&f({type:`patch`,patch:{restartHint:s.marketplaceRestartHint}})}catch(e){throw f({type:`patch`,patch:{actionError:e instanceof Error?e.message:s.marketplaceInstallFailed}}),e}finally{f({type:`patch`,patch:{rowBusy:null}})}},[s.marketplaceInstallFailed,s.marketplaceRestartHint,A]),M=(0,Q.useCallback)(async e=>{f({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await _e(e);A(),t.requiresGatewayRestart&&f({type:`patch`,patch:{restartHint:s.marketplaceRestartHint}})}catch(e){throw f({type:`patch`,patch:{actionError:e instanceof Error?e.message:s.marketplaceUninstallFailed}}),e}finally{f({type:`patch`,patch:{rowBusy:null}})}},[s.marketplaceRestartHint,s.marketplaceUninstallFailed,A]),P=w??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[k?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k instanceof Error?k.message:s.marketplaceLoadFailed}):null,x?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,S?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,O&&!w?(0,$.jsx)(`ul`,{className:ce,"aria-label":s.marketplaceLoading,children:[0,1,2,3,4,5].map(e=>(0,$.jsxs)(`li`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(I,{className:`size-10 shrink-0 rounded-xl`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(I,{className:`h-5 w-full`}),(0,$.jsx)(I,{className:`h-3 w-2/3`})]}),(0,$.jsx)(I,{className:`h-9 w-16 shrink-0 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,$.jsx)(I,{className:`h-4 w-full`}),(0,$.jsx)(I,{className:`h-4 w-full`}),(0,$.jsx)(I,{className:`h-4 w-2/3`})]})]},e))}):(0,$.jsx)(`ul`,{className:ce,children:P.length===0?(0,$.jsx)(`li`,{className:`col-span-full text-sm text-fg-muted`,children:s.marketplaceEmpty}):P.map(e=>{let t=ve(l,e.id),i=b===e.id,a=l.find(t=>t.pluginId===e.id||t.provenance?.packageName===e.id),c=e.localizations?.[o.startsWith(`zh`)?`zh-CN`:`en`],u=c?.displayName??e.name,d=c?.description??e.description;return(0,$.jsxs)(`li`,{className:le,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${u}, ${s.marketplaceDetailTitle}`,onClick:()=>a?.pluginId?n(Y(a.pluginId,`installed`,a.authorizationStatus===`required`,r.pathname+r.search)):f({type:`patch`,patch:{detailPkg:e.id}}),className:ue}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[(0,$.jsx)(ie,{iconUrl:e.branding?.iconUrl,fallback:j}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:u,children:u}),e.verified?(0,$.jsx)(G,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[e.version?(0,$.jsxs)(`span`,{children:[`v`,e.version]}):null,t===`user`?(0,$.jsx)(`span`,{className:a?.authorizationStatus===`required`?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,children:a?.authorizationStatus===`required`?o.startsWith(`zh`)?`需要授权`:`Authorization required`:s.marketplaceInstalled}):null]})]}),(0,$.jsx)(`div`,{role:`group`,className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:s.marketplaceBuiltin}):t===`user`?(0,$.jsx)($.Fragment,{children:e.packageType===`plugin`?(0,$.jsx)(`button`,{type:`button`,onClick:()=>a?.pluginId?n(Y(a.pluginId,`installed`,a.authorizationStatus===`required`,r.pathname+r.search)):f({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:a?.authorizationStatus===`required`?o.startsWith(`zh`)?`去授权`:`Connect account`:o.startsWith(`zh`)?`查看详情`:`View details`}):(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(s.marketplaceUninstallConfirm)&&M(e.id).catch(()=>{})},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,$.jsx)(N,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(re,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),s.marketplaceUninstall]})}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>f({type:`patch`,patch:e.packageType===`plugin`?{detailPkg:e.id,quickInstallPkg:e.id}:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex min-w-16 items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:e.packageType===`plugin`?o.startsWith(`zh`)?`安装`:`Install`:s.marketplaceReview})})]}),d?(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:d}):null,(e.categories?.length??0)>0?(0,$.jsx)(`div`,{className:`pointer-events-none relative mt-3 flex flex-wrap gap-1.5`,children:e.categories?.map(e=>(0,$.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-edge px-2 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]},e.id)})}),v?(0,$.jsx)(xe,{packageName:v,autoInstall:y===v,copy:s,extensions:l,onClose:()=>f({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:ee,onUninstall:M}):null]})}function xe(e){let t=(0,se.c)(98),{packageName:n,autoInstall:r,copy:i,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[d,p]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=h(Ee)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>me(n),t[0]=n,t[1]=b);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:O,isLoading:A}=E(v,b,T),j;t[3]!==a||t[4]!==n?(j=ve(a,n),t[3]=a,t[4]=n,t[5]=j):j=t[5];let M=j,P=M===`user`,F=D?.manifest?.permissions,L,R,z,ne,B,V,H,U,W,G,K,q;if(t[6]!==r||t[7]!==i||t[8]!==D||t[9]!==O||t[10]!==a||t[11]!==M||t[12]!==A||t[13]!==o||t[14]!==n||t[15]!==F||t[16]!==g){V=Symbol.for(`react.early_return_sentinel`);bb0:{let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],s;t[29]!==i||t[30]!==D?(s=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${i.marketplaceNoReadme}*`),t[29]=i,t[30]=D,t[31]=s):s=t[31];let c=s;if(D?.format===`agent-plugin`){let e;if(t[32]!==D||t[33]!==a||t[34]!==n){let r;t[36]!==D||t[37]!==n?(r=e=>e.provenance?.packageName===n||e.pluginId===D.manifest?.name,t[36]=D,t[37]=n,t[38]=r):r=t[38],e=a.find(r),t[32]=D,t[33]=a,t[34]=n,t[35]=e}else e=t[35];let i=`store:${n}`,s;t[39]!==r||t[40]!==D||t[41]!==o||t[42]!==e||t[43]!==i?(s=(0,$.jsx)(ae,{extension:e,initialSource:i,marketplace:D,autoInstall:r,onClose:o}),t[39]=r,t[40]=D,t[41]=o,t[42]=e,t[43]=i,t[44]=s):s=t[44],V=s;break bb0}z=w,ne=!0,t[45]===o?B=t[46]:(B=e=>!e&&o(),t[45]=o,t[46]=B),R=x,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[47]=q):q=t[47],L=S,W=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,G=Te;let l;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(ee,{className:`size-5`}),t[48]=l):l=t[48];let d;t[49]!==i.detailBack||t[50]!==o?(d=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailBack,children:l}),t[49]=i.detailBack,t[50]=o,t[51]=d):d=t[51];let p;t[52]===i.marketplaceDetailTitle?p=t[53]:(p=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[52]=i.marketplaceDetailTitle,t[53]=p);let m;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(f,{className:`size-5`}),t[54]=m):m=t[54];let h;t[55]!==i.detailClose||t[56]!==o?(h=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailClose,children:m}),t[55]=i.detailClose,t[56]=o,t[57]=h):h=t[57],t[58]!==d||t[59]!==p||t[60]!==h?(K=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[d,p,h]}),t[58]=d,t[59]=p,t[60]=h,t[61]=K):K=t[61],H=`min-h-0 flex-1 overflow-y-auto p-5`,U=A&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(I,{className:`h-6 w-48`}),(0,$.jsx)(I,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(I,{className:`h-12`}),(0,$.jsx)(I,{className:`h-12`})]}),(0,$.jsx)(I,{className:`h-28 w-full`}),(0,$.jsx)(I,{className:`h-36 w-full`})]}):O?(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:i.marketplaceLoadFailed})]}):D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),M===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,$.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(k,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?i.marketplaceCodeRisk:D.installability.reason??i.marketplaceUnavailableBody})]})]}),D.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(we)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(u,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=D,t[9]=O,t[10]=a,t[11]=M,t[12]=A,t[13]=o,t[14]=n,t[15]=F,t[16]=g,t[17]=L,t[18]=R,t[19]=z,t[20]=ne,t[21]=B,t[22]=V,t[23]=H,t[24]=U,t[25]=W,t[26]=G,t[27]=K,t[28]=q}else L=t[17],R=t[18],z=t[19],ne=t[20],B=t[21],V=t[22],H=t[23],U=t[24],W=t[25],G=t[26],K=t[27],q=t[28];if(V!==Symbol.for(`react.early_return_sentinel`))return V;let J;t[62]!==H||t[63]!==U?(J=(0,$.jsx)(`div`,{className:H,children:U}),t[62]=H,t[63]=U,t[64]=J):J=t[64];let Y;t[65]!==d||t[66]!==i.marketplaceBuiltinGoBuiltin||t[67]!==i.marketplaceBuiltinManageHint||t[68]!==i.marketplaceInstall||t[69]!==i.marketplaceReinstall||t[70]!==i.marketplaceReinstallConfirm||t[71]!==i.marketplaceUninstall||t[72]!==i.marketplaceUninstallConfirm||t[73]!==D||t[74]!==M||t[75]!==o||t[76]!==c||t[77]!==l||t[78]!==n||t[79]!==g||t[80]!==P?(Y=D?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:M===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(s,{to:`/capabilities/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:d||!D.installability.available||!g,onClick:()=>{P&&!window.confirm(i.marketplaceReinstallConfirm)||(p(!0),c(n,P).catch(Ce).finally(()=>p(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[d?(0,$.jsx)(N,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?i.marketplaceReinstall:i.marketplaceInstall]}),P?(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(p(!0),l(n).then(()=>o()).catch(Se).finally(()=>p(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,$.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[65]=d,t[66]=i.marketplaceBuiltinGoBuiltin,t[67]=i.marketplaceBuiltinManageHint,t[68]=i.marketplaceInstall,t[69]=i.marketplaceReinstall,t[70]=i.marketplaceReinstallConfirm,t[71]=i.marketplaceUninstall,t[72]=i.marketplaceUninstallConfirm,t[73]=D,t[74]=M,t[75]=o,t[76]=c,t[77]=l,t[78]=n,t[79]=g,t[80]=P,t[81]=Y):Y=t[81];let X;t[82]!==L||t[83]!==J||t[84]!==Y||t[85]!==W||t[86]!==G||t[87]!==K?(X=(0,$.jsxs)(L,{className:W,onOpenAutoFocus:G,children:[K,J,Y]}),t[82]=L,t[83]=J,t[84]=Y,t[85]=W,t[86]=G,t[87]=K,t[88]=X):X=t[88];let Z;t[89]!==R||t[90]!==X||t[91]!==q?(Z=(0,$.jsxs)(R,{children:[q,X]}),t[89]=R,t[90]=X,t[91]=q,t[92]=Z):Z=t[92];let ie;return t[93]!==z||t[94]!==ne||t[95]!==B||t[96]!==Z?(ie=(0,$.jsx)(z,{defaultOpen:ne,onOpenChange:B,children:Z}),t[93]=z,t[94]=ne,t[95]=B,t[96]=Z,t[97]=ie):ie=t[97],ie}function Se(){}function Ce(){}function we(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function Te(e){return e.preventDefault()}function Ee(e){return!!e.conversationId}function De({embedded:e=!1,onHeaderActionChange:t}){let n=a(),r=i(),l=_(e=>e.language),u=p(l),f=M(e=>e.setPageHeader),h=M(e=>e.clearPageHeader),g=J(),v=A(),[y,b]=o(),x=de(y.get(`tab`)??(g.some(e=>e.source!==`bundled`)?`user`:null)),S=(0,Q.useRef)(!1),C=y.get(`q`)??``,[w,T]=(0,Q.useState)(x),[E,D]=(0,Q.useState)(C),[O,k]=(0,Q.useState)(null),[ee,j]=(0,Q.useState)(!1),N=y.toString(),P=(0,Q.useRef)(N);if(P.current!==N){P.current=N;let e=de(y.get(`tab`)),t=y.get(`q`)??``;T(t=>t===e?t:e),D(e=>e===t?e:t)}(0,Q.useEffect)(()=>{b(e=>{let t=new URLSearchParams(e),n=E.trim();return n?t.set(`q`,n):t.delete(`q`),w===`marketplace`?t.delete(`tab`):t.set(`tab`,w),t.toString()===e.toString()?e:t},{replace:!0})},[w,E,b]);let I=(0,Q.useMemo)(()=>g.filter(e=>e.source===`bundled`),[g]),L=(0,Q.useMemo)(()=>g.filter(e=>e.source!==`bundled`),[g]);(0,Q.useEffect)(()=>{v||S.current||(S.current=!0,!y.has(`tab`)&&L.length&&T(`user`))},[v,y,L.length]);let te=w===`builtin`?I:L,re=(0,Q.useMemo)(()=>{let e=E.trim().toLowerCase(),t=te;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,l):e.hasUi?-1:1)},[te,E,l]);(0,Q.useEffect)(()=>{k(e=>{if(!e)return e;let t=g.find(t=>t.id===e.id);return t?Oe(e)===Oe(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[g]);let H=(0,Q.useMemo)(()=>({searchLabel:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder,search:(0,$.jsx)(X,{value:E,onChange:D,placeholder:w===`marketplace`?u.extensionsPage.marketplaceSearchPlaceholder:u.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(K,{children:[(0,$.jsx)(z,{asChild:!0,children:(0,$.jsx)(R,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":u.capabilitiesHub.moreActions,title:u.capabilitiesHub.moreActions,children:(0,$.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(W,{children:(0,$.jsxs)(ne,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(q,{className:m(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,F.transition),onSelect:()=>j(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(q,{asChild:!0,children:(0,$.jsxs)(s,{to:`/local-apps`,className:m(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,F.transition),children:[(0,$.jsx)(B,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),u.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(R,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(s,{to:`/local-apps/new`,"aria-label":u.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:u.extensionsPage.createLocalApp})]})})}),[l,u.capabilitiesHub.moreActions,u.extensionsPage,w,E]);(0,Q.useLayoutEffect)(()=>e?(t?.(H),()=>t?.(null)):(f({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:u.extensionsPage.title})}),end:(0,$.jsx)(Z,{contribution:H})}),()=>h()),[h,e,H,u.extensionsPage.title,t,f]);let U=[{id:`marketplace`,label:u.extensionsPage.tabMarketplace},{id:`builtin`,label:u.extensionsPage.tabBuiltin,count:v?void 0:I.length},{id:`user`,label:u.extensionsPage.tabUser,count:v?void 0:L.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:m(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(V,{items:U,activeTab:w,onChange:T,ariaLabel:u.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),w===`marketplace`?(0,$.jsx)(be,{query:E}):v?(0,$.jsx)(Fe,{}):w===`builtin`&&I.length===0?(0,$.jsx)(Le,{message:u.extensionsPage.emptyBuiltin}):w===`user`&&L.length===0?(0,$.jsx)(Le,{message:u.extensionsPage.emptyUser}):re.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:u.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:ce,children:re.map(e=>(0,$.jsx)(je,{extension:e,copy:u.extensionsPage,onOpen:()=>e.pluginId?n(Y(e.pluginId,`installed`,e.authorizationStatus===`required`,r.pathname+r.search)):k(e)},e.id))})]}),O?O.format===`agent-plugin`?(0,$.jsx)(ae,{extension:O,onClose:()=>k(null)},O.id):(0,$.jsx)(Ne,{extension:O,copy:u.extensionsPage,onClose:()=>k(null)},O.id):null,ee?(0,$.jsx)(ae,{onClose:()=>j(!1)}):null]})}function Oe(e){return e.activationEligible??e.active}function ke(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function Ae(e,t){let n=Oe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function je(e){let t=(0,se.c)(43),{extension:n,copy:r,onOpen:i}=e,a=_(Me),o,s;t[0]!==n||t[1]!==a?(s=a.startsWith(`zh`),o=oe(n,s),t[0]=n,t[1]=a,t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c=o,l=n.authorizationStatus===`required`,u=n.localizations?.[s?`zh-CN`:`en`]?.description??n.description,d=l?s?`去授权`:`Connect account`:s?`查看详情`:`View details`,f=`${c}, ${r.marketplaceDetailTitle}`,p;t[4]!==i||t[5]!==f?(p=(0,$.jsx)(`button`,{type:`button`,"aria-label":f,onClick:i,className:ue}),t[4]=i,t[5]=f,t[6]=p):p=t[6];let m=n.branding?.iconUrl,h;t[7]===m?h=t[8]:(h=(0,$.jsx)(ie,{iconUrl:m,fallback:B}),t[7]=m,t[8]=h);let g;t[9]===c?g=t[10]:(g=(0,$.jsx)(`h2`,{className:`line-clamp-2 break-words font-semibold leading-snug text-fg`,title:c,children:c}),t[9]=c,t[10]=g);let v;t[11]===n.provenance?.publisherVerification?v=t[12]:(v=n.provenance?.publisherVerification===`verified`?(0,$.jsx)(G,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,t[11]=n.provenance?.publisherVerification,t[12]=v);let y;t[13]!==g||t[14]!==v?(y=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[g,v]}),t[13]=g,t[14]=v,t[15]=y):y=t[15];let b;t[16]===n.version?b=t[17]:(b=n.version?(0,$.jsxs)(`span`,{children:[`v`,n.version]}):null,t[16]=n.version,t[17]=b);let x=l?`text-amber-700 dark:text-amber-400`:`text-fg-muted`,S=l?s?`需要授权`:`Authorization required`:Oe(n)?r.statusEnabled:r.runStateOff,C;t[18]!==x||t[19]!==S?(C=(0,$.jsx)(`span`,{className:x,children:S}),t[18]=x,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==b||t[22]!==C?(w=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-subtle`,children:[b,C]}),t[21]=b,t[22]=C,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==y?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,w]}),t[24]=w,t[25]=y,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==i?(E=(0,$.jsx)(`div`,{className:`pointer-events-auto relative z-10 flex max-w-[45%] shrink-0 items-start`,children:(0,$.jsx)(`button`,{type:`button`,onClick:i,className:`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg transition-colors hover:bg-surface-hover active:scale-[0.98] active:bg-surface-hover/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:d})}),t[27]=d,t[28]=i,t[29]=E):E=t[29];let D;t[30]!==T||t[31]!==E||t[32]!==h?(D=(0,$.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-3`,children:[h,T,E]}),t[30]=T,t[31]=E,t[32]=h,t[33]=D):D=t[33];let O;t[34]!==r.cardNoDescription||t[35]!==u?(O=u?.trim()||r.cardNoDescription,t[34]=r.cardNoDescription,t[35]=u,t[36]=O):O=t[36];let k;t[37]===O?k=t[38]:(k=(0,$.jsx)(`p`,{className:`pointer-events-none relative mt-3 line-clamp-3 text-sm leading-relaxed text-fg-muted`,children:O}),t[37]=O,t[38]=k);let A;return t[39]!==D||t[40]!==k||t[41]!==p?(A=(0,$.jsxs)(`article`,{className:le,children:[p,D,k]}),t[39]=D,t[40]=k,t[41]=p,t[42]=A):A=t[42],A}function Me(e){return e.language}function Ne({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,a]=(0,Q.useState)(null),[o,c]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),p=e.activationEligible===!0,h=(0,Q.useCallback)(async()=>{c(null),d(!1),a(`toggle`);try{let{requiresGatewayRestart:t}=await ge({extensionId:e.id,enabled:!p});await r(`gateway-extensions-list`),D(),d(t)}catch(e){c(e instanceof Error?e.message:t.extensionToggleFailed)}finally{a(null)}},[p,t.extensionToggleFailed,e.id,r]),g=(0,Q.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){c(null),d(!1),a(`uninstall`);try{await _e(e.id),await r(`gateway-extensions-list`),D(),n()}catch(e){c(e instanceof Error?e.message:t.marketplaceUninstallFailed),a(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),_=e.ui?.contributions?.pages??[],v=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],k=_.find(e=>e.showInNav)??_[0],A=v[0],j=k?H(e.id,k):null,M=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||L(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(S,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,$.jsx)(ee,{className:`size-5`})}),(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,$.jsx)(f,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,ke(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Ae(e,t)}),e.source===`bundled`?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(R,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void h(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(N,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):p?t.builtinToggleDisable:t.builtinToggleEnable})]}),o?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:o}):null,u?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(R,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void g(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(N,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(_.length>0||v.length>0||E.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Pe,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,$.jsx)(Pe,{template:t.badgeSettings,count:v.length,hidden:v.length===0}),(0,$.jsx)(Pe,{template:t.badgeWidgets,count:E.length,hidden:E.length===0})]})]}):null,P(e)&&(j||M)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[j?(0,$.jsxs)(s,{to:j,onClick:n,className:m(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(l,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,$.jsxs)(s,{to:M,onClick:n,className:m(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(O,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Pe(e){let t=(0,se.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function Fe(){let e=(0,se.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:ce,"aria-busy":`true`,children:Array.from({length:6},Ie)}),e[0]=t):t=e[0],t}function Ie(e,t){return(0,$.jsx)(I,{className:`h-32 rounded-xl`},t)}function Le(e){let t=(0,se.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{De as ExtensionsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-DPxcWxfD.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-DzA__S54.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
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"./messages-DBvKzlCl.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-DKyLVLpX.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-DvTSHLt3.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-Bc4c_AEq.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
@@ -0,0 +1,6 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,t as o}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./ellipsis-0k4rZLoy.js";import{t as u}from"./markdown-view-B58RypQ4.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-DBvKzlCl.js";import{t as m}from"./cn-0WouolD0.js";import{n as h}from"./locale-store-Jnhw2WMv.js";import{a as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{$i as C,Ao as w,Bu as T,Cd as ee,Co as E,Cu as D,Ds as O,Es as k,Go as A,Jl as j,Kl as M,Os as N,Rc as P,Rn as F,Ts as I,Wc as L,Xa as R,Yd as z,Zl as te,_s as ne,ar as re,cf as ie,cu as B,ds as V,er as ae,ff as H,fs as U,gs as oe,gu as se,hs as ce,jf as le,ji as ue,jl as W,l as G,nr as de,qu as fe,rr as pe,ru as me,sf as he,so as ge,tr as _e,uf as ve,v as ye,ws as be,xu as xe,yl as Se}from"./index-DvKDT-RQ.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as K,s as q,t as ke}from"./automation-display-DCkjVzA0.js";import{i as Ae,n as je,r as J,s as Me,t as Ne}from"./workflow-run-setup-panel-2Gq34KQk.js";import{i as Pe,n as Fe,r as Ie,t as Le}from"./browser-automation-inputs-DngvcZH9.js";var Re=n(),Y=e(t(),1),X=r(),ze=Array.from({length:24},(e,t)=>t);function Be(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function Ve(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function He(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function Ue(e){let t=(0,Re.c)(80),{value:n,onChange:r,disabled:i,allowEmpty:a,clearLabel:o,ariaLabel:c,ariaLabelledBy:l,className:u,triggerClassName:d,id:p,name:h,minuteStep:g}=e,_=a===void 0?!1:a,v=g===void 0?1:g,y=Be(n),b=y??Ve(),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(null),[T,ee]=(0,Y.useState)(b.hour),[E,D]=(0,Y.useState)(b.minute),k=(0,Y.useRef)([]),A=(0,Y.useRef)([]),j=oe(),M=ce(C),P=ne(j,M!==null),F=Math.max(1,Math.min(60,Math.round(v))),I=Array.from({length:Math.ceil(60/F)},(e,t)=>t*F).filter(Ge),L;t[0]===r?L=t[1]:(L=(e,t,n)=>{let i=n===void 0?!1:n;ee(e),D(t),r(He(e,t)),i&&S(!1)},t[0]=r,t[1]=L);let R=L,te=We,re;t[2]===u?re=t[3]:(re=m(`relative min-w-0`,u),t[2]=u,t[3]=re);let ie=N,B;t[4]===n?B=t[5]:(B=e=>{if(e){let e=Be(n)??Ve();ee(e.hour),D(e.minute)}S(e)},t[4]=n,t[5]=B);let V=_&&n&&`pr-9`,ae=i&&`cursor-not-allowed opacity-50 hover:border-edge`,H;t[6]!==V||t[7]!==ae||t[8]!==d?(H=m(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,V,ae,d),t[6]=V,t[7]=ae,t[8]=d,t[9]=H):H=t[9];let U;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,X.jsx)(z,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=U):U=t[10];let se=!y&&`text-fg-subtle`,le;t[11]===se?le=t[12]:(le=m(`tabular-nums`,se),t[11]=se,t[12]=le);let ue=y?He(y.hour,y.minute):`--:--`,W;t[13]!==le||t[14]!==ue?(W=(0,X.jsx)(`span`,{className:le,children:ue}),t[13]=le,t[14]=ue,t[15]=W):W=t[15];let G;t[16]!==c||t[17]!==l||t[18]!==i||t[19]!==p||t[20]!==W||t[21]!==H?(G=(0,X.jsx)(O,{asChild:!0,children:(0,X.jsxs)(`button`,{ref:w,id:p,type:`button`,disabled:i,"aria-label":c,"aria-labelledby":l,"aria-haspopup":`listbox`,className:H,children:[U,W]})}),t[16]=c,t[17]=l,t[18]=i,t[19]=p,t[20]=W,t[21]=H,t[22]=G):G=t[22];let de=N,fe=M??void 0,pe=N,me=m(P,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`),he=e=>{e.preventDefault(),requestAnimationFrame(()=>k.current[T]?.focus())},ge;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(z,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=ge):ge=t[23];let _e=c??`HH:mm`,ve;t[24]===_e?ve=t[25]:(ve=(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[ge,_e]}),t[24]=_e,t[25]=ve);let ye;t[26]!==T||t[27]!==E?(ye=He(T,E),t[26]=T,t[27]=E,t[28]=ye):ye=t[28];let be;t[29]===ye?be=t[30]:(be=(0,X.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:ye}),t[29]=ye,t[30]=be);let xe;t[31]!==ve||t[32]!==be?(xe=(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-inset px-3 py-2.5`,children:[ve,be]}),t[31]=ve,t[32]=be,t[33]=xe):xe=t[33];let Se;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,X.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=Se):Se=t[34];let Ce=`${c??`HH:mm`} HH`,we=ze.map((e,t)=>(0,X.jsx)(`button`,{ref:e=>{k.current[t]=e},type:`button`,role:`option`,"aria-selected":T===e,tabIndex:T===e?0:-1,className:m(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,T===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>R(e,E),onKeyDown:e=>te(e,ze,T,e=>R(e,E),k),children:String(e).padStart(2,`0`)},e)),Te;t[35]!==Ce||t[36]!==we?(Te=(0,X.jsxs)(`div`,{className:`pr-2`,children:[Se,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":Ce,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:we})]}),t[35]=Ce,t[36]=we,t[37]=Te):Te=t[37];let Ee;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,X.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=Ee):Ee=t[38];let De=`${c??`HH:mm`} MM`,Oe=I.map((e,t)=>(0,X.jsxs)(`button`,{ref:e=>{A.current[t]=e},type:`button`,role:`option`,"aria-selected":E===e,tabIndex:E===e?0:-1,className:m(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,E===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>R(T,e,!0),onKeyDown:e=>te(e,I,E,e=>R(T,e),A),children:[(0,X.jsx)(s,{className:m(`absolute left-0.5 size-3`,E!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),K;t[39]!==De||t[40]!==Oe?(K=(0,X.jsx)(`div`,{role:`listbox`,"aria-label":De,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Oe}),t[39]=De,t[40]=Oe,t[41]=K):K=t[41];let q;t[42]!==Ee||t[43]!==K?(q=(0,X.jsxs)(`div`,{className:`pl-2`,children:[Ee,K]}),t[42]=Ee,t[43]=K,t[44]=q):q=t[44];let ke;t[45]!==Te||t[46]!==q?(ke=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[Te,q]}),t[45]=Te,t[46]=q,t[47]=ke):ke=t[47];let Ae;t[48]!==pe.Content||t[49]!==me||t[50]!==he||t[51]!==xe||t[52]!==ke?(Ae=(0,X.jsxs)(pe.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:me,onOpenAutoFocus:he,children:[xe,ke]}),t[48]=pe.Content,t[49]=me,t[50]=he,t[51]=xe,t[52]=ke,t[53]=Ae):Ae=t[53];let je;t[54]!==de.Portal||t[55]!==fe||t[56]!==Ae?(je=(0,X.jsx)(de.Portal,{container:fe,children:Ae}),t[54]=de.Portal,t[55]=fe,t[56]=Ae,t[57]=je):je=t[57];let J;t[58]!==x||t[59]!==G||t[60]!==je||t[61]!==ie.Root||t[62]!==B?(J=(0,X.jsxs)(ie.Root,{open:x,onOpenChange:B,children:[G,je]}),t[58]=x,t[59]=G,t[60]=je,t[61]=ie.Root,t[62]=B,t[63]=J):J=t[63];let Me;t[64]!==_||t[65]!==c||t[66]!==o||t[67]!==i||t[68]!==r||t[69]!==n?(Me=_&&n?(0,X.jsx)(`button`,{type:`button`,disabled:i,"aria-label":o??c,title:o,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,X.jsx)(f,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=_,t[65]=c,t[66]=o,t[67]=i,t[68]=r,t[69]=n,t[70]=Me):Me=t[70];let Ne;t[71]!==i||t[72]!==h||t[73]!==n?(Ne=h?(0,X.jsx)(`input`,{type:`hidden`,name:h,value:n,disabled:i}):null,t[71]=i,t[72]=h,t[73]=n,t[74]=Ne):Ne=t[74];let Pe;return t[75]!==re||t[76]!==J||t[77]!==Me||t[78]!==Ne?(Pe=(0,X.jsxs)(`div`,{className:re,children:[J,Me,Ne]}),t[75]=re,t[76]=J,t[77]=Me,t[78]=Ne,t[79]=Pe):Pe=t[79],Pe}function We(e,t,n,r,i){let a=null,o=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(o+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(o-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let s=t[a];r(s),i.current?.[a]?.focus()}function Ge(e){return e<60}function Ke(e){return e.management!==void 0}var qe={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,model:``,instruction:``,taskId:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserAutomationId:``,browserAutomationInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,resultWebhookEndpoint:``,resultWebhookSecretId:``,disableAfterFailures:`3`},Je=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function Ye(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)o={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:ke(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=J(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_automation`||e.actionMode===`task_command`?`auto_apply`:e.safetyMode,u;return u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{}}:e.actionMode===`browser_automation`?{kind:`browser_automation`,automationId:e.browserAutomationId.trim(),inputs:e.browserAutomationInputs}:e.actionMode===`task_command`?{kind:`task_command`,taskId:e.taskId.trim(),command:{type:`start`,executor:{kind:`agent`,agentId:e.agentId.trim()}}}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:o,action:u,safety:{mode:l},conversationMode:e.conversationMode,delivery:{notificationPolicy:e.notificationPolicy,destinations:[{key:`gateway_event`,kind:`gateway_event`},...e.resultWebhookEndpoint.trim()&&e.resultWebhookSecretId.trim()?[{key:`result_webhook`,kind:`webhook`,endpoint:e.resultWebhookEndpoint.trim(),secretId:e.resultWebhookSecretId.trim()}]:[]]},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function Xe(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:qe.time,weekday:qe.weekday,cronExpr:e}}function Ze(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function Qe(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function Z(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function $e(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function et(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function tt(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=Z(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=Xe(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...Ze(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:Qe(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?$e(r.input):{},o=e.reliability?.executionTimeoutSeconds??(`timeoutSeconds`in r?r.timeoutSeconds:void 0)??(r.kind===`browser_automation`?600:1800);return{...qe,...n,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:r.kind===`system`?`agent`:r.kind,agentId:r.kind===`agent`||r.kind===`workflow`?r.agentId??``:r.kind===`task_command`&&r.command.type===`start`&&r.command.executor.kind===`agent`?r.command.executor.agentId:``,model:r.kind===`agent`?r.model??``:``,instruction:r.kind===`agent`?r.instruction:``,taskId:r.kind===`task_command`?r.taskId:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserAutomationId:r.kind===`browser_automation`?r.automationId:``,browserAutomationInputs:r.kind===`browser_automation`?r.inputs??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?je(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(o),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.delivery.notificationPolicy,resultWebhookEndpoint:e.delivery.destinations.find(e=>e.kind===`webhook`)?.endpoint??``,resultWebhookSecretId:e.delivery.destinations.find(e=>e.kind===`webhook`)?.secretId??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function nt(e,t,n){let r=Ye(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId,model:r.action.model}:e.action.kind===`workflow`&&r.action.kind===`workflow`?a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}:e.action.kind===`browser_automation`&&r.action.kind===`browser_automation`?a={...e.action,...r.action}:e.action.kind===`task_command`&&r.action.kind===`task_command`&&(a=r.action);let o=e.delivery.destinations.filter(e=>e.kind===`gateway_event`),s=e.delivery.destinations.filter(e=>e.kind===`webhook`);return{...r,description:t.description.trim(),projectId:t.projectId.trim(),delivery:{notificationPolicy:t.notificationPolicy,destinations:[...o.length>0?o:[{key:`gateway_event`,kind:`gateway_event`}],...e.delivery.destinations.filter(e=>e.kind===`file`||e.kind===`card`),...s.slice(1),...t.resultWebhookEndpoint.trim()&&t.resultWebhookSecretId.trim()?[{key:s[0]?.key??`result_webhook`,kind:`webhook`,endpoint:t.resultWebhookEndpoint.trim(),secretId:t.resultWebhookSecretId.trim()}]:[]]},trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}function rt(e){return[`reminder`,`brief`,`review`,`followUp`].map(t=>{let n=e.scenarios[t];return{...n,requiresProject:t===`followUp`,form:{...qe,name:n.name,instruction:t===`reminder`?``:n.instruction,triggerMode:t===`reminder`?`once`:t===`review`?`weekly`:`daily`,time:t===`brief`?`08:30`:t===`review`?`17:00`:`09:00`,weekday:`5`,notificationPolicy:`all`}}})}var it=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function at(e){let t=(0,Re.c)(99),{form:n,setForm:r,labels:i,projects:a,projectLocked:o,source:s,requiresProject:c}=e,l;t[0]===r?l=t[1]:(l=e=>r(t=>({...t,...e})),t[0]=r,t[1]=l);let u=l,d;t[2]!==i.experience.source||t[3]!==s?(d=(0,X.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[i.experience.source,`: `,s]}),t[2]=i.experience.source,t[3]=s,t[4]=d):d=t[4];let f;t[5]===u?f=t[6]:(f=e=>u({name:e.target.value}),t[5]=u,t[6]=f);let p;t[7]!==n.name||t[8]!==f?(p=(0,X.jsx)(`input`,{className:it,value:n.name,onChange:f}),t[7]=n.name,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==i.form.name||t[11]!==p?(m=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.name,p]}),t[10]=i.form.name,t[11]=p,t[12]=m):m=t[12];let h;t[13]===u?h=t[14]:(h=e=>u({instruction:e.target.value}),t[13]=u,t[14]=h);let g;t[15]!==n.instruction||t[16]!==h?(g=(0,X.jsx)(`textarea`,{className:it,rows:5,value:n.instruction,onChange:h}),t[15]=n.instruction,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==i.info.task||t[19]!==g?(_=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.info.task,g]}),t[18]=i.info.task,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==n.projectId||t[22]!==i.form.noProject||t[23]!==i.form.project||t[24]!==o||t[25]!==a||t[26]!==u?(v=!o&&(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.project,(0,X.jsxs)(V,{className:it,value:n.projectId,onChange:e=>u({projectId:e.target.value}),children:[(0,X.jsx)(U,{value:``,children:i.form.noProject}),a.map(ot)]})]}),t[21]=n.projectId,t[22]=i.form.noProject,t[23]=i.form.project,t[24]=o,t[25]=a,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==n.projectId||t[29]!==i.experience.projectRequired||t[30]!==c?(y=c&&!n.projectId?(0,X.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:i.experience.projectRequired}):null,t[28]=n.projectId,t[29]=i.experience.projectRequired,t[30]=c,t[31]=y):y=t[31];let b;t[32]===u?b=t[33]:(b=e=>u({triggerMode:e.target.value}),t[32]=u,t[33]=b);let x;t[34]===i.trigger.once?x=t[35]:(x=(0,X.jsx)(U,{value:`once`,children:i.trigger.once}),t[34]=i.trigger.once,t[35]=x);let S;t[36]===i.trigger.daily?S=t[37]:(S=(0,X.jsx)(U,{value:`daily`,children:i.trigger.daily}),t[36]=i.trigger.daily,t[37]=S);let C;t[38]===i.trigger.weekly?C=t[39]:(C=(0,X.jsx)(U,{value:`weekly`,children:i.trigger.weekly}),t[38]=i.trigger.weekly,t[39]=C);let w;t[40]!==n.triggerMode||t[41]!==b||t[42]!==x||t[43]!==S||t[44]!==C?(w=(0,X.jsxs)(V,{className:it,value:n.triggerMode,onChange:b,children:[x,S,C]}),t[40]=n.triggerMode,t[41]=b,t[42]=x,t[43]=S,t[44]=C,t[45]=w):w=t[45];let T;t[46]!==i.form.trigger||t[47]!==w?(T=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.trigger,w]}),t[46]=i.form.trigger,t[47]=w,t[48]=T):T=t[48];let ee;t[49]!==n.onceAt||t[50]!==n.time||t[51]!==n.triggerMode||t[52]!==i.form.onceAt||t[53]!==i.form.time||t[54]!==u?(ee=n.triggerMode===`once`?(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.onceAt,(0,X.jsx)(`input`,{type:`datetime-local`,className:it,value:n.onceAt,onChange:e=>u({onceAt:e.target.value})})]}):(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,X.jsx)(`span`,{children:i.form.time}),(0,X.jsx)(Ue,{value:n.time,onChange:e=>u({time:e}),ariaLabel:i.form.time})]}),t[49]=n.onceAt,t[50]=n.time,t[51]=n.triggerMode,t[52]=i.form.onceAt,t[53]=i.form.time,t[54]=u,t[55]=ee):ee=t[55];let E;t[56]!==n.triggerMode||t[57]!==n.weekday||t[58]!==i.form.day||t[59]!==i.weekdays||t[60]!==u?(E=n.triggerMode===`weekly`&&(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.day,(0,X.jsx)(V,{className:it,value:n.weekday,onChange:e=>u({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,X.jsx)(U,{value:String(t),children:i.weekdays[e]},e))})]}),t[56]=n.triggerMode,t[57]=n.weekday,t[58]=i.form.day,t[59]=i.weekdays,t[60]=u,t[61]=E):E=t[61];let D;t[62]!==T||t[63]!==ee||t[64]!==E?(D=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[T,ee,E]}),t[62]=T,t[63]=ee,t[64]=E,t[65]=D):D=t[65];let O;t[66]!==n.onceAt||t[67]!==n.triggerMode||t[68]!==i.experience.futureTime?(O=n.triggerMode===`once`&&n.onceAt&&new Date(n.onceAt).getTime()<=Date.now()?(0,X.jsx)(`p`,{role:`status`,className:`text-sm text-red-700 dark:text-red-300`,children:i.experience.futureTime}):null,t[66]=n.onceAt,t[67]=n.triggerMode,t[68]=i.experience.futureTime,t[69]=O):O=t[69];let k;t[70]===i.experience.scheduleNote?k=t[71]:(k=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.experience.scheduleNote}),t[70]=i.experience.scheduleNote,t[71]=k);let A;t[72]===u?A=t[73]:(A=e=>u({notificationPolicy:e.target.value}),t[72]=u,t[73]=A);let j;t[74]===i.draft.notifyAll?j=t[75]:(j=(0,X.jsx)(U,{value:`all`,children:i.draft.notifyAll}),t[74]=i.draft.notifyAll,t[75]=j);let M;t[76]===i.draft.notifyAttention?M=t[77]:(M=(0,X.jsx)(U,{value:`attention`,children:i.draft.notifyAttention}),t[76]=i.draft.notifyAttention,t[77]=M);let N;t[78]===i.draft.notifyNone?N=t[79]:(N=(0,X.jsx)(U,{value:`none`,children:i.draft.notifyNone}),t[78]=i.draft.notifyNone,t[79]=N);let P;t[80]!==n.notificationPolicy||t[81]!==A||t[82]!==j||t[83]!==M||t[84]!==N?(P=(0,X.jsxs)(V,{className:it,value:n.notificationPolicy,onChange:A,children:[j,M,N]}),t[80]=n.notificationPolicy,t[81]=A,t[82]=j,t[83]=M,t[84]=N,t[85]=P):P=t[85];let F;t[86]!==i.draft.notifications||t[87]!==P?(F=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.draft.notifications,P]}),t[86]=i.draft.notifications,t[87]=P,t[88]=F):F=t[88];let I;return t[89]!==y||t[90]!==D||t[91]!==d||t[92]!==O||t[93]!==k||t[94]!==F||t[95]!==m||t[96]!==_||t[97]!==v?(I=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[d,m,_,v,y,D,O,k,F]}),t[89]=y,t[90]=D,t[91]=d,t[92]=O,t[93]=k,t[94]=F,t[95]=m,t[96]=_,t[97]=v,t[98]=I):I=t[98],I}function ot(e){return(0,X.jsx)(U,{value:e.id,children:e.name},e.id)}function st(e,t){let n=new URLSearchParams({draft:e.trim()}),r=t?.trim();return r?n.set(`projectId`,r):n.set(`projectScope`,`none`),`/chat/new?${n.toString()}`}function ct(e,t){return t.reduce((t,n)=>n.automationId===e&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0)}function lt(e,t){let n=ct(e.id,t),r=!!(e.state.lastRunAtMs&&(!n||e.state.lastRunAtMs>n.createdAtMs)),i=r?e.state.lastRunStatus:n?.status??e.state.lastRunStatus;return i!==`failed`&&i!==`timeout`?null:`${i}:${(r?e.state.lastRunAtMs:n?.createdAtMs??e.state.lastRunAtMs)??`unknown`}`}function ut(e,t){return lt(e,t)!==null}var dt=`xopc.automations.dismissedExecutionIssues`;function ft(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(dt)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function pt(e,t,n){return e?Oe(e,n):t.never}function mt(e,t){return e.kind===`system`?e.capability===`home.advisor.refresh`?`Home AI suggestions refresh`:e.capability===`memory.temporal_sweep`?`Memory temporal sweep`:e.capability===`memory.daily_reconciliation`?`Memory daily reconciliation`:`Memory weekly knowledge maintenance`:e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_automation`?`Browser automation: ${e.automationId}`:e.kind===`task_command`?t.action.taskWithId.replace(`{id}`,e.taskId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function ht(e,t){return e.kind===`system`?`System`:e.kind===`workflow`?t.sources.workflow:e.kind===`browser_automation`?t.sources.browser:e.kind===`task_command`?t.sources.task:t.sources.agent}function gt(e,t){return e===`workflow`?t.action.runWorkflow:e===`browser_automation`?t.sources.browser:e===`task_command`?t.action.runTask:t.action.runAgent}function _t(e,t){return e===`cron`?t.trigger.customCron:e===`event`?t.trigger.customEvent:t.trigger[e]}function vt(e){let t=(0,Re.c)(10),{kind:n,className:r}=e;if(n===`system`){let e;return t[0]===r?e=t[1]:(e=(0,X.jsx)(Se,{className:r,"aria-hidden":!0}),t[0]=r,t[1]=e),e}if(n===`workflow`){let e;return t[2]===r?e=t[3]:(e=(0,X.jsx)(ee,{className:r,"aria-hidden":!0}),t[2]=r,t[3]=e),e}if(n===`browser_automation`){let e;return t[4]===r?e=t[5]:(e=(0,X.jsx)(fe,{className:r,"aria-hidden":!0}),t[4]=r,t[5]=e),e}if(n===`task_command`){let e;return t[6]===r?e=t[7]:(e=(0,X.jsx)(c,{className:r,"aria-hidden":!0}),t[6]=r,t[7]=e),e}let i;return t[8]===r?i=t[9]:(i=(0,X.jsx)(M,{className:r,"aria-hidden":!0}),t[8]=r,t[9]=i),i}function yt(e){return e.safety?.mode??`auto_apply`}function bt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function xt(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function St(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function Ct(e){return e.status===`failed`||e.status===`timeout`}function wt(e,t){return e.action.kind===`system`?mt(e.action,t):e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`?e.action.goal?.trim()||mt(e.action,t):(e.action.kind,mt(e.action,t))}function Tt(e){return e.description?.trim()??``}function Et(e){return St(e)?0:Ct(e)?1:e.status===`succeeded`?2:3}function Dt(e){return[...e].sort((e,t)=>{let n=Et(e)-Et(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function Ot(){let e=(0,Re.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`section`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-edge-subtle bg-edge-subtle xl:grid-cols-4`,children:Array.from({length:4}).map(At)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,X.jsx)(P,{className:`h-4 w-36`}),(0,X.jsx)(P,{className:`h-3 w-56 max-w-full`})]}),(0,X.jsx)(P,{className:`h-7 w-20 rounded-full`})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[n,(0,X.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(kt)})]}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(P,{className:`h-4 w-32`}),a=(0,X.jsx)(P,{className:`mt-4 h-24 rounded-lg`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,X.jsxs)(`div`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[minmax(18rem,0.8fr)_minmax(0,1.5fr)]`,children:[r,(0,X.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[i,a,(0,X.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,X.jsx)(P,{className:`h-12 rounded-lg`}),(0,X.jsx)(P,{className:`h-12 rounded-lg`}),(0,X.jsx)(P,{className:`h-12 rounded-lg`})]})]})]})]}),e[5]=o):o=e[5],o}function kt(e,t){return(0,X.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(P,{className:`size-4 rounded-full`}),(0,X.jsx)(P,{className:`h-4 w-32`}),(0,X.jsx)(P,{className:`h-5 w-20 rounded-full`})]}),(0,X.jsx)(P,{className:`mt-3 h-4 w-full`}),(0,X.jsx)(P,{className:`mt-2 h-4 w-3/5`})]}),(0,X.jsx)(P,{className:`h-8 w-24 rounded-md`})]})},t)}function At(e,t){return(0,X.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2.5 bg-surface-base px-3 py-2.5`,children:[(0,X.jsx)(P,{className:`size-4 rounded-full`}),(0,X.jsx)(P,{className:`h-3 w-14`}),(0,X.jsx)(P,{className:`ml-auto h-4 w-10`})]},t)}function jt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let o=h(e=>e.language),s=p(o),l=s.automations,u=s.productNavigation.sections[`automation-triggers`],C=s.cron,D=A(e=>e.setPageHeader),N=A(e=>e.clearPageHeader),P=i(),[F,z]=a(),te=!t&&F.get(`view`)===`activity`,ne=F.get(`run`)?.trim()??``,ie=F.get(`automation`)?.trim()??``,oe=F.get(`draft`)?.trim()??``,se=F.get(`action`)?.trim()??``,ce=F.get(`taskId`)?.trim()??``,ue=F.get(`projectId`)?.trim()??``,W=e?.trim()||ue,Ce=!!e?.trim(),we=F.get(`autogenerate`)===`1`,De=(0,Y.useRef)(``),Oe=F.get(`status`),K=Oe===`active`||Oe===`paused`||Oe===`running`||Oe===`attention`?Oe:`all`,q=F.get(`ownership`)===`system`?`system`:`user`,je=F.get(`source`),J=je===`agent`||je===`workflow`||je===`task_command`||je===`browser_automation`?je:`all`,Me=F.get(`q`)??``,Ne=e=>z(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`status`):n.set(`status`,e),n.delete(`automation`),n}),Ie=e=>z(t=>{let n=new URLSearchParams(t);return e===`user`?n.delete(`ownership`):n.set(`ownership`,e),n.delete(`automation`),n}),Le=e=>z(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n.delete(`automation`),n},{replace:!0}),Re=e=>z(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`source`):n.set(`source`,e),n.delete(`automation`),n}),ze=()=>z(e=>{let t=new URLSearchParams(e);return t.delete(`status`),t.delete(`source`),t.delete(`q`),t.delete(`automation`),t}),[Be,Ve]=(0,Y.useState)(null),[He,Ue]=(0,Y.useState)(!1),[We,Ge]=(0,Y.useState)(`blank`),[Je,Xe]=(0,Y.useState)(null),[Ze,Qe]=(0,Y.useState)(!1),[Z,$e]=(0,Y.useState)(qe),[it,ot]=(0,Y.useState)(null),[pt,mt]=(0,Y.useState)(null),[ht,gt]=(0,Y.useState)(!1),[_t,vt]=(0,Y.useState)(null),[yt,bt]=(0,Y.useState)(``),[xt,Ct]=(0,Y.useState)(null),[Et,kt]=(0,Y.useState)(!1),[At,jt]=(0,Y.useState)(!1),[Ft,It]=(0,Y.useState)(W),[Lt,Vt]=(0,Y.useState)(`new_session`),[Ht,Ut]=(0,Y.useState)(`attention`),[Wt,qt]=(0,Y.useState)(null),[Jt,Yt]=(0,Y.useState)(!1),[Xt,Zt]=(0,Y.useState)(!1),[Qt,$t]=(0,Y.useState)(!1),[nn,rn]=(0,Y.useState)(null),[$,an]=(0,Y.useState)(ft),on=S([`automations`,W],()=>G.list(W?{projectId:W}:void 0),{keepPreviousData:!0,refreshInterval:15e3}),sn=S([`automation-runs`,W],()=>G.runs(50,void 0,W?{projectId:W}:void 0),{keepPreviousData:!0,refreshInterval:1e4}),cn=S(W?`automations-global-system-source`:null,()=>G.list(),{keepPreviousData:!0,refreshInterval:15e3}),ln=S(W?`automation-runs-global-system-source`:null,()=>G.runs(50),{keepPreviousData:!0,refreshInterval:1e4}),un=S(_t?[`automation-history`,_t,W]:null,()=>G.runs(50,_t,W?{projectId:W}:void 0),{refreshInterval:1e4}),dn=S(pt?`automation-run-events:${pt}`:null,()=>G.runEvents(pt),{refreshInterval:5e3}),fn=S(`automation-workflow-definitions`,ye),pn=S(`automation-browser-automations`,()=>Pe.list()),mn=S(`automation-chat-agents`,ge),hn=S(`automation-tasks`,G.tasks),gn=S(`automation-projects`,()=>E({sortBy:`name`,sortOrder:`asc`,limit:200})),_n=on.isLoading&&!on.data||sn.isLoading&&!sn.data||!!W&&cn.isLoading&&!cn.data||!!W&&ln.isLoading&&!ln.data,vn=!_n&&(on.isLoading||sn.isLoading||cn.isLoading||ln.isLoading),yn=on.data?.automations??[],bn=W?cn.data?.automations??[]:yn,xn=(0,Y.useMemo)(()=>Dt(sn.data?.runs??[]),[sn.data?.runs]),Sn=(0,Y.useMemo)(()=>W?Dt(ln.data?.runs??[]):xn,[ln.data?.runs,W,xn]),Cn=(0,Y.useMemo)(()=>yn.filter(e=>!Ke(e)),[yn]),wn=(0,Y.useMemo)(()=>bn.filter(Ke),[bn]),Tn=(0,Y.useMemo)(()=>[...Cn,...wn],[wn,Cn]),En=(0,Y.useMemo)(()=>new Set(wn.map(e=>e.id)),[wn]),Dn=(0,Y.useMemo)(()=>xn.filter(e=>!En.has(e.automationId)),[xn,En]),On=(0,Y.useMemo)(()=>Sn.filter(e=>En.has(e.automationId)),[Sn,En]),kn=(0,Y.useMemo)(()=>W?[...xn,...On]:xn,[W,xn,On]),An=(0,Y.useMemo)(()=>kn.find(e=>e.id===pt)??un.data?.runs.find(e=>e.id===pt)??null,[kn,pt,un.data]),jn=(0,Y.useMemo)(()=>Tn.find(e=>e.id===_t)??null,[Tn,_t]),Mn=(0,Y.useMemo)(()=>Tn.find(e=>e.id===Je)??null,[Tn,Je]),Nn=(0,Y.useMemo)(()=>[...un.data?.runs??kn].filter(e=>e.automationId===_t).sort((e,t)=>t.createdAtMs-e.createdAtMs),[kn,_t,un.data]),Pn=dn.data?.events??[],Fn=(0,Y.useMemo)(()=>Dn.filter(e=>!St(e)&&e.readAtMs==null),[Dn]),In=Me.trim().toLocaleLowerCase(),Ln=q===`system`?wn:Cn,Rn=q===`system`?On:Dn,zn=(0,Y.useMemo)(()=>new Set(Rn.filter(St).map(e=>e.automationId)),[Rn]),Bn=(0,Y.useMemo)(()=>Ln.filter(e=>K===`attention`&&!ut(e,Rn)||K===`running`&&!zn.has(e.id)||K===`active`&&!e.enabled||K===`paused`&&e.enabled||J!==`all`&&e.action.kind!==J?!1:In?[e.name,Tt(e),wt(e,l),Te(e.trigger,l,C,o)].some(e=>e.toLocaleLowerCase().includes(In)):!0),[C,K,l,o,In,Ln,Rn,zn,J]),Vn=(0,Y.useMemo)(()=>fn.data??[],[fn.data]),Hn=(0,Y.useMemo)(()=>(pn.data?.automations??[]).filter(e=>e.enabled),[pn.data]),Un=mn.data?.items??[],Wn=(0,Y.useMemo)(()=>(hn.data?.items??[]).map(e=>e.task),[hn.data]),Gn=gn.data?.items??[],Kn=(0,Y.useMemo)(()=>Vn.find(e=>e.id===Z.workflowId.trim())??null,[Z.workflowId,Vn]),qn=(0,Y.useMemo)(()=>Hn.find(e=>e.id===Z.browserAutomationId.trim())??null,[Hn,Z.browserAutomationId]),Jn=Z.actionMode===`workflow`&&(!Z.workflowId.trim()||Vn.length>0&&!Vn.some(e=>e.id===Z.workflowId)),Yn=Z.actionMode===`workflow`&&Kn?!Ae(Kn,Z.workflowInput,Z.workflowInputValid).valid:!1,Xn=!!Mn?.management?.editable.includes(`trigger`),Zn=[`daily`,`weekly`,`interval`,`cron`].includes(Z.triggerMode)&&(![`daily`,`weekly`].includes(Z.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(Z.time))&&(Z.triggerMode!==`interval`||ke(Z.intervalValue,Z.intervalUnit)>=6e4)&&(Z.triggerMode!==`cron`||!!Z.cronExpr.trim()),Qn=Xn?Zn:!!Z.name.trim()&&(Z.triggerMode!==`once`||Number.isFinite(new Date(Z.onceAt).getTime())&&(!!Mn||new Date(Z.onceAt).getTime()>Date.now()))&&(![`daily`,`weekly`].includes(Z.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(Z.time))&&(Z.triggerMode!==`event`||!!Z.eventType.trim()&&et(Z.eventPayloadMatch))&&(Z.actionMode===`workflow`?!Jn&&!Yn:Z.actionMode===`browser_automation`?qn!==null&&Fe(qn,Z.browserAutomationInputs):Z.actionMode===`task_command`?!!(Z.taskId.trim()&&Z.agentId.trim()):!!Z.instruction.trim()),$n=(0,Y.useMemo)(()=>rt(l),[l]),er=(0,Y.useMemo)(()=>Cn.filter(e=>ut(e,Dn)),[Cn,Dn]),tr=(0,Y.useMemo)(()=>Ln.filter(e=>ut(e,Rn)),[Ln,Rn]),nr=er.some(e=>{let t=lt(e,Dn);return t!==null&&$[e.id]!==t}),rr=Rn.filter(St).length,ir=Ln.filter(e=>e.enabled&&e.state.nextRunAtMs).sort((e,t)=>(e.state.nextRunAtMs??1/0)-(t.state.nextRunAtMs??1/0))[0],ar=(0,Y.useMemo)(()=>({all:Ln.length,agent:Ln.filter(e=>e.action.kind===`agent`).length,workflow:Ln.filter(e=>e.action.kind===`workflow`).length,task_command:Ln.filter(e=>e.action.kind===`task_command`).length,browser_automation:Ln.filter(e=>e.action.kind===`browser_automation`).length}),[Ln]),or=Number(K!==`all`)+Number(J!==`all`),sr=(0,Y.useCallback)(()=>{an(e=>{let t={...e};for(let e of er){let n=lt(e,Dn);n&&(t[e.id]=n)}try{window.localStorage.setItem(dt,JSON.stringify(t))}catch{}return t})},[er,Dn]);(0,Y.useEffect)(()=>{if(!vn){if(Bn.length===0){vt(null);return}if(ie&&Bn.some(e=>e.id===ie)){vt(ie);return}_t&&Bn.some(e=>e.id===_t)||vt(Bn[0].id)}},[ie,Bn,vn,_t]);let cr=(0,Y.useCallback)(async()=>{await Promise.all([on.mutate(),sn.mutate(),cn.mutate(),ln.mutate(),un.mutate(),dn.mutate()])},[on.mutate,cn.mutate,ln.mutate,dn.mutate,sn.mutate,un.mutate]),lr=(0,Y.useCallback)(e=>{if(Ce){vt(null),mt(null);return}z(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),vt(null),mt(null)},[Ce,z]);(0,Y.useEffect)(()=>{Ce&&(It(W),$e(e=>e.projectId===W?e:{...e,projectId:W}))},[W,Ce]);let ur=(0,Y.useCallback)(e=>{if(Xe(null),Qe(!1),ot(null),Ge(e),Ue(!0),e===`blank`){$e({...qe,projectId:W});return}bt(``),Ct(null),jt(!1),It(W),Vt(`new_session`),Ut(`attention`)},[W]),dr=(0,Y.useCallback)(()=>{P(st(l.createWithAssistantPrompt,W))},[l.createWithAssistantPrompt,P,W]),fr=e=>{Ve(e),$e({...e.form,projectId:W}),Xe(null),Qe(!1),ot(null),Ge(`quick`),Ue(!0)},pr=(0,Y.useCallback)(e=>{$e(tt(e,Vn)),Xe(e.id),Qe(!1),vt(null),Ge(`blank`),Ue(!0)},[Vn]),mr=(0,Y.useCallback)(()=>{xt&&($e({...tt(xt.automation,Vn),projectId:Ft,conversationMode:Lt,notificationPolicy:Ht}),Xe(null),Qe(!0),Ge(`blank`))},[xt,Lt,Ht,Ft,Vn]),hr=(0,Y.useCallback)(async()=>{$t(!0),ot(null);try{await cr()}catch(e){ot(e instanceof Error?e.message:String(e))}finally{$t(!1)}},[l.feedback.actionFailed,cr]);(0,Y.useEffect)(()=>{let e=Tn.find(e=>e.id===ie);!e||!Ke(e)||q===`system`||z(e=>{let t=new URLSearchParams(e);return t.set(`ownership`,`system`),t},{replace:!0})},[ie,Tn,q,z]),(0,Y.useEffect)(()=>{se===`create`&&(ur(`blank`),ce&&$e(e=>({...e,actionMode:`task_command`,taskId:ce,safetyMode:`auto_apply`})),z(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t.delete(`taskId`),t},{replace:!0}))},[se,ur,z,ce]),(0,Y.useEffect)(()=>{if(!oe)return;let e=`${o}:${we?`auto`:`seed`}:${oe}`;De.current!==e&&(De.current=e,bt(oe),Ct(null),jt(!1),It(W),Ge(`draft`),Ue(!0),z(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),we&&(ot(null),kt(!0),G.draft({prompt:oe,language:o}).then(e=>{Ct(e.draft),jt(!1)}).catch(e=>{ot(e instanceof Error?e.message:String(e))}).finally(()=>{kt(!1)})))},[we,oe,o,W,z]);let gr=(0,Y.useCallback)(e=>{let t=xn.find(t=>t.id===e)??un.data?.runs.find(t=>t.id===e);if(!t||St(t)||t.readAtMs!=null)return;let n=Date.now();sn.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),un.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),G.markRunRead(e).catch(e=>{ot(e instanceof Error?e.message:String(e)),sn.mutate(),un.mutate()})},[xn,sn.mutate,un.data,un.mutate]),_r=(0,Y.useCallback)(e=>{gr(e),mt(e),gt(!0),z(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[gr,z]),vr=(0,Y.useCallback)(e=>{vt(e);let t=ct(e,kn);z(t=>{let n=new URLSearchParams(t);return n.set(`automation`,e),n},{replace:!0}),t&&t.readAtMs==null&&!St(t)&&gr(t.id)},[kn,gr,z]),yr=(0,Y.useCallback)(()=>{if(!ir)return;vt(ir.id);let e=ct(ir.id,kn);z(e=>{let t=new URLSearchParams(e);return t.delete(`status`),t.delete(`source`),t.delete(`q`),t.set(`automation`,ir.id),t},{replace:!0}),e&&e.readAtMs==null&&!St(e)&&gr(e.id)},[kn,gr,ir,z]);(0,Y.useEffect)(()=>{ne&&(gr(ne),mt(ne),gt(!0))},[gr,ne]),(0,Y.useEffect)(()=>{qt(null),Zt(!1)},[pt]);async function br(){if(ot(null),Z.triggerMode===`once`&&!Mn&&new Date(Z.onceAt).getTime()<=Date.now()){ot(l.experience.futureTime);return}if(!(!Qn||nn)&&!(We===`quick`&&Be?.requiresProject&&!Z.projectId)){if(Ze&&xt){rn(`draft:edit`);try{let e=Ye(Z,Kn),{simulation:t}=await G.simulate(e);Ct({...xt,automation:e,simulation:t}),It(Z.projectId),Vt(Z.conversationMode),Ut(Z.notificationPolicy),jt(!1),Qe(!1),Ge(`draft`)}catch(e){ot(e instanceof Error?e.message:String(e))}finally{rn(null)}return}if(Mn){let e=Mn.id;await xr(`automation:${e}:edit`,()=>G.update(e,Xn?{trigger:nt(Mn,{...Z,instruction:`managed`},null).trigger}:nt(Mn,Z,Kn)))&&(Ue(!1),Xe(null),vt(e));return}rn(`automation:create`);try{let e=Ye(Z,Kn),{automation:t}=await G.create(e);$e(qe),Ue(!1),z(e=>{let n=new URLSearchParams(e);return n.delete(`status`),n.delete(`q`),n.delete(`run`),n.set(`automation`,t.id),Ce||(t.projectId?n.set(`projectId`,t.projectId):n.delete(`projectId`)),n}),await cr(),vt(t.id)}catch(e){ot(e instanceof Error?e.message:String(e))}finally{rn(null)}}}async function xr(e,t){ot(null),rn(e);try{return await t(),await cr(),!0}catch(e){return ot(e instanceof Error?e.message:String(e)),!1}finally{rn(null)}}async function Sr(){await xr(`runs:read-all`,()=>G.markAllRunsRead(W||void 0))}async function Cr(){let e=yt.trim();if(e){ot(null),kt(!0);try{Ct((await G.draft({prompt:e,language:o})).draft),jt(!1)}catch(e){ot(e instanceof Error?e.message:String(e))}finally{kt(!1)}}}async function wr(){if(!xt)return;let e=``,t=``;await xr(`draft:publish`,async()=>{let{automation:n}=await G.create({...xt.automation,...Ft?{projectId:Ft}:{projectId:void 0},conversationMode:Lt,delivery:{...xt.automation.delivery,notificationPolicy:Ht}});Ct(null),bt(``),jt(!1),Ue(!1),Ne(`all`),Le(``),e=n.id,t=n.projectId??``})&&e&&(lr(t),vt(e))}async function Tr(){if(!xt)return;let e=``,t=``,n=``;await xr(`draft:test`,async()=>{let{automation:r}=await G.create({...xt.automation,...Ft?{projectId:Ft}:{projectId:void 0},conversationMode:Lt,delivery:{...xt.automation.delivery,notificationPolicy:Ht},enabled:!1}),{run:i}=await G.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,Ct(null),bt(``),jt(!1),Ue(!1),Ne(`all`),Le(``)})&&e&&n&&(lr(t),vt(e),_r(n))}async function Er(e){ot(null),Yt(!0),qt(null),Zt(!1);try{qt((await G.repairDraft(e.id,{language:o})).repair)}catch(e){ot(e instanceof Error?e.message:String(e))}finally{Yt(!1)}}async function Dr(e){Wt&&await xr(`run:${e.id}:repair`,async()=>{await G.update(e.automationId,Wt.patch),qt(null),Zt(!1)})}let Or=(0,Y.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(R,{className:`size-9 shrink-0 p-0`,loading:Qt,label:l.refresh,onClick:hr}),(0,X.jsxs)(`div`,{className:`inline-flex h-9 shrink-0`,role:`group`,"aria-label":l.createOptions,children:[(0,X.jsxs)(L,{variant:`primary`,className:`h-9 rounded-r-none pr-2.5`,onClick:dr,children:[(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0}),l.create]}),(0,X.jsxs)(pe,{children:[(0,X.jsx)(re,{asChild:!0,children:(0,X.jsx)(L,{variant:`primary`,className:`h-9 w-9 rounded-l-none border-l border-white/20 px-0`,"aria-label":l.createOptions,title:l.createOptions,children:(0,X.jsx)(ve,{className:`size-4`,"aria-hidden":!0})})}),(0,X.jsx)(de,{children:(0,X.jsxs)(ae,{align:`end`,sideOffset:6,className:`z-70 min-w-52 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,X.jsxs)(_e,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:dr,children:[(0,X.jsx)(T,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.createWithAssistant]}),(0,X.jsxs)(_e,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:()=>ur(`blank`),children:[(0,X.jsx)(xe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.setUpManually]})]})})]})]})]}),[l.create,l.createOptions,l.createWithAssistant,l.refresh,l.setUpManually,dr,ur,Qt,hr]);return(0,Y.useLayoutEffect)(()=>{if(!t)return D({startExtra:null,main:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:u}),end:Or}),()=>N()},[N,t,Or,u,D]),(0,X.jsxs)(`div`,{className:m(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,X.jsxs)(`div`,{className:m(`flex w-full flex-col gap-4`,t?`py-1`:`mx-auto max-w-[96rem] px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`),children:[t?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Se,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||l.title})]}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||l.subtitle})]}),Or]}):null,it||on.error||sn.error||cn.error||ln.error?(0,X.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:it||l.feedback.actionFailed}):null,te?_n?(0,X.jsx)(Ot,{}):(0,X.jsx)(zt,{runs:Rn,ownership:q,labels:l,language:o,unreadCount:q===`user`?Fn.length:0,loading:vn||Qt,onOwnershipChange:Ie,onRefresh:hr,onSelectRun:_r}):(0,X.jsxs)(X.Fragment,{children:[_n?null:(0,X.jsxs)(`section`,{"aria-labelledby":`automation-overview-title`,children:[(0,X.jsx)(`h2`,{id:`automation-overview-title`,className:`sr-only`,children:l.overview.title}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-edge-subtle bg-edge-subtle xl:grid-cols-4`,children:[(0,X.jsx)(Rt,{icon:(0,X.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),label:l.metrics.enabled,value:String(Ln.filter(e=>e.enabled).length),active:K===`active`,onClick:()=>Ne(`active`)}),(0,X.jsx)(Rt,{icon:(0,X.jsx)(le,{className:`size-4`,"aria-hidden":!0}),label:l.metrics.running,value:String(rr),active:K===`running`,onClick:()=>Ne(`running`)}),(0,X.jsx)(Rt,{icon:(0,X.jsx)(he,{className:`size-4`,"aria-hidden":!0}),label:l.dashboard.needsAttention,value:String(tr.length),tone:tr.length>0?`danger`:`default`,active:K===`attention`,onClick:()=>Ne(`attention`)}),(0,X.jsx)(Rt,{icon:(0,X.jsx)(H,{className:`size-4`,"aria-hidden":!0}),label:l.metrics.next,value:ir?Ee(ir.state.nextRunAtMs,o):`—`,onClick:ir?yr:void 0})]})]}),!_n&&nr&&q===`user`?(0,X.jsxs)(`div`,{className:`flex items-center rounded-lg border border-red-500/20 bg-red-500/5`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>Ne(`attention`),className:`flex min-w-0 flex-1 items-center gap-3 rounded-l-lg px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,X.jsx)(he,{className:`size-4 shrink-0 text-red-700 dark:text-red-300`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 text-sm text-fg`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[l.experience.executionIssues,` · `,er.length]}),(0,X.jsx)(`span`,{className:`ml-2 text-fg-muted`,children:l.experience.issuesDescription})]})]}),(0,X.jsx)(`button`,{type:`button`,onClick:sr,className:`mr-2 rounded-md p-2 text-fg-muted hover:bg-red-500/10 hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l.close,title:l.close,children:(0,X.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,_n?(0,X.jsx)(Ot,{}):(0,X.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[minmax(18rem,0.8fr)_minmax(0,1.5fr)]`,"aria-busy":vn,children:[(0,X.jsxs)(`aside`,{className:`flex max-h-[42rem] flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface xl:sticky xl:top-20 xl:max-h-[calc(100vh-7rem)]`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[Ce?null:(0,X.jsxs)(V,{"aria-label":l.filters.project,className:Q,value:W,onChange:e=>lr(e.target.value),children:[(0,X.jsx)(U,{value:``,children:l.filters.allProjects}),Gn.map(e=>(0,X.jsx)(U,{value:e.id,children:e.name},e.id))]}),(0,X.jsxs)(`div`,{className:m(`flex items-center gap-2`,!Ce&&`mt-2`),children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg-muted focus-within:border-accent`,children:[(0,X.jsx)(me,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,X.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:Me,onChange:e=>Le(e.target.value),placeholder:l.filters.search,"aria-label":l.filters.search})]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(O,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:m(`inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,or>0&&`border-accent/40 bg-accent/8 text-accent-fg`),"aria-label":l.filters.more,children:[(0,X.jsx)(j,{className:`size-4`,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:l.filters.more}),or>0?(0,X.jsx)(`span`,{className:`inline-flex min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-[11px] leading-5 text-on-accent`,children:or}):null]})}),(0,X.jsx)(I,{children:(0,X.jsxs)(be,{align:`end`,sideOffset:6,className:`z-[90] w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-edge bg-surface-overlay p-3 shadow-popover outline-none`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.filters.status}),(0,X.jsx)(w,{className:`mt-2 flex flex-wrap gap-1`,role:`group`,"aria-label":l.filters.status,indicatorClassName:`rounded-md bg-surface-active`,children:[{id:`all`,label:l.filters.all},{id:`active`,label:l.filters.active},{id:`running`,label:l.metrics.running},{id:`paused`,label:l.paused},{id:`attention`,label:l.experience.executionIssues}].map(e=>(0,X.jsx)(`button`,{type:`button`,className:m(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,K===e.id&&`bg-surface-active text-fg`),onClick:()=>Ne(e.id),"aria-pressed":K===e.id,children:e.label},e.id))}),(0,X.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.filters.executor}),(0,X.jsx)(w,{className:`mt-2 flex flex-wrap gap-1`,role:`group`,"aria-label":l.filters.executor,indicatorClassName:`rounded-md border border-edge bg-surface-active`,children:[{id:`all`,label:l.filters.allSources,icon:Se},{id:`agent`,label:l.sources.agent,icon:M},{id:`workflow`,label:l.sources.workflow,icon:ee},{id:`task_command`,label:l.sources.task,icon:c},{id:`browser_automation`,label:l.sources.browser,icon:fe}].map(e=>(0,X.jsxs)(`button`,{type:`button`,className:m(`flex min-h-8 items-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,J===e.id&&`border-edge bg-surface-active text-fg`),onClick:()=>Re(e.id),"aria-pressed":J===e.id,children:[(0,X.jsx)(e.icon,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{className:`text-fg-subtle`,children:ar[e.id]})]},e.id))})]}),or>0?(0,X.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,X.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:ze,children:l.filters.clear})}):null]})})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:l.filters.ownership}),(0,X.jsxs)(w,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":l.filters.ownership,indicatorClassName:`rounded-md bg-surface-base shadow-sm`,children:[(0,X.jsxs)(`button`,{type:`button`,className:m(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,q===`user`&&`bg-surface-base text-fg shadow-sm`),onClick:()=>Ie(`user`),"aria-pressed":q===`user`,children:[l.filters.userManaged,` · `,Cn.length]}),(0,X.jsxs)(`button`,{type:`button`,className:m(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,q===`system`&&`bg-surface-base text-fg shadow-sm`),onClick:()=>Ie(`system`),"aria-pressed":q===`system`,children:[l.system.title,` · `,wn.length]})]})]}),Fn.length>0&&q===`user`?(0,X.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 rounded-md bg-accent/8 px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,X.jsxs)(`span`,{children:[l.filters.unread,` · `,Fn.length]}),(0,X.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:nn===`runs:read-all`,onClick:()=>void Sr(),children:l.filters.markAllRead})]}):null,(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[vn?(0,X.jsx)(B,{className:`size-3 animate-spin`,"aria-hidden":!0}):null,vn?l.loading:l.filters.results.replace(`{count}`,String(Bn.length))]}),K!==`all`||J!==`all`||In?(0,X.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:ze,children:l.filters.clear}):null]})]}),(0,X.jsx)(Bt,{automations:Bn,runs:Rn,labels:l,cronLabels:C,language:o,selectedAutomationId:_t,onOpenDetails:vr})]}),jn?(0,X.jsx)(Kt,{automation:jn,runs:Nn,runsLoading:un.isLoading,runsError:un.error?l.feedback.actionFailed:void 0,labels:l,cronLabels:C,language:o,projects:Gn,busyAction:nn,onEdit:pr,onSelectRun:_r,onAction:xr},jn.id):(0,X.jsx)(`div`,{className:`min-h-[28rem] overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:q===`user`&&Ln.length===0?(0,X.jsxs)(`div`,{className:`p-5`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:l.experience.starterTemplates}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.experience.starterTemplatesDescription}),(0,X.jsx)(Mt,{templates:$n,labels:l,onSelect:fr}),(0,X.jsx)(L,{className:`mt-4`,variant:`ghost`,onClick:()=>ur(`draft`),children:l.experience.custom})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(en,{className:`min-h-56 rounded-none border-0 shadow-none`,icon:(0,X.jsx)(Se,{className:`size-5`}),title:Ln.length===0?l.empty.automations:l.empty.filtered}),Ln.length>0?(0,X.jsx)(`div`,{className:`flex justify-center border-t border-edge-subtle p-4`,children:(0,X.jsx)(L,{variant:`ghost`,onClick:ze,children:l.filters.clear})}):null]})})]}),!_n&&Cn.length>0?(0,X.jsx)(`div`,{children:(0,X.jsxs)(L,{variant:`ghost`,onClick:()=>ur(`draft`),children:[(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0}),l.experience.discover]})}):null]})]}),(0,X.jsx)(x,{open:He,onOpenChange:e=>{Ue(e),e||(Xe(null),Qe(!1))},children:(0,X.jsxs)(v,{children:[(0,X.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,X.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(b,{className:`text-base font-semibold text-fg`,children:We===`draft`?l.draft.title:Mn?l.editTitle:Ze?l.draft.editTitle:l.createTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:We===`draft`?l.draft.subtitle:l.form.createFlowHint})]}),(0,X.jsx)(_,{asChild:!0,children:(0,X.jsx)(L,{variant:`ghost`,"aria-label":l.close,children:(0,X.jsx)(f,{className:`size-4`})})})]}),it?(0,X.jsx)(`p`,{role:`alert`,className:`px-5 py-2 text-sm text-red-700 dark:text-red-300`,children:it}):null,We===`draft`?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,X.jsx)(Pt,{labels:l,prompt:yt,draft:xt,loading:Et,approved:At,publishBusy:nn===`draft:publish`,testBusy:nn===`draft:test`,templates:$n,projects:Gn,projectId:Ft,conversationMode:Lt,notificationPolicy:Ht,onPromptChange:bt,onGenerate:Cr,onEdit:mr,onPublish:wr,onTest:Tr,onProjectChange:It,onConversationModeChange:Vt,onNotificationPolicyChange:Ut,projectLocked:Ce,onApprovedChange:jt,onDiscard:()=>{Ct(null),jt(!1)},onTemplateSelect:e=>{fr(e),$e({...e.form,projectId:Ft})},onOpenAdvanced:()=>{$e({...qe,projectId:Ft,conversationMode:Lt,notificationPolicy:Ht}),Ge(`blank`)}})}):(0,X.jsxs)(X.Fragment,{children:[Xn?(0,X.jsx)(Nt,{form:Z,setForm:$e,labels:l}):We===`quick`&&Be?(0,X.jsx)(at,{form:Z,setForm:$e,labels:l,projects:Gn,projectLocked:Ce,source:Be.source,requiresProject:Be.requiresProject}):(0,X.jsx)(tn,{form:Z,labels:l,setForm:$e,projects:Gn,workflowDefinitions:Vn,selectedWorkflow:Kn,workflowsLoading:fn.isLoading,browserAutomations:Hn,selectedBrowserAutomation:qn,browserAutomationsLoading:pn.isLoading,agentOptions:Un,agentsLoading:mn.isLoading,defaultAgentId:mn.data?.defaultId??``,taskOptions:Wn,tasksLoading:hn.isLoading,language:o,projectLocked:Ce}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[We===`quick`?(0,X.jsx)(L,{variant:`ghost`,onClick:()=>Ge(`blank`),children:l.draft.advancedCreate}):null,Ze?(0,X.jsx)(L,{variant:`ghost`,onClick:()=>{Qe(!1),Ge(`draft`)},children:l.cancel}):(0,X.jsx)(_,{asChild:!0,children:(0,X.jsx)(L,{variant:`ghost`,children:l.cancel})}),(0,X.jsx)(L,{variant:`primary`,onClick:br,disabled:!Qn||!!nn||We===`quick`&&!!Be?.requiresProject&&!Z.projectId,children:nn===`automation:create`||nn===`draft:edit`||Mn&&nn===`automation:${Mn.id}:edit`?l.feedback.working:Mn||Ze?l.save:l.experience.createEnabled})]})]})]})]})}),(0,X.jsx)(x,{open:ht&&!!An,onOpenChange:e=>{gt(e),!e&&z(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,X.jsxs)(v,{children:[(0,X.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,X.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(b,{className:`truncate text-base font-semibold text-fg`,children:An?.automationName??l.dashboard.result}),(0,X.jsx)(_,{asChild:!0,children:(0,X.jsx)(L,{variant:`ghost`,"aria-label":l.close,children:(0,X.jsx)(f,{className:`size-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,X.jsx)(Gt,{className:`rounded-none border-0`,run:An,events:Pn,labels:l,cronLabels:C,language:o,loading:dn.isLoading,repairDraft:Wt,repairLoading:Jt,repairApproved:Xt,busyAction:nn,onRepairApprovedChange:Zt,onSuggestRepair:Er,onApplyRepair:Dr})})]})]})})]})}function Mt(e){let t=(0,Re.c)(9),{templates:n,labels:r,onSelect:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n){let e;t[4]!==r||t[5]!==i?(e=e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge-subtle bg-surface-panel p-4 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,X.jsx)(H,{className:`mb-3 size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.description}),(0,X.jsxs)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:[r.experience.source,`: `,e.source]})]},e.name),t[4]=r,t[5]=i,t[6]=e):e=t[6],a=n.map(e),t[0]=r,t[1]=i,t[2]=n,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,X.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:a}),t[7]=a,t[8]=o),o}function Nt(e){let t=(0,Re.c)(48),{form:n,setForm:r,labels:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(t=>({...t,...e})),t[0]=r,t[1]=a);let o=a,s;t[2]!==i.form.trigger||t[3]!==i.form.triggerStepDescription?(s=(0,X.jsx)(an,{step:`1`,title:i.form.trigger,description:i.form.triggerStepDescription}),t[2]=i.form.trigger,t[3]=i.form.triggerStepDescription,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=e=>o({triggerMode:e.target.value}),t[5]=o,t[6]=c);let l;t[7]===i.trigger.daily?l=t[8]:(l=(0,X.jsx)(U,{value:`daily`,children:i.trigger.daily}),t[7]=i.trigger.daily,t[8]=l);let u;t[9]===i.trigger.weekly?u=t[10]:(u=(0,X.jsx)(U,{value:`weekly`,children:i.trigger.weekly}),t[9]=i.trigger.weekly,t[10]=u);let d;t[11]===i.trigger.interval?d=t[12]:(d=(0,X.jsx)(U,{value:`interval`,children:i.trigger.interval}),t[11]=i.trigger.interval,t[12]=d);let f;t[13]===i.trigger.customCron?f=t[14]:(f=(0,X.jsx)(U,{value:`cron`,children:i.trigger.customCron}),t[13]=i.trigger.customCron,t[14]=f);let p;t[15]!==n.triggerMode||t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d||t[20]!==f?(p=(0,X.jsxs)(V,{className:Q,value:n.triggerMode,onChange:c,children:[l,u,d,f]}),t[15]=n.triggerMode,t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=f,t[21]=p):p=t[21];let m;t[22]!==n.time||t[23]!==n.triggerMode||t[24]!==n.weekday||t[25]!==i.form.day||t[26]!==i.form.time||t[27]!==i.weekdays||t[28]!==o?(m=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)($,{label:i.form.time,children:(0,X.jsx)(Ue,{value:n.time,onChange:e=>o({time:e}),ariaLabel:i.form.time})}),n.triggerMode===`weekly`?(0,X.jsx)($,{label:i.form.day,children:(0,X.jsxs)(V,{className:Q,value:n.weekday,onChange:e=>o({weekday:e.target.value}),children:[(0,X.jsx)(U,{value:`1`,children:i.weekdays.monday}),(0,X.jsx)(U,{value:`2`,children:i.weekdays.tuesday}),(0,X.jsx)(U,{value:`3`,children:i.weekdays.wednesday}),(0,X.jsx)(U,{value:`4`,children:i.weekdays.thursday}),(0,X.jsx)(U,{value:`5`,children:i.weekdays.friday}),(0,X.jsx)(U,{value:`6`,children:i.weekdays.saturday}),(0,X.jsx)(U,{value:`0`,children:i.weekdays.sunday})]})}):null]}):null,t[22]=n.time,t[23]=n.triggerMode,t[24]=n.weekday,t[25]=i.form.day,t[26]=i.form.time,t[27]=i.weekdays,t[28]=o,t[29]=m):m=t[29];let h;t[30]!==n.intervalUnit||t[31]!==n.intervalValue||t[32]!==n.triggerMode||t[33]!==i.form.intervalEvery||t[34]!==i.form.intervalUnits||t[35]!==o?(h=n.triggerMode===`interval`?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,X.jsx)($,{label:i.form.intervalEvery,children:(0,X.jsx)(`input`,{className:Q,type:`number`,min:`1`,value:n.intervalValue,onChange:e=>o({intervalValue:e.target.value})})}),(0,X.jsx)($,{label:i.form.intervalUnits.minute,children:(0,X.jsxs)(V,{className:Q,value:n.intervalUnit,onChange:e=>o({intervalUnit:e.target.value}),children:[(0,X.jsx)(U,{value:`minute`,children:i.form.intervalUnits.minute}),(0,X.jsx)(U,{value:`hour`,children:i.form.intervalUnits.hour}),(0,X.jsx)(U,{value:`day`,children:i.form.intervalUnits.day}),(0,X.jsx)(U,{value:`week`,children:i.form.intervalUnits.week})]})})]}):null,t[30]=n.intervalUnit,t[31]=n.intervalValue,t[32]=n.triggerMode,t[33]=i.form.intervalEvery,t[34]=i.form.intervalUnits,t[35]=o,t[36]=h):h=t[36];let g;t[37]!==n.cronExpr||t[38]!==n.triggerMode||t[39]!==i.form.expression||t[40]!==o?(g=n.triggerMode===`cron`?(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)($,{label:i.form.expression,children:(0,X.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>o({cronExpr:e.target.value})})})}):null,t[37]=n.cronExpr,t[38]=n.triggerMode,t[39]=i.form.expression,t[40]=o,t[41]=g):g=t[41];let _;return t[42]!==h||t[43]!==g||t[44]!==s||t[45]!==p||t[46]!==m?(_=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[s,p,m,h,g]}),t[42]=h,t[43]=g,t[44]=s,t[45]=p,t[46]=m,t[47]=_):_=t[47],_}function Pt(e){let t=(0,Re.c)(110),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,testBusy:c,templates:l,projects:u,projectId:d,conversationMode:f,notificationPolicy:p,onPromptChange:h,onGenerate:g,onEdit:_,onPublish:v,onTest:y,onProjectChange:b,onConversationModeChange:x,onNotificationPolicyChange:S,onApprovedChange:C,onDiscard:w,onTemplateSelect:T,onOpenAdvanced:ee,projectLocked:E}=e,D=s===void 0?!1:s,O=c===void 0?!1:c,k=E===void 0?!1:E,A=!!(i&&i.simulation.requiredConfirmations.length>0),j;t[0]!==i||t[1]!==n.draft.advancedCreate||t[2]!==n.draft.suggestions||t[3]!==n.draft.suggestionsDescription||t[4]!==n.experience||t[5]!==ee||t[6]!==T||t[7]!==l?(j=i?null:(0,X.jsxs)(`div`,{className:`mb-5 border-b border-edge-subtle pb-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,X.jsx)(L,{variant:`ghost`,onClick:ee,children:n.draft.advancedCreate})]}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`focus-visible:ring-2 focus-visible:ring-accent rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>T(e),children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description}),(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.experience.source,`: `,e.source]})]},e.name))})]}),t[0]=i,t[1]=n.draft.advancedCreate,t[2]=n.draft.suggestions,t[3]=n.draft.suggestionsDescription,t[4]=n.experience,t[5]=ee,t[6]=T,t[7]=l,t[8]=j):j=t[8];let N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(M,{className:`size-4 text-accent`}),t[9]=N):N=t[9];let P;t[10]===n.draft.title?P=t[11]:(P=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[N,n.draft.title]}),t[10]=n.draft.title,t[11]=P);let F;t[12]===n.draft.subtitle?F=t[13]:(F=(0,X.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[12]=n.draft.subtitle,t[13]=F);let I;t[14]!==P||t[15]!==F?(I=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[P,F]}),t[14]=P,t[15]=F,t[16]=I):I=t[16];let R;t[17]!==a||t[18]!==r?(R=a||!r.trim(),t[17]=a,t[18]=r,t[19]=R):R=t[19];let z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,X.jsx)(M,{className:`size-4`}),t[20]=z):z=t[20];let te=a?n.draft.generating:n.draft.generate,ne;t[21]!==g||t[22]!==te||t[23]!==R?(ne=(0,X.jsxs)(L,{variant:`primary`,onClick:g,disabled:R,children:[z,te]}),t[21]=g,t[22]=te,t[23]=R,t[24]=ne):ne=t[24];let re;t[25]!==ne||t[26]!==I?(re=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[I,ne]}),t[25]=ne,t[26]=I,t[27]=re):re=t[27];let ie;t[28]===h?ie=t[29]:(ie=e=>h(e.target.value),t[28]=h,t[29]=ie);let B;t[30]!==n.draft.placeholder||t[31]!==n.draft.title||t[32]!==r||t[33]!==ie?(B=(0,X.jsx)(`textarea`,{"aria-label":n.draft.title,className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:ie,placeholder:n.draft.placeholder}),t[30]=n.draft.placeholder,t[31]=n.draft.title,t[32]=r,t[33]=ie,t[34]=B):B=t[34];let ae=k?`sm:grid-cols-2`:`sm:grid-cols-3`,H;t[35]===ae?H=t[36]:(H=m(`mt-3 grid gap-3`,ae),t[35]=ae,t[36]=H);let oe;t[37]!==n.draft.noProject||t[38]!==n.draft.project||t[39]!==b||t[40]!==d||t[41]!==k||t[42]!==u?(oe=k?null:(0,X.jsx)($,{label:n.draft.project,children:(0,X.jsxs)(V,{className:Q,value:d,onChange:e=>b(e.target.value),children:[(0,X.jsx)(U,{value:``,children:n.draft.noProject}),u.map(Ft)]})}),t[37]=n.draft.noProject,t[38]=n.draft.project,t[39]=b,t[40]=d,t[41]=k,t[42]=u,t[43]=oe):oe=t[43];let ce;t[44]===x?ce=t[45]:(ce=e=>x(e.target.value),t[44]=x,t[45]=ce);let le;t[46]===n.draft.newConversation?le=t[47]:(le=(0,X.jsx)(U,{value:`new_session`,children:n.draft.newConversation}),t[46]=n.draft.newConversation,t[47]=le);let ue;t[48]===n.draft.continuousConversation?ue=t[49]:(ue=(0,X.jsx)(U,{value:`continuous`,children:n.draft.continuousConversation}),t[48]=n.draft.continuousConversation,t[49]=ue);let W;t[50]!==f||t[51]!==ce||t[52]!==le||t[53]!==ue?(W=(0,X.jsxs)(V,{className:Q,value:f,onChange:ce,children:[le,ue]}),t[50]=f,t[51]=ce,t[52]=le,t[53]=ue,t[54]=W):W=t[54];let G;t[55]!==n.draft.conversation||t[56]!==W?(G=(0,X.jsx)($,{label:n.draft.conversation,children:W}),t[55]=n.draft.conversation,t[56]=W,t[57]=G):G=t[57];let de;t[58]===S?de=t[59]:(de=e=>S(e.target.value),t[58]=S,t[59]=de);let fe;t[60]===n.draft.notifyAttention?fe=t[61]:(fe=(0,X.jsx)(U,{value:`attention`,children:n.draft.notifyAttention}),t[60]=n.draft.notifyAttention,t[61]=fe);let pe;t[62]===n.draft.notifyAll?pe=t[63]:(pe=(0,X.jsx)(U,{value:`all`,children:n.draft.notifyAll}),t[62]=n.draft.notifyAll,t[63]=pe);let me;t[64]===n.draft.notifyNone?me=t[65]:(me=(0,X.jsx)(U,{value:`none`,children:n.draft.notifyNone}),t[64]=n.draft.notifyNone,t[65]=me);let he;t[66]!==p||t[67]!==de||t[68]!==fe||t[69]!==pe||t[70]!==me?(he=(0,X.jsxs)(V,{className:Q,value:p,onChange:de,children:[fe,pe,me]}),t[66]=p,t[67]=de,t[68]=fe,t[69]=pe,t[70]=me,t[71]=he):he=t[71];let ge;t[72]!==n.draft.notifications||t[73]!==he?(ge=(0,X.jsx)($,{label:n.draft.notifications,children:he}),t[72]=n.draft.notifications,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==H||t[76]!==oe||t[77]!==G||t[78]!==ge?(_e=(0,X.jsxs)(`div`,{className:H,children:[oe,G,ge]}),t[75]=H,t[76]=oe,t[77]=G,t[78]=ge,t[79]=_e):_e=t[79];let ve;t[80]!==o||t[81]!==i||t[82]!==n.draft.approval||t[83]!==n.draft.assumptions||t[84]!==n.draft.discard||t[85]!==n.draft.edit||t[86]!==n.draft.publish||t[87]!==n.draft.review||t[88]!==n.draft.risks||t[89]!==n.draft.safety||t[90]!==n.draft.testOnce||t[91]!==n.draft.testing||t[92]!==n.feedback||t[93]!==n.info||t[94]!==n.none||t[95]!==C||t[96]!==w||t[97]!==_||t[98]!==v||t[99]!==y||t[100]!==D||t[101]!==A||t[102]!==O?(ve=i?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,X.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,X.jsx)($t,{label:n.info.when,value:i.simulation.triggerSummary}),(0,X.jsx)($t,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,X.jsx)(It,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,X.jsx)(It,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,X.jsx)(It,{title:n.draft.risks,items:i.risks,empty:n.none}),A?(0,X.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>C(e.target.checked)}),(0,X.jsx)(`span`,{children:n.draft.approval})]}):null,(0,X.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,X.jsx)(L,{variant:`ghost`,onClick:w,children:n.draft.discard}),(0,X.jsxs)(L,{variant:`secondary`,onClick:_,children:[(0,X.jsx)(xe,{className:`size-4`}),n.draft.edit]}),(0,X.jsxs)(L,{variant:`secondary`,onClick:y,disabled:O||D||A&&!o,children:[(0,X.jsx)(se,{className:`size-4`}),O?n.draft.testing:n.draft.testOnce]}),(0,X.jsx)(L,{variant:`primary`,onClick:v,disabled:D||A&&!o,children:D?n.feedback.working:n.draft.publish})]})]})]}):null,t[80]=o,t[81]=i,t[82]=n.draft.approval,t[83]=n.draft.assumptions,t[84]=n.draft.discard,t[85]=n.draft.edit,t[86]=n.draft.publish,t[87]=n.draft.review,t[88]=n.draft.risks,t[89]=n.draft.safety,t[90]=n.draft.testOnce,t[91]=n.draft.testing,t[92]=n.feedback,t[93]=n.info,t[94]=n.none,t[95]=C,t[96]=w,t[97]=_,t[98]=v,t[99]=y,t[100]=D,t[101]=A,t[102]=O,t[103]=ve):ve=t[103];let ye;return t[104]!==re||t[105]!==B||t[106]!==_e||t[107]!==ve||t[108]!==j?(ye=(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[j,re,B,_e,ve]}),t[104]=re,t[105]=B,t[106]=_e,t[107]=ve,t[108]=j,t[109]=ye):ye=t[109],ye}function Ft(e){return(0,X.jsx)(U,{value:e.id,children:e.name},e.id)}function It(e){let t=(0,Re.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(Lt):(0,X.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,X.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,X.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Lt(e){return(0,X.jsxs)(`li`,{children:[`- `,e]},e)}function Rt(e){let t=(0,Re.c)(25),{icon:n,label:r,value:i,tone:a,active:o,onClick:s}=e,c=a===void 0?`default`:a,l=c===`danger`?`text-red-600 dark:text-red-300`:`text-fg-subtle`,u;t[0]===l?u=t[1]:(u=m(`shrink-0`,l),t[0]=l,t[1]=u);let d;t[2]!==n||t[3]!==u?(d=(0,X.jsx)(`span`,{className:u,children:n}),t[2]=n,t[3]=u,t[4]=d):d=t[4];let f;t[5]===r?f=t[6]:(f=(0,X.jsx)(`span`,{className:`truncate text-xs font-medium text-fg-muted`,children:r}),t[5]=r,t[6]=f);let p=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,h;t[7]===p?h=t[8]:(h=m(`ml-auto truncate text-sm font-semibold tabular-nums`,p),t[7]=p,t[8]=h);let g;t[9]!==h||t[10]!==i?(g=(0,X.jsx)(`span`,{className:h,children:i}),t[9]=h,t[10]=i,t[11]=g):g=t[11];let _;t[12]!==d||t[13]!==f||t[14]!==g?(_=(0,X.jsxs)(X.Fragment,{children:[d,f,g]}),t[12]=d,t[13]=f,t[14]=g,t[15]=_):_=t[15];let v=_,y=o&&`bg-accent/8`,b=s&&`cursor-pointer hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,x;t[16]!==y||t[17]!==b?(x=m(`flex min-h-12 min-w-0 items-center gap-2.5 bg-surface-base px-3 py-2.5 text-left transition-colors`,y,b),t[16]=y,t[17]=b,t[18]=x):x=t[18];let S=x,C=`${r}: ${i}`,w;return t[19]!==C||t[20]!==o||t[21]!==S||t[22]!==v||t[23]!==s?(w=s?(0,X.jsx)(`button`,{type:`button`,className:S,onClick:s,"aria-label":C,"aria-pressed":o,children:v}):(0,X.jsx)(`div`,{className:S,"aria-label":C,children:v}),t[19]=C,t[20]=o,t[21]=S,t[22]=v,t[23]=s,t[24]=w):w=t[24],w}function zt(e){let t=(0,Re.c)(74),{runs:n,ownership:r,labels:i,language:a,unreadCount:o,loading:s,onOwnershipChange:l,onRefresh:u,onSelectRun:d}=e,f;t[0]===n?f=t[1]:(f=n.filter(St),t[0]=n,t[1]=f);let p=f.length,h;t[2]===n?h=t[3]:(h=n.filter(Ct),t[2]=n,t[3]=h);let g=h.length,_;t[4]===i.dashboard.activity?_=t[5]:(_=(0,X.jsx)(`h2`,{id:`automation-activity-title`,className:`text-sm font-semibold text-fg`,children:i.dashboard.activity}),t[4]=i.dashboard.activity,t[5]=_);let v;t[6]===i.dashboard.activityDescription?v=t[7]:(v=(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.dashboard.activityDescription}),t[6]=i.dashboard.activityDescription,t[7]=v);let y;t[8]!==_||t[9]!==v?(y=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[_,v]}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let b=i.filters.ownership,x=r===`user`&&`bg-surface-base text-fg shadow-sm`,S;t[11]===x?S=t[12]:(S=m(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,x),t[11]=x,t[12]=S);let C;t[13]===l?C=t[14]:(C=()=>l(`user`),t[13]=l,t[14]=C);let T=r===`user`,ee;t[15]!==i.filters.userManaged||t[16]!==T||t[17]!==S||t[18]!==C?(ee=(0,X.jsx)(`button`,{type:`button`,className:S,onClick:C,"aria-pressed":T,children:i.filters.userManaged}),t[15]=i.filters.userManaged,t[16]=T,t[17]=S,t[18]=C,t[19]=ee):ee=t[19];let E=r===`system`&&`bg-surface-base text-fg shadow-sm`,D;t[20]===E?D=t[21]:(D=m(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,E),t[20]=E,t[21]=D);let O;t[22]===l?O=t[23]:(O=()=>l(`system`),t[22]=l,t[23]=O);let k=r===`system`,A;t[24]!==i.system.title||t[25]!==D||t[26]!==O||t[27]!==k?(A=(0,X.jsx)(`button`,{type:`button`,className:D,onClick:O,"aria-pressed":k,children:i.system.title}),t[24]=i.system.title,t[25]=D,t[26]=O,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==i.filters.ownership||t[30]!==ee||t[31]!==A?(j=(0,X.jsxs)(w,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":b,indicatorClassName:`rounded-md bg-surface-base shadow-sm`,children:[ee,A]}),t[29]=i.filters.ownership,t[30]=ee,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==i.refresh||t[34]!==s||t[35]!==u?(M=(0,X.jsx)(R,{className:`size-9 shrink-0 p-0`,loading:s,label:i.refresh,onClick:u}),t[33]=i.refresh,t[34]=s,t[35]=u,t[36]=M):M=t[36];let N;t[37]!==j||t[38]!==M?(N=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,M]}),t[37]=j,t[38]=M,t[39]=N):N=t[39];let P;t[40]!==N||t[41]!==y?(P=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3 sm:px-5`,children:[y,N]}),t[40]=N,t[41]=y,t[42]=P):P=t[42];let F;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,X.jsx)(le,{className:`size-4`,"aria-hidden":!0}),t[43]=F):F=t[43];let I=i.metrics.total,L=String(n.length),z;t[44]!==i.metrics.total||t[45]!==L?(z=(0,X.jsx)(Rt,{icon:F,label:I,value:L}),t[44]=i.metrics.total,t[45]=L,t[46]=z):z=t[46];let te;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsx)(se,{className:`size-4`,"aria-hidden":!0}),t[47]=te):te=t[47];let ne=i.metrics.running,re=String(p),ie;t[48]!==i.metrics.running||t[49]!==re?(ie=(0,X.jsx)(Rt,{icon:te,label:ne,value:re}),t[48]=i.metrics.running,t[49]=re,t[50]=ie):ie=t[50];let B;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(he,{className:`size-4`,"aria-hidden":!0}),t[51]=B):B=t[51];let V=i.dashboard.needsAttention,ae=String(g),H=g>0?`danger`:`default`,U;t[52]!==i.dashboard.needsAttention||t[53]!==ae||t[54]!==H?(U=(0,X.jsx)(Rt,{icon:B,label:V,value:ae,tone:H}),t[52]=i.dashboard.needsAttention,t[53]=ae,t[54]=H,t[55]=U):U=t[55];let oe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,X.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[56]=oe):oe=t[56];let ce=i.filters.unread,ue=String(o),W;t[57]!==i.filters.unread||t[58]!==ue?(W=(0,X.jsx)(Rt,{icon:oe,label:ce,value:ue}),t[57]=i.filters.unread,t[58]=ue,t[59]=W):W=t[59];let G;t[60]!==z||t[61]!==ie||t[62]!==U||t[63]!==W?(G=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-b border-edge-subtle bg-edge-subtle lg:grid-cols-4`,children:[z,ie,U,W]}),t[60]=z,t[61]=ie,t[62]=U,t[63]=W,t[64]=G):G=t[64];let de;t[65]!==i||t[66]!==a||t[67]!==d||t[68]!==n?(de=n.length===0?(0,X.jsx)(en,{className:`min-h-64 rounded-none border-0 shadow-none`,icon:(0,X.jsx)(le,{className:`size-5`}),title:i.empty.runs}):(0,X.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-start gap-3 px-4 py-3 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:px-5`,onClick:()=>d(e.id),children:[(0,X.jsx)(`span`,{className:m(`mt-1.5 size-2 shrink-0 rounded-full`,St(e)?`bg-blue-500`:Ct(e)?`bg-red-500`:`bg-emerald-500`),"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName}),e.readAtMs==null&&!St(e)?(0,X.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,X.jsx)(`span`,{className:m(`mt-1 line-clamp-2 block text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||i.status[e.status]}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:pt(e.createdAtMs,i,a)})]}),(0,X.jsx)(`span`,{className:m(`shrink-0 rounded-full px-2 py-0.5 text-xs`,bt(e.status)),children:i.status[e.status]})]},e.id))}),t[65]=i,t[66]=a,t[67]=d,t[68]=n,t[69]=de):de=t[69];let fe;return t[70]!==P||t[71]!==G||t[72]!==de?(fe=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,"aria-labelledby":`automation-activity-title`,children:[P,G,de]}),t[70]=P,t[71]=G,t[72]=de,t[73]=fe):fe=t[73],fe}function Bt(e){let t=(0,Re.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:c}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Se,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,X.jsx)(en,{className:`rounded-none border-0 shadow-none`,icon:e,title:i.empty.filtered}),t[1]=i.empty.filtered,t[2]=n),n}let l;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(Vt),n=t.find(St),l=t[0];return(0,X.jsxs)(`button`,{type:`button`,className:m(`block w-full p-3 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,s===e.id&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 130px`},"aria-current":s===e.id?`true`:void 0,onClick:()=>c(e.id),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:m(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:ut(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.enabled?i.enabled:i.paused}),l&&l.readAtMs==null&&!St(l)?(0,X.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,X.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-wrap items-center gap-1.5 pl-4 text-xs`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-panel px-1.5 py-0.5 text-fg-muted`,children:[(0,X.jsx)(vt,{kind:e.action.kind,className:`size-3`}),ht(e.action,i)]}),(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 rounded-md bg-surface-panel px-1.5 py-0.5 text-fg-muted`,children:[(0,X.jsx)(H,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`truncate`,children:Te(e.trigger,i,a,o)})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center justify-between gap-2 pl-4 text-xs text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:m(`line-clamp-2`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.state.lastError||(e.state.lastRunStatus?i.status[e.state.lastRunStatus]:i.experience.noRuns)}),l?.status?(0,X.jsx)(`span`,{className:m(`shrink-0 rounded-full px-1.5 py-0.5`,bt(l.status)),children:i.status[l.status]}):null]}),(0,X.jsxs)(`div`,{className:`mt-2 space-y-1 pl-4 text-xs text-fg-muted`,children:[l?(0,X.jsxs)(`div`,{children:[i.last,`: `,pt(l.createdAtMs,i,o)]}):null,(0,X.jsx)(`div`,{children:e.enabled?`${i.next}: ${K(e,i,o)}`:i.paused})]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=c,t[15]=r,t[16]=s,t[17]=e):e=t[17],l=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=s,t[10]=l}else l=t[10];let u;return t[18]===l?u=t[19]:(u=(0,X.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:l}),t[18]=l,t[19]=u),u}function Vt(e,t){return t.createdAtMs-e.createdAtMs}function Ht(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Ut(e){let t=(0,Re.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,Y.useState)(a===void 0?!1:a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
2
+ `),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`
3
+ `).slice(0,10).join(`
4
+ `).trimEnd()}...`:l,t[4]=f,t[5]=l,t[6]=p):p=t[6];let h=p,g;t[7]!==o||t[8]!==f||t[9]!==r||t[10]!==i?(g=f?(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Wt),"aria-expanded":o,children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,X.jsx)(ve,{className:m(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,X.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=f,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=o||!f?l:h,v;t[12]===_?v=t[13]:(v=(0,X.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let y;return t[14]!==g||t[15]!==v?(y=(0,X.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-inset/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=y):y=t[16],y}function Wt(e){return!e}function Gt(e){let t=(0,Re.c)(148),{className:n,run:r,events:i,labels:a,cronLabels:s,language:l,loading:d,repairDraft:f,repairLoading:p,repairApproved:h,busyAction:g,onRepairApprovedChange:_,onSuggestRepair:v,onApplyRepair:y}=e;if(!r){let e;t[0]===n?e=t[1]:(e=m(`flex min-h-64 flex-col justify-center rounded-lg border border-edge-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(le,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===a.selectRun?i=t[4]:(i=(0,X.jsx)(`div`,{className:`mt-2`,children:a.selectRun}),t[3]=a.selectRun,t[4]=i);let o;return t[5]!==e||t[6]!==i?(o=(0,X.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=o):o=t[7],o}let b=r.error||r.summary,x=r.conversationId?`/chat/${encodeURIComponent(r.conversationId)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,S=r.conversationId?a.runDetail.openConversation:a.runDetail.openWorkflow,C=r.conversationId?T:ee,w=St(r)?le:r.status===`succeeded`?c:he,E;t[8]===n?E=t[9]:(E=m(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=E);let D;t[10]===r.automationName?D=t[11]:(D=(0,X.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=D);let O;t[12]===r.id?O=t[13]:(O=r.id.slice(0,8),t[12]=r.id,t[13]=O);let k;t[14]===O?k=t[15]:(k=(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:O}),t[14]=O,t[15]=k);let A;t[16]!==D||t[17]!==k?(A=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[D,k]}),t[16]=D,t[17]=k,t[18]=A):A=t[18];let j;t[19]===r.status?j=t[20]:(j=m(`shrink-0 rounded-full px-2 py-0.5 text-xs`,bt(r.status)),t[19]=r.status,t[20]=j);let N=a.status[r.status],F;t[21]!==j||t[22]!==N?(F=(0,X.jsx)(`span`,{className:j,children:N}),t[21]=j,t[22]=N,t[23]=F):F=t[23];let I;t[24]!==A||t[25]!==F?(I=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[A,F]}),t[24]=A,t[25]=F,t[26]=I):I=t[26];let R;t[27]!==a||t[28]!==l||t[29]!==r.createdAtMs?(R=pt(r.createdAtMs,a,l),t[27]=a,t[28]=l,t[29]=r.createdAtMs,t[30]=R):R=t[30];let z;t[31]===R?z=t[32]:(z=(0,X.jsx)(`span`,{children:R}),t[31]=R,t[32]=z);let te;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=te):te=t[33];let ne=a.details.duration,re;t[34]!==a||t[35]!==r.durationMs?(re=xt(r.durationMs,a),t[34]=a,t[35]=r.durationMs,t[36]=re):re=t[36];let B;t[37]!==a.details.duration||t[38]!==re?(B=(0,X.jsxs)(`span`,{children:[ne,` `,re]}),t[37]=a.details.duration,t[38]=re,t[39]=B):B=t[39];let V;t[40]!==z||t[41]!==B?(V=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[z,te,B]}),t[40]=z,t[41]=B,t[42]=V):V=t[42];let ae;t[43]!==a.repair||t[44]!==v||t[45]!==p||t[46]!==r?(ae=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsxs)(L,{variant:`secondary`,onClick:()=>v(r),disabled:p,children:[(0,X.jsx)(M,{className:`size-4`}),p?a.repair.generating:a.repair.suggest]})}):null,t[43]=a.repair,t[44]=v,t[45]=p,t[46]=r,t[47]=ae):ae=t[47];let H;t[48]!==V||t[49]!==ae||t[50]!==I?(H=(0,X.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[I,V,ae]}),t[48]=V,t[49]=ae,t[50]=I,t[51]=H):H=t[51];let U;t[52]===r?U=t[53]:(U=St(r)?`text-blue-500`:Ct(r)?`text-red-500`:r.status===`succeeded`?`text-emerald-500`:`text-fg-muted`,t[52]=r,t[53]=U);let oe;t[54]===U?oe=t[55]:(oe=m(`size-4`,U),t[54]=U,t[55]=oe);let se;t[56]!==w||t[57]!==oe?(se=(0,X.jsx)(w,{className:oe}),t[56]=w,t[57]=oe,t[58]=se):se=t[58];let ce;t[59]!==a.runDetail.resultTitle||t[60]!==se?(ce=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[se,a.runDetail.resultTitle]}),t[59]=a.runDetail.resultTitle,t[60]=se,t[61]=ce):ce=t[61];let ue;t[62]!==C||t[63]!==S||t[64]!==x?(ue=x?(0,X.jsx)(L,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,X.jsxs)(o,{to:x,children:[(0,X.jsx)(C,{className:`size-3.5`}),S,(0,X.jsx)(ie,{className:`size-3.5`})]})}):null,t[62]=C,t[63]=S,t[64]=x,t[65]=ue):ue=t[65];let W;t[66]!==ce||t[67]!==ue?(W=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[ce,ue]}),t[66]=ce,t[67]=ue,t[68]=W):W=t[68];let G=r.error&&`border-red-500/25 bg-red-500/5`,de;t[69]===G?de=t[70]:(de=m(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-inset/25 p-3`,G),t[69]=G,t[70]=de);let pe;t[71]!==a.runDetail.noResult||t[72]!==a.runDetail.resultPending||t[73]!==b||t[74]!==r?(pe=b?r.error?(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:b}):(0,X.jsx)(u,{content:b,compact:!0,className:`text-sm`}):(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:St(r)?a.runDetail.resultPending:a.runDetail.noResult}),t[71]=a.runDetail.noResult,t[72]=a.runDetail.resultPending,t[73]=b,t[74]=r,t[75]=pe):pe=t[75];let me;t[76]!==de||t[77]!==pe?(me=(0,X.jsx)(`div`,{className:de,children:pe}),t[76]=de,t[77]=pe,t[78]=me):me=t[78];let ge;t[79]!==W||t[80]!==me?(ge=(0,X.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[W,me]}),t[79]=W,t[80]=me,t[81]=ge):ge=t[81];let _e;t[82]===a.runDetail.runInfo?_e=t[83]:(_e=(0,X.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:a.runDetail.runInfo}),t[82]=a.runDetail.runInfo,t[83]=_e);let ye;t[84]!==s||t[85]!==a||t[86]!==l||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(ye=r.manual?a.trigger.manual:Te(r.triggerSnapshot,a,s,l),t[84]=s,t[85]=a,t[86]=l,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=ye):ye=t[89];let be;t[90]!==a.explain.whyRan||t[91]!==ye?(be=(0,X.jsx)(Zt,{label:a.explain.whyRan,value:ye}),t[90]=a.explain.whyRan,t[91]=ye,t[92]=be):be=t[92];let xe=a.details.started,Se;t[93]!==a||t[94]!==l||t[95]!==r.startedAtMs?(Se=pt(r.startedAtMs,a,l),t[93]=a,t[94]=l,t[95]=r.startedAtMs,t[96]=Se):Se=t[96];let Ce;t[97]!==a.details.started||t[98]!==Se?(Ce=(0,X.jsx)(Zt,{label:xe,value:Se}),t[97]=a.details.started,t[98]=Se,t[99]=Ce):Ce=t[99];let we;t[100]!==a.details.model||t[101]!==r.model?(we=r.model?(0,X.jsx)(Zt,{label:a.details.model,value:r.model}):null,t[100]=a.details.model,t[101]=r.model,t[102]=we):we=t[102];let Ee;t[103]!==be||t[104]!==Ce||t[105]!==we?(Ee=(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[be,Ce,we]}),t[103]=be,t[104]=Ce,t[105]=we,t[106]=Ee):Ee=t[106];let De;t[107]!==_e||t[108]!==Ee?(De=(0,X.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[_e,Ee]}),t[107]=_e,t[108]=Ee,t[109]=De):De=t[109];let Oe;t[110]!==g||t[111]!==a||t[112]!==y||t[113]!==_||t[114]!==h||t[115]!==f||t[116]!==r?(Oe=f?(0,X.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:a.repair.title}),(0,X.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:f.explanation}),f.expectedEffect?(0,X.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:f.expectedEffect}):null,(0,X.jsx)(It,{title:a.repair.risks,items:f.risks,empty:a.none}),(0,X.jsx)(Ut,{value:f.patch,labels:a,title:a.details.repairPatch}),f.requiresApproval?(0,X.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:h,onChange:e=>_(e.target.checked)}),(0,X.jsx)(`span`,{children:a.repair.approval})]}):null,(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsx)(L,{variant:`primary`,onClick:()=>y(r),disabled:g===`run:${r.id}:repair`||f.requiresApproval&&!h,children:g===`run:${r.id}:repair`?a.feedback.working:a.repair.apply})})]}):null,t[110]=g,t[111]=a,t[112]=y,t[113]=_,t[114]=h,t[115]=f,t[116]=r,t[117]=Oe):Oe=t[117];let K;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,X.jsx)(fe,{className:`size-4 shrink-0`}),t[118]=K):K=t[118];let q;t[119]===a.runDetail.technicalEvents?q=t[120]:(q=(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[K,a.runDetail.technicalEvents]}),t[119]=a.runDetail.technicalEvents,t[120]=q);let ke;t[121]!==i.length||t[122]!==a.runDetail.eventCount?(ke=a.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=a.runDetail.eventCount,t[123]=ke):ke=t[123];let Ae;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,X.jsx)(ve,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=Ae):Ae=t[124];let je;t[125]===ke?je=t[126]:(je=(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[ke,Ae]}),t[125]=ke,t[126]=je);let J;t[127]!==q||t[128]!==je?(J=(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[q,je]}),t[127]=q,t[128]=je,t[129]=J):J=t[129];let Me;t[130]===a.runDetail.technicalEventsDescription?Me=t[131]:(Me=(0,X.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:a.runDetail.technicalEventsDescription}),t[130]=a.runDetail.technicalEventsDescription,t[131]=Me);let Ne;t[132]!==i||t[133]!==a||t[134]!==l||t[135]!==d?(Ne=(0,X.jsx)(`div`,{className:`mt-4`,children:d?(0,X.jsxs)(`div`,{className:`space-y-3`,"aria-label":a.loading,children:[(0,X.jsx)(P,{className:`h-10 w-full`}),(0,X.jsx)(P,{className:`h-10 w-4/5`}),(0,X.jsx)(P,{className:`h-10 w-11/12`})]}):i.length===0?(0,X.jsx)(`div`,{className:`text-sm text-fg-muted`,children:a.empty.events}):(0,X.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,X.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,X.jsx)(`span`,{className:m(`mt-1 size-2 rounded-full`,Qt(e.type))}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-sm text-fg`,children:Ht(e,a)}),(0,X.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[pt(e.createdAtMs,a,l),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,X.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-inset/35`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[a.details.eventData,(0,X.jsx)(ve,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,X.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=a,t[134]=l,t[135]=d,t[136]=Ne):Ne=t[136];let Pe;t[137]!==J||t[138]!==Me||t[139]!==Ne?(Pe=(0,X.jsxs)(`details`,{className:`group px-4 py-3`,children:[J,Me,Ne]}),t[137]=J,t[138]=Me,t[139]=Ne,t[140]=Pe):Pe=t[140];let Fe;return t[141]!==E||t[142]!==H||t[143]!==ge||t[144]!==De||t[145]!==Oe||t[146]!==Pe?(Fe=(0,X.jsxs)(`aside`,{className:E,children:[H,ge,De,Oe,Pe]}),t[141]=E,t[142]=H,t[143]=ge,t[144]=De,t[145]=Oe,t[146]=Pe,t[147]=Fe):Fe=t[147],Fe}function Kt(e){let t=(0,Re.c)(146),{automation:n,runs:r,runsLoading:i,runsError:a,labels:o,cronLabels:s,language:d,projects:f,busyAction:p,onEdit:h,onSelectRun:g,onAction:_}=e,v=p===`automation:${n.id}:run`,y=p===`automation:${n.id}:toggle`,b=p===`automation:${n.id}:delete`,x;t[0]===n.management?x=t[1]:(x=!n.management||n.management.editable.includes(`enabled`),t[0]=n.management,t[1]=x);let S=x,C=!n.management||n.management.runnable,w;t[2]===n.management?w=t[3]:(w=!n.management||n.management.editable.includes(`trigger`),t[2]=n.management,t[3]=w);let T=w,E=!n.management||n.management.deletable,O;t[4]===n.name?O=t[5]:(O=(0,X.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[4]=n.name,t[5]=O);let k=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,A;t[6]===k?A=t[7]:(A=m(`shrink-0 rounded-full px-2 py-0.5 text-xs`,k),t[6]=k,t[7]=A);let j=n.enabled?o.enabled:o.paused,M;t[8]!==A||t[9]!==j?(M=(0,X.jsx)(`span`,{className:A,children:j}),t[8]=A,t[9]=j,t[10]=M):M=t[10];let N;t[11]!==O||t[12]!==M?(N=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[O,M]}),t[11]=O,t[12]=M,t[13]=N):N=t[13];let F;t[14]===n?F=t[15]:(F=Tt(n)?(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Tt(n)}):null,t[14]=n,t[15]=F);let I;t[16]===n.action.kind?I=t[17]:(I=(0,X.jsx)(vt,{kind:n.action.kind,className:`size-3.5`}),t[16]=n.action.kind,t[17]=I);let R;t[18]!==n.action||t[19]!==o?(R=ht(n.action,o),t[18]=n.action,t[19]=o,t[20]=R):R=t[20];let z;t[21]!==I||t[22]!==R?(z=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-edge-subtle bg-surface-base px-2 py-1`,children:[I,R]}),t[21]=I,t[22]=R,t[23]=z):z=t[23];let te;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[24]=te):te=t[24];let ne;t[25]!==n.trigger||t[26]!==s||t[27]!==o||t[28]!==d?(ne=Te(n.trigger,o,s,d),t[25]=n.trigger,t[26]=s,t[27]=o,t[28]=d,t[29]=ne):ne=t[29];let ie;t[30]===ne?ie=t[31]:(ie=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-edge-subtle bg-surface-base px-2 py-1`,children:[te,ne]}),t[30]=ne,t[31]=ie);let V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),t[32]=V):V=t[32];let U;t[33]!==n.projectId||t[34]!==o.info||t[35]!==f?(U=f.find(e=>e.id===n.projectId)?.name??o.info.noProject,t[33]=n.projectId,t[34]=o.info,t[35]=f,t[36]=U):U=t[36];let oe;t[37]===U?oe=t[38]:(oe=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-edge-subtle bg-surface-base px-2 py-1`,children:[V,U]}),t[37]=U,t[38]=oe);let ce;t[39]!==z||t[40]!==ie||t[41]!==oe?(ce=(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[z,ie,oe]}),t[39]=z,t[40]=ie,t[41]=oe,t[42]=ce):ce=t[42];let ue;t[43]!==ce||t[44]!==N||t[45]!==F?(ue=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[N,F,ce]}),t[43]=ce,t[44]=N,t[45]=F,t[46]=ue):ue=t[46];let fe;t[47]!==n||t[48]!==p||t[49]!==E||t[50]!==T||t[51]!==C||t[52]!==S||t[53]!==b||t[54]!==o.dashboard.delete||t[55]!==o.dashboard.deleted||t[56]!==o.dashboard.pause||t[57]!==o.dashboard.resume||t[58]!==o.dashboard.resumed||t[59]!==o.dashboard.runNow||t[60]!==o.details||t[61]!==o.edit||t[62]!==o.experience.deleteConfirm||t[63]!==o.feedback||t[64]!==_||t[65]!==h||t[66]!==v||t[67]!==y?(fe=S||C||T||E?(0,X.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[S?(0,X.jsxs)(L,{variant:`secondary`,disabled:p!==null,onClick:()=>void _(`automation:${n.id}:toggle`,()=>n.enabled?G.pause(n.id):G.resume(n.id),n.enabled?o.feedback.paused:o.dashboard.resumed),children:[y?(0,X.jsx)(B,{className:`size-4 animate-spin`}):n.enabled?(0,X.jsx)(D,{className:`size-4`}):(0,X.jsx)(se,{className:`size-4`}),n.enabled?o.dashboard.pause:o.dashboard.resume]}):null,C?(0,X.jsxs)(L,{variant:`primary`,disabled:p!==null,onClick:()=>void _(`automation:${n.id}:run`,()=>G.runNow(n.id),o.feedback.rerunQueued),children:[v?(0,X.jsx)(B,{className:`size-4 animate-spin`}):(0,X.jsx)(se,{className:`size-4`}),o.dashboard.runNow]}):null,T||E?(0,X.jsxs)(pe,{children:[(0,X.jsx)(re,{asChild:!0,children:(0,X.jsx)(L,{variant:`ghost`,className:`size-9 p-0`,"aria-label":o.details.moreActions,children:(0,X.jsx)(l,{className:`size-4`})})}),(0,X.jsx)(de,{children:(0,X.jsxs)(ae,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[T?(0,X.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>h(n),children:[(0,X.jsx)(xe,{className:`size-4`}),o.edit]}):null,E?(0,X.jsxs)(_e,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-red-700 outline-none hover:bg-red-500/10 dark:text-red-300`,disabled:p!==null,onSelect:()=>{window.confirm(o.experience.deleteConfirm)&&_(`automation:${n.id}:delete`,()=>G.remove(n.id),o.dashboard.deleted)},children:[b?(0,X.jsx)(B,{className:`size-4 animate-spin`}):(0,X.jsx)(W,{className:`size-4`}),o.dashboard.delete]}):null]})})]}):null]}):null,t[47]=n,t[48]=p,t[49]=E,t[50]=T,t[51]=C,t[52]=S,t[53]=b,t[54]=o.dashboard.delete,t[55]=o.dashboard.deleted,t[56]=o.dashboard.pause,t[57]=o.dashboard.resume,t[58]=o.dashboard.resumed,t[59]=o.dashboard.runNow,t[60]=o.details,t[61]=o.edit,t[62]=o.experience.deleteConfirm,t[63]=o.feedback,t[64]=_,t[65]=h,t[66]=v,t[67]=y,t[68]=fe):fe=t[68];let me;t[69]!==ue||t[70]!==fe?(me=(0,X.jsxs)(`header`,{className:`flex flex-col items-start gap-3 border-b border-edge px-5 py-4`,children:[ue,fe]}),t[69]=ue,t[70]=fe,t[71]=me):me=t[71];let he;t[72]===o.dashboard.latestResult?he=t[73]:(he=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.dashboard.latestResult}),t[72]=o.dashboard.latestResult,t[73]=he);let ge;t[74]!==o.experience.viewResult||t[75]!==g||t[76]!==r[0]?(ge=r[0]?(0,X.jsx)(L,{variant:`secondary`,onClick:()=>g(r[0].id),children:o.experience.viewResult}):null,t[74]=o.experience.viewResult,t[75]=g,t[76]=r[0],t[77]=ge):ge=t[77];let ve;t[78]!==he||t[79]!==ge?(ve=(0,X.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[he,ge]}),t[78]=he,t[79]=ge,t[80]=ve):ve=t[80];let ye;t[81]!==o||t[82]!==d||t[83]!==r[0]||t[84]!==a||t[85]!==i?(ye=a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-red-700 dark:text-red-300`,children:a}):i?(0,X.jsx)(P,{className:`h-28 w-full`}):r[0]?(0,X.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge-subtle bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,X.jsx)(`span`,{className:m(`rounded-full px-2 py-0.5`,bt(r[0].status)),children:o.status[r[0].status]}),pt(r[0].createdAtMs,o,d)]}),(0,X.jsx)(u,{content:r[0].error||r[0].summary||(St(r[0])?o.runDetail.resultPending:o.runDetail.noResult),compact:!0})]}):(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.experience.noRuns}),t[81]=o,t[82]=d,t[83]=r[0],t[84]=a,t[85]=i,t[86]=ye):ye=t[86];let be;t[87]!==n||t[88]!==o||t[89]!==d?(be=n.enabled?`${o.next}: ${K(n,o,d)}`:o.paused,t[87]=n,t[88]=o,t[89]=d,t[90]=be):be=t[90];let Se;t[91]===be?Se=t[92]:(Se=(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:be}),t[91]=be,t[92]=Se);let Ce;t[93]!==ve||t[94]!==ye||t[95]!==Se?(Ce=(0,X.jsxs)(`section`,{children:[ve,ye,Se]}),t[93]=ve,t[94]=ye,t[95]=Se,t[96]=Ce):Ce=t[96];let we;t[97]===o.dashboard.runHistory?we=t[98]:(we=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.dashboard.runHistory}),t[97]=o.dashboard.runHistory,t[98]=we);let Ee;t[99]===o.dashboard.runHistoryDescription?Ee=t[100]:(Ee=(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:o.dashboard.runHistoryDescription}),t[99]=o.dashboard.runHistoryDescription,t[100]=Ee);let De;t[101]!==we||t[102]!==Ee?(De=(0,X.jsxs)(`div`,{children:[we,Ee]}),t[101]=we,t[102]=Ee,t[103]=De):De=t[103];let Oe;t[104]===r.length?Oe=t[105]:(Oe=(0,X.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[104]=r.length,t[105]=Oe);let q;t[106]!==De||t[107]!==Oe?(q=(0,X.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[De,Oe]}),t[106]=De,t[107]=Oe,t[108]=q):q=t[108];let ke;t[109]!==o||t[110]!==d||t[111]!==g||t[112]!==r||t[113]!==i?(ke=i?(0,X.jsx)(P,{className:`h-24 w-full`}):r.length===0?(0,X.jsx)(en,{className:`min-h-24 py-6`,icon:(0,X.jsx)(le,{className:`size-5`}),title:o.empty.runs}):(0,X.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:r.slice(0,8).map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`block w-full p-3 text-left hover:bg-surface-hover`,onClick:()=>g(e.id),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,X.jsx)(c,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,X.jsx)(le,{className:`size-4 shrink-0 text-fg-muted`}),(0,X.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:pt(e.createdAtMs,o,d)})]}),(0,X.jsx)(`span`,{className:m(`shrink-0 rounded-full px-2 py-0.5 text-xs`,bt(e.status)),children:o.status[e.status]})]}),(0,X.jsx)(`p`,{className:m(`mt-1 line-clamp-2 pl-6 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||mt(e.actionSnapshot,o)})]},e.id))}),t[109]=o,t[110]=d,t[111]=g,t[112]=r,t[113]=i,t[114]=ke):ke=t[114];let Ae;t[115]!==q||t[116]!==ke?(Ae=(0,X.jsxs)(`section`,{className:`min-w-0`,children:[q,ke]}),t[115]=q,t[116]=ke,t[117]=Ae):Ae=t[117];let je;t[118]===o.experience.settings?je=t[119]:(je=(0,X.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:o.experience.settings}),t[118]=o.experience.settings,t[119]=je);let J;t[120]!==n||t[121]!==o?(J=wt(n,o),t[120]=n,t[121]=o,t[122]=J):J=t[122];let Me;t[123]===J?Me=t[124]:(Me=(0,X.jsx)(u,{content:J,compact:!0}),t[123]=J,t[124]=Me);let Ne;t[125]!==n||t[126]!==s||t[127]!==o||t[128]!==d||t[129]!==f?(Ne=(0,X.jsx)(Jt,{automation:n,labels:o,cronLabels:s,language:d,projects:f}),t[125]=n,t[126]=s,t[127]=o,t[128]=d,t[129]=f,t[130]=Ne):Ne=t[130];let Pe;t[131]!==Me||t[132]!==Ne?(Pe=(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[Me,Ne]}),t[131]=Me,t[132]=Ne,t[133]=Pe):Pe=t[133];let Fe;t[134]!==je||t[135]!==Pe?(Fe=(0,X.jsxs)(`details`,{className:`rounded-lg border border-edge-subtle p-4`,children:[je,Pe]}),t[134]=je,t[135]=Pe,t[136]=Fe):Fe=t[136];let Ie;t[137]!==Ae||t[138]!==Fe?(Ie=(0,X.jsxs)(`div`,{className:`grid gap-5`,children:[Ae,Fe]}),t[137]=Ae,t[138]=Fe,t[139]=Ie):Ie=t[139];let Le;t[140]!==Ce||t[141]!==Ie?(Le=(0,X.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[Ce,Ie]}),t[140]=Ce,t[141]=Ie,t[142]=Le):Le=t[142];let Y;return t[143]!==me||t[144]!==Le?(Y=(0,X.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[me,Le]}),t[143]=me,t[144]=Le,t[145]=Y):Y=t[145],Y}function qt(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Jt(e){let t=(0,Re.c)(146),{automation:n,labels:r,cronLabels:i,language:a,projects:o}=e,s,l,u,d,f,p,m,h,g,_,v;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=yt(n),o;t[15]!==n||t[16]!==r||t[17]!==a?(o=K(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=o):o=t[18];let y=o,b;t[19]!==n.state.nextRunAtMs||t[20]!==a?(b=n.state.nextRunAtMs?Oe(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=b):b=t[21];let x=b;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(v=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],v.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],v.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=Oe(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],v.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],v.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],v.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],v.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],v.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],v.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],v.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=v}else v=t[39];g=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?_=t[71]:(_=(0,X.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=_),p=`grid gap-4 p-4`;let S;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(H,{className:`size-4`,"aria-hidden":!0}),t[72]=S):S=t[72];let C=r.info.schedule,w;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(w=Te(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=w):w=t[77];let T=n.enabled?`${r.info.nextRun}:${y}`:y;t[78]!==r.info.schedule||t[79]!==x||t[80]!==w||t[81]!==T?(m=(0,X.jsx)(Xt,{icon:S,label:C,value:w,description:T,descriptionTitle:x}),t[78]=r.info.schedule,t[79]=x,t[80]=w,t[81]=T,t[82]=m):m=t[82];let E;t[83]===n.action.kind?E=t[84]:(E=n.action.kind===`workflow`?(0,X.jsx)(ee,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_automation`?(0,X.jsx)(fe,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`task_command`?(0,X.jsx)(c,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=E);let D=r.info.action,O;t[85]!==n.action||t[86]!==r?(O=mt(n.action,r),t[85]=n.action,t[86]=r,t[87]=O):O=t[87],t[88]!==r.info.action||t[89]!==E||t[90]!==O?(h=(0,X.jsx)(Xt,{icon:E,label:D,value:O}),t[88]=r.info.action,t[89]=E,t[90]=O,t[91]=h):h=t[91],s=Xt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[92]=l):l=t[92],u=r.info.permission,d=r.safety[e],f=qt(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v}else s=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13],v=t[14];let y;t[93]!==s||t[94]!==l||t[95]!==u||t[96]!==d||t[97]!==f?(y=(0,X.jsx)(s,{icon:l,label:u,value:d,description:f}),t[93]=s,t[94]=l,t[95]=u,t[96]=d,t[97]=f,t[98]=y):y=t[98];let b;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[99]=b):b=t[99];let x;t[100]!==n.projectId||t[101]!==r.info.noProject||t[102]!==o?(x=o.find(e=>e.id===n.projectId)?.name??r.info.noProject,t[100]=n.projectId,t[101]=r.info.noProject,t[102]=o,t[103]=x):x=t[103];let S;t[104]!==r.info.project||t[105]!==x?(S=(0,X.jsx)(Xt,{icon:b,label:r.info.project,value:x}),t[104]=r.info.project,t[105]=x,t[106]=S):S=t[106];let C;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[107]=C):C=t[107];let w=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,E;t[108]!==r.info.conversation||t[109]!==w?(E=(0,X.jsx)(Xt,{icon:C,label:r.info.conversation,value:w}),t[108]=r.info.conversation,t[109]=w,t[110]=E):E=t[110];let D;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,X.jsx)(he,{className:`size-4`,"aria-hidden":!0}),t[111]=D):D=t[111];let O=n.delivery.notificationPolicy===`all`?r.info.notifyAll:n.delivery.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,k;t[112]!==r.info.notifications||t[113]!==O?(k=(0,X.jsx)(Xt,{icon:D,label:r.info.notifications,value:O}),t[112]=r.info.notifications,t[113]=O,t[114]=k):k=t[114];let A;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(le,{className:`size-4`,"aria-hidden":!0}),t[115]=A):A=t[115];let j=r.info.lastRun,M;t[116]!==n||t[117]!==r||t[118]!==a?(M=De(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=M):M=t[119];let N=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,P;t[120]!==r.info.lastRun||t[121]!==M||t[122]!==N?(P=(0,X.jsx)(Xt,{icon:A,label:j,value:M,valueTone:N}),t[120]=r.info.lastRun,t[121]=M,t[122]=N,t[123]=P):P=t[123];let F;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(F=n.state.consecutiveFailures?(0,X.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,X.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[124]=n.state.consecutiveFailures,t[125]=n.state.lastError,t[126]=r.dashboard,t[127]=F):F=t[127];let I;t[128]!==r.info.technicalDetails||t[129]!==v?(I=v.length>0?(0,X.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,X.jsx)(`span`,{children:r.info.technicalDetails}),(0,X.jsx)(ve,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-2`,children:v.map(Yt)})]}):null,t[128]=r.info.technicalDetails,t[129]=v,t[130]=I):I=t[130];let L;t[131]!==y||t[132]!==S||t[133]!==E||t[134]!==k||t[135]!==P||t[136]!==F||t[137]!==I||t[138]!==p||t[139]!==m||t[140]!==h?(L=(0,X.jsxs)(`div`,{className:p,children:[m,h,y,S,E,k,P,F,I]}),t[131]=y,t[132]=S,t[133]=E,t[134]=k,t[135]=P,t[136]=F,t[137]=I,t[138]=p,t[139]=m,t[140]=h,t[141]=L):L=t[141];let R;return t[142]!==L||t[143]!==g||t[144]!==_?(R=(0,X.jsxs)(`aside`,{className:g,children:[_,L]}),t[142]=L,t[143]=g,t[144]=_,t[145]=R):R=t[145],R}function Yt(e){return(0,X.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,X.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function Xt(e){let t=(0,Re.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,c=s===void 0?`default`:s,l;t[0]===n?l=t[1]:(l=(0,X.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=u);let d=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,f;t[4]===d?f=t[5]:(f=m(`mt-1 text-sm font-medium leading-5`,d),t[4]=d,t[5]=f);let p;t[6]!==f||t[7]!==i?(p=(0,X.jsx)(`div`,{className:f,children:i}),t[6]=f,t[7]=i,t[8]=p):p=t[8];let h;t[9]!==a||t[10]!==o?(h=a?(0,X.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=h):h=t[11];let g;t[12]!==u||t[13]!==p||t[14]!==h?(g=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[u,p,h]}),t[12]=u,t[13]=p,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==l||t[17]!==g?(_=(0,X.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,g]}),t[16]=l,t[17]=g,t[18]=_):_=t[18],_}function Zt(e){let t=(0,Re.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,X.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,X.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Qt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function $t(e){let t=(0,Re.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,X.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function en(e){let t=(0,Re.c)(8),{className:n,icon:r,title:i}=e,a;t[0]===n?a=t[1]:(a=m(`flex min-h-48 flex-col items-center justify-center text-fg-muted`,n),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,X.jsx)(`div`,{className:`mt-2 text-sm`,children:i}),t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,X.jsxs)(`div`,{className:a,children:[r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function tn(e){let t=(0,Re.c)(349),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:o,selectedWorkflow:s,workflowsLoading:c,browserAutomations:l,selectedBrowserAutomation:u,browserAutomationsLoading:d,agentOptions:f,agentsLoading:h,defaultAgentId:g,taskOptions:_,tasksLoading:v,language:y,projectLocked:b}=e,x=b===void 0?!1:b,S=p(y).agentsSettings,w;t[0]===i?w=t[1]:(w=e=>i(t=>({...t,...e})),t[0]=i,t[1]=w);let T=w,ee=ke(n.intervalValue,n.intervalUnit),E=Date.now(),D;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(D=[1,2,3],t[2]=D):D=t[2];let O;t[3]!==ee||t[4]!==E||t[5]!==y?(O=D.map(e=>Ee(E+ee*e,y,E)),t[3]=ee,t[4]=E,t[5]=y,t[6]=O):O=t[6];let k=O,A;if(t[7]!==n.projectId||t[8]!==n.taskId||t[9]!==_){let e;t[11]!==n.projectId||t[12]!==n.taskId?(e=e=>e.id===n.taskId||e.phase!==`closed`&&(!n.projectId||e.projectId===n.projectId),t[11]=n.projectId,t[12]=n.taskId,t[13]=e):e=t[13],A=_.filter(e),t[7]=n.projectId,t[8]=n.taskId,t[9]=_,t[10]=A}else A=t[10];let j=A,M,N;t[14]!==g||t[15]!==n.actionMode||t[16]!==n.agentId||t[17]!==i?(M=()=>{n.actionMode!==`task_command`||n.agentId.trim()||!g||i(e=>({...e,agentId:g}))},N=[g,n.actionMode,n.agentId,i],t[14]=g,t[15]=n.actionMode,t[16]=n.agentId,t[17]=i,t[18]=M,t[19]=N):(M=t[18],N=t[19]),(0,Y.useEffect)(M,N);let P,I;t[20]!==n.actionMode||t[21]!==n.workflowId||t[22]!==i||t[23]!==o?(P=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=o[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},I=[n.actionMode,n.workflowId,i,o],t[20]=n.actionMode,t[21]=n.workflowId,t[22]=i,t[23]=o,t[24]=P,t[25]=I):(P=t[24],I=t[25]),(0,Y.useEffect)(P,I);let L,R;t[26]!==l||t[27]!==n.actionMode||t[28]!==n.browserAutomationId||t[29]!==i?(L=()=>{if(n.actionMode!==`browser_automation`||n.browserAutomationId.trim())return;let e=l[0];e&&i(t=>({...t,browserAutomationId:e.id,browserAutomationInputs:Ie(e)}))},R=[l,n.actionMode,n.browserAutomationId,i],t[26]=l,t[27]=n.actionMode,t[28]=n.browserAutomationId,t[29]=i,t[30]=L,t[31]=R):(L=t[30],R=t[31]),(0,Y.useEffect)(L,R);let z;t[32]===T?z=t[33]:(z=e=>T({name:e.target.value}),t[32]=T,t[33]=z);let te;t[34]!==n.name||t[35]!==z?(te=(0,X.jsx)(`input`,{className:Q,value:n.name,onChange:z}),t[34]=n.name,t[35]=z,t[36]=te):te=t[36];let ne;t[37]!==r.form.name||t[38]!==te?(ne=(0,X.jsx)($,{label:r.form.name,children:te}),t[37]=r.form.name,t[38]=te,t[39]=ne):ne=t[39];let re;t[40]===T?re=t[41]:(re=e=>T({description:e.target.value}),t[40]=T,t[41]=re);let B;t[42]!==n.description||t[43]!==re?(B=(0,X.jsx)(`input`,{className:Q,value:n.description,onChange:re}),t[42]=n.description,t[43]=re,t[44]=B):B=t[44];let ae;t[45]!==r.form.description||t[46]!==B?(ae=(0,X.jsx)($,{label:r.form.description,children:B}),t[45]=r.form.description,t[46]=B,t[47]=ae):ae=t[47];let H;t[48]!==n.projectId||t[49]!==r.form.noProject||t[50]!==r.form.project||t[51]!==x||t[52]!==a||t[53]!==T?(H=x?null:(0,X.jsx)($,{label:r.form.project,children:(0,X.jsxs)(V,{className:Q,value:n.projectId,onChange:e=>T({projectId:e.target.value}),children:[(0,X.jsx)(U,{value:``,children:r.form.noProject}),a.map(rn)]})}),t[48]=n.projectId,t[49]=r.form.noProject,t[50]=r.form.project,t[51]=x,t[52]=a,t[53]=T,t[54]=H):H=t[54];let oe=r.form.rulePreview,se;t[55]===r.form.rulePreview?se=t[56]:(se=(0,X.jsx)(`div`,{className:`text-xs font-medium text-accent-fg`,children:r.form.rulePreview}),t[55]=r.form.rulePreview,t[56]=se);let ce;t[57]!==n.triggerMode||t[58]!==r?(ce=_t(n.triggerMode,r),t[57]=n.triggerMode,t[58]=r,t[59]=ce):ce=t[59];let le;t[60]===ce?le=t[61]:(le=(0,X.jsx)(`span`,{children:ce}),t[60]=ce,t[61]=le);let W;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(ie,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[62]=W):W=t[62];let G;t[63]!==n.actionMode||t[64]!==r?(G=gt(n.actionMode,r),t[63]=n.actionMode,t[64]=r,t[65]=G):G=t[65];let de;t[66]===G?de=t[67]:(de=(0,X.jsx)(`span`,{children:G}),t[66]=G,t[67]=de);let fe;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(ie,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[68]=fe):fe=t[68];let pe;t[69]!==n.projectId||t[70]!==r.form.noProject||t[71]!==r.form.project||t[72]!==a?(pe=n.projectId?a.find(e=>e.id===n.projectId)?.name??r.form.project:r.form.noProject,t[69]=n.projectId,t[70]=r.form.noProject,t[71]=r.form.project,t[72]=a,t[73]=pe):pe=t[73];let me;t[74]===pe?me=t[75]:(me=(0,X.jsx)(`span`,{children:pe}),t[74]=pe,t[75]=me);let he;t[76]!==le||t[77]!==de||t[78]!==me?(he=(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-sm text-fg`,children:[le,W,de,fe,me]}),t[76]=le,t[77]=de,t[78]=me,t[79]=he):he=t[79];let ge;t[80]!==r.form.rulePreview||t[81]!==se||t[82]!==he?(ge=(0,X.jsxs)(`div`,{className:`rounded-xl border border-accent/20 bg-accent/5 px-4 py-3`,"aria-label":oe,children:[se,he]}),t[80]=r.form.rulePreview,t[81]=se,t[82]=he,t[83]=ge):ge=t[83];let _e;t[84]!==r.form.trigger||t[85]!==r.form.triggerStepDescription?(_e=(0,X.jsx)(an,{step:`1`,title:r.form.trigger,description:r.form.triggerStepDescription}),t[84]=r.form.trigger,t[85]=r.form.triggerStepDescription,t[86]=_e):_e=t[86];let ye;t[87]===T?ye=t[88]:(ye=e=>T({triggerMode:e.target.value}),t[87]=T,t[88]=ye);let be;t[89]===r.trigger.manual?be=t[90]:(be=(0,X.jsx)(U,{value:`manual`,children:r.trigger.manual}),t[89]=r.trigger.manual,t[90]=be);let xe;t[91]===r.trigger.once?xe=t[92]:(xe=(0,X.jsx)(U,{value:`once`,children:r.trigger.once}),t[91]=r.trigger.once,t[92]=xe);let Se;t[93]===r.trigger.daily?Se=t[94]:(Se=(0,X.jsx)(U,{value:`daily`,children:r.trigger.daily}),t[93]=r.trigger.daily,t[94]=Se);let Te;t[95]===r.trigger.weekly?Te=t[96]:(Te=(0,X.jsx)(U,{value:`weekly`,children:r.trigger.weekly}),t[95]=r.trigger.weekly,t[96]=Te);let De;t[97]===r.trigger.interval?De=t[98]:(De=(0,X.jsx)(U,{value:`interval`,children:r.trigger.interval}),t[97]=r.trigger.interval,t[98]=De);let Oe;t[99]===r.trigger.customCron?Oe=t[100]:(Oe=(0,X.jsx)(U,{value:`cron`,children:r.trigger.customCron}),t[99]=r.trigger.customCron,t[100]=Oe);let K;t[101]===r.trigger.webhook?K=t[102]:(K=(0,X.jsx)(U,{value:`webhook`,children:r.trigger.webhook}),t[101]=r.trigger.webhook,t[102]=K);let Ae;t[103]===r.trigger.taskBlocked?Ae=t[104]:(Ae=(0,X.jsx)(U,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[103]=r.trigger.taskBlocked,t[104]=Ae);let je;t[105]===r.trigger.noteCreated?je=t[106]:(je=(0,X.jsx)(U,{value:`noteCreated`,children:r.trigger.noteCreated}),t[105]=r.trigger.noteCreated,t[106]=je);let J;t[107]===r.trigger.workflowFailed?J=t[108]:(J=(0,X.jsx)(U,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[107]=r.trigger.workflowFailed,t[108]=J);let Pe;t[109]===r.trigger.sessionUpdated?Pe=t[110]:(Pe=(0,X.jsx)(U,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[109]=r.trigger.sessionUpdated,t[110]=Pe);let Fe;t[111]===r.trigger.customEvent?Fe=t[112]:(Fe=(0,X.jsx)(U,{value:`event`,children:r.trigger.customEvent}),t[111]=r.trigger.customEvent,t[112]=Fe);let ze;t[113]!==n.triggerMode||t[114]!==ye||t[115]!==be||t[116]!==xe||t[117]!==Se||t[118]!==Te||t[119]!==De||t[120]!==Oe||t[121]!==K||t[122]!==Ae||t[123]!==je||t[124]!==J||t[125]!==Pe||t[126]!==Fe?(ze=(0,X.jsxs)(V,{className:Q,value:n.triggerMode,onChange:ye,children:[be,xe,Se,Te,De,Oe,K,Ae,je,J,Pe,Fe]}),t[113]=n.triggerMode,t[114]=ye,t[115]=be,t[116]=xe,t[117]=Se,t[118]=Te,t[119]=De,t[120]=Oe,t[121]=K,t[122]=Ae,t[123]=je,t[124]=J,t[125]=Pe,t[126]=Fe,t[127]=ze):ze=t[127];let Be;t[128]!==n.onceAt||t[129]!==n.triggerMode||t[130]!==r.form.onceAt||t[131]!==T?(Be=n.triggerMode===`once`?(0,X.jsx)($,{label:r.form.onceAt,children:(0,X.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>T({onceAt:e.target.value})})}):null,t[128]=n.onceAt,t[129]=n.triggerMode,t[130]=r.form.onceAt,t[131]=T,t[132]=Be):Be=t[132];let Ve;t[133]!==n.time||t[134]!==n.triggerMode||t[135]!==n.weekday||t[136]!==r.form.day||t[137]!==r.form.time||t[138]!==r.weekdays||t[139]!==T?(Ve=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)($,{label:r.form.time,children:(0,X.jsx)(Ue,{value:n.time,onChange:e=>T({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,X.jsx)($,{label:r.form.day,children:(0,X.jsxs)(V,{className:Q,value:n.weekday,onChange:e=>T({weekday:e.target.value}),children:[(0,X.jsx)(U,{value:`1`,children:r.weekdays.monday}),(0,X.jsx)(U,{value:`2`,children:r.weekdays.tuesday}),(0,X.jsx)(U,{value:`3`,children:r.weekdays.wednesday}),(0,X.jsx)(U,{value:`4`,children:r.weekdays.thursday}),(0,X.jsx)(U,{value:`5`,children:r.weekdays.friday}),(0,X.jsx)(U,{value:`6`,children:r.weekdays.saturday}),(0,X.jsx)(U,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[133]=n.time,t[134]=n.triggerMode,t[135]=n.weekday,t[136]=r.form.day,t[137]=r.form.time,t[138]=r.weekdays,t[139]=T,t[140]=Ve):Ve=t[140];let He=n.triggerMode===`interval`?(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,X.jsx)($,{label:r.form.intervalEvery,children:(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,X.jsx)(`input`,{className:Q,type:`number`,min:6e4/ke(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>T({intervalValue:e.target.value})}),(0,X.jsxs)(V,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;T({intervalValue:Ce(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,X.jsx)(U,{value:`minute`,children:r.form.intervalUnits.minute}),(0,X.jsx)(U,{value:`hour`,children:r.form.intervalUnits.hour}),(0,X.jsx)(U,{value:`day`,children:r.form.intervalUnits.day}),(0,X.jsx)(U,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Je.map(e=>{let t=ke(e.value,e.unit),n=t===ee;return(0,X.jsx)(`button`,{type:`button`,"aria-pressed":n,className:m(`rounded-full border px-2.5 py-1 text-xs transition-colors`,n?`border-accent bg-accent/10 text-accent`:`border-edge-subtle text-fg-muted hover:border-edge hover:bg-surface-hover hover:text-fg`),onClick:()=>T({intervalValue:e.value,intervalUnit:e.unit}),children:q(t,y)},`${e.value}:${e.unit}`)})})]}),(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:we(ee,y)}),(0,X.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,k.join(y===`zh`?`、`:`, `)]}),(0,X.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,We;t[141]!==n.cronExpr||t[142]!==n.triggerMode||t[143]!==r.form.expression||t[144]!==T?(We=n.triggerMode===`cron`?(0,X.jsx)($,{label:r.form.expression,children:(0,X.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>T({cronExpr:e.target.value})})}):null,t[141]=n.cronExpr,t[142]=n.triggerMode,t[143]=r.form.expression,t[144]=T,t[145]=We):We=t[145];let Ge;t[146]!==n.triggerMode||t[147]!==n.webhookSecretId||t[148]!==r.form.secretId||t[149]!==T?(Ge=n.triggerMode===`webhook`?(0,X.jsx)($,{label:r.form.secretId,children:(0,X.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>T({webhookSecretId:e.target.value})})}):null,t[146]=n.triggerMode,t[147]=n.webhookSecretId,t[148]=r.form.secretId,t[149]=T,t[150]=Ge):Ge=t[150];let Ke;t[151]!==n.eventPayloadMatch||t[152]!==n.eventSource||t[153]!==n.eventType||t[154]!==n.triggerMode||t[155]!==r.form.eventPayloadMatch||t[156]!==r.form.eventSource||t[157]!==r.form.eventType||t[158]!==r.form.invalidJsonObject||t[159]!==T?(Ke=n.triggerMode===`event`?(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)($,{label:r.form.eventType,children:(0,X.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>T({eventType:e.target.value})})}),(0,X.jsx)($,{label:r.form.eventSource,children:(0,X.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>T({eventSource:e.target.value})})})]}),(0,X.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,X.jsx)(`textarea`,{className:m(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>T({eventPayloadMatch:e.target.value}),placeholder:`{
5
+ "status": "blocked"
6
+ }`}),et(n.eventPayloadMatch)?null:(0,X.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[151]=n.eventPayloadMatch,t[152]=n.eventSource,t[153]=n.eventType,t[154]=n.triggerMode,t[155]=r.form.eventPayloadMatch,t[156]=r.form.eventSource,t[157]=r.form.eventType,t[158]=r.form.invalidJsonObject,t[159]=T,t[160]=Ke):Ke=t[160];let qe;t[161]!==r.form.action||t[162]!==r.form.actionStepDescription?(qe=(0,X.jsx)(an,{step:`2`,title:r.form.action,description:r.form.actionStepDescription}),t[161]=r.form.action,t[162]=r.form.actionStepDescription,t[163]=qe):qe=t[163];let Ye;t[164]!==n.timeoutSeconds||t[165]!==n.workflowId||t[166]!==T||t[167]!==o?(Ye=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);T({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_automation`?`600`:`1800`}:{},...t===`browser_automation`||t===`task_command`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&o[0]?{workflowId:o[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[164]=n.timeoutSeconds,t[165]=n.workflowId,t[166]=T,t[167]=o,t[168]=Ye):Ye=t[168];let Xe;t[169]===r.action.runAgent?Xe=t[170]:(Xe=(0,X.jsx)(U,{value:`agent`,children:r.action.runAgent}),t[169]=r.action.runAgent,t[170]=Xe);let Ze;t[171]===r.action.runWorkflow?Ze=t[172]:(Ze=(0,X.jsx)(U,{value:`workflow`,children:r.action.runWorkflow}),t[171]=r.action.runWorkflow,t[172]=Ze);let Qe;t[173]===r.action.runTask?Qe=t[174]:(Qe=(0,X.jsx)(U,{value:`task_command`,children:r.action.runTask}),t[173]=r.action.runTask,t[174]=Qe);let Z=y===`zh`?`浏览器自动化`:`Browser automation`,$e;t[175]===Z?$e=t[176]:($e=(0,X.jsx)(U,{value:`browser_automation`,children:Z}),t[175]=Z,t[176]=$e);let tt;t[177]!==n.actionMode||t[178]!==Ye||t[179]!==Xe||t[180]!==Ze||t[181]!==Qe||t[182]!==$e?(tt=(0,X.jsxs)(V,{className:Q,value:n.actionMode,onChange:Ye,children:[Xe,Ze,Qe,$e]}),t[177]=n.actionMode,t[178]=Ye,t[179]=Xe,t[180]=Ze,t[181]=Qe,t[182]=$e,t[183]=tt):tt=t[183];let nt=n.actionMode===`browser_automation`?null:(0,X.jsx)($,{label:r.form.agent,children:(0,X.jsxs)(V,{className:Q,value:n.agentId,onChange:e=>T({agentId:e.target.value}),children:[(0,X.jsx)(U,{value:``,children:h?r.form.loadingAgents:r.form.defaultAgent}),f.map(e=>(0,X.jsx)(U,{value:e.id,children:F(e,S)},e.id))]})}),rt;t[184]!==j||t[185]!==l||t[186]!==d||t[187]!==n.actionMode||t[188]!==n.agentId||t[189]!==n.browserAutomationId||t[190]!==n.browserAutomationInputs||t[191]!==n.description||t[192]!==n.instruction||t[193]!==n.model||t[194]!==n.name||t[195]!==n.taskId||t[196]!==n.triggerMode||t[197]!==n.workflowId||t[198]!==n.workflowInput||t[199]!==r.form.defaultModel||t[200]!==r.form.instruction||t[201]!==r.form.loadingTasks||t[202]!==r.form.loadingWorkflows||t[203]!==r.form.model||t[204]!==r.form.modelHint||t[205]!==r.form.noModels||t[206]!==r.form.noTasks||t[207]!==r.form.noWorkflows||t[208]!==r.form.searchModels||t[209]!==r.form.task||t[210]!==r.form.taskClosed||t[211]!==r.form.taskContextHint||t[212]!==r.form.triggeredRun||t[213]!==r.form.workflow||t[214]!==y||t[215]!==u||t[216]!==s||t[217]!==v||t[218]!==T||t[219]!==o||t[220]!==c?(rt=n.actionMode===`agent`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:r.form.model,children:[(0,X.jsx)(C,{value:n.model,onChange:e=>T({model:e}),placeholder:r.form.defaultModel,emptyLabel:r.form.defaultModel,searchPlaceholder:r.form.searchModels,noMatches:r.form.noModels,allowEmpty:!0,showProviderSettingsFooter:!0,contentAlign:`start`,className:`w-full`,ariaLabel:r.form.model}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.form.modelHint})]}),(0,X.jsxs)($,{label:r.form.instruction,children:[(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(Me,{value:n.instruction,onApply:e=>T({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:y,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId,model:n.model},showLabel:!1})}),(0,X.jsx)(`textarea`,{className:m(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>T({instruction:e.target.value})})]})]}):n.actionMode===`workflow`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:r.form.workflow,children:(0,X.jsxs)(V,{className:Q,value:n.workflowId,onChange:e=>T({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:c||o.length===0,children:[c?(0,X.jsx)(U,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,X.jsx)(U,{value:``,children:r.form.noWorkflows}):null,o.map(e=>(0,X.jsx)(U,{value:e.id,children:ue(e,y).title},e.id))]})}),s?(0,X.jsx)(Ne,{definition:s,language:y,value:n.workflowInput,onChange:e=>T({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>T({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:s.id,workflowTitle:ue(s,y).title,workflowDescription:ue(s,y).description}},inputClassName:`rounded-lg`}):null]}):n.actionMode===`task_command`?(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)($,{label:r.form.task,children:[(0,X.jsxs)(V,{className:Q,value:n.taskId,onChange:e=>T({taskId:e.target.value}),disabled:v||j.length===0,children:[v?(0,X.jsx)(U,{value:``,children:r.form.loadingTasks}):null,!v&&j.length===0?(0,X.jsx)(U,{value:``,children:r.form.noTasks}):null,j.map(e=>(0,X.jsxs)(U,{value:e.id,disabled:e.phase===`closed`,children:[e.title,e.phase===`closed`?` · ${r.form.taskClosed}`:``]},e.id))]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.form.taskContextHint})]})}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:y===`zh`?`浏览器自动化`:`Browser automation`,children:(0,X.jsxs)(V,{className:Q,value:n.browserAutomationId,onChange:e=>{let t=l.find(t=>t.id===e.target.value);T({browserAutomationId:e.target.value,browserAutomationInputs:t?Ie(t):{}})},disabled:d||l.length===0,children:[l.length===0?(0,X.jsx)(U,{value:``,children:y===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,l.map(nn)]})}),u&&Object.keys(u.inputs).length>0?(0,X.jsx)($,{label:y===`zh`?`运行时填写`:`Run inputs`,children:(0,X.jsx)(Le,{automation:u,values:n.browserAutomationInputs,language:y,onChange:e=>T({browserAutomationInputs:e})})}):null]}),t[184]=j,t[185]=l,t[186]=d,t[187]=n.actionMode,t[188]=n.agentId,t[189]=n.browserAutomationId,t[190]=n.browserAutomationInputs,t[191]=n.description,t[192]=n.instruction,t[193]=n.model,t[194]=n.name,t[195]=n.taskId,t[196]=n.triggerMode,t[197]=n.workflowId,t[198]=n.workflowInput,t[199]=r.form.defaultModel,t[200]=r.form.instruction,t[201]=r.form.loadingTasks,t[202]=r.form.loadingWorkflows,t[203]=r.form.model,t[204]=r.form.modelHint,t[205]=r.form.noModels,t[206]=r.form.noTasks,t[207]=r.form.noWorkflows,t[208]=r.form.searchModels,t[209]=r.form.task,t[210]=r.form.taskClosed,t[211]=r.form.taskContextHint,t[212]=r.form.triggeredRun,t[213]=r.form.workflow,t[214]=y,t[215]=u,t[216]=s,t[217]=v,t[218]=T,t[219]=o,t[220]=c,t[221]=rt):rt=t[221];let it;t[222]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,X.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs text-fg-muted`,children:`3`}),t[222]=it):it=t[222];let at;t[223]===r.form.advancedDescription?at=t[224]:(at=(0,X.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[223]=r.form.advancedDescription,t[224]=at);let ot;t[225]!==r.form.advanced||t[226]!==at?(ot=(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[it,(0,X.jsxs)(`span`,{children:[r.form.advanced,at]})]}),t[225]=r.form.advanced,t[226]=at,t[227]=ot):ot=t[227];let st;t[228]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,X.jsx)(ve,{className:`size-4 transition-transform group-open:rotate-180`}),t[228]=st):st=t[228];let ct;t[229]===ot?ct=t[230]:(ct=(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[ot,st]}),t[229]=ot,t[230]=ct);let lt;t[231]!==n.actionMode||t[232]!==n.safetyMode||t[233]!==r.form.safety||t[234]!==r.safety||t[235]!==T?(lt=n.actionMode!==`browser_automation`&&n.actionMode!==`task_command`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(an,{title:r.form.safety}),(0,X.jsxs)($,{label:r.form.safety,children:[(0,X.jsxs)(V,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;T({safetyMode:t})},children:[(0,X.jsx)(U,{value:`suggest_only`,children:r.safety.suggest_only}),(0,X.jsx)(U,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,X.jsx)(U,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription})]})]}):null,t[231]=n.actionMode,t[232]=n.safetyMode,t[233]=r.form.safety,t[234]=r.safety,t[235]=T,t[236]=lt):lt=t[236];let ut;t[237]===r.form.results?ut=t[238]:(ut=(0,X.jsx)(an,{title:r.form.results}),t[237]=r.form.results,t[238]=ut);let dt;t[239]===T?dt=t[240]:(dt=e=>T({conversationMode:e.target.value}),t[239]=T,t[240]=dt);let ft;t[241]===r.form.newConversation?ft=t[242]:(ft=(0,X.jsx)(U,{value:`new_session`,children:r.form.newConversation}),t[241]=r.form.newConversation,t[242]=ft);let pt;t[243]===r.form.continuousConversation?pt=t[244]:(pt=(0,X.jsx)(U,{value:`continuous`,children:r.form.continuousConversation}),t[243]=r.form.continuousConversation,t[244]=pt);let mt;t[245]!==n.conversationMode||t[246]!==dt||t[247]!==ft||t[248]!==pt?(mt=(0,X.jsxs)(V,{className:Q,value:n.conversationMode,onChange:dt,children:[ft,pt]}),t[245]=n.conversationMode,t[246]=dt,t[247]=ft,t[248]=pt,t[249]=mt):mt=t[249];let ht;t[250]!==r.form.conversation||t[251]!==mt?(ht=(0,X.jsx)($,{label:r.form.conversation,children:mt}),t[250]=r.form.conversation,t[251]=mt,t[252]=ht):ht=t[252];let vt;t[253]===T?vt=t[254]:(vt=e=>T({notificationPolicy:e.target.value}),t[253]=T,t[254]=vt);let yt;t[255]===r.form.notifyAttention?yt=t[256]:(yt=(0,X.jsx)(U,{value:`attention`,children:r.form.notifyAttention}),t[255]=r.form.notifyAttention,t[256]=yt);let bt;t[257]===r.form.notifyAll?bt=t[258]:(bt=(0,X.jsx)(U,{value:`all`,children:r.form.notifyAll}),t[257]=r.form.notifyAll,t[258]=bt);let xt;t[259]===r.form.notifyNone?xt=t[260]:(xt=(0,X.jsx)(U,{value:`none`,children:r.form.notifyNone}),t[259]=r.form.notifyNone,t[260]=xt);let St;t[261]!==n.notificationPolicy||t[262]!==vt||t[263]!==yt||t[264]!==bt||t[265]!==xt?(St=(0,X.jsxs)(V,{className:Q,value:n.notificationPolicy,onChange:vt,children:[yt,bt,xt]}),t[261]=n.notificationPolicy,t[262]=vt,t[263]=yt,t[264]=bt,t[265]=xt,t[266]=St):St=t[266];let Ct;t[267]!==r.form.notifications||t[268]!==St?(Ct=(0,X.jsx)($,{label:r.form.notifications,children:St}),t[267]=r.form.notifications,t[268]=St,t[269]=Ct):Ct=t[269];let wt;t[270]===T?wt=t[271]:(wt=e=>T({resultWebhookEndpoint:e.target.value}),t[270]=T,t[271]=wt);let Tt;t[272]!==n.resultWebhookEndpoint||t[273]!==wt?(Tt=(0,X.jsx)(`input`,{className:Q,value:n.resultWebhookEndpoint,onChange:wt}),t[272]=n.resultWebhookEndpoint,t[273]=wt,t[274]=Tt):Tt=t[274];let Et;t[275]===T?Et=t[276]:(Et=e=>T({resultWebhookSecretId:e.target.value}),t[275]=T,t[276]=Et);let Dt;t[277]!==n.resultWebhookSecretId||t[278]!==r.form.resultWebhookSecretId||t[279]!==Et?(Dt=(0,X.jsx)(`input`,{className:Q,value:n.resultWebhookSecretId,onChange:Et,placeholder:r.form.resultWebhookSecretId}),t[277]=n.resultWebhookSecretId,t[278]=r.form.resultWebhookSecretId,t[279]=Et,t[280]=Dt):Dt=t[280];let Ot;t[281]!==Tt||t[282]!==Dt?(Ot=(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[Tt,Dt]}),t[281]=Tt,t[282]=Dt,t[283]=Ot):Ot=t[283];let kt;t[284]!==r.form.resultWebhookEndpoint||t[285]!==Ot?(kt=(0,X.jsx)($,{label:r.form.resultWebhookEndpoint,children:Ot}),t[284]=r.form.resultWebhookEndpoint,t[285]=Ot,t[286]=kt):kt=t[286];let At;t[287]===r.form.reliability?At=t[288]:(At=(0,X.jsx)(an,{title:r.form.reliability}),t[287]=r.form.reliability,t[288]=At);let jt;t[289]===T?jt=t[290]:(jt=e=>T({timeoutSeconds:e.target.value}),t[289]=T,t[290]=jt);let Mt;t[291]!==n.timeoutSeconds||t[292]!==jt?(Mt=(0,X.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:jt}),t[291]=n.timeoutSeconds,t[292]=jt,t[293]=Mt):Mt=t[293];let Nt;t[294]!==r.form.timeoutSeconds||t[295]!==Mt?(Nt=(0,X.jsx)($,{label:r.form.timeoutSeconds,children:Mt}),t[294]=r.form.timeoutSeconds,t[295]=Mt,t[296]=Nt):Nt=t[296];let Pt;t[297]===T?Pt=t[298]:(Pt=e=>T({disableAfterFailures:e.target.value}),t[297]=T,t[298]=Pt);let Ft;t[299]!==n.disableAfterFailures||t[300]!==Pt?(Ft=(0,X.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:Pt}),t[299]=n.disableAfterFailures,t[300]=Pt,t[301]=Ft):Ft=t[301];let It;t[302]!==r.form.disableAfterFailures||t[303]!==Ft?(It=(0,X.jsx)($,{label:r.form.disableAfterFailures,children:Ft}),t[302]=r.form.disableAfterFailures,t[303]=Ft,t[304]=It):It=t[304];let Lt;t[305]!==Nt||t[306]!==It?(Lt=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Nt,It]}),t[305]=Nt,t[306]=It,t[307]=Lt):Lt=t[307];let Rt;t[308]===r.form.effectivePolicy?Rt=t[309]:(Rt=(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[308]=r.form.effectivePolicy,t[309]=Rt);let zt=n.timeoutSeconds||`—`,Bt;t[310]!==r.form.executionDeadline||t[311]!==zt?(Bt=(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,zt,`s`]}),t[310]=r.form.executionDeadline,t[311]=zt,t[312]=Bt):Bt=t[312];let Vt;t[313]===r.form.downstreamTimeoutHint?Vt=t[314]:(Vt=(0,X.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[313]=r.form.downstreamTimeoutHint,t[314]=Vt);let Ht;t[315]!==Rt||t[316]!==Bt||t[317]!==Vt?(Ht=(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-inset/40 px-3 py-2.5`,children:[Rt,Bt,Vt]}),t[315]=Rt,t[316]=Bt,t[317]=Vt,t[318]=Ht):Ht=t[318];let Ut;t[319]!==Ht||t[320]!==lt||t[321]!==ut||t[322]!==ht||t[323]!==Ct||t[324]!==kt||t[325]!==At||t[326]!==Lt?(Ut=(0,X.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[lt,ut,ht,Ct,kt,At,Lt,Ht]}),t[319]=Ht,t[320]=lt,t[321]=ut,t[322]=ht,t[323]=Ct,t[324]=kt,t[325]=At,t[326]=Lt,t[327]=Ut):Ut=t[327];let Wt;t[328]!==Ut||t[329]!==ct?(Wt=(0,X.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[ct,Ut]}),t[328]=Ut,t[329]=ct,t[330]=Wt):Wt=t[330];let Gt;return t[331]!==Wt||t[332]!==ne||t[333]!==ae||t[334]!==H||t[335]!==ge||t[336]!==_e||t[337]!==ze||t[338]!==Be||t[339]!==Ve||t[340]!==He||t[341]!==We||t[342]!==Ge||t[343]!==Ke||t[344]!==qe||t[345]!==tt||t[346]!==nt||t[347]!==rt?(Gt=(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[ne,ae,H,ge,_e,ze,Be,Ve,He,We,Ge,Ke,qe,tt,nt,rt,Wt]})}),t[331]=Wt,t[332]=ne,t[333]=ae,t[334]=H,t[335]=ge,t[336]=_e,t[337]=ze,t[338]=Be,t[339]=Ve,t[340]=He,t[341]=We,t[342]=Ge,t[343]=Ke,t[344]=qe,t[345]=tt,t[346]=nt,t[347]=rt,t[348]=Gt):Gt=t[348],Gt}function nn(e){return(0,X.jsx)(U,{value:e.id,children:e.name},e.id)}function rn(e){return(0,X.jsx)(U,{value:e.id,children:e.name},e.id)}var Q=`min-h-11 w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-base sm:min-h-0 sm:text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,Re.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function an(e){let t=(0,Re.c)(12),{title:n,step:r,description:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,X.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent-fg`,children:r}):(0,X.jsx)(ee,{className:`mt-0.5 size-4 text-fg-muted`}),t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,X.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:i}):null,t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,X.jsxs)(`div`,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,X.jsxs)(`div`,{className:`flex items-start gap-2 pt-2`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}export{jt as t};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-preview-renderer-wzIchDSv.js","assets/preload-helper-zJ_50EbN.js","assets/pdf-runtime-DU_sMPjG.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-DPxcWxfD.js";import{a as o,t as s}from"./attachment-utils-core-BIOUBrpT.js";import{t as c}from"./preview-open-alternatives-DzA__S54.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(l(null),f(!1),!t||!n||!o||!r)return;let c=!1,u,d=document.createElement(`div`);d.className=`flex min-h-0 flex-1 flex-col overflow-auto`,o.replaceChildren(d),_(d,g(e,n));let p=e=>{c?e():u=e};return(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-wzIchDSv.js`),__vite__mapDeps([0,1,2]));if(c)return;let o=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(d,t,{loadingText:o.attachmentPreviewPdfRendering,loadMoreHint:o.attachmentPreviewPdfLoadMore,onPageCount:e=>{c||s?.(e)}});p(e)}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(d,t,{truncationNotice:o.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});p(e),c||f(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(d,t);p(e)}}catch(e){c||l(e instanceof Error?e.message:String(e))}})(),()=>{c=!0,u?.(),d.remove()}},[t,n,o,r,e,s]),{error:c,excelTruncated:d}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(28),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=o(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,s]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y||t[11]!==e.onImageSwipe||t[12]!==m?(v=t=>{if(!t.isPrimary){c.current=null;return}t.button===0&&(c.current={pointerId:t.pointerId,x:t.clientX,y:t.clientY,ox:a.x,oy:a.y,swipe:t.pointerType===`touch`&&m<=1&&!!e.onImageSwipe},t.currentTarget.setPointerCapture(t.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=e.onImageSwipe,t[12]=m,t[13]=v):v=t[13];let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||t.swipe||s({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},t[14]=y):y=t[14];let b;t[15]===e?b=t[16]:(b=t=>{let n=c.current;if(!n||n.pointerId!==t.pointerId)return;c.current=null;let r=t.clientX-n.x,i=t.clientY-n.y;n.swipe&&Math.abs(r)>=50&&Math.abs(r)>Math.abs(i)*1.5&&e.onImageSwipe?.(r<0?`next`:`previous`)},t[15]=e,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[17]=x):x=t[17];let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[18]!==S||t[19]!==C?(w={transform:S,cursor:C},t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==r||t[22]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[21]=r,t[22]=w,t[23]=T):T=t[23];let E;return t[24]!==T||t[25]!==v||t[26]!==b?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[24]=T,t[25]=v,t[26]=b,t[27]=E):E=t[27],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(22),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T);let E=f?(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[(0,p.jsx)(y,{props:e,message:b(e)}),(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600 dark:text-red-400`,children:f})]}):e.kind===`excel`&&m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,D=`${f?`hidden`:`flex`} docx-preview-host min-h-0 flex-1 flex-col overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`,O;t[17]===D?O=t[18]:(O=(0,p.jsx)(`div`,{ref:s,className:D}),t[17]=D,t[18]=O);let k;return t[19]!==O||t[20]!==E?(k=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[E,O]}),t[19]=O,t[20]=E,t[21]=k):k=t[21],k}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,o=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,s):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==o?(u=o?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=o,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==o?(f=o?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=o,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
2
+ 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"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-DBvKzlCl.js";import{a as o,t as s}from"./attachment-utils-core-BIOUBrpT.js";import{t as c}from"./preview-open-alternatives-DKyLVLpX.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(l(null),f(!1),!t||!n||!o||!r)return;let c=!1,u,d=document.createElement(`div`);d.className=`flex min-h-0 flex-1 flex-col overflow-auto`,o.replaceChildren(d),_(d,g(e,n));let p=e=>{c?e():u=e};return(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-wzIchDSv.js`),__vite__mapDeps([0,1,2]));if(c)return;let o=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(d,t,{loadingText:o.attachmentPreviewPdfRendering,loadMoreHint:o.attachmentPreviewPdfLoadMore,onPageCount:e=>{c||s?.(e)}});p(e)}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(d,t,{truncationNotice:o.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});p(e),c||f(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(d,t);p(e)}}catch(e){c||l(e instanceof Error?e.message:String(e))}})(),()=>{c=!0,u?.(),d.remove()}},[t,n,o,r,e,s]),{error:c,excelTruncated:d}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(28),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=o(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,s]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y||t[11]!==e.onImageSwipe||t[12]!==m?(v=t=>{if(!t.isPrimary){c.current=null;return}t.button===0&&(c.current={pointerId:t.pointerId,x:t.clientX,y:t.clientY,ox:a.x,oy:a.y,swipe:t.pointerType===`touch`&&m<=1&&!!e.onImageSwipe},t.currentTarget.setPointerCapture(t.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=e.onImageSwipe,t[12]=m,t[13]=v):v=t[13];let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||t.swipe||s({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},t[14]=y):y=t[14];let b;t[15]===e?b=t[16]:(b=t=>{let n=c.current;if(!n||n.pointerId!==t.pointerId)return;c.current=null;let r=t.clientX-n.x,i=t.clientY-n.y;n.swipe&&Math.abs(r)>=50&&Math.abs(r)>Math.abs(i)*1.5&&e.onImageSwipe?.(r<0?`next`:`previous`)},t[15]=e,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[17]=x):x=t[17];let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[18]!==S||t[19]!==C?(w={transform:S,cursor:C},t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==r||t[22]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[21]=r,t[22]=w,t[23]=T):T=t[23];let E;return t[24]!==T||t[25]!==v||t[26]!==b?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[24]=T,t[25]=v,t[26]=b,t[27]=E):E=t[27],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(22),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T);let E=f?(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[(0,p.jsx)(y,{props:e,message:b(e)}),(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600 dark:text-red-400`,children:f})]}):e.kind===`excel`&&m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,D=`${f?`hidden`:`flex`} docx-preview-host min-h-0 flex-1 flex-col overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`,O;t[17]===D?O=t[18]:(O=(0,p.jsx)(`div`,{ref:s,className:D}),t[17]=D,t[18]=O);let k;return t[19]!==O||t[20]!==E?(k=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[E,O]}),t[19]=O,t[20]=E,t[21]=k):k=t[21],k}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,o=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,s):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==o?(u=o?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=o,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==o?(f=o?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=o,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};