@xopcai/xopc 0.0.455 → 0.0.456

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 (137) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{automations-page-Dt_Z1UTT.js → automations-page-CgQDpSpK.js} +1 -1
  4. package/dist/gateway/static/root/assets/{automations-workspace-BhHgruhH.js → automations-workspace-CWEDraTP.js} +2 -2
  5. package/dist/gateway/static/root/assets/{chat-page-dY6aCCRx.js → chat-page-BjYumhaI.js} +19 -19
  6. package/dist/gateway/static/root/assets/{desktop-pet-DlTuGzZ2.js → desktop-pet-Cn1TfGz4.js} +1 -1
  7. package/dist/gateway/static/root/assets/{desktop-pet-narrative-cBFIPXzR.js → desktop-pet-narrative-JqMsz4rn.js} +1 -1
  8. package/dist/gateway/static/root/assets/{index-CZI3VGGW.js → index-DBlVVXOA.js} +5 -5
  9. package/dist/gateway/static/root/assets/index-DpkEeFEQ.css +1 -0
  10. package/dist/gateway/static/root/assets/{note-detail-panel-anM38aV6.js → note-detail-panel-C6s0WlNL.js} +2 -2
  11. package/dist/gateway/static/root/assets/{notes-page-BsZmT7Zw.js → notes-page-CR7dNVDi.js} +1 -1
  12. package/dist/gateway/static/root/assets/{personal-page-BSCNuRMT.js → personal-page-C89kLOIL.js} +1 -1
  13. package/dist/gateway/static/root/assets/{project-detail-page-ibZZ_w51.js → project-detail-page-sHcdluTm.js} +1 -1
  14. package/dist/gateway/static/root/assets/{route-preload-anuckzRl.js → route-preload-DrfQJkmW.js} +2 -2
  15. package/dist/gateway/static/root/assets/{settings-page-DAc5n-mM.js → settings-page-C4CYw21O.js} +1 -1
  16. package/dist/gateway/static/root/assets/{task-detail-page-BJok6V1K.js → task-detail-page-DBnkT1Nj.js} +1 -1
  17. package/dist/gateway/static/root/assets/tool-friendly-title-CP35P4VA.js +2 -0
  18. package/dist/gateway/static/root/assets/understanding-refresh-store-CIpGYSl0.js +1 -0
  19. package/dist/gateway/static/root/assets/user-model-page-Bbi2MpIS.js +2 -0
  20. package/dist/gateway/static/root/index.html +7 -7
  21. package/dist/package.js +1 -1
  22. package/dist/src/agent/agent-manager.js +7 -2
  23. package/dist/src/agent/background-review/prompts.d.ts +1 -1
  24. package/dist/src/agent/background-review/prompts.js +8 -1
  25. package/dist/src/agent/background-review/run-background-review.js +48 -4
  26. package/dist/src/agent/context/audit.js +18 -0
  27. package/dist/src/agent/context/coordinator.d.ts +4 -0
  28. package/dist/src/agent/context/coordinator.js +33 -7
  29. package/dist/src/agent/context/deep-recall.d.ts +33 -0
  30. package/dist/src/agent/context/deep-recall.js +190 -0
  31. package/dist/src/agent/context/execution-context.js +29 -5
  32. package/dist/src/agent/context/execution-context.types.d.ts +2 -0
  33. package/dist/src/agent/context/memory-claim-grounding.d.ts +2 -0
  34. package/dist/src/agent/context/memory-claim-grounding.js +20 -0
  35. package/dist/src/agent/context/recall-grounding.d.ts +3 -0
  36. package/dist/src/agent/context/recall-grounding.js +31 -0
  37. package/dist/src/agent/embedded/run-turn.js +46 -0
  38. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  39. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  40. package/dist/src/agent/external-tools/endpoint-provider.js +3 -3
  41. package/dist/src/agent/memory/context-recovery.d.ts +1 -1
  42. package/dist/src/agent/memory/index.js +1 -1
  43. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  44. package/dist/src/agent/service.d.ts +1 -0
  45. package/dist/src/agent/service.js +6 -3
  46. package/dist/src/agent/skills/index.js +1 -1
  47. package/dist/src/agent/skills/managed-store.js +1 -1
  48. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  49. package/dist/src/agent/tools/factory.js +22 -0
  50. package/dist/src/agent/tools/knowledge-memory-tool.js +7 -1
  51. package/dist/src/agent/tools/personal-memory-tool.d.ts +11 -0
  52. package/dist/src/agent/tools/personal-memory-tool.js +387 -0
  53. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  54. package/dist/src/agent/tools/session-search-tool.d.ts +2 -0
  55. package/dist/src/agent/tools/session-search-tool.js +21 -7
  56. package/dist/src/agent/tools/user-context-tool.js +11 -1
  57. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  58. package/dist/src/agent-catalog/capabilities.js +2 -2
  59. package/dist/src/agent-catalog/repository.js +1 -1
  60. package/dist/src/automations/api/routes.js +2 -2
  61. package/dist/src/automations/capabilities/drafts.js +1 -1
  62. package/dist/src/automations/capabilities/write.js +1 -1
  63. package/dist/src/automations/configuration-conversation.js +1 -1
  64. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  65. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  66. package/dist/src/capabilities/runtime/product.js +1 -1
  67. package/dist/src/cli/commands/agents.js +1 -1
  68. package/dist/src/cli/commands/models.js +1 -1
  69. package/dist/src/cli/commands/onboard/model.js +1 -1
  70. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  71. package/dist/src/computer/endpoint-transport.js +1 -1
  72. package/dist/src/config/agent-profile.js +1 -1
  73. package/dist/src/config/schema.d.ts +6 -0
  74. package/dist/src/config/schema.js +6 -0
  75. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  76. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  77. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  78. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  79. package/dist/src/gateway/agents-admin.js +2 -2
  80. package/dist/src/gateway/global-defaults-admin.js +1 -1
  81. package/dist/src/gateway/hono/lib/config-payload.d.ts +6 -0
  82. package/dist/src/gateway/hono/routes/agents.js +1 -1
  83. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  84. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  85. package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
  86. package/dist/src/gateway/hono/routes/notes.js +2 -2
  87. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  88. package/dist/src/gateway/hono/routes/projects.js +2 -2
  89. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  90. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  91. package/dist/src/gateway/hono/routes/user-model.js +47 -7
  92. package/dist/src/gateway/image-generation-setup.js +1 -1
  93. package/dist/src/gateway/service/config-coordinator.d.ts +6 -0
  94. package/dist/src/gateway/service.js +4 -4
  95. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  96. package/dist/src/home-intelligence/host.js +2 -2
  97. package/dist/src/imports/importService.js +1 -1
  98. package/dist/src/knowledge-memory/index.js +2 -2
  99. package/dist/src/knowledge-memory/repository.d.ts +6 -0
  100. package/dist/src/knowledge-memory/repository.js +49 -1
  101. package/dist/src/knowledge-memory/usage-policy.js +7 -7
  102. package/dist/src/local-apps/automation-proposals.js +1 -1
  103. package/dist/src/local-apps/capabilities/automation-policy.js +1 -1
  104. package/dist/src/local-apps/capabilities/delegate.js +3 -3
  105. package/dist/src/local-apps/p1-services.js +1 -1
  106. package/dist/src/local-apps/service.js +1 -1
  107. package/dist/src/memory-learning/work-capture.js +3 -1
  108. package/dist/src/personal-agent/policy.d.ts +1 -1
  109. package/dist/src/personal-agent/policy.js +2 -1
  110. package/dist/src/personal-agent/prompts.js +7 -1
  111. package/dist/src/personal-agent/service.js +1 -1
  112. package/dist/src/providers/model-catalog-persistence.js +1 -1
  113. package/dist/src/runtime-tools/archive.js +1 -1
  114. package/dist/src/session/history-recall-policy.d.ts +6 -0
  115. package/dist/src/session/history-recall-policy.js +48 -0
  116. package/dist/src/tasks/capabilities/read.js +2 -2
  117. package/dist/src/tasks/capabilities/write.js +1 -1
  118. package/dist/src/tui/backends/embedded-backend.js +1 -1
  119. package/dist/src/user-context/config.d.ts +12 -0
  120. package/dist/src/user-context/config.js +14 -1
  121. package/dist/src/user-context/memory-version.d.ts +2 -0
  122. package/dist/src/user-context/memory-version.js +12 -0
  123. package/dist/src/user-model/capture/evidence-policy.d.ts +45 -0
  124. package/dist/src/user-model/capture/evidence-policy.js +143 -0
  125. package/dist/src/user-model/capture/executor.d.ts +1 -0
  126. package/dist/src/user-model/capture/executor.js +68 -8
  127. package/dist/src/user-model/capture/semantic.d.ts +16 -0
  128. package/dist/src/user-model/capture/semantic.js +66 -12
  129. package/dist/src/user-model/repository.js +11 -0
  130. package/dist/src/user-model/usage-policy.js +5 -5
  131. package/dist/src/voice/realtime/persona-context.js +1 -1
  132. package/dist/src/work-discovery/service.js +1 -1
  133. package/package.json +1 -1
  134. package/dist/gateway/static/root/assets/index-Bj5exyow.css +0 -1
  135. package/dist/gateway/static/root/assets/tool-friendly-title-DC8_9-Lo.js +0 -2
  136. package/dist/gateway/static/root/assets/understanding-refresh-store-Ihz2p9Vg.js +0 -1
  137. package/dist/gateway/static/root/assets/user-model-page-1eYattnk.js +0 -2
@@ -3,7 +3,7 @@
3
3
  "minimum_chrome_version": "120",
4
4
  "default_locale": "en",
5
5
  "name": "__MSG_appName__",
6
- "version": "0.0.455",
6
+ "version": "0.0.456",
7
7
  "description": "__MSG_appDescription__",
