@xopcai/xopc 0.0.159 → 0.0.161
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{action-boundary-settings-panel-CaRK2vIy.js → action-boundary-settings-panel-BIVBUiNT.js} +1 -1
- package/dist/gateway/static/root/assets/activity-store-o7GRljfD.js +1 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BeVf03hx.js → agent-avatar-dicebear-9R3szLMc.js} +1 -1
- package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +2 -0
- package/dist/gateway/static/root/assets/{api-BjcBIV2O.js → api-jSTqFMq9.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BG2ulMYw.js → app-management-settings-panel-D81cyE76.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-0Kjenr2T.js → appearance-settings-Ct6bZQCV.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-ChiNnH1e.js → archive-plugin-CfD7AZKn.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-pbBlQR-g.js → attachment-load-CP_Gaxt3.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CTZDOyDy.js → automation-suggestion-card-BGKM_NDZ.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BeZGzpGF.js → binary-plugins-IPr2EVnS.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BnDmhN5Z.js → block-editor-B6aHEGA6.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-Ii36j_7v.js → capability-presets-api-CCX9-LjU.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Cl3dw4yh.js → capability-presets-settings-panel-Dva9SiPK.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-CFqrSi5K.js → channel-recipient-api-MmLMLDWf.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +1 -0
- package/dist/gateway/static/root/assets/check-DUBLcKHA.js +1 -0
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +1 -0
- package/dist/gateway/static/root/assets/cn-JdwAhgNB.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-CiLxuZ8S.js → connector-logo-BbjzIs87.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +2 -0
- package/dist/gateway/static/root/assets/createLucideIcon-DPHK1VkS.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-CYH5ZSXy.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-DQLqGLc0.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-DTqXSpqf.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CC2VL5Mc.js → directory-picker-path-field-ClsiXhmz.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-KY7ZfVsy.js → dreaming-settings-CjMPPdzg.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-C8KBeucs.js → extension-debug-page-57eizjhB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CV-5Kcyk.js → extension-page-CsbSb3u1.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DvUtDrAu.js → extension-settings-page-DKA9-lyP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DXfVeJLc.js → gateway-config-api-DIPJuzBZ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CDLqAQY7.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-cxQ94qMm.js → gateway-startup-retry-DrfSJtvT.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-P8VhLqYF.js → goals-config-api-lGC10UkU.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DHXyaH_O.js → goals-settings-BWq0pdrA.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CNckP_Dv.js → heartbeat-settings-D4o8BJVv.js} +1 -1
- package/dist/gateway/static/root/assets/index-CkUHH170.css +1 -0
- package/dist/gateway/static/root/assets/index-vq_cJZJC.js +199 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-jXmv1RVX.js → keyboard-shortcuts-settings-6T2QYehS.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Cs5LKjtc.js → local-apps-page-DCjg2K9f.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-C_M71MK9.js → locale-store-Dar-xqQr.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CyYCBqym.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-BFqeSNte.js → markdown-split-rt1XO43g.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Cc8379gq.js → media-plugins-Bwo8CJuh.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CxySDn9d.js +5 -0
- package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +2 -0
- package/dist/gateway/static/root/assets/{notes-page-DlGU4ipo.js → notes-page-Dp-pkX7d.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-kFOswGlG.js → page-tabs-CzZ4iKOb.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CvjuvABg.js → preview-open-alternatives-3E_Qa-58.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-B2T48Sbt.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-DwrD7ODx.js → save-bar-controls-CkeKasGm.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Ba4WzTmE.js → schedule-field-TkqUL3wm.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DvydL8eF.js → schema-form-DC-iU5IG.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-LaQqGGej.js → settings-collapsible-section-Dpqth3oA.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DruI__qO.js → settings-form-section-CNqF6IwY.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-UvA-eDhF.js → settings-loading-skeleton-DkvwitK_.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DG-XMIPu.js → settings-page-layout-DWvNgISx.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-5oCGSebm.js → settings-page-qPG7I2zd.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-FLVeTrRt.js → share-preview-page-DGpSPW-n.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CeK93xVi.js → system-settings-panel-8TxxSbUw.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-C8ohIHhw.js → theme-store-B5FzMWOx.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-D1Lr2gG0.js → typed-models-lib-DEGtSA5h.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BWzou5ar.js → use-channel-catalog-BDU6FneG.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bynqe4kV.js → workflow-run-setup-panel-Cwi8Pz7n.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +11 -0
- package/dist/gateway/static/root/index.html +12 -10
- package/dist/package.js +1 -1
- package/dist/src/automations/service/action-executor.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.d.ts +1 -0
- package/dist/src/gateway/chat-stream/mapper.js +43 -7
- package/dist/src/gateway/hono/routes/home.js +15 -2
- package/dist/src/gateway/hono/routes/work-discovery.js +451 -0
- package/dist/src/gateway/hono/sse.d.ts +2 -0
- package/dist/src/gateway/hono/sse.js +10 -3
- package/dist/src/gateway/run-loop.js +17 -7
- package/dist/src/gateway/server.d.ts +1 -0
- package/dist/src/gateway/server.js +9 -0
- package/dist/src/gateway/service.d.ts +2 -0
- package/dist/src/gateway/service.js +27 -2
- package/dist/src/local-apps/preview-runtime-bridge.d.ts +1 -1
- package/dist/src/local-apps/preview-runtime-bridge.js +14 -11
- package/dist/src/mobile/notification-service.js +1 -0
- package/dist/src/pets/factory.js +23 -26
- package/dist/src/pets/manifest.d.ts +2 -1
- package/dist/src/pets/manifest.js +15 -8
- package/dist/src/pets/validator.js +8 -3
- package/dist/src/proactive/calendar-signals.d.ts +4 -0
- package/dist/src/proactive/calendar-signals.js +120 -0
- package/dist/src/proactive/focus-service.d.ts +62 -0
- package/dist/src/proactive/focus-service.js +173 -0
- package/dist/src/proactive/index.d.ts +7 -0
- package/dist/src/proactive/index.js +7 -0
- package/dist/src/proactive/insight-repository.d.ts +19 -0
- package/dist/src/proactive/insight-repository.js +106 -0
- package/dist/src/proactive/run-processor.d.ts +19 -0
- package/dist/src/proactive/run-processor.js +125 -0
- package/dist/src/proactive/trial-expiry-reconciler.d.ts +5 -0
- package/dist/src/proactive/trial-expiry-reconciler.js +30 -0
- package/dist/src/proactive/types.d.ts +64 -0
- package/dist/src/proactive/types.js +1 -0
- package/dist/src/proactive/watch-repository.d.ts +28 -0
- package/dist/src/proactive/watch-repository.js +129 -0
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +4 -0
- package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +16 -0
- package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +40 -0
- package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +52 -0
- package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +15 -0
- package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +26 -0
- package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +25 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/work-discovery/analyzer.d.ts +12 -1
- package/dist/src/work-discovery/analyzer.js +126 -7
- package/dist/src/work-discovery/candidate-discovery.d.ts +17 -0
- package/dist/src/work-discovery/candidate-discovery.js +279 -0
- package/dist/src/work-discovery/evaluation.d.ts +11 -0
- package/dist/src/work-discovery/evaluation.js +17 -0
- package/dist/src/work-discovery/governance.d.ts +25 -0
- package/dist/src/work-discovery/governance.js +96 -0
- package/dist/src/work-discovery/incremental-repository.d.ts +13 -0
- package/dist/src/work-discovery/incremental-repository.js +55 -0
- package/dist/src/work-discovery/incremental.d.ts +2 -0
- package/dist/src/work-discovery/incremental.js +7 -0
- package/dist/src/work-discovery/index.d.ts +10 -0
- package/dist/src/work-discovery/index.js +13 -3
- package/dist/src/work-discovery/investigation-repository.d.ts +16 -0
- package/dist/src/work-discovery/investigation-repository.js +122 -0
- package/dist/src/work-discovery/investigator.d.ts +55 -0
- package/dist/src/work-discovery/investigator.js +358 -0
- package/dist/src/work-discovery/probe.d.ts +22 -0
- package/dist/src/work-discovery/probe.js +88 -1
- package/dist/src/work-discovery/service.d.ts +110 -1
- package/dist/src/work-discovery/service.js +578 -8
- package/dist/src/work-discovery/source-repository.d.ts +13 -0
- package/dist/src/work-discovery/source-repository.js +72 -0
- package/dist/src/work-discovery/thread-repository.d.ts +34 -0
- package/dist/src/work-discovery/thread-repository.js +112 -0
- package/dist/src/work-discovery/thread-service.d.ts +8 -0
- package/dist/src/work-discovery/thread-service.js +104 -0
- package/dist/src/work-discovery/types.d.ts +145 -0
- package/package.json +1 -1
- package/skills/creative/hatch-pet/SKILL.md +2 -2
- package/dist/gateway/static/root/assets/activity-store-C-57rvkX.js +0 -1
- package/dist/gateway/static/root/assets/agents-P05C4A-3.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-DANGrBpN.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BXfGL_cm.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-534luV0B.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-M91zFJVi.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vooEF4lG.js +0 -1
- package/dist/gateway/static/root/assets/check-BODqo66o.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-RzVebuX2.js +0 -1
- package/dist/gateway/static/root/assets/cn-BQ_8x0bT.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CV5UulW6.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-Cil2eSpW.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DwsC6l5F.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-sprite-DqZ6fbIj.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BpJ0v56l.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-lMHD-2CX.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-yPmF-G7b.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BHTCKobG.js +0 -2
- package/dist/gateway/static/root/assets/index-BgZhEOkN.css +0 -1
- package/dist/gateway/static/root/assets/index-BuqGh2SW.js +0 -193
- package/dist/gateway/static/root/assets/local-app-workbench-page-zpp_wciE.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-B4CRYqYR.js +0 -7
- package/dist/gateway/static/root/assets/messages-BuT0SR1R.js +0 -5
- package/dist/gateway/static/root/assets/models-hub-panel-1hdoAoB_.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-DQEAZTA5.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-Bp9bC7A6.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-RNorFXTw.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BqRTcM_6.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B2EfW1cm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CklL85T4.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D3my1HgB.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DVxgjrsP.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bcu58ZaF.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CDd-84FE.js +0 -2
- package/dist/gateway/static/root/assets/sliding-segmented-uWmrxE3P.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-1OyJnTyR.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-B2ncRwHS.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BZlY4PZL.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DPXMrneY.js +0 -1
- package/dist/gateway/static/root/assets/work-page-CTERoqyv.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CLgsnqFQ.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{l as n}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as r}from"./cn-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{l as n}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-CxySDn9d.js";import{n as a}from"./locale-store-Dar-xqQr.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{Qs as s,Ss as c,b as l,ru as u,tl as d,v as f,x as p,y as m}from"./index-vq_cJZJC.js";var h=e(),g=t();function _(e){let t=(0,h.c)(45),{title:p,description:_,prompt:x,coverage:S,className:C,variant:w}=e,T=w===void 0?`card`:w,E=a(b),D=i(E).automations.suggestions,O=i(E).automations,k=n(),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=A):A=t[0];let{data:j}=o(S?`automation-suggestion-coverage`:null,y,A),M=S?j?.automations.find(e=>l(e,S)):void 0,N=M?f(M,O):[];if(T===`titleAction`){if(M){let e;t[1]===C?e=t[2]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,C),t[1]=C,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let i;return t[4]===k?i=t[5]:(i=()=>k(`/automations`),t[4]=k,t[5]=i),(0,g.jsxs)(`section`,{className:e,children:[n,(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:D.coveredTitle}),(0,g.jsx)(c,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:i,children:D.manage})]})}let e;t[6]===C?e=t[7]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,C),t[6]=C,t[7]=e);let n;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(d,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=n):n=t[8];let i;t[9]!==_||t[10]!==p?(i=(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:_,children:p}),t[9]=_,t[10]=p,t[11]=i):i=t[11];let a;t[12]!==k||t[13]!==x?(a=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[12]=k,t[13]=x,t[14]=a):a=t[14];let o;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,g.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t[15]=o):o=t[15],(0,g.jsxs)(`section`,{className:e,children:[n,i,(0,g.jsxs)(c,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:a,children:[o,D.create]})]})}if(M){let e;t[16]===C?e=t[17]:(e=r(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,C),t[16]=C,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let i;t[19]===k?i=t[20]:(i=()=>k(`/automations`),t[19]=k,t[20]=i);let a;return t[21]!==D||t[22]!==i?(a=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsx)(c,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:i,children:D.manage})}),t[21]=D,t[22]=i,t[23]=a):a=t[23],(0,g.jsxs)(`section`,{className:e,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:D.coveredTitle}),(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:m(D.coveredDescription,{name:M.name})})]})]}),(0,g.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:O.explain.whyCovered}),(0,g.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:N.map(v)})]}),a]})}let P;t[24]===C?P=t[25]:(P=r(`rounded-lg bg-surface-panel p-3 shadow-surface`,C),t[24]=C,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=F):F=t[26];let I;t[27]===p?I=t[28]:(I=(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:p}),t[27]=p,t[28]=I);let L;t[29]===_?L=t[30]:(L=(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:_}),t[29]=_,t[30]=L);let R;t[31]!==I||t[32]!==L?(R=(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[I,L]})]}),t[31]=I,t[32]=L,t[33]=R):R=t[33];let z;t[34]!==k||t[35]!==x?(z=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[34]=k,t[35]=x,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,g.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t[37]=B):B=t[37];let V;t[38]!==D.create||t[39]!==z?(V=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsxs)(c,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:z,children:[B,D.create]})}),t[38]=D.create,t[39]=z,t[40]=V):V=t[40];let H;return t[41]!==V||t[42]!==P||t[43]!==R?(H=(0,g.jsxs)(`section`,{className:P,children:[R,V]}),t[41]=V,t[42]=P,t[43]=R,t[44]=H):H=t[44],H}function v(e){return(0,g.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function y(){return p.list()}function b(e){return e.language}export{_ as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./circle-alert-BEjgurr2.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-CxySDn9d.js";import{n as l}from"./locale-store-Dar-xqQr.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$o as d,Ac as f,Ar as p,Bi as m,Bo as h,Du as g,Fl as _,Ho as v,Jc as y,Ka as b,Ko as x,Oc as ee,Qi as S,Qs as C,Ro as w,Rs as T,Sc as E,Ss as D,Ts as O,Uc as k,Uo as A,Wo as te,Xa as j,au as ne,bo as re,cu as ie,gi as ae,hc as M,hi as oe,mi as se,nc as ce,pi as le,ru as ue,su as de,ts as N,vi as fe,wc as P,ws as F,x as I,xl as L,yt as pe,zo as me}from"./index-vq_cJZJC.js";import{t as R}from"./format-cron-label-arqgGlVV.js";import{a as he,i as ge,n as z,r as B,t as _e}from"./workflow-run-setup-panel-Cwi8Pz7n.js";var V=e(t(),1),H=n(),U=1e3,W=60*U,G=60*W,ve=24*G,ye=7*ve,be=new Intl.ListFormat(`en-US`,{type:`conjunction`}),K=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),xe={en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},Se={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Ce={minute:W,hour:G,day:ve,week:ye};function q(e){return e===`zh`?`zh-CN`:`en-US`}function we(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:K[String(t)].format(e)}function Te(e,t){return t===`zh`?e.join(` `):be.format(e)}function Ee(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(W,Math.round((Number.isFinite(n)&&n>0?n:1)*Ce[t]))}function De(e,t,n){let r=typeof e==`number`?e:Number.parseFloat(e),i=Number.isFinite(r)&&r>0?r:1;return String(Number.parseFloat((i*Ce[t]/Ce[n]).toFixed(6)))}function Oe(e,t){let n=Math.max(U,Math.round(e)),r=n===ve?[{unit:`hour`,ms:G}]:n>=ye&&n%ye===0?[{unit:`week`,ms:ye}]:n>=ve?[{unit:`day`,ms:ve},{unit:`hour`,ms:G},{unit:`minute`,ms:W},{unit:`second`,ms:U}]:n>=G?[{unit:`hour`,ms:G},{unit:`minute`,ms:W},{unit:`second`,ms:U}]:n>=W?[{unit:`minute`,ms:W},{unit:`second`,ms:U}]:[{unit:`second`,ms:U}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(we(r,e,t)),i%=n)}return Te(a,t)}function ke(e,t){let n=Oe(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function Ae(e,t){return xe[t].format(new Date(e))}function je(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function J(e,t,n=Date.now()){let r=new Date(e),i=Math.round((je(r)-je(new Date(n)))/ve),a=Se[t].format(r);return i===0?t===`zh`?`今天 ${a}`:`today at ${a}`:i===1?t===`zh`?`明天 ${a}`:`tomorrow at ${a}`:i===-1?t===`zh`?`昨天 ${a}`:`yesterday at ${a}`:Ae(e,t)}function Me(e,t){return e.eventType===`goal.status_changed`&&e.payloadMatch?.status===`blocked`?t.trigger.goalBlockedWhen:e.eventType===`note.created`?t.trigger.noteCreatedWhen:e.eventType===`workflow.run.completed`&&e.payloadMatch?.status===`failed`?t.trigger.workflowFailedWhen:e.eventType===`session.transcript.updated`?t.trigger.sessionUpdatedWhen:t.trigger.eventWithType.replace(`{type}`,e.eventType)}function Ne(e,t,n,r){if(e.kind===`manual`)return t.trigger.manualWhen;if(e.kind===`webhook`)return t.trigger.webhookWhen;if(e.kind===`event`)return Me(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,J(Date.parse(i.at),r)):i.kind===`interval`?ke(i.everyMs,r):R(i.expr,q(r),n.scheduleBadge,{timezone:i.tz})}function Y(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?J(e.state.nextRunAtMs,n,r):e.trigger.kind===`manual`?t.info.noAutomaticTrigger:e.trigger.kind===`event`||e.trigger.kind===`webhook`?t.info.waitingForTrigger:t.info.noUpcomingRun:t.info.pausedNoAutomaticRuns}function Pe(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=J(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var X={name:``,description:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,safetyMode:`suggest_only`,timeoutSeconds:`300`,afterRunMode:`none`,webhookUrl:``,disableAfterFailures:`3`},Fe=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function Ie(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`goalBlocked`)o={kind:`event`,eventType:`goal.status_changed`,source:`goals`,payloadMatch:{status:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Ee(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=B(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.safetyMode===`auto_apply`?e.afterRunMode:`none`,u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{},timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300)}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300)};return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},trigger:o,action:u,safety:{mode:e.safetyMode},afterRun:l===`webhook`?{kind:`webhook`,url:e.webhookUrl.trim()}:{kind:l},reliability:{timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function Le(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:X.time,weekday:X.weekday,cronExpr:e}}function Re(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function ze(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function Be(e){let t=e.payloadMatch;return e.eventType===`goal.status_changed`&&e.source===`goals`&&t?.status===`blocked`?{triggerMode:`goalBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function Ve(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function He(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function Ue(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=Be(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=Le(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...Re(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:ze(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?Ve(r.input):{},o=e.afterRun??{kind:`none`},s=r.timeoutSeconds??e.reliability?.timeoutSeconds??300;return{...X,...n,name:e.name,description:e.description??``,actionMode:r.kind,agentId:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?z(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(s),afterRunMode:o.kind,webhookUrl:o.kind===`webhook`?o.url:``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function We(e,t,n){let r=Ie(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;return e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId}:e.action.kind===`workflow`&&r.action.kind===`workflow`&&(a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}),{...r,description:t.description.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function Ge(e,t,n){return e?Ae(e,n):t.never}function Ke(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function qe(e){return e.safety?.mode??`auto_apply`}function Je(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`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function Ye(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 Xe(e){return e.status===`running`||e.status===`queued`}function Ze(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function Qe(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function $e(e){return!!Qe(e)}function et(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function tt(e){return Xe(e)?0:Ze(e)?1:e.status===`succeeded`?2:3}function nt(e){return[...e].sort((e,t)=>{let n=tt(e)-tt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function rt(e){let t=(0,H.c)(5),n;t[0]===e?n=t[1]:(n=()=>typeof window>`u`?!1:window.matchMedia(e).matches,t[0]=e,t[1]=n);let[r,i]=(0,V.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),n=()=>i(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,V.useEffect)(a,o),r}function it(){let e=(0,H.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Z.jsx)(j,{className:`h-4 w-36`}),(0,Z.jsx)(j,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(j,{className:`h-7 w-20 rounded-full`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[t,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(at)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(j,{className:`h-4 w-32`}),i=(0,Z.jsx)(j,{className:`mt-4 h-24 rounded-lg`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[n,(0,Z.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[r,i,(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,Z.jsx)(j,{className:`h-12 rounded-lg`}),(0,Z.jsx)(j,{className:`h-12 rounded-lg`}),(0,Z.jsx)(j,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function at(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(j,{className:`size-4 rounded-full`}),(0,Z.jsx)(j,{className:`h-4 w-32`}),(0,Z.jsx)(j,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(j,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(j,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(j,{className:`h-8 w-24 rounded-md`})]})},t)}function ot(){let e=l(e=>e.language),t=c(e),n=t.automations,r=t.cron,a=re(e=>e.setPageHeader),o=re(e=>e.clearPageHeader),[d,f]=i(),p=d.get(`run`)?.trim()??``,m=d.get(`automation`)?.trim()??``,g=d.get(`draft`)?.trim()??``,_=d.get(`action`)?.trim()??``,y=d.get(`projectId`)?.trim()??``,ee=d.get(`autogenerate`)===`1`,C=d.get(`insight`)?.trim()??``,T=(0,V.useRef)(``),k=rt(`(min-width: 1280px)`),[j,ne]=(0,V.useState)(`activity`),[ie,M]=(0,V.useState)(!1),[ce,ue]=(0,V.useState)(`blank`),[de,N]=(0,V.useState)(null),[P,F]=(0,V.useState)(!1),[L,R]=(0,V.useState)(X),[he,z]=(0,V.useState)(null),[B,_e]=(0,V.useState)(null),[H,U]=(0,V.useState)(!1),[W,G]=(0,V.useState)(null),[ve,ye]=(0,V.useState)(``),[be,K]=(0,V.useState)(null),[xe,Se]=(0,V.useState)(!1),[Ce,q]=(0,V.useState)(!1),[we,Te]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(!1),[Oe,ke]=(0,V.useState)(!1),[Ae,je]=(0,V.useState)(!1),[J,Me]=(0,V.useState)(null),Ne=u([`automations`,y],()=>I.list(y?{projectId:y}:void 0),{refreshInterval:15e3}),Y=u([`automation-runs`,y],()=>I.runs(50,void 0,y?{projectId:y}:void 0),{refreshInterval:1e4}),Pe=u(`automation-metrics`,()=>I.metrics(),{refreshInterval:15e3}),Fe=u(B?`automation-run-events:${B}`:null,()=>I.runEvents(B),{refreshInterval:5e3}),Le=u(`automation-workflow-definitions`,pe),Re=u(`automation-chat-agents`,b),ze=Ne.isLoading&&!Ne.data||Y.isLoading&&!Y.data||Pe.isLoading&&!Pe.data,Be=Ne.data?.automations??[],Ve=(0,V.useMemo)(()=>nt(Y.data?.runs??[]),[Y.data?.runs]),Ke=(0,V.useMemo)(()=>Be.filter(e=>!$e(e)),[Be]),qe=(0,V.useMemo)(()=>Be.filter($e),[Be]),Je=(0,V.useMemo)(()=>new Set(qe.map(e=>e.id)),[qe]),Ye=(0,V.useMemo)(()=>Ve.filter(e=>!Je.has(e.automationId)),[Ve,Je]),Xe=(0,V.useMemo)(()=>{let e;for(let t of Ke){let n=t.state.nextRunAtMs;n&&(e==null||n<e)&&(e=n)}return e},[Ke]),Qe=(0,V.useMemo)(()=>Ve.find(e=>e.id===B)??null,[Ve,B]),et=(0,V.useMemo)(()=>Be.find(e=>e.id===W)??null,[Be,W]),tt=(0,V.useMemo)(()=>Be.find(e=>e.id===de)??null,[Be,de]),at=(0,V.useMemo)(()=>Ve.filter(e=>e.automationId===W),[Ve,W]),ot=Fe.data?.events??[],lt=(0,V.useMemo)(()=>Ye.filter(Ze),[Ye]),ut=Ye[0]??null,pt=(0,V.useMemo)(()=>Le.data??[],[Le.data]),mt=Re.data?.items??[],ht=(0,V.useMemo)(()=>pt.find(e=>e.id===L.workflowId.trim())??null,[L.workflowId,pt]),vt=L.actionMode===`workflow`&&(!L.workflowId.trim()||pt.length>0&&!pt.some(e=>e.id===L.workflowId)),yt=L.actionMode===`workflow`&&ht?!ge(ht,L.workflowInput,L.workflowInputValid).valid:!1,bt=!!L.name.trim()&&(L.triggerMode!==`once`||Number.isFinite(new Date(L.onceAt).getTime()))&&(L.triggerMode!==`event`||!!L.eventType.trim()&&He(L.eventPayloadMatch))&&(L.actionMode===`workflow`?!vt&&!yt:!!L.instruction.trim())&&(L.afterRunMode!==`webhook`||!!L.webhookUrl.trim()),xt=(0,V.useMemo)(()=>[{name:n.templates.dailyAgent.name,description:n.templates.dailyAgent.description,form:{...X,name:n.templates.dailyAgent.name,instruction:n.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:n.templates.morningWorkflow.name,description:n.templates.morningWorkflow.description,form:{...X,name:n.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:pt[0]?.id??``}},{name:n.templates.webhookAgent.name,description:n.templates.webhookAgent.description,form:{...X,name:n.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:n.templates.blockedGoal.name,description:n.templates.blockedGoal.description,form:{...X,name:n.templates.blockedGoal.formName,triggerMode:`goalBlocked`,instruction:n.templates.blockedGoal.instruction}},{name:n.templates.noteCreated.name,description:n.templates.noteCreated.description,form:{...X,name:n.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:n.templates.noteCreated.instruction}}],[n,pt]);(0,V.useEffect)(()=>{j!==`activity`||Ye.length===0||B&&Ye.some(e=>e.id===B)||_e(Ye[0].id)},[B,Ye,j]);let St=(0,V.useCallback)(async()=>{await Promise.all([Ne.mutate(),Y.mutate(),Pe.mutate(),Fe.mutate()])},[Ne.mutate,Pe.mutate,Fe.mutate,Y.mutate]),Ct=(0,V.useCallback)(e=>{N(null),F(!1),ue(e),M(!0),e===`blank`&&R(X)},[]),wt=(0,V.useCallback)(e=>{R(Ue(e,pt)),N(e.id),F(!1),G(null),ue(`blank`),M(!0)},[pt]),Tt=(0,V.useCallback)(()=>{be&&(R(Ue(be.automation,pt)),N(null),F(!0),ue(`blank`))},[be,pt]),Dt=(0,V.useCallback)(async()=>{je(!0),z(null);try{await St()}catch(e){let t=e instanceof Error?e.message:String(e);z(t),x({type:`error`,title:n.feedback.actionFailed,message:t})}finally{je(!1)}},[n.feedback.actionFailed,St]);(0,V.useEffect)(()=>{p&&(ne(`activity`),_e(p),k||U(!0))},[p,k]),(0,V.useEffect)(()=>{if(!m)return;let e=Be.find(e=>e.id===m);e&&(ne($e(e)?`system`:`automations`),G(e.id),f(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[m,Be,f]),(0,V.useEffect)(()=>{k&&U(!1)},[k]),(0,V.useEffect)(()=>{_===`create`&&(Ct(`blank`),f(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[_,Ct,f]),(0,V.useEffect)(()=>{if(!g)return;let t=`${e}:${ee?`auto`:`seed`}:${g}`;T.current!==t&&(T.current=t,ye(g),K(null),q(!1),ue(`draft`),M(!0),f(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t.delete(`insight`),t},{replace:!0}),ee&&(z(null),Se(!0),I.draft({prompt:g,language:e}).then(e=>{K(e.draft),q(!1),C&&I.completeInsightDraft(C)}).catch(e=>{z(e instanceof Error?e.message:String(e))}).finally(()=>{Se(!1)})))},[ee,g,C,e,f]);let Q=(0,V.useCallback)(e=>{_e(e),k||U(!0),f(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[f,k]);(0,V.useEffect)(()=>{Te(null),ke(!1)},[B]);async function $(){if(z(null),bt){if(P&&be){Me(`draft:edit`);try{let e=Ie(L,ht),{simulation:t}=await I.simulate(e);K({...be,automation:e,simulation:t}),q(!1),F(!1),ue(`draft`)}catch(e){let t=e instanceof Error?e.message:String(e);z(t),x({type:`error`,title:n.feedback.actionFailed,message:t})}finally{Me(null)}return}if(tt){let e=tt.id;await Ot(`automation:${e}:edit`,()=>I.update(e,We(tt,L,ht)))&&(M(!1),N(null),G(e));return}try{await I.create({...Ie(L,ht),...y?{projectId:y}:{}}),R(X),M(!1),await St()}catch(e){let t=e instanceof Error?e.message:String(e);z(t),x({type:`error`,title:n.feedback.actionFailed,message:t})}}}async function Ot(e,t){z(null),Me(e);try{return await t(),await St(),!0}catch(e){let t=e instanceof Error?e.message:String(e);return z(t),x({type:`error`,title:n.feedback.actionFailed,message:t}),!1}finally{Me(null)}}async function kt(){let t=ve.trim();if(t){z(null),Se(!0);try{K((await I.draft({prompt:t,language:e})).draft),q(!1)}catch(e){z(e instanceof Error?e.message:String(e))}finally{Se(!1)}}}async function At(){be&&await Ot(`draft:publish`,async()=>{await I.create({...be.automation,...y?{projectId:y}:{}}),K(null),ye(``),q(!1),M(!1)})}async function jt(t){z(null),De(!0),Te(null),ke(!1);try{Te((await I.repairDraft(t.id,{language:e})).repair)}catch(e){z(e instanceof Error?e.message:String(e))}finally{De(!1)}}async function Mt(e){we&&await Ot(`run:${e.id}:repair`,async()=>{await I.update(e.automationId,we.patch),Te(null),ke(!1)})}let Nt=(0,V.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(S,{className:`size-9 shrink-0 p-0`,loading:Ae,label:n.refresh,onClick:Dt}),(0,Z.jsxs)(ae,{children:[(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(D,{variant:`primary`,children:[(0,Z.jsx)(E,{className:`size-4`}),n.new]})}),(0,Z.jsx)(oe,{children:(0,Z.jsxs)(le,{align:`end`,className:`z-70 min-w-52 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsx)(se,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>Ct(`draft`),children:n.createMenu.draft}),(0,Z.jsx)(se,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>Ct(`template`),children:n.createMenu.template}),(0,Z.jsx)(se,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>Ct(`blank`),children:n.createMenu.blank})]})})]})]}),[n.createMenu.blank,n.createMenu.draft,n.createMenu.template,n.new,n.refresh,Ct,Ae,Dt]);return(0,V.useLayoutEffect)(()=>(a({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:Nt}),()=>o()),[o,Nt,n.subtitle,n.title,a]),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,Z.jsx)(st,{label:n.dashboard.needsAttention,value:lt.length,tone:lt.length>0?`danger`:`neutral`}),(0,Z.jsx)(st,{label:n.metrics.running,value:Ye.filter(e=>e.status===`running`).length}),(0,Z.jsx)(st,{label:n.dashboard.latestResult,value:ut?n.status[ut.status]:n.none,tone:ut&&Ze(ut)?`danger`:`neutral`}),(0,Z.jsx)(st,{label:n.metrics.next,value:Xe?Ge(Xe,n,e):n.none})]}),(0,Z.jsx)(`nav`,{className:`inline-flex w-fit rounded-lg border border-edge bg-surface-panel p-1`,children:[{id:`activity`,label:n.dashboard.activity,count:Ye.length},{id:`automations`,label:n.dashboard.manage,count:Ke.length},{id:`system`,label:n.system.title,count:qe.length}].map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:s(`inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted`,j===e.id&&`bg-surface-hover text-fg`),onClick:()=>{ne(e.id),e.id!==`activity`&&U(!1)},children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`rounded-full border border-edge/70 px-1.5 py-0.5 text-[0.6875rem] leading-none text-fg-muted`,children:e.count})]},e.id))}),he?(0,Z.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:he}):null,ze?(0,Z.jsx)(it,{}):j===`activity`?(0,Z.jsxs)(`section`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(18rem,22rem)_minmax(0,1fr)]`,children:[(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(ft,{runs:Ye.slice(0,12),labels:n,cronLabels:r,language:e,selectedRunId:B,busyAction:J,className:`h-auto`,onSelectRun:Q,onAction:Ot})}),(0,Z.jsx)(gt,{className:`hidden xl:sticky xl:top-4 xl:block`,run:Qe,events:ot,labels:n,cronLabels:r,language:e,loading:Fe.isLoading,repairDraft:we,repairLoading:Ee,repairApproved:Oe,busyAction:J,onRepairApprovedChange:ke,onSuggestRepair:jt,onApplyRepair:Mt})]}):j===`automations`?(0,Z.jsx)(`section`,{children:(0,Z.jsx)(dt,{automations:Ke,runs:Ye,labels:n,cronLabels:r,language:e,busyAction:J,onOpenDetails:G,onAction:Ot})}):(0,Z.jsx)(`section`,{children:(0,Z.jsx)(dt,{automations:qe,runs:Ve,labels:n,cronLabels:r,language:e,busyAction:J,readOnly:!0,onOpenDetails:G,onAction:Ot})})]}),(0,Z.jsx)(w,{open:ie,onOpenChange:e=>{M(e),e||(N(null),F(!1))},children:(0,Z.jsxs)(A,{children:[(0,Z.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(h,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(te,{className:`text-base font-semibold text-fg`,children:ce===`draft`?n.draft.title:ce===`template`?n.createMenu.templatesTitle:tt?n.editTitle:P?n.draft.editTitle:n.createTitle}),(0,Z.jsx)(me,{asChild:!0,children:(0,Z.jsx)(D,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(O,{className:`size-4`})})})]}),ce===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(ct,{labels:n,prompt:ve,draft:be,loading:xe,approved:Ce,publishBusy:J===`draft:publish`,onPromptChange:ye,onGenerate:kt,onEdit:Tt,onPublish:At,onApprovedChange:q,onDiscard:()=>{K(null),q(!1)}})}):ce===`template`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:xt.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-lg bg-surface-base p-4 text-left hover:bg-surface-hover`,onClick:()=>{R(e.form),ue(`blank`)},children:[(0,Z.jsx)(`div`,{className:`font-medium text-fg`,children:e.name}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:e.description})]},e.name))})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Et,{form:L,labels:n,setForm:R,workflowDefinitions:pt,selectedWorkflow:ht,workflowsLoading:Le.isLoading,agentOptions:mt,agentsLoading:Re.isLoading,language:e}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[P?(0,Z.jsx)(D,{variant:`ghost`,onClick:()=>{F(!1),ue(`draft`)},children:n.cancel}):(0,Z.jsx)(me,{asChild:!0,children:(0,Z.jsx)(D,{variant:`ghost`,children:n.cancel})}),(0,Z.jsx)(D,{variant:`primary`,onClick:$,disabled:!bt||J===`draft:edit`||!!(tt&&J),children:J===`draft:edit`||tt&&J===`automation:${tt.id}:edit`?n.feedback.working:tt||P?n.save:n.create})]})]})]})]})}),(0,Z.jsx)(_t,{automation:et,runs:at,labels:n,cronLabels:r,language:e,busyAction:J,onClose:()=>G(null),onSelectRun:e=>{Q(e),G(null)},onEdit:wt,onAction:Ot}),(0,Z.jsx)(w,{open:!k&&H&&!!Qe,onOpenChange:U,children:(0,Z.jsxs)(A,{children:[(0,Z.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(h,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(te,{className:`truncate text-base font-semibold text-fg`,children:Qe?.automationName??n.dashboard.result}),(0,Z.jsx)(me,{asChild:!0,children:(0,Z.jsx)(D,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(O,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(gt,{className:`rounded-none border-0`,run:Qe,events:ot,labels:n,cronLabels:r,language:e,loading:Fe.isLoading,repairDraft:we,repairLoading:Ee,repairApproved:Oe,busyAction:J,onRepairApprovedChange:ke,onSuggestRepair:jt,onApplyRepair:Mt})})]})]})})]})}function st(e){let t=(0,H.c)(13),{label:n,value:r,tone:i}=e,a=i===void 0?`neutral`:i,o=a===`danger`&&`bg-red-500/10`,c;t[0]===o?c=t[1]:(c=s(`rounded-lg border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,o),t[0]=o,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[2]=n,t[3]=l);let u=a===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,d;t[4]===u?d=t[5]:(d=s(`mt-1 truncate text-lg font-semibold`,u),t[4]=u,t[5]=d);let f;t[6]!==d||t[7]!==r?(f=(0,Z.jsx)(`div`,{className:d,children:r}),t[6]=d,t[7]=r,t[8]=f):f=t[8];let p;return t[9]!==c||t[10]!==l||t[11]!==f?(p=(0,Z.jsxs)(`div`,{className:c,children:[l,f]}),t[9]=c,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function ct(e){let t=(0,H.c)(49),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,onPromptChange:c,onGenerate:l,onEdit:u,onPublish:d,onApprovedChange:f,onDiscard:p}=e,m=s===void 0?!1:s,h=!!(i&&i.simulation.requiredConfirmations.length>0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(C,{className:`size-4 text-accent`}),t[0]=g):g=t[0];let _;t[1]===n.draft.title?_=t[2]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[g,n.draft.title]}),t[1]=n.draft.title,t[2]=_);let v;t[3]===n.draft.subtitle?v=t[4]:(v=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=v);let y;t[5]!==_||t[6]!==v?(y=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[_,v]}),t[5]=_,t[6]=v,t[7]=y):y=t[7];let b;t[8]!==a||t[9]!==r?(b=a||!r.trim(),t[8]=a,t[9]=r,t[10]=b):b=t[10];let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(C,{className:`size-4`}),t[11]=x):x=t[11];let S=a?n.draft.generating:n.draft.generate,w;t[12]!==l||t[13]!==b||t[14]!==S?(w=(0,Z.jsxs)(D,{variant:`primary`,onClick:l,disabled:b,children:[x,S]}),t[12]=l,t[13]=b,t[14]=S,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[y,w]}),t[16]=y,t[17]=w,t[18]=T):T=t[18];let E;t[19]===c?E=t[20]:(E=e=>c(e.target.value),t[19]=c,t[20]=E);let O;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==E?(O=(0,Z.jsx)(`textarea`,{className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:E,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=E,t[24]=O):O=t[24];let k;t[25]!==o||t[26]!==i||t[27]!==n.draft.approval||t[28]!==n.draft.assumptions||t[29]!==n.draft.discard||t[30]!==n.draft.edit||t[31]!==n.draft.publish||t[32]!==n.draft.review||t[33]!==n.draft.risks||t[34]!==n.draft.safety||t[35]!==n.feedback||t[36]!==n.info||t[37]!==n.none||t[38]!==f||t[39]!==p||t[40]!==u||t[41]!==d||t[42]!==m||t[43]!==h?(k=i?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,Z.jsx)(wt,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(wt,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,Z.jsx)(lt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(lt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(lt,{title:n.draft.risks,items:i.risks,empty:n.none}),h?(0,Z.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>f(e.target.checked)}),(0,Z.jsx)(`span`,{children:n.draft.approval})]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(D,{variant:`ghost`,onClick:p,children:n.draft.discard}),(0,Z.jsxs)(D,{variant:`secondary`,onClick:u,children:[(0,Z.jsx)(ee,{className:`size-4`}),n.draft.edit]}),(0,Z.jsx)(D,{variant:`primary`,onClick:d,disabled:m||h&&!o,children:m?n.feedback.working:n.draft.publish})]})]})]}):null,t[25]=o,t[26]=i,t[27]=n.draft.approval,t[28]=n.draft.assumptions,t[29]=n.draft.discard,t[30]=n.draft.edit,t[31]=n.draft.publish,t[32]=n.draft.review,t[33]=n.draft.risks,t[34]=n.draft.safety,t[35]=n.feedback,t[36]=n.info,t[37]=n.none,t[38]=f,t[39]=p,t[40]=u,t[41]=d,t[42]=m,t[43]=h,t[44]=k):k=t[44];let A;return t[45]!==T||t[46]!==O||t[47]!==k?(A=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[T,O,k]}),t[45]=T,t[46]=O,t[47]=k,t[48]=A):A=t[48],A}function lt(e){let t=(0,H.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(ut):(0,Z.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function ut(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function dt(e){let t=(0,H.c)(24),{automations:n,runs:r,labels:i,cronLabels:a,language:o,busyAction:c,readOnly:l,onOpenDetails:u,onAction:d}=e,p=l===void 0?!1:l;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(F,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.automations?n=t[2]:(n=(0,Z.jsx)(Tt,{icon:e,title:i.empty.automations}),t[1]=i.empty.automations,t[2]=n),n}let m;if(t[3]!==n||t[4]!==c||t[5]!==a||t[6]!==i||t[7]!==o||t[8]!==d||t[9]!==u||t[10]!==p||t[11]!==r){let e;t[13]!==c||t[14]!==a||t[15]!==i||t[16]!==o||t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==r?(e=e=>{let t=et(e),n=r.filter(t=>t.automationId===e.id),l=n.find(Xe),m=n[0],h=c===`automation:${e.id}:run`,g=c===`automation:${e.id}:toggle`,_=c===`automation:${e.id}:delete`;return(0,Z.jsxs)(`article`,{className:`flex min-h-44 cursor-pointer flex-col rounded-lg border border-edge-subtle bg-surface-base p-3.5 shadow-surface outline-none transition-colors hover:bg-surface-hover`,role:`button`,tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&u(e.id)},children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.name}),l?(0,Z.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`}):null]}),t?(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:t}):null]}),(0,Z.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?i.enabled:i.paused})]}),(0,Z.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase text-fg-muted`,children:i.info.when}),(0,Z.jsx)(`span`,{className:`truncate`,children:Ne(e.trigger,i,a,o)})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg-muted`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase`,children:i.info.run}),(0,Z.jsx)(`span`,{className:`truncate`,children:Ke(e.action,i)})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`span`,{children:[i.last,`: `,Ge(e.state.lastRunAtMs,i,o)]}),(0,Z.jsxs)(`span`,{children:[i.next,`: `,Ge(e.state.nextRunAtMs,i,o)]}),(0,Z.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5`,Je(e.state.lastRunStatus)),children:e.state.lastRunStatus?i.status[e.state.lastRunStatus]:i.status.notRun}),m?.error?(0,Z.jsx)(`p`,{className:`basis-full line-clamp-1 text-red-700 dark:text-red-300`,children:m.error}):null]}),p?null:(0,Z.jsx)(`div`,{className:`mt-auto flex justify-end pt-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(D,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":i.dashboard.runNow,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:run`,()=>I.runNow(e.id),i.feedback.rerunQueued)},children:(0,Z.jsx)(P,{className:s(`size-4`,h&&`animate-pulse`)})}),(0,Z.jsx)(D,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":e.enabled?i.dashboard.pause:i.dashboard.resume,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:toggle`,()=>e.enabled?I.pause(e.id):I.resume(e.id),e.enabled?i.feedback.paused:i.dashboard.resumed)},children:g?(0,Z.jsx)(M,{className:`size-4 animate-spin`}):e.enabled?(0,Z.jsx)(f,{className:`size-4`}):(0,Z.jsx)(P,{className:`size-4`})}),(0,Z.jsx)(D,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":i.dashboard.delete,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:delete`,()=>I.remove(e.id),i.dashboard.deleted)},children:_?(0,Z.jsx)(M,{className:`size-4 animate-spin`}):(0,Z.jsx)(T,{className:`size-4`})})]})})]},e.id)},t[13]=c,t[14]=a,t[15]=i,t[16]=o,t[17]=d,t[18]=u,t[19]=p,t[20]=r,t[21]=e):e=t[21],m=n.map(e),t[3]=n,t[4]=c,t[5]=a,t[6]=i,t[7]=o,t[8]=d,t[9]=u,t[10]=p,t[11]=r,t[12]=m}else m=t[12];let h;return t[22]===m?h=t[23]:(h=(0,Z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:m}),t[22]=m,t[23]=h),h}function ft(e){let t=(0,H.c)(25),{runs:n,labels:r,cronLabels:i,language:a,selectedRunId:o,busyAction:c,className:l,onSelectRun:u,onAction:d}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(g,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===r.empty.runs?n=t[2]:(n=(0,Z.jsx)(Tt,{icon:e,title:r.empty.runs}),t[1]=r.empty.runs,t[2]=n),n}let f;t[3]===l?f=t[4]:(f=s(`overflow-hidden rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,l),t[3]=l,t[4]=f);let p;if(t[5]!==c||t[6]!==i||t[7]!==r||t[8]!==a||t[9]!==d||t[10]!==u||t[11]!==n||t[12]!==o){let e;t[14]!==c||t[15]!==i||t[16]!==r||t[17]!==a||t[18]!==d||t[19]!==u||t[20]!==o?(e=e=>(0,Z.jsxs)(`div`,{className:s(`grid cursor-pointer gap-3 border-b border-edge p-4 outline-none last:border-b-0 hover:bg-surface-hover md:grid-cols-[1fr_auto]`,o===e.id&&`bg-surface-hover`),role:`button`,tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&u(e.id)},children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.automationName}),(0,Z.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-xs`,Je(e.status)),children:r.status[e.status]}),e.workflowRunId?(0,Z.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[r.workflowPrefix,` `,e.workflowRunId.slice(0,8)]}):null]}),(0,Z.jsx)(`div`,{className:s(`mt-1 line-clamp-2 whitespace-pre-line text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||(Xe(e)?r.runDetail.resultPending:r.runDetail.noResult)}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[Ge(e.createdAtMs,r,a),` · `,e.manual?r.trigger.manual:Ne(e.triggerSnapshot,r,i,a)]})]}),e.status===`running`||e.status===`queued`?(0,Z.jsx)(D,{variant:`ghost`,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`run:${e.id}:cancel`,()=>I.cancelRun(e.id),r.dashboard.cancelled)},children:c===`run:${e.id}:cancel`?r.feedback.working:r.cancel}):null]},e.id),t[14]=c,t[15]=i,t[16]=r,t[17]=a,t[18]=d,t[19]=u,t[20]=o,t[21]=e):e=t[21],p=n.map(e),t[5]=c,t[6]=i,t[7]=r,t[8]=a,t[9]=d,t[10]=u,t[11]=n,t[12]=o,t[13]=p}else p=t[13];let m;return t[22]!==f||t[23]!==p?(m=(0,Z.jsx)(`div`,{className:f,children:p}),t[22]=f,t[23]=p,t[24]=m):m=t[24],m}function pt(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`after_run.started`:return n.afterRunStarted;case`after_run.completed`:return n.afterRunCompleted;case`after_run.failed`:return n.afterRunFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function mt(e){let t=(0,H.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,c]=(0,V.useState)(a===void 0?!1:a),l;t[0]===n?l=t[1]:(l=JSON.stringify(n,null,2),t[0]=n,t[1]=l);let u=l,d;t[2]===u?d=t[3]:(d=u.split(`
|
|
2
|
+
`),t[2]=u,t[3]=d);let f=d.length,p=u.length>720||f>18,m;t[4]!==p||t[5]!==u?(m=p?`${u.split(`
|
|
3
|
+
`).slice(0,10).join(`
|
|
4
|
+
`).trimEnd()}...`:u,t[4]=p,t[5]=u,t[6]=m):m=t[6];let h=m,g;t[7]!==o||t[8]!==p||t[9]!==r||t[10]!==i?(g=p?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(ht),"aria-expanded":o,children:[(0,Z.jsx)(`span`,{children:i}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,Z.jsx)(de,{className:s(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=p,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=o||!p?u:h,v;t[12]===_?v=t[13]:(v=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let y;return t[14]!==g||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=y):y=t[16],y}function ht(e){return!e}function gt(e){let t=(0,H.c)(148),{className:n,run:r,events:i,labels:c,cronLabels:l,language:u,loading:d,repairDraft:f,repairLoading:p,repairApproved:h,busyAction:_,onRepairApprovedChange:v,onSuggestRepair:b,onApplyRepair:x}=e;if(!r){let e;t[0]===n?e=t[1]:(e=s(`flex min-h-64 flex-col justify-center rounded-lg border border-edge-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(g,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===c.selectRun?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`mt-2`,children:c.selectRun}),t[3]=c.selectRun,t[4]=i);let a;return t[5]!==e||t[6]!==i?(a=(0,Z.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=a):a=t[7],a}let ee=r.error||r.summary,S=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,w=r.sessionKey?c.runDetail.openConversation:c.runDetail.openWorkflow,T=r.sessionKey?k:L,E=Xe(r)?g:Ze(r)?o:ue,O;t[8]===n?O=t[9]:(O=s(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=O);let A;t[10]===r.automationName?A=t[11]:(A=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=A);let te;t[12]===r.id?te=t[13]:(te=r.id.slice(0,8),t[12]=r.id,t[13]=te);let re;t[14]===te?re=t[15]:(re=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:te}),t[14]=te,t[15]=re);let ie;t[16]!==A||t[17]!==re?(ie=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[A,re]}),t[16]=A,t[17]=re,t[18]=ie):ie=t[18];let ae;t[19]===r.status?ae=t[20]:(ae=s(`shrink-0 rounded-full px-2 py-0.5 text-xs`,Je(r.status)),t[19]=r.status,t[20]=ae);let M=c.status[r.status],oe;t[21]!==ae||t[22]!==M?(oe=(0,Z.jsx)(`span`,{className:ae,children:M}),t[21]=ae,t[22]=M,t[23]=oe):oe=t[23];let se;t[24]!==ie||t[25]!==oe?(se=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[ie,oe]}),t[24]=ie,t[25]=oe,t[26]=se):se=t[26];let ce;t[27]!==c||t[28]!==u||t[29]!==r.createdAtMs?(ce=Ge(r.createdAtMs,c,u),t[27]=c,t[28]=u,t[29]=r.createdAtMs,t[30]=ce):ce=t[30];let le;t[31]===ce?le=t[32]:(le=(0,Z.jsx)(`span`,{children:ce}),t[31]=ce,t[32]=le);let N;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=N):N=t[33];let fe=c.details.duration,P;t[34]!==c||t[35]!==r.durationMs?(P=Ye(r.durationMs,c),t[34]=c,t[35]=r.durationMs,t[36]=P):P=t[36];let F;t[37]!==c.details.duration||t[38]!==P?(F=(0,Z.jsxs)(`span`,{children:[fe,` `,P]}),t[37]=c.details.duration,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==le||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[le,N,F]}),t[40]=le,t[41]=F,t[42]=I):I=t[42];let pe;t[43]!==c.repair||t[44]!==b||t[45]!==p||t[46]!==r?(pe=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(D,{variant:`secondary`,onClick:()=>b(r),disabled:p,children:[(0,Z.jsx)(C,{className:`size-4`}),p?c.repair.generating:c.repair.suggest]})}):null,t[43]=c.repair,t[44]=b,t[45]=p,t[46]=r,t[47]=pe):pe=t[47];let me;t[48]!==I||t[49]!==pe||t[50]!==se?(me=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[se,I,pe]}),t[48]=I,t[49]=pe,t[50]=se,t[51]=me):me=t[51];let R;t[52]===r?R=t[53]:(R=Xe(r)?`text-blue-500`:Ze(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=R);let he;t[54]===R?he=t[55]:(he=s(`size-4`,R),t[54]=R,t[55]=he);let ge;t[56]!==E||t[57]!==he?(ge=(0,Z.jsx)(E,{className:he}),t[56]=E,t[57]=he,t[58]=ge):ge=t[58];let z;t[59]!==c.runDetail.resultTitle||t[60]!==ge?(z=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[ge,c.runDetail.resultTitle]}),t[59]=c.runDetail.resultTitle,t[60]=ge,t[61]=z):z=t[61];let B;t[62]!==T||t[63]!==w||t[64]!==S?(B=S?(0,Z.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:S,children:[(0,Z.jsx)(T,{className:`size-3.5`}),w,(0,Z.jsx)(ne,{className:`size-3.5`})]})}):null,t[62]=T,t[63]=w,t[64]=S,t[65]=B):B=t[65];let _e;t[66]!==z||t[67]!==B?(_e=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[z,B]}),t[66]=z,t[67]=B,t[68]=_e):_e=t[68];let V=r.error&&`border-red-500/25 bg-red-500/5`,U;t[69]===V?U=t[70]:(U=s(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,V),t[69]=V,t[70]=U);let W;t[71]!==c.runDetail.noResult||t[72]!==c.runDetail.resultPending||t[73]!==ee||t[74]!==r?(W=ee?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:ee}):(0,Z.jsx)(m,{content:ee,compact:!0,className:`text-sm`,openHttpLinksInNewTab:!0}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:Xe(r)?c.runDetail.resultPending:c.runDetail.noResult}),t[71]=c.runDetail.noResult,t[72]=c.runDetail.resultPending,t[73]=ee,t[74]=r,t[75]=W):W=t[75];let G;t[76]!==U||t[77]!==W?(G=(0,Z.jsx)(`div`,{className:U,children:W}),t[76]=U,t[77]=W,t[78]=G):G=t[78];let ve;t[79]!==_e||t[80]!==G?(ve=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[_e,G]}),t[79]=_e,t[80]=G,t[81]=ve):ve=t[81];let ye;t[82]===c.runDetail.runInfo?ye=t[83]:(ye=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:c.runDetail.runInfo}),t[82]=c.runDetail.runInfo,t[83]=ye);let be;t[84]!==l||t[85]!==c||t[86]!==u||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(be=r.manual?c.trigger.manual:Ne(r.triggerSnapshot,c,l,u),t[84]=l,t[85]=c,t[86]=u,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=be):be=t[89];let K;t[90]!==c.explain.whyRan||t[91]!==be?(K=(0,Z.jsx)(St,{label:c.explain.whyRan,value:be}),t[90]=c.explain.whyRan,t[91]=be,t[92]=K):K=t[92];let xe=c.details.started,Se;t[93]!==c||t[94]!==u||t[95]!==r.startedAtMs?(Se=Ge(r.startedAtMs,c,u),t[93]=c,t[94]=u,t[95]=r.startedAtMs,t[96]=Se):Se=t[96];let Ce;t[97]!==c.details.started||t[98]!==Se?(Ce=(0,Z.jsx)(St,{label:xe,value:Se}),t[97]=c.details.started,t[98]=Se,t[99]=Ce):Ce=t[99];let q;t[100]!==c.details.model||t[101]!==r.model?(q=r.model?(0,Z.jsx)(St,{label:c.details.model,value:r.model}):null,t[100]=c.details.model,t[101]=r.model,t[102]=q):q=t[102];let we;t[103]!==K||t[104]!==Ce||t[105]!==q?(we=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[K,Ce,q]}),t[103]=K,t[104]=Ce,t[105]=q,t[106]=we):we=t[106];let Te;t[107]!==ye||t[108]!==we?(Te=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ye,we]}),t[107]=ye,t[108]=we,t[109]=Te):Te=t[109];let Ee;t[110]!==_||t[111]!==c||t[112]!==x||t[113]!==v||t[114]!==h||t[115]!==f||t[116]!==r?(Ee=f?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:c.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:f.explanation}),f.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:f.expectedEffect}):null,(0,Z.jsx)(lt,{title:c.repair.risks,items:f.risks,empty:c.none}),(0,Z.jsx)(mt,{value:f.patch,labels:c,title:c.details.repairPatch}),f.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:h,onChange:e=>v(e.target.checked)}),(0,Z.jsx)(`span`,{children:c.repair.approval})]}):null,(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsx)(D,{variant:`primary`,onClick:()=>x(r),disabled:_===`run:${r.id}:repair`||f.requiresApproval&&!h,children:_===`run:${r.id}:repair`?c.feedback.working:c.repair.apply})})]}):null,t[110]=_,t[111]=c,t[112]=x,t[113]=v,t[114]=h,t[115]=f,t[116]=r,t[117]=Ee):Ee=t[117];let De;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(y,{className:`size-4 shrink-0`}),t[118]=De):De=t[118];let Oe;t[119]===c.runDetail.technicalEvents?Oe=t[120]:(Oe=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[De,c.runDetail.technicalEvents]}),t[119]=c.runDetail.technicalEvents,t[120]=Oe);let ke;t[121]!==i.length||t[122]!==c.runDetail.eventCount?(ke=c.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=c.runDetail.eventCount,t[123]=ke):ke=t[123];let Ae;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(de,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=Ae):Ae=t[124];let je;t[125]===ke?je=t[126]:(je=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[ke,Ae]}),t[125]=ke,t[126]=je);let J;t[127]!==Oe||t[128]!==je?(J=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[Oe,je]}),t[127]=Oe,t[128]=je,t[129]=J):J=t[129];let Me;t[130]===c.runDetail.technicalEventsDescription?Me=t[131]:(Me=(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:c.runDetail.technicalEventsDescription}),t[130]=c.runDetail.technicalEventsDescription,t[131]=Me);let Y;t[132]!==i||t[133]!==c||t[134]!==u||t[135]!==d?(Y=(0,Z.jsx)(`div`,{className:`mt-4`,children:d?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":c.loading,children:[(0,Z.jsx)(j,{className:`h-10 w-full`}),(0,Z.jsx)(j,{className:`h-10 w-4/5`}),(0,Z.jsx)(j,{className:`h-10 w-11/12`})]}):i.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-fg-muted`,children:c.empty.events}):(0,Z.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,Z.jsx)(`span`,{className:s(`mt-1 size-2 rounded-full`,Ct(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:pt(e,c)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[Ge(e.createdAtMs,c,u),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[c.details.eventData,(0,Z.jsx)(de,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,Z.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=c,t[134]=u,t[135]=d,t[136]=Y):Y=t[136];let Pe;t[137]!==J||t[138]!==Me||t[139]!==Y?(Pe=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[J,Me,Y]}),t[137]=J,t[138]=Me,t[139]=Y,t[140]=Pe):Pe=t[140];let X;return t[141]!==O||t[142]!==me||t[143]!==ve||t[144]!==Te||t[145]!==Ee||t[146]!==Pe?(X=(0,Z.jsxs)(`aside`,{className:O,children:[me,ve,Te,Ee,Pe]}),t[141]=O,t[142]=me,t[143]=ve,t[144]=Te,t[145]=Ee,t[146]=Pe,t[147]=X):X=t[147],X}function _t(e){let t=(0,H.c)(23),{automation:n,runs:r,labels:i,cronLabels:o,language:c,busyAction:l,onClose:u,onEdit:d,onSelectRun:p,onAction:m}=e,y=n?l===`automation:${n.id}:run`:!1,b=n?l===`automation:${n.id}:toggle`:!1,x=n?l===`automation:${n.id}:delete`:!1,S=!!n,C;t[0]===u?C=t[1]:(C=e=>!e&&u(),t[0]=u,t[1]=C);let E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[2]=E):E=t[2];let k;t[3]!==n||t[4]!==l||t[5]!==o||t[6]!==x||t[7]!==i||t[8]!==c||t[9]!==m||t[10]!==u||t[11]!==d||t[12]!==p||t[13]!==y||t[14]!==r||t[15]!==b?(k=n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(te,{className:`truncate text-base font-semibold text-fg`,children:n.name}),n.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:n.description}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-xs`,n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:n.enabled?i.enabled:i.paused}),(0,Z.jsx)(me,{asChild:!0,children:(0,Z.jsx)(D,{variant:`ghost`,"aria-label":i.close,children:(0,Z.jsx)(O,{className:`size-4`})})})]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[20rem_1fr]`,children:[(0,Z.jsx)(yt,{automation:n,labels:i,cronLabels:o,language:c}),(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length})]}),r.length===0?(0,Z.jsx)(Tt,{icon:(0,Z.jsx)(g,{className:`size-5`}),title:i.empty.runs}):(0,Z.jsx)(`div`,{className:`grid gap-2`,children:r.map(e=>(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left outline-none`,onClick:()=>p(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,Z.jsx)(ue,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(g,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:Ge(e.createdAtMs,i,c)}),(0,Z.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-xs`,Je(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.error||e.summary||Ke(e.actionSnapshot,i)})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[e.sessionKey?(0,Z.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,Z.jsxs)(a,{to:`/chat/${encodeURIComponent(e.sessionKey)}`,children:[(0,Z.jsx)(_,{className:`size-3.5`}),i.dashboard.openSession]})}):null,e.workflowRunId?(0,Z.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,Z.jsxs)(a,{to:`/workflows?run=${encodeURIComponent(e.workflowRunId)}`,children:[(0,Z.jsx)(L,{className:`size-3.5`}),i.feedback.workflow]})}):null]})]})},e.id))})]})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsxs)(D,{variant:`ghost`,disabled:l!==null,onClick:()=>void m(`automation:${n.id}:delete`,()=>I.remove(n.id),i.dashboard.deleted).then(e=>{e&&u()}),children:[x?(0,Z.jsx)(M,{className:`size-4 animate-spin`}):(0,Z.jsx)(T,{className:`size-4`}),i.dashboard.delete]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[$e(n)?null:(0,Z.jsxs)(D,{variant:`secondary`,disabled:l!==null,onClick:()=>d(n),children:[(0,Z.jsx)(ee,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(D,{variant:`secondary`,disabled:l!==null,onClick:()=>void m(`automation:${n.id}:toggle`,()=>n.enabled?I.pause(n.id):I.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[b?(0,Z.jsx)(M,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(f,{className:`size-4`}):(0,Z.jsx)(P,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(D,{variant:`primary`,disabled:l!==null,onClick:()=>void m(`automation:${n.id}:run`,()=>I.runNow(n.id),i.feedback.rerunQueued),children:[y?(0,Z.jsx)(M,{className:`size-4 animate-spin`}):(0,Z.jsx)(P,{className:`size-4`}),i.dashboard.runNow]})]})]})]}):null,t[3]=n,t[4]=l,t[5]=o,t[6]=x,t[7]=i,t[8]=c,t[9]=m,t[10]=u,t[11]=d,t[12]=p,t[13]=y,t[14]=r,t[15]=b,t[16]=k):k=t[16];let j;t[17]===k?j=t[18]:(j=(0,Z.jsxs)(A,{children:[E,(0,Z.jsx)(h,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,56rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:k})]}),t[17]=k,t[18]=j);let ne;return t[19]!==S||t[20]!==C||t[21]!==j?(ne=(0,Z.jsx)(w,{open:S,onOpenChange:C,children:j}),t[19]=S,t[20]=C,t[21]=j,t[22]=ne):ne=t[22],ne}function vt(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function yt(e){let t=(0,H.c)(127),{automation:n,labels:r,cronLabels:i,language:a}=e,o,s,c,l,u,d,f,p,m,h,_;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=qe(n),g;t[15]!==n||t[16]!==r||t[17]!==a?(g=Y(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=g):g=t[18];let v=g,y;t[19]!==n.state.nextRunAtMs||t[20]!==a?(y=n.state.nextRunAtMs?Ae(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=y):y=t[21];let b=y;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(_=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],_.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],_.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=Ae(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],_.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],_.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],_.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],_.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],_.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],_.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],_.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=_}else _=t[39];m=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?h=t[71]:(h=(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=h),d=`grid gap-4 p-4`;let x;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[72]=x):x=t[72];let ee=r.info.schedule,S;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(S=Ne(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=S):S=t[77];let C=n.enabled?`${r.info.nextRun}:${v}`:v;t[78]!==r.info.schedule||t[79]!==b||t[80]!==S||t[81]!==C?(f=(0,Z.jsx)(xt,{icon:x,label:ee,value:S,description:C,descriptionTitle:b}),t[78]=r.info.schedule,t[79]=b,t[80]=S,t[81]=C,t[82]=f):f=t[82];let w;t[83]===n.action.kind?w=t[84]:(w=n.action.kind===`workflow`?(0,Z.jsx)(L,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=w);let T=r.info.action,E;t[85]!==n.action||t[86]!==r?(E=Ke(n.action,r),t[85]=n.action,t[86]=r,t[87]=E):E=t[87],t[88]!==r.info.action||t[89]!==w||t[90]!==E?(p=(0,Z.jsx)(xt,{icon:w,label:T,value:E}),t[88]=r.info.action,t[89]=w,t[90]=E,t[91]=p):p=t[91],o=xt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),t[92]=s):s=t[92],c=r.info.permission,l=r.safety[e],u=vt(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=_}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],_=t[14];let v;t[93]!==o||t[94]!==s||t[95]!==c||t[96]!==l||t[97]!==u?(v=(0,Z.jsx)(o,{icon:s,label:c,value:l,description:u}),t[93]=o,t[94]=s,t[95]=c,t[96]=l,t[97]=u,t[98]=v):v=t[98];let y;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[99]=y):y=t[99];let b=r.info.lastRun,x;t[100]!==n||t[101]!==r||t[102]!==a?(x=Pe(n,r,a),t[100]=n,t[101]=r,t[102]=a,t[103]=x):x=t[103];let ee=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,S;t[104]!==r.info.lastRun||t[105]!==x||t[106]!==ee?(S=(0,Z.jsx)(xt,{icon:y,label:b,value:x,valueTone:ee}),t[104]=r.info.lastRun,t[105]=x,t[106]=ee,t[107]=S):S=t[107];let C;t[108]!==n.state.consecutiveFailures||t[109]!==n.state.lastError||t[110]!==r.dashboard?(C=n.state.consecutiveFailures?(0,Z.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[108]=n.state.consecutiveFailures,t[109]=n.state.lastError,t[110]=r.dashboard,t[111]=C):C=t[111];let w;t[112]!==r.info.technicalDetails||t[113]!==_?(w=_.length>0?(0,Z.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,Z.jsx)(`span`,{children:r.info.technicalDetails}),(0,Z.jsx)(de,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:_.map(bt)})]}):null,t[112]=r.info.technicalDetails,t[113]=_,t[114]=w):w=t[114];let T;t[115]!==v||t[116]!==S||t[117]!==C||t[118]!==w||t[119]!==d||t[120]!==f||t[121]!==p?(T=(0,Z.jsxs)(`div`,{className:d,children:[f,p,v,S,C,w]}),t[115]=v,t[116]=S,t[117]=C,t[118]=w,t[119]=d,t[120]=f,t[121]=p,t[122]=T):T=t[122];let E;return t[123]!==T||t[124]!==m||t[125]!==h?(E=(0,Z.jsxs)(`aside`,{className:m,children:[h,T]}),t[123]=T,t[124]=m,t[125]=h,t[126]=E):E=t[126],E}function bt(e){return(0,Z.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function xt(e){let t=(0,H.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:c}=e,l=c===void 0?`default`:c,u;t[0]===n?u=t[1]:(u=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=d);let f=l===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,p;t[4]===f?p=t[5]:(p=s(`mt-1 text-sm font-medium leading-5`,f),t[4]=f,t[5]=p);let m;t[6]!==p||t[7]!==i?(m=(0,Z.jsx)(`div`,{className:p,children:i}),t[6]=p,t[7]=i,t[8]=m):m=t[8];let h;t[9]!==a||t[10]!==o?(h=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=h):h=t[11];let g;t[12]!==d||t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[d,m,h]}),t[12]=d,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==u||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[u,g]}),t[16]=u,t[17]=g,t[18]=_):_=t[18],_}function St(e){let t=(0,H.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ct(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function wt(e){let t=(0,H.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Tt(e){let t=(0,H.c)(5),{icon:n,title:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge-subtle bg-surface-base text-fg-muted shadow-surface`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Et(e){let t=(0,H.c)(242),{form:n,labels:r,setForm:i,workflowDefinitions:a,selectedWorkflow:o,workflowsLoading:l,agentOptions:u,agentsLoading:f,language:m}=e,h=c(m).agentsSettings,g;t[0]===i?g=t[1]:(g=e=>i(t=>({...t,...e})),t[0]=i,t[1]=g);let _=g,v=Ee(n.intervalValue,n.intervalUnit),y=Date.now(),b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=[1,2,3],t[2]=b):b=t[2];let x;t[3]!==v||t[4]!==y||t[5]!==m?(x=b.map(e=>J(y+v*e,m,y)),t[3]=v,t[4]=y,t[5]=m,t[6]=x):x=t[6];let ee=x,S,C;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==a?(S=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=a[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},C=[n.actionMode,n.workflowId,i,a],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=a,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,V.useEffect)(S,C);let w;t[13]===_?w=t[14]:(w=e=>_({name:e.target.value}),t[13]=_,t[14]=w);let T;t[15]!==n.name||t[16]!==w?(T=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:w}),t[15]=n.name,t[16]=w,t[17]=T):T=t[17];let E;t[18]!==r.form.name||t[19]!==T?(E=(0,Z.jsx)($,{label:r.form.name,children:T}),t[18]=r.form.name,t[19]=T,t[20]=E):E=t[20];let D;t[21]===_?D=t[22]:(D=e=>_({description:e.target.value}),t[21]=_,t[22]=D);let O;t[23]!==n.description||t[24]!==D?(O=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:D}),t[23]=n.description,t[24]=D,t[25]=O):O=t[25];let k;t[26]!==r.form.description||t[27]!==O?(k=(0,Z.jsx)($,{label:r.form.description,children:O}),t[26]=r.form.description,t[27]=O,t[28]=k):k=t[28];let A;t[29]===r.form.trigger?A=t[30]:(A=(0,Z.jsx)(Ot,{title:r.form.trigger}),t[29]=r.form.trigger,t[30]=A);let te;t[31]===_?te=t[32]:(te=e=>_({triggerMode:e.target.value}),t[31]=_,t[32]=te);let j;t[33]===r.trigger.manual?j=t[34]:(j=(0,Z.jsx)(N,{value:`manual`,children:r.trigger.manual}),t[33]=r.trigger.manual,t[34]=j);let ne;t[35]===r.trigger.once?ne=t[36]:(ne=(0,Z.jsx)(N,{value:`once`,children:r.trigger.once}),t[35]=r.trigger.once,t[36]=ne);let re;t[37]===r.trigger.daily?re=t[38]:(re=(0,Z.jsx)(N,{value:`daily`,children:r.trigger.daily}),t[37]=r.trigger.daily,t[38]=re);let ie;t[39]===r.trigger.weekly?ie=t[40]:(ie=(0,Z.jsx)(N,{value:`weekly`,children:r.trigger.weekly}),t[39]=r.trigger.weekly,t[40]=ie);let ae;t[41]===r.trigger.interval?ae=t[42]:(ae=(0,Z.jsx)(N,{value:`interval`,children:r.trigger.interval}),t[41]=r.trigger.interval,t[42]=ae);let M;t[43]===r.trigger.customCron?M=t[44]:(M=(0,Z.jsx)(N,{value:`cron`,children:r.trigger.customCron}),t[43]=r.trigger.customCron,t[44]=M);let oe;t[45]===r.trigger.webhook?oe=t[46]:(oe=(0,Z.jsx)(N,{value:`webhook`,children:r.trigger.webhook}),t[45]=r.trigger.webhook,t[46]=oe);let se;t[47]===r.trigger.goalBlocked?se=t[48]:(se=(0,Z.jsx)(N,{value:`goalBlocked`,children:r.trigger.goalBlocked}),t[47]=r.trigger.goalBlocked,t[48]=se);let ce;t[49]===r.trigger.noteCreated?ce=t[50]:(ce=(0,Z.jsx)(N,{value:`noteCreated`,children:r.trigger.noteCreated}),t[49]=r.trigger.noteCreated,t[50]=ce);let le;t[51]===r.trigger.workflowFailed?le=t[52]:(le=(0,Z.jsx)(N,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[51]=r.trigger.workflowFailed,t[52]=le);let ue;t[53]===r.trigger.sessionUpdated?ue=t[54]:(ue=(0,Z.jsx)(N,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[53]=r.trigger.sessionUpdated,t[54]=ue);let de;t[55]===r.trigger.customEvent?de=t[56]:(de=(0,Z.jsx)(N,{value:`event`,children:r.trigger.customEvent}),t[55]=r.trigger.customEvent,t[56]=de);let fe;t[57]!==n.triggerMode||t[58]!==te||t[59]!==j||t[60]!==ne||t[61]!==re||t[62]!==ie||t[63]!==ae||t[64]!==M||t[65]!==oe||t[66]!==se||t[67]!==ce||t[68]!==le||t[69]!==ue||t[70]!==de?(fe=(0,Z.jsxs)(d,{className:Q,value:n.triggerMode,onChange:te,children:[j,ne,re,ie,ae,M,oe,se,ce,le,ue,de]}),t[57]=n.triggerMode,t[58]=te,t[59]=j,t[60]=ne,t[61]=re,t[62]=ie,t[63]=ae,t[64]=M,t[65]=oe,t[66]=se,t[67]=ce,t[68]=le,t[69]=ue,t[70]=de,t[71]=fe):fe=t[71];let P;t[72]!==n.onceAt||t[73]!==n.triggerMode||t[74]!==r.form.onceAt||t[75]!==_?(P=n.triggerMode===`once`?(0,Z.jsx)($,{label:r.form.onceAt,children:(0,Z.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>_({onceAt:e.target.value})})}):null,t[72]=n.onceAt,t[73]=n.triggerMode,t[74]=r.form.onceAt,t[75]=_,t[76]=P):P=t[76];let F;t[77]!==n.time||t[78]!==n.triggerMode||t[79]!==n.weekday||t[80]!==r.form.day||t[81]!==r.form.time||t[82]!==r.weekdays||t[83]!==_?(F=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.time,children:(0,Z.jsx)(`input`,{className:Q,type:`time`,value:n.time,onChange:e=>_({time:e.target.value})})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(d,{className:Q,value:n.weekday,onChange:e=>_({weekday:e.target.value}),children:[(0,Z.jsx)(N,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(N,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(N,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(N,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(N,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(N,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(N,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[77]=n.time,t[78]=n.triggerMode,t[79]=n.weekday,t[80]=r.form.day,t[81]=r.form.time,t[82]=r.weekdays,t[83]=_,t[84]=F):F=t[84];let I=n.triggerMode===`interval`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsx)($,{label:r.form.intervalEvery,children:(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Z.jsx)(`input`,{className:Q,type:`number`,min:6e4/Ee(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>_({intervalValue:e.target.value})}),(0,Z.jsxs)(d,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;_({intervalValue:De(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(N,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(N,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(N,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(N,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Fe.map(e=>{let t=Ee(e.value,e.unit),n=t===v;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:s(`rounded-full border px-2.5 py-1 text-xs transition-colors`,n?`border-accent bg-accent/10 text-accent`:`border-edge-subtle text-fg-muted hover:border-edge hover:bg-surface-hover hover:text-fg`),onClick:()=>_({intervalValue:e.value,intervalUnit:e.unit}),children:Oe(t,m)},`${e.value}:${e.unit}`)})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:ke(v,m)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,ee.join(m===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,L;t[85]!==n.cronExpr||t[86]!==n.triggerMode||t[87]!==r.form.expression||t[88]!==_?(L=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>_({cronExpr:e.target.value})})}):null,t[85]=n.cronExpr,t[86]=n.triggerMode,t[87]=r.form.expression,t[88]=_,t[89]=L):L=t[89];let pe;t[90]!==n.triggerMode||t[91]!==n.webhookSecretId||t[92]!==r.form.secretId||t[93]!==_?(pe=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>_({webhookSecretId:e.target.value})})}):null,t[90]=n.triggerMode,t[91]=n.webhookSecretId,t[92]=r.form.secretId,t[93]=_,t[94]=pe):pe=t[94];let me;t[95]!==n.eventPayloadMatch||t[96]!==n.eventSource||t[97]!==n.eventType||t[98]!==n.triggerMode||t[99]!==r.form.eventPayloadMatch||t[100]!==r.form.eventSource||t[101]!==r.form.eventType||t[102]!==r.form.invalidJsonObject||t[103]!==_?(me=n.triggerMode===`event`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.eventType,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>_({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>_({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:s(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>_({eventPayloadMatch:e.target.value}),placeholder:`{
|
|
5
|
+
"status": "blocked"
|
|
6
|
+
}`}),He(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[95]=n.eventPayloadMatch,t[96]=n.eventSource,t[97]=n.eventType,t[98]=n.triggerMode,t[99]=r.form.eventPayloadMatch,t[100]=r.form.eventSource,t[101]=r.form.eventType,t[102]=r.form.invalidJsonObject,t[103]=_,t[104]=me):me=t[104];let R;t[105]===r.form.action?R=t[106]:(R=(0,Z.jsx)(Ot,{title:r.form.action}),t[105]=r.form.action,t[106]=R);let ge;t[107]!==n.workflowId||t[108]!==_||t[109]!==a?(ge=e=>{let t=e.target.value;_({actionMode:t,...t===`workflow`&&!n.workflowId.trim()&&a[0]?{workflowId:a[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[107]=n.workflowId,t[108]=_,t[109]=a,t[110]=ge):ge=t[110];let z;t[111]===r.action.runAgent?z=t[112]:(z=(0,Z.jsx)(N,{value:`agent`,children:r.action.runAgent}),t[111]=r.action.runAgent,t[112]=z);let B;t[113]===r.action.runWorkflow?B=t[114]:(B=(0,Z.jsx)(N,{value:`workflow`,children:r.action.runWorkflow}),t[113]=r.action.runWorkflow,t[114]=B);let U;t[115]!==n.actionMode||t[116]!==ge||t[117]!==z||t[118]!==B?(U=(0,Z.jsxs)(d,{className:Q,value:n.actionMode,onChange:ge,children:[z,B]}),t[115]=n.actionMode,t[116]=ge,t[117]=z,t[118]=B,t[119]=U):U=t[119];let W=$,G=r.form.agent,ve=d,ye=Q,be=n.agentId,K;t[120]===_?K=t[121]:(K=e=>_({agentId:e.target.value}),t[120]=_,t[121]=K);let xe=f?r.form.loadingAgents:r.form.defaultAgent,Se;t[122]===xe?Se=t[123]:(Se=(0,Z.jsx)(N,{value:``,children:xe}),t[122]=xe,t[123]=Se);let Ce=u.map(e=>(0,Z.jsx)(N,{value:e.id,children:p(e,h)},e.id)),q;t[124]!==ve||t[125]!==n.agentId||t[126]!==ye||t[127]!==K||t[128]!==Se||t[129]!==Ce?(q=(0,Z.jsxs)(ve,{className:ye,value:be,onChange:K,children:[Se,Ce]}),t[124]=ve,t[125]=n.agentId,t[126]=ye,t[127]=K,t[128]=Se,t[129]=Ce,t[130]=q):q=t[130];let we;t[131]!==W||t[132]!==r.form.agent||t[133]!==q?(we=(0,Z.jsx)(W,{label:G,children:q}),t[131]=W,t[132]=r.form.agent,t[133]=q,t[134]=we):we=t[134];let Te;t[135]!==n.actionMode||t[136]!==n.agentId||t[137]!==n.description||t[138]!==n.instruction||t[139]!==n.name||t[140]!==n.triggerMode||t[141]!==n.workflowId||t[142]!==n.workflowInput||t[143]!==r.form.instruction||t[144]!==r.form.loadingWorkflows||t[145]!==r.form.noWorkflows||t[146]!==r.form.triggeredRun||t[147]!==r.form.workflow||t[148]!==m||t[149]!==o||t[150]!==_||t[151]!==a||t[152]!==l?(Te=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(he,{value:n.instruction,onApply:e=>_({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:m,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:s(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>_({instruction:e.target.value})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(d,{className:Q,value:n.workflowId,onChange:e=>_({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:l||a.length===0,children:[l?(0,Z.jsx)(N,{value:``,children:r.form.loadingWorkflows}):null,!l&&a.length===0?(0,Z.jsx)(N,{value:``,children:r.form.noWorkflows}):null,a.map(Dt)]})}),o?(0,Z.jsx)(_e,{definition:o,language:m,value:n.workflowInput,onChange:e=>_({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>_({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:o.id,workflowTitle:o.title,workflowDescription:o.description}},inputClassName:`rounded-lg`}):null]}),t[135]=n.actionMode,t[136]=n.agentId,t[137]=n.description,t[138]=n.instruction,t[139]=n.name,t[140]=n.triggerMode,t[141]=n.workflowId,t[142]=n.workflowInput,t[143]=r.form.instruction,t[144]=r.form.loadingWorkflows,t[145]=r.form.noWorkflows,t[146]=r.form.triggeredRun,t[147]=r.form.workflow,t[148]=m,t[149]=o,t[150]=_,t[151]=a,t[152]=l,t[153]=Te):Te=t[153];let Ae;t[154]===r.form.safety?Ae=t[155]:(Ae=(0,Z.jsx)(Ot,{title:r.form.safety}),t[154]=r.form.safety,t[155]=Ae);let je;t[156]!==n.afterRunMode||t[157]!==_?(je=e=>{let t=e.target.value;_({safetyMode:t,...t!==`auto_apply`&&n.afterRunMode===`webhook`?{afterRunMode:`none`,webhookUrl:``}:{}})},t[156]=n.afterRunMode,t[157]=_,t[158]=je):je=t[158];let Me;t[159]===r.safety.suggest_only?Me=t[160]:(Me=(0,Z.jsx)(N,{value:`suggest_only`,children:r.safety.suggest_only}),t[159]=r.safety.suggest_only,t[160]=Me);let Ne;t[161]===r.safety.ask_before_apply?Ne=t[162]:(Ne=(0,Z.jsx)(N,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),t[161]=r.safety.ask_before_apply,t[162]=Ne);let Y;t[163]===r.safety.auto_apply?Y=t[164]:(Y=(0,Z.jsx)(N,{value:`auto_apply`,children:r.safety.auto_apply}),t[163]=r.safety.auto_apply,t[164]=Y);let Pe;t[165]!==n.safetyMode||t[166]!==je||t[167]!==Me||t[168]!==Ne||t[169]!==Y?(Pe=(0,Z.jsxs)(d,{className:Q,value:n.safetyMode,onChange:je,children:[Me,Ne,Y]}),t[165]=n.safetyMode,t[166]=je,t[167]=Me,t[168]=Ne,t[169]=Y,t[170]=Pe):Pe=t[170];let X=n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription,Ie;t[171]===X?Ie=t[172]:(Ie=(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:X}),t[171]=X,t[172]=Ie);let Le;t[173]!==r.form.safety||t[174]!==Pe||t[175]!==Ie?(Le=(0,Z.jsxs)($,{label:r.form.safety,children:[Pe,Ie]}),t[173]=r.form.safety,t[174]=Pe,t[175]=Ie,t[176]=Le):Le=t[176];let Re;t[177]===r.form.afterRun?Re=t[178]:(Re=(0,Z.jsx)(Ot,{title:r.form.afterRun}),t[177]=r.form.afterRun,t[178]=Re);let ze;t[179]===_?ze=t[180]:(ze=e=>_({afterRunMode:e.target.value}),t[179]=_,t[180]=ze);let Be;t[181]===r.afterRun.none?Be=t[182]:(Be=(0,Z.jsx)(N,{value:`none`,children:r.afterRun.none}),t[181]=r.afterRun.none,t[182]=Be);let Ve;t[183]===r.afterRun.saveToSession?Ve=t[184]:(Ve=(0,Z.jsx)(N,{value:`saveToSession`,children:r.afterRun.saveToSession}),t[183]=r.afterRun.saveToSession,t[184]=Ve);let Ue=n.safetyMode!==`auto_apply`,We;t[185]!==r.afterRun.webhook||t[186]!==Ue?(We=(0,Z.jsx)(N,{value:`webhook`,disabled:Ue,children:r.afterRun.webhook}),t[185]=r.afterRun.webhook,t[186]=Ue,t[187]=We):We=t[187];let Ge;t[188]!==n.afterRunMode||t[189]!==ze||t[190]!==Be||t[191]!==Ve||t[192]!==We?(Ge=(0,Z.jsxs)(d,{className:Q,value:n.afterRunMode,onChange:ze,children:[Be,Ve,We]}),t[188]=n.afterRunMode,t[189]=ze,t[190]=Be,t[191]=Ve,t[192]=We,t[193]=Ge):Ge=t[193];let Ke;t[194]!==n.afterRunMode||t[195]!==n.webhookUrl||t[196]!==r.form.webhookUrl||t[197]!==_?(Ke=n.afterRunMode===`webhook`?(0,Z.jsx)($,{label:r.form.webhookUrl,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookUrl,onChange:e=>_({webhookUrl:e.target.value})})}):null,t[194]=n.afterRunMode,t[195]=n.webhookUrl,t[196]=r.form.webhookUrl,t[197]=_,t[198]=Ke):Ke=t[198];let qe;t[199]===r.form.reliability?qe=t[200]:(qe=(0,Z.jsx)(Ot,{title:r.form.reliability}),t[199]=r.form.reliability,t[200]=qe);let Je;t[201]===_?Je=t[202]:(Je=e=>_({timeoutSeconds:e.target.value}),t[201]=_,t[202]=Je);let Ye;t[203]!==n.timeoutSeconds||t[204]!==Je?(Ye=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:Je}),t[203]=n.timeoutSeconds,t[204]=Je,t[205]=Ye):Ye=t[205];let Xe;t[206]!==r.form.timeoutSeconds||t[207]!==Ye?(Xe=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:Ye}),t[206]=r.form.timeoutSeconds,t[207]=Ye,t[208]=Xe):Xe=t[208];let Ze;t[209]===_?Ze=t[210]:(Ze=e=>_({disableAfterFailures:e.target.value}),t[209]=_,t[210]=Ze);let Qe;t[211]!==n.disableAfterFailures||t[212]!==Ze?(Qe=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:Ze}),t[211]=n.disableAfterFailures,t[212]=Ze,t[213]=Qe):Qe=t[213];let $e;t[214]!==r.form.disableAfterFailures||t[215]!==Qe?($e=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:Qe}),t[214]=r.form.disableAfterFailures,t[215]=Qe,t[216]=$e):$e=t[216];let et;t[217]!==Xe||t[218]!==$e?(et=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Xe,$e]}),t[217]=Xe,t[218]=$e,t[219]=et):et=t[219];let tt;return t[220]!==E||t[221]!==k||t[222]!==A||t[223]!==fe||t[224]!==P||t[225]!==F||t[226]!==I||t[227]!==L||t[228]!==pe||t[229]!==me||t[230]!==R||t[231]!==U||t[232]!==we||t[233]!==Te||t[234]!==Ae||t[235]!==Le||t[236]!==Re||t[237]!==Ge||t[238]!==Ke||t[239]!==qe||t[240]!==et?(tt=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[E,k,A,fe,P,F,I,L,pe,me,R,U,we,Te,Ae,Le,Re,Ge,Ke,qe,et]})}),t[220]=E,t[221]=k,t[222]=A,t[223]=fe,t[224]=P,t[225]=F,t[226]=I,t[227]=L,t[228]=pe,t[229]=me,t[230]=R,t[231]=U,t[232]=we,t[233]=Te,t[234]=Ae,t[235]=Le,t[236]=Re,t[237]=Ge,t[238]=Ke,t[239]=qe,t[240]=et,t[241]=tt):tt=t[241],tt}function Dt(e){return(0,Z.jsx)(N,{value:e.id,children:e.title||e.name},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,H.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Ot(e){let t=(0,H.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(L,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{ot as AutomationsPage};
|
package/dist/gateway/static/root/assets/{binary-plugins-BeZGzpGF.js → binary-plugins-IPr2EVnS.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-preview-renderer-DonnL2dL.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-BuT0SR1R.js";import{$a as o,Za as s}from"./index-BuqGh2SW.js";import{t as c}from"./preview-open-alternatives-CvjuvABg.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let c=(0,u.useRef)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(c.current?.(),c.current=null,d(null),p(!1),!t||!n||!o||!r)return;let l=!1;return _(o,g(e,n)),(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-DonnL2dL.js`),__vite__mapDeps([0,1,2]));if(l)return;let u=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(o,t,{loadingText:u.attachmentPreviewPdfRendering,loadMoreHint:u.attachmentPreviewPdfLoadMore,onPageCount:s});c.current=e}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(o,t,{truncationNotice:u.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});c.current=e,l||p(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(o,t);c.current=e}}catch(e){l||d(e instanceof Error?e.message:String(e))}})(),()=>{l=!0,c.current?.(),c.current=null}},[t,n,o,r,e,s]),{error:l,excelTruncated:f}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=o(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,s]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||s({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(31),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;if(t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T),f){let n;t[17]===e?n=t[18]:(n=b(e),t[17]=e,t[18]=n);let r;t[19]!==e||t[20]!==n?(r=(0,p.jsx)(y,{props:e,message:n}),t[19]=e,t[20]=n,t[21]=r):r=t[21];let i;t[22]===f?i=t[23]:(i=(0,p.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),t[22]=f,t[23]=i);let a;return t[24]!==r||t[25]!==i?(a=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[r,i]}),t[24]=r,t[25]=i,t[26]=a):a=t[26],a}if(e.kind===`excel`){let n=m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,r;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[27]=r):r=t[27];let i;return t[28]===n?i=t[29]:(i=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[n,r]}),t[28]=n,t[29]=i),i}let E;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[30]=E):E=t[30],E}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,o=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,s):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==o?(u=o?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=o,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==o?(f=o?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=o,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-CxySDn9d.js";import{Ha as o,Wa as s}from"./index-vq_cJZJC.js";import{t as c}from"./preview-open-alternatives-3E_Qa-58.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let c=(0,u.useRef)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(c.current?.(),c.current=null,d(null),p(!1),!t||!n||!o||!r)return;let l=!1;return _(o,g(e,n)),(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-DonnL2dL.js`),__vite__mapDeps([0,1,2]));if(l)return;let u=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(o,t,{loadingText:u.attachmentPreviewPdfRendering,loadMoreHint:u.attachmentPreviewPdfLoadMore,onPageCount:s});c.current=e}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(o,t,{truncationNotice:u.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});c.current=e,l||p(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(o,t);c.current=e}}catch(e){l||d(e instanceof Error?e.message:String(e))}})(),()=>{l=!0,c.current?.(),c.current=null}},[t,n,o,r,e,s]),{error:l,excelTruncated:f}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=s(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,o]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{o({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||o({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(31),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;if(t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T),f){let n;t[17]===e?n=t[18]:(n=b(e),t[17]=e,t[18]=n);let r;t[19]!==e||t[20]!==n?(r=(0,p.jsx)(y,{props:e,message:n}),t[19]=e,t[20]=n,t[21]=r):r=t[21];let i;t[22]===f?i=t[23]:(i=(0,p.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),t[22]=f,t[23]=i);let a;return t[24]!==r||t[25]!==i?(a=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[r,i]}),t[24]=r,t[25]=i,t[26]=a):a=t[26],a}if(e.kind===`excel`){let n=m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,r;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[27]=r):r=t[27];let i;return t[28]===n?i=t[29]:(i=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[n,r]}),t[28]=n,t[29]=i),i}let E;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[30]=E):E=t[30],E}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,s=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,o):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==s?(u=s?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=s,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==s?(f=s?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=s,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
|