@xopcai/xopc 0.0.273 → 0.0.275
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/_locales/en/messages.json +215 -0
- package/dist/browser-ext/_locales/zh_CN/messages.json +215 -0
- package/dist/browser-ext/dist/assets/{auth-DkwOUI6_.js → auth-ClQTK565.js} +291 -115
- package/dist/browser-ext/dist/assets/{sidepanel-C86O7q5Y.css → sidepanel-CeGqObOa.css} +41 -20
- package/dist/browser-ext/dist/background.js +36 -4
- package/dist/browser-ext/dist/sidepanel.html +2 -2
- package/dist/browser-ext/dist/sidepanel.js +457 -310
- package/dist/browser-ext/manifest.json +6 -4
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-cF7IX2RP.js → activity-store-SJZ5fS17.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BrgxX8nG.js → agent-avatar-dicebear-Dx6x7MXq.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DvhuRCLA.js → agent-defaults-settings-panel-BuxTpjkf.js} +1 -1
- package/dist/gateway/static/root/assets/agents-_f9HEOol.js +1 -0
- package/dist/gateway/static/root/assets/{api-CYkdUpkx.js → api-CnJAVHBu.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DfoNzWIa.js → app-management-settings-panel-BYKWXcVl.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-czbLdCqj.js → appearance-settings-BmhSJc4X.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DYTnK9lL.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-D14P13mX.js → archive-plugin-BY6ncIeE.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-load-B6cw8KtO.js +1 -0
- package/dist/gateway/static/root/assets/{attachment-preview-renderer-BDTD8YUe.js → attachment-preview-renderer-CfEDFYPE.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-process-heavy-C5CqLCsX.js +5 -0
- package/dist/gateway/static/root/assets/{automations-page-DM7ZEewI.js → automations-page-D1WwsSf3.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CjF56MI_.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CxNg6InF.js → binary-plugins-CC-wYm0K.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-D22VcYnC.js → block-editor-D8rh9KNe.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-6NWTLEpd.js → browser-automation-inputs-DGCqIPXT.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BrqySdbW.js → browser-automations-page-CMrffyct.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-1onvP1Se.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C9ZSJxjr.js +8 -0
- package/dist/gateway/static/root/assets/{channels-settings-yHsY174W.js → channels-settings-CvLTnI99.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-BUZimNmp.js → channels-status-swr-BTT2sIGg.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CZPBNpMI.js → chat-terminal-dock-F_dUdZ8l.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-D7NHV8B2.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-Da_0QyLe.js → date-picker-MHuajwQ-.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D_djqzy7.js → dependency-picker-BcMJJI9X.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Celmbw-T.js → desktop-pet-DlNm_7H0.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CqNNgF45.js → desktop-pet-settings-BI1JQMnE.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-Cp5jO5B_.js +1 -0
- package/dist/gateway/static/root/assets/excel-worksheet-utils-DpdB-DjU.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-ku3kCjvH.js → extension-debug-page-DZr0GkkA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C7FpHwL4.js → extension-page-QsHoQ6VX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-OMj2tU2_.js → extension-settings-page-I2YX4Tzb.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-6eb1vKE1.js → gateway-config-swr-cd8owslz.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-GwfQu8rN.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DUFFCU8H.js → gateway-startup-retry-CVTa5HSS.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CSFzOACM.js → heartbeat-settings-D-hVYXzL.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-SEW_0k8Q.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-C1cHRBRp.js → image-generation-api-DtMRG1oF.js} +1 -1
- package/dist/gateway/static/root/assets/{index-C6OWYFtQ.js → index-DfZZLrWp.js} +35 -35
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BuvD3iv8.js → keyboard-shortcuts-settings-D_I-hiG2.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CaC4-THD.js → local-app-workbench-page-BcY7wIHs.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-DdJ8zwBp.js → local-apps-page-DniZuXJJ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BBSCIl4I.js → locale-store-BkJ7g35d.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BaR2he0K.js → logs-page-DIiOMrJ_.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-BPw41YX6.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-c5vtnYe8.js → markdown-view-B2IR4E2r.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D_a6GDY6.js → media-plugins-BoP3LSQz.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-DjuBdDCn.js → messages-BGc-OJWg.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-BI2xr54R.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CM7Ns8i1.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-C7Le9bSI.js → page-tabs-B21WfV92.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-B2pOxJBK.js → preview-open-alternatives-BZoDpPqV.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-card-BlQ1vCtV.js → proactive-card-Bw9CbzUX.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-CghKTfYa.js → proactive-page-Czw_CEDB.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DpjiHgwu.js → product-open-page-DsQcgZkI.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-jOECabbf.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Ck9j5q0x.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CyQ4k1Ux.js → registry-api-CTq8EECj.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-2xcpaLTC.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bl4ArLHf.js → runtime-tools-settings-panel-Bz5gIRjy.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-KQFmfWd4.js → schema-form-CqM0ntNm.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CE9MK60k.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D0grhQan.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Dbnls9ty.js → settings-form-section-LqcDYJ2m.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CDKirYRG.js → settings-page-BpvBmheO.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CYuqNzWH.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-F3qhAryJ.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-B4wSoQM3.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C3LD7fkR.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Bd0_ED_p.js → skills-page-D9fI548d.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-rA-XT-YG.js → skills-page.utils-DZNmyYqU.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CSkMrHLz.js → system-settings-panel-CMsmFOhV.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DRwTJ8E0.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-DWpIEWen.js → theme-store-mV6Cm2vj.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-DGaqXwql.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DkQAIAuB.js → use-autosave-bXCl0Y0j.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-B3RjDSri.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BrqcH0P-.js → voice-api-key-field-Cx9rl7mP.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-BJ95Z3pT.js → voice-config-api-D3DdcH4H.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-vfTWKm13.js → work-discovery-overlay-ywJpaqKp.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CHdr_ng9.js → workflow-run-setup-panel-DyGukxOL.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CifIqO2B.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +41 -2
- package/dist/src/agent/child-agent-factory.d.ts +3 -0
- package/dist/src/agent/child-agent-factory.js +2 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
- package/dist/src/agent/service.js +20 -16
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +21 -4
- package/dist/src/agent/workflow/workflow-child-tools.js +2 -0
- package/dist/src/browser/native-messaging-host.d.ts +1 -1
- package/dist/src/browser/native-messaging-host.js +3 -2
- package/dist/src/browser/providers/browser-ext-install.d.ts +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +8 -3
- package/dist/src/browser/providers/realtime-extension.d.ts +4 -1
- package/dist/src/browser/providers/realtime-extension.js +26 -10
- package/dist/src/browser/readiness.d.ts +4 -1
- package/dist/src/browser/readiness.js +11 -5
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/gateway/gateway-workflow-host.types.d.ts +2 -0
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +5 -2
- package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
- package/dist/src/gateway/hono/routes/browser.js +24 -11
- package/dist/src/gateway/hono/routes/device-pairing-approval.d.ts +9 -2
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +50 -10
- package/dist/src/gateway/hono/routes/devices.d.ts +2 -1
- package/dist/src/gateway/hono/routes/devices.js +33 -16
- package/dist/src/gateway/hono/routes/endpoint-tools.js +9 -0
- package/dist/src/gateway/hono/routes/models.js +6 -0
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/tunnel.js +34 -2
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/rate-limit/buckets.js +2 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +4 -0
- package/dist/src/providers/model-catalog-types.d.ts +1 -0
- package/dist/src/providers/xopc-cloud-model-source.js +12 -1
- package/dist/src/storage/sqlite/device-pairing-approval.js +3 -1
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +9 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/tunnel/xopc-cloud-registration.d.ts +5 -0
- package/dist/src/tunnel/xopc-cloud-registration.js +17 -11
- package/dist/src/workflows/service/workflow-run-service.js +4 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-C0By2FIo.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BSJXKWcE.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-Dok_B1Gv.js +0 -2
- package/dist/gateway/static/root/assets/attachment-process-heavy-B2_kr5EA.js +0 -11
- package/dist/gateway/static/root/assets/automations-workspace--1TsZf3O.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DOHgQer_.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Bpse_5K-.js +0 -8
- package/dist/gateway/static/root/assets/connectors-page-B_wLKGnH.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-B5_w9qlm.js +0 -1
- package/dist/gateway/static/root/assets/excel-worksheet-utils-EyvwNT4X.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CH-6vkgN.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BJebAKB-.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-r-iYWZFY.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-BV6nbgac.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BmLKoWwi.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CV8Lh296.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-COweOaJP.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-ChPPGVU5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DgmHibOK.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DV7kMco2.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-SQmtWoOs.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-DwgLjS1m.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Cs5bUrYw.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DyKrjq7F.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CEQU-L_G.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-COJcGnEi.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BQAU55lf.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-hwRJD7vR.js +0 -6
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,p as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./messages-DjuBdDCn.js";import{c as g,n as _}from"./locale-store-BBSCIl4I.js";import{t as v}from"./cn-JdwAhgNB.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{t as b}from"./button-B11EPpor.js";import{t as x}from"./skeleton-BwbyijEw.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as w}from"./settings-shell-layer-context-DCp6ykjQ.js";import{El as T,Gc as E,P as D,Ra as O,Rs as k,Us as A,an as j,cn as M,ic as N,in as P,ln as F,lo as I,on as ee,sn as L,vu as R,yc as z}from"./index-C6OWYFtQ.js";import{r as B}from"./settings-page-layout-DYelDcMV.js";var V=n(),H=e(t(),1),U=r(),te=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],W=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function G(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function K(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function q(e){let t=(0,V.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function J(e){let t=(0,V.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,U.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function Y(e){let t=(0,V.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,U.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function X(e){let t=(0,V.c)(56),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,onChange:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=i!=null,f;t[0]===n?f=t[1]:(f=(0,U.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=f);let p;t[2]!==i||t[3]!==a?(p=i===void 0?(0,U.jsx)(q,{children:a?`继承`:`Inherited`}):null,t[2]=i,t[3]=a,t[4]=p):p=t[4];let m;t[5]!==u||t[6]!==i||t[7]!==a?(m=i===null?(0,U.jsx)(q,{children:u?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[5]=u,t[6]=i,t[7]=a,t[8]=m):m=t[8];let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==r?.primary||t[14]!==i||t[15]!==a?(g=i===void 0?(0,U.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[13]=r?.primary,t[14]=i,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==c||t[21]!==i||t[22]!==a?(v=i===void 0?null:(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(void 0),children:a?`继承`:`Inherit`}),t[20]=c,t[21]=i,t[22]=a,t[23]=v):v=t[23];let y;t[24]!==l||t[25]!==c||t[26]!==i||t[27]!==a?(y=l&&i!==null?(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`使用 Chat`:`Use Chat`}):null,t[24]=l,t[25]=c,t[26]=i,t[27]=a,t[28]=y):y=t[28];let x;t[29]!==u||t[30]!==c||t[31]!==i||t[32]!==a?(x=u&&i!==null?(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`禁用`:`Disable`}):null,t[29]=u,t[30]=c,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;t[34]!==d||t[35]!==r?.fallbacks||t[36]!==r?.primary||t[37]!==c||t[38]!==a?(S=d?null:(0,U.jsx)(b,{className:`px-2 py-1 text-xs`,onClick:()=>c({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[34]=d,t[35]=r?.fallbacks,t[36]=r?.primary,t[37]=c,t[38]=a,t[39]=S):S=t[39];let C;t[40]!==y||t[41]!==x||t[42]!==S||t[43]!==v?(C=(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[v,y,x,S]}),t[40]=y,t[41]=x,t[42]=S,t[43]=v,t[44]=C):C=t[44];let w;t[45]!==C||t[46]!==_?(w=(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[_,C]}),t[45]=C,t[46]=_,t[47]=w):w=t[47];let T;t[48]!==d||t[49]!==c||t[50]!==i||t[51]!==a?(T=d?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`主模型`:`Primary model`,(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:i.primary,onChange:e=>c({...i,primary:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`回退模型`:`Fallbacks`,(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:i.fallbacks.join(`, `),onChange:e=>c({...i,fallbacks:G(e.target.value)}),placeholder:a?`逗号分隔`:`Comma separated`})]})]}):null,t[48]=d,t[49]=c,t[50]=i,t[51]=a,t[52]=T):T=t[52];let E;return t[53]!==w||t[54]!==T?(E=(0,U.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[w,T]}),t[53]=w,t[54]=T,t[55]=E):E=t[55],E}function Z(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Q({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:o,onOpenDefaults:s,onChat:c,onDelete:l}){let[u,d]=(0,H.useState)(`overview`),[f,p]=(0,H.useState)(()=>structuredClone(e.override)),[m,h]=(0,H.useState)(!1),[g,_]=(0,H.useState)(null),y=JSON.stringify(f)!==JSON.stringify(e.override),x=[f.models?.chat,...Object.values(f.models?.intents??{}),f.models?.imageUnderstanding,f.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,H.useEffect)(()=>a(y),[y,a]);let S=(0,H.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(f.tools??{})])].sort(),[e.effective.tools,f.tools,t]),C=[f.models?n?`模型`:`Models`:null,f.skills?n?`技能`:`Skills`:null,f.tools?n?`工具权限`:`Tool access`:null,f.runtime||f.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),w=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,D=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,O=j({id:e.id,name:f.profile?.name??e.name},r),M={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},P={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},I=async()=>{h(!0),_(null);try{let t=(await F(e.id,{workspace:f.workspace??null,profile:f.profile,models:f.models??null,skills:f.skills??null,tools:f.tools??null,workflows:f.workflows??null,runtime:f.runtime??null})).agents.find(t=>t.id===e.id);t&&p(structuredClone(t.override))}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},ee=async()=>{h(!0),_(null);try{await F(e.id,{setDefault:!0})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},L=(e,t)=>{let n={...f.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},p({...f,tools:Object.keys(n).length>0?n:void 0})},B=(e,t)=>{let n={...f.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,p({...f,models:Object.keys(n).length>0?n:void 0})};return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,U.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,U.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:T},{id:`profile`,label:n?`个性`:`Profile`,icon:k},{id:`models`,label:n?`模型`:`Models`,icon:N},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:R},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:T},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:A}].map(({id:e,label:t,icon:n})=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>d(e),className:v(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,u===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,U.jsx)(n,{className:`size-4`}),t]},e))})}),(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[g||i?(0,U.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:g??i}):null,u===`overview`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,U.jsxs)(b,{onClick:c,children:[(0,U.jsx)(E,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:C.length>0?n?`已自定义:${C.join(`、`)}`:`Customized: ${C.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:C.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,U.jsx)(b,{onClick:s,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsx)(Y,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:f.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`技能`:`Skills`,value:D,detail:f.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`工具权限`:`Tool access`,value:w>0?n?`${w} 个禁用`:`${w} denied`:n?`全部可用`:`All available`,detail:f.tools?n?`${Object.keys(f.tools).length} 个本地覆盖`:`${Object.keys(f.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:f.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,U.jsx)(b,{onClick:()=>void ee(),disabled:m,children:n?`设为默认智能体`:`Make default agent`})]}):null,u===`profile`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`个性与工作区`:`Profile and workspace`,description:n?`只设置这个智能体独有的身份、表达方式和工作目录。`:`Keep only this agent’s identity, behavior, and workspace here.`}),(0,U.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:O,onChange:e=>p({...f,profile:{name:e.target.value,...f.profile?.instructions?{instructions:f.profile.instructions}:{}}})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n?`工作区`:`Workspace`,f.workspace?null:(0,U.jsx)(q,{children:n?`自动`:`Automatic`})]}),(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:f.workspace??``,placeholder:e.effective.workspace,onChange:e=>p({...f,workspace:e.target.value||void 0})})]})]}),(0,U.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`个性指令`:`Personality instructions`,(0,U.jsx)(`textarea`,{rows:10,className:`${W} mt-1.5 resize-y leading-6`,value:f.profile?.instructions??``,onChange:t=>p({...f,profile:{name:f.profile?.name||e.name,instructions:t.target.value||void 0}}),placeholder:n?`描述角色、语气、判断偏好和工作方式`:`Describe the role, tone, judgment preferences, and working style`})]})]}):null,u===`models`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:f.models?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>p({...f,models:void 0}),children:[(0,U.jsx)(z,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,U.jsx)(X,{label:r.editorChatModel,inherited:e.effective.models.chat,value:f.models?.chat,zh:n,onChange:e=>{let t={...f.models??{}};e?t.chat=e:delete t.chat,p({...f,models:Object.keys(t).length>0?t:void 0})}}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,U.jsx)(`div`,{className:`space-y-3`,children:te.map(t=>(0,U.jsx)(X,{label:M[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:f.models?.intents?.[t],zh:n,allowChatFallback:!0,onChange:e=>B(t,e)},t))})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(X,{label:n?`图片理解`:`Image understanding`,inherited:e.effective.models.imageUnderstanding,value:f.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...f.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,p({...f,models:Object.keys(t).length>0?t:void 0})}}),(0,U.jsx)(X,{label:n?`图片生成`:`Image generation`,inherited:e.effective.models.imageGeneration,value:f.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...f.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:f.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:f.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},p({...f,models:Object.keys(n).length>0?n:void 0})}}),f.models?.imageGeneration?(0,U.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,U.jsx)(`input`,{type:`number`,min:1,className:`${W} mt-1.5`,value:f.models.imageGeneration.timeoutMs??``,onChange:e=>p({...f,models:{...f.models,imageGeneration:{...f.models.imageGeneration,timeoutMs:K(e.target.value)}}})})]}),(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>p({...f,models:{...f.models,imageGeneration:{...f.models.imageGeneration,autoProviderFallback:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,f.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,u===`capabilities`?(0,U.jsxs)(`div`,{className:`space-y-7`,children:[(0,U.jsx)(J,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),f.skills?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>p({...f,skills:void 0}),children:[(0,U.jsx)(z,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,U.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,U.jsx)(b,{variant:f.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>p({...f,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,U.jsx)(b,{variant:f.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>p({...f,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),f.skills?.mode===`merge`?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:f.skills.add.join(`, `),onChange:e=>p({...f,skills:{mode:`merge`,add:G(e.target.value),remove:f.skills?.mode===`merge`?f.skills.remove:[]}})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:f.skills.remove.join(`, `),onChange:e=>p({...f,skills:{mode:`merge`,add:f.skills?.mode===`merge`?f.skills.add:[],remove:G(e.target.value)}})})]})]}):null,f.skills?.mode===`replace`?(0,U.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:f.skills.include.join(`, `),onChange:e=>p({...f,skills:{mode:`replace`,include:G(e.target.value)}})})]}):null]}),(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),f.tools?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>p({...f,tools:void 0}),children:[(0,U.jsx)(z,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),(0,U.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:S.map(t=>{let r=f.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${P[i]}`})]}),(0,U.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>L(t,e),className:v(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:P[e]},e))})]},t)})})]})]}):null,u===`runtime`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:f.runtime||f.workflows?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>p({...f,runtime:void 0,workflows:void 0}),children:[(0,U.jsx)(z,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,U.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,f.runtime?.[t]===void 0?(0,U.jsx)(q,{children:n?`继承`:`Inherited`}):null]}),(0,U.jsx)(`input`,{type:`number`,min:1,className:`${W} mt-1.5`,value:f.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=Z({...f.runtime??{},[t]:K(e.target.value)});p({...f,runtime:n})}})]},t))}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,U.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:f.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=Z({...f.workflows??{},default:e.target.value||void 0});p({...f,workflows:t})}})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:f.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=G(e.target.value),n=Z({...f.workflows??{},allowed:t.length>0?t:void 0});p({...f,workflows:n})}})]})]})]}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),f.runtime?.promptCache?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>{let e=Z({...f.runtime??{},promptCache:void 0});p({...f,runtime:e})},children:[(0,U.jsx)(z,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),f.runtime?.promptCache?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>p({...f,runtime:{...f.runtime,promptCache:{...f.runtime.promptCache,mode:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,f.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>p({...f,runtime:{...f.runtime,promptCache:{...f.runtime.promptCache,lifetime:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,f.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,U.jsx)(b,{className:`mt-4`,onClick:()=>p({...f,runtime:{...f.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,u===`danger`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,U.jsx)(b,{disabled:m,onClick:()=>void ee(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,U.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,U.jsxs)(b,{variant:`ghost`,className:`text-red-600`,onClick:l,children:[(0,U.jsx)(A,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,U.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x?n?`请补全自定义模型`:`Complete the custom model reference`:y?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(b,{onClick:o,children:n?`关闭`:`Close`}),(0,U.jsx)(b,{variant:`primary`,disabled:m||!y||x||f.profile!==void 0&&!f.profile.name.trim(),onClick:()=>void I(),children:m?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function $(e){let t=(0,V.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:p}=e,[h,g]=(0,H.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,U.jsx)(o,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=_):_=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=v(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,S,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=y):y=t[1];let b;t[2]!==n.avatar||t[3]!==n.id?(b=(0,U.jsx)(D,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=b):b=t[4];let x;t[5]!==n||t[6]!==r?(x=j(n,r),t[5]=n,t[6]=r,t[7]=x):x=t[7];let T;t[8]===x?T=t[9]:(T=(0,U.jsx)(d,{className:`truncate text-base font-semibold text-fg`,children:x}),t[8]=x,t[9]=T);let E;t[10]===n.id?E=t[11]:(E=(0,U.jsx)(s,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=E);let O;t[12]!==T||t[13]!==E?(O=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[T,E]}),t[12]=T,t[13]=E,t[14]=O):O=t[14];let k;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(k=n.isDefault?(0,U.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=k):k=t[17];let A;t[18]!==b||t[19]!==O||t[20]!==k?(A=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[b,O,k]}),t[18]=b,t[19]=O,t[20]=k,t[21]=A):A=t[21];let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,U.jsx)(m,{className:`size-4`}),t[22]=M):M=t[22];let N;t[23]===r.closeDialogAria?N=t[24]:(N=(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:M})}),t[23]=r.closeDialogAria,t[24]=N);let P;t[25]!==N||t[26]!==A?(P=(0,U.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,N]}),t[25]=N,t[26]=A,t[27]=P):P=t[27];let F;t[28]!==p||t[29]!==h||t[30]!==P?(F=(0,U.jsxs)(l,{children:[_,(0,U.jsx)(u,{ref:g,className:y,onOpenAutoFocus:ne,children:(0,U.jsxs)(w,{layer:`modal`,portalContainer:h,children:[P,p]})})]}),t[28]=p,t[29]=h,t[30]=P,t[31]=F):F=t[31];let I;return t[32]!==a||t[33]!==i||t[34]!==F?(I=(0,U.jsx)(f,{open:i,onOpenChange:a,children:F}),t[32]=a,t[33]=i,t[34]=F,t[35]=I):I=t[35],I}function ne(e){return e.preventDefault()}function re(e){let t=(0,V.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=j(e,i),n=P(e,i);return(0,U.jsx)(`li`,{className:`min-h-0`,children:(0,U.jsxs)(`article`,{className:v(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,U.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(D,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,U.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,U.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,U.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,U.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,U.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,U.jsxs)(b,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,U.jsx)(E,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,U.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var ie=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function ae(e){let t=(0,V.c)(59),{open:n,busy:r,error:i,name:a,instructions:p,zh:h,onNameChange:g,onInstructionsChange:_,onCreate:y,onOpenChange:x}=e,w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,U.jsx)(o,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=w):w=t[0];let T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=v(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(92vw,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,S),t[1]=T):T=t[1];let E=h?`新建智能体`:`Create agent`,D;t[2]===E?D=t[3]:(D=(0,U.jsx)(d,{className:`text-base font-semibold text-fg`,children:E}),t[2]=E,t[3]=D);let O=h?`只设置身份即可开始,所有能力自动继承全局配置。`:`Set its identity and start. Every capability inherits globally.`,k;t[4]===O?k=t[5]:(k=(0,U.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[4]=O,t[5]=k);let A;t[6]!==D||t[7]!==k?(A=(0,U.jsxs)(`div`,{children:[D,k]}),t[6]=D,t[7]=k,t[8]=A):A=t[8];let j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover`,"aria-label":`Close`,children:(0,U.jsx)(m,{className:`size-4`})})}),t[9]=j):j=t[9];let M;t[10]===A?M=t[11]:(M=(0,U.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,j]}),t[10]=A,t[11]=M);let N;t[12]===i?N=t[13]:(N=i?(0,U.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[12]=i,t[13]=N);let P=h?`名称`:`Name`,F=h?`智能体名称`:`Agent name`,I;t[14]===g?I=t[15]:(I=e=>g(e.target.value),t[14]=g,t[15]=I);let ee=h?`例如:数据分析师`:`For example: Data analyst`,L;t[16]!==a||t[17]!==F||t[18]!==I||t[19]!==ee?(L=(0,U.jsx)(`input`,{id:`create-agent-name`,"aria-label":F,className:`${ie} mt-1.5`,value:a,onChange:I,placeholder:ee}),t[16]=a,t[17]=F,t[18]=I,t[19]=ee,t[20]=L):L=t[20];let R;t[21]!==P||t[22]!==L?(R=(0,U.jsxs)(`label`,{htmlFor:`create-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[P,L]}),t[21]=P,t[22]=L,t[23]=R):R=t[23];let z=h?`个性与工作方式(可选)`:`Personality and working style (optional)`,B=h?`个性与工作方式`:`Personality and working style`,H;t[24]===_?H=t[25]:(H=e=>_(e.target.value),t[24]=_,t[25]=H);let te=h?`描述角色、语气和偏好的工作方式`:`Describe its role, tone, and preferred way of working`,W;t[26]!==p||t[27]!==B||t[28]!==H||t[29]!==te?(W=(0,U.jsx)(`textarea`,{id:`create-agent-instructions`,"aria-label":B,rows:4,className:`${ie} mt-1.5 resize-none`,value:p,onChange:H,placeholder:te}),t[26]=p,t[27]=B,t[28]=H,t[29]=te,t[30]=W):W=t[30];let G;t[31]!==z||t[32]!==W?(G=(0,U.jsxs)(`label`,{htmlFor:`create-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[z,W]}),t[31]=z,t[32]=W,t[33]=G):G=t[33];let K;t[34]!==N||t[35]!==R||t[36]!==G?(K=(0,U.jsxs)(`div`,{className:`space-y-4 p-5`,children:[N,R,G]}),t[34]=N,t[35]=R,t[36]=G,t[37]=K):K=t[37];let q=h?`取消`:`Cancel`,J;t[38]!==r||t[39]!==q?(J=(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(b,{disabled:r,children:q})}),t[38]=r,t[39]=q,t[40]=J):J=t[40];let Y;t[41]!==r||t[42]!==a?(Y=r||!a.trim(),t[41]=r,t[42]=a,t[43]=Y):Y=t[43];let X=r?h?`创建中…`:`Creating…`:h?`创建智能体`:`Create agent`,Z;t[44]!==y||t[45]!==Y||t[46]!==X?(Z=(0,U.jsx)(b,{variant:`primary`,disabled:Y,onClick:y,children:X}),t[44]=y,t[45]=Y,t[46]=X,t[47]=Z):Z=t[47];let Q;t[48]!==J||t[49]!==Z?(Q=(0,U.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[J,Z]}),t[48]=J,t[49]=Z,t[50]=Q):Q=t[50];let $;t[51]!==K||t[52]!==Q||t[53]!==M?($=(0,U.jsxs)(l,{children:[w,(0,U.jsxs)(u,{className:T,children:[M,K,Q]})]}),t[51]=K,t[52]=Q,t[53]=M,t[54]=$):$=t[54];let ne;return t[55]!==x||t[56]!==n||t[57]!==$?(ne=(0,U.jsx)(f,{open:n,onOpenChange:x,children:$}),t[55]=x,t[56]=n,t[57]=$,t[58]=ne):ne=t[58],ne}function oe(){let e=(0,V.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(x,{className:`h-7 w-28`}),(0,U.jsx)(x,{className:`h-4 w-80 max-w-full`})]}),(0,U.jsx)(x,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsxs)(B,{gap:`gap-5`,children:[t,(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(se)})]}),e[1]=n):n=e[1],n}function se(e){return(0,U.jsx)(x,{className:`h-64 rounded-2xl`},e)}function ce(){let e=g(e=>e.sessionKey),t=_(e=>e.language),n=t===`zh`,r=h(t).agentsSettings,o=i(),{agentId:s}=a(),{data:c,error:l,isLoading:u,mutate:d}=y(e?`settings-gateway-agents`:null,M),f=I(e=>e.setPageHeader),m=I(e=>e.clearPageHeader),[v,x]=(0,H.useState)({open:!1,name:``,instructions:``}),[S,C]=(0,H.useState)(!1),[w,T]=(0,H.useState)(null),E=(0,H.useRef)(!1),D=c?.agents.find(e=>e.id===s),k=(0,H.useMemo)(()=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(b,{onClick:()=>o(`/settings/agent-defaults`),children:n?`全局默认配置`:`Global defaults`}),(0,U.jsxs)(b,{variant:`primary`,onClick:()=>{T(null),x(e=>({...e,open:!0}))},children:[(0,U.jsx)(p,{className:`size-4`}),n?`新建智能体`:`New agent`]})]}),[o,n]);(0,H.useLayoutEffect)(()=>(f({startExtra:null,main:(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n?`智能体`:`Agents`}),end:k}),()=>m()),[m,k,f,n]);let A=async()=>{C(!0),T(null);try{let e=await ee({profile:{name:v.name.trim(),...v.instructions.trim()?{instructions:v.instructions.trim()}:{}}});x({open:!1,name:``,instructions:``}),o(`/agents/${e.createdAgentId}`)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}},N=async e=>{let t=j(e,r);if(window.confirm(n?`删除 ${t}?此操作无法撤销。`:`Delete ${t}? This cannot be undone.`)){C(!0),T(null);try{await L(e.id),o(`/agents`)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}},P=e=>{O(e),o(`/chat/new`)},F=e=>{E.current=!1,window.setTimeout(()=>o(`/agents/${e}`),0)},R=()=>{E.current&&!window.confirm(n?`放弃未保存的更改?`:`Discard unsaved changes?`)||(E.current=!1,o(`/agents`))},z=()=>{E.current&&!window.confirm(n?`放弃未保存的更改?`:`Discard unsaved changes?`)||(E.current=!1,o(`/settings/agent-defaults`))},V=(0,H.useCallback)(e=>{E.current=e},[]);return e?l&&!c?(0,U.jsxs)(B,{children:[(0,U.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(l)}),(0,U.jsx)(b,{onClick:()=>void d(),children:n?`重试`:`Retry`})]}):u||!c?(0,U.jsx)(oe,{}):(0,U.jsxs)(B,{gap:`gap-5`,className:`max-w-6xl`,padding:`px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(l||w)&&!D?(0,U.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:w??String(l)}):null,(0,U.jsx)(re,{agents:c.agents,busy:S,messages:r,onOpen:F,onChat:P}),D?(0,U.jsx)($,{agent:D,messages:r,open:!0,onOpenChange:e=>{e||R()},children:(0,U.jsx)(Q,{agent:D,toolIds:c.builtinToolIds,zh:n,messages:r,externalError:w,onDirtyChange:V,onClose:R,onOpenDefaults:z,onChat:()=>P(D.id),onDelete:()=>void N(D)},D.id)}):null,(0,U.jsx)(ae,{open:v.open,busy:S,error:w,name:v.name,instructions:v.instructions,zh:n,onNameChange:e=>x(t=>({...t,name:e})),onInstructionsChange:e=>x(t=>({...t,instructions:e})),onCreate:()=>void A(),onOpenChange:e=>{S||(x(t=>({...t,open:e})),e||T(null))}})]}):(0,U.jsx)(B,{children:(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`需要本机服务令牌。`:`Local service token required.`})})}export{ce as AgentsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,i as s,o as c,r as l,s as u,t as d}from"./dist-CpzYSoz7.js";import{t as f}from"./check-DUBLcKHA.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./markdown-view-c5vtnYe8.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./messages-DjuBdDCn.js";import{a as y,c as b,i as x,n as S,r as C}from"./locale-store-BBSCIl4I.js";import{t as w}from"./cn-JdwAhgNB.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-B11EPpor.js";import{t as O}from"./skeleton-BwbyijEw.js";import{Ha as k,Rc as A,Ua as j,Us as ee,Va as M,Wa as N,Ws as te,Zi as P,_u as F,dc as I,hc as L,ku as ne,lc as re,lo as R,qa as z,su as B,za as V}from"./index-C6OWYFtQ.js";import{t as H}from"./page-tabs-C7Le9bSI.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ie(e){let t=await x(C(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await x(C(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await x(C(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await x(C(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=v(S(e=>e.language)).extensionsPage,n=b(e=>!!e.sessionKey),r=M(),{mutate:i}=T(),[a,o]=(0,U.useReducer)(P,Z),{q:s,debounced:c,detailPkg:l,rowBusy:u,actionError:d,restartHint:f}=a,p=n?`marketplace-${c}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:m,isLoading:g,error:_}=E(p,async()=>y(c.length>0?C(`/api/marketplace?q=${encodeURIComponent(c)}`):C(`/api/marketplace`)),{revalidateOnFocus:!1}),x=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),z()},[i]),D=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});x(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,x]),k=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);x(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,x]),j=m?.extensions??[];return(0,X.jsxs)(`div`,{className:w(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(L,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:s,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),_?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_ instanceof Error?_.message:t.marketplaceLoadFailed}):null,d?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}):null,f?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f}):null,g&&!m?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(O,{className:`h-5 w-40`}),(0,X.jsx)(O,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(O,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(O,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:j.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):j.map(e=>{let n=ae(r,e.id),i=u===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:w(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(B,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&k(e.id).catch(()=>{})},className:w(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,X.jsx)(h,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(te,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:w(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),l?(0,X.jsx)($,{packageName:l,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:D,onUninstall:k}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:s,onInstall:f,onUninstall:p}=e,[g,v]=(0,U.useState)(!1),[y,x]=(0,U.useState)(!1),S=b(ue)?`ext-mp-detail-${n}`:null,C;t[0]===n?C=t[1]:(C=async()=>ie(n),t[0]=n,t[1]=C);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:k,isLoading:A}=E(S,C,T),j;t[3]!==i||t[4]!==n?(j=ae(i,n),t[3]=i,t[4]=n,t[5]=j):j=t[5];let M=j,N=M===`user`,P=D?.manifest?.permissions,F,I,L,R,z,B,V,H,G,K,q;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==D||t[29]!==k||t[30]!==M||t[31]!==A||t[32]!==s||t[33]!==P||t[34]!==y){let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==D?(n=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=D,t[48]=n):n=t[48];let i=n;L=d,R=!0,t[49]===s?z=t[50]:(z=e=>!e&&s(),t[49]=s,t[50]=z),I=c,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],F=l,H=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ne,{className:`size-5`}),t[52]=a):a=t[52];let f;t[53]!==r.detailBack||t[54]!==s?(f=(0,X.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=s,t[55]=f):f=t[55];let p;t[56]===r.marketplaceDetailTitle?p=t[57]:(p=(0,X.jsx)(u,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=p);let h;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(_,{className:`size-5`}),t[58]=h):h=t[58];let g;t[59]!==r.detailClose||t[60]!==s?(g=(0,X.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:h}),t[59]=r.detailClose,t[60]=s,t[61]=g):g=t[61],t[62]!==f||t[63]!==p||t[64]!==g?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[f,p,g]}),t[62]=f,t[63]=p,t[64]=g,t[65]=K):K=t[65],B=`min-h-0 flex-1 overflow-y-auto p-5`,V=A&&!D?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(O,{className:`h-6 w-48`}),(0,X.jsx)(O,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(O,{className:`h-12`}),(0,X.jsx)(O,{className:`h-12`})]}),(0,X.jsx)(O,{className:`h-28 w-full`}),(0,X.jsx)(O,{className:`h-36 w-full`})]}):k?(0,X.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:k instanceof Error?k.message:r.marketplaceLoadFailed})]}):D?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:D.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:D.downloads})]})]}),M===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,X.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?r.marketplaceCodeRisk:D.installability.reason??r.marketplaceUnavailableBody})]})]}),D.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>x(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(m,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=D,t[29]=k,t[30]=M,t[31]=A,t[32]=s,t[33]=P,t[34]=y,t[35]=F,t[36]=I,t[37]=L,t[38]=R,t[39]=z,t[40]=B,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else F=t[35],I=t[36],L=t[37],R=t[38],z=t[39],B=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==B||t[67]!==V?(J=(0,X.jsx)(`div`,{className:B,children:V}),t[66]=B,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==g||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==D||t[78]!==M||t[79]!==s||t[80]!==f||t[81]!==p||t[82]!==n||t[83]!==y||t[84]!==N?(Y=D?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:M===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:g||!D.installability.available||!y,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(v(!0),f(n,N).catch(se).finally(()=>v(!1)))},className:w(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[g?(0,X.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,X.jsxs)(`button`,{type:`button`,disabled:g,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(v(!0),p(n).then(()=>s()).catch(oe).finally(()=>v(!1)))},className:w(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,X.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=g,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=D,t[78]=M,t[79]=s,t[80]=f,t[81]=p,t[82]=n,t[83]=y,t[84]=N,t[85]=Y):Y=t[85];let Z;t[86]!==F||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(F,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=F,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==I||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(I,{children:[q,Z]}),t[93]=I,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==L||t[98]!==R||t[99]!==z||t[100]!==Q?($=(0,X.jsx)(L,{defaultOpen:R,onOpenChange:z,children:Q}),t[97]=L,t[98]=R,t[99]=z,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.sessionKey}function de(){let e=S(e=>e.language),t=v(e),n=R(e=>e.setPageHeader),r=R(e=>e.clearPageHeader),o=M(),s=k(),[c,l]=i(),u=G(c.get(`tab`)),d=c.get(`q`)??``,[f,p]=(0,U.useState)(u),[m,h]=(0,U.useState)(d),[_,y]=(0,U.useState)(null),b=c.toString(),x=(0,U.useRef)(b);if(x.current!==b){x.current=b;let e=G(c.get(`tab`)),t=c.get(`q`)??``;p(t=>t===e?t:e),h(e=>e===t?e:t)}(0,U.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=m.trim();return n?t.set(`q`,n):t.delete(`q`),f===`marketplace`?t.delete(`tab`):t.set(`tab`,f),t.toString()===e.toString()?e:t},{replace:!0})},[f,m,l]);let C=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=f===`builtin`?C:w,E=(0,U.useMemo)(()=>{let t=m.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,m,e]);if((0,U.useEffect)(()=>{y(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(F,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(D,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(g,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&f!==`marketplace`)return(0,X.jsx)(ye,{});let O=f!==`marketplace`&&T.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,X.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3 border-b border-edge-subtle pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:f,onChange:p,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(L,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),f===`marketplace`?(0,X.jsx)(Q,{}):f===`builtin`&&C.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):f===`user`&&w.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):E.length===0?(0,X.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:f===`user`,onOpen:()=>y(e)},e.id))})]}),_?(0,X.jsx)(_e,{extension:_,copy:t.extensionsPage,onClose:()=>y(null)},_.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,o;t[0]===n?o=t[1]:(o=fe(n),t[0]=n,t[1]=o);let s=o,c=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=w(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=l):l=t[2];let u=n.name||n.id,d;t[3]===u?d=t[4]:(d=u.charAt(0).toUpperCase(),t[3]=u,t[4]=d);let p;t[5]===d?p=t[6]:(p=(0,X.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:d}),t[5]=d,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let h;t[9]===n.version?h=t[10]:(h=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=h);let _;t[11]!==m||t[12]!==h?(_=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==s?(v=s?(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,X.jsx)(f,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,X.jsx)(g,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=s,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==c?(C=(0,X.jsx)(`span`,{title:c,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=c,t[27]=C):C=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,X.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==C||t[33]!==T?(E=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,T]}),t[32]=C,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==y||t[36]!==x||t[37]!==E?(D=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,E]}),t[35]=y,t[36]=x,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==p?(O=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[p,D]}),t[39]=D,t[40]=p,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:l,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,f]=(0,U.useState)(!1),[m,g]=(0,U.useState)(null),[v,y]=(0,U.useState)(!1),b=e.activationEligible===!0,x=(0,U.useCallback)(async()=>{if(e.source===`bundled`){g(null),y(!1),f(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!b});await r(`gateway-extensions-list`),z(),y(t)}catch(e){g(e instanceof Error?e.message:t.builtinToggleFailed)}finally{f(!1)}}},[b,t.builtinToggleFailed,e.id,e.source,r]),S=e.ui?.contributions?.pages??[],C=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],k=S.find(e=>e.showInNav)??S[0],A=C[0],ee=k?V(e.id,k):null,M=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||j(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(d,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(c,{children:[(0,X.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(l,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,X.jsx)(ne,{className:`size-5`})}),(0,X.jsx)(u,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(s,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,X.jsx)(_,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(D,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void x(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(h,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):b?t.builtinToggleDisable:t.builtinToggleEnable})]}),m?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:m}):null,v?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(S.length>0||C.length>0||E.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:S.length,hidden:S.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:C.length,hidden:C.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:E.length,hidden:E.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,N(e)&&(ee||M)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[ee?(0,X.jsxs)(a,{to:ee,onClick:n,className:w(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(p,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,M?(0,X.jsxs)(a,{to:M,onClick:n,className:w(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-B2_kr5EA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-zJ_50EbN.js";import{na as t}from"./index-C6OWYFtQ.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-D4PI9qAw.js","assets/preload-helper-zJ_50EbN.js","assets/docx-preview-CajIk2FR.js","assets/rolldown-runtime-aKtaBQYM.js","assets/jszip.min-DT31yWkU.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./preload-helper-zJ_50EbN.js";import{n}from"./excel-worksheet-utils-EyvwNT4X.js";var r=!1;async function i(){let e=await t(()=>import(`./pdf-D4PI9qAw.js`),__vite__mapDeps([0,1]));return r||=(e.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString(),!0),e}async function a(e,t){let n=(await i()).getDocument({data:e}),r=null;try{r=await n.promise;let e=`<pdf filename="${t}">`,i=await Promise.all(Array.from({length:r.numPages},(e,t)=>{let n=t+1;return(async()=>({pageNum:n,pageText:(await(await r.getPage(n)).getTextContent()).items.flatMap(e=>{let t=`str`in e?e.str:``;return t.trim()?[t]:[]}).join(` `)}))()}));for(let{pageNum:t,pageText:n}of i)e+=`\n<page number="${t}">\n${n}\n</page>`;e+=`
|
|
3
|
-
</pdf>`;let a=await o(r);return{extractedText:e,preview:a}}finally{await n.destroy()}}async function o(e){try{let t=await e.getPage(1),n=t.getViewport({scale:1}),r=Math.min(160/n.width,160/n.height),i=t.getViewport({scale:r}),a=document.createElement(`canvas`),o=a.getContext(`2d`);return o?(a.height=i.height,a.width=i.width,await t.render({canvasContext:o,viewport:i,canvas:a}).promise,a.toDataURL(`image/png`).split(`,`)[1]):void 0}catch{return}}async function s(e,n){let{parseAsync:r}=await t(async()=>{let{parseAsync:e}=await import(`./docx-preview-CajIk2FR.js`);return{parseAsync:e}},__vite__mapDeps([2,3,4]));try{let t=await r(e),i=`<docx filename="${n}">\n<page number="1">\n`,a=t.documentPart?.body;if(a?.children){let e=[];for(let t of a.children){let n=c(t);n&&e.push(n)}i+=e.join(`
|
|
4
|
-
`)}return i+=`
|
|
5
|
-
</page>
|
|
6
|
-
</docx>`,{extractedText:i}}catch(e){throw Error(`Failed to process DOCX: ${String(e)}`)}}function c(e){let t=e,n=``,r=t.type?.toLowerCase()||``;if(r===`paragraph`&&t.children)for(let e of t.children){let t=e;if((t.type?.toLowerCase()||``)===`run`&&t.children)for(let e of t.children){let t=e;(t.type?.toLowerCase()||``)===`text`&&(n+=t.text||``)}}else if(r===`table`){if(t.children){let e=[];for(let n of t.children){let t=n;if((t.type?.toLowerCase()||``)===`tablerow`&&t.children){let n=[];for(let e of t.children){let t=e;if((t.type?.toLowerCase()||``)===`tablecell`&&t.children){let e=[];for(let n of t.children){let t=c(n);t&&e.push(t)}e.length>0&&n.push(e.join(` `))}}n.length>0&&e.push(n.join(` | `))}}e.length>0&&(n=`\n[Table]\n${e.join(`
|
|
7
|
-
`)}\n[/Table]\n`)}}else if(t.children&&Array.isArray(t.children)){let e=[];for(let n of t.children){let t=c(n);t&&e.push(t)}n=e.join(` `)}return n.trim()}var l=120,u=12e5;function d(e){let t=[];try{if(typeof DOMParser>`u`){let n=/<a:t[^>]*>([^<]*)<\/a:t>/g,r;for(;(r=n.exec(e))!==null;){let e=r[1]?.trim();e&&t.push(e)}return t}let n=new DOMParser().parseFromString(e,`text/xml`);if(n.querySelector(`parsererror`))return t;let r=n.getElementsByTagNameNS(`http://schemas.openxmlformats.org/drawingml/2006/main`,`t`);if(r.length>0){for(let e=0;e<r.length;e++){let n=r[e]?.textContent?.trim();n&&t.push(n)}return t}let i=n.querySelectorAll(`*|t`);for(let e=0;e<i.length;e++){let n=i[e]?.textContent?.trim();n&&t.push(n)}}catch{}return t}async function f(n,r){let i=(await t(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([4,3]))).default;try{let e=await i.loadAsync(n),t=`<pptx filename="${r}">`,a=Object.keys(e.files).filter(e=>e.match(/ppt\/slides\/slide\d+\.xml$/)).sort((e,t)=>Number.parseInt(e.match(/slide(\d+)\.xml$/)?.[1]||`0`,10)-Number.parseInt(t.match(/slide(\d+)\.xml$/)?.[1]||`0`,10)),o=Math.min(a.length,l);a.length>l&&(t+=`\n<!-- truncated: ${a.length} slides, processing first ${l} -->`);let s=await Promise.all(a.slice(0,o).map(async(t,n)=>{let r=e.file(t);return r?{i:n,slideXml:await r.async(`text`)}:{i:n,slideXml:null}})),c=async e=>{if(e>=s.length)return;if(t.length>=u){t+=`\n<!-- extraction stopped: size limit ${u} chars -->`;return}let{i:n,slideXml:r}=s[e];if(r){let e=d(r);if(e.length>0){t+=`\n<slide number="${n+1}">`;let r=e.join(`
|
|
8
|
-
`),i=u-t.length-32;t+=i>=r.length?`\n${r}`:`\n${r.slice(0,Math.max(0,i))}`,t+=`
|
|
9
|
-
</slide>`}}e%4==3&&e+1<s.length&&await new Promise(e=>setTimeout(e,0)),await c(e+1)};return await c(0),t+=`
|
|
10
|
-
</pptx>`,{extractedText:t}}catch(e){throw Error(`Failed to process PPTX: ${String(e)}`)}}async function p(e,r){let i=await t(()=>import(`./xlsx-CKkngM-o.js`),[]);try{let t=i.read(e,{type:`array`}),a=`<excel filename="${r}">`,o=t.SheetNames??[];for(let[e,r]of o.entries()){let o=t.Sheets[r],s=n(i,o,r);a+=`\n<sheet name="${r}" index="${e+1}">\n${s}\n</sheet>`}return a+=`
|
|
11
|
-
</excel>`,{extractedText:a}}catch(e){throw Error(`Failed to process Excel: ${String(e)}`)}}export{s as processDocx,p as processExcel,a as processPdf,f as processPptx};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,n as s,o as c,r as l,s as u,t as d}from"./dist-CpzYSoz7.js";import{n as f,r as p}from"./popover-select-Dz_Qis2R.js";import{t as m}from"./circle-check-C23XjkUj.js";import{t as h}from"./markdown-view-c5vtnYe8.js";import{t as g}from"./git-branch-Dh9uxTot.js";import{t as ee}from"./message-circle-Badhj-4D.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as te}from"./messages-DjuBdDCn.js";import{n as y}from"./locale-store-BBSCIl4I.js";import{t as b}from"./cn-JdwAhgNB.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{t as S}from"./button-B11EPpor.js";import{t as C}from"./skeleton-BwbyijEw.js";import{Aa as w,Bl as ne,Ki as re,Mc as T,Ns as ie,Nu as ae,Oc as oe,Pc as se,Qc as E,Sn as D,Ws as ce,aa as O,an as k,bc as A,bn as j,cu as M,du as le,hc as N,ic as ue,l as P,lc as F,lo as I,lu as L,pu as R,wn as de,xn as fe,y as z,yn as pe}from"./index-C6OWYFtQ.js";import{a as B,i as V,o as H,r as U}from"./cron-expression-C26e13YU.js";import{a as W,i as me,n as he,r as ge,t as _e}from"./workflow-run-setup-panel-CHdr_ng9.js";import{i as ve,n as ye,r as be,t as G}from"./browser-automation-inputs-6NWTLEpd.js";var K=e(t(),1),xe=n(),Se=B();function q(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function Ce(e,t){let n=e===7?0:e;return new Date(Date.UTC(2023,0,1)+n*864e5).toLocaleDateString(t,{weekday:`short`,timeZone:`UTC`})}function we(e,t){return e.length<=1?e[0]??``:t.startsWith(`zh`)?e.join(`、`):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function Te(e){return e.length===5&&e.every((e,t)=>e===t+1)}function Ee(e){if(e.length!==2)return!1;let t=[...e].toSorted((e,t)=>e-t);return t[0]===0&&t[1]===6}function De(e,t,n,r){try{let i=Se.CronExpressionParser.parse(e,{...r?.timezone?{tz:r.timezone}:{}}).fields,a=U(i.minute.values),o=U(i.hour.values),s=U(i.dayOfWeek.values),c=U(i.dayOfMonth.values);if(a.length===60&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.everyMinute;if(!i.minute.isWildcard&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&a.length>1){let e=V(a);if(e!=null&&e>0)return n.everyNMinutes.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length>1&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard){let e=V(o);if(e!=null&&e>0)return n.everyNHours.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&o.length===24)return n.hourly;let l=!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length===1?q(o[0],a[0],t):``;if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.dailyAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Te(s))return n.weekdaysAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Ee(s))return n.weekendsAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length===1){let e=Ce(s[0],t);return n.weeklyOn.replace(`{{day}}`,e).replace(`{{time}}`,l)}if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length>1){let e=we(s.map(e=>Ce(e,t)),t);return n.daysAt.replace(`{{days}}`,e).replace(`{{time}}`,l)}return l&&!i.dayOfMonth.isWildcard&&c.length===1&&i.month.isWildcard&&i.dayOfWeek.isWildcard?n.monthlyAt.replace(`{{day}}`,String(c[0])).replace(`{{time}}`,l):n.customSchedule}catch{return null}}function J(e,t,n,r){let i=e.trim();return i?De(i,t,n,r)||Oe(r?.nextRun,t)||n.customSchedule:Oe(r?.nextRun,t)||`—`}function Oe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleString(t,{weekday:`short`,hour:`numeric`,minute:`2-digit`})}var ke=1e3,Y=60*ke,X=60*Y,Ae=24*X,je=7*Ae,Me=new Intl.ListFormat(`en-US`,{type:`conjunction`}),Ne=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),Pe={en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},Fe={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Ie={minute:Y,hour:X,day:Ae,week:je};function Le(e){return e===`zh`?`zh-CN`:`en-US`}function Re(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:Ne[String(t)].format(e)}function ze(e,t){return t===`zh`?e.join(` `):Me.format(e)}function Be(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(Y,Math.round((Number.isFinite(n)&&n>0?n:1)*Ie[t]))}function Ve(e,t,n){let r=typeof e==`number`?e:Number.parseFloat(e),i=Number.isFinite(r)&&r>0?r:1;return String(Number.parseFloat((i*Ie[t]/Ie[n]).toFixed(6)))}function He(e,t){let n=Math.max(ke,Math.round(e)),r=n===Ae?[{unit:`hour`,ms:X}]:n>=je&&n%je===0?[{unit:`week`,ms:je}]:n>=Ae?[{unit:`day`,ms:Ae},{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=X?[{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=Y?[{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:[{unit:`second`,ms:ke}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(Re(r,e,t)),i%=n)}return ze(a,t)}function Ue(e,t){let n=He(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function We(e,t){return Pe[t].format(new Date(e))}function Ge(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function Ke(e,t,n=Date.now()){let r=new Date(e),i=Math.round((Ge(r)-Ge(new Date(n)))/Ae),a=Fe[t].format(r);return i===0?t===`zh`?`今天 ${a}`:`today at ${a}`:i===1?t===`zh`?`明天 ${a}`:`tomorrow at ${a}`:i===-1?t===`zh`?`昨天 ${a}`:`yesterday at ${a}`:We(e,t)}function qe(e,t){return e.eventType===`task.attention_required.v2`&&e.payloadMatch?.reason===`blocked`?t.trigger.taskBlockedWhen:e.eventType===`note.created`?t.trigger.noteCreatedWhen:e.eventType===`workflow.run.completed`&&e.payloadMatch?.status===`failed`?t.trigger.workflowFailedWhen:e.eventType===`session.transcript.updated`?t.trigger.sessionUpdatedWhen:t.trigger.eventWithType.replace(`{type}`,e.eventType)}function Je(e,t,n,r){if(e.kind===`manual`)return t.trigger.manualWhen;if(e.kind===`webhook`)return t.trigger.webhookWhen;if(e.kind===`event`)return qe(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,Ke(Date.parse(i.at),r)):i.kind===`interval`?Ue(i.everyMs,r):J(i.expr,Le(r),n.scheduleBadge,{timezone:i.tz})}function Ye(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?Ke(e.state.nextRunAtMs,n,r):e.trigger.kind===`manual`?t.info.noAutomaticTrigger:e.trigger.kind===`event`||e.trigger.kind===`webhook`?t.info.waitingForTrigger:t.info.noUpcomingRun:t.info.pausedNoAutomaticRuns}function Xe(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=Ke(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var Ze={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserAutomationId:``,browserAutomationInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,completionWebhookUrl:``,disableAfterFailures:`3`},Qe=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function $e(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)o={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Be(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=ge(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_automation`?`auto_apply`:e.safetyMode,u;return u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{}}:e.actionMode===`browser_automation`?{kind:`browser_automation`,automationId:e.browserAutomationId.trim(),inputs:e.browserAutomationInputs}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:o,action:u,safety:{mode:l},conversationMode:e.conversationMode,notificationPolicy:e.notificationPolicy,...l===`auto_apply`&&e.completionWebhookUrl.trim()?{completionWebhookUrl:e.completionWebhookUrl.trim()}:{},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function et(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:Ze.time,weekday:Ze.weekday,cronExpr:e}}function tt(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function nt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function rt(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function it(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function at(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function ot(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=rt(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=et(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...tt(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:nt(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?it(r.input):{},o=e.reliability?.executionTimeoutSeconds??r.timeoutSeconds??e.reliability?.timeoutSeconds??(r.kind===`browser_automation`?600:1800);return{...Ze,...n,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:r.kind,agentId:r.kind===`browser_automation`?``:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserAutomationId:r.kind===`browser_automation`?r.automationId:``,browserAutomationInputs:r.kind===`browser_automation`?r.inputs??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?he(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(o),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.notificationPolicy??`attention`,completionWebhookUrl:e.completionWebhookUrl??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function st(e,t,n){let r=$e(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;return e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId}:e.action.kind===`workflow`&&r.action.kind===`workflow`?a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}:e.action.kind===`browser_automation`&&r.action.kind===`browser_automation`&&(a={...e.action,...r.action}),{...r,description:t.description.trim(),projectId:t.projectId.trim(),completionWebhookUrl:t.completionWebhookUrl.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function ct(e,t,n){return e?We(e,n):t.never}function lt(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_automation`?`Browser automation: ${e.automationId}`:e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function ut(e){return e.safety?.mode??`auto_apply`}function dt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function ft(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function pt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function mt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function ht(e,t){if((e.state.consecutiveFailures??0)>0)return!0;let n=t.reduce((t,n)=>n.automationId===e.id&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0);return n?mt(n):!1}function gt(e,t){return e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`&&e.action.goal?.trim()||lt(e.action,t)}function _t(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function vt(e){return!!_t(e)}function yt(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function bt(e){return pt(e)?0:mt(e)?1:e.status===`succeeded`?2:3}function xt(e){return[...e].sort((e,t)=>{let n=bt(e)-bt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function St(){let e=(0,xe.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Z.jsx)(C,{className:`h-4 w-36`}),(0,Z.jsx)(C,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(C,{className:`h-7 w-20 rounded-full`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[t,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(Ct)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(C,{className:`h-4 w-32`}),i=(0,Z.jsx)(C,{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)(C,{className:`h-12 rounded-lg`}),(0,Z.jsx)(C,{className:`h-12 rounded-lg`}),(0,Z.jsx)(C,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function Ct(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(C,{className:`size-4 rounded-full`}),(0,Z.jsx)(C,{className:`h-4 w-32`}),(0,Z.jsx)(C,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(C,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(C,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(C,{className:`h-8 w-24 rounded-md`})]})},t)}function wt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let a=y(e=>e.language),m=te(a),h=m.automations,g=m.cron,ee=I(e=>e.setPageHeader),C=I(e=>e.clearPageHeader),[T,ae]=i(),oe=T.get(`run`)?.trim()??``,se=T.get(`automation`)?.trim()??``,E=T.get(`draft`)?.trim()??``,ce=T.get(`action`)?.trim()??``,k=T.get(`projectId`)?.trim()??``,A=e?.trim()||k,M=!!e?.trim(),le=T.get(`autogenerate`)===`1`,ue=(0,K.useRef)(``),[F,L]=(0,K.useState)(`all`),[R,B]=(0,K.useState)(``),[V,H]=(0,K.useState)(!1),[U,W]=(0,K.useState)(`blank`),[he,ge]=(0,K.useState)(null),[_e,be]=(0,K.useState)(!1),[G,xe]=(0,K.useState)(Ze),[Se,q]=(0,K.useState)(null),[Ce,we]=(0,K.useState)(null),[Te,Ee]=(0,K.useState)(!1),[De,J]=(0,K.useState)(null),[Oe,ke]=(0,K.useState)(``),[Y,X]=(0,K.useState)(null),[Ae,je]=(0,K.useState)(!1),[Me,Ne]=(0,K.useState)(!1),[Pe,Fe]=(0,K.useState)(A),[Ie,Le]=(0,K.useState)(`new_session`),[Re,ze]=(0,K.useState)(`attention`),[Be,Ve]=(0,K.useState)(null),[He,Ue]=(0,K.useState)(!1),[We,Ge]=(0,K.useState)(!1),[Ke,qe]=(0,K.useState)(!1),[Ye,Xe]=(0,K.useState)(null),Qe=x([`automations`,A],()=>P.list(A?{projectId:A}:void 0),{refreshInterval:15e3}),et=x([`automation-runs`,A],()=>P.runs(50,void 0,A?{projectId:A}:void 0),{refreshInterval:1e4}),tt=x(Ce?`automation-run-events:${Ce}`:null,()=>P.runEvents(Ce),{refreshInterval:5e3}),nt=x(`automation-workflow-definitions`,z),rt=x(`automation-browser-automations`,()=>ve.list()),it=x(`automation-chat-agents`,O),ct=x(`automation-projects`,()=>w({sortBy:`name`,sortOrder:`asc`,limit:200})),lt=Qe.isLoading&&!Qe.data||et.isLoading&&!et.data,ut=Qe.data?.automations??[],dt=(0,K.useMemo)(()=>xt(et.data?.runs??[]),[et.data?.runs]),ft=(0,K.useMemo)(()=>ut.filter(e=>!vt(e)),[ut]),mt=(0,K.useMemo)(()=>ut.filter(vt),[ut]),ht=(0,K.useMemo)(()=>new Set(mt.map(e=>e.id)),[mt]),_t=(0,K.useMemo)(()=>dt.filter(e=>!ht.has(e.automationId)),[dt,ht]),bt=(0,K.useMemo)(()=>dt.find(e=>e.id===Ce)??null,[dt,Ce]),Ct=(0,K.useMemo)(()=>ut.find(e=>e.id===De)??null,[ut,De]),wt=(0,K.useMemo)(()=>ut.find(e=>e.id===he)??null,[ut,he]),Et=(0,K.useMemo)(()=>dt.filter(e=>e.automationId===De).sort((e,t)=>t.createdAtMs-e.createdAtMs),[dt,De]),Dt=tt.data?.events??[],Ot=(0,K.useMemo)(()=>_t.filter(e=>!pt(e)&&e.readAtMs==null),[_t]),At=R.trim().toLocaleLowerCase(),jt=(0,K.useMemo)(()=>(F===`system`?mt:ft).filter(e=>F===`active`&&!e.enabled||F===`paused`&&e.enabled?!1:At?[e.name,yt(e),gt(e,h),Je(e.trigger,h,g,a)].some(e=>e.toLocaleLowerCase().includes(At)):!0),[g,F,h,a,At,mt,ft,_t]),Mt=(0,K.useMemo)(()=>nt.data??[],[nt.data]),Nt=(0,K.useMemo)(()=>(rt.data?.automations??[]).filter(e=>e.enabled),[rt.data]),It=it.data?.items??[],Lt=ct.data?.items??[],Rt=(0,K.useMemo)(()=>Mt.find(e=>e.id===G.workflowId.trim())??null,[G.workflowId,Mt]),zt=(0,K.useMemo)(()=>Nt.find(e=>e.id===G.browserAutomationId.trim())??null,[Nt,G.browserAutomationId]),Bt=G.actionMode===`workflow`&&(!G.workflowId.trim()||Mt.length>0&&!Mt.some(e=>e.id===G.workflowId)),Vt=G.actionMode===`workflow`&&Rt?!me(Rt,G.workflowInput,G.workflowInputValid).valid:!1,Ht=!!G.name.trim()&&(G.triggerMode!==`once`||Number.isFinite(new Date(G.onceAt).getTime()))&&(G.triggerMode!==`event`||!!G.eventType.trim()&&at(G.eventPayloadMatch))&&(G.actionMode===`workflow`?!Bt&&!Vt:G.actionMode===`browser_automation`?zt!==null&&ye(zt,G.browserAutomationInputs):!!G.instruction.trim()),Gt=(0,K.useMemo)(()=>[{name:h.templates.dailyAgent.name,description:h.templates.dailyAgent.description,form:{...Ze,name:h.templates.dailyAgent.name,instruction:h.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:h.templates.morningWorkflow.name,description:h.templates.morningWorkflow.description,form:{...Ze,name:h.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:Mt[0]?.id??``}},{name:h.templates.webhookAgent.name,description:h.templates.webhookAgent.description,form:{...Ze,name:h.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:h.templates.blockedTask.name,description:h.templates.blockedTask.description,form:{...Ze,name:h.templates.blockedTask.formName,triggerMode:`taskBlocked`,instruction:h.templates.blockedTask.instruction}},{name:h.templates.noteCreated.name,description:h.templates.noteCreated.description,form:{...Ze,name:h.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:h.templates.noteCreated.instruction}}],[h,Mt]);(0,K.useEffect)(()=>{if(jt.length===0){J(null);return}De&&jt.some(e=>e.id===De)||J(jt[0].id)},[jt,De]);let Kt=(0,K.useCallback)(async()=>{await Promise.all([Qe.mutate(),et.mutate(),tt.mutate()])},[Qe.mutate,tt.mutate,et.mutate]),qt=(0,K.useCallback)(e=>{if(M){J(null),we(null);return}ae(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),J(null),we(null)},[M,ae]);(0,K.useEffect)(()=>{M&&(Fe(A),xe(e=>e.projectId===A?e:{...e,projectId:A}))},[A,M]);let $=(0,K.useCallback)(e=>{if(ge(null),be(!1),W(e),H(!0),e===`blank`){xe({...Ze,projectId:A});return}ke(``),X(null),Ne(!1),Fe(A),Le(`new_session`),ze(`attention`)},[A]),Jt=(0,K.useCallback)(e=>{xe(ot(e,Mt)),ge(e.id),be(!1),J(null),W(`blank`),H(!0)},[Mt]),Yt=(0,K.useCallback)(()=>{Y&&(xe({...ot(Y.automation,Mt),projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),ge(null),be(!0),W(`blank`))},[Y,Ie,Re,Pe,Mt]),Xt=(0,K.useCallback)(async()=>{qe(!0),q(null);try{await Kt()}catch(e){q(e instanceof Error?e.message:String(e))}finally{qe(!1)}},[h.feedback.actionFailed,Kt]);(0,K.useEffect)(()=>{if(!se)return;let e=ut.find(e=>e.id===se);e&&(L(vt(e)?`system`:`all`),J(e.id),ae(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[se,ut,ae]),(0,K.useEffect)(()=>{ce===`create`&&($(`blank`),ae(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[ce,$,ae]),(0,K.useEffect)(()=>{if(!E)return;let e=`${a}:${le?`auto`:`seed`}:${E}`;ue.current!==e&&(ue.current=e,ke(E),X(null),Ne(!1),Fe(A),W(`draft`),H(!0),ae(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),le&&(q(null),je(!0),P.draft({prompt:E,language:a}).then(e=>{X(e.draft),Ne(!1)}).catch(e=>{q(e instanceof Error?e.message:String(e))}).finally(()=>{je(!1)})))},[le,E,a,A,ae]);let Zt=(0,K.useCallback)(e=>{let t=dt.find(t=>t.id===e);if(!t||pt(t)||t.readAtMs!=null)return;let n=Date.now();et.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),P.markRunRead(e).catch(e=>{q(e instanceof Error?e.message:String(e)),et.mutate()})},[dt,et.mutate]),Qt=(0,K.useCallback)(e=>{Zt(e),we(e),Ee(!0),ae(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Zt,ae]),$t=(0,K.useCallback)(e=>{J(e);let t=dt.find(t=>t.automationId===e);t&&t.readAtMs==null&&!pt(t)&&Zt(t.id)},[Zt,dt]);(0,K.useEffect)(()=>{oe&&(Zt(oe),we(oe),Ee(!0))},[Zt,oe]),(0,K.useEffect)(()=>{Ve(null),Ge(!1)},[Ce]);async function en(){if(q(null),Ht){if(_e&&Y){Xe(`draft:edit`);try{let e=$e(G,Rt),{simulation:t}=await P.simulate(e);X({...Y,automation:e,simulation:t}),Fe(G.projectId),Le(G.conversationMode),ze(G.notificationPolicy),Ne(!1),be(!1),W(`draft`)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Xe(null)}return}if(wt){let e=wt.id;await tn(`automation:${e}:edit`,()=>P.update(e,st(wt,G,Rt)))&&(H(!1),ge(null),J(e));return}try{let e=$e(G,Rt),{automation:t}=await P.create(e);xe(Ze),H(!1),L(`all`),B(``),qt(t.projectId??``),await Kt(),J(t.id)}catch(e){q(e instanceof Error?e.message:String(e))}}}async function tn(e,t){q(null),Xe(e);try{return await t(),await Kt(),!0}catch(e){return q(e instanceof Error?e.message:String(e)),!1}finally{Xe(null)}}async function nn(){await tn(`runs:read-all`,()=>P.markAllRunsRead(A||void 0))}async function rn(){let e=Oe.trim();if(e){q(null),je(!0);try{X((await P.draft({prompt:e,language:a})).draft),Ne(!1)}catch(e){q(e instanceof Error?e.message:String(e))}finally{je(!1)}}}async function an(){if(!Y)return;let e=``,t=``;await tn(`draft:publish`,async()=>{let{automation:n}=await P.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re});X(null),ke(``),Ne(!1),H(!1),L(`all`),B(``),e=n.id,t=n.projectId??``})&&e&&(qt(t),J(e))}async function on(){if(!Y)return;let e=``,t=``,n=``;await tn(`draft:test`,async()=>{let{automation:r}=await P.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re,enabled:!1}),{run:i}=await P.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,X(null),ke(``),Ne(!1),H(!1),L(`all`),B(``)})&&e&&n&&(qt(t),J(e),Qt(n))}async function sn(e){q(null),Ue(!0),Ve(null),Ge(!1);try{Ve((await P.repairDraft(e.id,{language:a})).repair)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}async function cn(e){Be&&await tn(`run:${e.id}:repair`,async()=>{await P.update(e.automationId,Be.patch),Ve(null),Ge(!1)})}let ln=(0,K.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(re,{className:`size-9 shrink-0 p-0`,loading:Ke,label:h.refresh,onClick:Xt}),(0,Z.jsxs)(S,{variant:`primary`,onClick:()=>$(`draft`),children:[(0,Z.jsx)(_,{className:`size-4`}),h.new]})]}),[h.new,h.refresh,$,Ke,Xt]);return(0,K.useLayoutEffect)(()=>{if(!t)return ee({startExtra:null,main:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h.title}),end:ln}),()=>C()},[C,t,ln,h.title,ee]),(0,Z.jsxs)(`div`,{className:b(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,Z.jsxs)(`div`,{className:b(`flex w-full flex-col gap-4`,t?`py-1`:`mx-auto max-w-[96rem] px-4 py-7 sm:px-6 lg:px-8 lg:py-9`),children:[t?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ie,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||h.title})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||h.subtitle})]}),ln]}):null,Se?(0,Z.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Se}):null,lt?(0,Z.jsx)(St,{}):(0,Z.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[20rem_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle p-3`,children:[M?null:(0,Z.jsxs)(f,{"aria-label":h.filters.project,className:Q,value:A,onChange:e=>qt(e.target.value),children:[(0,Z.jsx)(p,{value:``,children:h.filters.allProjects}),Lt.map(e=>(0,Z.jsx)(p,{value:e.id,children:e.name},e.id))]}),(0,Z.jsxs)(`label`,{className:b(`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg-muted focus-within:border-accent`,!M&&`mt-2`),children:[(0,Z.jsx)(N,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:R,onChange:e=>B(e.target.value),placeholder:h.filters.search})]}),(0,Z.jsxs)(`nav`,{className:`mt-3 flex items-center gap-1`,"aria-label":h.filters.status,children:[[{id:`all`,label:h.filters.all},{id:`active`,label:h.filters.active},{id:`paused`,label:h.paused}].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:b(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,F===e.id&&`bg-surface-hover text-fg`),onClick:()=>L(e.id),children:e.label},e.id)),(0,Z.jsxs)(D,{children:[(0,Z.jsx)(de,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:b(`ml-auto rounded-md p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,F===`system`&&`bg-surface-hover text-fg`),"aria-label":h.system.title,children:(0,Z.jsx)(ne,{className:`size-4`})})}),(0,Z.jsx)(fe,{children:(0,Z.jsx)(pe,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,Z.jsxs)(j,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>L(`system`),children:[h.system.title,` `,mt.length]})})})]})]}),Ot.length>0&&F!==`system`?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 rounded-md bg-accent/8 px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,Z.jsxs)(`span`,{children:[h.filters.unread,` · `,Ot.length]}),(0,Z.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:Ye===`runs:read-all`,onClick:()=>void nn(),children:h.filters.markAllRead})]}):null]}),(0,Z.jsx)(kt,{automations:jt,runs:F===`system`?dt:_t,labels:h,cronLabels:g,language:a,selectedAutomationId:De,onOpenDetails:$t})]}),Ct?(0,Z.jsx)(Ft,{automation:Ct,runs:Et,labels:h,cronLabels:g,language:a,projects:Lt,busyAction:Ye,onEdit:Jt,onSelectRun:Qt,onAction:tn}):(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(ie,{className:`size-5`}),title:h.empty.filtered})]})]}),(0,Z.jsx)(d,{open:V,onOpenChange:e=>{H(e),e||(ge(null),be(!1))},children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(l,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(u,{className:`text-base font-semibold text-fg`,children:U===`draft`?h.draft.title:wt?h.editTitle:_e?h.draft.editTitle:h.createTitle}),(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,"aria-label":h.close,children:(0,Z.jsx)(v,{className:`size-4`})})})]}),U===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(Tt,{labels:h,prompt:Oe,draft:Y,loading:Ae,approved:Me,publishBusy:Ye===`draft:publish`,testBusy:Ye===`draft:test`,templates:Gt,projects:Lt,projectId:Pe,conversationMode:Ie,notificationPolicy:Re,onPromptChange:ke,onGenerate:rn,onEdit:Yt,onPublish:an,onTest:on,onProjectChange:Fe,onConversationModeChange:Le,onNotificationPolicyChange:ze,projectLocked:M,onApprovedChange:Ne,onDiscard:()=>{X(null),Ne(!1)},onTemplateSelect:e=>{xe({...e,projectId:Pe}),W(`blank`)},onOpenAdvanced:()=>{xe({...Ze,projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),W(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wt,{form:G,labels:h,setForm:xe,projects:Lt,workflowDefinitions:Mt,selectedWorkflow:Rt,workflowsLoading:nt.isLoading,browserAutomations:Nt,selectedBrowserAutomation:zt,browserAutomationsLoading:rt.isLoading,agentOptions:It,agentsLoading:it.isLoading,language:a,projectLocked:M}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[_e?(0,Z.jsx)(S,{variant:`ghost`,onClick:()=>{be(!1),W(`draft`)},children:h.cancel}):(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,children:h.cancel})}),(0,Z.jsx)(S,{variant:`primary`,onClick:en,disabled:!Ht||Ye===`draft:edit`||!!(wt&&Ye),children:Ye===`draft:edit`||wt&&Ye===`automation:${wt.id}:edit`?h.feedback.working:wt||_e?h.save:h.create})]})]})]})]})}),(0,Z.jsx)(d,{open:Te&&!!bt,onOpenChange:e=>{Ee(e),!e&&ae(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(l,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(u,{className:`truncate text-base font-semibold text-fg`,children:bt?.automationName??h.dashboard.result}),(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,"aria-label":h.close,children:(0,Z.jsx)(v,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(Pt,{className:`rounded-none border-0`,run:bt,events:Dt,labels:h,cronLabels:g,language:a,loading:tt.isLoading,repairDraft:Be,repairLoading:He,repairApproved:We,busyAction:Ye,onRepairApprovedChange:Ge,onSuggestRepair:sn,onApplyRepair:cn})})]})]})})]})}function Tt(e){let t=(0,xe.c)(108),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,testBusy:c,templates:l,projects:u,projectId:d,conversationMode:m,notificationPolicy:h,onPromptChange:g,onGenerate:ee,onEdit:_,onPublish:v,onTest:te,onProjectChange:y,onConversationModeChange:x,onNotificationPolicyChange:C,onApprovedChange:w,onDiscard:ne,onTemplateSelect:re,onOpenAdvanced:ie,projectLocked:ae}=e,se=s===void 0?!1:s,E=c===void 0?!1:c,D=ae===void 0?!1:ae,ce=!!(i&&i.simulation.requiredConfirmations.length>0),O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(ue,{className:`size-4 text-accent`}),t[0]=O):O=t[0];let k;t[1]===n.draft.title?k=t[2]:(k=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[O,n.draft.title]}),t[1]=n.draft.title,t[2]=k);let A;t[3]===n.draft.subtitle?A=t[4]:(A=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=A);let j;t[5]!==k||t[6]!==A?(j=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[5]=k,t[6]=A,t[7]=j):j=t[7];let M;t[8]!==a||t[9]!==r?(M=a||!r.trim(),t[8]=a,t[9]=r,t[10]=M):M=t[10];let le;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(ue,{className:`size-4`}),t[11]=le):le=t[11];let N=a?n.draft.generating:n.draft.generate,P;t[12]!==ee||t[13]!==N||t[14]!==M?(P=(0,Z.jsxs)(S,{variant:`primary`,onClick:ee,disabled:M,children:[le,N]}),t[12]=ee,t[13]=N,t[14]=M,t[15]=P):P=t[15];let F;t[16]!==P||t[17]!==j?(F=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,P]}),t[16]=P,t[17]=j,t[18]=F):F=t[18];let I;t[19]===g?I=t[20]:(I=e=>g(e.target.value),t[19]=g,t[20]=I);let L;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==I?(L=(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:I,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=I,t[24]=L):L=t[24];let R=D?`sm:grid-cols-2`:`sm:grid-cols-3`,de;t[25]===R?de=t[26]:(de=b(`mt-3 grid gap-3`,R),t[25]=R,t[26]=de);let fe;t[27]!==n.draft.noProject||t[28]!==n.draft.project||t[29]!==y||t[30]!==d||t[31]!==D||t[32]!==u?(fe=D?null:(0,Z.jsx)($,{label:n.draft.project,children:(0,Z.jsxs)(f,{className:Q,value:d,onChange:e=>y(e.target.value),children:[(0,Z.jsx)(p,{value:``,children:n.draft.noProject}),u.map(Et)]})}),t[27]=n.draft.noProject,t[28]=n.draft.project,t[29]=y,t[30]=d,t[31]=D,t[32]=u,t[33]=fe):fe=t[33];let z;t[34]===x?z=t[35]:(z=e=>x(e.target.value),t[34]=x,t[35]=z);let pe;t[36]===n.draft.newConversation?pe=t[37]:(pe=(0,Z.jsx)(p,{value:`new_session`,children:n.draft.newConversation}),t[36]=n.draft.newConversation,t[37]=pe);let B;t[38]===n.draft.continuousConversation?B=t[39]:(B=(0,Z.jsx)(p,{value:`continuous`,children:n.draft.continuousConversation}),t[38]=n.draft.continuousConversation,t[39]=B);let V;t[40]!==m||t[41]!==z||t[42]!==pe||t[43]!==B?(V=(0,Z.jsxs)(f,{className:Q,value:m,onChange:z,children:[pe,B]}),t[40]=m,t[41]=z,t[42]=pe,t[43]=B,t[44]=V):V=t[44];let H;t[45]!==n.draft.conversation||t[46]!==V?(H=(0,Z.jsx)($,{label:n.draft.conversation,children:V}),t[45]=n.draft.conversation,t[46]=V,t[47]=H):H=t[47];let U;t[48]===C?U=t[49]:(U=e=>C(e.target.value),t[48]=C,t[49]=U);let W;t[50]===n.draft.notifyAttention?W=t[51]:(W=(0,Z.jsx)(p,{value:`attention`,children:n.draft.notifyAttention}),t[50]=n.draft.notifyAttention,t[51]=W);let me;t[52]===n.draft.notifyAll?me=t[53]:(me=(0,Z.jsx)(p,{value:`all`,children:n.draft.notifyAll}),t[52]=n.draft.notifyAll,t[53]=me);let he;t[54]===n.draft.notifyNone?he=t[55]:(he=(0,Z.jsx)(p,{value:`none`,children:n.draft.notifyNone}),t[54]=n.draft.notifyNone,t[55]=he);let ge;t[56]!==h||t[57]!==U||t[58]!==W||t[59]!==me||t[60]!==he?(ge=(0,Z.jsxs)(f,{className:Q,value:h,onChange:U,children:[W,me,he]}),t[56]=h,t[57]=U,t[58]=W,t[59]=me,t[60]=he,t[61]=ge):ge=t[61];let _e;t[62]!==n.draft.notifications||t[63]!==ge?(_e=(0,Z.jsx)($,{label:n.draft.notifications,children:ge}),t[62]=n.draft.notifications,t[63]=ge,t[64]=_e):_e=t[64];let ve;t[65]!==de||t[66]!==fe||t[67]!==H||t[68]!==_e?(ve=(0,Z.jsxs)(`div`,{className:de,children:[fe,H,_e]}),t[65]=de,t[66]=fe,t[67]=H,t[68]=_e,t[69]=ve):ve=t[69];let ye;t[70]!==i||t[71]!==n.draft.advancedCreate||t[72]!==n.draft.suggestions||t[73]!==n.draft.suggestionsDescription||t[74]!==ie||t[75]!==re||t[76]!==l?(ye=i?null:(0,Z.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,Z.jsx)(S,{variant:`ghost`,onClick:ie,children:n.draft.advancedCreate})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.slice(0,4).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>re(e.form),children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]},e.name))})]}),t[70]=i,t[71]=n.draft.advancedCreate,t[72]=n.draft.suggestions,t[73]=n.draft.suggestionsDescription,t[74]=ie,t[75]=re,t[76]=l,t[77]=ye):ye=t[77];let be;t[78]!==o||t[79]!==i||t[80]!==n.draft.approval||t[81]!==n.draft.assumptions||t[82]!==n.draft.discard||t[83]!==n.draft.edit||t[84]!==n.draft.publish||t[85]!==n.draft.review||t[86]!==n.draft.risks||t[87]!==n.draft.safety||t[88]!==n.draft.testOnce||t[89]!==n.draft.testing||t[90]!==n.feedback||t[91]!==n.info||t[92]!==n.none||t[93]!==w||t[94]!==ne||t[95]!==_||t[96]!==v||t[97]!==te||t[98]!==se||t[99]!==ce||t[100]!==E?(be=i?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,Z.jsx)(Ht,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(Ht,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,Z.jsx)(Dt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.risks,items:i.risks,empty:n.none}),ce?(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=>w(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)(S,{variant:`ghost`,onClick:ne,children:n.draft.discard}),(0,Z.jsxs)(S,{variant:`secondary`,onClick:_,children:[(0,Z.jsx)(T,{className:`size-4`}),n.draft.edit]}),(0,Z.jsxs)(S,{variant:`secondary`,onClick:te,disabled:E||se||ce&&!o,children:[(0,Z.jsx)(oe,{className:`size-4`}),E?n.draft.testing:n.draft.testOnce]}),(0,Z.jsx)(S,{variant:`primary`,onClick:v,disabled:se||ce&&!o,children:se?n.feedback.working:n.draft.publish})]})]})]}):null,t[78]=o,t[79]=i,t[80]=n.draft.approval,t[81]=n.draft.assumptions,t[82]=n.draft.discard,t[83]=n.draft.edit,t[84]=n.draft.publish,t[85]=n.draft.review,t[86]=n.draft.risks,t[87]=n.draft.safety,t[88]=n.draft.testOnce,t[89]=n.draft.testing,t[90]=n.feedback,t[91]=n.info,t[92]=n.none,t[93]=w,t[94]=ne,t[95]=_,t[96]=v,t[97]=te,t[98]=se,t[99]=ce,t[100]=E,t[101]=be):be=t[101];let G;return t[102]!==F||t[103]!==L||t[104]!==ve||t[105]!==ye||t[106]!==be?(G=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[F,L,ve,ye,be]}),t[102]=F,t[103]=L,t[104]=ve,t[105]=ye,t[106]=be,t[107]=G):G=t[107],G}function Et(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}function Dt(e){let t=(0,xe.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(Ot):(0,Z.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Ot(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function kt(e){let t=(0,xe.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:c}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ie,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,Z.jsx)(Ut,{className:`rounded-none border-0 shadow-none`,icon:e,title:i.empty.filtered}),t[1]=i.empty.filtered,t[2]=n),n}let l;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(At),n=t.find(pt),l=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:b(`block w-full p-3 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,s===e.id&&`bg-surface-hover`),onClick:()=>c(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:b(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:ht(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),l&&l.readAtMs==null&&!pt(l)?(0,Z.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,Z.jsx)(`div`,{className:`mt-1 truncate pl-4 text-xs text-fg-muted`,children:Je(e.trigger,i,a,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center justify-between gap-2 pl-4 text-xs text-fg-subtle`,children:[(0,Z.jsx)(`span`,{className:b(`truncate`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.enabled?`${i.next}: ${ct(e.state.nextRunAtMs,i,o)}`:i.paused}),l?.status?(0,Z.jsx)(`span`,{className:b(`shrink-0 rounded-full px-1.5 py-0.5`,dt(l.status)),children:i.status[l.status]}):null]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=c,t[15]=r,t[16]=s,t[17]=e):e=t[17],l=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=s,t[10]=l}else l=t[10];let u;return t[18]===l?u=t[19]:(u=(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:l}),t[18]=l,t[19]=u),u}function At(e,t){return t.createdAtMs-e.createdAtMs}function jt(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`completion_hook.started`:return n.completionHookStarted;case`completion_hook.completed`:return n.completionHookCompleted;case`completion_hook.failed`:return n.completionHookFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Mt(e){let t=(0,xe.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,K.useState)(a===void 0?!1:a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
|
|
2
|
-
`),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`
|
|
3
|
-
`).slice(0,10).join(`
|
|
4
|
-
`).trimEnd()}...`:l,t[4]=f,t[5]=l,t[6]=p):p=t[6];let m=p,h;t[7]!==o||t[8]!==f||t[9]!==r||t[10]!==i?(h=f?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Nt),"aria-expanded":o,children:[(0,Z.jsx)(`span`,{children:i}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,Z.jsx)(le,{className:b(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=f,t[9]=r,t[10]=i,t[11]=h):h=t[11];let g=o||!f?l:m,ee;t[12]===g?ee=t[13]:(ee=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:g}),t[12]=g,t[13]=ee);let _;return t[14]!==h||t[15]!==ee?(_=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[h,ee]}),t[14]=h,t[15]=ee,t[16]=_):_=t[16],_}function Nt(e){return!e}function Pt(e){let t=(0,xe.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:c,loading:l,repairDraft:u,repairLoading:d,repairApproved:f,busyAction:p,onRepairApprovedChange:_,onSuggestRepair:v,onApplyRepair:te}=e;if(!r){let e;t[0]===n?e=t[1]:(e=b(`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)(ae,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===o.selectRun?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`mt-2`,children:o.selectRun}),t[3]=o.selectRun,t[4]=i);let a;return t[5]!==e||t[6]!==i?(a=(0,Z.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=a):a=t[7],a}let y=r.error||r.summary,x=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,w=r.sessionKey?o.runDetail.openConversation:o.runDetail.openWorkflow,ne=r.sessionKey?ee:g,re=pt(r)?ae:mt(r)?M:m,T;t[8]===n?T=t[9]:(T=b(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=T);let ie;t[10]===r.automationName?ie=t[11]:(ie=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=ie);let oe;t[12]===r.id?oe=t[13]:(oe=r.id.slice(0,8),t[12]=r.id,t[13]=oe);let se;t[14]===oe?se=t[15]:(se=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:oe}),t[14]=oe,t[15]=se);let D;t[16]!==ie||t[17]!==se?(D=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[ie,se]}),t[16]=ie,t[17]=se,t[18]=D):D=t[18];let ce;t[19]===r.status?ce=t[20]:(ce=b(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(r.status)),t[19]=r.status,t[20]=ce);let O=o.status[r.status],k;t[21]!==ce||t[22]!==O?(k=(0,Z.jsx)(`span`,{className:ce,children:O}),t[21]=ce,t[22]=O,t[23]=k):k=t[23];let A;t[24]!==D||t[25]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[D,k]}),t[24]=D,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==o||t[28]!==c||t[29]!==r.createdAtMs?(j=ct(r.createdAtMs,o,c),t[27]=o,t[28]=c,t[29]=r.createdAtMs,t[30]=j):j=t[30];let N;t[31]===j?N=t[32]:(N=(0,Z.jsx)(`span`,{children:j}),t[31]=j,t[32]=N);let P;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=P):P=t[33];let F=o.details.duration,I;t[34]!==o||t[35]!==r.durationMs?(I=ft(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=I):I=t[36];let R;t[37]!==o.details.duration||t[38]!==I?(R=(0,Z.jsxs)(`span`,{children:[F,` `,I]}),t[37]=o.details.duration,t[38]=I,t[39]=R):R=t[39];let de;t[40]!==N||t[41]!==R?(de=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[N,P,R]}),t[40]=N,t[41]=R,t[42]=de):de=t[42];let fe;t[43]!==o.repair||t[44]!==v||t[45]!==d||t[46]!==r?(fe=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(S,{variant:`secondary`,onClick:()=>v(r),disabled:d,children:[(0,Z.jsx)(ue,{className:`size-4`}),d?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=v,t[45]=d,t[46]=r,t[47]=fe):fe=t[47];let z;t[48]!==de||t[49]!==fe||t[50]!==A?(z=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[A,de,fe]}),t[48]=de,t[49]=fe,t[50]=A,t[51]=z):z=t[51];let pe;t[52]===r?pe=t[53]:(pe=pt(r)?`text-blue-500`:mt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=pe);let B;t[54]===pe?B=t[55]:(B=b(`size-4`,pe),t[54]=pe,t[55]=B);let V;t[56]!==re||t[57]!==B?(V=(0,Z.jsx)(re,{className:B}),t[56]=re,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==o.runDetail.resultTitle||t[60]!==V?(H=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[V,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=V,t[61]=H):H=t[61];let U;t[62]!==ne||t[63]!==w||t[64]!==x?(U=x?(0,Z.jsx)(S,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:x,children:[(0,Z.jsx)(ne,{className:`size-3.5`}),w,(0,Z.jsx)(L,{className:`size-3.5`})]})}):null,t[62]=ne,t[63]=w,t[64]=x,t[65]=U):U=t[65];let W;t[66]!==H||t[67]!==U?(W=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[H,U]}),t[66]=H,t[67]=U,t[68]=W):W=t[68];let me=r.error&&`border-red-500/25 bg-red-500/5`,he;t[69]===me?he=t[70]:(he=b(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,me),t[69]=me,t[70]=he);let ge;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==y||t[74]!==r?(ge=y?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:y}):(0,Z.jsx)(h,{content:y,compact:!0,className:`text-sm`}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:pt(r)?o.runDetail.resultPending:o.runDetail.noResult}),t[71]=o.runDetail.noResult,t[72]=o.runDetail.resultPending,t[73]=y,t[74]=r,t[75]=ge):ge=t[75];let _e;t[76]!==he||t[77]!==ge?(_e=(0,Z.jsx)(`div`,{className:he,children:ge}),t[76]=he,t[77]=ge,t[78]=_e):_e=t[78];let ve;t[79]!==W||t[80]!==_e?(ve=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[W,_e]}),t[79]=W,t[80]=_e,t[81]=ve):ve=t[81];let ye;t[82]===o.runDetail.runInfo?ye=t[83]:(ye=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=ye);let be;t[84]!==s||t[85]!==o||t[86]!==c||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(be=r.manual?o.trigger.manual:Je(r.triggerSnapshot,o,s,c),t[84]=s,t[85]=o,t[86]=c,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=be):be=t[89];let G;t[90]!==o.explain.whyRan||t[91]!==be?(G=(0,Z.jsx)(Bt,{label:o.explain.whyRan,value:be}),t[90]=o.explain.whyRan,t[91]=be,t[92]=G):G=t[92];let K=o.details.started,Se;t[93]!==o||t[94]!==c||t[95]!==r.startedAtMs?(Se=ct(r.startedAtMs,o,c),t[93]=o,t[94]=c,t[95]=r.startedAtMs,t[96]=Se):Se=t[96];let q;t[97]!==o.details.started||t[98]!==Se?(q=(0,Z.jsx)(Bt,{label:K,value:Se}),t[97]=o.details.started,t[98]=Se,t[99]=q):q=t[99];let Ce;t[100]!==o.details.model||t[101]!==r.model?(Ce=r.model?(0,Z.jsx)(Bt,{label:o.details.model,value:r.model}):null,t[100]=o.details.model,t[101]=r.model,t[102]=Ce):Ce=t[102];let we;t[103]!==G||t[104]!==q||t[105]!==Ce?(we=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[G,q,Ce]}),t[103]=G,t[104]=q,t[105]=Ce,t[106]=we):we=t[106];let Te;t[107]!==ye||t[108]!==we?(Te=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ye,we]}),t[107]=ye,t[108]=we,t[109]=Te):Te=t[109];let Ee;t[110]!==p||t[111]!==o||t[112]!==te||t[113]!==_||t[114]!==f||t[115]!==u||t[116]!==r?(Ee=u?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:u.explanation}),u.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:u.expectedEffect}):null,(0,Z.jsx)(Dt,{title:o.repair.risks,items:u.risks,empty:o.none}),(0,Z.jsx)(Mt,{value:u.patch,labels:o,title:o.details.repairPatch}),u.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:f,onChange:e=>_(e.target.checked)}),(0,Z.jsx)(`span`,{children:o.repair.approval})]}):null,(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsx)(S,{variant:`primary`,onClick:()=>te(r),disabled:p===`run:${r.id}:repair`||u.requiresApproval&&!f,children:p===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=p,t[111]=o,t[112]=te,t[113]=_,t[114]=f,t[115]=u,t[116]=r,t[117]=Ee):Ee=t[117];let De;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(E,{className:`size-4 shrink-0`}),t[118]=De):De=t[118];let J;t[119]===o.runDetail.technicalEvents?J=t[120]:(J=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[De,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=J);let Oe;t[121]!==i.length||t[122]!==o.runDetail.eventCount?(Oe=o.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=o.runDetail.eventCount,t[123]=Oe):Oe=t[123];let ke;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(le,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=ke):ke=t[124];let Y;t[125]===Oe?Y=t[126]:(Y=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[Oe,ke]}),t[125]=Oe,t[126]=Y);let X;t[127]!==J||t[128]!==Y?(X=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[J,Y]}),t[127]=J,t[128]=Y,t[129]=X):X=t[129];let Ae;t[130]===o.runDetail.technicalEventsDescription?Ae=t[131]:(Ae=(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:o.runDetail.technicalEventsDescription}),t[130]=o.runDetail.technicalEventsDescription,t[131]=Ae);let je;t[132]!==i||t[133]!==o||t[134]!==c||t[135]!==l?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:l?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":o.loading,children:[(0,Z.jsx)(C,{className:`h-10 w-full`}),(0,Z.jsx)(C,{className:`h-10 w-4/5`}),(0,Z.jsx)(C,{className:`h-10 w-11/12`})]}):i.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,Z.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,Z.jsx)(`span`,{className:b(`mt-1 size-2 rounded-full`,Vt(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:jt(e,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[ct(e.createdAtMs,o,c),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[o.details.eventData,(0,Z.jsx)(le,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,Z.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=o,t[134]=c,t[135]=l,t[136]=je):je=t[136];let Me;t[137]!==X||t[138]!==Ae||t[139]!==je?(Me=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[X,Ae,je]}),t[137]=X,t[138]=Ae,t[139]=je,t[140]=Me):Me=t[140];let Ne;return t[141]!==T||t[142]!==z||t[143]!==ve||t[144]!==Te||t[145]!==Ee||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:T,children:[z,ve,Te,Ee,Me]}),t[141]=T,t[142]=z,t[143]=ve,t[144]=Te,t[145]=Ee,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Ft(e){let t=(0,xe.c)(83),{automation:n,runs:r,labels:i,cronLabels:a,language:o,projects:s,busyAction:c,onEdit:l,onSelectRun:u,onAction:d}=e,f=c===`automation:${n.id}:run`,p=c===`automation:${n.id}:toggle`,g=c===`automation:${n.id}:delete`,ee;t[0]===n?ee=t[1]:(ee=vt(n),t[0]=n,t[1]=ee);let _=ee,v;t[2]===n.name?v=t[3]:(v=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=v);let te=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,y;t[4]===te?y=t[5]:(y=b(`shrink-0 rounded-full px-2 py-0.5 text-xs`,te),t[4]=te,t[5]=y);let x=n.enabled?i.enabled:i.paused,C;t[6]!==y||t[7]!==x?(C=(0,Z.jsx)(`span`,{className:y,children:x}),t[6]=y,t[7]=x,t[8]=C):C=t[8];let w;t[9]!==v||t[10]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[v,C]}),t[9]=v,t[10]=C,t[11]=w):w=t[11];let re;t[12]===n?re=t[13]:(re=yt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:yt(n)}):null,t[12]=n,t[13]=re);let ie;t[14]!==w||t[15]!==re?(ie=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[w,re]}),t[14]=w,t[15]=re,t[16]=ie):ie=t[16];let E;t[17]!==n||t[18]!==c||t[19]!==g||t[20]!==i.dashboard.delete||t[21]!==i.dashboard.deleted||t[22]!==i.dashboard.pause||t[23]!==i.dashboard.resume||t[24]!==i.dashboard.resumed||t[25]!==i.dashboard.runNow||t[26]!==i.details||t[27]!==i.edit||t[28]!==i.feedback||t[29]!==d||t[30]!==l||t[31]!==_||t[32]!==f||t[33]!==p?(E=_?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(S,{variant:`secondary`,disabled:c!==null,onClick:()=>void d(`automation:${n.id}:toggle`,()=>n.enabled?P.pause(n.id):P.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[p?(0,Z.jsx)(A,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(se,{className:`size-4`}):(0,Z.jsx)(oe,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(S,{variant:`primary`,disabled:c!==null,onClick:()=>void d(`automation:${n.id}:run`,()=>P.runNow(n.id),i.feedback.rerunQueued),children:[f?(0,Z.jsx)(A,{className:`size-4 animate-spin`}):(0,Z.jsx)(oe,{className:`size-4`}),i.dashboard.runNow]}),(0,Z.jsxs)(D,{children:[(0,Z.jsx)(de,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,className:`size-9 p-0`,"aria-label":i.details.moreActions,children:(0,Z.jsx)(ne,{className:`size-4`})})}),(0,Z.jsx)(fe,{children:(0,Z.jsxs)(pe,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(j,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>l(n),children:[(0,Z.jsx)(T,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(j,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-red-700 outline-none hover:bg-red-500/10 dark:text-red-300`,disabled:c!==null,onSelect:()=>void d(`automation:${n.id}:delete`,()=>P.remove(n.id),i.dashboard.deleted),children:[g?(0,Z.jsx)(A,{className:`size-4 animate-spin`}):(0,Z.jsx)(ce,{className:`size-4`}),i.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=c,t[19]=g,t[20]=i.dashboard.delete,t[21]=i.dashboard.deleted,t[22]=i.dashboard.pause,t[23]=i.dashboard.resume,t[24]=i.dashboard.resumed,t[25]=i.dashboard.runNow,t[26]=i.details,t[27]=i.edit,t[28]=i.feedback,t[29]=d,t[30]=l,t[31]=_,t[32]=f,t[33]=p,t[34]=E):E=t[34];let O;t[35]!==E||t[36]!==ie?(O=(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[ie,E]}),t[35]=E,t[36]=ie,t[37]=O):O=t[37];let k;t[38]===i.info.task?k=t[39]:(k=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.info.task}),t[38]=i.info.task,t[39]=k);let M;t[40]!==n||t[41]!==i?(M=gt(n,i),t[40]=n,t[41]=i,t[42]=M):M=t[42];let le;t[43]===M?le=t[44]:(le=(0,Z.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsx)(h,{content:M,compact:!0})}),t[43]=M,t[44]=le);let N;t[45]!==k||t[46]!==le?(N=(0,Z.jsxs)(`section`,{children:[k,le]}),t[45]=k,t[46]=le,t[47]=N):N=t[47];let ue;t[48]!==n||t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==s?(ue=(0,Z.jsx)(Lt,{automation:n,labels:i,cronLabels:a,language:o,projects:s}),t[48]=n,t[49]=a,t[50]=i,t[51]=o,t[52]=s,t[53]=ue):ue=t[53];let F;t[54]===i.dashboard.runHistory?F=t[55]:(F=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),t[54]=i.dashboard.runHistory,t[55]=F);let I;t[56]===i.dashboard.runHistoryDescription?I=t[57]:(I=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription}),t[56]=i.dashboard.runHistoryDescription,t[57]=I);let L;t[58]!==F||t[59]!==I?(L=(0,Z.jsxs)(`div`,{children:[F,I]}),t[58]=F,t[59]=I,t[60]=L):L=t[60];let R;t[61]===r.length?R=t[62]:(R=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[61]=r.length,t[62]=R);let z;t[63]!==L||t[64]!==R?(z=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[L,R]}),t[63]=L,t[64]=R,t[65]=z):z=t[65];let B;t[66]!==i||t[67]!==o||t[68]!==u||t[69]!==r?(B=r.length===0?(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(ae,{className:`size-5`}),title:i.empty.runs}):(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:r.slice(0,8).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`block w-full p-3 text-left hover:bg-surface-hover`,onClick:()=>u(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,Z.jsx)(m,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(ae,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:ct(e.createdAtMs,i,o)})]}),(0,Z.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:b(`mt-1 line-clamp-2 pl-6 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||lt(e.actionSnapshot,i)})]},e.id))}),t[66]=i,t[67]=o,t[68]=u,t[69]=r,t[70]=B):B=t[70];let V;t[71]!==z||t[72]!==B?(V=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[z,B]}),t[71]=z,t[72]=B,t[73]=V):V=t[73];let H;t[74]!==ue||t[75]!==V?(H=(0,Z.jsxs)(`div`,{className:`grid items-start gap-5 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[ue,V]}),t[74]=ue,t[75]=V,t[76]=H):H=t[76];let U;t[77]!==N||t[78]!==H?(U=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[N,H]}),t[77]=N,t[78]=H,t[79]=U):U=t[79];let W;return t[80]!==O||t[81]!==U?(W=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[O,U]}),t[80]=O,t[81]=U,t[82]=W):W=t[82],W}function It(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Lt(e){let t=(0,xe.c)(146),{automation:n,labels:r,cronLabels:i,language:a,projects:o}=e,s,c,l,u,d,f,p,m,h,_,v;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=ut(n),o;t[15]!==n||t[16]!==r||t[17]!==a?(o=Ye(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=o):o=t[18];let ee=o,te;t[19]!==n.state.nextRunAtMs||t[20]!==a?(te=n.state.nextRunAtMs?We(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=te):te=t[21];let y=te;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(v=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],v.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],v.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=We(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],v.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],v.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],v.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],v.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],v.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],v.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],v.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=v}else v=t[39];h=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?_=t[71]:(_=(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]=_),f=`grid gap-4 p-4`;let b;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[72]=b):b=t[72];let x=r.info.schedule,S;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(S=Je(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}:${ee}`:ee;t[78]!==r.info.schedule||t[79]!==y||t[80]!==S||t[81]!==C?(p=(0,Z.jsx)(zt,{icon:b,label:x,value:S,description:C,descriptionTitle:y}),t[78]=r.info.schedule,t[79]=y,t[80]=S,t[81]=C,t[82]=p):p=t[82];let w;t[83]===n.action.kind?w=t[84]:(w=n.action.kind===`workflow`?(0,Z.jsx)(g,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_automation`?(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=w);let ne=r.info.action,re;t[85]!==n.action||t[86]!==r?(re=lt(n.action,r),t[85]=n.action,t[86]=r,t[87]=re):re=t[87],t[88]!==r.info.action||t[89]!==w||t[90]!==re?(m=(0,Z.jsx)(zt,{icon:w,label:ne,value:re}),t[88]=r.info.action,t[89]=w,t[90]=re,t[91]=m):m=t[91],s=zt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[92]=c):c=t[92],l=r.info.permission,u=r.safety[e],d=It(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=_,t[14]=v}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],_=t[13],v=t[14];let te;t[93]!==s||t[94]!==c||t[95]!==l||t[96]!==u||t[97]!==d?(te=(0,Z.jsx)(s,{icon:c,label:l,value:u,description:d}),t[93]=s,t[94]=c,t[95]=l,t[96]=u,t[97]=d,t[98]=te):te=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;t[100]!==n.projectId||t[101]!==r.info.noProject||t[102]!==o?(b=o.find(e=>e.id===n.projectId)?.name??r.info.noProject,t[100]=n.projectId,t[101]=r.info.noProject,t[102]=o,t[103]=b):b=t[103];let x;t[104]!==r.info.project||t[105]!==b?(x=(0,Z.jsx)(zt,{icon:y,label:r.info.project,value:b}),t[104]=r.info.project,t[105]=b,t[106]=x):x=t[106];let S;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[107]=S):S=t[107];let C=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,w;t[108]!==r.info.conversation||t[109]!==C?(w=(0,Z.jsx)(zt,{icon:S,label:r.info.conversation,value:C}),t[108]=r.info.conversation,t[109]=C,t[110]=w):w=t[110];let ne;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[111]=ne):ne=t[111];let re=n.notificationPolicy===`all`?r.info.notifyAll:n.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,T;t[112]!==r.info.notifications||t[113]!==re?(T=(0,Z.jsx)(zt,{icon:ne,label:r.info.notifications,value:re}),t[112]=r.info.notifications,t[113]=re,t[114]=T):T=t[114];let oe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[115]=oe):oe=t[115];let se=r.info.lastRun,D;t[116]!==n||t[117]!==r||t[118]!==a?(D=Xe(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=D):D=t[119];let ce=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,O;t[120]!==r.info.lastRun||t[121]!==D||t[122]!==ce?(O=(0,Z.jsx)(zt,{icon:oe,label:se,value:D,valueTone:ce}),t[120]=r.info.lastRun,t[121]=D,t[122]=ce,t[123]=O):O=t[123];let k;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(k=n.state.consecutiveFailures?(0,Z.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[124]=n.state.consecutiveFailures,t[125]=n.state.lastError,t[126]=r.dashboard,t[127]=k):k=t[127];let A;t[128]!==r.info.technicalDetails||t[129]!==v?(A=v.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)(le,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:v.map(Rt)})]}):null,t[128]=r.info.technicalDetails,t[129]=v,t[130]=A):A=t[130];let j;t[131]!==te||t[132]!==x||t[133]!==w||t[134]!==T||t[135]!==O||t[136]!==k||t[137]!==A||t[138]!==f||t[139]!==p||t[140]!==m?(j=(0,Z.jsxs)(`div`,{className:f,children:[p,m,te,x,w,T,O,k,A]}),t[131]=te,t[132]=x,t[133]=w,t[134]=T,t[135]=O,t[136]=k,t[137]=A,t[138]=f,t[139]=p,t[140]=m,t[141]=j):j=t[141];let N;return t[142]!==j||t[143]!==h||t[144]!==_?(N=(0,Z.jsxs)(`aside`,{className:h,children:[_,j]}),t[142]=j,t[143]=h,t[144]=_,t[145]=N):N=t[145],N}function Rt(e){return(0,Z.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function zt(e){let t=(0,xe.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,c=s===void 0?`default`:s,l;t[0]===n?l=t[1]:(l=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=u);let d=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,f;t[4]===d?f=t[5]:(f=b(`mt-1 text-sm font-medium leading-5`,d),t[4]=d,t[5]=f);let p;t[6]!==f||t[7]!==i?(p=(0,Z.jsx)(`div`,{className:f,children:i}),t[6]=f,t[7]=i,t[8]=p):p=t[8];let m;t[9]!==a||t[10]!==o?(m=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]=m):m=t[11];let h;t[12]!==u||t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,p,m]}),t[12]=u,t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function Bt(e){let t=(0,xe.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Vt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Ht(e){let t=(0,xe.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ut(e){let t=(0,xe.c)(8),{className:n,icon:r,title:i}=e,a;t[0]===n?a=t[1]:(a=b(`flex min-h-48 flex-col items-center justify-center text-fg-muted`,n),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:i}),t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`div`,{className:a,children:[r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Wt(e){let t=(0,xe.c)(274),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:o,selectedWorkflow:s,workflowsLoading:c,browserAutomations:l,selectedBrowserAutomation:u,browserAutomationsLoading:d,agentOptions:m,agentsLoading:h,language:g,projectLocked:ee}=e,_=ee===void 0?!1:ee,v=te(g).agentsSettings,y;t[0]===i?y=t[1]:(y=e=>i(t=>({...t,...e})),t[0]=i,t[1]=y);let x=y,S=Be(n.intervalValue,n.intervalUnit),C=Date.now(),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=[1,2,3],t[2]=w):w=t[2];let ne;t[3]!==S||t[4]!==C||t[5]!==g?(ne=w.map(e=>Ke(C+S*e,g,C)),t[3]=S,t[4]=C,t[5]=g,t[6]=ne):ne=t[6];let re=ne,T,ie;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==o?(T=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=o[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},ie=[n.actionMode,n.workflowId,i,o],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=o,t[11]=T,t[12]=ie):(T=t[11],ie=t[12]),(0,K.useEffect)(T,ie);let ae,oe;t[13]!==l||t[14]!==n.actionMode||t[15]!==n.browserAutomationId||t[16]!==i?(ae=()=>{if(n.actionMode!==`browser_automation`||n.browserAutomationId.trim())return;let e=l[0];e&&i(t=>({...t,browserAutomationId:e.id,browserAutomationInputs:be(e)}))},oe=[l,n.actionMode,n.browserAutomationId,i],t[13]=l,t[14]=n.actionMode,t[15]=n.browserAutomationId,t[16]=i,t[17]=ae,t[18]=oe):(ae=t[17],oe=t[18]),(0,K.useEffect)(ae,oe);let se;t[19]===x?se=t[20]:(se=e=>x({name:e.target.value}),t[19]=x,t[20]=se);let E;t[21]!==n.name||t[22]!==se?(E=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:se}),t[21]=n.name,t[22]=se,t[23]=E):E=t[23];let D;t[24]!==r.form.name||t[25]!==E?(D=(0,Z.jsx)($,{label:r.form.name,children:E}),t[24]=r.form.name,t[25]=E,t[26]=D):D=t[26];let ce;t[27]===x?ce=t[28]:(ce=e=>x({description:e.target.value}),t[27]=x,t[28]=ce);let O;t[29]!==n.description||t[30]!==ce?(O=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:ce}),t[29]=n.description,t[30]=ce,t[31]=O):O=t[31];let A;t[32]!==r.form.description||t[33]!==O?(A=(0,Z.jsx)($,{label:r.form.description,children:O}),t[32]=r.form.description,t[33]=O,t[34]=A):A=t[34];let j;t[35]!==n.projectId||t[36]!==r.form.noProject||t[37]!==r.form.project||t[38]!==_||t[39]!==a||t[40]!==x?(j=_?null:(0,Z.jsx)($,{label:r.form.project,children:(0,Z.jsxs)(f,{className:Q,value:n.projectId,onChange:e=>x({projectId:e.target.value}),children:[(0,Z.jsx)(p,{value:``,children:r.form.noProject}),a.map(qt)]})}),t[35]=n.projectId,t[36]=r.form.noProject,t[37]=r.form.project,t[38]=_,t[39]=a,t[40]=x,t[41]=j):j=t[41];let M;t[42]===r.form.trigger?M=t[43]:(M=(0,Z.jsx)(Jt,{title:r.form.trigger}),t[42]=r.form.trigger,t[43]=M);let N;t[44]===x?N=t[45]:(N=e=>x({triggerMode:e.target.value}),t[44]=x,t[45]=N);let ue;t[46]===r.trigger.manual?ue=t[47]:(ue=(0,Z.jsx)(p,{value:`manual`,children:r.trigger.manual}),t[46]=r.trigger.manual,t[47]=ue);let P;t[48]===r.trigger.once?P=t[49]:(P=(0,Z.jsx)(p,{value:`once`,children:r.trigger.once}),t[48]=r.trigger.once,t[49]=P);let F;t[50]===r.trigger.daily?F=t[51]:(F=(0,Z.jsx)(p,{value:`daily`,children:r.trigger.daily}),t[50]=r.trigger.daily,t[51]=F);let I;t[52]===r.trigger.weekly?I=t[53]:(I=(0,Z.jsx)(p,{value:`weekly`,children:r.trigger.weekly}),t[52]=r.trigger.weekly,t[53]=I);let L;t[54]===r.trigger.interval?L=t[55]:(L=(0,Z.jsx)(p,{value:`interval`,children:r.trigger.interval}),t[54]=r.trigger.interval,t[55]=L);let R;t[56]===r.trigger.customCron?R=t[57]:(R=(0,Z.jsx)(p,{value:`cron`,children:r.trigger.customCron}),t[56]=r.trigger.customCron,t[57]=R);let de;t[58]===r.trigger.webhook?de=t[59]:(de=(0,Z.jsx)(p,{value:`webhook`,children:r.trigger.webhook}),t[58]=r.trigger.webhook,t[59]=de);let fe;t[60]===r.trigger.taskBlocked?fe=t[61]:(fe=(0,Z.jsx)(p,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[60]=r.trigger.taskBlocked,t[61]=fe);let z;t[62]===r.trigger.noteCreated?z=t[63]:(z=(0,Z.jsx)(p,{value:`noteCreated`,children:r.trigger.noteCreated}),t[62]=r.trigger.noteCreated,t[63]=z);let pe;t[64]===r.trigger.workflowFailed?pe=t[65]:(pe=(0,Z.jsx)(p,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[64]=r.trigger.workflowFailed,t[65]=pe);let B;t[66]===r.trigger.sessionUpdated?B=t[67]:(B=(0,Z.jsx)(p,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[66]=r.trigger.sessionUpdated,t[67]=B);let V;t[68]===r.trigger.customEvent?V=t[69]:(V=(0,Z.jsx)(p,{value:`event`,children:r.trigger.customEvent}),t[68]=r.trigger.customEvent,t[69]=V);let U;t[70]!==n.triggerMode||t[71]!==N||t[72]!==ue||t[73]!==P||t[74]!==F||t[75]!==I||t[76]!==L||t[77]!==R||t[78]!==de||t[79]!==fe||t[80]!==z||t[81]!==pe||t[82]!==B||t[83]!==V?(U=(0,Z.jsxs)(f,{className:Q,value:n.triggerMode,onChange:N,children:[ue,P,F,I,L,R,de,fe,z,pe,B,V]}),t[70]=n.triggerMode,t[71]=N,t[72]=ue,t[73]=P,t[74]=F,t[75]=I,t[76]=L,t[77]=R,t[78]=de,t[79]=fe,t[80]=z,t[81]=pe,t[82]=B,t[83]=V,t[84]=U):U=t[84];let me;t[85]!==n.onceAt||t[86]!==n.triggerMode||t[87]!==r.form.onceAt||t[88]!==x?(me=n.triggerMode===`once`?(0,Z.jsx)($,{label:r.form.onceAt,children:(0,Z.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>x({onceAt:e.target.value})})}):null,t[85]=n.onceAt,t[86]=n.triggerMode,t[87]=r.form.onceAt,t[88]=x,t[89]=me):me=t[89];let he;t[90]!==n.time||t[91]!==n.triggerMode||t[92]!==n.weekday||t[93]!==r.form.day||t[94]!==r.form.time||t[95]!==r.weekdays||t[96]!==x?(he=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.time,children:(0,Z.jsx)(H,{value:n.time,onChange:e=>x({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(f,{className:Q,value:n.weekday,onChange:e=>x({weekday:e.target.value}),children:[(0,Z.jsx)(p,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(p,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(p,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(p,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(p,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(p,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(p,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[90]=n.time,t[91]=n.triggerMode,t[92]=n.weekday,t[93]=r.form.day,t[94]=r.form.time,t[95]=r.weekdays,t[96]=x,t[97]=he):he=t[97];let ge=n.triggerMode===`interval`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsx)($,{label:r.form.intervalEvery,children:(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Z.jsx)(`input`,{className:Q,type:`number`,min:6e4/Be(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>x({intervalValue:e.target.value})}),(0,Z.jsxs)(f,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;x({intervalValue:Ve(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(p,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(p,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(p,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(p,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Qe.map(e=>{let t=Be(e.value,e.unit),n=t===S;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:b(`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:()=>x({intervalValue:e.value,intervalUnit:e.unit}),children:He(t,g)},`${e.value}:${e.unit}`)})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:Ue(S,g)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,re.join(g===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,ve;t[98]!==n.cronExpr||t[99]!==n.triggerMode||t[100]!==r.form.expression||t[101]!==x?(ve=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>x({cronExpr:e.target.value})})}):null,t[98]=n.cronExpr,t[99]=n.triggerMode,t[100]=r.form.expression,t[101]=x,t[102]=ve):ve=t[102];let ye;t[103]!==n.triggerMode||t[104]!==n.webhookSecretId||t[105]!==r.form.secretId||t[106]!==x?(ye=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>x({webhookSecretId:e.target.value})})}):null,t[103]=n.triggerMode,t[104]=n.webhookSecretId,t[105]=r.form.secretId,t[106]=x,t[107]=ye):ye=t[107];let Se;t[108]!==n.eventPayloadMatch||t[109]!==n.eventSource||t[110]!==n.eventType||t[111]!==n.triggerMode||t[112]!==r.form.eventPayloadMatch||t[113]!==r.form.eventSource||t[114]!==r.form.eventType||t[115]!==r.form.invalidJsonObject||t[116]!==x?(Se=n.triggerMode===`event`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.eventType,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>x({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>x({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:b(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>x({eventPayloadMatch:e.target.value}),placeholder:`{
|
|
5
|
-
"status": "blocked"
|
|
6
|
-
}`}),at(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[108]=n.eventPayloadMatch,t[109]=n.eventSource,t[110]=n.eventType,t[111]=n.triggerMode,t[112]=r.form.eventPayloadMatch,t[113]=r.form.eventSource,t[114]=r.form.eventType,t[115]=r.form.invalidJsonObject,t[116]=x,t[117]=Se):Se=t[117];let q;t[118]===r.form.action?q=t[119]:(q=(0,Z.jsx)(Jt,{title:r.form.action}),t[118]=r.form.action,t[119]=q);let Ce;t[120]!==n.timeoutSeconds||t[121]!==n.workflowId||t[122]!==x||t[123]!==o?(Ce=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);x({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_automation`?`600`:`1800`}:{},...t===`browser_automation`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&o[0]?{workflowId:o[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[120]=n.timeoutSeconds,t[121]=n.workflowId,t[122]=x,t[123]=o,t[124]=Ce):Ce=t[124];let we;t[125]===r.action.runAgent?we=t[126]:(we=(0,Z.jsx)(p,{value:`agent`,children:r.action.runAgent}),t[125]=r.action.runAgent,t[126]=we);let Te;t[127]===r.action.runWorkflow?Te=t[128]:(Te=(0,Z.jsx)(p,{value:`workflow`,children:r.action.runWorkflow}),t[127]=r.action.runWorkflow,t[128]=Te);let Ee=g===`zh`?`浏览器自动化`:`Browser automation`,De;t[129]===Ee?De=t[130]:(De=(0,Z.jsx)(p,{value:`browser_automation`,children:Ee}),t[129]=Ee,t[130]=De);let J;t[131]!==n.actionMode||t[132]!==Ce||t[133]!==we||t[134]!==Te||t[135]!==De?(J=(0,Z.jsxs)(f,{className:Q,value:n.actionMode,onChange:Ce,children:[we,Te,De]}),t[131]=n.actionMode,t[132]=Ce,t[133]=we,t[134]=Te,t[135]=De,t[136]=J):J=t[136];let Oe=n.actionMode===`browser_automation`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(f,{className:Q,value:n.agentId,onChange:e=>x({agentId:e.target.value}),children:[(0,Z.jsx)(p,{value:``,children:h?r.form.loadingAgents:r.form.defaultAgent}),m.map(e=>(0,Z.jsx)(p,{value:e.id,children:k(e,v)},e.id))]})}),ke;t[137]!==l||t[138]!==d||t[139]!==n.actionMode||t[140]!==n.agentId||t[141]!==n.browserAutomationId||t[142]!==n.browserAutomationInputs||t[143]!==n.description||t[144]!==n.instruction||t[145]!==n.name||t[146]!==n.triggerMode||t[147]!==n.workflowId||t[148]!==n.workflowInput||t[149]!==r.form.instruction||t[150]!==r.form.loadingWorkflows||t[151]!==r.form.noWorkflows||t[152]!==r.form.triggeredRun||t[153]!==r.form.workflow||t[154]!==g||t[155]!==u||t[156]!==s||t[157]!==x||t[158]!==o||t[159]!==c?(ke=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(W,{value:n.instruction,onApply:e=>x({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:g,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:b(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>x({instruction:e.target.value})})]}):n.actionMode===`workflow`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(f,{className:Q,value:n.workflowId,onChange:e=>x({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:c||o.length===0,children:[c?(0,Z.jsx)(p,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,Z.jsx)(p,{value:``,children:r.form.noWorkflows}):null,o.map(Kt)]})}),s?(0,Z.jsx)(_e,{definition:s,language:g,value:n.workflowInput,onChange:e=>x({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>x({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:s.id,workflowTitle:s.title,workflowDescription:s.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:g===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(f,{className:Q,value:n.browserAutomationId,onChange:e=>{let t=l.find(t=>t.id===e.target.value);x({browserAutomationId:e.target.value,browserAutomationInputs:t?be(t):{}})},disabled:d||l.length===0,children:[l.length===0?(0,Z.jsx)(p,{value:``,children:g===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,l.map(Gt)]})}),u&&Object.keys(u.inputs).length>0?(0,Z.jsx)($,{label:g===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(G,{automation:u,values:n.browserAutomationInputs,language:g,onChange:e=>x({browserAutomationInputs:e})})}):null]}),t[137]=l,t[138]=d,t[139]=n.actionMode,t[140]=n.agentId,t[141]=n.browserAutomationId,t[142]=n.browserAutomationInputs,t[143]=n.description,t[144]=n.instruction,t[145]=n.name,t[146]=n.triggerMode,t[147]=n.workflowId,t[148]=n.workflowInput,t[149]=r.form.instruction,t[150]=r.form.loadingWorkflows,t[151]=r.form.noWorkflows,t[152]=r.form.triggeredRun,t[153]=r.form.workflow,t[154]=g,t[155]=u,t[156]=s,t[157]=x,t[158]=o,t[159]=c,t[160]=ke):ke=t[160];let Y;t[161]===r.form.advancedDescription?Y=t[162]:(Y=(0,Z.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[161]=r.form.advancedDescription,t[162]=Y);let X;t[163]!==r.form.advanced||t[164]!==Y?(X=(0,Z.jsxs)(`span`,{children:[r.form.advanced,Y]}),t[163]=r.form.advanced,t[164]=Y,t[165]=X):X=t[165];let Ae;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(le,{className:`size-4 transition-transform group-open:rotate-180`}),t[166]=Ae):Ae=t[166];let je;t[167]===X?je=t[168]:(je=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[X,Ae]}),t[167]=X,t[168]=je);let Me;t[169]!==n.actionMode||t[170]!==n.safetyMode||t[171]!==r.form.safety||t[172]!==r.safety||t[173]!==x?(Me=n.actionMode===`browser_automation`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jt,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(f,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;x({safetyMode:t})},children:[(0,Z.jsx)(p,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(p,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(p,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription})]})]}),t[169]=n.actionMode,t[170]=n.safetyMode,t[171]=r.form.safety,t[172]=r.safety,t[173]=x,t[174]=Me):Me=t[174];let Ne;t[175]===r.form.results?Ne=t[176]:(Ne=(0,Z.jsx)(Jt,{title:r.form.results}),t[175]=r.form.results,t[176]=Ne);let Pe;t[177]===x?Pe=t[178]:(Pe=e=>x({conversationMode:e.target.value}),t[177]=x,t[178]=Pe);let Fe;t[179]===r.form.newConversation?Fe=t[180]:(Fe=(0,Z.jsx)(p,{value:`new_session`,children:r.form.newConversation}),t[179]=r.form.newConversation,t[180]=Fe);let Ie;t[181]===r.form.continuousConversation?Ie=t[182]:(Ie=(0,Z.jsx)(p,{value:`continuous`,children:r.form.continuousConversation}),t[181]=r.form.continuousConversation,t[182]=Ie);let Le;t[183]!==n.conversationMode||t[184]!==Pe||t[185]!==Fe||t[186]!==Ie?(Le=(0,Z.jsxs)(f,{className:Q,value:n.conversationMode,onChange:Pe,children:[Fe,Ie]}),t[183]=n.conversationMode,t[184]=Pe,t[185]=Fe,t[186]=Ie,t[187]=Le):Le=t[187];let Re;t[188]!==r.form.conversation||t[189]!==Le?(Re=(0,Z.jsx)($,{label:r.form.conversation,children:Le}),t[188]=r.form.conversation,t[189]=Le,t[190]=Re):Re=t[190];let ze;t[191]===x?ze=t[192]:(ze=e=>x({notificationPolicy:e.target.value}),t[191]=x,t[192]=ze);let We;t[193]===r.form.notifyAttention?We=t[194]:(We=(0,Z.jsx)(p,{value:`attention`,children:r.form.notifyAttention}),t[193]=r.form.notifyAttention,t[194]=We);let Ge;t[195]===r.form.notifyAll?Ge=t[196]:(Ge=(0,Z.jsx)(p,{value:`all`,children:r.form.notifyAll}),t[195]=r.form.notifyAll,t[196]=Ge);let qe;t[197]===r.form.notifyNone?qe=t[198]:(qe=(0,Z.jsx)(p,{value:`none`,children:r.form.notifyNone}),t[197]=r.form.notifyNone,t[198]=qe);let Je;t[199]!==n.notificationPolicy||t[200]!==ze||t[201]!==We||t[202]!==Ge||t[203]!==qe?(Je=(0,Z.jsxs)(f,{className:Q,value:n.notificationPolicy,onChange:ze,children:[We,Ge,qe]}),t[199]=n.notificationPolicy,t[200]=ze,t[201]=We,t[202]=Ge,t[203]=qe,t[204]=Je):Je=t[204];let Ye;t[205]!==r.form.notifications||t[206]!==Je?(Ye=(0,Z.jsx)($,{label:r.form.notifications,children:Je}),t[205]=r.form.notifications,t[206]=Je,t[207]=Ye):Ye=t[207];let Xe;t[208]!==n.completionWebhookUrl||t[209]!==n.safetyMode||t[210]!==r.form.completionWebhook||t[211]!==x?(Xe=n.safetyMode===`auto_apply`?(0,Z.jsx)($,{label:r.form.completionWebhook,children:(0,Z.jsx)(`input`,{className:Q,value:n.completionWebhookUrl,onChange:e=>x({completionWebhookUrl:e.target.value})})}):null,t[208]=n.completionWebhookUrl,t[209]=n.safetyMode,t[210]=r.form.completionWebhook,t[211]=x,t[212]=Xe):Xe=t[212];let Ze;t[213]===r.form.reliability?Ze=t[214]:(Ze=(0,Z.jsx)(Jt,{title:r.form.reliability}),t[213]=r.form.reliability,t[214]=Ze);let $e;t[215]===x?$e=t[216]:($e=e=>x({timeoutSeconds:e.target.value}),t[215]=x,t[216]=$e);let et;t[217]!==n.timeoutSeconds||t[218]!==$e?(et=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:$e}),t[217]=n.timeoutSeconds,t[218]=$e,t[219]=et):et=t[219];let tt;t[220]!==r.form.timeoutSeconds||t[221]!==et?(tt=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:et}),t[220]=r.form.timeoutSeconds,t[221]=et,t[222]=tt):tt=t[222];let nt;t[223]===x?nt=t[224]:(nt=e=>x({disableAfterFailures:e.target.value}),t[223]=x,t[224]=nt);let rt;t[225]!==n.disableAfterFailures||t[226]!==nt?(rt=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:nt}),t[225]=n.disableAfterFailures,t[226]=nt,t[227]=rt):rt=t[227];let it;t[228]!==r.form.disableAfterFailures||t[229]!==rt?(it=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:rt}),t[228]=r.form.disableAfterFailures,t[229]=rt,t[230]=it):it=t[230];let ot;t[231]!==tt||t[232]!==it?(ot=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[tt,it]}),t[231]=tt,t[232]=it,t[233]=ot):ot=t[233];let st;t[234]===r.form.effectivePolicy?st=t[235]:(st=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[234]=r.form.effectivePolicy,t[235]=st);let ct=n.timeoutSeconds||`—`,lt;t[236]!==r.form.executionDeadline||t[237]!==ct?(lt=(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,ct,`s`]}),t[236]=r.form.executionDeadline,t[237]=ct,t[238]=lt):lt=t[238];let ut;t[239]===r.form.downstreamTimeoutHint?ut=t[240]:(ut=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[239]=r.form.downstreamTimeoutHint,t[240]=ut);let dt;t[241]!==st||t[242]!==lt||t[243]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-muted/40 px-3 py-2.5`,children:[st,lt,ut]}),t[241]=st,t[242]=lt,t[243]=ut,t[244]=dt):dt=t[244];let ft;t[245]!==Me||t[246]!==Ne||t[247]!==Re||t[248]!==Ye||t[249]!==Xe||t[250]!==Ze||t[251]!==ot||t[252]!==dt?(ft=(0,Z.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[Me,Ne,Re,Ye,Xe,Ze,ot,dt]}),t[245]=Me,t[246]=Ne,t[247]=Re,t[248]=Ye,t[249]=Xe,t[250]=Ze,t[251]=ot,t[252]=dt,t[253]=ft):ft=t[253];let pt;t[254]!==je||t[255]!==ft?(pt=(0,Z.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[je,ft]}),t[254]=je,t[255]=ft,t[256]=pt):pt=t[256];let mt;return t[257]!==D||t[258]!==A||t[259]!==j||t[260]!==M||t[261]!==U||t[262]!==me||t[263]!==he||t[264]!==ge||t[265]!==ve||t[266]!==ye||t[267]!==Se||t[268]!==q||t[269]!==J||t[270]!==Oe||t[271]!==ke||t[272]!==pt?(mt=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[D,A,j,M,U,me,he,ge,ve,ye,Se,q,J,Oe,ke,pt]})}),t[257]=D,t[258]=A,t[259]=j,t[260]=M,t[261]=U,t[262]=me,t[263]=he,t[264]=ge,t[265]=ve,t[266]=ye,t[267]=Se,t[268]=q,t[269]=J,t[270]=Oe,t[271]=ke,t[272]=pt,t[273]=mt):mt=t[273],mt}function Gt(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}function Kt(e){return(0,Z.jsx)(p,{value:e.id,children:e.title||e.name},e.id)}function qt(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,xe.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Jt(e){let t=(0,xe.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(g,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{wt as t};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,h as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./popover-select-Dz_Qis2R.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./messages-DjuBdDCn.js";import{a as f,c as p,i as m,n as h,r as g}from"./locale-store-BBSCIl4I.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-B11EPpor.js";import{n as y,r as b}from"./gateway-config-swr-6eb1vKE1.js";import{t as x}from"./skeleton-BwbyijEw.js";import{El as S,Hc as C,Us as w,Wl as T,Xc as ee,Xi as E,Yi as D,bc as te,kc as ne,kl as re,zl as O}from"./index-C6OWYFtQ.js";import{n as ie,r as k}from"./settings-page-layout-DYelDcMV.js";import{n as A}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as j,t as ae}from"./use-autosave-DkQAIAuB.js";import{t as M}from"./settings-advanced-gate-DV7kMco2.js";var N=e(t(),1),P=n();function F(){return f(g(`/api/browser/status`))}function I(){return f(g(`/api/browser/test`),{method:`POST`})}function oe(e=!1){return f(g(`/api/browser/extension/install`),{method:`POST`,body:JSON.stringify({force:e})})}function L(e){return f(g(`/api/browser/extension/open`),{method:`POST`,body:JSON.stringify({action:e})})}async function R(e,t){let n=await m(g(`/api/browser/playwright/install/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},signal:t});if(!n.ok||!n.body)throw Error(`Chromium install request failed (HTTP ${n.status}).`);let r=n.body.getReader(),i=new TextDecoder,a=``,o;try{for(;!o;){let t=await r.read();if(t.done)break;a+=i.decode(t.value,{stream:!0}),a=a.replace(/\r\n/g,`
|
|
2
|
-
`);let n=a.split(`
|
|
3
|
-
|
|
4
|
-
`);a=n.pop()??``;for(let t of n){let n=t.split(`
|
|
5
|
-
`).find(e=>e.startsWith(`event:`))?.slice(6).trim(),r=t.split(`
|
|
6
|
-
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(``);r&&(n===`progress`&&e(JSON.parse(r)),n===`result`&&(o=JSON.parse(r)))}}}finally{r.releaseLock()}if(!o)throw Error(`Chromium installer ended without a result.`);return o}async function se(){await f(g(`/api/browser/playwright/install/cancel`),{method:`POST`})}function z(e){let[t,n]=(0,N.useState)(!1),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(null),l=(0,N.useRef)(null);return{running:t,cancelling:r,progress:a,error:s,install:(0,N.useCallback)(async()=>{if(l.current)return;let t=new AbortController;l.current=t,n(!0),o(null),c(null);try{let n=await R(o,t.signal);if(!n.ok){n.error!==`cancelled`&&c(n.message??n.error);return}e()}catch(e){t.signal.aborted||c(e instanceof Error?e.message:String(e))}finally{l.current===t&&(l.current=null),n(!1),i(!1)}},[e]),cancel:(0,N.useCallback)(async()=>{l.current&&(i(!0),await se().catch(()=>{}),l.current.abort())},[])}}var B=r(),V={extension:`Chrome extension`,playwright:`Playwright Chromium`,cdp:`CDP`,remote:`Remote browser`};function ce(e){let{enabled:t,driverKind:n,autosaveStatus:r,zh:a}=e,o=i(),c=_(t?[`browser-control-status`,n]:null,F,{revalidateOnFocus:!0,refreshInterval:n===`extension`?3e3:0}),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(null),[m,h]=(0,N.useState)(null),g=r===`dirty`||r===`saving`;(0,N.useEffect)(()=>{r===`saved`&&c.mutate()},[r,c.mutate]);let y=(0,N.useCallback)(async(e,t,n)=>{d(e),p(null),h(null);try{await t(),h(n),await c.mutate()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(null)}},[c.mutate]),b=z((0,N.useCallback)(()=>{h(a?`Chromium 已安装,可以开始连接测试。`:`Chromium is installed and ready to test.`),c.mutate()},[c.mutate,a])),S=c.data?.payload,C=S?.driverKind===n,T=t?g||!C?`syncing`:S?.state:`disabled`;return(0,B.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(T===`ready`?s:T===`syncing`?u:w,{className:`size-4 shrink-0 ${T===`ready`?`text-success`:T===`syncing`?`animate-spin text-fg-muted`:T===`disabled`?`text-fg-subtle`:`text-warning`}`}),(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`浏览器就绪状态`:`Browser readiness`}),(0,B.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs ${T===`ready`?`bg-success-soft text-success`:T===`disabled`?`bg-surface-hover text-fg-muted`:`bg-warning-soft text-warning`}`,children:T===`ready`?a?`已就绪`:`Ready`:T===`disabled`?a?`未启用`:`Disabled`:T===`syncing`?a?`正在应用配置`:`Applying configuration`:a?`需要处理`:`Needs attention`})]}),(0,B.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[V[n],S?.detail&&C?` · ${S.detail}`:``]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(v,{variant:`ghost`,className:`h-9`,onClick:()=>void c.mutate(),disabled:c.isValidating,children:[(0,B.jsx)(te,{className:`size-3.5 ${c.isValidating?`animate-spin`:``}`}),a?`刷新`:`Refresh`]}),(0,B.jsxs)(v,{variant:`secondary`,className:`h-9`,disabled:!t||g||l!==null||b.running,onClick:()=>void y(`test`,I,a?`连接测试成功。`:`Connection test passed.`),children:[l===`test`?(0,B.jsx)(u,{className:`size-3.5 animate-spin`}):(0,B.jsx)(ne,{className:`size-3.5`}),a?`测试连接`:`Test connection`]})]})]}),t&&c.isLoading?(0,B.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,B.jsx)(x,{className:`h-12`}),(0,B.jsx)(x,{className:`h-12`}),(0,B.jsx)(x,{className:`h-12`})]}):null,t&&c.error?(0,B.jsx)(W,{tone:`error`,children:c.error instanceof Error?c.error.message:String(c.error)}):null,f||b.error?(0,B.jsx)(W,{tone:`error`,children:f??b.error}):null,m?(0,B.jsx)(W,{tone:`success`,children:m}):null,t&&n===`extension`&&C?(0,B.jsx)(H,{status:S?.driverStatus,zh:a,busy:l,run:y,onConnectRemote:()=>o(`/settings/devices?startDevicePairing=browser`)}):null,t&&n===`playwright`&&C?(0,B.jsx)(de,{status:S?.driverStatus,zh:a,installer:b}):null,t&&n===`cdp`?(0,B.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会验证已保存的 CDP 地址,并复用浏览器中现有的标签页和登录状态。`:`The connection test verifies the saved CDP endpoint and reuses that browser’s existing tabs and signed-in state.`}):null,t&&n===`remote`?(0,B.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会在服务商侧创建一个临时浏览器会话,并在测试结束后立即关闭。`:`The connection test creates a temporary provider session and closes it immediately after the test.`}):null]})}function H(e){let t=(0,P.c)(70),{status:n,zh:r,busy:i,run:a,onConnectRemote:o}=e,s=n?.artifacts,d=r?`扩展文件`:`Extension files`,f=s?.installed===!0,p=s?.installed?r?`已安装`:`Installed`:r?`未安装或需更新`:`Install or update required`,m;t[0]!==d||t[1]!==f||t[2]!==p?(m=(0,B.jsx)(U,{label:d,ok:f,value:p}),t[0]=d,t[1]=f,t[2]=p,t[3]=m):m=t[3];let h=r?`本机自动发现`:`Local auto-discovery`,g=s?.nativeHost?.installed===!0,_=s?.nativeHost?.installed?r?`已就绪`:`Ready`:s?.nativeHost?.reason??(r?`需要修复`:`Repair required`),y;t[4]!==h||t[5]!==g||t[6]!==_?(y=(0,B.jsx)(U,{label:h,ok:g,value:_}),t[4]=h,t[5]=g,t[6]=_,t[7]=y):y=t[7];let b=r?`安全通道`:`Secure channel`,x=n?.transport===`gateway-realtime`,S=n?.transport===`gateway-realtime`?`Gateway Realtime`:r?`不可用`:`Unavailable`,C;t[8]!==S||t[9]!==b||t[10]!==x?(C=(0,B.jsx)(U,{label:b,ok:x,value:S}),t[8]=S,t[9]=b,t[10]=x,t[11]=C):C=t[11];let w=r?`Chrome 连接`:`Chrome connection`,T=n?.connected===!0,ee=n?.connected?r?`已连接`:`Connected`:n?.socketConnected?r?`需要重新加载扩展`:`Reload extension`:r?`等待扩展连接`:`Waiting for extension`,E;t[12]!==w||t[13]!==T||t[14]!==ee?(E=(0,B.jsx)(U,{label:w,ok:T,value:ee}),t[12]=w,t[13]=T,t[14]=ee,t[15]=E):E=t[15];let D;t[16]!==C||t[17]!==E||t[18]!==m||t[19]!==y?(D=(0,B.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[m,y,C,E]}),t[16]=C,t[17]=E,t[18]=m,t[19]=y,t[20]=D):D=t[20];let te=s?.extensionDir??`Gateway Realtime`,O;t[21]===te?O=t[22]:(O=(0,B.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:te}),t[21]=te,t[22]=O);let ie=s?.installed?`secondary`:`primary`,k=i!==null,A;t[23]!==s?.installed||t[24]!==a||t[25]!==r?(A=()=>void a(`extension-install`,()=>oe(!!s?.installed),r?`扩展文件已准备好。`:`Extension files are ready.`),t[23]=s?.installed,t[24]=a,t[25]=r,t[26]=A):A=t[26];let j;t[27]===i?j=t[28]:(j=i===`extension-install`?(0,B.jsx)(u,{className:`size-3.5 animate-spin`}):(0,B.jsx)(c,{className:`size-3.5`}),t[27]=i,t[28]=j);let ae=s?.installed?r?`刷新扩展文件`:`Refresh files`:r?`安装扩展文件`:`Install extension`,M;t[29]!==ie||t[30]!==k||t[31]!==A||t[32]!==j||t[33]!==ae?(M=(0,B.jsxs)(v,{className:`h-9`,variant:ie,disabled:k,onClick:A,children:[j,ae]}),t[29]=ie,t[30]=k,t[31]=A,t[32]=j,t[33]=ae,t[34]=M):M=t[34];let N=!s?.installed||i!==null,F;t[35]!==a||t[36]!==r?(F=()=>void a(`extension-open`,ue,r?`已打开 Chrome 扩展页。`:`Chrome extensions opened.`),t[35]=a,t[36]=r,t[37]=F):F=t[37];let I;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,B.jsx)(l,{className:`size-3.5`}),t[38]=I):I=t[38];let L=r?`打开扩展页`:`Open extensions`,R;t[39]!==N||t[40]!==F||t[41]!==L?(R=(0,B.jsxs)(v,{className:`h-9`,variant:`secondary`,disabled:N,onClick:F,children:[I,L]}),t[39]=N,t[40]=F,t[41]=L,t[42]=R):R=t[42];let se=!s?.installed||i!==null,z;t[43]!==a||t[44]!==r?(z=()=>void a(`extension-folder`,le,r?`已打开扩展目录。`:`Extension folder opened.`),t[43]=a,t[44]=r,t[45]=z):z=t[45];let V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,B.jsx)(re,{className:`size-3.5`}),t[46]=V):V=t[46];let ce=r?`打开扩展目录`:`Open folder`,H;t[47]!==se||t[48]!==z||t[49]!==ce?(H=(0,B.jsxs)(v,{className:`h-9`,variant:`ghost`,disabled:se,onClick:z,children:[V,ce]}),t[47]=se,t[48]=z,t[49]=ce,t[50]=H):H=t[50];let de=i!==null,W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,B.jsx)(ne,{className:`size-3.5`}),t[51]=W):W=t[51];let fe=r?`连接远程 Chrome`:`Connect remote Chrome`,G;t[52]!==o||t[53]!==de||t[54]!==fe?(G=(0,B.jsxs)(v,{className:`h-9`,variant:`secondary`,disabled:de,onClick:o,children:[W,fe]}),t[52]=o,t[53]=de,t[54]=fe,t[55]=G):G=t[55];let K;t[56]!==M||t[57]!==R||t[58]!==H||t[59]!==G?(K=(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[M,R,H,G]}),t[56]=M,t[57]=R,t[58]=H,t[59]=G,t[60]=K):K=t[60];let q;t[61]!==n?.connected||t[62]!==n?.socketConnected||t[63]!==r?(q=n?.connected?null:(0,B.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:n?.socketConnected?r?`扩展仍在运行旧协议。请打开 Chrome 扩展页,找到 xopc 并点击“重新加载”,然后刷新状态。`:`The extension is still running an older protocol. Open Chrome Extensions, find xopc, click Reload, then refresh status.`:r?`打开 xopc Chrome 扩展后,它会自动发现并安全连接本机 Gateway;连接远程 Gateway 时才需要配对链接和手动确认。`:`Open the xopc Chrome extension to discover and securely connect to a local Gateway automatically. A pairing link and explicit approval are only required for a remote Gateway.`}),t[61]=n?.connected,t[62]=n?.socketConnected,t[63]=r,t[64]=q):q=t[64];let J;return t[65]!==D||t[66]!==O||t[67]!==K||t[68]!==q?(J=(0,B.jsxs)(`div`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[D,O,K,q]}),t[65]=D,t[66]=O,t[67]=K,t[68]=q,t[69]=J):J=t[69],J}function le(){return L(`folder`)}function ue(){return L(`chrome`)}function de(e){let t=(0,P.c)(28),{status:n,zh:r,installer:i}=e,a=n?.installed===!0,o=n?.installed?r?`已安装`:`Installed`:n?.reason??(r?`未安装`:`Not installed`),s;t[0]!==a||t[1]!==o?(s=(0,B.jsx)(U,{label:`Chromium`,ok:a,value:o}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let l;t[3]===n?l=t[4]:(l=n?.executablePath?(0,B.jsx)(`p`,{className:`mt-2 break-all text-xs text-fg-subtle`,children:n.executablePath}):null,t[3]=n,t[4]=l);let d;t[5]===i.progress?d=t[6]:(d=i.progress?(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:i.progress.message??i.progress.phase}),(0,B.jsx)(`span`,{children:i.progress.percent==null?``:`${Math.round(i.progress.percent)}%`})]}),(0,B.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width]`,style:{width:`${i.progress.percent??8}%`}})})]}):null,t[5]=i.progress,t[6]=d);let f=n?.installed?`secondary`:`primary`,p;t[7]===i?p=t[8]:(p=()=>void i.install(),t[7]=i,t[8]=p);let m;t[9]===i.running?m=t[10]:(m=i.running?(0,B.jsx)(u,{className:`size-3.5 animate-spin`}):(0,B.jsx)(c,{className:`size-3.5`}),t[9]=i.running,t[10]=m);let h=n?.installed?r?`重新安装 Chromium`:`Reinstall Chromium`:r?`安装 Chromium`:`Install Chromium`,g;t[11]!==i.running||t[12]!==f||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,B.jsxs)(v,{variant:f,className:`h-9`,disabled:i.running,onClick:p,children:[m,h]}),t[11]=i.running,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==i||t[18]!==r?(_=i.running?(0,B.jsx)(v,{variant:`ghost`,className:`h-9`,disabled:i.cancelling,onClick:()=>void i.cancel(),children:i.cancelling?r?`正在取消…`:`Cancelling…`:r?`取消`:`Cancel`}):null,t[17]=i,t[18]=r,t[19]=_):_=t[19];let y;t[20]!==_||t[21]!==g?(y=(0,B.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[g,_]}),t[20]=_,t[21]=g,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==l||t[26]!==d?(b=(0,B.jsxs)(`div`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[s,l,d,y]}),t[23]=y,t[24]=s,t[25]=l,t[26]=d,t[27]=b):b=t[27],b}function U(e){let t=(0,P.c)(11),{label:n,ok:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=a);let o=`mt-1 flex items-center gap-1.5 text-sm ${r?`text-success`:`text-fg-muted`}`,s=`size-1.5 rounded-full ${r?`bg-success`:`bg-warning`}`,c;t[2]===s?c=t[3]:(c=(0,B.jsx)(`span`,{className:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c||t[6]!==i?(l=(0,B.jsxs)(`p`,{className:o,children:[c,i]}),t[4]=o,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==a||t[9]!==l?(u=(0,B.jsxs)(`div`,{className:`rounded-lg bg-surface-subtle px-3 py-2`,children:[a,l]}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function W(e){let t=(0,P.c)(4),{tone:n,children:r}=e,i=`mt-3 rounded-lg px-3 py-2 text-xs ${n===`success`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,a=n===`error`?`alert`:`status`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,B.jsx)(`p`,{className:i,role:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function fe(e){let t=(0,P.c)(36),{sectionId:n,vm:r,children:i}=e,a=h(G),o;t[0]===a?o=t[1]:(o=d(a),t[0]=a,t[1]=o);let s=o,c=s.agentSettings,l=s.settingsSections[n]??n;if(!r.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===l?n=t[4]:(n=(0,B.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:l}),t[3]=l,t[4]=n);let r;t[5]===c.needToken?r=t[6]:(r=(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,B.jsx)(k,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,B.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(r.loading){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(k,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,B.jsx)(A,{sections:1})}),t[10]=e):e=t[10],e}if(!r.form){let e=r.error??r.fetchError??c.loadError,n;t[11]===e?n=t[12]:(n=(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n);let i;t[13]===r?i=t[14]:(i=()=>void r.mutate(),t[13]=r,t[14]=i);let a;t[15]!==s.logs.refresh||t[16]!==i?(a=(0,B.jsx)(v,{type:`button`,variant:`secondary`,onClick:i,children:s.logs.refresh}),t[15]=s.logs.refresh,t[16]=i,t[17]=a):a=t[17];let o;return t[18]!==n||t[19]!==a?(o=(0,B.jsxs)(k,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:[n,a]}),t[18]=n,t[19]=a,t[20]=o):o=t[20],o}let u;t[21]!==r.autosaveStatus||t[22]!==r.error?(u=(0,B.jsx)(j,{status:r.autosaveStatus,error:r.error}),t[21]=r.autosaveStatus,t[22]=r.error,t[23]=u):u=t[23];let f;t[24]!==l||t[25]!==u?(f=(0,B.jsx)(ie,{title:l,actions:u}),t[24]=l,t[25]=u,t[26]=f):f=t[26];let p;t[27]===r.error?p=t[28]:(p=r.error?(0,B.jsx)(`div`,{className:`rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:r.error}):null,t[27]=r.error,t[28]=p);let m;t[29]===i?m=t[30]:(m=(0,B.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:i}),t[29]=i,t[30]=m);let g;return t[31]!==f||t[32]!==p||t[33]!==m||t[34]!==r.onBlurCapture?(g=(0,B.jsxs)(k,{gap:`gap-6`,onBlurCapture:r.onBlurCapture,children:[f,p,m]}),t[31]=f,t[32]=p,t[33]=m,t[34]=r.onBlurCapture,t[35]=g):g=t[35],g}function G(e){return e.language}var K={enabled:!0,driverKind:`extension`,headless:!1,executablePath:``,cdpEndpoint:`http://127.0.0.1:9222`,remoteProvider:`browserbase`,remoteApiKey:``,remoteProjectId:``,remoteRegion:``,maxNodes:180,maxCharacters:12e3,visualFallback:!0,actionTimeoutMs:3e4,sessionTimeoutMs:9e5,maxSequenceLength:5,allowedPrivateHosts:``,crossDomainNavigation:`ask`,uploads:`ask`,consequentialActions:`ask`};function q(e){let t=Y(Y(e).browser),n=Y(t.driver),r=Y(t.observation),i=Y(t.limits),a=Y(t.security),o=n.kind;return{...K,enabled:t.enabled!==!1,driverKind:o===`playwright`||o===`cdp`||o===`remote`?o:`extension`,headless:n.headless===!0,executablePath:X(n.executablePath,``),cdpEndpoint:X(n.endpoint,K.cdpEndpoint),remoteProvider:n.provider===`browser-use`?`browser-use`:`browserbase`,remoteApiKey:X(n.apiKey,``),remoteProjectId:X(n.projectId,``),remoteRegion:X(n.region,``),maxNodes:Z(r.maxNodes,K.maxNodes),maxCharacters:Z(r.maxCharacters,K.maxCharacters),visualFallback:r.visualFallback!==!1,actionTimeoutMs:Z(i.actionTimeoutMs,K.actionTimeoutMs),sessionTimeoutMs:Z(i.sessionTimeoutMs,K.sessionTimeoutMs),maxSequenceLength:Z(i.maxSequenceLength,K.maxSequenceLength),allowedPrivateHosts:Array.isArray(a.allowedPrivateHosts)?a.allowedPrivateHosts.filter(e=>typeof e==`string`).join(`
|
|
7
|
-
`):``,crossDomainNavigation:he(a.crossDomainNavigation),uploads:he(a.uploads),consequentialActions:he(a.consequentialActions)}}function J(e){let t=e.driverKind===`extension`?{kind:`extension`}:e.driverKind===`playwright`?{kind:`playwright`,headless:e.headless,...e.executablePath.trim()?{executablePath:e.executablePath.trim()}:{}}:e.driverKind===`cdp`?{kind:`cdp`,endpoint:e.cdpEndpoint.trim()}:{kind:`remote`,provider:e.remoteProvider,...e.remoteApiKey.trim()?{apiKey:e.remoteApiKey.trim()}:{},...e.remoteProjectId.trim()?{projectId:e.remoteProjectId.trim()}:{},...e.remoteRegion.trim()?{region:e.remoteRegion.trim()}:{}};return{enabled:e.enabled,driver:t,observation:{maxNodes:e.maxNodes,maxCharacters:e.maxCharacters,visualFallback:e.visualFallback},limits:{actionTimeoutMs:e.actionTimeoutMs,sessionTimeoutMs:e.sessionTimeoutMs,maxSequenceLength:e.maxSequenceLength},security:{privateNetworks:`deny`,allowedPrivateHosts:e.allowedPrivateHosts.split(`
|
|
8
|
-
`).map(e=>e.trim()).filter(Boolean),crossDomainNavigation:e.crossDomainNavigation,uploads:e.uploads,consequentialActions:e.consequentialActions}}}function pe(e){if(e.driverKind===`cdp`)try{let t=new URL(e.cdpEndpoint);if(t.protocol!==`http:`&&t.protocol!==`https:`&&t.protocol!==`ws:`&&t.protocol!==`wss:`)return`CDP endpoint must use http, https, ws, or wss.`}catch{return`Enter a valid CDP endpoint URL.`}return!Number.isInteger(e.maxNodes)||e.maxNodes<20||e.maxNodes>500?`Max nodes must be between 20 and 500.`:!Number.isInteger(e.maxCharacters)||e.maxCharacters<1e3||e.maxCharacters>5e4?`Max characters must be between 1,000 and 50,000.`:!Number.isInteger(e.actionTimeoutMs)||e.actionTimeoutMs<1e3||e.actionTimeoutMs>12e4?`Action timeout must be between 1,000 and 120,000 ms.`:!Number.isInteger(e.sessionTimeoutMs)||e.sessionTimeoutMs<6e4||e.sessionTimeoutMs>36e5?`Session timeout must be between 60,000 and 3,600,000 ms.`:!Number.isInteger(e.maxSequenceLength)||e.maxSequenceLength<1||e.maxSequenceLength>10?`Sequence length must be between 1 and 10.`:null}async function me(e){await f(g(`/api/config`),{method:`PATCH`,body:JSON.stringify({browser:J(e)})}),y()}function Y(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e,t){return typeof e==`string`?e:t}function Z(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function he(e){return e===`allow`||e===`deny`?e:`ask`}var ge=D();function _e(e){let t=!!p(e=>e.sessionKey),[n,r]=(0,N.useReducer)(ge,{form:null,baseline:null}),i=n.form,a=n.baseline,o=(0,N.useRef)(!1),s=(0,N.useRef)(i);s.current=i;let c=(0,N.useRef)(null),{data:l,error:u,isLoading:d,mutate:f}=b(t);E({enabled:t,parsed:(0,N.useMemo)(()=>l?.payload?.config===void 0?null:q(l.payload.config),[l]),dirty:o.current,trackedParsedRef:c,dispatch:r,onResetDirty:()=>{o.current=!1}});let m=!!(t&&d&&l===void 0&&!u),h=u instanceof Error?u.message:u?String(u):null,g=(0,N.useMemo)(()=>!i||!a?!1:JSON.stringify(i)!==JSON.stringify(a),[i,a]),_=(0,N.useCallback)(e=>{o.current=!0,r({type:`patch`,patch:e})},[]),v=ae({value:i,dirty:g,onSave:(0,N.useCallback)(async t=>{try{await me(t),r({type:`saved`,value:t}),o.current=!!(s.current&&JSON.stringify(s.current)!==JSON.stringify(t))}catch(t){throw Error(t instanceof Error?t.message:e.saveError)}},[e.saveError]),validate:pe});return{hasToken:t,loading:m,fetchError:h,form:i,update:_,autosaveStatus:v.status,error:v.error,onBlurCapture:v.onBlurCapture,mutate:f}}var ve=[`extension`,`playwright`,`cdp`,`remote`];function ye(){let e=(0,P.c)(29),t=h(be),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=_e(n.agentSettings),i=r.form,s=t===`zh`,[c]=a(),l=(0,N.useRef)(!1),u;e[2]!==i||e[3]!==c||e[4]!==r?(u=()=>{if(!i||l.current)return;l.current=!0;let e=c.get(`driver`);ve.includes(e)&&e!==i.driverKind&&r.update({driverKind:e})},e[2]=i,e[3]=c,e[4]=r,e[5]=u):u=e[5];let f;e[6]!==i||e[7]!==c||e[8]!==r.update?(f=[i,c,r.update],e[6]=i,e[7]=c,e[8]=r.update,e[9]=f):f=e[9],(0,N.useEffect)(u,f);let p=s?`Chrome 扩展(推荐)`:`Chrome extension (recommended)`,m;e[10]===p?m=e[11]:(m={value:`extension`,label:p},e[10]=p,e[11]=m);let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g={value:`playwright`,label:`Playwright Chromium`},e[12]=g):g=e[12];let _=s?`CDP 已有浏览器`:`Existing browser over CDP`,v;e[13]===_?v=e[14]:(v={value:`cdp`,label:_},e[13]=_,e[14]=v);let y=s?`远程浏览器`:`Remote browser`,b;e[15]===y?b=e[16]:(b={value:`remote`,label:y},e[15]=y,e[16]=b);let x;e[17]!==m||e[18]!==v||e[19]!==b?(x=[m,g,v,b],e[17]=m,e[18]=v,e[19]=b,e[20]=x):x=e[20];let w=x,T;e[21]!==w||e[22]!==i||e[23]!==r||e[24]!==s?(T=i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ce,{enabled:i.enabled,driverKind:i.driverKind,autosaveStatus:r.autosaveStatus,zh:s}),(0,B.jsxs)(Se,{title:s?`运行方式`:`Connection`,icon:(0,B.jsx)(C,{className:`size-4`}),children:[(0,B.jsx)(we,{label:s?`启用浏览器控制`:`Enable browser control`,checked:i.enabled,onChange:e=>r.update({enabled:e})}),(0,B.jsx)(Q,{label:s?`浏览器连接`:`Browser connection`,children:(0,B.jsx)(o,{value:i.driverKind,options:w,placeholder:s?`选择连接方式`:`Choose a connection`,allowEmpty:!1,onChange:e=>r.update({driverKind:e})})}),(0,B.jsx)(xe,{kind:i.driverKind,zh:s}),i.driverKind===`playwright`?(0,B.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-subtle p-4`,children:[(0,B.jsx)(we,{label:s?`无头模式`:`Headless mode`,description:s?`后台运行,不显示浏览器窗口。关闭后可观察智能体的操作过程。`:`Run in the background without a visible window. Turn off to watch the agent work.`,checked:i.headless,onChange:e=>r.update({headless:e})}),(0,B.jsx)($,{label:s?`Chromium 可执行文件(可选)`:`Chromium executable (optional)`,description:s?`留空时使用由 xopc 安装的 Chromium。`:`Leave empty to use Chromium installed by xopc.`,value:i.executablePath,onChange:e=>r.update({executablePath:e})})]}):null,i.driverKind===`cdp`?(0,B.jsx)(`div`,{className:`rounded-lg bg-surface-subtle p-4`,children:(0,B.jsx)($,{label:`CDP endpoint`,description:s?`例如 http://127.0.0.1:9222。Chrome 需要开启 remote debugging。`:`For example http://127.0.0.1:9222. Chrome must be started with remote debugging enabled.`,value:i.cdpEndpoint,onChange:e=>r.update({cdpEndpoint:e})})}):null,i.driverKind===`remote`?(0,B.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-subtle p-4`,children:[(0,B.jsx)(Q,{label:s?`服务商`:`Provider`,children:(0,B.jsx)(o,{value:i.remoteProvider,options:[{value:`browserbase`,label:`Browserbase`},{value:`browser-use`,label:`Browser Use`}],placeholder:s?`选择服务商`:`Choose a provider`,allowEmpty:!1,onChange:e=>r.update({remoteProvider:e})})}),(0,B.jsx)($,{label:`API key`,type:`password`,autoComplete:`off`,value:i.remoteApiKey,onChange:e=>r.update({remoteApiKey:e})}),(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,B.jsx)($,{label:`Project ID`,value:i.remoteProjectId,onChange:e=>r.update({remoteProjectId:e})}),(0,B.jsx)($,{label:`Region`,value:i.remoteRegion,onChange:e=>r.update({remoteRegion:e})})]})]}):null]}),(0,B.jsx)(M,{children:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Se,{title:s?`页面理解`:`Page understanding`,icon:(0,B.jsx)(O,{className:`size-4`}),children:[(0,B.jsx)(we,{label:s?`需要时附加截图`:`Attach screenshots when needed`,checked:i.visualFallback,onChange:e=>r.update({visualFallback:e})}),(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,B.jsx)(Ce,{label:s?`语义节点上限`:`Semantic node limit`,description:`20–500`,min:20,max:500,value:i.maxNodes,onChange:e=>r.update({maxNodes:e})}),(0,B.jsx)(Ce,{label:s?`文本字符上限`:`Text character limit`,description:`1,000–50,000`,min:1e3,max:5e4,step:1e3,value:i.maxCharacters,onChange:e=>r.update({maxCharacters:e})})]})]}),(0,B.jsx)(Se,{title:s?`执行限制`:`Execution limits`,icon:(0,B.jsx)(S,{className:`size-4`}),children:(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,B.jsx)(Ce,{label:s?`操作超时(毫秒)`:`Action timeout (ms)`,min:1e3,max:12e4,step:1e3,value:i.actionTimeoutMs,onChange:e=>r.update({actionTimeoutMs:e})}),(0,B.jsx)(Ce,{label:s?`会话超时(毫秒)`:`Session timeout (ms)`,min:6e4,max:36e5,step:6e4,value:i.sessionTimeoutMs,onChange:e=>r.update({sessionTimeoutMs:e})}),(0,B.jsx)(Ce,{label:s?`批量步骤上限`:`Sequence step limit`,min:1,max:10,value:i.maxSequenceLength,onChange:e=>r.update({maxSequenceLength:e})})]})}),(0,B.jsxs)(Se,{title:s?`安全与审批`:`Safety and approvals`,icon:(0,B.jsx)(ee,{className:`size-4`}),children:[(0,B.jsx)($,{label:s?`允许访问的私网主机`:`Allowed private hosts`,description:s?`每行一个主机名或 IP,不支持通配符。`:`One hostname or IP per line. Wildcards are not supported.`,multiline:!0,value:i.allowedPrivateHosts,onChange:e=>r.update({allowedPrivateHosts:e})}),(0,B.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,B.jsx)(Te,{zh:s,label:s?`跨域导航`:`Cross-domain navigation`,value:i.crossDomainNavigation,onChange:e=>r.update({crossDomainNavigation:e})}),(0,B.jsx)(Te,{zh:s,label:s?`高影响动作`:`Consequential actions`,value:i.consequentialActions,onChange:e=>r.update({consequentialActions:e})}),(0,B.jsx)(Te,{zh:s,label:s?`文件上传`:`File uploads`,value:i.uploads,onChange:e=>r.update({uploads:e})})]})]})]})})]}):null,e[21]=w,e[22]=i,e[23]=r,e[24]=s,e[25]=T):T=e[25];let E;return e[26]!==T||e[27]!==r?(E=(0,B.jsx)(fe,{sectionId:`agent-browser`,vm:r,children:T}),e[26]=T,e[27]=r,e[28]=E):E=e[28],E}function be(e){return e.language}function xe(e){let t=(0,P.c)(7),{kind:n,zh:r}=e,i=r?`直接操作你正在使用的 Chrome,保留登录状态和现有标签页;最适合日常协作。`:`Operate your current Chrome with its signed-in state and existing tabs; best for daily collaboration.`,a=r?`由 xopc 启动独立 Chromium,环境隔离、自动化稳定,适合无人值守任务。`:`Let xopc launch an isolated Chromium; stable for unattended automation.`,o=r?`连接已开启远程调试的 Chrome 或 Chromium,适合自定义浏览器启动方式。`:`Connect to Chrome or Chromium already running with remote debugging.`,s=r?`使用 Browserbase 或 Browser Use 的云端浏览器,适合服务器环境和长任务。`:`Use a Browserbase or Browser Use cloud browser for servers and long-running tasks.`,c;t[0]!==i||t[1]!==a||t[2]!==o||t[3]!==s?(c={extension:i,playwright:a,cdp:o,remote:s},t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c):c=t[4];let l=c[n],u;return t[5]===l?u=t[6]:(u=(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:l}),t[5]=l,t[6]=u),u}function Se(e){let t=(0,P.c)(17),{title:n,description:r,icon:i,children:a}=e,o;t[0]===i?o=t[1]:(o=(0,B.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:i}),t[0]=i,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,B.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=r?(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[4]=r,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,B.jsxs)(`div`,{children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,B.jsxs)(`div`,{className:`mb-4 flex items-start gap-2`,children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let d;t[12]===a?d=t[13]:(d=(0,B.jsx)(`div`,{className:`space-y-4`,children:a}),t[12]=a,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,B.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-5`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Q(e){let t=(0,P.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,B.jsx)(`span`,{className:`mb-1.5 block font-medium`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,B.jsx)(`span`,{className:`mt-1.5 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,B.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function $(e){let t=(0,P.c)(10),{label:n,description:r,value:i,onChange:a,type:o,multiline:s,autoComplete:c}=e,l=o===void 0?`text`:o,u=s===void 0?!1:s,d;t[0]!==c||t[1]!==u||t[2]!==a||t[3]!==l||t[4]!==i?(d=u?(0,B.jsx)(`textarea`,{rows:3,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-subtle px-3 py-2 text-sm text-fg outline-none focus:border-accent`}):(0,B.jsx)(`input`,{type:l,autoComplete:c,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-subtle px-3 py-2 text-sm text-fg outline-none focus:border-accent`}),t[0]=c,t[1]=u,t[2]=a,t[3]=l,t[4]=i,t[5]=d):d=t[5];let f;return t[6]!==r||t[7]!==n||t[8]!==d?(f=(0,B.jsx)(Q,{label:n,description:r,children:d}),t[6]=r,t[7]=n,t[8]=d,t[9]=f):f=t[9],f}function Ce(e){let t=(0,P.c)(12),{label:n,description:r,value:i,onChange:a,min:o,max:s,step:c}=e,l=c===void 0?1:c,u;t[0]===a?u=t[1]:(u=e=>{let t=Number(e.target.value);Number.isFinite(t)&&a(t)},t[0]=a,t[1]=u);let d;t[2]!==s||t[3]!==o||t[4]!==l||t[5]!==u||t[6]!==i?(d=(0,B.jsx)(`input`,{type:`number`,min:o,max:s,step:l,value:i,onChange:u,className:`h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none focus:border-accent`}),t[2]=s,t[3]=o,t[4]=l,t[5]=u,t[6]=i,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==n||t[10]!==d?(f=(0,B.jsx)(Q,{label:n,description:r,children:d}),t[8]=r,t[9]=n,t[10]=d,t[11]=f):f=t[11],f}function we(e){let t=(0,P.c)(15),{label:n,description:r,checked:i,onChange:a}=e,o;t[0]===a?o=t[1]:(o=e=>a(e.target.checked),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,B.jsx)(`input`,{type:`checkbox`,checked:i,onChange:o,className:`mt-0.5 size-4 accent-accent`}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n?c=t[6]:(c=(0,B.jsx)(`span`,{className:`block font-medium`,children:n}),t[5]=n,t[6]=c);let l;t[7]===r?l=t[8]:(l=r?(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,B.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==s||t[13]!==u?(d=(0,B.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14],d}function Te(e){let t=(0,P.c)(20),{zh:n,label:r,value:i,onChange:a}=e,s=n?`每次询问`:`Ask each time`,c;t[0]===s?c=t[1]:(c={value:`ask`,label:s},t[0]=s,t[1]=c);let l=n?`允许`:`Allow`,u;t[2]===l?u=t[3]:(u={value:`allow`,label:l},t[2]=l,t[3]=u);let d=n?`拒绝`:`Deny`,f;t[4]===d?f=t[5]:(f={value:`deny`,label:d},t[4]=d,t[5]=f);let p;t[6]!==c||t[7]!==u||t[8]!==f?(p=[c,u,f],t[6]=c,t[7]=u,t[8]=f,t[9]=p):p=t[9];let m=p,h=n?`选择策略`:`Choose a policy`,g;t[10]===a?g=t[11]:(g=e=>a(e),t[10]=a,t[11]=g);let _;t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==i?(_=(0,B.jsx)(o,{value:i,options:m,placeholder:h,allowEmpty:!1,onChange:g}),t[12]=m,t[13]=h,t[14]=g,t[15]=i,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_?(v=(0,B.jsx)(Q,{label:r,children:_}),t[17]=r,t[18]=_,t[19]=v):v=t[19],v}export{ye as AgentBrowserSettingsPage};
|