8
8
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqnpr4vpLC/nmvy+wiOWk3SWlp2nEZkFijfk8ivGw7StNZgCK90nOMvwhdEtlkk3GOWDvdVnq8HxCsM3UNQ8FnGUyerpH1FJXqXuradxeHf8ZxFjiQU/mIWfnKbUuONWQORon3/pigyoXoK/VUXgg0Wbm/rbVwsS0bv+25R6m+mZgBspOLeKuoH7ivhL+48WV6POtMBsFPZweY26477EM7ukh+56Ff5ENevB8ymxBBn7qK5ZoeZd2a23U8ioX5TsHfe6fnrjitPWjIxD8G0NoKQxcaa/Mo+xs+T6UiLKxP0wjz5bm7jB5H+CXtkRJqzBWUB0h+RSLJckzZfA8BAJrRwIDAQAB",
9
9
  "permissions": [
@@ -2,7 +2,7 @@
2
2
  "id": "telegram",
3
3
  "name": "Telegram Channel",
4
4
  "description": "Bundled Telegram Bot channel (private workspace sources; ships inside @xopcai/xopc dist/)",
5
- "version": "0.0.455",
5
+ "version": "0.0.456",
6
6
  "kind": "channel",
7
7
  "main": "src/index.js",
8
8
  "channels": [
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-BhHgruhH.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-CWEDraTP.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,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page-dY6aCCRx.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/locale-store-cg9cm2EL.js","assets/messages-eQ2CYlpG.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/arrow-up-right-T72JbQ1Q.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-BN2HTA9T.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/notes-api-CR75RHd0.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-D1zBWkfB.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/chat-chart-block-NSy-B0NS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/skeleton-DzdOeGYz.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/vendor-swr-CdRzEUwF.js","assets/button-Cc4hUNTt.js","assets/automation-api-mn8ihWJ_.js","assets/earth-C9Z4bTTG.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-CeXl9w6z.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/new-chat-navigation-B6NPQ4h4.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/database-CjjeZfRG.js","assets/ellipsis-0k4rZLoy.js","assets/file-BqMS_3DT.js","assets/file-text-D12HbeVy.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/use-file-preview-expanded-dhNMHf5b.js","assets/eye-CABVeTq0.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/constants-DpkUgykJ.js","assets/session-api-CQlEq0MB.js","assets/gateway-startup-retry-BaaoKBoB.js","assets/attachment-utils-core-BIOUBrpT.js","assets/composer-notifications-B-kL3qAA.js","assets/activity-store-DYwR1u3f.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/workspace-api-B1Uirhxf.js","assets/files-BNL4kkSB.js","assets/index.module-Cd9ENXfk.js","assets/dist-ZrL34Ps4.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/install-connector-dialog-BsiyYQhx.js","assets/secret-input-DsjfQmDn.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CgsSm-Av.js","assets/gateway-config-swr-OGhON-s6.js","assets/oauth-provider-connect-Dk1NeeqD.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-s0FMNhq9.js","assets/registry-api-BTd_OgbD.js","assets/oauth-api-CvPnQTlH.js","assets/connection-usage-guide-CiVpcbds.js","assets/connection-usage-BhdQRWgQ.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/trash-2-DusmjVPV.js","assets/share-link-dialog-ztX1WPXG.js","assets/copy-text-row-CpiRzq4G.js","assets/wrench-DFb4r8bH.js","assets/tasks-BTLabOMp.js","assets/specialists-xbB3xL9e.js","assets/api-DPNeNCmR.js","assets/session-manager-C7RfUfqI.js","assets/local-session-drafts-XurtjR58.js","assets/tool-activity-BtJkgjFf.js","assets/gateway-realtime-B9u4uSXW.js","assets/gateway-realtime-store-xB7Bq4Zs.js","assets/agents-admin-api-CKscfdvA.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-BrK8-SNz.js","assets/model-selector-CL6WT-jw.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/use-composer-attachments-CLIrD0mm.js","assets/chevron-left-DqFhpbvK.js","assets/capabilities-kG175Q-7.js","assets/capabilities-DKbXv8Ck.js","assets/file-preview-surface-z7_HV0WN.js","assets/phone-workspace-store-CC61pIuJ.js","assets/shares-api-CSZqeNL4.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/chat-agents-api-UOdNWZ0_.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-DBE1mvOS.js","assets/workspace-editor-agent-store-Nos5ebMv.js","assets/voice-input-shortcut-events-Cc30ZcFy.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/linkify-it-BkqEorO0.js","assets/tool-friendly-title-DC8_9-Lo.js","assets/use-realtime-voice-DDVVlX1R.js","assets/voice-CDlC6XMH.js","assets/voice-call-context-BM2A4bLz.js","assets/page-header-store-DU4NnGap.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-CbVokTvd.js","assets/theme-store-GZQ3pTgy.js","assets/extension-message-router-Dn8JzOdR.js","assets/agent-avatar-display-DqFYHXCS.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-DrA5mTQp.js","assets/command-palette-api-Dkn9bbYd.js","assets/skill-list-api-DfUsku-x.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-BY_k6iWp.js","assets/calendar-clock-D-quYVPe.js","assets/message-circle-Badhj-4D.js","assets/date-picker-dx284jQI.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-C1PXAXZF.js","assets/dev-view-store-BOxbj1ie.js","assets/extension-iframe-host-DiIqM2JO.js","assets/extension-authoritative-grants-C0ReZguU.js","assets/runtime-health-zDkHcOZO.js","assets/api-CHM2c_Ah.js","assets/terminal-panel-store-D8eZPvql.js","assets/agents-app-path-ciChvpCS.js","assets/agent-display-names-Bje7vfSn.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-Ckb8baxj.js","assets/management-api-B6jVuJ6W.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>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-Czpn1I53.js";import{m as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as c,i as l,l as u,n as d}from"./locale-store-cg9cm2EL.js";import{t as f}from"./messages-eQ2CYlpG.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-CY7CS_D3.js";import{t as y}from"./activity-YogQEteU.js";import{t as b}from"./arrow-left-D880xG-P.js";import{t as x}from"./calendar-clock-D-quYVPe.js";import{i as S,n as C,r as w,t as T}from"./automation-run-list-BhtaMpTb.js";import{t as E}from"./check-DUBLcKHA.js";import{t as D}from"./chevron-down-ccbiQQz_.js";import{t as O}from"./chevron-right-BweFrslA.js";import{n as k,r as A}from"./popover-select-CLsphyzA.js";import{t as j}from"./circle-alert-BEjgurr2.js";import{t as M}from"./circle-check-C23XjkUj.js";import{t as N}from"./copy-Dv6d4Dvw.js";import{t as P}from"./ellipsis-0k4rZLoy.js";import{t as F}from"./eye-CABVeTq0.js";import{t as I}from"./git-branch-Dh9uxTot.js";import{t as L}from"./list-filter-CIPvpfLA.js";import{t as R}from"./loader-circle-CifKLtgG.js";import{t as z}from"./markdown-view-D1zBWkfB.js";import{t as ee}from"./message-circle-Badhj-4D.js";import{t as te}from"./pause-DuPxgSxk.js";import{t as ne}from"./pencil-DmIY3Oa-.js";import{t as re}from"./play-kxZvpBg8.js";import{t as ie}from"./plus-Q2yW6OE7.js";import{t as ae}from"./refresh-cw-BRlGaq2w.js";import{t as oe}from"./search-DA7gz22f.js";import{t as B}from"./shield-check-BU58siTV.js";import{t as se}from"./sparkles-DHlfQFAF.js";import{t as V}from"./square-pen-B8FsvqNu.js";import{t as H}from"./trash-2-DusmjVPV.js";import{t as ce}from"./x-B_N4OPjy.js";import{t as U}from"./zap-dximCGjy.js";import{t as W}from"./cn-0WouolD0.js";import{t as G}from"./skeleton-DzdOeGYz.js";import{d as K}from"./api-DPNeNCmR.js";import{a as q}from"./session-api-CQlEq0MB.js";import{T as J}from"./session-manager-C7RfUfqI.js";import{a as le,i as Y,o as ue}from"./vendor-swr-CdRzEUwF.js";import{t as de}from"./chat-agents-api-UOdNWZ0_.js";import{t as fe}from"./button-Cc4hUNTt.js";import{t as pe}from"./page-header-store-DU4NnGap.js";import{t as X}from"./automation-api-mn8ihWJ_.js";import{t as me}from"./sliding-tab-list-CmcrqRzN.js";import{t as he}from"./refresh-button-DiWdGAaX.js";import{a as ge,c as _e,d as ve,f as ye,i as be,l as xe,m as Se,o as Z,p as Ce,r as we,s as Te,t as Ee,u as De}from"./dist-ZrL34Ps4.js";import{n as Oe}from"./model-selector-CL6WT-jw.js";import{C as ke,S as Ae,_ as je,a as Me,b as Ne,c as Pe,d as Fe,f as Ie,g as Le,h as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,s as Ge,u as Ke,v as qe,w as Je,x as Ye,y as Xe}from"./automation-task-card-BY_k6iWp.js";import{t as Ze}from"./time-picker-C1PXAXZF.js";import{n as Qe}from"./agent-display-names-Bje7vfSn.js";import{i as $e,n as et,r as tt,t as nt}from"./automation-result-state-COzakzak.js";import{t as rt}from"./date-time-picker-Dj-bhLNP.js";var it=n(),Q=e(t(),1),$=r(),at=(0,Q.lazy)(()=>i(()=>import(`./chat-page-dY6aCCRx.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201])));function ot(e){let t=(0,it.c)(110),{runId:n,automationId:r,projectId:i,language:a,onConfigure:o,onDetails:s,onBack:c}=e,l=a===`zh`,[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>g(e),t[0]=_):_=t[0];let v=_,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(!0),t[1]=y):y=t[1];let x=y,{mutate:S}=le(),w=(0,Q.useRef)(!1),T=i??``,E;t[2]!==r||t[3]!==n||t[4]!==T?(E=[`automation-execution`,r,n,T],t[2]=r,t[3]=n,t[4]=T,t[5]=E):E=t[5];let D;t[6]!==r||t[7]!==i||t[8]!==n||t[9]!==l?(D=async()=>{let{run:e}=await X.getRun(n);if(e.automationId!==r)throw Error(l?`执行记录不属于此自动化`:`Execution does not belong to this automation`);let{automation:t}=await X.get(r);if(i&&t.projectId!==i)throw Error(l?`执行记录不属于此项目`:`Execution does not belong to this project`);return{run:e,automation:t}},t[6]=r,t[7]=i,t[8]=n,t[9]=l,t[10]=D):D=t[10];let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O={refreshInterval:lt,shouldRetryOnError:!1},t[11]=O):O=t[11];let{data:k,error:A,mutate:j}=Y(E,D,O),M=k?.run,N=M?.conversationId,P;t[12]===N?P=t[13]:(P=e=>!!(N&&(e.sessions[N]?.streaming||e.sessions[N]?.sending)),t[12]=N,t[13]=P);let F=J(P),I;t[14]===N?I=t[15]:(I=N?[`automation-execution-session`,N]:null,t[14]=N,t[15]=I);let L;t[16]===N?L=t[17]:(L=()=>q(N),t[16]=N,t[17]=L);let R;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(R={shouldRetryOnError:!1},t[18]=R):R=t[18];let{data:ee,error:te,mutate:ne}=Y(I,L,R),re=M?.conversationShared||k?.automation.conversationMode===`continuous`||ee?.customData?.latestAutomationRunId!==void 0&&ee.customData.latestAutomationRunId!==n,ie=!!(ee&&(!re||u)),ae=!A&&!!(M&&(!N||re&&!u&&ee&&!te&&(M?.summary||M?.error)||ee&&!te&&p)),oe,B;if(t[19]!==ae||t[20]!==j||t[21]!==S||t[22]!==M?(oe=()=>{!M||!ae||C(M)||M.readAtMs!=null||w.current||(w.current=!0,X.markRunRead(M.id).then(async()=>{await Promise.all([j(),S(ct)])}).catch(st).finally(()=>{w.current=!1}))},B=[M,ae,j,S],t[19]=ae,t[20]=j,t[21]=S,t[22]=M,t[23]=oe,t[24]=B):(oe=t[23],B=t[24]),(0,Q.useEffect)(oe,B),A){let e=A instanceof Error?A.message:l?`执行记录加载失败`:`Could not load execution`,n;t[25]===e?n=t[26]:(n=(0,$.jsx)(`p`,{children:e}),t[25]=e,t[26]=n);let r;t[27]===j?r=t[28]:(r=()=>void j(),t[27]=j,t[28]=r);let i=l?`重试`:`Retry`,a;t[29]!==r||t[30]!==i?(a=(0,$.jsx)(fe,{onClick:r,children:i}),t[29]=r,t[30]=i,t[31]=a):a=t[31];let o=l?`返回自动化`:`Back to automation`,s;t[32]!==c||t[33]!==o?(s=(0,$.jsx)(fe,{onClick:c,children:o}),t[32]=c,t[33]=o,t[34]=s):s=t[34];let u;return t[35]!==n||t[36]!==a||t[37]!==s?(u=(0,$.jsxs)(`section`,{role:`alert`,className:`space-y-3 p-5`,children:[n,a,s]}),t[35]=n,t[36]=a,t[37]=s,t[38]=u):u=t[38],u}if(!M){let e;return t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-4 p-5`,"aria-busy":`true`,children:[(0,$.jsx)(G,{className:`h-6 w-2/3`}),(0,$.jsx)(G,{className:`h-20`})]}),t[39]=e):e=t[39],e}let se;t[40]===M?se=t[41]:(se=C(M),t[40]=M,t[41]=se);let V=se,H=l?`执行会话`:`Execution conversation`,ce=l?`返回自动化`:`Back to automation`,U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(b,{className:`size-4`}),t[42]=U):U=t[42];let W;t[43]!==c||t[44]!==ce?(W=(0,$.jsx)(fe,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":ce,children:U}),t[43]=c,t[44]=ce,t[45]=W):W=t[45];let K;t[46]===M.automationName?K=t[47]:(K=(0,$.jsx)(`h2`,{className:`truncate text-sm font-medium text-fg`,children:M.automationName}),t[46]=M.automationName,t[47]=K);let ue;t[48]!==W||t[49]!==K?(ue=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[W,K]}),t[48]=W,t[49]=K,t[50]=ue):ue=t[50];let de;t[51]!==M.createdAtMs||t[52]!==l?(de=new Date(M.createdAtMs).toLocaleString(l?`zh-CN`:`en-US`),t[51]=M.createdAtMs,t[52]=l,t[53]=de):de=t[53];let pe;t[54]===a?pe=t[55]:(pe=f(a),t[54]=a,t[55]=pe);let me=pe.automations.status[M.status],he;t[56]!==de||t[57]!==me?(he=(0,$.jsxs)(`span`,{children:[de,` · `,me]}),t[56]=de,t[57]=me,t[58]=he):he=t[58];let ge;t[59]!==s||t[60]!==M.id?(ge=()=>s(M.id),t[59]=s,t[60]=M.id,t[61]=ge):ge=t[61];let _e=l?`运行详情`:`Run details`,ve;t[62]!==ge||t[63]!==_e?(ve=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:ge,children:_e}),t[62]=ge,t[63]=_e,t[64]=ve):ve=t[64];let ye;t[65]!==o||t[66]!==M?(ye=()=>o(M),t[65]=o,t[66]=M,t[67]=ye):ye=t[67];let be=l?`调整自动化`:`Adjust automation`,xe;t[68]!==ye||t[69]!==be?(xe=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:ye,children:be}),t[68]=ye,t[69]=be,t[70]=xe):xe=t[70];let Se;t[71]!==he||t[72]!==ve||t[73]!==xe?(Se=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[he,ve,xe]}),t[71]=he,t[72]=ve,t[73]=xe,t[74]=Se):Se=t[74];let Z;t[75]!==k?.automation||t[76]!==re||t[77]!==l?(Z=re?(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[l?`多次执行可能共用此会话;下方摘要对应所选执行。`:`Executions may share this conversation. The summary belongs to the selected execution.`,k?.automation.conversationMode===`continuous`?l?`追问会进入后续运行上下文。`:` Follow-ups become context for future runs.`:null]}):null,t[75]=k?.automation,t[76]=re,t[77]=l,t[78]=Z):Z=t[78];let Ce;t[79]!==h||t[80]!==u||t[81]!==l?(Ce=u?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:h===!0?l?`已定位到所选执行的会话起点。`:`Located the selected execution in this conversation.`:h===!1?l?`旧记录缺少可用的执行定位信息,当前显示完整会话。`:`No matching turn was found in the available history. Showing the full conversation.`:l?`正在定位所选执行…`:`Locating the selected execution…`}):null,t[79]=h,t[80]=u,t[81]=l,t[82]=Ce):Ce=t[82];let we;t[83]!==V||t[84]!==l?(we=V?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:l?`执行中,完成后可继续追问。`:`Execution in progress. Follow up after it finishes.`}):null,t[83]=V,t[84]=l,t[85]=we):we=t[85];let Te;t[86]!==ue||t[87]!==Se||t[88]!==Z||t[89]!==Ce||t[90]!==we?(Te=(0,$.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge px-4 py-3`,children:[ue,Se,Z,Ce,we]}),t[86]=ue,t[87]=Se,t[88]=Z,t[89]=Ce,t[90]=we,t[91]=Te):Te=t[91];let Ee;t[92]!==V||t[93]!==N||t[94]!==F||t[95]!==ee||t[96]!==a||t[97]!==ne||t[98]!==M.error||t[99]!==M.id||t[100]!==M.summary||t[101]!==te||t[102]!==re||t[103]!==ie||t[104]!==l?(Ee=ie?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(G,{className:`m-5 h-40`}),children:(0,$.jsx)(at,{embedded:!0,automationExecution:!0,conversationId:N,readOnly:V||F,onHistoryReady:x,initialTurnId:re?M.id:void 0,onInitialTurnLocated:v},N)}):(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[M.summary?(0,$.jsx)(z,{content:M.summary}):null,M.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-danger`,children:M.error}):null,N?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:V?l?`等待执行会话,开始后会自动更新。`:`Waiting for the execution conversation. This view updates automatically.`:l?`本次执行没有关联会话,可查看运行结果和详情。`:`No conversation is associated with this execution. Results and diagnostics remain available.`}),N&&!ee&&!te?(0,$.jsx)(G,{className:`h-24`}):null,te?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:te.status===404?l?`执行会话已删除,运行结果仍保留。`:`The execution conversation was deleted. Results are still available.`:l?`执行会话暂时无法读取,运行结果仍保留。`:`The conversation is unavailable. Results are still available.`}),(0,$.jsx)(fe,{onClick:()=>void ne(),children:l?`重试`:`Retry`})]}):null,re&&ee?(0,$.jsx)(fe,{variant:`secondary`,onClick:()=>d(!0),children:l?`打开共享会话`:`Open shared conversation`}):null,V?null:(0,$.jsx)($e,{runId:M.id,language:a})]}),t[92]=V,t[93]=N,t[94]=F,t[95]=ee,t[96]=a,t[97]=ne,t[98]=M.error,t[99]=M.id,t[100]=M.summary,t[101]=te,t[102]=re,t[103]=ie,t[104]=l,t[105]=Ee):Ee=t[105];let De;return t[106]!==H||t[107]!==Te||t[108]!==Ee?(De=(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":H,children:[Te,Ee]}),t[106]=H,t[107]=Te,t[108]=Ee,t[109]=De):De=t[109],De}function st(){}function ct(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-navigation-runs`].includes(String(e[0]))||e===`automations-global-system-source`}function lt(e){return e&&C(e.run)?3e3:15e3}function ut(e){let t=(0,it.c)(44),{automation:n,language:r,busy:i,onEdit:a,onAction:o}=e,s=r===`zh`,c=n.management,l=s?`${n.name}的更多操作`:`More actions for ${n.name}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(P,{className:`size-4`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,$.jsx)(Se,{asChild:!0,children:(0,$.jsx)(fe,{variant:`ghost`,className:`size-8 p-0`,"aria-label":l,children:u})}),t[1]=l,t[2]=d);let f;t[3]!==n||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==s?(f=(!c||c.editable.includes(`enabled`))&&!ke(n)?(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:toggle`,()=>n.enabled?X.pause(n.id):X.resume(n.id)),children:[n.enabled?(0,$.jsx)(te,{className:`size-4`}):(0,$.jsx)(re,{className:`size-4`}),n.enabled?s?`暂停`:`Pause`:s?`恢复`:`Resume`]}):null,t[3]=n,t[4]=i,t[5]=c,t[6]=o,t[7]=s,t[8]=f):f=t[8];let p;t[9]!==n.id||t[10]!==i||t[11]!==c||t[12]!==o||t[13]!==s?(p=!c||c.runnable?(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:run`,()=>X.runNow(n.id)),children:[(0,$.jsx)(re,{className:`size-4`}),s?`立即运行`:`Run now`]}):null,t[9]=n.id,t[10]=i,t[11]=c,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==i||t[17]!==c||t[18]!==a||t[19]!==s?(m=!c||c.editable.includes(`trigger`)?(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>a(n),children:[(0,$.jsx)(ne,{className:`size-4`}),s?`编辑`:`Edit`]}):null,t[15]=n,t[16]=i,t[17]=c,t[18]=a,t[19]=s,t[20]=m):m=t[20];let h;t[21]!==n.id||t[22]!==o||t[23]!==s?(h=()=>void o(`automation:${n.id}:copy-link`,()=>navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}#/automations?automation=${encodeURIComponent(n.id)}`),s?`任务链接已复制`:`Task link copied`),t[21]=n.id,t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(N,{className:`size-4`}),t[25]=g):g=t[25];let _=s?`复制任务链接`:`Copy task link`,v;t[26]!==h||t[27]!==_?(v=(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:h,children:[g,_]}),t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.id||t[30]!==i||t[31]!==c||t[32]!==o||t[33]!==s?(y=!c||c.deletable?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50 text-danger`,disabled:i,onSelect:()=>{window.confirm(s?`删除这个定时任务?已保存的对话仍可查看。`:`Delete this scheduled task? Saved conversations will remain available.`)&&o(`automation:${n.id}:delete`,()=>X.remove(n.id))},children:[(0,$.jsx)(H,{className:`size-4`}),s?`删除`:`Delete`]})]}):null,t[29]=n.id,t[30]=i,t[31]=c,t[32]=o,t[33]=s,t[34]=y):y=t[34];let b;t[35]!==v||t[36]!==y||t[37]!==f||t[38]!==p||t[39]!==m?(b=(0,$.jsx)(Z,{children:(0,$.jsxs)(Ee,{align:`end`,sideOffset:4,className:`z-70 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[f,p,m,v,y]})}),t[35]=v,t[36]=y,t[37]=f,t[38]=p,t[39]=m,t[40]=b):b=t[40];let x;return t[41]!==b||t[42]!==d?(x=(0,$.jsxs)(xe,{children:[d,b]}),t[41]=b,t[42]=d,t[43]=x):x=t[43],x}function dt({automations:e,runs:t,labels:n,cronLabels:r,language:i,selectedAutomationId:a,selectedRunId:o,selectedRun:s,projectId:c,executionSummaries:l,onSelectRun:d,onOpenDetails:f,busy:p,onEdit:m,onAction:h}){let g=`xopc.automation-navigation:${u(e=>e.baseUrl)}:${u(e=>e.conversationId)??`local`}`,[_,v]=(0,Q.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}});(0,Q.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);v(e&&typeof e==`object`&&!Array.isArray(e)?e:{})}catch{v({})}},[g]);let y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!a||y.current===a||(y.current=a,v(e=>({...e,[a]:!0})))},[a]);let b=e=>v(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(g,JSON.stringify(n))}catch{}return n});return e.length===0?(0,$.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:n.empty.filtered}):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:e.map(e=>{let u=t.filter(t=>t.automationId===e.id).sort((e,t)=>t.createdAtMs-e.createdAtMs),g=u.find(C);return(0,$.jsxs)(`div`,{className:`group relative`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!!_[e.id],"aria-controls":`automation-runs-${e.id}`,"aria-label":i===`zh`?`${_[e.id]?`收起`:`展开`} ${e.name} 的执行记录`:`${_[e.id]?`Collapse`:`Expand`} executions for ${e.name}`,className:`absolute left-1 top-2 z-10 rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(e.id),children:_[e.id]?(0,$.jsx)(D,{className:`size-4`}):(0,$.jsx)(O,{className:`size-4`})}),(0,$.jsxs)(`button`,{type:`button`,className:W(`block w-full p-3 pl-9 pr-10 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,a===e.id&&!o&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 76px`},"aria-current":a===e.id&&!o?`true`:void 0,onClick:()=>f(e.id),children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:W(`size-2 shrink-0 rounded-full`,g?`bg-blue-500`:et(e,u)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:ke(e)?i===`zh`?`已完成`:`Completed`:e.enabled?n.enabled:n.paused}),(l?.[e.id]?.unreadCount??0)>0?(0,$.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:n.filters.unread})}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate pl-4 text-xs leading-5 text-fg-muted`,children:[e.enabled?(0,$.jsxs)($.Fragment,{children:[Le(e,n,i),(0,$.jsx)(`span`,{className:`mx-1.5`,children:`·`})]}):null,je(e.trigger,n,r,i)]}),et(e,u)?(0,$.jsx)(`p`,{className:`mt-1 pl-4 text-xs text-red-700 dark:text-red-300`,children:n.dashboard.needsAttention}):null]}),(0,$.jsx)(`div`,{id:`automation-runs-${e.id}`,hidden:!_[e.id],children:(0,$.jsx)(T,{automationId:e.id,projectId:c,language:i,selectedRunId:o,selectedRun:s,enabled:!!_[e.id],onSelectRun:d})}),(0,$.jsx)(`div`,{className:`absolute right-1 top-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,$.jsx)(ut,{automation:e,language:i,busy:p,onEdit:m,onAction:h})})]},e.id)})})}var ft=`xopc.automations.listWidth`,pt=272,mt=200,ht=560;function gt({children:e,language:t,busy:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(()=>{try{let e=Number(window.localStorage.getItem(ft));if(Number.isFinite(e)&&e>=mt&&e<=ht)return e}catch{}return pt});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(ft,String(s))}catch{}},[s]),(0,Q.useEffect)(()=>{if(!a)return;let{cursor:e,userSelect:t}=document.body.style;return document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,()=>{document.body.style.cursor=e,document.body.style.userSelect=t}},[a]);let l=e=>{let t=r.current?.getBoundingClientRect().width??1e3,n=Math.max(mt,Math.min(ht,t*.6,t-292));return Math.round(Math.max(mt,Math.min(n,e)))},u=t===`zh`?`调整任务列表宽度`:`Resize task list`;return(0,$.jsxs)(`section`,{ref:r,"aria-busy":n,className:`grid min-h-0 min-w-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-y-3 md:grid-cols-[minmax(0,min(var(--automation-list-width),60%))_0.75rem_minmax(0,1fr)] md:grid-rows-1 md:gap-y-0`,style:{"--automation-list-width":`${s}px`},children:[e[0],(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-valuemin":mt,"aria-valuemax":ht,"aria-valuenow":s,tabIndex:0,title:t===`zh`?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,className:`relative hidden touch-none select-none cursor-col-resize focus-visible:outline-accent md:block`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e.currentTarget.previousElementSibling?.getBoundingClientRect().width??s;i.current={pointerId:e.pointerId,startX:e.clientX,startWidth:t},o(!0)},onPointerMove:e=>{let t=i.current;t?.pointerId===e.pointerId&&c(l(t.startWidth+e.clientX-t.startX))},onPointerUp:e=>{i.current?.pointerId===e.pointerId&&(i.current=null,o(!1),e.currentTarget.releasePointerCapture(e.pointerId))},onPointerCancel:()=>{i.current=null,o(!1)},onLostPointerCapture:()=>{i.current=null,o(!1)},onDoubleClick:()=>c(pt),onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(l(e.key===`Home`?mt:e.key===`End`?ht:s+(e.key===`ArrowLeft`?-16:16))))}}),e[1]]})}var _t=(0,Q.lazy)(()=>i(()=>import(`./chat-page-dY6aCCRx.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201])));function vt(e){let t=(0,it.c)(51),{automation:n,conversationId:r,runs:i,language:a,onSelectRun:o,onConfigured:s}=e,c=n?.id,l;t[0]!==c||t[1]!==r?(l=c&&!r?[`automation-workspace-chat`,c]:null,t[0]=c,t[1]=r,t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=()=>X.openConfiguration({automationId:c}),t[3]=c,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1},t[5]=d):d=t[5];let{data:p,error:m,mutate:h}=Y(l,u,d),g;t[6]===r?g=t[7]:(g=r?[`automation-configuration`,r]:null,t[6]=r,t[7]=g);let _;t[8]===r?_=t[9]:(_=()=>X.configuration(r),t[8]=r,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={refreshInterval:3e3},t[10]=v):v=t[10];let{data:y}=Y(g,_,v),b,x;t[11]!==n||t[12]!==s||t[13]!==y?(b=()=>{!n&&y?.automation&&s?.(y.automation.id)},x=[n,y,s],t[11]=n,t[12]=s,t[13]=y,t[14]=b,t[15]=x):(b=t[14],x=t[15]),(0,Q.useEffect)(b,x);let S=r??p?.conversationId,{mutate:C}=le(),w;t[16]===S?w=t[17]:(w=e=>!!(S&&(e.sessions[S]?.streaming||e.sessions[S]?.sending)),t[16]=S,t[17]=w);let T=J(w),E=(0,Q.useRef)(!1),D,O;t[18]!==C||t[19]!==T?(D=()=>{E.current&&!T&&C(yt),E.current=T},O=[T,C],t[18]=C,t[19]=T,t[20]=D,t[21]=O):(D=t[20],O=t[21]),(0,Q.useEffect)(D,O);let k=a===`zh`,A;t[22]===a?A=t[23]:(A=f(a),t[22]=a,t[23]=A);let j=A,M;if(t[24]!==a||t[25]!==j.automations.status||t[26]!==o||t[27]!==i||t[28]!==k){let e;t[30]!==a||t[31]!==j.automations.status||t[32]!==o||t[33]!==k?(e=e=>({id:`automation-run:${e.id}`,timestamp:e.createdAtMs,content:(0,$.jsxs)(`article`,{className:`mx-auto w-full max-w-[var(--max-width-chat-frame)] space-y-3 py-3`,"aria-label":k?`任务运行结果`:`Task run result`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[new Date(e.createdAtMs).toLocaleString(k?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),` · `,j.automations.status[e.status]]}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>o(e.id),children:k?`查看详情`:`View details`})]}),e.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-danger`,children:tt(e,a)}):e.summary?(0,$.jsx)(z,{content:e.summary}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k?`正在执行,结果会显示在这里。`:`Running. The result will appear here.`}),e.status===`failed`||e.status===`timeout`?(0,$.jsx)(Ve,{automationId:e.automationId,runId:e.id,language:a,variant:`secondary`}):null,[`queued`,`running`,`cancelling`].includes(e.status)?null:(0,$.jsx)($e,{runId:e.id,language:a})]})}),t[30]=a,t[31]=j.automations.status,t[32]=o,t[33]=k,t[34]=e):e=t[34],M=i.map(e),t[24]=a,t[25]=j.automations.status,t[26]=o,t[27]=i,t[28]=k,t[29]=M}else M=t[29];let N=M;if(m){let e=k?`暂时无法打开任务对话。`:`Could not open the task conversation.`,n;t[35]===e?n=t[36]:(n=(0,$.jsx)(`p`,{children:e}),t[35]=e,t[36]=n);let r;t[37]===h?r=t[38]:(r=()=>void h(),t[37]=h,t[38]=r);let i=k?`重试`:`Retry`,a;t[39]!==r||t[40]!==i?(a=(0,$.jsx)(fe,{variant:`secondary`,onClick:r,children:i}),t[39]=r,t[40]=i,t[41]=a):a=t[41];let o;return t[42]!==n||t[43]!==a?(o=(0,$.jsxs)(`div`,{role:`alert`,className:`p-6 text-sm text-fg-muted`,children:[n,a]}),t[42]=n,t[43]=a,t[44]=o):o=t[44],o}let P=k?`任务对话`:`Task conversation`,F;t[45]!==N||t[46]!==S?(F=S?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(G,{className:`m-5 h-40`}),children:(0,$.jsx)(_t,{embedded:!0,conversationId:S,automationWorkspace:!0,automationTimelineEntries:N},S)}):(0,$.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,$.jsx)(G,{className:`h-20 w-2/3`}),(0,$.jsx)(G,{className:`h-28`})]}),t[45]=N,t[46]=S,t[47]=F):F=t[47];let I;return t[48]!==P||t[49]!==F?(I=(0,$.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":P,children:F}),t[48]=P,t[49]=F,t[50]=I):I=t[50],I}function yt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-configuration`].includes(String(e[0]))}var bt=`relative flex min-h-9 cursor-pointer items-center rounded-md py-2 pl-3 pr-8 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,xt=`z-70 max-h-[min(32rem,calc(100dvh-2rem))] min-w-52 overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover`;function St(e){let t=(0,it.c)(4),{value:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(be,{className:`absolute right-2.5`,children:(0,$.jsx)(E,{className:`size-3.5`,"aria-hidden":!0})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,$.jsxs)(_e,{value:n,className:bt,children:[i,r]}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Ct(e){let t=(0,it.c)(131),{language:n,labels:r,filter:i,ownership:a,source:o,projectId:s,projects:c,projectLocked:l,query:u,unreadCount:d,markReadBusy:f,onFilter:p,onOwnership:m,onSource:h,onProject:g,onQuery:_,onClear:v,onMarkAllRead:y}=e,b=n===`zh`,[x,C]=(0,Q.useState)(!1),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=x||!!u,D=i!==`all`||o!==`all`||a!==`user`||!l&&!!s,k;t[0]===_?k=t[1]:(k=()=>{_(``),C(!1),T.current?.focus()},t[0]=_,t[1]=k);let A=k,j=b?`定时任务`:`Scheduled tasks`,M;t[2]===j?M=t[3]:(M=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:j}),t[2]=j,t[3]=M);let N=b?`筛选任务`:`Filter tasks`,P=b?`筛选任务`:`Filter tasks`,F=D&&`text-accent-fg`,I;t[4]===F?I=t[5]:(I=W(`relative rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-surface-hover`,F),t[4]=F,t[5]=I);let z;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(L,{className:`size-4`,"aria-hidden":!0}),t[6]=z):z=t[6];let ee;t[7]!==D||t[8]!==b?(ee=D?(0,$.jsx)(`span`,{className:`absolute right-1.5 top-1.5 size-1 rounded-full bg-accent`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:b?`已应用筛选`:`Filters applied`})}):null,t[7]=D,t[8]=b,t[9]=ee):ee=t[9];let te;t[10]!==N||t[11]!==P||t[12]!==I||t[13]!==ee?(te=(0,$.jsx)(Se,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":N,title:P,className:I,children:[z,ee]})}),t[10]=N,t[11]=P,t[12]=I,t[13]=ee,t[14]=te):te=t[14];let ne=b?`状态`:`Status`,re;t[15]===ne?re=t[16]:(re=(0,$.jsx)(ge,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:ne}),t[15]=ne,t[16]=re);let ie;t[17]===p?ie=t[18]:(ie=e=>p(e),t[17]=p,t[18]=ie);let ae=b?`全部状态`:`All statuses`,B;t[19]===ae?B=t[20]:(B=(0,$.jsx)(St,{value:`all`,children:ae}),t[19]=ae,t[20]=B);let se;t[21]===r.filters.active?se=t[22]:(se=(0,$.jsx)(St,{value:`active`,children:r.filters.active}),t[21]=r.filters.active,t[22]=se);let V;t[23]===r.paused?V=t[24]:(V=(0,$.jsx)(St,{value:`paused`,children:r.paused}),t[23]=r.paused,t[24]=V);let H=b?`已完成`:`Completed`,U;t[25]===H?U=t[26]:(U=(0,$.jsx)(St,{value:`completed`,children:H}),t[25]=H,t[26]=U);let G;t[27]===r.metrics.running?G=t[28]:(G=(0,$.jsx)(St,{value:`running`,children:r.metrics.running}),t[27]=r.metrics.running,t[28]=G);let K;t[29]===r.dashboard.needsAttention?K=t[30]:(K=(0,$.jsx)(St,{value:`attention`,children:r.dashboard.needsAttention}),t[29]=r.dashboard.needsAttention,t[30]=K);let q;t[31]!==i||t[32]!==ie||t[33]!==B||t[34]!==se||t[35]!==V||t[36]!==U||t[37]!==G||t[38]!==K?(q=(0,$.jsxs)(Te,{value:i,onValueChange:ie,children:[B,se,V,U,G,K]}),t[31]=i,t[32]=ie,t[33]=B,t[34]=se,t[35]=V,t[36]=U,t[37]=G,t[38]=K,t[39]=q):q=t[39];let J;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(De,{className:`my-1 border-t border-edge`}),t[40]=J):J=t[40];let le=b?`归属`:`Owner`,Y;t[41]===le?Y=t[42]:(Y=(0,$.jsx)(ge,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:le}),t[41]=le,t[42]=Y);let ue;t[43]===m?ue=t[44]:(ue=e=>m(e),t[43]=m,t[44]=ue);let de=b?`我的任务`:`My tasks`,fe;t[45]===de?fe=t[46]:(fe=(0,$.jsx)(St,{value:`user`,children:de}),t[45]=de,t[46]=fe);let pe=b?`系统任务`:`System tasks`,X;t[47]===pe?X=t[48]:(X=(0,$.jsx)(St,{value:`system`,children:pe}),t[47]=pe,t[48]=X);let me;t[49]!==a||t[50]!==ue||t[51]!==fe||t[52]!==X?(me=(0,$.jsxs)(Te,{value:a,onValueChange:ue,children:[fe,X]}),t[49]=a,t[50]=ue,t[51]=fe,t[52]=X,t[53]=me):me=t[53];let he;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(De,{className:`my-1 border-t border-edge`}),t[54]=he):he=t[54];let _e;t[55]!==r.filters.allProjects||t[56]!==g||t[57]!==s||t[58]!==l||t[59]!==c||t[60]!==b?(_e=l?null:(0,$.jsxs)(ve,{children:[(0,$.jsxs)(Ce,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[b?`项目`:`Project`,(0,$.jsx)(`span`,{className:`ml-auto max-w-28 truncate text-xs text-fg-muted`,children:c.find(e=>e.id===s)?.name??r.filters.allProjects}),(0,$.jsx)(O,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0})]}),(0,$.jsx)(Z,{children:(0,$.jsx)(ye,{sideOffset:4,className:xt,children:(0,$.jsxs)(Te,{value:s,onValueChange:g,children:[(0,$.jsx)(St,{value:``,children:r.filters.allProjects}),c.map(wt)]})})})]}),t[55]=r.filters.allProjects,t[56]=g,t[57]=s,t[58]=l,t[59]=c,t[60]=b,t[61]=_e):_e=t[61];let be=b?`任务类型`:`Task type`,Oe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,$.jsx)(O,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),t[62]=Oe):Oe=t[62];let ke;t[63]===be?ke=t[64]:(ke=(0,$.jsxs)(Ce,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[be,Oe]}),t[63]=be,t[64]=ke);let Ae;t[65]===h?Ae=t[66]:(Ae=e=>h(e),t[65]=h,t[66]=Ae);let je=b?`全部类型`:`All types`,Me;t[67]===je?Me=t[68]:(Me=(0,$.jsx)(St,{value:`all`,children:je}),t[67]=je,t[68]=Me);let Ne;t[69]===r.sources.agent?Ne=t[70]:(Ne=(0,$.jsx)(St,{value:`agent`,children:r.sources.agent}),t[69]=r.sources.agent,t[70]=Ne);let Pe;t[71]===r.sources.task?Pe=t[72]:(Pe=(0,$.jsx)(St,{value:`task_command`,children:r.sources.task}),t[71]=r.sources.task,t[72]=Pe);let Fe;t[73]!==o||t[74]!==Ae||t[75]!==Me||t[76]!==Ne||t[77]!==Pe?(Fe=(0,$.jsx)(Z,{children:(0,$.jsx)(ye,{sideOffset:4,className:xt,children:(0,$.jsxs)(Te,{value:o,onValueChange:Ae,children:[Me,Ne,Pe]})})}),t[73]=o,t[74]=Ae,t[75]=Me,t[76]=Ne,t[77]=Pe,t[78]=Fe):Fe=t[78];let Ie;t[79]!==ke||t[80]!==Fe?(Ie=(0,$.jsxs)(ve,{children:[ke,Fe]}),t[79]=ke,t[80]=Fe,t[81]=Ie):Ie=t[81];let Le;t[82]!==D||t[83]!==v||t[84]!==u||t[85]!==b?(Le=D||u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{className:`my-1 border-t border-edge`}),(0,$.jsx)(we,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover`,onSelect:v,children:b?`重置筛选`:`Reset filters`})]}):null,t[82]=D,t[83]=v,t[84]=u,t[85]=b,t[86]=Le):Le=t[86];let Re;t[87]!==re||t[88]!==q||t[89]!==Y||t[90]!==me||t[91]!==_e||t[92]!==Ie||t[93]!==Le?(Re=(0,$.jsx)(Z,{children:(0,$.jsxs)(Ee,{align:`end`,sideOffset:6,className:xt,children:[re,q,J,Y,me,he,_e,Ie,Le]})}),t[87]=re,t[88]=q,t[89]=Y,t[90]=me,t[91]=_e,t[92]=Ie,t[93]=Le,t[94]=Re):Re=t[94];let ze;t[95]!==te||t[96]!==Re?(ze=(0,$.jsxs)(xe,{children:[te,Re]}),t[95]=te,t[96]=Re,t[97]=ze):ze=t[97];let Be=b?`搜索任务`:`Search tasks`,Ve=b?`搜索任务`:`Search tasks`,He;t[98]!==A||t[99]!==E?(He=()=>{E?A():(C(!0),requestAnimationFrame(()=>w.current?.focus()))},t[98]=A,t[99]=E,t[100]=He):He=t[100];let Ue=E&&`bg-surface-hover text-fg`,We;t[101]===Ue?We=t[102]:(We=W(`rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,Ue),t[101]=Ue,t[102]=We);let Ge;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[103]=Ge):Ge=t[103];let Ke;t[104]!==E||t[105]!==Be||t[106]!==Ve||t[107]!==He||t[108]!==We?(Ke=(0,$.jsx)(`button`,{ref:T,type:`button`,"aria-label":Be,title:Ve,"aria-expanded":E,onClick:He,className:We,children:Ge}),t[104]=E,t[105]=Be,t[106]=Ve,t[107]=He,t[108]=We,t[109]=Ke):Ke=t[109];let qe;t[110]!==ze||t[111]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[ze,Ke]}),t[110]=ze,t[111]=Ke,t[112]=qe):qe=t[112];let Je;t[113]!==M||t[114]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:[M,qe]}),t[113]=M,t[114]=qe,t[115]=Je):Je=t[115];let Ye;t[116]!==r.filters.markAllRead||t[117]!==f||t[118]!==y||t[119]!==d?(Ye=d>0?(0,$.jsxs)(`button`,{type:`button`,disabled:f,onClick:y,className:`flex min-h-9 w-full items-center gap-2 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:pointer-events-none disabled:opacity-50`,"aria-busy":f,children:[f?(0,$.jsx)(R,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(S,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.filters.markAllRead]}):null,t[116]=r.filters.markAllRead,t[117]=f,t[118]=y,t[119]=d,t[120]=Ye):Ye=t[120];let Xe;t[121]!==A||t[122]!==_||t[123]!==u||t[124]!==E||t[125]!==b?(Xe=E?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2.5 focus-within:border-accent`,children:[(0,$.jsx)(oe,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{ref:w,value:u,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),A())},"aria-label":b?`搜索任务名称或内容`:`Search task names or content`,placeholder:b?`搜索任务…`:`Search tasks…`,className:`min-h-10 min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":b?`关闭搜索`:`Close search`,onClick:A,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[121]=A,t[122]=_,t[123]=u,t[124]=E,t[125]=b,t[126]=Xe):Xe=t[126];let Ze;return t[127]!==Je||t[128]!==Ye||t[129]!==Xe?(Ze=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Je,Ye,Xe]}),t[127]=Je,t[128]=Ye,t[129]=Xe,t[130]=Ze):Ze=t[130],Ze}function wt(e){return(0,$.jsx)(St,{value:e.id,children:(0,$.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name})},e.id)}var Tt=[[`☀️`,`晨间简报`,`每天开始工作前,整理今天值得关注的任务与进展。`,`Morning briefing`,`Start each day with your tasks and project updates.`,`每天早上帮我整理当天到期、逾期的任务和项目进展,给出今天的重点。`,`Each morning, summarize my due and overdue tasks and project progress, and suggest priorities.`],[`📝`,`每周工作回顾`,`回顾一周的成果和问题,为下周留出清晰的方向。`,`Weekly review`,`Review the week and find a clear direction for the next.`,`每周五帮我回顾本周完成的任务和项目进展,整理未解决的问题,建议下周的重点。`,`Every Friday, review completed tasks and project progress, unresolved issues, and priorities for next week.`],[`🌱`,`项目进展跟进`,`定期看看项目进度,找出需要你关注的事情。`,`Project check-in`,`Keep an eye on project progress and what needs attention.`,`定期帮我检查项目进度,整理延期、阻塞和需要我决策的事项。先和我确认关注哪个项目以及运行时间。`,`Regularly review a project for delays, blockers, and decisions I need to make. Ask which project and when to run.`],[`🔔`,`重要事项提醒`,`把容易忘记的事情交给提醒,安心专注眼前。`,`A timely reminder`,`Make room to focus by setting a reminder for later.`,`我想安排一个重要事项提醒。请先问我需要提醒什么、什么时候提醒,以及是否重复。`,`Help me schedule a reminder. Ask what to remember, when, and whether it should repeat.`],[`📚`,`笔记整理`,`回看新收集的想法,整理出值得继续推进的线索。`,`Notes roundup`,`Revisit recent ideas and surface useful next steps.`,`每周帮我回顾最近新增的笔记,按主题整理,找出值得继续推进的想法。请先确认时间和范围。`,`Each week, group my recent notes by topic and suggest ideas worth pursuing. Confirm the schedule and scope.`],[`🧭`,`明日工作计划`,`下班前梳理未完成的事,安排明天最重要的三件事。`,`Plan tomorrow`,`Wrap up loose ends and choose tomorrow’s top three priorities.`,`每个工作日下班前,帮我梳理未完成的任务,建议明天最重要的三件事。请先确认具体时间。`,`Before the end of each workday, review unfinished tasks and suggest tomorrow’s top three priorities. Confirm the time.`],[`🗓️`,`月度复盘`,`拉远一点看进展,发现反复出现的问题和新的机会。`,`Monthly reflection`,`Step back to spot progress, recurring problems, and opportunities.`,`每月月底帮我回顾项目和任务的进展,总结成果、反复出现的问题和下个月的重点。请确认运行时间。`,`At the end of each month, review project and task progress, achievements, recurring problems, and priorities. Confirm the schedule.`],[`🎯`,`逾期任务检查`,`定期发现被搁置的事项,让重要的事重新向前。`,`Overdue task check`,`Find neglected tasks and get important work moving again.`,`定期帮我检查逾期任务,按紧迫程度整理,并建议下一步。请先确认运行频率和时间。`,`Regularly review overdue tasks, prioritize them by urgency, and suggest next steps. Confirm the frequency and time.`]];function Et(e=Math.random){let t=[...Tt];for(let n=t.length-1;n>0;n--){let r=Math.min(n,Math.max(0,Math.floor(e()*(n+1))));[t[n],t[r]]=[t[r],t[n]]}return t.slice(0,6)}function Dt({language:e,projectId:t,onOpenConversation:n}){let r=s(),[i,a]=(0,Q.useState)(!1),[o,c]=(0,Q.useState)(``),l=async e=>{a(!0),c(``);try{let i=await Ue({projectId:t,prompt:e});n?n(i):r(i)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}},u=e===`zh`,[d,f]=(0,Q.useState)(Et),p=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-2 py-10 sm:px-6 md:py-20`,children:[(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(x,{className:`mx-auto size-10 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:u?`安排任务`:`Schedule a task`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:u?`说说你希望定期完成什么,我们一起安排好。`:`Tell us what you’d like done regularly. We’ll work out the details together.`})]}),(0,$.jsxs)(`div`,{className:`mb-3 mt-10 flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:u?`也可以从这些想法开始`:`Or start with an idea`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(Et()),className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),u?`换一组`:`More ideas`]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.map(e=>(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void l(u?e[5]:e[6]),className:`flex min-h-28 items-center gap-4 rounded-xl border border-dashed border-edge bg-surface-panel px-5 py-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-2xl`,"aria-hidden":!0,children:e[0]}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:u?e[1]:e[3]}),(0,$.jsx)(`span`,{className:`mt-1 block text-sm leading-5 text-fg-muted`,children:u?e[2]:e[4]})]})]},e[1]))}),(0,$.jsx)(`div`,{className:`mt-6 text-center`,children:(0,$.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void l(),className:`rounded-md px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:u?`说说你想安排的其他任务`:`Describe another task`})}),o?(0,$.jsx)(`p`,{role:`alert`,className:`mt-3 text-center text-sm text-danger`,children:o}):null]});return(0,$.jsx)(`section`,{"aria-label":u?`安排任务`:`Schedule a task`,children:p})}function Ot(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function kt(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function At(e,t={}){let n=Ot(e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page-BjYumhaI.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/locale-store-cg9cm2EL.js","assets/messages-eQ2CYlpG.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/arrow-up-right-T72JbQ1Q.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-BN2HTA9T.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/notes-api-CR75RHd0.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-D1zBWkfB.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/chat-chart-block-NSy-B0NS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/skeleton-DzdOeGYz.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/vendor-swr-CdRzEUwF.js","assets/button-Cc4hUNTt.js","assets/automation-api-mn8ihWJ_.js","assets/earth-C9Z4bTTG.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-CeXl9w6z.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/new-chat-navigation-B6NPQ4h4.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/database-CjjeZfRG.js","assets/ellipsis-0k4rZLoy.js","assets/file-BqMS_3DT.js","assets/file-text-D12HbeVy.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/use-file-preview-expanded-dhNMHf5b.js","assets/eye-CABVeTq0.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/constants-DpkUgykJ.js","assets/session-api-CQlEq0MB.js","assets/gateway-startup-retry-BaaoKBoB.js","assets/attachment-utils-core-BIOUBrpT.js","assets/composer-notifications-B-kL3qAA.js","assets/activity-store-DYwR1u3f.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/workspace-api-B1Uirhxf.js","assets/files-BNL4kkSB.js","assets/index.module-Cd9ENXfk.js","assets/dist-ZrL34Ps4.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/install-connector-dialog-BsiyYQhx.js","assets/secret-input-DsjfQmDn.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CgsSm-Av.js","assets/gateway-config-swr-OGhON-s6.js","assets/oauth-provider-connect-Dk1NeeqD.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-s0FMNhq9.js","assets/registry-api-BTd_OgbD.js","assets/oauth-api-CvPnQTlH.js","assets/connection-usage-guide-CiVpcbds.js","assets/connection-usage-BhdQRWgQ.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/trash-2-DusmjVPV.js","assets/share-link-dialog-ztX1WPXG.js","assets/copy-text-row-CpiRzq4G.js","assets/wrench-DFb4r8bH.js","assets/tasks-BTLabOMp.js","assets/specialists-xbB3xL9e.js","assets/api-DPNeNCmR.js","assets/session-manager-C7RfUfqI.js","assets/local-session-drafts-XurtjR58.js","assets/tool-activity-BtJkgjFf.js","assets/gateway-realtime-B9u4uSXW.js","assets/gateway-realtime-store-xB7Bq4Zs.js","assets/agents-admin-api-CKscfdvA.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-BrK8-SNz.js","assets/model-selector-CL6WT-jw.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/use-composer-attachments-CLIrD0mm.js","assets/chevron-left-DqFhpbvK.js","assets/capabilities-kG175Q-7.js","assets/capabilities-DKbXv8Ck.js","assets/file-preview-surface-z7_HV0WN.js","assets/phone-workspace-store-CC61pIuJ.js","assets/shares-api-CSZqeNL4.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/chat-agents-api-UOdNWZ0_.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-DBE1mvOS.js","assets/workspace-editor-agent-store-Nos5ebMv.js","assets/voice-input-shortcut-events-Cc30ZcFy.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/linkify-it-BkqEorO0.js","assets/tool-friendly-title-CP35P4VA.js","assets/use-realtime-voice-DDVVlX1R.js","assets/voice-CDlC6XMH.js","assets/voice-call-context-BM2A4bLz.js","assets/page-header-store-DU4NnGap.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-CbVokTvd.js","assets/theme-store-GZQ3pTgy.js","assets/extension-message-router-Dn8JzOdR.js","assets/agent-avatar-display-DqFYHXCS.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-DrA5mTQp.js","assets/command-palette-api-Dkn9bbYd.js","assets/skill-list-api-DfUsku-x.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-BY_k6iWp.js","assets/calendar-clock-D-quYVPe.js","assets/message-circle-Badhj-4D.js","assets/date-picker-dx284jQI.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-C1PXAXZF.js","assets/dev-view-store-BOxbj1ie.js","assets/extension-iframe-host-DiIqM2JO.js","assets/extension-authoritative-grants-C0ReZguU.js","assets/runtime-health-zDkHcOZO.js","assets/api-CHM2c_Ah.js","assets/terminal-panel-store-D8eZPvql.js","assets/agents-app-path-ciChvpCS.js","assets/agent-display-names-Bje7vfSn.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-Ckb8baxj.js","assets/management-api-B6jVuJ6W.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>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-Czpn1I53.js";import{m as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as c,i as l,l as u,n as d}from"./locale-store-cg9cm2EL.js";import{t as f}from"./messages-eQ2CYlpG.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-CY7CS_D3.js";import{t as y}from"./activity-YogQEteU.js";import{t as b}from"./arrow-left-D880xG-P.js";import{t as x}from"./calendar-clock-D-quYVPe.js";import{i as S,n as C,r as w,t as T}from"./automation-run-list-BhtaMpTb.js";import{t as E}from"./check-DUBLcKHA.js";import{t as D}from"./chevron-down-ccbiQQz_.js";import{t as O}from"./chevron-right-BweFrslA.js";import{n as k,r as A}from"./popover-select-CLsphyzA.js";import{t as j}from"./circle-alert-BEjgurr2.js";import{t as M}from"./circle-check-C23XjkUj.js";import{t as N}from"./copy-Dv6d4Dvw.js";import{t as P}from"./ellipsis-0k4rZLoy.js";import{t as F}from"./eye-CABVeTq0.js";import{t as I}from"./git-branch-Dh9uxTot.js";import{t as L}from"./list-filter-CIPvpfLA.js";import{t as R}from"./loader-circle-CifKLtgG.js";import{t as z}from"./markdown-view-D1zBWkfB.js";import{t as ee}from"./message-circle-Badhj-4D.js";import{t as te}from"./pause-DuPxgSxk.js";import{t as ne}from"./pencil-DmIY3Oa-.js";import{t as re}from"./play-kxZvpBg8.js";import{t as ie}from"./plus-Q2yW6OE7.js";import{t as ae}from"./refresh-cw-BRlGaq2w.js";import{t as oe}from"./search-DA7gz22f.js";import{t as B}from"./shield-check-BU58siTV.js";import{t as se}from"./sparkles-DHlfQFAF.js";import{t as V}from"./square-pen-B8FsvqNu.js";import{t as H}from"./trash-2-DusmjVPV.js";import{t as ce}from"./x-B_N4OPjy.js";import{t as U}from"./zap-dximCGjy.js";import{t as W}from"./cn-0WouolD0.js";import{t as G}from"./skeleton-DzdOeGYz.js";import{d as K}from"./api-DPNeNCmR.js";import{a as q}from"./session-api-CQlEq0MB.js";import{T as J}from"./session-manager-C7RfUfqI.js";import{a as le,i as Y,o as ue}from"./vendor-swr-CdRzEUwF.js";import{t as de}from"./chat-agents-api-UOdNWZ0_.js";import{t as fe}from"./button-Cc4hUNTt.js";import{t as pe}from"./page-header-store-DU4NnGap.js";import{t as X}from"./automation-api-mn8ihWJ_.js";import{t as me}from"./sliding-tab-list-CmcrqRzN.js";import{t as he}from"./refresh-button-DiWdGAaX.js";import{a as ge,c as _e,d as ve,f as ye,i as be,l as xe,m as Se,o as Z,p as Ce,r as we,s as Te,t as Ee,u as De}from"./dist-ZrL34Ps4.js";import{n as Oe}from"./model-selector-CL6WT-jw.js";import{C as ke,S as Ae,_ as je,a as Me,b as Ne,c as Pe,d as Fe,f as Ie,g as Le,h as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,s as Ge,u as Ke,v as qe,w as Je,x as Ye,y as Xe}from"./automation-task-card-BY_k6iWp.js";import{t as Ze}from"./time-picker-C1PXAXZF.js";import{n as Qe}from"./agent-display-names-Bje7vfSn.js";import{i as $e,n as et,r as tt,t as nt}from"./automation-result-state-COzakzak.js";import{t as rt}from"./date-time-picker-Dj-bhLNP.js";var it=n(),Q=e(t(),1),$=r(),at=(0,Q.lazy)(()=>i(()=>import(`./chat-page-BjYumhaI.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201])));function ot(e){let t=(0,it.c)(110),{runId:n,automationId:r,projectId:i,language:a,onConfigure:o,onDetails:s,onBack:c}=e,l=a===`zh`,[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>g(e),t[0]=_):_=t[0];let v=_,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(!0),t[1]=y):y=t[1];let x=y,{mutate:S}=le(),w=(0,Q.useRef)(!1),T=i??``,E;t[2]!==r||t[3]!==n||t[4]!==T?(E=[`automation-execution`,r,n,T],t[2]=r,t[3]=n,t[4]=T,t[5]=E):E=t[5];let D;t[6]!==r||t[7]!==i||t[8]!==n||t[9]!==l?(D=async()=>{let{run:e}=await X.getRun(n);if(e.automationId!==r)throw Error(l?`执行记录不属于此自动化`:`Execution does not belong to this automation`);let{automation:t}=await X.get(r);if(i&&t.projectId!==i)throw Error(l?`执行记录不属于此项目`:`Execution does not belong to this project`);return{run:e,automation:t}},t[6]=r,t[7]=i,t[8]=n,t[9]=l,t[10]=D):D=t[10];let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O={refreshInterval:lt,shouldRetryOnError:!1},t[11]=O):O=t[11];let{data:k,error:A,mutate:j}=Y(E,D,O),M=k?.run,N=M?.conversationId,P;t[12]===N?P=t[13]:(P=e=>!!(N&&(e.sessions[N]?.streaming||e.sessions[N]?.sending)),t[12]=N,t[13]=P);let F=J(P),I;t[14]===N?I=t[15]:(I=N?[`automation-execution-session`,N]:null,t[14]=N,t[15]=I);let L;t[16]===N?L=t[17]:(L=()=>q(N),t[16]=N,t[17]=L);let R;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(R={shouldRetryOnError:!1},t[18]=R):R=t[18];let{data:ee,error:te,mutate:ne}=Y(I,L,R),re=M?.conversationShared||k?.automation.conversationMode===`continuous`||ee?.customData?.latestAutomationRunId!==void 0&&ee.customData.latestAutomationRunId!==n,ie=!!(ee&&(!re||u)),ae=!A&&!!(M&&(!N||re&&!u&&ee&&!te&&(M?.summary||M?.error)||ee&&!te&&p)),oe,B;if(t[19]!==ae||t[20]!==j||t[21]!==S||t[22]!==M?(oe=()=>{!M||!ae||C(M)||M.readAtMs!=null||w.current||(w.current=!0,X.markRunRead(M.id).then(async()=>{await Promise.all([j(),S(ct)])}).catch(st).finally(()=>{w.current=!1}))},B=[M,ae,j,S],t[19]=ae,t[20]=j,t[21]=S,t[22]=M,t[23]=oe,t[24]=B):(oe=t[23],B=t[24]),(0,Q.useEffect)(oe,B),A){let e=A instanceof Error?A.message:l?`执行记录加载失败`:`Could not load execution`,n;t[25]===e?n=t[26]:(n=(0,$.jsx)(`p`,{children:e}),t[25]=e,t[26]=n);let r;t[27]===j?r=t[28]:(r=()=>void j(),t[27]=j,t[28]=r);let i=l?`重试`:`Retry`,a;t[29]!==r||t[30]!==i?(a=(0,$.jsx)(fe,{onClick:r,children:i}),t[29]=r,t[30]=i,t[31]=a):a=t[31];let o=l?`返回自动化`:`Back to automation`,s;t[32]!==c||t[33]!==o?(s=(0,$.jsx)(fe,{onClick:c,children:o}),t[32]=c,t[33]=o,t[34]=s):s=t[34];let u;return t[35]!==n||t[36]!==a||t[37]!==s?(u=(0,$.jsxs)(`section`,{role:`alert`,className:`space-y-3 p-5`,children:[n,a,s]}),t[35]=n,t[36]=a,t[37]=s,t[38]=u):u=t[38],u}if(!M){let e;return t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-4 p-5`,"aria-busy":`true`,children:[(0,$.jsx)(G,{className:`h-6 w-2/3`}),(0,$.jsx)(G,{className:`h-20`})]}),t[39]=e):e=t[39],e}let se;t[40]===M?se=t[41]:(se=C(M),t[40]=M,t[41]=se);let V=se,H=l?`执行会话`:`Execution conversation`,ce=l?`返回自动化`:`Back to automation`,U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(b,{className:`size-4`}),t[42]=U):U=t[42];let W;t[43]!==c||t[44]!==ce?(W=(0,$.jsx)(fe,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":ce,children:U}),t[43]=c,t[44]=ce,t[45]=W):W=t[45];let K;t[46]===M.automationName?K=t[47]:(K=(0,$.jsx)(`h2`,{className:`truncate text-sm font-medium text-fg`,children:M.automationName}),t[46]=M.automationName,t[47]=K);let ue;t[48]!==W||t[49]!==K?(ue=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[W,K]}),t[48]=W,t[49]=K,t[50]=ue):ue=t[50];let de;t[51]!==M.createdAtMs||t[52]!==l?(de=new Date(M.createdAtMs).toLocaleString(l?`zh-CN`:`en-US`),t[51]=M.createdAtMs,t[52]=l,t[53]=de):de=t[53];let pe;t[54]===a?pe=t[55]:(pe=f(a),t[54]=a,t[55]=pe);let me=pe.automations.status[M.status],he;t[56]!==de||t[57]!==me?(he=(0,$.jsxs)(`span`,{children:[de,` · `,me]}),t[56]=de,t[57]=me,t[58]=he):he=t[58];let ge;t[59]!==s||t[60]!==M.id?(ge=()=>s(M.id),t[59]=s,t[60]=M.id,t[61]=ge):ge=t[61];let _e=l?`运行详情`:`Run details`,ve;t[62]!==ge||t[63]!==_e?(ve=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:ge,children:_e}),t[62]=ge,t[63]=_e,t[64]=ve):ve=t[64];let ye;t[65]!==o||t[66]!==M?(ye=()=>o(M),t[65]=o,t[66]=M,t[67]=ye):ye=t[67];let be=l?`调整自动化`:`Adjust automation`,xe;t[68]!==ye||t[69]!==be?(xe=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:ye,children:be}),t[68]=ye,t[69]=be,t[70]=xe):xe=t[70];let Se;t[71]!==he||t[72]!==ve||t[73]!==xe?(Se=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[he,ve,xe]}),t[71]=he,t[72]=ve,t[73]=xe,t[74]=Se):Se=t[74];let Z;t[75]!==k?.automation||t[76]!==re||t[77]!==l?(Z=re?(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[l?`多次执行可能共用此会话;下方摘要对应所选执行。`:`Executions may share this conversation. The summary belongs to the selected execution.`,k?.automation.conversationMode===`continuous`?l?`追问会进入后续运行上下文。`:` Follow-ups become context for future runs.`:null]}):null,t[75]=k?.automation,t[76]=re,t[77]=l,t[78]=Z):Z=t[78];let Ce;t[79]!==h||t[80]!==u||t[81]!==l?(Ce=u?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:h===!0?l?`已定位到所选执行的会话起点。`:`Located the selected execution in this conversation.`:h===!1?l?`旧记录缺少可用的执行定位信息,当前显示完整会话。`:`No matching turn was found in the available history. Showing the full conversation.`:l?`正在定位所选执行…`:`Locating the selected execution…`}):null,t[79]=h,t[80]=u,t[81]=l,t[82]=Ce):Ce=t[82];let we;t[83]!==V||t[84]!==l?(we=V?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:l?`执行中,完成后可继续追问。`:`Execution in progress. Follow up after it finishes.`}):null,t[83]=V,t[84]=l,t[85]=we):we=t[85];let Te;t[86]!==ue||t[87]!==Se||t[88]!==Z||t[89]!==Ce||t[90]!==we?(Te=(0,$.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge px-4 py-3`,children:[ue,Se,Z,Ce,we]}),t[86]=ue,t[87]=Se,t[88]=Z,t[89]=Ce,t[90]=we,t[91]=Te):Te=t[91];let Ee;t[92]!==V||t[93]!==N||t[94]!==F||t[95]!==ee||t[96]!==a||t[97]!==ne||t[98]!==M.error||t[99]!==M.id||t[100]!==M.summary||t[101]!==te||t[102]!==re||t[103]!==ie||t[104]!==l?(Ee=ie?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(G,{className:`m-5 h-40`}),children:(0,$.jsx)(at,{embedded:!0,automationExecution:!0,conversationId:N,readOnly:V||F,onHistoryReady:x,initialTurnId:re?M.id:void 0,onInitialTurnLocated:v},N)}):(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[M.summary?(0,$.jsx)(z,{content:M.summary}):null,M.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-danger`,children:M.error}):null,N?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:V?l?`等待执行会话,开始后会自动更新。`:`Waiting for the execution conversation. This view updates automatically.`:l?`本次执行没有关联会话,可查看运行结果和详情。`:`No conversation is associated with this execution. Results and diagnostics remain available.`}),N&&!ee&&!te?(0,$.jsx)(G,{className:`h-24`}):null,te?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:te.status===404?l?`执行会话已删除,运行结果仍保留。`:`The execution conversation was deleted. Results are still available.`:l?`执行会话暂时无法读取,运行结果仍保留。`:`The conversation is unavailable. Results are still available.`}),(0,$.jsx)(fe,{onClick:()=>void ne(),children:l?`重试`:`Retry`})]}):null,re&&ee?(0,$.jsx)(fe,{variant:`secondary`,onClick:()=>d(!0),children:l?`打开共享会话`:`Open shared conversation`}):null,V?null:(0,$.jsx)($e,{runId:M.id,language:a})]}),t[92]=V,t[93]=N,t[94]=F,t[95]=ee,t[96]=a,t[97]=ne,t[98]=M.error,t[99]=M.id,t[100]=M.summary,t[101]=te,t[102]=re,t[103]=ie,t[104]=l,t[105]=Ee):Ee=t[105];let De;return t[106]!==H||t[107]!==Te||t[108]!==Ee?(De=(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":H,children:[Te,Ee]}),t[106]=H,t[107]=Te,t[108]=Ee,t[109]=De):De=t[109],De}function st(){}function ct(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-navigation-runs`].includes(String(e[0]))||e===`automations-global-system-source`}function lt(e){return e&&C(e.run)?3e3:15e3}function ut(e){let t=(0,it.c)(44),{automation:n,language:r,busy:i,onEdit:a,onAction:o}=e,s=r===`zh`,c=n.management,l=s?`${n.name}的更多操作`:`More actions for ${n.name}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(P,{className:`size-4`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,$.jsx)(Se,{asChild:!0,children:(0,$.jsx)(fe,{variant:`ghost`,className:`size-8 p-0`,"aria-label":l,children:u})}),t[1]=l,t[2]=d);let f;t[3]!==n||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==s?(f=(!c||c.editable.includes(`enabled`))&&!ke(n)?(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:toggle`,()=>n.enabled?X.pause(n.id):X.resume(n.id)),children:[n.enabled?(0,$.jsx)(te,{className:`size-4`}):(0,$.jsx)(re,{className:`size-4`}),n.enabled?s?`暂停`:`Pause`:s?`恢复`:`Resume`]}):null,t[3]=n,t[4]=i,t[5]=c,t[6]=o,t[7]=s,t[8]=f):f=t[8];let p;t[9]!==n.id||t[10]!==i||t[11]!==c||t[12]!==o||t[13]!==s?(p=!c||c.runnable?(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:run`,()=>X.runNow(n.id)),children:[(0,$.jsx)(re,{className:`size-4`}),s?`立即运行`:`Run now`]}):null,t[9]=n.id,t[10]=i,t[11]=c,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==i||t[17]!==c||t[18]!==a||t[19]!==s?(m=!c||c.editable.includes(`trigger`)?(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>a(n),children:[(0,$.jsx)(ne,{className:`size-4`}),s?`编辑`:`Edit`]}):null,t[15]=n,t[16]=i,t[17]=c,t[18]=a,t[19]=s,t[20]=m):m=t[20];let h;t[21]!==n.id||t[22]!==o||t[23]!==s?(h=()=>void o(`automation:${n.id}:copy-link`,()=>navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}#/automations?automation=${encodeURIComponent(n.id)}`),s?`任务链接已复制`:`Task link copied`),t[21]=n.id,t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(N,{className:`size-4`}),t[25]=g):g=t[25];let _=s?`复制任务链接`:`Copy task link`,v;t[26]!==h||t[27]!==_?(v=(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:h,children:[g,_]}),t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.id||t[30]!==i||t[31]!==c||t[32]!==o||t[33]!==s?(y=!c||c.deletable?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(we,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50 text-danger`,disabled:i,onSelect:()=>{window.confirm(s?`删除这个定时任务?已保存的对话仍可查看。`:`Delete this scheduled task? Saved conversations will remain available.`)&&o(`automation:${n.id}:delete`,()=>X.remove(n.id))},children:[(0,$.jsx)(H,{className:`size-4`}),s?`删除`:`Delete`]})]}):null,t[29]=n.id,t[30]=i,t[31]=c,t[32]=o,t[33]=s,t[34]=y):y=t[34];let b;t[35]!==v||t[36]!==y||t[37]!==f||t[38]!==p||t[39]!==m?(b=(0,$.jsx)(Z,{children:(0,$.jsxs)(Ee,{align:`end`,sideOffset:4,className:`z-70 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[f,p,m,v,y]})}),t[35]=v,t[36]=y,t[37]=f,t[38]=p,t[39]=m,t[40]=b):b=t[40];let x;return t[41]!==b||t[42]!==d?(x=(0,$.jsxs)(xe,{children:[d,b]}),t[41]=b,t[42]=d,t[43]=x):x=t[43],x}function dt({automations:e,runs:t,labels:n,cronLabels:r,language:i,selectedAutomationId:a,selectedRunId:o,selectedRun:s,projectId:c,executionSummaries:l,onSelectRun:d,onOpenDetails:f,busy:p,onEdit:m,onAction:h}){let g=`xopc.automation-navigation:${u(e=>e.baseUrl)}:${u(e=>e.conversationId)??`local`}`,[_,v]=(0,Q.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}});(0,Q.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);v(e&&typeof e==`object`&&!Array.isArray(e)?e:{})}catch{v({})}},[g]);let y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!a||y.current===a||(y.current=a,v(e=>({...e,[a]:!0})))},[a]);let b=e=>v(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(g,JSON.stringify(n))}catch{}return n});return e.length===0?(0,$.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:n.empty.filtered}):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:e.map(e=>{let u=t.filter(t=>t.automationId===e.id).sort((e,t)=>t.createdAtMs-e.createdAtMs),g=u.find(C);return(0,$.jsxs)(`div`,{className:`group relative`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!!_[e.id],"aria-controls":`automation-runs-${e.id}`,"aria-label":i===`zh`?`${_[e.id]?`收起`:`展开`} ${e.name} 的执行记录`:`${_[e.id]?`Collapse`:`Expand`} executions for ${e.name}`,className:`absolute left-1 top-2 z-10 rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(e.id),children:_[e.id]?(0,$.jsx)(D,{className:`size-4`}):(0,$.jsx)(O,{className:`size-4`})}),(0,$.jsxs)(`button`,{type:`button`,className:W(`block w-full p-3 pl-9 pr-10 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,a===e.id&&!o&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 76px`},"aria-current":a===e.id&&!o?`true`:void 0,onClick:()=>f(e.id),children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:W(`size-2 shrink-0 rounded-full`,g?`bg-blue-500`:et(e,u)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:ke(e)?i===`zh`?`已完成`:`Completed`:e.enabled?n.enabled:n.paused}),(l?.[e.id]?.unreadCount??0)>0?(0,$.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:n.filters.unread})}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate pl-4 text-xs leading-5 text-fg-muted`,children:[e.enabled?(0,$.jsxs)($.Fragment,{children:[Le(e,n,i),(0,$.jsx)(`span`,{className:`mx-1.5`,children:`·`})]}):null,je(e.trigger,n,r,i)]}),et(e,u)?(0,$.jsx)(`p`,{className:`mt-1 pl-4 text-xs text-red-700 dark:text-red-300`,children:n.dashboard.needsAttention}):null]}),(0,$.jsx)(`div`,{id:`automation-runs-${e.id}`,hidden:!_[e.id],children:(0,$.jsx)(T,{automationId:e.id,projectId:c,language:i,selectedRunId:o,selectedRun:s,enabled:!!_[e.id],onSelectRun:d})}),(0,$.jsx)(`div`,{className:`absolute right-1 top-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,$.jsx)(ut,{automation:e,language:i,busy:p,onEdit:m,onAction:h})})]},e.id)})})}var ft=`xopc.automations.listWidth`,pt=272,mt=200,ht=560;function gt({children:e,language:t,busy:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(()=>{try{let e=Number(window.localStorage.getItem(ft));if(Number.isFinite(e)&&e>=mt&&e<=ht)return e}catch{}return pt});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(ft,String(s))}catch{}},[s]),(0,Q.useEffect)(()=>{if(!a)return;let{cursor:e,userSelect:t}=document.body.style;return document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,()=>{document.body.style.cursor=e,document.body.style.userSelect=t}},[a]);let l=e=>{let t=r.current?.getBoundingClientRect().width??1e3,n=Math.max(mt,Math.min(ht,t*.6,t-292));return Math.round(Math.max(mt,Math.min(n,e)))},u=t===`zh`?`调整任务列表宽度`:`Resize task list`;return(0,$.jsxs)(`section`,{ref:r,"aria-busy":n,className:`grid min-h-0 min-w-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-y-3 md:grid-cols-[minmax(0,min(var(--automation-list-width),60%))_0.75rem_minmax(0,1fr)] md:grid-rows-1 md:gap-y-0`,style:{"--automation-list-width":`${s}px`},children:[e[0],(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-valuemin":mt,"aria-valuemax":ht,"aria-valuenow":s,tabIndex:0,title:t===`zh`?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,className:`relative hidden touch-none select-none cursor-col-resize focus-visible:outline-accent md:block`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e.currentTarget.previousElementSibling?.getBoundingClientRect().width??s;i.current={pointerId:e.pointerId,startX:e.clientX,startWidth:t},o(!0)},onPointerMove:e=>{let t=i.current;t?.pointerId===e.pointerId&&c(l(t.startWidth+e.clientX-t.startX))},onPointerUp:e=>{i.current?.pointerId===e.pointerId&&(i.current=null,o(!1),e.currentTarget.releasePointerCapture(e.pointerId))},onPointerCancel:()=>{i.current=null,o(!1)},onLostPointerCapture:()=>{i.current=null,o(!1)},onDoubleClick:()=>c(pt),onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(l(e.key===`Home`?mt:e.key===`End`?ht:s+(e.key===`ArrowLeft`?-16:16))))}}),e[1]]})}var _t=(0,Q.lazy)(()=>i(()=>import(`./chat-page-BjYumhaI.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201])));function vt(e){let t=(0,it.c)(51),{automation:n,conversationId:r,runs:i,language:a,onSelectRun:o,onConfigured:s}=e,c=n?.id,l;t[0]!==c||t[1]!==r?(l=c&&!r?[`automation-workspace-chat`,c]:null,t[0]=c,t[1]=r,t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=()=>X.openConfiguration({automationId:c}),t[3]=c,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1},t[5]=d):d=t[5];let{data:p,error:m,mutate:h}=Y(l,u,d),g;t[6]===r?g=t[7]:(g=r?[`automation-configuration`,r]:null,t[6]=r,t[7]=g);let _;t[8]===r?_=t[9]:(_=()=>X.configuration(r),t[8]=r,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={refreshInterval:3e3},t[10]=v):v=t[10];let{data:y}=Y(g,_,v),b,x;t[11]!==n||t[12]!==s||t[13]!==y?(b=()=>{!n&&y?.automation&&s?.(y.automation.id)},x=[n,y,s],t[11]=n,t[12]=s,t[13]=y,t[14]=b,t[15]=x):(b=t[14],x=t[15]),(0,Q.useEffect)(b,x);let S=r??p?.conversationId,{mutate:C}=le(),w;t[16]===S?w=t[17]:(w=e=>!!(S&&(e.sessions[S]?.streaming||e.sessions[S]?.sending)),t[16]=S,t[17]=w);let T=J(w),E=(0,Q.useRef)(!1),D,O;t[18]!==C||t[19]!==T?(D=()=>{E.current&&!T&&C(yt),E.current=T},O=[T,C],t[18]=C,t[19]=T,t[20]=D,t[21]=O):(D=t[20],O=t[21]),(0,Q.useEffect)(D,O);let k=a===`zh`,A;t[22]===a?A=t[23]:(A=f(a),t[22]=a,t[23]=A);let j=A,M;if(t[24]!==a||t[25]!==j.automations.status||t[26]!==o||t[27]!==i||t[28]!==k){let e;t[30]!==a||t[31]!==j.automations.status||t[32]!==o||t[33]!==k?(e=e=>({id:`automation-run:${e.id}`,timestamp:e.createdAtMs,content:(0,$.jsxs)(`article`,{className:`mx-auto w-full max-w-[var(--max-width-chat-frame)] space-y-3 py-3`,"aria-label":k?`任务运行结果`:`Task run result`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[new Date(e.createdAtMs).toLocaleString(k?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),` · `,j.automations.status[e.status]]}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>o(e.id),children:k?`查看详情`:`View details`})]}),e.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-danger`,children:tt(e,a)}):e.summary?(0,$.jsx)(z,{content:e.summary}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k?`正在执行,结果会显示在这里。`:`Running. The result will appear here.`}),e.status===`failed`||e.status===`timeout`?(0,$.jsx)(Ve,{automationId:e.automationId,runId:e.id,language:a,variant:`secondary`}):null,[`queued`,`running`,`cancelling`].includes(e.status)?null:(0,$.jsx)($e,{runId:e.id,language:a})]})}),t[30]=a,t[31]=j.automations.status,t[32]=o,t[33]=k,t[34]=e):e=t[34],M=i.map(e),t[24]=a,t[25]=j.automations.status,t[26]=o,t[27]=i,t[28]=k,t[29]=M}else M=t[29];let N=M;if(m){let e=k?`暂时无法打开任务对话。`:`Could not open the task conversation.`,n;t[35]===e?n=t[36]:(n=(0,$.jsx)(`p`,{children:e}),t[35]=e,t[36]=n);let r;t[37]===h?r=t[38]:(r=()=>void h(),t[37]=h,t[38]=r);let i=k?`重试`:`Retry`,a;t[39]!==r||t[40]!==i?(a=(0,$.jsx)(fe,{variant:`secondary`,onClick:r,children:i}),t[39]=r,t[40]=i,t[41]=a):a=t[41];let o;return t[42]!==n||t[43]!==a?(o=(0,$.jsxs)(`div`,{role:`alert`,className:`p-6 text-sm text-fg-muted`,children:[n,a]}),t[42]=n,t[43]=a,t[44]=o):o=t[44],o}let P=k?`任务对话`:`Task conversation`,F;t[45]!==N||t[46]!==S?(F=S?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(G,{className:`m-5 h-40`}),children:(0,$.jsx)(_t,{embedded:!0,conversationId:S,automationWorkspace:!0,automationTimelineEntries:N},S)}):(0,$.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,$.jsx)(G,{className:`h-20 w-2/3`}),(0,$.jsx)(G,{className:`h-28`})]}),t[45]=N,t[46]=S,t[47]=F):F=t[47];let I;return t[48]!==P||t[49]!==F?(I=(0,$.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":P,children:F}),t[48]=P,t[49]=F,t[50]=I):I=t[50],I}function yt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-configuration`].includes(String(e[0]))}var bt=`relative flex min-h-9 cursor-pointer items-center rounded-md py-2 pl-3 pr-8 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,xt=`z-70 max-h-[min(32rem,calc(100dvh-2rem))] min-w-52 overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover`;function St(e){let t=(0,it.c)(4),{value:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(be,{className:`absolute right-2.5`,children:(0,$.jsx)(E,{className:`size-3.5`,"aria-hidden":!0})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,$.jsxs)(_e,{value:n,className:bt,children:[i,r]}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Ct(e){let t=(0,it.c)(131),{language:n,labels:r,filter:i,ownership:a,source:o,projectId:s,projects:c,projectLocked:l,query:u,unreadCount:d,markReadBusy:f,onFilter:p,onOwnership:m,onSource:h,onProject:g,onQuery:_,onClear:v,onMarkAllRead:y}=e,b=n===`zh`,[x,C]=(0,Q.useState)(!1),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=x||!!u,D=i!==`all`||o!==`all`||a!==`user`||!l&&!!s,k;t[0]===_?k=t[1]:(k=()=>{_(``),C(!1),T.current?.focus()},t[0]=_,t[1]=k);let A=k,j=b?`定时任务`:`Scheduled tasks`,M;t[2]===j?M=t[3]:(M=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:j}),t[2]=j,t[3]=M);let N=b?`筛选任务`:`Filter tasks`,P=b?`筛选任务`:`Filter tasks`,F=D&&`text-accent-fg`,I;t[4]===F?I=t[5]:(I=W(`relative rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-surface-hover`,F),t[4]=F,t[5]=I);let z;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(L,{className:`size-4`,"aria-hidden":!0}),t[6]=z):z=t[6];let ee;t[7]!==D||t[8]!==b?(ee=D?(0,$.jsx)(`span`,{className:`absolute right-1.5 top-1.5 size-1 rounded-full bg-accent`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:b?`已应用筛选`:`Filters applied`})}):null,t[7]=D,t[8]=b,t[9]=ee):ee=t[9];let te;t[10]!==N||t[11]!==P||t[12]!==I||t[13]!==ee?(te=(0,$.jsx)(Se,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":N,title:P,className:I,children:[z,ee]})}),t[10]=N,t[11]=P,t[12]=I,t[13]=ee,t[14]=te):te=t[14];let ne=b?`状态`:`Status`,re;t[15]===ne?re=t[16]:(re=(0,$.jsx)(ge,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:ne}),t[15]=ne,t[16]=re);let ie;t[17]===p?ie=t[18]:(ie=e=>p(e),t[17]=p,t[18]=ie);let ae=b?`全部状态`:`All statuses`,B;t[19]===ae?B=t[20]:(B=(0,$.jsx)(St,{value:`all`,children:ae}),t[19]=ae,t[20]=B);let se;t[21]===r.filters.active?se=t[22]:(se=(0,$.jsx)(St,{value:`active`,children:r.filters.active}),t[21]=r.filters.active,t[22]=se);let V;t[23]===r.paused?V=t[24]:(V=(0,$.jsx)(St,{value:`paused`,children:r.paused}),t[23]=r.paused,t[24]=V);let H=b?`已完成`:`Completed`,U;t[25]===H?U=t[26]:(U=(0,$.jsx)(St,{value:`completed`,children:H}),t[25]=H,t[26]=U);let G;t[27]===r.metrics.running?G=t[28]:(G=(0,$.jsx)(St,{value:`running`,children:r.metrics.running}),t[27]=r.metrics.running,t[28]=G);let K;t[29]===r.dashboard.needsAttention?K=t[30]:(K=(0,$.jsx)(St,{value:`attention`,children:r.dashboard.needsAttention}),t[29]=r.dashboard.needsAttention,t[30]=K);let q;t[31]!==i||t[32]!==ie||t[33]!==B||t[34]!==se||t[35]!==V||t[36]!==U||t[37]!==G||t[38]!==K?(q=(0,$.jsxs)(Te,{value:i,onValueChange:ie,children:[B,se,V,U,G,K]}),t[31]=i,t[32]=ie,t[33]=B,t[34]=se,t[35]=V,t[36]=U,t[37]=G,t[38]=K,t[39]=q):q=t[39];let J;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(De,{className:`my-1 border-t border-edge`}),t[40]=J):J=t[40];let le=b?`归属`:`Owner`,Y;t[41]===le?Y=t[42]:(Y=(0,$.jsx)(ge,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:le}),t[41]=le,t[42]=Y);let ue;t[43]===m?ue=t[44]:(ue=e=>m(e),t[43]=m,t[44]=ue);let de=b?`我的任务`:`My tasks`,fe;t[45]===de?fe=t[46]:(fe=(0,$.jsx)(St,{value:`user`,children:de}),t[45]=de,t[46]=fe);let pe=b?`系统任务`:`System tasks`,X;t[47]===pe?X=t[48]:(X=(0,$.jsx)(St,{value:`system`,children:pe}),t[47]=pe,t[48]=X);let me;t[49]!==a||t[50]!==ue||t[51]!==fe||t[52]!==X?(me=(0,$.jsxs)(Te,{value:a,onValueChange:ue,children:[fe,X]}),t[49]=a,t[50]=ue,t[51]=fe,t[52]=X,t[53]=me):me=t[53];let he;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(De,{className:`my-1 border-t border-edge`}),t[54]=he):he=t[54];let _e;t[55]!==r.filters.allProjects||t[56]!==g||t[57]!==s||t[58]!==l||t[59]!==c||t[60]!==b?(_e=l?null:(0,$.jsxs)(ve,{children:[(0,$.jsxs)(Ce,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[b?`项目`:`Project`,(0,$.jsx)(`span`,{className:`ml-auto max-w-28 truncate text-xs text-fg-muted`,children:c.find(e=>e.id===s)?.name??r.filters.allProjects}),(0,$.jsx)(O,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0})]}),(0,$.jsx)(Z,{children:(0,$.jsx)(ye,{sideOffset:4,className:xt,children:(0,$.jsxs)(Te,{value:s,onValueChange:g,children:[(0,$.jsx)(St,{value:``,children:r.filters.allProjects}),c.map(wt)]})})})]}),t[55]=r.filters.allProjects,t[56]=g,t[57]=s,t[58]=l,t[59]=c,t[60]=b,t[61]=_e):_e=t[61];let be=b?`任务类型`:`Task type`,Oe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,$.jsx)(O,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),t[62]=Oe):Oe=t[62];let ke;t[63]===be?ke=t[64]:(ke=(0,$.jsxs)(Ce,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[be,Oe]}),t[63]=be,t[64]=ke);let Ae;t[65]===h?Ae=t[66]:(Ae=e=>h(e),t[65]=h,t[66]=Ae);let je=b?`全部类型`:`All types`,Me;t[67]===je?Me=t[68]:(Me=(0,$.jsx)(St,{value:`all`,children:je}),t[67]=je,t[68]=Me);let Ne;t[69]===r.sources.agent?Ne=t[70]:(Ne=(0,$.jsx)(St,{value:`agent`,children:r.sources.agent}),t[69]=r.sources.agent,t[70]=Ne);let Pe;t[71]===r.sources.task?Pe=t[72]:(Pe=(0,$.jsx)(St,{value:`task_command`,children:r.sources.task}),t[71]=r.sources.task,t[72]=Pe);let Fe;t[73]!==o||t[74]!==Ae||t[75]!==Me||t[76]!==Ne||t[77]!==Pe?(Fe=(0,$.jsx)(Z,{children:(0,$.jsx)(ye,{sideOffset:4,className:xt,children:(0,$.jsxs)(Te,{value:o,onValueChange:Ae,children:[Me,Ne,Pe]})})}),t[73]=o,t[74]=Ae,t[75]=Me,t[76]=Ne,t[77]=Pe,t[78]=Fe):Fe=t[78];let Ie;t[79]!==ke||t[80]!==Fe?(Ie=(0,$.jsxs)(ve,{children:[ke,Fe]}),t[79]=ke,t[80]=Fe,t[81]=Ie):Ie=t[81];let Le;t[82]!==D||t[83]!==v||t[84]!==u||t[85]!==b?(Le=D||u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{className:`my-1 border-t border-edge`}),(0,$.jsx)(we,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover`,onSelect:v,children:b?`重置筛选`:`Reset filters`})]}):null,t[82]=D,t[83]=v,t[84]=u,t[85]=b,t[86]=Le):Le=t[86];let Re;t[87]!==re||t[88]!==q||t[89]!==Y||t[90]!==me||t[91]!==_e||t[92]!==Ie||t[93]!==Le?(Re=(0,$.jsx)(Z,{children:(0,$.jsxs)(Ee,{align:`end`,sideOffset:6,className:xt,children:[re,q,J,Y,me,he,_e,Ie,Le]})}),t[87]=re,t[88]=q,t[89]=Y,t[90]=me,t[91]=_e,t[92]=Ie,t[93]=Le,t[94]=Re):Re=t[94];let ze;t[95]!==te||t[96]!==Re?(ze=(0,$.jsxs)(xe,{children:[te,Re]}),t[95]=te,t[96]=Re,t[97]=ze):ze=t[97];let Be=b?`搜索任务`:`Search tasks`,Ve=b?`搜索任务`:`Search tasks`,He;t[98]!==A||t[99]!==E?(He=()=>{E?A():(C(!0),requestAnimationFrame(()=>w.current?.focus()))},t[98]=A,t[99]=E,t[100]=He):He=t[100];let Ue=E&&`bg-surface-hover text-fg`,We;t[101]===Ue?We=t[102]:(We=W(`rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,Ue),t[101]=Ue,t[102]=We);let Ge;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[103]=Ge):Ge=t[103];let Ke;t[104]!==E||t[105]!==Be||t[106]!==Ve||t[107]!==He||t[108]!==We?(Ke=(0,$.jsx)(`button`,{ref:T,type:`button`,"aria-label":Be,title:Ve,"aria-expanded":E,onClick:He,className:We,children:Ge}),t[104]=E,t[105]=Be,t[106]=Ve,t[107]=He,t[108]=We,t[109]=Ke):Ke=t[109];let qe;t[110]!==ze||t[111]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[ze,Ke]}),t[110]=ze,t[111]=Ke,t[112]=qe):qe=t[112];let Je;t[113]!==M||t[114]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:[M,qe]}),t[113]=M,t[114]=qe,t[115]=Je):Je=t[115];let Ye;t[116]!==r.filters.markAllRead||t[117]!==f||t[118]!==y||t[119]!==d?(Ye=d>0?(0,$.jsxs)(`button`,{type:`button`,disabled:f,onClick:y,className:`flex min-h-9 w-full items-center gap-2 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:pointer-events-none disabled:opacity-50`,"aria-busy":f,children:[f?(0,$.jsx)(R,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(S,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.filters.markAllRead]}):null,t[116]=r.filters.markAllRead,t[117]=f,t[118]=y,t[119]=d,t[120]=Ye):Ye=t[120];let Xe;t[121]!==A||t[122]!==_||t[123]!==u||t[124]!==E||t[125]!==b?(Xe=E?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2.5 focus-within:border-accent`,children:[(0,$.jsx)(oe,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{ref:w,value:u,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),A())},"aria-label":b?`搜索任务名称或内容`:`Search task names or content`,placeholder:b?`搜索任务…`:`Search tasks…`,className:`min-h-10 min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":b?`关闭搜索`:`Close search`,onClick:A,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[121]=A,t[122]=_,t[123]=u,t[124]=E,t[125]=b,t[126]=Xe):Xe=t[126];let Ze;return t[127]!==Je||t[128]!==Ye||t[129]!==Xe?(Ze=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Je,Ye,Xe]}),t[127]=Je,t[128]=Ye,t[129]=Xe,t[130]=Ze):Ze=t[130],Ze}function wt(e){return(0,$.jsx)(St,{value:e.id,children:(0,$.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name})},e.id)}var Tt=[[`☀️`,`晨间简报`,`每天开始工作前,整理今天值得关注的任务与进展。`,`Morning briefing`,`Start each day with your tasks and project updates.`,`每天早上帮我整理当天到期、逾期的任务和项目进展,给出今天的重点。`,`Each morning, summarize my due and overdue tasks and project progress, and suggest priorities.`],[`📝`,`每周工作回顾`,`回顾一周的成果和问题,为下周留出清晰的方向。`,`Weekly review`,`Review the week and find a clear direction for the next.`,`每周五帮我回顾本周完成的任务和项目进展,整理未解决的问题,建议下周的重点。`,`Every Friday, review completed tasks and project progress, unresolved issues, and priorities for next week.`],[`🌱`,`项目进展跟进`,`定期看看项目进度,找出需要你关注的事情。`,`Project check-in`,`Keep an eye on project progress and what needs attention.`,`定期帮我检查项目进度,整理延期、阻塞和需要我决策的事项。先和我确认关注哪个项目以及运行时间。`,`Regularly review a project for delays, blockers, and decisions I need to make. Ask which project and when to run.`],[`🔔`,`重要事项提醒`,`把容易忘记的事情交给提醒,安心专注眼前。`,`A timely reminder`,`Make room to focus by setting a reminder for later.`,`我想安排一个重要事项提醒。请先问我需要提醒什么、什么时候提醒,以及是否重复。`,`Help me schedule a reminder. Ask what to remember, when, and whether it should repeat.`],[`📚`,`笔记整理`,`回看新收集的想法,整理出值得继续推进的线索。`,`Notes roundup`,`Revisit recent ideas and surface useful next steps.`,`每周帮我回顾最近新增的笔记,按主题整理,找出值得继续推进的想法。请先确认时间和范围。`,`Each week, group my recent notes by topic and suggest ideas worth pursuing. Confirm the schedule and scope.`],[`🧭`,`明日工作计划`,`下班前梳理未完成的事,安排明天最重要的三件事。`,`Plan tomorrow`,`Wrap up loose ends and choose tomorrow’s top three priorities.`,`每个工作日下班前,帮我梳理未完成的任务,建议明天最重要的三件事。请先确认具体时间。`,`Before the end of each workday, review unfinished tasks and suggest tomorrow’s top three priorities. Confirm the time.`],[`🗓️`,`月度复盘`,`拉远一点看进展,发现反复出现的问题和新的机会。`,`Monthly reflection`,`Step back to spot progress, recurring problems, and opportunities.`,`每月月底帮我回顾项目和任务的进展,总结成果、反复出现的问题和下个月的重点。请确认运行时间。`,`At the end of each month, review project and task progress, achievements, recurring problems, and priorities. Confirm the schedule.`],[`🎯`,`逾期任务检查`,`定期发现被搁置的事项,让重要的事重新向前。`,`Overdue task check`,`Find neglected tasks and get important work moving again.`,`定期帮我检查逾期任务,按紧迫程度整理,并建议下一步。请先确认运行频率和时间。`,`Regularly review overdue tasks, prioritize them by urgency, and suggest next steps. Confirm the frequency and time.`]];function Et(e=Math.random){let t=[...Tt];for(let n=t.length-1;n>0;n--){let r=Math.min(n,Math.max(0,Math.floor(e()*(n+1))));[t[n],t[r]]=[t[r],t[n]]}return t.slice(0,6)}function Dt({language:e,projectId:t,onOpenConversation:n}){let r=s(),[i,a]=(0,Q.useState)(!1),[o,c]=(0,Q.useState)(``),l=async e=>{a(!0),c(``);try{let i=await Ue({projectId:t,prompt:e});n?n(i):r(i)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}},u=e===`zh`,[d,f]=(0,Q.useState)(Et),p=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-2 py-10 sm:px-6 md:py-20`,children:[(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(x,{className:`mx-auto size-10 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:u?`安排任务`:`Schedule a task`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:u?`说说你希望定期完成什么,我们一起安排好。`:`Tell us what you’d like done regularly. We’ll work out the details together.`})]}),(0,$.jsxs)(`div`,{className:`mb-3 mt-10 flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:u?`也可以从这些想法开始`:`Or start with an idea`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(Et()),className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),u?`换一组`:`More ideas`]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.map(e=>(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void l(u?e[5]:e[6]),className:`flex min-h-28 items-center gap-4 rounded-xl border border-dashed border-edge bg-surface-panel px-5 py-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-2xl`,"aria-hidden":!0,children:e[0]}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:u?e[1]:e[3]}),(0,$.jsx)(`span`,{className:`mt-1 block text-sm leading-5 text-fg-muted`,children:u?e[2]:e[4]})]})]},e[1]))}),(0,$.jsx)(`div`,{className:`mt-6 text-center`,children:(0,$.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void l(),className:`rounded-md px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:u?`说说你想安排的其他任务`:`Describe another task`})}),o?(0,$.jsx)(`p`,{role:`alert`,className:`mt-3 text-center text-sm text-danger`,children:o}):null]});return(0,$.jsx)(`section`,{"aria-label":u?`安排任务`:`Schedule a task`,children:p})}function Ot(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function kt(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function At(e,t={}){let n=Ot(e.split(`
3
3
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
4
4
  `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(kt(n));return null}async function jt(e,t={}){let n=await c(l(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=At(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=At(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let u=o.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:s.trim()||void 0}}function Mt(){let[e,t]=(0,Q.useState)(``),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,Q.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await jt(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){let t=e instanceof Error?e.message:`AI suggestion failed`;return s(t),null}finally{a(!1)}},[]),reset:(0,Q.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var Nt=5;function Pt(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function Ft(e){let t=(0,it.c)(245),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:o,format:s,intent:c,locale:l,context:u,disabled:d,className:f,showLabel:y}=e,b=o===void 0?`generic.text`:o,x=s===void 0?`plain`:s,S=c===void 0?`improve`:c,C=y===void 0||y,[w,T]=(0,Q.useState)(!1),[E,O]=(0,Q.useState)(n),[k,A]=(0,Q.useState)(`preview`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`edit`),[I,L]=(0,Q.useState)(!0),[R,ee]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(null),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(!0),{suggestion:oe,thinking:B,loading:H,error:U,generate:G,reset:K}=Mt(),q;t[0]===l?q=t[1]:(q=Pt(l),t[0]=l,t[1]=q);let J=q,le;t[2]!==H||t[3]!==B?(le=H&&B.trim().length>0,t[2]=H,t[3]=B,t[4]=le):le=t[4];let Y=le,ue,de;t[5]!==w||t[6]!==n?(ue=()=>{w||O(n)},de=[w,n],t[5]=w,t[6]=n,t[7]=ue,t[8]=de):(ue=t[7],de=t[8]),(0,Q.useEffect)(ue,de);let pe,X;t[9]===oe?(pe=t[10],X=t[11]):(X=()=>{M(oe)},pe=[oe],t[9]=oe,t[10]=pe,t[11]=X),(0,Q.useEffect)(X,pe);let he,ge;t[12]===B?(he=t[13],ge=t[14]):(he=()=>{B.trim()&&L(!0)},ge=[B],t[12]=B,t[13]=he,t[14]=ge),(0,Q.useEffect)(he,ge);let _e;t[15]!==Y||t[16]!==I?(_e=()=>{let e=re.current;!e||!Y||!I||ie.current&&(e.scrollTop=e.scrollHeight)},t[15]=Y,t[16]=I,t[17]=_e):_e=t[17];let ve;t[18]!==Y||t[19]!==B||t[20]!==I?(ve=[Y,B,I],t[18]=Y,t[19]=B,t[20]=I,t[21]=ve):ve=t[21],(0,Q.useLayoutEffect)(_e,ve);let ye;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>{let e=re.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;ie.current=t<=Nt},t[22]=ye):ye=t[22];let be=ye,xe;t[23]!==u||t[24]!==i||t[25]!==a||t[26]!==x||t[27]!==G||t[28]!==S||t[29]!==l||t[30]!==b?(xe=async e=>{P(`edit`),L(!0),ie.current=!0,await G({intent:S,scenario:b,input:e,locale:l,field:{id:i,label:a,format:x},context:u})},t[23]=u,t[24]=i,t[25]=a,t[26]=x,t[27]=G,t[28]=S,t[29]=l,t[30]=b,t[31]=xe):xe=t[31];let Se=xe,Z;t[32]!==K||t[33]!==n?(Z=e=>{ee(!!e.currentTarget.closest(`[role="dialog"]`)),ne(document.querySelector(`.app-main-surface`)),O(n),A(`preview`),M(``),P(`edit`),L(!0),K(),T(!0)},t[32]=K,t[33]=n,t[34]=Z):Z=t[34];let Ce=Z,we;t[35]!==E||t[36]!==Se?(we=async()=>{await Se(E)},t[35]=E,t[36]=Se,t[37]=we):we=t[37];let Te=we,Ee;t[38]!==K||t[39]!==n?(Ee=()=>{T(!1),O(n),A(`preview`),M(``),P(`edit`),L(!0),K()},t[38]=K,t[39]=n,t[40]=Ee):Ee=t[40];let De=Ee,Oe;t[41]!==De||t[42]!==E||t[43]!==r?(Oe=()=>{r(E),De()},t[41]=De,t[42]=E,t[43]=r,t[44]=Oe):Oe=t[44];let ke=Oe,Ae;t[45]!==De||t[46]!==j||t[47]!==r?(Ae=()=>{j.trim()&&(r(j),De())},t[45]=De,t[46]=j,t[47]=r,t[48]=Ae):Ae=t[48];let je=Ae,Me;t[49]!==De||t[50]!==E||t[51]!==j||t[52]!==r?(Me=()=>{if(!j.trim())return;let e=E.trimEnd();r(e?`${e}\n\n${j}`:j),De()},t[49]=De,t[50]=E,t[51]=j,t[52]=r,t[53]=Me):Me=t[53];let Ne=Me,Pe;t[54]!==j||t[55]!==U||t[56]!==H?(Pe=!H&&!U&&j.trim().length>0,t[54]=j,t[55]=U,t[56]=H,t[57]=Pe):Pe=t[57];let Fe=Pe,Ie=E!==n,Le;t[58]!==j||t[59]!==U||t[60]!==B?(Le=j.trim().length>0||B.trim().length>0||!!U,t[58]=j,t[59]=U,t[60]=B,t[61]=Le):Le=t[61];let Re=Le,ze=!C&&`size-7 p-0`,Be;t[62]!==f||t[63]!==ze?(Be=W(`h-7 gap-1 px-2 text-xs`,ze,f),t[62]=f,t[63]=ze,t[64]=Be):Be=t[64];let Ve=d||H,He;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,$.jsx)(se,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=He):He=t[65];let Ue=C?J.buttonTitle:null,We;t[66]!==J.buttonTitle||t[67]!==Ce||t[68]!==Be||t[69]!==Ve||t[70]!==Ue?(We=(0,$.jsxs)(fe,{type:`button`,variant:`ghost`,className:Be,title:J.buttonTitle,"aria-label":J.buttonTitle,disabled:Ve,onClick:Ce,children:[He,Ue]}),t[66]=J.buttonTitle,t[67]=Ce,t[68]=Be,t[69]=Ve,t[70]=Ue,t[71]=We):We=t[71];let Ge;t[72]===De?Ge=t[73]:(Ge=e=>e?T(!0):De(),t[72]=De,t[73]=Ge);let Ke=te??void 0,qe=R?`bg-transparent`:`bg-scrim`,Je;t[74]===qe?Je=t[75]:(Je=W(`xopc-dialog-overlay absolute inset-0 z-[80]`,qe),t[74]=qe,t[75]=Je);let Ye;t[76]===Je?Ye=t[77]:(Ye=(0,$.jsx)(p,{className:Je}),t[76]=Je,t[77]=Ye);let Xe;t[78]===J.title?Xe=t[79]:(Xe=(0,$.jsx)(_,{className:`text-base font-semibold text-fg`,children:J.title}),t[78]=J.title,t[79]=Xe);let Ze;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,$.jsx)(ce,{className:`size-5`,strokeWidth:1.75}),t[80]=Ze):Ze=t[80];let Qe;t[81]===J.close?Qe=t[82]:(Qe=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(fe,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":J.close,children:Ze})}),t[81]=J.close,t[82]=Qe);let $e;t[83]!==Xe||t[84]!==Qe?($e=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Xe,Qe]}),t[83]=Xe,t[84]=Qe,t[85]=$e):$e=t[85];let et;t[86]===J.current?et=t[87]:(et=(0,$.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:J.current}),t[86]=J.current,t[87]=et);let tt=J.current,nt=k===`edit`,rt=k===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,at;t[88]===rt?at=t[89]:(at=W(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,rt),t[88]=rt,t[89]=at);let ot,st;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>A(`edit`),st=(0,$.jsx)(V,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ot,t[91]=st):(ot=t[90],st=t[91]);let ct;t[92]!==J.edit||t[93]!==nt||t[94]!==at?(ct=(0,$.jsxs)(`button`,{"aria-pressed":nt,type:`button`,className:at,onClick:ot,children:[st,J.edit]}),t[92]=J.edit,t[93]=nt,t[94]=at,t[95]=ct):ct=t[95];let lt=k===`preview`,ut=k===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,dt;t[96]===ut?dt=t[97]:(dt=W(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ut),t[96]=ut,t[97]=dt);let ft,pt;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(ft=()=>A(`preview`),pt=(0,$.jsx)(F,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[98]=ft,t[99]=pt):(ft=t[98],pt=t[99]);let mt;t[100]!==J.preview||t[101]!==lt||t[102]!==dt?(mt=(0,$.jsxs)(`button`,{"aria-pressed":lt,type:`button`,className:dt,onClick:ft,children:[pt,J.preview]}),t[100]=J.preview,t[101]=lt,t[102]=dt,t[103]=mt):mt=t[103];let ht;t[104]!==J.current||t[105]!==ct||t[106]!==mt?(ht=(0,$.jsxs)(me,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,role:`group`,"aria-label":tt,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[ct,mt]}),t[104]=J.current,t[105]=ct,t[106]=mt,t[107]=ht):ht=t[107];let gt;t[108]!==et||t[109]!==ht?(gt=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[et,ht]}),t[108]=et,t[109]=ht,t[110]=gt):gt=t[110];let _t;t[111]!==E||t[112]!==k||t[113]!==x||t[114]!==J.current||t[115]!==J.empty?(_t=k===`preview`?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:x===`markdown`?(0,$.jsx)(z,{content:E||J.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:E||J.empty})}):(0,$.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:E,onChange:e=>O(e.currentTarget.value),placeholder:J.empty,"aria-label":J.current}),t[111]=E,t[112]=k,t[113]=x,t[114]=J.current,t[115]=J.empty,t[116]=_t):_t=t[116];let vt;t[117]!==gt||t[118]!==_t?(vt=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[gt,_t]}),t[117]=gt,t[118]=_t,t[119]=vt):vt=t[119];let yt;t[120]===J.editedSuggestion?yt=t[121]:(yt=(0,$.jsx)(`span`,{children:J.editedSuggestion}),t[120]=J.editedSuggestion,t[121]=yt);let bt;t[122]!==J.loading||t[123]!==H?(bt=H?(0,$.jsx)(`span`,{className:`ml-2 font-normal`,children:J.loading}):null,t[122]=J.loading,t[123]=H,t[124]=bt):bt=t[124];let xt;t[125]!==yt||t[126]!==bt?(xt=(0,$.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[yt,bt]}),t[125]=yt,t[126]=bt,t[127]=xt):xt=t[127];let St=J.editedSuggestion,Ct=N===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[128]===Ct?wt=t[129]:(wt=W(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[128]=Ct,t[129]=wt);let Tt=N===`edit`,Et,Dt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Et=()=>P(`edit`),Dt=(0,$.jsx)(V,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[130]=Et,t[131]=Dt):(Et=t[130],Dt=t[131]);let Ot;t[132]!==J.edit||t[133]!==wt||t[134]!==Tt?(Ot=(0,$.jsxs)(`button`,{type:`button`,className:wt,"aria-pressed":Tt,onClick:Et,children:[Dt,J.edit]}),t[132]=J.edit,t[133]=wt,t[134]=Tt,t[135]=Ot):Ot=t[135];let kt=N===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,At;t[136]===kt?At=t[137]:(At=W(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,kt),t[136]=kt,t[137]=At);let jt=N===`preview`,Ft,Rt;t[138]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=()=>P(`preview`),Rt=(0,$.jsx)(F,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[138]=Ft,t[139]=Rt):(Ft=t[138],Rt=t[139]);let zt;t[140]!==J.preview||t[141]!==At||t[142]!==jt?(zt=(0,$.jsxs)(`button`,{type:`button`,className:At,"aria-pressed":jt,onClick:Ft,children:[Rt,J.preview]}),t[140]=J.preview,t[141]=At,t[142]=jt,t[143]=zt):zt=t[143];let Bt;t[144]!==J.editedSuggestion||t[145]!==Ot||t[146]!==zt?(Bt=(0,$.jsxs)(me,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,role:`group`,"aria-label":St,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[Ot,zt]}),t[144]=J.editedSuggestion,t[145]=Ot,t[146]=zt,t[147]=Bt):Bt=t[147];let Vt;t[148]!==xt||t[149]!==Bt?(Vt=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[xt,Bt]}),t[148]=xt,t[149]=Bt,t[150]=Vt):Vt=t[150];let Ht=Y?`opacity-100`:`pointer-events-none opacity-0`,Ut;t[151]===Ht?Ut=t[152]:(Ut=W(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ht),t[151]=Ht,t[152]=Ut);let Wt=!Y,Gt;t[153]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=()=>L(It),t[153]=Gt):Gt=t[153];let Kt;t[154]!==J.thinkingLoading||t[155]!==H?(Kt=H?(0,$.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,J.thinkingLoading]}):null,t[154]=J.thinkingLoading,t[155]=H,t[156]=Kt):Kt=t[156];let qt;t[157]!==J.thinking||t[158]!==Kt?(qt=(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J.thinking,Kt]}),t[157]=J.thinking,t[158]=Kt,t[159]=qt):qt=t[159];let Jt=I&&`rotate-180`,Yt;t[160]===Jt?Yt=t[161]:(Yt=W(`size-3.5 shrink-0 transition-transform`,Jt),t[160]=Jt,t[161]=Yt);let Xt;t[162]===Yt?Xt=t[163]:(Xt=(0,$.jsx)(D,{className:Yt,strokeWidth:1.75,"aria-hidden":!0}),t[162]=Yt,t[163]=Xt);let Zt;t[164]!==qt||t[165]!==Xt?(Zt=(0,$.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Gt,children:[qt,Xt]}),t[164]=qt,t[165]=Xt,t[166]=Zt):Zt=t[166];let Qt;t[167]!==B||t[168]!==I?(Qt=I?(0,$.jsx)(`pre`,{ref:re,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:be,children:B}):null,t[167]=B,t[168]=I,t[169]=Qt):Qt=t[169];let $t;t[170]!==Zt||t[171]!==Qt?($t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-inset/70`,children:[Zt,Qt]}),t[170]=Zt,t[171]=Qt,t[172]=$t):$t=t[172];let en;t[173]!==Ut||t[174]!==Wt||t[175]!==$t?(en=(0,$.jsx)(`div`,{className:Ut,"aria-hidden":Wt,children:$t}),t[173]=Ut,t[174]=Wt,t[175]=$t,t[176]=en):en=t[176];let tn=Y?`pointer-events-none opacity-0`:`opacity-100`,nn;t[177]===tn?nn=t[178]:(nn=W(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,tn),t[177]=tn,t[178]=nn);let rn;t[179]!==j||t[180]!==U||t[181]!==x||t[182]!==J.empty||t[183]!==J.loading||t[184]!==J.suggestion||t[185]!==H||t[186]!==N?(rn=U?(0,$.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:U}):N===`preview`?(0,$.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:H&&!j.trim()?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.loading}):x===`markdown`?(0,$.jsx)(z,{content:j||J.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:j||J.empty})}):(0,$.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:j,onChange:e=>M(e.currentTarget.value),disabled:H,placeholder:H?J.loading:J.empty,"aria-label":J.suggestion}),t[179]=j,t[180]=U,t[181]=x,t[182]=J.empty,t[183]=J.loading,t[184]=J.suggestion,t[185]=H,t[186]=N,t[187]=rn):rn=t[187];let an;t[188]!==nn||t[189]!==rn?(an=(0,$.jsx)(`div`,{className:nn,children:rn}),t[188]=nn,t[189]=rn,t[190]=an):an=t[190];let on;t[191]!==en||t[192]!==an?(on=(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[en,an]}),t[191]=en,t[192]=an,t[193]=on):on=t[193];let sn;t[194]!==Vt||t[195]!==on?(sn=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Vt,on]}),t[194]=Vt,t[195]=on,t[196]=sn):sn=t[196];let cn;t[197]!==vt||t[198]!==sn?(cn=(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[vt,sn]}),t[197]=vt,t[198]=sn,t[199]=cn):cn=t[199];let ln;t[200]!==De||t[201]!==J.cancel?(ln=(0,$.jsx)(fe,{type:`button`,variant:`secondary`,onClick:De,children:J.cancel}),t[200]=De,t[201]=J.cancel,t[202]=ln):ln=t[202];let un=!Ie,dn;t[203]!==ke||t[204]!==J.applyCurrent||t[205]!==un?(dn=(0,$.jsx)(fe,{type:`button`,variant:`secondary`,disabled:un,onClick:ke,children:J.applyCurrent}),t[203]=ke,t[204]=J.applyCurrent,t[205]=un,t[206]=dn):dn=t[206];let fn;t[207]===Te?fn=t[208]:(fn=()=>void Te(),t[207]=Te,t[208]=fn);let pn;t[209]===Re?pn=t[210]:(pn=Re?(0,$.jsx)(ae,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,$.jsx)(se,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[209]=Re,t[210]=pn);let mn=Re?J.regenerate:J.generate,hn;t[211]!==H||t[212]!==pn||t[213]!==mn||t[214]!==fn?(hn=(0,$.jsxs)(fe,{type:`button`,variant:`secondary`,disabled:H,onClick:fn,children:[pn,mn]}),t[211]=H,t[212]=pn,t[213]=mn,t[214]=fn,t[215]=hn):hn=t[215];let gn=!Fe,_n;t[216]!==Ne||t[217]!==J.append||t[218]!==gn?(_n=(0,$.jsx)(fe,{type:`button`,variant:`secondary`,disabled:gn,onClick:Ne,children:J.append}),t[216]=Ne,t[217]=J.append,t[218]=gn,t[219]=_n):_n=t[219];let vn=!Fe,yn;t[220]!==je||t[221]!==J.replace||t[222]!==vn?(yn=(0,$.jsx)(fe,{type:`button`,variant:`primary`,disabled:vn,onClick:je,children:J.replace}),t[220]=je,t[221]=J.replace,t[222]=vn,t[223]=yn):yn=t[223];let bn;t[224]!==hn||t[225]!==_n||t[226]!==yn||t[227]!==ln||t[228]!==dn?(bn=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[ln,dn,hn,_n,yn]}),t[224]=hn,t[225]=_n,t[226]=yn,t[227]=ln,t[228]=dn,t[229]=bn):bn=t[229];let xn;t[230]!==bn||t[231]!==$e||t[232]!==cn?(xn=(0,$.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(g,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,onOpenAutoFocus:Lt,children:[$e,cn,bn]})}),t[230]=bn,t[231]=$e,t[232]=cn,t[233]=xn):xn=t[233];let Sn;t[234]!==xn||t[235]!==Ke||t[236]!==Ye?(Sn=(0,$.jsxs)(h,{container:Ke,children:[Ye,xn]}),t[234]=xn,t[235]=Ke,t[236]=Ye,t[237]=Sn):Sn=t[237];let Cn;t[238]!==w||t[239]!==Sn||t[240]!==Ge?(Cn=(0,$.jsx)(v,{open:w,onOpenChange:Ge,children:Sn}),t[238]=w,t[239]=Sn,t[240]=Ge,t[241]=Cn):Cn=t[241];let wn;return t[242]!==Cn||t[243]!==We?(wn=(0,$.jsxs)($.Fragment,{children:[We,Cn]}),t[242]=Cn,t[243]=We,t[244]=wn):wn=t[244],wn}function It(e){return!e}function Lt(e){return e.preventDefault()}function Rt(e){return e.management!==void 0}function zt(e){return[`reminder`,`brief`,`review`,`followUp`].map(t=>{let n=e.scenarios[t];return{...n,requiresProject:t===`followUp`,form:{...Fe,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 Bt=`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 Vt(e){let t=(0,it.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,$.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,$.jsx)(`input`,{className:Bt,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,$.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,$.jsx)(`textarea`,{className:Bt,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,$.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,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.project,(0,$.jsxs)(k,{className:Bt,value:n.projectId,onChange:e=>u({projectId:e.target.value}),children:[(0,$.jsx)(A,{value:``,children:i.form.noProject}),a.map(Ht)]})]}),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,$.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,$.jsx)(A,{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,$.jsx)(A,{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,$.jsx)(A,{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,$.jsxs)(k,{className:Bt,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,$.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 E;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?(E=n.triggerMode===`once`?(0,$.jsx)(rt,{label:i.form.onceAt,value:n.onceAt,defaultTime:n.time,onChange:e=>u({onceAt:e})}):(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:i.form.time}),(0,$.jsx)(Ze,{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]=E):E=t[55];let D;t[56]!==n.triggerMode||t[57]!==n.weekday||t[58]!==i.form.day||t[59]!==i.weekdays||t[60]!==u?(D=n.triggerMode===`weekly`&&(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.day,(0,$.jsx)(k,{className:Bt,value:n.weekday,onChange:e=>u({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,$.jsx)(A,{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]=D):D=t[61];let O;t[62]!==T||t[63]!==E||t[64]!==D?(O=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[T,E,D]}),t[62]=T,t[63]=E,t[64]=D,t[65]=O):O=t[65];let j;t[66]!==n.onceAt||t[67]!==n.triggerMode||t[68]!==i.experience.futureTime?(j=n.triggerMode===`once`&&n.onceAt&&new Date(n.onceAt).getTime()<=Date.now()?(0,$.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]=j):j=t[69];let M;t[70]===i.experience.scheduleNote?M=t[71]:(M=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.experience.scheduleNote}),t[70]=i.experience.scheduleNote,t[71]=M);let N;t[72]===u?N=t[73]:(N=e=>u({notificationPolicy:e.target.value}),t[72]=u,t[73]=N);let P;t[74]===i.draft.notifyAll?P=t[75]:(P=(0,$.jsx)(A,{value:`all`,children:i.draft.notifyAll}),t[74]=i.draft.notifyAll,t[75]=P);let F;t[76]===i.draft.notifyAttention?F=t[77]:(F=(0,$.jsx)(A,{value:`attention`,children:i.draft.notifyAttention}),t[76]=i.draft.notifyAttention,t[77]=F);let I;t[78]===i.draft.notifyNone?I=t[79]:(I=(0,$.jsx)(A,{value:`none`,children:i.draft.notifyNone}),t[78]=i.draft.notifyNone,t[79]=I);let L;t[80]!==n.notificationPolicy||t[81]!==N||t[82]!==P||t[83]!==F||t[84]!==I?(L=(0,$.jsxs)(k,{className:Bt,value:n.notificationPolicy,onChange:N,children:[P,F,I]}),t[80]=n.notificationPolicy,t[81]=N,t[82]=P,t[83]=F,t[84]=I,t[85]=L):L=t[85];let R;t[86]!==i.draft.notifications||t[87]!==L?(R=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.draft.notifications,L]}),t[86]=i.draft.notifications,t[87]=L,t[88]=R):R=t[88];let z;return t[89]!==y||t[90]!==O||t[91]!==d||t[92]!==j||t[93]!==M||t[94]!==R||t[95]!==m||t[96]!==_||t[97]!==v?(z=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[d,m,_,v,y,O,j,M,R]}),t[89]=y,t[90]=O,t[91]=d,t[92]=j,t[93]=M,t[94]=R,t[95]=m,t[96]=_,t[97]=v,t[98]=z):z=t[98],z}function Ht(e){return(0,$.jsx)(A,{value:e.id,children:e.name},e.id)}var Ut=`xopc.automations.dismissedExecutionIssues`;function Wt(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(Ut)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function Gt(e,t,n){return e?Xe(e,n):t.never}function Kt(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===`task_command`?t.action.taskWithId.replace(`{id}`,e.taskId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function qt(e,t){return e===`task_command`?t.action.runTask:t.action.runAgent}function Jt(e){return e.safety?.mode??`auto_apply`}function Yt(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 Zt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function Qt(e){return e.status===`failed`||e.status===`timeout`}function $t(e,t){return e.action.kind===`system`?Kt(e.action,t):e.action.kind===`agent`?e.action.instruction:(e.action.kind,Kt(e.action,t))}function en(e){return e.description?.trim()??``}function tn(e){return Zt(e)?0:Qt(e)?1:e.status===`succeeded`?2:3}function nn(e){return[...e].sort((e,t)=>{let n=tn(e)-tn(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function rn(){let e=(0,it.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.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(on)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,$.jsx)(G,{className:`h-4 w-36`}),(0,$.jsx)(G,{className:`h-3 w-56 max-w-full`})]}),(0,$.jsx)(G,{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,$.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[n,(0,$.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(an)})]}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(G,{className:`h-4 w-32`}),a=(0,$.jsx)(G,{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,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-3 md:grid-cols-[15rem_minmax(0,1fr)] md:grid-rows-1 lg:grid-cols-[17rem_minmax(0,1fr)]`,children:[r,(0,$.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[i,a,(0,$.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,$.jsx)(G,{className:`h-12 rounded-lg`}),(0,$.jsx)(G,{className:`h-12 rounded-lg`}),(0,$.jsx)(G,{className:`h-12 rounded-lg`})]})]})]})]}),e[5]=o):o=e[5],o}function an(e,t){return(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(G,{className:`size-4 rounded-full`}),(0,$.jsx)(G,{className:`h-4 w-32`}),(0,$.jsx)(G,{className:`h-5 w-20 rounded-full`})]}),(0,$.jsx)(G,{className:`mt-3 h-4 w-full`}),(0,$.jsx)(G,{className:`mt-2 h-4 w-3/5`})]}),(0,$.jsx)(G,{className:`h-8 w-24 rounded-md`})]})},t)}function on(e,t){return(0,$.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2.5 bg-surface-base px-3 py-2.5`,children:[(0,$.jsx)(G,{className:`size-4 rounded-full`}),(0,$.jsx)(G,{className:`h-3 w-14`}),(0,$.jsx)(G,{className:`ml-auto h-4 w-10`})]},t)}function sn({projectId:e,embedded:t=!1,title:n,subtitle:r}){let i=d(e=>e.language),o=f(i),s=o.automations,c=o.productNavigation.sections[`automation-triggers`],l=o.cron,u=pe(e=>e.setPageHeader),y=pe(e=>e.clearPageHeader),[b,x]=a(),S=!t&&b.get(`view`)===`activity`,C=b.get(`run`)?.trim()??``,w=b.get(`view`)===`execution`&&!!C,T=b.get(`automation`)?.trim()??``,E=b.get(`new`)===`1`,D=b.get(`setupChat`)??void 0,O=b.get(`draft`)?.trim()??``,k=b.get(`action`)?.trim()??``,A=b.get(`taskId`)?.trim()??``,M=b.get(`projectId`)?.trim()??``,N=e?.trim()||M,P=!!e?.trim(),F=b.get(`autogenerate`)===`1`,I=(0,Q.useRef)(``),L=b.get(`status`),R=L===`active`||L===`paused`||L===`completed`||L===`running`||L===`attention`?L:`all`,z=b.get(`ownership`)===`system`?`system`:`user`,ee=b.get(`source`),te=ee===`agent`||ee===`task_command`?ee:`all`,ne=b.get(`q`)??``,re=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`status`):n.set(`status`,e),n.delete(`automation`),n}),ae=e=>x(t=>{let n=new URLSearchParams(t);return e===`user`?n.delete(`ownership`):n.set(`ownership`,e),n.delete(`automation`),n}),oe=e=>x(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n.delete(`automation`),n},{replace:!0}),B=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`source`):n.set(`source`,e),n.delete(`automation`),n}),se=()=>x(e=>{let t=new URLSearchParams(e);return t.delete(`status`),t.delete(`source`),t.delete(`q`),t.delete(`automation`),t}),[V,H]=(0,Q.useState)(null),[G,q]=(0,Q.useState)(!1),[J,le]=(0,Q.useState)(`blank`),[me,ge]=(0,Q.useState)(!1),[_e,ve]=(0,Q.useState)(null),[ye,be]=(0,Q.useState)(null),[xe,Se]=(0,Q.useState)(!1),[Z,Ce]=(0,Q.useState)(Fe),[we,Te]=(0,Q.useState)(null),[Ee,De]=(0,Q.useState)(null),[Oe,Ae]=(0,Q.useState)(!1),[Ne,Le]=(0,Q.useState)(null),[Re,Ve]=(0,Q.useState)(``),[Ue,Ge]=(0,Q.useState)(null),[qe,Je]=(0,Q.useState)(!1),[Ye,Xe]=(0,Q.useState)(!1),[Ze,Qe]=(0,Q.useState)(N),[$e,tt]=(0,Q.useState)(`new_session`),[rt,it]=(0,Q.useState)(`attention`),[at,st]=(0,Q.useState)(null),[ct,lt]=(0,Q.useState)(!1),[ut,ft]=(0,Q.useState)(!1),[pt,mt]=(0,Q.useState)(!1),[ht,_t]=(0,Q.useState)(null),[yt,bt]=(0,Q.useState)(Wt),xt=Y([`automations`,N],()=>X.list(N?{projectId:N}:void 0),{keepPreviousData:!0,refreshInterval:15e3}),St=Y([`automation-runs`,N],()=>X.runs(50,void 0,N?{projectId:N}:void 0),{keepPreviousData:!0,refreshInterval:1e4}),wt=Y(N?`automations-global-system-source`:null,()=>X.list(),{keepPreviousData:!0,refreshInterval:15e3}),Tt=Y(N?`automation-runs-global-system-source`:null,()=>X.runs(50),{keepPreviousData:!0,refreshInterval:1e4}),Et=Y(Ne?[`automation-history`,Ne,N]:null,()=>X.runs(50,Ne,N?{projectId:N}:void 0),{refreshInterval:1e4}),Ot=Y(Ee?`automation-run-events:${Ee}`:null,()=>X.runEvents(Ee),{refreshInterval:5e3}),kt=Y(Ee?[`automation-exact-run`,Ee]:null,()=>X.getRun(Ee),{refreshInterval:3e3}),At=Y(`automation-chat-agents`,de),jt=Y(`automation-tasks`,X.tasks),Mt=Y(`automation-projects`,()=>K({sortBy:`name`,sortOrder:`asc`,limit:200})),Nt=xt.isLoading&&!xt.data||St.isLoading&&!St.data||!!N&&wt.isLoading&&!wt.data||!!N&&Tt.isLoading&&!Tt.data,Pt=!Nt&&(xt.isLoading||St.isLoading||wt.isLoading||Tt.isLoading),Ft=xt.data?.automations??[],It=N?wt.data?.automations??[]:Ft,Lt=(0,Q.useMemo)(()=>nn(St.data?.runs??[]),[St.data?.runs]),Bt=(0,Q.useMemo)(()=>N?nn(Tt.data?.runs??[]):Lt,[Tt.data?.runs,N,Lt]),Ht=(0,Q.useMemo)(()=>Ft.filter(e=>!Rt(e)),[Ft]),Gt=(0,Q.useMemo)(()=>It.filter(Rt),[It]),Kt=(0,Q.useMemo)(()=>[...Ht,...Gt],[Gt,Ht]),qt=(0,Q.useMemo)(()=>new Set(Gt.map(e=>e.id)),[Gt]),Jt=(0,Q.useMemo)(()=>Lt.filter(e=>!qt.has(e.automationId)),[Lt,qt]),Yt=(0,Q.useMemo)(()=>Bt.filter(e=>qt.has(e.automationId)),[Bt,qt]),Xt=(0,Q.useMemo)(()=>N?[...Lt,...Yt]:Lt,[N,Lt,Yt]),Qt=(0,Q.useMemo)(()=>kt.data?.run?.id===Ee?kt.data.run:Xt.find(e=>e.id===Ee)??Et.data?.runs.find(e=>e.id===Ee)??null,[Xt,Ee,Et.data,kt.data]),tn=(0,Q.useMemo)(()=>Kt.find(e=>e.id===Ne)??null,[Kt,Ne]),an=(0,Q.useMemo)(()=>Kt.find(e=>e.id===ye)??null,[Kt,ye]),on=(0,Q.useMemo)(()=>[...Et.data?.runs??Xt].filter(e=>e.automationId===Ne).sort((e,t)=>t.createdAtMs-e.createdAtMs),[Xt,Ne,Et.data]),sn=Ot.data?.events??[],un=(0,Q.useMemo)(()=>Jt.filter(e=>!Zt(e)&&e.readAtMs==null),[Jt]),dn=Ht.reduce((e,t)=>e+(xt.data?.executionSummaries?.[t.id]?.unreadCount??0),0),fn=ne.trim().toLocaleLowerCase(),pn=z===`system`?Gt:Ht,hn=z===`system`?Yt:Jt,gn=(0,Q.useMemo)(()=>new Set(hn.filter(Zt).map(e=>e.automationId)),[hn]),_n=(0,Q.useMemo)(()=>pn.filter(e=>R===`attention`&&!et(e,hn)||R===`running`&&!gn.has(e.id)||R===`active`&&!e.enabled||R===`paused`&&(e.enabled||ke(e))||R===`completed`&&!ke(e)||te!==`all`&&e.action.kind!==te?!1:!fn||[e.name,en(e),$t(e,s),je(e.trigger,s,l,i)].some(e=>e.toLocaleLowerCase().includes(fn))),[l,R,s,i,fn,pn,hn,gn,te]),bn=At.data?.items??[],xn=(0,Q.useMemo)(()=>(jt.data?.items??[]).map(e=>e.task),[jt.data]),Sn=Mt.data?.items??[],Cn=!!an?.management?.editable.includes(`trigger`),wn=[`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`||Be(Z.intervalValue,Z.intervalUnit)>=6e4)&&(Z.triggerMode!==`cron`||!!Z.cronExpr.trim()),Tn=Cn?wn:!!Z.name.trim()&&(Z.triggerMode!==`once`||Number.isFinite(new Date(Z.onceAt).getTime())&&(!!an||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()&&Ie(Z.eventPayloadMatch))&&(Z.actionMode===`task_command`?!!(Z.taskId.trim()&&Z.agentId.trim()):!!Z.instruction.trim()),En=!0;try{[`daily`,`weekly`,`cron`].includes(Z.triggerMode)&&He(Z)}catch{En=!1}let Dn=Tn&&En,kn=(0,Q.useMemo)(()=>zt(s),[s]),An=(0,Q.useMemo)(()=>Ht.filter(e=>et(e,Jt)),[Ht,Jt]),jn=An.some(e=>{let t=nt(e,Jt);return t!==null&&yt[e.id]!==t}),Mn=(0,Q.useCallback)(()=>{bt(e=>{let t={...e};for(let e of An){let n=nt(e,Jt);n&&(t[e.id]=n)}try{window.localStorage.setItem(Ut,JSON.stringify(t))}catch{}return t})},[An,Jt]);(0,Q.useEffect)(()=>{if(!Pt){if(E){Le(null);return}if(T){Le(T);return}if(_n.length===0){Le(null);return}Ne&&_n.some(e=>e.id===Ne)||Le(null)}},[T,_n,E,Pt,Ne]);let Nn=(0,Q.useCallback)(async()=>{await Promise.all([xt.mutate(),St.mutate(),wt.mutate(),Tt.mutate(),Et.mutate(),Ot.mutate(),ue(e=>Array.isArray(e)&&e[0]===`automation-navigation-runs`)])},[xt.mutate,wt.mutate,Tt.mutate,Ot.mutate,St.mutate,Et.mutate]),Pn=(0,Q.useCallback)(e=>{if(P){Le(null),De(null);return}x(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),Le(null),De(null)},[P,x]);(0,Q.useEffect)(()=>{P&&(Qe(N),Ce(e=>e.projectId===N?e:{...e,projectId:N}))},[N,P]);let Fn=(0,Q.useCallback)(e=>{if(e===`blank`&&!A){ge(!0);return}if(be(null),Se(!1),Te(null),le(e),q(!0),e===`blank`){Ce({...Fe,projectId:N});return}Ve(``),Ge(null),Xe(!1),Qe(N),tt(`new_session`),it(`attention`)},[N,A]),In=e=>{H(e),Ce({...e.form,projectId:N}),be(null),Se(!1),Te(null),le(`quick`),q(!0)},Ln=(0,Q.useCallback)(e=>{if(e.action.kind===`agent`&&!e.management){ve(e);return}Ce(Ke(e)),be(e.id),Se(!1),Le(null),le(`blank`),q(!0)},[]),Rn=(0,Q.useCallback)(()=>{Ue&&(Ce({...Ke(Ue.automation),projectId:Ze,conversationMode:$e,notificationPolicy:rt}),be(null),Se(!0),le(`blank`))},[Ue,$e,rt,Ze]),zn=(0,Q.useCallback)(async()=>{mt(!0),Te(null);try{await Nn()}catch(e){let t=e instanceof Error?e.message:String(e);Te(t)}finally{mt(!1)}},[s.feedback.actionFailed,Nn]);(0,Q.useEffect)(()=>{let e=Kt.find(e=>e.id===T);!e||!Rt(e)||z===`system`||x(e=>{let t=new URLSearchParams(e);return t.set(`ownership`,`system`),t},{replace:!0})},[T,Kt,z,x]),(0,Q.useEffect)(()=>{k===`create`&&(Fn(`blank`),A&&Ce(e=>({...e,actionMode:`task_command`,taskId:A,safetyMode:`auto_apply`})),x(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t.delete(`taskId`),t},{replace:!0}))},[k,Fn,x,A]),(0,Q.useEffect)(()=>{if(!O)return;let e=`${i}:${F?`auto`:`seed`}:${O}`;I.current!==e&&(I.current=e,Ve(O),Ge(null),Xe(!1),Qe(N),le(`draft`),q(!0),x(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),F&&(Te(null),Je(!0),X.draft({prompt:O,language:i}).then(e=>{Ge(e.draft),Xe(!1)}).catch(e=>{Te(e instanceof Error?e.message:String(e))}).finally(()=>{Je(!1)})))},[F,O,i,N,x]);let Bn=(0,Q.useCallback)(e=>{let t=Lt.find(t=>t.id===e)??Et.data?.runs.find(t=>t.id===e);if(!t||Zt(t)||t.readAtMs!=null)return;let n=Date.now();St.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),Et.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),X.markRunRead(e).catch(e=>{Te(e instanceof Error?e.message:String(e)),St.mutate(),Et.mutate()})},[Lt,St.mutate,Et.data,Et.mutate]),Vn=(0,Q.useCallback)(e=>{Bn(e),De(e),Ae(!0),x(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Bn,x]),Hn=(0,Q.useCallback)(e=>{Le(e),De(null),Ae(!1),x(t=>{let n=new URLSearchParams(t);n.set(`automation`,e);for(let e of[`new`,`setupChat`,`chatDraft`,`run`,`view`])n.delete(e);return n})},[x]),Un=(0,Q.useCallback)(e=>{Ae(!1),x(t=>{let n=new URLSearchParams(t);n.set(`automation`,e.automationId),n.set(`run`,e.id),n.set(`view`,`execution`);for(let e of[`new`,`setupChat`,`chatDraft`])n.delete(e);return n})},[x]);(0,Q.useEffect)(()=>{De(C||null),Ae(!!C&&!w)},[w,C]),(0,Q.useEffect)(()=>{C&&!w&&Bn(C)},[w,C,Bn]),(0,Q.useEffect)(()=>{st(null),ft(!1)},[Ee]);async function Wn(){if(Te(null),Z.triggerMode===`once`&&!an&&new Date(Z.onceAt).getTime()<=Date.now()){Te(s.experience.futureTime);return}if(!(!Dn||ht)&&!(J===`quick`&&V?.requiresProject&&!Z.projectId)){if(xe&&Ue){_t(`draft:edit`);try{let e=ze(Z),{simulation:t}=await X.simulate(e);Ge({...Ue,automation:e,simulation:t}),Qe(Z.projectId),tt(Z.conversationMode),it(Z.notificationPolicy),Xe(!1),Se(!1),le(`draft`)}catch(e){let t=e instanceof Error?e.message:String(e);Te(t)}finally{_t(null)}return}if(an){let e=an.id;await Gn(`automation:${e}:edit`,()=>X.update(e,{...Cn?{trigger:Pe(an,{...Z,instruction:`managed`}).trigger}:Pe(an,Z),expectedRevision:an.updatedAtMs}))&&(q(!1),be(null),Le(e));return}_t(`automation:create`);try{let e=ze(Z),{automation:t}=await X.create(e);Ce(Fe),q(!1),x(e=>{let n=new URLSearchParams(e);return n.delete(`status`),n.delete(`q`),n.delete(`run`),n.delete(`new`),n.set(`automation`,t.id),P||(t.projectId?n.set(`projectId`,t.projectId):n.delete(`projectId`)),n}),await Nn(),Le(t.id)}catch(e){let t=e instanceof Error?e.message:String(e);Te(t)}finally{_t(null)}}}async function Gn(e,t){Te(null),_t(e);try{return await t(),await Nn(),!0}catch(e){let t=e instanceof Error?e.message:String(e);return Te(t),!1}finally{_t(null)}}async function Kn(){await Gn(`runs:read-all`,()=>X.markAllRunsRead(N||void 0))}async function qn(){let e=Re.trim();if(e){Te(null),Je(!0);try{let t=await X.draft({prompt:e,language:i});Ge(t.draft),Xe(!1)}catch(e){Te(e instanceof Error?e.message:String(e))}finally{Je(!1)}}}async function Jn(){if(!Ue)return;let e=``,t=``;await Gn(`draft:publish`,async()=>{let{automation:n}=await X.create({...Ue.automation,...Ze?{projectId:Ze}:{projectId:void 0},conversationMode:$e,delivery:{...Ue.automation.delivery,notificationPolicy:rt}});Ge(null),Ve(``),Xe(!1),q(!1),re(`all`),oe(``),e=n.id,t=n.projectId??``})&&e&&(Pn(t),Hn(e))}async function Yn(){if(!Ue)return;let e=``,t=``,n=``;await Gn(`draft:test`,async()=>{let{automation:r}=await X.create({...Ue.automation,...Ze?{projectId:Ze}:{projectId:void 0},conversationMode:$e,delivery:{...Ue.automation.delivery,notificationPolicy:rt},enabled:!1}),{run:i}=await X.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,Ge(null),Ve(``),Xe(!1),q(!1),re(`all`),oe(``)})&&e&&n&&(Pn(t),Hn(e),Vn(n))}async function Xn(e){Te(null),lt(!0),st(null),ft(!1);try{let t=await X.repairDraft(e.id,{language:i});st(t.repair)}catch(e){Te(e instanceof Error?e.message:String(e))}finally{lt(!1)}}async function Zn(e){at&&await Gn(`run:${e.id}:repair`,async()=>{await X.update(e.automationId,at.patch),st(null),ft(!1)})}let Qn=(0,Q.useMemo)(()=>(0,$.jsx)(he,{className:`size-9 shrink-0 p-0`,loading:pt,label:s.refresh,onClick:zn}),[s.refresh,pt,zn]);return(0,Q.useLayoutEffect)(()=>{if(!t)return u({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:c}),end:Qn}),()=>y()},[y,t,Qn,c,u]),(0,$.jsxs)(`div`,{className:W(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,$.jsxs)(`div`,{className:W(`flex min-h-0 w-full flex-1 flex-col gap-4`,t?`py-1`:`px-4 pt-3 sm:px-9 lg:pt-4 xl:px-10`,!t&&(S?`overflow-y-auto`:`overflow-hidden`)),children:[t?(0,$.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,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(U,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||s.title})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||s.subtitle})]}),Qn]}):null,we||xt.error||St.error||wt.error||Tt.error?(0,$.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:we||s.feedback.actionFailed}):null,S?Nt?(0,$.jsx)(rn,{}):(0,$.jsx)(mn,{runs:hn,ownership:z,labels:s,language:i,unreadCount:z===`user`?un.length:0,loading:Pt||pt,onOwnershipChange:ae,onRefresh:zn,onSelectRun:Vn}):(0,$.jsxs)($.Fragment,{children:[!Nt&&jn&&z===`user`?(0,$.jsxs)(`div`,{className:`flex items-center rounded-lg border border-red-500/20 bg-red-500/5`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>re(`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,$.jsx)(j,{className:`size-4 shrink-0 text-red-700 dark:text-red-300`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 text-sm text-fg`,children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[s.experience.executionIssues,` · `,An.length]}),(0,$.jsx)(`span`,{className:`ml-2 text-fg-muted`,children:s.experience.issuesDescription})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:Mn,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":s.close,title:s.close,children:(0,$.jsx)(ce,{className:`size-4`,"aria-hidden":!0})})]}):null,Nt?(0,$.jsx)(rn,{}):(0,$.jsxs)(gt,{language:i,busy:Pt,children:[(0,$.jsxs)(`aside`,{className:W(`max-h-[28vh] min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-base md:flex md:h-full md:max-h-none`,w?`hidden`:`flex`),children:[(0,$.jsxs)(`div`,{className:`shrink-0 p-3`,children:[(0,$.jsx)(Ct,{language:i,labels:s,filter:R,ownership:z,source:te,projectId:N,projects:Sn,projectLocked:P,query:ne,unreadCount:z===`user`?dn:0,markReadBusy:ht===`runs:read-all`,onFilter:re,onOwnership:ae,onSource:B,onProject:Pn,onQuery:oe,onClear:()=>{se(),ae(`user`),P||Pn(``)},onMarkAllRead:()=>void Kn()}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>ge(!0),className:`mt-2 flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),i===`zh`?`新建任务`:`New task`]})]}),T&&!_n.some(e=>e.id===T)?(0,$.jsxs)(`p`,{role:`status`,className:`px-3 pb-2 text-xs text-fg-muted`,children:[i===`zh`?`当前自动化不在筛选结果中。`:`The selected automation is outside these filters.`,(0,$.jsx)(`button`,{type:`button`,className:`ml-1 text-accent-fg underline`,onClick:se,children:i===`zh`?`清除筛选`:`Clear filters`})]}):null,(0,$.jsx)(dt,{automations:_n,runs:hn,labels:s,cronLabels:l,language:i,selectedAutomationId:E?null:Ne,selectedRunId:w?C:void 0,selectedRun:w?Qt:null,projectId:N||void 0,executionSummaries:(z===`system`&&N?wt.data:xt.data)?.executionSummaries,onSelectRun:Un,onOpenDetails:Hn,busy:ht!==null,onEdit:Ln,onAction:Gn})]}),w&&T?(0,$.jsx)(ot,{automationId:T,runId:C,projectId:N||void 0,language:i,onBack:()=>Hn(T),onDetails:()=>Ae(!0),onConfigure:e=>{X.openConfiguration({automationId:e.automationId,runId:e.id}).then(({conversationId:t})=>{Ae(!1),x(n=>{let r=new URLSearchParams(n);return r.set(`automation`,e.automationId),r.set(`setupChat`,t),r.delete(`run`),r.delete(`view`),r})}).catch(e=>Te(e instanceof Error?e.message:String(e)))}},`${T}:${C}`):!E&&tn&&!tn.management&&tn.action.kind!==`system`?(0,$.jsx)(vt,{automation:tn,conversationId:D,runs:on,language:i,onSelectRun:Vn},tn.id):D?(0,$.jsx)(vt,{conversationId:D,runs:[],language:i,onSelectRun:Vn,onConfigured:Hn},D):!E&&tn?(0,$.jsx)(yn,{automation:tn,runs:on,runsLoading:Et.isLoading,runsError:Et.error?s.feedback.actionFailed:void 0,labels:s,cronLabels:l,language:i,projects:Sn,busyAction:ht,onEdit:Ln,onSelectRun:Vn,onAction:Gn},tn.id):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto`,children:(0,$.jsx)(Dt,{language:i,projectId:N,onOpenConversation:e=>{let t=new URL(e,window.location.origin),n=t.searchParams.get(`setupChat`);x(e=>{let r=new URLSearchParams(e);r.set(`new`,`1`),r.delete(`automation`),r.set(`setupChat`,n);let i=t.searchParams.get(`chatDraft`);return i?r.set(`chatDraft`,i):r.delete(`chatDraft`),r})}},N)})]})]})]}),me?(0,$.jsx)(We,{language:i,projectId:N,onClose:()=>ge(!1),onCreated:e=>{ae(`user`),se(),Hn(e.id)}}):null,_e?(0,$.jsx)(We,{automation:_e,language:i,onClose:()=>ve(null)}):null,(0,$.jsx)(v,{open:G,onOpenChange:e=>{q(e),e||(be(null),Se(!1))},children:(0,$.jsxs)(h,{children:[(0,$.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,$.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,64rem)] -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,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(_,{className:`text-base font-semibold text-fg`,children:J===`draft`?s.draft.title:an?s.editTitle:xe?s.draft.editTitle:s.createTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:J===`draft`?s.draft.subtitle:s.form.createFlowHint})]}),(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(fe,{variant:`ghost`,"aria-label":s.close,children:(0,$.jsx)(ce,{className:`size-4`})})})]}),we?(0,$.jsx)(`p`,{role:`alert`,className:`px-5 py-2 text-sm text-red-700 dark:text-red-300`,children:we}):null,J===`draft`?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,$.jsx)(ln,{labels:s,prompt:Re,draft:Ue,loading:qe,approved:Ye,publishBusy:ht===`draft:publish`,testBusy:ht===`draft:test`,templates:kn,projects:Sn,projectId:Ze,conversationMode:$e,notificationPolicy:rt,onPromptChange:Ve,onGenerate:qn,onEdit:Rn,onPublish:Jn,onTest:Yn,onProjectChange:Qe,onConversationModeChange:tt,onNotificationPolicyChange:it,projectLocked:P,onApprovedChange:Xe,onDiscard:()=>{Ge(null),Xe(!1)},onTemplateSelect:e=>{In(e),Ce({...e.form,projectId:Ze})},onOpenAdvanced:()=>{Ce({...Fe,projectId:Ze,conversationMode:$e,notificationPolicy:rt}),le(`blank`)}})}):(0,$.jsxs)($.Fragment,{children:[Cn?(0,$.jsx)(cn,{form:Z,setForm:Ce,labels:s}):J===`quick`&&V?(0,$.jsx)(Vt,{form:Z,setForm:Ce,labels:s,projects:Sn,projectLocked:P,source:V.source,requiresProject:V.requiresProject}):(0,$.jsx)(On,{form:Z,labels:s,setForm:Ce,projects:Sn,agentOptions:bn,agentsLoading:At.isLoading,defaultAgentId:At.data?.defaultId??``,taskOptions:xn,tasksLoading:jt.isLoading,language:i,projectLocked:P}),Cn||J===`quick`?(0,$.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto px-5 pb-4`,children:(0,$.jsx)(Me,{form:Z,onChange:e=>Ce(t=>({...t,...e})),language:i})}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[J===`quick`?(0,$.jsx)(fe,{variant:`ghost`,onClick:()=>le(`blank`),children:s.draft.advancedCreate}):null,xe?(0,$.jsx)(fe,{variant:`ghost`,onClick:()=>{Se(!1),le(`draft`)},children:s.cancel}):(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(fe,{variant:`ghost`,children:s.cancel})}),(0,$.jsx)(fe,{variant:`primary`,onClick:Wn,disabled:!Dn||!!ht||J===`quick`&&!!V?.requiresProject&&!Z.projectId,children:ht===`automation:create`||ht===`draft:edit`||an&&ht===`automation:${an.id}:edit`?s.feedback.working:an||xe?s.save:s.experience.createEnabled})]})]})]})]})}),(0,$.jsx)(v,{open:Oe&&!!Qt,onOpenChange:e=>{Ae(e),!(e||w)&&x(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,$.jsxs)(h,{children:[(0,$.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,$.jsxs)(g,{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,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:Qt?.automationName??s.dashboard.result}),(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(fe,{variant:`ghost`,"aria-label":s.close,children:(0,$.jsx)(ce,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,$.jsx)(vn,{className:`rounded-none border-0`,run:Qt,events:sn,labels:s,cronLabels:l,language:i,loading:Ot.isLoading,repairDraft:at,repairLoading:ct,repairApproved:ut,busyAction:ht,onRepairApprovedChange:ft,onSuggestRepair:Xn,onApplyRepair:Zn})})]})]})})]})}function cn(e){let t=(0,it.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?s=t[3]:(s=(0,$.jsx)(jn,{title:i.form.trigger}),t[2]=i.form.trigger,t[3]=s);let c;t[4]===o?c=t[5]:(c=e=>o({triggerMode:e.target.value}),t[4]=o,t[5]=c);let l;t[6]===i.trigger.daily?l=t[7]:(l=(0,$.jsx)(A,{value:`daily`,children:i.trigger.daily}),t[6]=i.trigger.daily,t[7]=l);let u;t[8]===i.trigger.weekly?u=t[9]:(u=(0,$.jsx)(A,{value:`weekly`,children:i.trigger.weekly}),t[8]=i.trigger.weekly,t[9]=u);let d;t[10]===i.trigger.interval?d=t[11]:(d=(0,$.jsx)(A,{value:`interval`,children:i.trigger.interval}),t[10]=i.trigger.interval,t[11]=d);let f;t[12]===i.trigger.customCron?f=t[13]:(f=(0,$.jsx)(A,{value:`cron`,children:i.trigger.customCron}),t[12]=i.trigger.customCron,t[13]=f);let p;t[14]!==n.triggerMode||t[15]!==i.form.trigger||t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d||t[20]!==f?(p=(0,$.jsxs)(k,{"aria-label":i.form.trigger,className:An,value:n.triggerMode,onChange:c,children:[l,u,d,f]}),t[14]=n.triggerMode,t[15]=i.form.trigger,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,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(Je,{label:i.form.time,children:(0,$.jsx)(Ze,{value:n.time,onChange:e=>o({time:e}),ariaLabel:i.form.time})}),n.triggerMode===`weekly`?(0,$.jsx)(Je,{label:i.form.day,children:(0,$.jsxs)(k,{className:An,value:n.weekday,onChange:e=>o({weekday:e.target.value}),children:[(0,$.jsx)(A,{value:`1`,children:i.weekdays.monday}),(0,$.jsx)(A,{value:`2`,children:i.weekdays.tuesday}),(0,$.jsx)(A,{value:`3`,children:i.weekdays.wednesday}),(0,$.jsx)(A,{value:`4`,children:i.weekdays.thursday}),(0,$.jsx)(A,{value:`5`,children:i.weekdays.friday}),(0,$.jsx)(A,{value:`6`,children:i.weekdays.saturday}),(0,$.jsx)(A,{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,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,$.jsx)(Je,{label:i.form.intervalEvery,children:(0,$.jsx)(`input`,{className:An,type:`number`,min:`1`,value:n.intervalValue,onChange:e=>o({intervalValue:e.target.value})})}),(0,$.jsx)(Je,{label:i.form.intervalUnits.minute,children:(0,$.jsxs)(k,{className:An,value:n.intervalUnit,onChange:e=>o({intervalUnit:e.target.value}),children:[(0,$.jsx)(A,{value:`minute`,children:i.form.intervalUnits.minute}),(0,$.jsx)(A,{value:`hour`,children:i.form.intervalUnits.hour}),(0,$.jsx)(A,{value:`day`,children:i.form.intervalUnits.day}),(0,$.jsx)(A,{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,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(Je,{label:i.form.expression,children:(0,$.jsx)(`input`,{className:An,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,$.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 ln(e){let t=(0,it.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:m,onGenerate:h,onEdit:g,onPublish:_,onTest:v,onProjectChange:y,onConversationModeChange:b,onNotificationPolicyChange:x,onApprovedChange:S,onDiscard:C,onTemplateSelect:w,onOpenAdvanced:T,projectLocked:E}=e,D=s!==void 0&&s,O=c!==void 0&&c,j=E!==void 0&&E,M=!!(i&&i.simulation.requiredConfirmations.length>0),N;t[0]!==i||t[1]!==n.draft.advancedCreate||t[2]!==n.draft.suggestions||t[3]!==n.draft.suggestionsDescription||t[4]!==n.experience||t[5]!==T||t[6]!==w||t[7]!==l?(N=i?null:(0,$.jsxs)(`div`,{className:`mb-5 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,$.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,$.jsx)(fe,{variant:`ghost`,onClick:T,children:n.draft.advancedCreate})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.map(e=>(0,$.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:()=>w(e),children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description}),(0,$.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]=T,t[6]=w,t[7]=l,t[8]=N):N=t[8];let P;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(se,{className:`size-4 text-accent`}),t[9]=P):P=t[9];let F;t[10]===n.draft.title?F=t[11]:(F=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[P,n.draft.title]}),t[10]=n.draft.title,t[11]=F);let I;t[12]===n.draft.subtitle?I=t[13]:(I=(0,$.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[12]=n.draft.subtitle,t[13]=I);let L;t[14]!==F||t[15]!==I?(L=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[F,I]}),t[14]=F,t[15]=I,t[16]=L):L=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,$.jsx)(se,{className:`size-4`}),t[20]=z):z=t[20];let ee=a?n.draft.generating:n.draft.generate,te;t[21]!==h||t[22]!==ee||t[23]!==R?(te=(0,$.jsxs)(fe,{variant:`primary`,onClick:h,disabled:R,children:[z,ee]}),t[21]=h,t[22]=ee,t[23]=R,t[24]=te):te=t[24];let ie;t[25]!==te||t[26]!==L?(ie=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[L,te]}),t[25]=te,t[26]=L,t[27]=ie):ie=t[27];let ae;t[28]===m?ae=t[29]:(ae=e=>m(e.target.value),t[28]=m,t[29]=ae);let oe;t[30]!==n.draft.placeholder||t[31]!==n.draft.title||t[32]!==r||t[33]!==ae?(oe=(0,$.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:ae,placeholder:n.draft.placeholder}),t[30]=n.draft.placeholder,t[31]=n.draft.title,t[32]=r,t[33]=ae,t[34]=oe):oe=t[34];let B=j?`sm:grid-cols-2`:`sm:grid-cols-3`,V;t[35]===B?V=t[36]:(V=W(`mt-3 grid gap-3`,B),t[35]=B,t[36]=V);let H;t[37]!==n.draft.noProject||t[38]!==n.draft.project||t[39]!==y||t[40]!==d||t[41]!==j||t[42]!==u?(H=j?null:(0,$.jsx)(Je,{label:n.draft.project,children:(0,$.jsxs)(k,{className:An,value:d,onChange:e=>y(e.target.value),children:[(0,$.jsx)(A,{value:``,children:n.draft.noProject}),u.map(un)]})}),t[37]=n.draft.noProject,t[38]=n.draft.project,t[39]=y,t[40]=d,t[41]=j,t[42]=u,t[43]=H):H=t[43];let ce;t[44]===b?ce=t[45]:(ce=e=>b(e.target.value),t[44]=b,t[45]=ce);let U;t[46]===n.draft.newConversation?U=t[47]:(U=(0,$.jsx)(A,{value:`new_session`,children:n.draft.newConversation}),t[46]=n.draft.newConversation,t[47]=U);let G;t[48]===n.draft.continuousConversation?G=t[49]:(G=(0,$.jsx)(A,{value:`continuous`,children:n.draft.continuousConversation}),t[48]=n.draft.continuousConversation,t[49]=G);let K;t[50]!==f||t[51]!==ce||t[52]!==U||t[53]!==G?(K=(0,$.jsxs)(k,{className:An,value:f,onChange:ce,children:[U,G]}),t[50]=f,t[51]=ce,t[52]=U,t[53]=G,t[54]=K):K=t[54];let q;t[55]!==n.draft.conversation||t[56]!==K?(q=(0,$.jsx)(Je,{label:n.draft.conversation,children:K}),t[55]=n.draft.conversation,t[56]=K,t[57]=q):q=t[57];let J;t[58]===x?J=t[59]:(J=e=>x(e.target.value),t[58]=x,t[59]=J);let le;t[60]===n.draft.notifyAttention?le=t[61]:(le=(0,$.jsx)(A,{value:`attention`,children:n.draft.notifyAttention}),t[60]=n.draft.notifyAttention,t[61]=le);let Y;t[62]===n.draft.notifyAll?Y=t[63]:(Y=(0,$.jsx)(A,{value:`all`,children:n.draft.notifyAll}),t[62]=n.draft.notifyAll,t[63]=Y);let ue;t[64]===n.draft.notifyNone?ue=t[65]:(ue=(0,$.jsx)(A,{value:`none`,children:n.draft.notifyNone}),t[64]=n.draft.notifyNone,t[65]=ue);let de;t[66]!==p||t[67]!==J||t[68]!==le||t[69]!==Y||t[70]!==ue?(de=(0,$.jsxs)(k,{className:An,value:p,onChange:J,children:[le,Y,ue]}),t[66]=p,t[67]=J,t[68]=le,t[69]=Y,t[70]=ue,t[71]=de):de=t[71];let pe;t[72]!==n.draft.notifications||t[73]!==de?(pe=(0,$.jsx)(Je,{label:n.draft.notifications,children:de}),t[72]=n.draft.notifications,t[73]=de,t[74]=pe):pe=t[74];let X;t[75]!==V||t[76]!==H||t[77]!==q||t[78]!==pe?(X=(0,$.jsxs)(`div`,{className:V,children:[H,q,pe]}),t[75]=V,t[76]=H,t[77]=q,t[78]=pe,t[79]=X):X=t[79];let me;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]!==S||t[96]!==C||t[97]!==g||t[98]!==_||t[99]!==v||t[100]!==D||t[101]!==M||t[102]!==O?(me=i?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,$.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,$.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,$.jsx)(En,{label:n.info.when,value:i.simulation.triggerSummary}),(0,$.jsx)(En,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,$.jsx)(dn,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,$.jsx)(dn,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,$.jsx)(dn,{title:n.draft.risks,items:i.risks,empty:n.none}),M?(0,$.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>S(e.target.checked)}),(0,$.jsx)(`span`,{children:n.draft.approval})]}):null,(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(fe,{variant:`ghost`,onClick:C,children:n.draft.discard}),(0,$.jsxs)(fe,{variant:`secondary`,onClick:g,children:[(0,$.jsx)(ne,{className:`size-4`}),n.draft.edit]}),(0,$.jsxs)(fe,{variant:`secondary`,onClick:v,disabled:O||D||M&&!o,children:[(0,$.jsx)(re,{className:`size-4`}),O?n.draft.testing:n.draft.testOnce]}),(0,$.jsx)(fe,{variant:`primary`,onClick:_,disabled:D||M&&!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]=S,t[96]=C,t[97]=g,t[98]=_,t[99]=v,t[100]=D,t[101]=M,t[102]=O,t[103]=me):me=t[103];let he;return t[104]!==ie||t[105]!==oe||t[106]!==X||t[107]!==me||t[108]!==N?(he=(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[N,ie,oe,X,me]}),t[104]=ie,t[105]=oe,t[106]=X,t[107]=me,t[108]=N,t[109]=he):he=t[109],he}function un(e){return(0,$.jsx)(A,{value:e.id,children:e.name},e.id)}function dn(e){let t=(0,it.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.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(fn):(0,$.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,$.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,$.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function fn(e){return(0,$.jsxs)(`li`,{children:[`- `,e]},e)}function pn(e){let t=(0,it.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=W(`shrink-0`,l),t[0]=l,t[1]=u);let d;t[2]!==n||t[3]!==u?(d=(0,$.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,$.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`,m;t[7]===p?m=t[8]:(m=W(`ml-auto truncate text-sm font-semibold tabular-nums`,p),t[7]=p,t[8]=m);let h;t[9]!==m||t[10]!==i?(h=(0,$.jsx)(`span`,{className:m,children:i}),t[9]=m,t[10]=i,t[11]=h):h=t[11];let g;t[12]!==d||t[13]!==f||t[14]!==h?(g=(0,$.jsxs)($.Fragment,{children:[d,f,h]}),t[12]=d,t[13]=f,t[14]=h,t[15]=g):g=t[15];let _=g,v=o&&`bg-accent/8`,y=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`,b;t[16]!==v||t[17]!==y?(b=W(`flex min-h-12 min-w-0 items-center gap-2.5 bg-surface-base px-3 py-2.5 text-left transition-colors`,v,y),t[16]=v,t[17]=y,t[18]=b):b=t[18];let x=b,S=`${r}: ${i}`,C;return t[19]!==S||t[20]!==o||t[21]!==x||t[22]!==_||t[23]!==s?(C=s?(0,$.jsx)(`button`,{type:`button`,className:x,onClick:s,"aria-label":S,"aria-pressed":o,children:_}):(0,$.jsx)(`div`,{className:x,"aria-label":S,children:_}),t[19]=S,t[20]=o,t[21]=x,t[22]=_,t[23]=s,t[24]=C):C=t[24],C}function mn(e){let t=(0,it.c)(74),{runs:n,ownership:r,labels:i,language:a,unreadCount:o,loading:s,onOwnershipChange:c,onRefresh:l,onSelectRun:u}=e,d;t[0]===n?d=t[1]:(d=n.filter(Zt),t[0]=n,t[1]=d);let f=d.length,p;t[2]===n?p=t[3]:(p=n.filter(Qt),t[2]=n,t[3]=p);let m=p.length,h;t[4]===i.dashboard.activity?h=t[5]:(h=(0,$.jsx)(`h2`,{id:`automation-activity-title`,className:`text-sm font-semibold text-fg`,children:i.dashboard.activity}),t[4]=i.dashboard.activity,t[5]=h);let g;t[6]===i.dashboard.activityDescription?g=t[7]:(g=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.dashboard.activityDescription}),t[6]=i.dashboard.activityDescription,t[7]=g);let _;t[8]!==h||t[9]!==g?(_=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=i.filters.ownership,b=r===`user`&&`bg-surface-base text-fg shadow-sm`,x;t[11]===b?x=t[12]:(x=W(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,b),t[11]=b,t[12]=x);let S;t[13]===c?S=t[14]:(S=()=>c(`user`),t[13]=c,t[14]=S);let C=r===`user`,w;t[15]!==i.filters.userManaged||t[16]!==C||t[17]!==x||t[18]!==S?(w=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,"aria-pressed":C,children:i.filters.userManaged}),t[15]=i.filters.userManaged,t[16]=C,t[17]=x,t[18]=S,t[19]=w):w=t[19];let T=r===`system`&&`bg-surface-base text-fg shadow-sm`,E;t[20]===T?E=t[21]:(E=W(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,T),t[20]=T,t[21]=E);let D;t[22]===c?D=t[23]:(D=()=>c(`system`),t[22]=c,t[23]=D);let O=r===`system`,k;t[24]!==i.system.title||t[25]!==E||t[26]!==D||t[27]!==O?(k=(0,$.jsx)(`button`,{type:`button`,className:E,onClick:D,"aria-pressed":O,children:i.system.title}),t[24]=i.system.title,t[25]=E,t[26]=D,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==i.filters.ownership||t[30]!==w||t[31]!==k?(A=(0,$.jsxs)(me,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":v,indicatorClassName:`rounded-md bg-surface-base shadow-sm`,children:[w,k]}),t[29]=i.filters.ownership,t[30]=w,t[31]=k,t[32]=A):A=t[32];let N;t[33]!==i.refresh||t[34]!==s||t[35]!==l?(N=(0,$.jsx)(he,{className:`size-9 shrink-0 p-0`,loading:s,label:i.refresh,onClick:l}),t[33]=i.refresh,t[34]=s,t[35]=l,t[36]=N):N=t[36];let P;t[37]!==A||t[38]!==N?(P=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,N]}),t[37]=A,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==P||t[41]!==_?(F=(0,$.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:[_,P]}),t[40]=P,t[41]=_,t[42]=F):F=t[42];let I;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[43]=I):I=t[43];let L=i.metrics.total,R=String(n.length),z;t[44]!==i.metrics.total||t[45]!==R?(z=(0,$.jsx)(pn,{icon:I,label:L,value:R}),t[44]=i.metrics.total,t[45]=R,t[46]=z):z=t[46];let ee;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[47]=ee):ee=t[47];let te=i.metrics.running,ne=String(f),ie;t[48]!==i.metrics.running||t[49]!==ne?(ie=(0,$.jsx)(pn,{icon:ee,label:te,value:ne}),t[48]=i.metrics.running,t[49]=ne,t[50]=ie):ie=t[50];let ae;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),t[51]=ae):ae=t[51];let oe=i.dashboard.needsAttention,B=String(m),se=m>0?`danger`:`default`,V;t[52]!==i.dashboard.needsAttention||t[53]!==B||t[54]!==se?(V=(0,$.jsx)(pn,{icon:ae,label:oe,value:B,tone:se}),t[52]=i.dashboard.needsAttention,t[53]=B,t[54]=se,t[55]=V):V=t[55];let H;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[56]=H):H=t[56];let ce=i.filters.unread,U=String(o),G;t[57]!==i.filters.unread||t[58]!==U?(G=(0,$.jsx)(pn,{icon:H,label:ce,value:U}),t[57]=i.filters.unread,t[58]=U,t[59]=G):G=t[59];let K;t[60]!==z||t[61]!==ie||t[62]!==V||t[63]!==G?(K=(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-b border-edge-subtle bg-edge-subtle lg:grid-cols-4`,children:[z,ie,V,G]}),t[60]=z,t[61]=ie,t[62]=V,t[63]=G,t[64]=K):K=t[64];let q;t[65]!==i||t[66]!==a||t[67]!==u||t[68]!==n?(q=n.length===0?(0,$.jsx)(Dn,{className:`min-h-64 rounded-none border-0 shadow-none`,icon:(0,$.jsx)(y,{className:`size-5`}),title:i.empty.runs}):(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>(0,$.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:()=>u(e.id),children:[(0,$.jsx)(`span`,{className:W(`mt-1.5 size-2 shrink-0 rounded-full`,Zt(e)?`bg-blue-500`:Qt(e)?`bg-red-500`:`bg-emerald-500`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName}),e.readAtMs==null&&!Zt(e)?(0,$.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,$.jsx)(`span`,{className:W(`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,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:Gt(e.createdAtMs,i,a)})]}),(0,$.jsx)(`span`,{className:W(`shrink-0 rounded-full px-2 py-0.5 text-xs`,Yt(e.status)),children:i.status[e.status]})]},e.id))}),t[65]=i,t[66]=a,t[67]=u,t[68]=n,t[69]=q):q=t[69];let J;return t[70]!==F||t[71]!==K||t[72]!==q?(J=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,"aria-labelledby":`automation-activity-title`,children:[F,K,q]}),t[70]=F,t[71]=K,t[72]=q,t[73]=J):J=t[73],J}function hn(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 gn(e){let t=(0,it.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,Q.useState)(a!==void 0&&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(`
5
5
  `),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(`