@xopcai/xopc 0.0.201 → 0.0.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DOhnAQOQ.js → activity-store-SZAay-ze.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D8Cw0Mve.js → agent-avatar-dicebear-DPLJtxoS.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DyjRuuRa.js +68 -0
- package/dist/gateway/static/root/assets/{api-E9Bk-Idp.js → api-C1cSt2ru.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BubrReXg.js → app-management-settings-panel-B3PCMqor.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BY5Az2p4.js → appearance-settings-txSx3REK.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BEhBaooZ.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BY8843mB.js → archive-plugin-B2VVc17j.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DG45KScf.js → attachment-load-Crk7x8qR.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BUC6FL6O.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DGIF2ZAv.js → binary-plugins-CLlJsq5D.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C1Qktr1g.js → block-editor-cJ5lVNAG.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-Bq2m4VpX.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_jnndyz.js → browser-workflow-inputs-WRiFG88u.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DyIRvPaq.js → browser-workflows-page-BHLdVoOC.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BiQbVvYU.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api--tz0mGLY.js → capability-presets-api-DmElfgC9.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CYlZQpLY.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CkOKF9nc.js → channel-recipient-api-BUEOtPft.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DlDiCMhO.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Dm_-934M.js +1 -0
- package/dist/gateway/static/root/assets/{connectors-api-FBOe9SWC.js → connectors-api-BCdn44_o.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Ce-eaPHw.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-D2hF3t68.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-Dtn7e6TW.js → date-picker-Dvjoq2mB.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-zv1OIhk3.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-DJZhKLTb.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-FDmaty3P.js → desktop-pet-settings-B3ubM-eY.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-X2e8xn8j.js → directory-picker-path-field-BZEJIWOT.js} +1 -1
- package/dist/gateway/static/root/assets/download-Dk-ZjtO6.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Dx4MBfga.js → extension-debug-page-Bvq3E1A1.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bf_FEDhM.js → extension-page-CuCJjWNm.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CrOgZxkf.js → extension-settings-page-CpTk_ajr.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CZ4r-7qT.js → gateway-config-api-C2yM6qj7.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Cv2ywpdb.js → gateway-config-swr-CN-JHMAh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DpWmVi0w.js → gateway-settings-COwi--2Q.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-undf-k5g.js → gateway-startup-retry-Dq1RyCjz.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DSQZhSvT.js → heartbeat-settings-Dc6H4VGF.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BB3RGxwm.js +3 -0
- package/dist/gateway/static/root/assets/index-CPTLS-Zn.js +85 -0
- package/dist/gateway/static/root/assets/index-Dm-cvIpl.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bc3Quw42.js → keyboard-shortcuts-settings-cue30Z5p.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DfO6FOB9.js +2 -0
- package/dist/gateway/static/root/assets/local-apps-page-DKQSCsa0.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-CnamlR07.js → locale-store-81Gv0wwo.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DODbODyl.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-CJmcaVje.js → management-settings--4H26QR-.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-AcuFp0TH.js → markdown-split-BTvpyjAi.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-B12xeflb.css +1 -0
- package/dist/gateway/static/root/assets/markdown-view-B4iBrVWK.js +69 -0
- package/dist/gateway/static/root/assets/{media-plugins-BvFgsiJL.js → media-plugins-DrejWl8t.js} +1 -1
- package/dist/gateway/static/root/assets/messages-ELK_1h2D.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-IW7IQ9nJ.js → notes-page-DfSzeQKd.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DxL4GhwV.js +4 -0
- package/dist/gateway/static/root/assets/plus-Q2yW6OE7.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-yjh1_7K3.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CWEzLykF.js → product-open-page-DopWBJLa.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Bl3LJHZB.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DStOErTC.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-C_hh9ztK.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DAohEZrX.js → runtime-tools-settings-panel-_dHhbYV2.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-C_OBW8A5.js → schema-form-DZhORvJZ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DDY21KYw.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BJrHIcw8.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C7w2WS-A.js → settings-form-section-Du5eAgFS.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-zwibve4m.js → settings-loading-skeleton-DWS27sv1.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B9W03dSW.js → settings-page-DPD0MwoN.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CnXN4LH_.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-D6HmH2ga.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-U3lvtO3Y.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B6GiZgZU.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-XVO7d3fh.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-D9QT5cxj.js → skills-page.utils-DwxIpWrI.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-c1HVtv1Y.js → system-settings-panel-BmKbxR8_.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DA6ItYrc.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BDyUTObE.js → theme-store-hOF81tUQ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-D6UkH_Ga.js → use-autosave-GJfDpf66.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CQ1QrRE6.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BOxkKbGh.js → voice-api-key-field-B0zve9EE.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-DrIbHnBz.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-CQW8pPec.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-ZA3bP65I.js → workflow-run-setup-panel-D-_zQxim.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-O21l_f5c.js +5 -0
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-BcyiDXU3.js → working-directory-picker-modal-5xYx48tV.js} +1 -1
- package/dist/gateway/static/root/assets/x-B_N4OPjy.js +1 -0
- package/dist/gateway/static/root/index.html +19 -14
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/embedded/run-for-session.js +3 -2
- package/dist/src/agent/embedded/run-turn.js +29 -16
- package/dist/src/agent/embedded/types.d.ts +2 -2
- package/dist/src/agent/embedded/xopc-stream-bridge.d.ts +2 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +2 -2
- package/dist/src/agent/memory/context-budget.d.ts +6 -1
- package/dist/src/agent/memory/context-budget.js +94 -2
- package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
- package/dist/src/agent/prompt/cache-boundary.js +10 -1
- package/dist/src/agent/prompt/sections/project-context.d.ts +1 -4
- package/dist/src/agent/prompt/sections/project-context.js +6 -13
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -1
- package/dist/src/agent/prompt/system-prompt.d.ts +1 -3
- package/dist/src/agent/prompt/system-prompt.js +6 -15
- package/dist/src/agent/tools/cache-stability.d.ts +3 -0
- package/dist/src/agent/tools/cache-stability.js +19 -0
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent-manifest/schema.d.ts +40 -20
- package/dist/src/agent-manifest/schema.js +4 -5
- package/dist/src/config/schema.d.ts +40 -20
- package/dist/src/extensions/types/providers.d.ts +0 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -1
- package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
- package/dist/src/gateway/hono/oauth-async.js +14 -2
- package/dist/src/providers/extension-stream-bridge.js +0 -2
- package/dist/src/providers/google-managed-prompt-cache.d.ts +14 -0
- package/dist/src/providers/google-managed-prompt-cache.js +125 -0
- package/dist/src/providers/prompt-cache-fingerprint.d.ts +4 -0
- package/dist/src/providers/prompt-cache-fingerprint.js +44 -0
- package/dist/src/providers/prompt-cache-lifecycle.d.ts +9 -0
- package/dist/src/providers/prompt-cache-lifecycle.js +31 -0
- package/dist/src/providers/prompt-cache-observability.d.ts +20 -0
- package/dist/src/providers/prompt-cache-observability.js +44 -0
- package/dist/src/providers/prompt-cache-payload.d.ts +10 -3
- package/dist/src/providers/prompt-cache-payload.js +204 -31
- package/dist/src/providers/prompt-cache-plan.d.ts +15 -0
- package/dist/src/providers/prompt-cache-plan.js +29 -0
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-ANavi648.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CFh9MBxc.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-751CeNI3.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CGAWs-TT.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CghUK68J.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-XsTfkvUn.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DkoAZZMe.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-e4vekkAu.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-Q4QaYjpI.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-Br6nPaM6.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-DzTM6aH8.js +0 -1
- package/dist/gateway/static/root/assets/home-page-L0uHiu0T.js +0 -3
- package/dist/gateway/static/root/assets/index-Bp8I_eX4.css +0 -1
- package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +0 -152
- package/dist/gateway/static/root/assets/local-app-workbench-page-Copi3sdP.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-CP9X_vtz.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DMKq6e29.js +0 -2
- package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-Zb8U0anO.js +0 -4
- package/dist/gateway/static/root/assets/preview-open-alternatives-C-b34dgQ.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BuIbLnan.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BwUfRqNV.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BTaXxcEi.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BnHoTCD3.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8Hec2Af.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-6e3ks2be.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Bwc5HfLI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-WgkaNzpc.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-CjP-6WVU.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-D8ZhPDNF.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-Dd19yK9t.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DUkdJl1e.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-C2b5W5bw.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./external-link-DjqjBmc3.js";import{t as c}from"./markdown-view-B4iBrVWK.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{t as m}from"./messages-ELK_1h2D.js";import{l as h,n as g,o as _,r as v,s as y}from"./locale-store-81Gv0wwo.js";import{a as b,i as x,o as S,r as C,s as w,t as T}from"./dist-BPoKqzeH.js";import{a as E,i as D}from"./vendor-swr-BIWyz7Rc.js";import{r as O}from"./settings-form-draft-Dy10ldo8.js";import{Aa as k,Bl as ee,Cs as A,Fa as j,Ia as M,La as N,Ma as P,Pa as F,Ta as I,Ts as L,Va as R,Xs as z,as as te,is as ne,kl as B,ks as V,yl as H}from"./index-CPTLS-Zn.js";import{t as U}from"./page-tabs-BaEQMYm_.js";var W=e(t(),1),G=n();function K(e){return e===`builtin`||e===`user`?e:`marketplace`}async function q(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 re(e){let t=await _(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await _(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function Y(e){let t=await _(v(`/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 q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function X(e){let t=await _(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Z=r();function ie(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Q={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function $({className:e}){let t=m(g(e=>e.language)).extensionsPage,n=h(e=>!!e.token),r=F(),{mutate:i}=E(),[a,o]=(0,W.useReducer)(O,Q),{q:s,debounced:c,detailPkg:u,rowBusy:d,actionError:p,restartHint:_}=a,b=n?`marketplace-${c}`:null;(0,W.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:x,isLoading:S,error:C}=D(b,async()=>y(c.length>0?v(`/api/marketplace?q=${encodeURIComponent(c)}`):v(`/api/marketplace`)),{revalidateOnFocus:!1}),w=(0,W.useCallback)(()=>{i(`gateway-extensions-list`),I()},[i]),T=(0,W.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await J({name:e,overwrite:n});w(),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,w]),ee=(0,W.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await X(e);w(),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,w]),A=x?.extensions??[];return(0,Z.jsxs)(`div`,{className:f(`flex flex-col gap-4`,e),children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(V,{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,Z.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`})]}),C?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C instanceof Error?C.message:t.marketplaceLoadFailed}):null,p?(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:p}):null,_?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_}):null,S&&!x?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Z.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Z.jsx)(k,{className:`h-5 w-40`}),(0,Z.jsx)(k,{className:`h-4 w-full max-w-xl`}),(0,Z.jsx)(k,{className:`h-4 w-2/3 max-w-md`})]}),(0,Z.jsx)(k,{className:`h-8 w-20`})]})},e))}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:A.length===0?(0,Z.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):A.map(e=>{let n=ie(r,e.id),i=d===e.id;return(0,Z.jsx)(`li`,{className:`list-none`,children:(0,Z.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:f(`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,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Z.jsx)(H,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Z.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,Z.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Z.jsx)(z,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Z.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,Z.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Z.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&ee(e.id).catch(()=>{})},className:f(`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,Z.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(te,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:f(`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)})}),u?(0,Z.jsx)(ae,{packageName:u,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:T,onUninstall:ee}):null]})}function ae(e){let t=(0,G.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:u}=e,[p,m]=(0,W.useState)(!1),[g,_]=(0,W.useState)(!1),v=h(ue)?`ext-mp-detail-${n}`:null,y;t[0]===n?y=t[1]:(y=async()=>re(n),t[0]=n,t[1]=y);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[2]=x):x=t[2];let{data:E,error:O,isLoading:j}=D(v,y,x),M;t[3]!==i||t[4]!==n?(M=ie(i,n),t[3]=i,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,F=E?.manifest?.permissions,I,L,R,z,B,V,H,U,K,q,J;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]!==E||t[29]!==O||t[30]!==N||t[31]!==j||t[32]!==o||t[33]!==F||t[34]!==g){let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==E?(n=E?.readme?.trim()||(E?.description?.trim()?`### ${E.name}\n\n${E.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=E,t[48]=n):n=t[48];let i=n;R=T,z=!0,t[49]===o?B=t[50]:(B=e=>!e&&o(),t[49]=o,t[50]=B),L=S,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=J):J=t[51],I=C,U=`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`,K=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ee,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let l;t[56]===r.marketplaceDetailTitle?l=t[57]:(l=(0,Z.jsx)(w,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=l);let u;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(d,{className:`size-5`}),t[58]=u):u=t[58];let f;t[59]!==r.detailClose||t[60]!==o?(f=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:u}),t[59]=r.detailClose,t[60]=o,t[61]=f):f=t[61],t[62]!==s||t[63]!==l||t[64]!==f?(q=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,l,f]}),t[62]=s,t[63]=l,t[64]=f,t[65]=q):q=t[65],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=j&&!E?(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Z.jsx)(k,{className:`h-6 w-48`}),(0,Z.jsx)(k,{className:`h-4 w-28`}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)(k,{className:`h-12`}),(0,Z.jsx)(k,{className:`h-12`})]}),(0,Z.jsx)(k,{className:`h-28 w-full`}),(0,Z.jsx)(k,{className:`h-36 w-full`})]}):O?(0,Z.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,Z.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:r.marketplaceLoadFailed})]}):E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:E.name}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:E.id})}),(0,Z.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Z.jsx)(`dd`,{children:E.author.username})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Z.jsx)(`dd`,{children:E.latestVersion.version})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Z.jsx)(`dd`,{children:E.downloads})]})]}),N===`bundled`?null:(0,Z.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[E.installability.available?(0,Z.jsx)(A,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Z.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:E.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:E.installability.available?r.marketplaceCodeRisk:E.installability.reason??r.marketplaceUnavailableBody})]})]}),E.installability.available?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Z.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Z.jsx)(`dd`,{children:E.packageSummary?.dependencyCount??0})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,Z.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(E.packageSummary?.lifecycleScripts.length??0)>0?(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,E.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Z.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),E.readme?.trim()?(0,Z.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Z.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Z.jsx)(c,{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]=E,t[29]=O,t[30]=N,t[31]=j,t[32]=o,t[33]=F,t[34]=g,t[35]=I,t[36]=L,t[37]=R,t[38]=z,t[39]=B,t[40]=V,t[41]=H,t[42]=U,t[43]=K,t[44]=q,t[45]=J}else I=t[35],L=t[36],R=t[37],z=t[38],B=t[39],V=t[40],H=t[41],U=t[42],K=t[43],q=t[44],J=t[45];let Y;t[66]!==V||t[67]!==H?(Y=(0,Z.jsx)(`div`,{className:V,children:H}),t[66]=V,t[67]=H,t[68]=Y):Y=t[68];let X;t[69]!==p||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]!==E||t[78]!==N||t[79]!==o||t[80]!==s||t[81]!==u||t[82]!==n||t[83]!==g||t[84]!==P?(X=E?(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Z.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:p||!E.installability.available||!g,onClick:()=>{P&&!window.confirm(r.marketplaceReinstallConfirm)||(m(!0),s(n,P).catch(se).finally(()=>m(!1)))},className:f(`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:[p?(0,Z.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?r.marketplaceReinstall:r.marketplaceInstall]}),P?(0,Z.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(m(!0),u(n).then(()=>o()).catch(oe).finally(()=>m(!1)))},className:f(`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,Z.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=p,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]=E,t[78]=N,t[79]=o,t[80]=s,t[81]=u,t[82]=n,t[83]=g,t[84]=P,t[85]=X):X=t[85];let Q;t[86]!==I||t[87]!==Y||t[88]!==X||t[89]!==U||t[90]!==K||t[91]!==q?(Q=(0,Z.jsxs)(I,{className:U,onOpenAutoFocus:K,children:[q,Y,X]}),t[86]=I,t[87]=Y,t[88]=X,t[89]=U,t[90]=K,t[91]=q,t[92]=Q):Q=t[92];let $;t[93]!==L||t[94]!==Q||t[95]!==J?($=(0,Z.jsxs)(L,{children:[J,Q]}),t[93]=L,t[94]=Q,t[95]=J,t[96]=$):$=t[96];let ae;return t[97]!==R||t[98]!==z||t[99]!==B||t[100]!==$?(ae=(0,Z.jsx)(R,{defaultOpen:z,onOpenChange:B,children:$}),t[97]=R,t[98]=z,t[99]=B,t[100]=$,t[101]=ae):ae=t[101],ae}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,Z.jsxs)(`li`,{className:`break-words`,children:[(0,Z.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=g(e=>e.language),t=m(e),n=R(e=>e.setPageHeader),r=R(e=>e.clearPageHeader),o=F(),s=j(),[c,l]=i(),d=K(c.get(`tab`)),f=c.get(`q`)??``,[h,_]=(0,W.useState)(d),[v,y]=(0,W.useState)(f),[b,x]=(0,W.useState)(null),S=c.toString(),C=(0,W.useRef)(S);if(C.current!==S){C.current=S;let e=K(c.get(`tab`)),t=c.get(`q`)??``;_(t=>t===e?t:e),y(e=>e===t?e:t)}(0,W.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=v.trim();return n?t.set(`q`,n):t.delete(`q`),h===`marketplace`?t.delete(`tab`):t.set(`tab`,h),t.toString()===e.toString()?e:t},{replace:!0})},[h,v,l]);let w=(0,W.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),T=(0,W.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),E=h===`builtin`?w:T,D=(0,W.useMemo)(()=>{let t=v.trim().toLowerCase(),n=E;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)},[E,v,e]);if((0,W.useEffect)(()=>{x(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,W.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(p,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Z.jsx)(B,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Z.jsx)(p,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps/new`,children:[(0,Z.jsx)(u,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&h!==`marketplace`)return(0,Z.jsx)(ye,{});let O=h!==`marketplace`&&E.length>0;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(U,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:w.length},{id:`user`,label:t.extensionsPage.tabUser,count:T.length}],activeTab:h,onChange:_,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,Z.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Z.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:v,onChange:e=>y(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]}),h===`marketplace`?(0,Z.jsx)($,{}):h===`builtin`&&w.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):h===`user`&&T.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyUser}):D.length===0?(0,Z.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,Z.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:h===`user`,onOpen:()=>x(e)},e.id))})]}),b?(0,Z.jsx)(_e,{extension:b,copy:t.extensionsPage,onClose:()=>x(null)},b.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,G.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=fe(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(`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]=d):d=t[2];let p=n.name||n.id,m;t[3]===p?m=t[4]:(m=p.charAt(0).toUpperCase(),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,Z.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:m}),t[5]=m,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,Z.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,Z.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Z.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,Z.jsx)(u,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,Z.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,Z.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,Z.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]!==w||t[33]!==T?(E=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:d,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}=E(),[i,o]=(0,W.useState)(!1),[c,u]=(0,W.useState)(null),[m,h]=(0,W.useState)(!1),g=e.activationEligible===!0,_=(0,W.useCallback)(async()=>{if(e.source===`bundled`){u(null),h(!1),o(!0);try{let{requiresGatewayRestart:t}=await Y({extensionId:e.id,enabled:!g});await r(`gateway-extensions-list`),I(),h(t)}catch(e){u(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[g,t.builtinToggleFailed,e.id,e.source,r]),v=e.ui?.contributions?.pages??[],y=e.ui?.contributions?.settingsPanels??[],D=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],k=v.find(e=>e.showInNav)??v[0],A=y[0],j=k?P(e.id,k):null,F=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||M(e)?`/settings/ext/${e.id}`:null;return(0,Z.jsx)(T,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Z.jsxs)(C,{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,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Z.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,Z.jsx)(ee,{className:`size-5`})}),(0,Z.jsx)(w,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Z.jsxs)(x,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Z.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,Z.jsx)(d,{className:`size-5`})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.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,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Z.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.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,Z.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void _(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):g?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,m?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Z.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&&(v.length>0||y.length>0||D.length>0)?(0,Z.jsxs)(`section`,{className:`mt-8`,children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsx)(ve,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,Z.jsx)(ve,{template:t.badgeSettings,count:y.length,hidden:y.length===0}),(0,Z.jsx)(ve,{template:t.badgeWidgets,count:D.length,hidden:D.length===0}),(0,Z.jsx)(ve,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,N(e)&&(j||F)?(0,Z.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[j?(0,Z.jsxs)(a,{to:j,onClick:n,className:f(`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,Z.jsx)(s,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,Z.jsxs)(a,{to:F,onClick:n,className:f(`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,Z.jsx)(L,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Z.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,G.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,Z.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,G.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Z.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Z.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,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Z.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,Z.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,G.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.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,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-BY8843mB.js → archive-plugin-B2VVc17j.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-ELK_1h2D.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-yjh1_7K3.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
|
package/dist/gateway/static/root/assets/{attachment-load-DG45KScf.js → attachment-load-Crk7x8qR.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
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{
|
|
2
|
+
import{t as e}from"./preload-helper-zJ_50EbN.js";import{Oa as t}from"./index-CPTLS-Zn.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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./markdown-view-B4iBrVWK.js";import{t as l}from"./plus-Q2yW6OE7.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{t as p}from"./messages-ELK_1h2D.js";import{n as m}from"./locale-store-81Gv0wwo.js";import{a as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{Aa as S,An as C,Cl as w,Cs as T,Fi as E,Gl as ee,Go as D,Gs as O,Ic as k,Ns as A,Tl as j,Va as M,Vs as N,Xc as te,as as ne,bl as re,dr as ie,fr as P,gr as ae,ka as oe,ks as se,lc as F,mr as ce,oc as le,pr as ue,qs as I,u as L,v as de,vl as R,vs as z,xl as fe}from"./index-CPTLS-Zn.js";import{a as B,i as V,o as pe,r as H}from"./cron-expression-D2hF3t68.js";import{a as me,i as he,n as ge,r as U,t as _e}from"./workflow-run-setup-panel-D-_zQxim.js";import{i as ve,n as ye,r as be,t as xe}from"./browser-workflow-inputs-WRiFG88u.js";var W=e(t(),1),G=n(),Se=B();function Ce(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function we(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 K(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=H(i.minute.values),o=H(i.hour.values),s=H(i.dayOfWeek.values),c=H(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?Ce(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=we(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=K(s.map(e=>we(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 Oe(e,t,n,r){let i=e.trim();return i?De(i,t,n,r)||ke(r?.nextRun,t)||n.customSchedule:ke(r?.nextRun,t)||`—`}function ke(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 q=1e3,Ae=60*q,J=60*Ae,Y=24*J,X=7*Y,je=new Intl.ListFormat(`en-US`,{type:`conjunction`}),Me=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),Ne={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`})},Pe={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Fe={minute:Ae,hour:J,day:Y,week:X};function Ie(e){return e===`zh`?`zh-CN`:`en-US`}function Le(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:Me[String(t)].format(e)}function Re(e,t){return t===`zh`?e.join(` `):je.format(e)}function ze(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(Ae,Math.round((Number.isFinite(n)&&n>0?n:1)*Fe[t]))}function Be(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*Fe[t]/Fe[n]).toFixed(6)))}function Ve(e,t){let n=Math.max(q,Math.round(e)),r=n===Y?[{unit:`hour`,ms:J}]:n>=X&&n%X===0?[{unit:`week`,ms:X}]:n>=Y?[{unit:`day`,ms:Y},{unit:`hour`,ms:J},{unit:`minute`,ms:Ae},{unit:`second`,ms:q}]:n>=J?[{unit:`hour`,ms:J},{unit:`minute`,ms:Ae},{unit:`second`,ms:q}]:n>=Ae?[{unit:`minute`,ms:Ae},{unit:`second`,ms:q}]:[{unit:`second`,ms:q}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(Le(r,e,t)),i%=n)}return Re(a,t)}function He(e,t){let n=Ve(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function Ue(e,t){return Ne[t].format(new Date(e))}function We(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function Ge(e,t,n=Date.now()){let r=new Date(e),i=Math.round((We(r)-We(new Date(n)))/Y),a=Pe[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}`:Ue(e,t)}function Ke(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 qe(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 Ke(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,Ge(Date.parse(i.at),r)):i.kind===`interval`?He(i.everyMs,r):Oe(i.expr,Ie(r),n.scheduleBadge,{timezone:i.tz})}function Je(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?Ge(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 Ye(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=Ge(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var Xe={name:``,description:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserWorkflowId:``,browserWorkflowInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,afterRunMode:`none`,webhookUrl:``,disableAfterFailures:`3`},Ze=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function Qe(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:ze(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=U(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_recipe`?`auto_apply`:e.safetyMode,u=l===`auto_apply`?e.afterRunMode:`none`,d;return d=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_recipe`?{kind:`browser_recipe`,recipeId:e.browserWorkflowId.trim(),args:e.browserWorkflowInputs}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},trigger:o,action:d,safety:{mode:l},afterRun:u===`webhook`?{kind:`webhook`,url:e.webhookUrl.trim()}:{kind:u},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function $e(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:Xe.time,weekday:Xe.weekday,cronExpr:e}}function et(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 tt(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 nt(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 rt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function it(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 at(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=nt(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=$e(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...et(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:tt(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?rt(r.input):{},o=e.afterRun??{kind:`none`},s=e.reliability?.executionTimeoutSeconds??r.timeoutSeconds??e.reliability?.timeoutSeconds??(r.kind===`browser_recipe`?600:1800);return{...Xe,...n,name:e.name,description:e.description??``,actionMode:r.kind,agentId:r.kind===`browser_recipe`?``:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserWorkflowId:r.kind===`browser_recipe`?r.recipeId:``,browserWorkflowInputs:r.kind===`browser_recipe`?r.args??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?ge(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(s),afterRunMode:o.kind,webhookUrl:o.kind===`webhook`?o.url:``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function ot(e,t,n){let r=Qe(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_recipe`&&r.action.kind===`browser_recipe`&&(a={...e.action,...r.action}),{...r,description:t.description.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function st(e,t,n){return e?Ue(e,n):t.never}function ct(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_recipe`?`Browser automation: ${e.recipeId}`:e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function lt(e){return e.safety?.mode??`auto_apply`}function ut(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 dt(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 ft(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function pt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function mt(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?pt(n):!1}function ht(e,t){return e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`&&e.action.goal?.trim()||ct(e.action,t)}function gt(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function _t(e){return!!gt(e)}function vt(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function yt(e){return ft(e)?0:pt(e)?1:e.status===`succeeded`?2:3}function bt(e){return[...e].sort((e,t)=>{let n=yt(e)-yt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function xt(){let e=(0,G.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)(S,{className:`h-4 w-36`}),(0,Z.jsx)(S,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(S,{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(St)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(S,{className:`h-4 w-32`}),i=(0,Z.jsx)(S,{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)(S,{className:`h-12 rounded-lg`}),(0,Z.jsx)(S,{className:`h-12 rounded-lg`}),(0,Z.jsx)(S,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function St(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)(S,{className:`size-4 rounded-full`}),(0,Z.jsx)(S,{className:`h-4 w-32`}),(0,Z.jsx)(S,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(S,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(S,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(S,{className:`h-8 w-24 rounded-md`})]})},t)}function Ct(){let e=m(e=>e.language),t=p(e),n=t.automations,r=t.cron,a=M(e=>e.setPageHeader),o=M(e=>e.clearPageHeader),[s,c]=i(),S=s.get(`run`)?.trim()??``,C=s.get(`view`)===`runs`,w=s.get(`automation`)?.trim()??``,T=s.get(`draft`)?.trim()??``,O=s.get(`action`)?.trim()??``,k=s.get(`projectId`)?.trim()??``,A=s.get(`autogenerate`)===`1`,j=(0,W.useRef)(``),[N,te]=(0,W.useState)(`all`),[ne,re]=(0,W.useState)(``),[ie,P]=(0,W.useState)(!1),[ae,F]=(0,W.useState)(`blank`),[ce,le]=(0,W.useState)(null),[ue,I]=(0,W.useState)(!1),[R,z]=(0,W.useState)(Xe),[fe,B]=(0,W.useState)(null),[V,pe]=(0,W.useState)(null),[H,me]=(0,W.useState)(!1),[ge,U]=(0,W.useState)(null),[_e,be]=(0,W.useState)(``),[xe,G]=(0,W.useState)(null),[Se,Ce]=(0,W.useState)(!1),[we,K]=(0,W.useState)(!1),[Te,Ee]=(0,W.useState)(null),[De,Oe]=(0,W.useState)(!1),[ke,q]=(0,W.useState)(!1),[Ae,J]=(0,W.useState)(!1),[Y,X]=(0,W.useState)(null),je=x([`automations`,k],()=>L.list(k?{projectId:k}:void 0),{refreshInterval:15e3}),Me=x([`automation-runs`,k],()=>L.runs(50,void 0,k?{projectId:k}:void 0),{refreshInterval:1e4}),Ne=x(V?`automation-run-events:${V}`:null,()=>L.runEvents(V),{refreshInterval:5e3}),Pe=x(`automation-workflow-definitions`,de),Fe=x(`automation-browser-workflows`,()=>ve.list()),Ie=x(`automation-chat-agents`,oe),Le=je.isLoading&&!je.data||Me.isLoading&&!Me.data,Re=je.data?.automations??[],ze=(0,W.useMemo)(()=>bt(Me.data?.runs??[]),[Me.data?.runs]),Be=(0,W.useMemo)(()=>Re.filter(e=>!_t(e)),[Re]),Ve=(0,W.useMemo)(()=>Re.filter(_t),[Re]),He=(0,W.useMemo)(()=>new Set(Ve.map(e=>e.id)),[Ve]),Ue=(0,W.useMemo)(()=>ze.filter(e=>!He.has(e.automationId)),[ze,He]),We=(0,W.useMemo)(()=>ze.find(e=>e.id===V)??null,[ze,V]),Ge=(0,W.useMemo)(()=>Re.find(e=>e.id===ge)??null,[Re,ge]),Ke=(0,W.useMemo)(()=>Re.find(e=>e.id===ce)??null,[Re,ce]),Je=(0,W.useMemo)(()=>ze.filter(e=>e.automationId===ge).sort((e,t)=>t.createdAtMs-e.createdAtMs),[ze,ge]),Ye=Ne.data?.events??[],Ze=(0,W.useMemo)(()=>Be.filter(e=>mt(e,Ue)).length,[Be,Ue]),$e=ne.trim().toLocaleLowerCase(),et=(0,W.useMemo)(()=>(N===`system`?Ve:Be).filter(t=>N===`active`&&!t.enabled||N===`paused`&&t.enabled||N===`attention`&&!mt(t,Ue)?!1:$e?[t.name,vt(t),ht(t,n),qe(t.trigger,n,r,e)].some(e=>e.toLocaleLowerCase().includes($e)):!0),[r,N,n,e,$e,Ve,Be,Ue]),tt=(0,W.useMemo)(()=>Pe.data??[],[Pe.data]),nt=(0,W.useMemo)(()=>(Fe.data?.workflows??[]).filter(e=>e.enabled),[Fe.data]),rt=Ie.data?.items??[],st=(0,W.useMemo)(()=>tt.find(e=>e.id===R.workflowId.trim())??null,[R.workflowId,tt]),ct=(0,W.useMemo)(()=>nt.find(e=>e.id===R.browserWorkflowId.trim())??null,[nt,R.browserWorkflowId]),lt=R.actionMode===`workflow`&&(!R.workflowId.trim()||tt.length>0&&!tt.some(e=>e.id===R.workflowId)),ut=R.actionMode===`workflow`&&st?!he(st,R.workflowInput,R.workflowInputValid).valid:!1,dt=!!R.name.trim()&&(R.triggerMode!==`once`||Number.isFinite(new Date(R.onceAt).getTime()))&&(R.triggerMode!==`event`||!!R.eventType.trim()&&it(R.eventPayloadMatch))&&(R.actionMode===`workflow`?!lt&&!ut:R.actionMode===`browser_recipe`?ct!==null&&ye(ct,R.browserWorkflowInputs):!!R.instruction.trim())&&(R.afterRunMode!==`webhook`||!!R.webhookUrl.trim()),ft=(0,W.useMemo)(()=>[{name:n.templates.dailyAgent.name,description:n.templates.dailyAgent.description,form:{...Xe,name:n.templates.dailyAgent.name,instruction:n.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:n.templates.morningWorkflow.name,description:n.templates.morningWorkflow.description,form:{...Xe,name:n.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:tt[0]?.id??``}},{name:n.templates.webhookAgent.name,description:n.templates.webhookAgent.description,form:{...Xe,name:n.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:n.templates.blockedTask.name,description:n.templates.blockedTask.description,form:{...Xe,name:n.templates.blockedTask.formName,triggerMode:`taskBlocked`,instruction:n.templates.blockedTask.instruction}},{name:n.templates.noteCreated.name,description:n.templates.noteCreated.description,form:{...Xe,name:n.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:n.templates.noteCreated.instruction}}],[n,tt]);(0,W.useEffect)(()=>{if(et.length===0){U(null);return}ge&&et.some(e=>e.id===ge)||U(et[0].id)},[et,ge]);let pt=(0,W.useCallback)(async()=>{await Promise.all([je.mutate(),Me.mutate(),Ne.mutate()])},[je.mutate,Ne.mutate,Me.mutate]),gt=(0,W.useCallback)(e=>{if(le(null),I(!1),F(e),P(!0),e===`blank`){z(Xe);return}be(``),G(null),K(!1)},[]),yt=(0,W.useCallback)(e=>{z(at(e,tt)),le(e.id),I(!1),U(null),F(`blank`),P(!0)},[tt]),St=(0,W.useCallback)(()=>{xe&&(z(at(xe.automation,tt)),le(null),I(!0),F(`blank`))},[xe,tt]),Ct=(0,W.useCallback)(async()=>{J(!0),B(null);try{await pt()}catch(e){B(e instanceof Error?e.message:String(e))}finally{J(!1)}},[n.feedback.actionFailed,pt]);(0,W.useEffect)(()=>{S&&(pe(S),me(!0))},[S]),(0,W.useEffect)(()=>{if(!w)return;let e=Re.find(e=>e.id===w);e&&(te(_t(e)?`system`:`all`),U(e.id),c(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[w,Re,c]),(0,W.useEffect)(()=>{O===`create`&&(gt(`blank`),c(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[O,gt,c]),(0,W.useEffect)(()=>{if(!T)return;let t=`${e}:${A?`auto`:`seed`}:${T}`;j.current!==t&&(j.current=t,be(T),G(null),K(!1),F(`draft`),P(!0),c(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),A&&(B(null),Ce(!0),L.draft({prompt:T,language:e}).then(e=>{G(e.draft),K(!1)}).catch(e=>{B(e instanceof Error?e.message:String(e))}).finally(()=>{Ce(!1)})))},[A,T,e,c]);let Tt=(0,W.useCallback)(e=>{pe(e),me(!0),c(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[c]);(0,W.useEffect)(()=>{Ee(null),q(!1)},[V]);async function Et(){if(B(null),dt){if(ue&&xe){X(`draft:edit`);try{let e=Qe(R,st),{simulation:t}=await L.simulate(e);G({...xe,automation:e,simulation:t}),K(!1),I(!1),F(`draft`)}catch(e){B(e instanceof Error?e.message:String(e))}finally{X(null)}return}if(Ke){let e=Ke.id;await Ot(`automation:${e}:edit`,()=>L.update(e,ot(Ke,R,st)))&&(P(!1),le(null),U(e));return}try{let{automation:e}=await L.create({...Qe(R,st),...k?{projectId:k}:{}});z(Xe),P(!1),te(`all`),re(``),await pt(),U(e.id)}catch(e){B(e instanceof Error?e.message:String(e))}}}async function Ot(e,t){B(null),X(e);try{return await t(),await pt(),!0}catch(e){return B(e instanceof Error?e.message:String(e)),!1}finally{X(null)}}async function At(){let t=_e.trim();if(t){B(null),Ce(!0);try{G((await L.draft({prompt:t,language:e})).draft),K(!1)}catch(e){B(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}}async function jt(){if(!xe)return;let e=``;await Ot(`draft:publish`,async()=>{let{automation:t}=await L.create({...xe.automation,...k?{projectId:k}:{}});G(null),be(``),K(!1),P(!1),te(`all`),re(``),e=t.id})&&e&&U(e)}async function Mt(t){B(null),Oe(!0),Ee(null),q(!1);try{Ee((await L.repairDraft(t.id,{language:e})).repair)}catch(e){B(e instanceof Error?e.message:String(e))}finally{Oe(!1)}}async function Ft(e){Te&&await Ot(`run:${e.id}:repair`,async()=>{await L.update(e.automationId,Te.patch),Ee(null),q(!1)})}let It=(0,W.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(E,{className:`size-9 shrink-0 p-0`,loading:Ae,label:n.refresh,onClick:Ct}),(0,Z.jsxs)(f,{variant:`secondary`,onClick:()=>c(e=>{let t=new URLSearchParams(e);return C?t.delete(`view`):t.set(`view`,`runs`),t}),children:[(0,Z.jsx)(ee,{className:`size-4`}),C?n.dashboard.backToAutomations:n.dashboard.allRuns]}),(0,Z.jsxs)(f,{variant:`primary`,onClick:()=>gt(`draft`),children:[(0,Z.jsx)(l,{className:`size-4`}),n.new]})]}),[n.dashboard.allRuns,n.dashboard.backToAutomations,n.new,n.refresh,gt,Ae,Ct,C,c]);return(0,W.useLayoutEffect)(()=>(a({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:It}),()=>o()),[o,It,n.subtitle,n.title,a]),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-5 sm:px-5 xl:px-6`,children:[fe?(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:fe}):null,Le?(0,Z.jsx)(xt,{}):C?(0,Z.jsx)(kt,{runs:ze,labels:n,cronLabels:r,language:e,busyAction:Y,onSelectRun:Tt,onAction:Ot}):(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:[(0,Z.jsxs)(`label`,{className:`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`,children:[(0,Z.jsx)(se,{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:ne,onChange:e=>re(e.target.value),placeholder:n.filters.search})]}),(0,Z.jsx)(`nav`,{className:`mt-3 flex flex-wrap gap-1`,"aria-label":n.filters.status,children:[{id:`all`,label:n.filters.all},{id:`active`,label:n.filters.active},{id:`paused`,label:n.paused},{id:`attention`,label:n.dashboard.needsAttention,count:Ze},{id:`system`,label:n.system.title,count:Ve.length}].map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:d(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,N===e.id&&`bg-surface-hover text-fg`),onClick:()=>te(e.id),children:[e.label,e.count?` ${e.count}`:``]},e.id))})]}),(0,Z.jsx)(Dt,{automations:et,runs:N===`system`?ze:Ue,labels:n,cronLabels:r,language:e,selectedAutomationId:ge,onOpenDetails:U})]}),Ge?(0,Z.jsx)(Pt,{automation:Ge,runs:Je,labels:n,cronLabels:r,language:e,busyAction:Y,onEdit:yt,onSelectRun:Tt,onAction:Ot}):(0,Z.jsx)(Ht,{icon:(0,Z.jsx)(D,{className:`size-5`}),title:n.empty.filtered})]})]}),(0,Z.jsx)(b,{open:ie,onOpenChange:e=>{P(e),e||(le(null),I(!1))},children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(y,{className:`text-base font-semibold text-fg`,children:ae===`draft`?n.draft.title:Ke?n.editTitle:ue?n.draft.editTitle:n.createTitle}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(u,{className:`size-4`})})})]}),ae===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(wt,{labels:n,prompt:_e,draft:xe,loading:Se,approved:we,publishBusy:Y===`draft:publish`,templates:ft,onPromptChange:be,onGenerate:At,onEdit:St,onPublish:jt,onApprovedChange:K,onDiscard:()=>{G(null),K(!1)},onTemplateSelect:e=>{z(e),F(`blank`)},onOpenAdvanced:()=>{z(Xe),F(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ut,{form:R,labels:n,setForm:z,workflowDefinitions:tt,selectedWorkflow:st,workflowsLoading:Pe.isLoading,browserWorkflows:nt,selectedBrowserWorkflow:ct,browserWorkflowsLoading:Fe.isLoading,agentOptions:rt,agentsLoading:Ie.isLoading,language:e}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[ue?(0,Z.jsx)(f,{variant:`ghost`,onClick:()=>{I(!1),F(`draft`)},children:n.cancel}):(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,children:n.cancel})}),(0,Z.jsx)(f,{variant:`primary`,onClick:Et,disabled:!dt||Y===`draft:edit`||!!(Ke&&Y),children:Y===`draft:edit`||Ke&&Y===`automation:${Ke.id}:edit`?n.feedback.working:Ke||ue?n.save:n.create})]})]})]})]})}),(0,Z.jsx)(b,{open:H&&!!We,onOpenChange:e=>{me(e),!e&&c(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(y,{className:`truncate text-base font-semibold text-fg`,children:We?.automationName??n.dashboard.result}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(u,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(Nt,{className:`rounded-none border-0`,run:We,events:Ye,labels:n,cronLabels:r,language:e,loading:Ne.isLoading,repairDraft:Te,repairLoading:De,repairApproved:ke,busyAction:Y,onRepairApprovedChange:q,onSuggestRepair:Mt,onApplyRepair:Ft})})]})]})})]})}function wt(e){let t=(0,G.c)(58),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,templates:c,onPromptChange:l,onGenerate:u,onEdit:d,onPublish:p,onApprovedChange:m,onDiscard:h,onTemplateSelect:g,onOpenAdvanced:_}=e,v=s===void 0?!1:s,y=!!(i&&i.simulation.requiredConfirmations.length>0),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(z,{className:`size-4 text-accent`}),t[0]=b):b=t[0];let x;t[1]===n.draft.title?x=t[2]:(x=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[b,n.draft.title]}),t[1]=n.draft.title,t[2]=x);let S;t[3]===n.draft.subtitle?S=t[4]:(S=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]!==a||t[9]!==r?(w=a||!r.trim(),t[8]=a,t[9]=r,t[10]=w):w=t[10];let T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(z,{className:`size-4`}),t[11]=T):T=t[11];let E=a?n.draft.generating:n.draft.generate,ee;t[12]!==u||t[13]!==w||t[14]!==E?(ee=(0,Z.jsxs)(f,{variant:`primary`,onClick:u,disabled:w,children:[T,E]}),t[12]=u,t[13]=w,t[14]=E,t[15]=ee):ee=t[15];let D;t[16]!==C||t[17]!==ee?(D=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[C,ee]}),t[16]=C,t[17]=ee,t[18]=D):D=t[18];let k;t[19]===l?k=t[20]:(k=e=>l(e.target.value),t[19]=l,t[20]=k);let A;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==k?(A=(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:k,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=k,t[24]=A):A=t[24];let j;t[25]!==i||t[26]!==n.draft.advancedCreate||t[27]!==n.draft.suggestions||t[28]!==n.draft.suggestionsDescription||t[29]!==_||t[30]!==g||t[31]!==c?(j=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)(f,{variant:`ghost`,onClick:_,children:n.draft.advancedCreate})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:c.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:()=>g(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[25]=i,t[26]=n.draft.advancedCreate,t[27]=n.draft.suggestions,t[28]=n.draft.suggestionsDescription,t[29]=_,t[30]=g,t[31]=c,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==i||t[35]!==n.draft.approval||t[36]!==n.draft.assumptions||t[37]!==n.draft.discard||t[38]!==n.draft.edit||t[39]!==n.draft.publish||t[40]!==n.draft.review||t[41]!==n.draft.risks||t[42]!==n.draft.safety||t[43]!==n.feedback||t[44]!==n.info||t[45]!==n.none||t[46]!==m||t[47]!==h||t[48]!==d||t[49]!==p||t[50]!==v||t[51]!==y?(M=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)(Vt,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(Vt,{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)(Tt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(Tt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(Tt,{title:n.draft.risks,items:i.risks,empty:n.none}),y?(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=>m(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)(f,{variant:`ghost`,onClick:h,children:n.draft.discard}),(0,Z.jsxs)(f,{variant:`secondary`,onClick:d,children:[(0,Z.jsx)(O,{className:`size-4`}),n.draft.edit]}),(0,Z.jsx)(f,{variant:`primary`,onClick:p,disabled:v||y&&!o,children:v?n.feedback.working:n.draft.publish})]})]})]}):null,t[33]=o,t[34]=i,t[35]=n.draft.approval,t[36]=n.draft.assumptions,t[37]=n.draft.discard,t[38]=n.draft.edit,t[39]=n.draft.publish,t[40]=n.draft.review,t[41]=n.draft.risks,t[42]=n.draft.safety,t[43]=n.feedback,t[44]=n.info,t[45]=n.none,t[46]=m,t[47]=h,t[48]=d,t[49]=p,t[50]=v,t[51]=y,t[52]=M):M=t[52];let N;return t[53]!==D||t[54]!==A||t[55]!==j||t[56]!==M?(N=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[D,A,j,M]}),t[53]=D,t[54]=A,t[55]=j,t[56]=M,t[57]=N):N=t[57],N}function Tt(e){let t=(0,G.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(Et):(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 Et(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function Dt(e){let t=(0,G.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)(D,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,Z.jsx)(Ht,{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(Ot),n=t.find(ft),l=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:d(`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:d(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:mt(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})]}),(0,Z.jsx)(`div`,{className:`mt-1 truncate pl-4 text-xs text-fg-muted`,children:qe(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:`truncate`,children:e.enabled?`${i.next}: ${st(e.state.nextRunAtMs,i,o)}`:i.paused}),l?.status?(0,Z.jsx)(`span`,{className:d(`shrink-0 rounded-full px-1.5 py-0.5`,ut(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 Ot(e,t){return t.createdAtMs-e.createdAtMs}function kt(e){let t=(0,G.c)(23),{runs:n,labels:r,cronLabels:i,language:a,busyAction:o,onSelectRun:s,onAction:c}=e,l;t[0]===r.dashboard.allRuns?l=t[1]:(l=(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.dashboard.allRuns}),t[0]=r.dashboard.allRuns,t[1]=l);let u;t[2]===r.dashboard.runCenterDescription?u=t[3]:(u=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.dashboard.runCenterDescription}),t[2]=r.dashboard.runCenterDescription,t[3]=u);let p;t[4]!==l||t[5]!==u?(p=(0,Z.jsxs)(`div`,{children:[l,u]}),t[4]=l,t[5]=u,t[6]=p):p=t[6];let m;t[7]===n.length?m=t[8]:(m=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:n.length}),t[7]=n.length,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,Z.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==o||t[13]!==i||t[14]!==r||t[15]!==a||t[16]!==c||t[17]!==s||t[18]!==n?(g=n.length===0?(0,Z.jsx)(Ht,{icon:(0,Z.jsx)(ee,{className:`size-5`}),title:r.empty.runs}):(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3 hover:bg-surface-hover`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left outline-none`,onClick:()=>s(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.automationName}),(0,Z.jsx)(`span`,{className:d(`rounded-full px-2 py-0.5 text-xs`,ut(e.status)),children:r.status[e.status]}),(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:st(e.createdAtMs,r,a)})]}),(0,Z.jsx)(`p`,{className:d(`mt-1 line-clamp-2 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||(ft(e)?r.runDetail.resultPending:r.runDetail.noResult)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.manual?r.trigger.manual:qe(e.triggerSnapshot,r,i,a)})]}),ft(e)?(0,Z.jsx)(f,{variant:`ghost`,disabled:o!==null,onClick:()=>void c(`run:${e.id}:cancel`,()=>L.cancelRun(e.id),r.dashboard.cancelled),children:o===`run:${e.id}:cancel`?r.feedback.working:r.cancel}):null]},e.id))}),t[12]=o,t[13]=i,t[14]=r,t[15]=a,t[16]=c,t[17]=s,t[18]=n,t[19]=g):g=t[19];let _;return t[20]!==h||t[21]!==g?(_=(0,Z.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[h,g]}),t[20]=h,t[21]=g,t[22]=_):_=t[22],_}function At(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`after_run.started`:return n.afterRunStarted;case`after_run.completed`:return n.afterRunCompleted;case`after_run.failed`:return n.afterRunFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function jt(e){let t=(0,G.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,W.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 f=u.length,p=l.length>720||f>18,m;t[4]!==p||t[5]!==l?(m=p?`${l.split(`
|
|
3
|
+
`).slice(0,10).join(`
|
|
4
|
+
`).trimEnd()}...`:l,t[4]=p,t[5]=l,t[6]=m):m=t[6];let h=m,g;t[7]!==o||t[8]!==p||t[9]!==r||t[10]!==i?(g=p?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Mt),"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)(w,{className:d(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=p,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=o||!p?l:h,v;t[12]===_?v=t[13]:(v=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let y;return t[14]!==g||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=y):y=t[16],y}function Mt(e){return!e}function Nt(e){let t=(0,G.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:l,loading:u,repairDraft:p,repairLoading:m,repairApproved:h,busyAction:g,onRepairApprovedChange:_,onSuggestRepair:v,onApplyRepair:y}=e;if(!r){let e;t[0]===n?e=t[1]:(e=d(`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)(ee,{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 b=r.error||r.summary,x=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,C=r.sessionKey?o.runDetail.openConversation:o.runDetail.openWorkflow,T=r.sessionKey?le:k,E=ft(r)?ee:pt(r)?re:R,D;t[8]===n?D=t[9]:(D=d(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=D);let O;t[10]===r.automationName?O=t[11]:(O=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=O);let A;t[12]===r.id?A=t[13]:(A=r.id.slice(0,8),t[12]=r.id,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:A}),t[14]=A,t[15]=j);let M;t[16]!==O||t[17]!==j?(M=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[O,j]}),t[16]=O,t[17]=j,t[18]=M):M=t[18];let N;t[19]===r.status?N=t[20]:(N=d(`shrink-0 rounded-full px-2 py-0.5 text-xs`,ut(r.status)),t[19]=r.status,t[20]=N);let te=o.status[r.status],ne;t[21]!==N||t[22]!==te?(ne=(0,Z.jsx)(`span`,{className:N,children:te}),t[21]=N,t[22]=te,t[23]=ne):ne=t[23];let ie;t[24]!==M||t[25]!==ne?(ie=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[M,ne]}),t[24]=M,t[25]=ne,t[26]=ie):ie=t[26];let P;t[27]!==o||t[28]!==l||t[29]!==r.createdAtMs?(P=st(r.createdAtMs,o,l),t[27]=o,t[28]=l,t[29]=r.createdAtMs,t[30]=P):P=t[30];let ae;t[31]===P?ae=t[32]:(ae=(0,Z.jsx)(`span`,{children:P}),t[31]=P,t[32]=ae);let oe;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=oe):oe=t[33];let se=o.details.duration,ce;t[34]!==o||t[35]!==r.durationMs?(ce=dt(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=ce):ce=t[36];let ue;t[37]!==o.details.duration||t[38]!==ce?(ue=(0,Z.jsxs)(`span`,{children:[se,` `,ce]}),t[37]=o.details.duration,t[38]=ce,t[39]=ue):ue=t[39];let I;t[40]!==ae||t[41]!==ue?(I=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[ae,oe,ue]}),t[40]=ae,t[41]=ue,t[42]=I):I=t[42];let L;t[43]!==o.repair||t[44]!==v||t[45]!==m||t[46]!==r?(L=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(f,{variant:`secondary`,onClick:()=>v(r),disabled:m,children:[(0,Z.jsx)(z,{className:`size-4`}),m?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=v,t[45]=m,t[46]=r,t[47]=L):L=t[47];let de;t[48]!==I||t[49]!==L||t[50]!==ie?(de=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[ie,I,L]}),t[48]=I,t[49]=L,t[50]=ie,t[51]=de):de=t[51];let B;t[52]===r?B=t[53]:(B=ft(r)?`text-blue-500`:pt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=B);let V;t[54]===B?V=t[55]:(V=d(`size-4`,B),t[54]=B,t[55]=V);let pe;t[56]!==E||t[57]!==V?(pe=(0,Z.jsx)(E,{className:V}),t[56]=E,t[57]=V,t[58]=pe):pe=t[58];let H;t[59]!==o.runDetail.resultTitle||t[60]!==pe?(H=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[pe,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=pe,t[61]=H):H=t[61];let me;t[62]!==T||t[63]!==C||t[64]!==x?(me=x?(0,Z.jsx)(f,{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)(T,{className:`size-3.5`}),C,(0,Z.jsx)(fe,{className:`size-3.5`})]})}):null,t[62]=T,t[63]=C,t[64]=x,t[65]=me):me=t[65];let he;t[66]!==H||t[67]!==me?(he=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[H,me]}),t[66]=H,t[67]=me,t[68]=he):he=t[68];let ge=r.error&&`border-red-500/25 bg-red-500/5`,U;t[69]===ge?U=t[70]:(U=d(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,ge),t[69]=ge,t[70]=U);let _e;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==b||t[74]!==r?(_e=b?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:b}):(0,Z.jsx)(c,{content:b,compact:!0,className:`text-sm`,openHttpLinksInNewTab:!0}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:ft(r)?o.runDetail.resultPending:o.runDetail.noResult}),t[71]=o.runDetail.noResult,t[72]=o.runDetail.resultPending,t[73]=b,t[74]=r,t[75]=_e):_e=t[75];let ve;t[76]!==U||t[77]!==_e?(ve=(0,Z.jsx)(`div`,{className:U,children:_e}),t[76]=U,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==he||t[80]!==ve?(ye=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[he,ve]}),t[79]=he,t[80]=ve,t[81]=ye):ye=t[81];let be;t[82]===o.runDetail.runInfo?be=t[83]:(be=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=be);let xe;t[84]!==s||t[85]!==o||t[86]!==l||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(xe=r.manual?o.trigger.manual:qe(r.triggerSnapshot,o,s,l),t[84]=s,t[85]=o,t[86]=l,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=xe):xe=t[89];let W;t[90]!==o.explain.whyRan||t[91]!==xe?(W=(0,Z.jsx)(zt,{label:o.explain.whyRan,value:xe}),t[90]=o.explain.whyRan,t[91]=xe,t[92]=W):W=t[92];let Se=o.details.started,Ce;t[93]!==o||t[94]!==l||t[95]!==r.startedAtMs?(Ce=st(r.startedAtMs,o,l),t[93]=o,t[94]=l,t[95]=r.startedAtMs,t[96]=Ce):Ce=t[96];let we;t[97]!==o.details.started||t[98]!==Ce?(we=(0,Z.jsx)(zt,{label:Se,value:Ce}),t[97]=o.details.started,t[98]=Ce,t[99]=we):we=t[99];let K;t[100]!==o.details.model||t[101]!==r.model?(K=r.model?(0,Z.jsx)(zt,{label:o.details.model,value:r.model}):null,t[100]=o.details.model,t[101]=r.model,t[102]=K):K=t[102];let Te;t[103]!==W||t[104]!==we||t[105]!==K?(Te=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[W,we,K]}),t[103]=W,t[104]=we,t[105]=K,t[106]=Te):Te=t[106];let Ee;t[107]!==be||t[108]!==Te?(Ee=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[be,Te]}),t[107]=be,t[108]=Te,t[109]=Ee):Ee=t[109];let De;t[110]!==g||t[111]!==o||t[112]!==y||t[113]!==_||t[114]!==h||t[115]!==p||t[116]!==r?(De=p?(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:p.explanation}),p.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:p.expectedEffect}):null,(0,Z.jsx)(Tt,{title:o.repair.risks,items:p.risks,empty:o.none}),(0,Z.jsx)(jt,{value:p.patch,labels:o,title:o.details.repairPatch}),p.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:h,onChange:e=>_(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)(f,{variant:`primary`,onClick:()=>y(r),disabled:g===`run:${r.id}:repair`||p.requiresApproval&&!h,children:g===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=g,t[111]=o,t[112]=y,t[113]=_,t[114]=h,t[115]=p,t[116]=r,t[117]=De):De=t[117];let Oe;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(F,{className:`size-4 shrink-0`}),t[118]=Oe):Oe=t[118];let ke;t[119]===o.runDetail.technicalEvents?ke=t[120]:(ke=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[Oe,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=ke);let q;t[121]!==i.length||t[122]!==o.runDetail.eventCount?(q=o.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=o.runDetail.eventCount,t[123]=q):q=t[123];let Ae;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(w,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=Ae):Ae=t[124];let J;t[125]===q?J=t[126]:(J=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[q,Ae]}),t[125]=q,t[126]=J);let Y;t[127]!==ke||t[128]!==J?(Y=(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:[ke,J]}),t[127]=ke,t[128]=J,t[129]=Y):Y=t[129];let X;t[130]===o.runDetail.technicalEventsDescription?X=t[131]:(X=(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]=X);let je;t[132]!==i||t[133]!==o||t[134]!==l||t[135]!==u?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:u?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":o.loading,children:[(0,Z.jsx)(S,{className:`h-10 w-full`}),(0,Z.jsx)(S,{className:`h-10 w-4/5`}),(0,Z.jsx)(S,{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:d(`mt-1 size-2 rounded-full`,Bt(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:At(e,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[st(e.createdAtMs,o,l),` · `,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)(w,{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]=l,t[135]=u,t[136]=je):je=t[136];let Me;t[137]!==Y||t[138]!==X||t[139]!==je?(Me=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[Y,X,je]}),t[137]=Y,t[138]=X,t[139]=je,t[140]=Me):Me=t[140];let Ne;return t[141]!==D||t[142]!==de||t[143]!==ye||t[144]!==Ee||t[145]!==De||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:D,children:[de,ye,Ee,De,Me]}),t[141]=D,t[142]=de,t[143]=ye,t[144]=Ee,t[145]=De,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Pt(e){let t=(0,G.c)(82),{automation:n,runs:r,labels:i,cronLabels:a,language:o,busyAction:s,onEdit:l,onSelectRun:u,onAction:p}=e,m=s===`automation:${n.id}:run`,h=s===`automation:${n.id}:toggle`,g=s===`automation:${n.id}:delete`,_;t[0]===n?_=t[1]:(_=_t(n),t[0]=n,t[1]=_);let v=_,y;t[2]===n.name?y=t[3]:(y=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=y);let b=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,x;t[4]===b?x=t[5]:(x=d(`shrink-0 rounded-full px-2 py-0.5 text-xs`,b),t[4]=b,t[5]=x);let S=n.enabled?i.enabled:i.paused,C;t[6]!==x||t[7]!==S?(C=(0,Z.jsx)(`span`,{className:x,children:S}),t[6]=x,t[7]=S,t[8]=C):C=t[8];let w;t[9]!==y||t[10]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[y,C]}),t[9]=y,t[10]=C,t[11]=w):w=t[11];let T;t[12]===n?T=t[13]:(T=vt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:vt(n)}):null,t[12]=n,t[13]=T);let E;t[14]!==w||t[15]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[w,T]}),t[14]=w,t[15]=T,t[16]=E):E=t[16];let D;t[17]!==n||t[18]!==s||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]!==p||t[30]!==l||t[31]!==v||t[32]!==m||t[33]!==h?(D=v?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(f,{variant:`secondary`,disabled:s!==null,onClick:()=>void p(`automation:${n.id}:toggle`,()=>n.enabled?L.pause(n.id):L.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[h?(0,Z.jsx)(A,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(I,{className:`size-4`}):(0,Z.jsx)(N,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(f,{variant:`primary`,disabled:s!==null,onClick:()=>void p(`automation:${n.id}:run`,()=>L.runNow(n.id),i.feedback.rerunQueued),children:[m?(0,Z.jsx)(A,{className:`size-4 animate-spin`}):(0,Z.jsx)(N,{className:`size-4`}),i.dashboard.runNow]}),(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(ae,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,className:`size-9 p-0`,"aria-label":i.details.moreActions,children:(0,Z.jsx)(te,{className:`size-4`})})}),(0,Z.jsx)(ue,{children:(0,Z.jsxs)(ie,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(P,{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)(O,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(P,{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:s!==null,onSelect:()=>void p(`automation:${n.id}:delete`,()=>L.remove(n.id),i.dashboard.deleted),children:[g?(0,Z.jsx)(A,{className:`size-4 animate-spin`}):(0,Z.jsx)(ne,{className:`size-4`}),i.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=s,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]=p,t[30]=l,t[31]=v,t[32]=m,t[33]=h,t[34]=D):D=t[34];let k;t[35]!==D||t[36]!==E?(k=(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[E,D]}),t[35]=D,t[36]=E,t[37]=k):k=t[37];let j;t[38]===i.info.task?j=t[39]:(j=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.info.task}),t[38]=i.info.task,t[39]=j);let M;t[40]!==n||t[41]!==i?(M=ht(n,i),t[40]=n,t[41]=i,t[42]=M):M=t[42];let re;t[43]===M?re=t[44]:(re=(0,Z.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsx)(c,{content:M,compact:!0,openHttpLinksInNewTab:!0})}),t[43]=M,t[44]=re);let oe;t[45]!==j||t[46]!==re?(oe=(0,Z.jsxs)(`section`,{children:[j,re]}),t[45]=j,t[46]=re,t[47]=oe):oe=t[47];let se;t[48]!==n||t[49]!==a||t[50]!==i||t[51]!==o?(se=(0,Z.jsx)(It,{automation:n,labels:i,cronLabels:a,language:o}),t[48]=n,t[49]=a,t[50]=i,t[51]=o,t[52]=se):se=t[52];let F;t[53]===i.dashboard.runHistory?F=t[54]:(F=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),t[53]=i.dashboard.runHistory,t[54]=F);let le;t[55]===i.dashboard.runHistoryDescription?le=t[56]:(le=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription}),t[55]=i.dashboard.runHistoryDescription,t[56]=le);let de;t[57]!==F||t[58]!==le?(de=(0,Z.jsxs)(`div`,{children:[F,le]}),t[57]=F,t[58]=le,t[59]=de):de=t[59];let z;t[60]===r.length?z=t[61]:(z=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[60]=r.length,t[61]=z);let fe;t[62]!==de||t[63]!==z?(fe=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[de,z]}),t[62]=de,t[63]=z,t[64]=fe):fe=t[64];let B;t[65]!==i||t[66]!==o||t[67]!==u||t[68]!==r?(B=r.length===0?(0,Z.jsx)(Ht,{icon:(0,Z.jsx)(ee,{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)(R,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(ee,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:st(e.createdAtMs,i,o)})]}),(0,Z.jsx)(`span`,{className:d(`shrink-0 rounded-full px-2 py-0.5 text-xs`,ut(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:d(`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||ct(e.actionSnapshot,i)})]},e.id))}),t[65]=i,t[66]=o,t[67]=u,t[68]=r,t[69]=B):B=t[69];let V;t[70]!==fe||t[71]!==B?(V=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[fe,B]}),t[70]=fe,t[71]=B,t[72]=V):V=t[72];let pe;t[73]!==se||t[74]!==V?(pe=(0,Z.jsxs)(`div`,{className:`grid items-start gap-5 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[se,V]}),t[73]=se,t[74]=V,t[75]=pe):pe=t[75];let H;t[76]!==oe||t[77]!==pe?(H=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[oe,pe]}),t[76]=oe,t[77]=pe,t[78]=H):H=t[78];let me;return t[79]!==k||t[80]!==H?(me=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[k,H]}),t[79]=k,t[80]=H,t[81]=me):me=t[81],me}function Ft(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function It(e){let t=(0,G.c)(127),{automation:n,labels:r,cronLabels:i,language:a}=e,o,s,c,l,u,d,f,p,m,h,g;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=lt(n),_;t[15]!==n||t[16]!==r||t[17]!==a?(_=Je(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=_):_=t[18];let v=_,y;t[19]!==n.state.nextRunAtMs||t[20]!==a?(y=n.state.nextRunAtMs?Ue(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=y):y=t[21];let b=y;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(g=[],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],g.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],g.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=Ue(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],g.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],g.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],g.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],g.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],g.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],g.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],g.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]=g}else g=t[39];m=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?h=t[71]:(h=(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=h),d=`grid gap-4 p-4`;let x;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(j,{className:`size-4`,"aria-hidden":!0}),t[72]=x):x=t[72];let S=r.info.schedule,C;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(C=qe(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=C):C=t[77];let w=n.enabled?`${r.info.nextRun}:${v}`:v;t[78]!==r.info.schedule||t[79]!==b||t[80]!==C||t[81]!==w?(f=(0,Z.jsx)(Rt,{icon:x,label:S,value:C,description:w,descriptionTitle:b}),t[78]=r.info.schedule,t[79]=b,t[80]=C,t[81]=w,t[82]=f):f=t[82];let E;t[83]===n.action.kind?E=t[84]:(E=n.action.kind===`workflow`?(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_recipe`?(0,Z.jsx)(F,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=E);let ee=r.info.action,O;t[85]!==n.action||t[86]!==r?(O=ct(n.action,r),t[85]=n.action,t[86]=r,t[87]=O):O=t[87],t[88]!==r.info.action||t[89]!==E||t[90]!==O?(p=(0,Z.jsx)(Rt,{icon:E,label:ee,value:O}),t[88]=r.info.action,t[89]=E,t[90]=O,t[91]=p):p=t[91],o=Rt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[92]=s):s=t[92],c=r.info.permission,l=r.safety[e],u=Ft(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;t[93]!==o||t[94]!==s||t[95]!==c||t[96]!==l||t[97]!==u?(_=(0,Z.jsx)(o,{icon:s,label:c,value:l,description:u}),t[93]=o,t[94]=s,t[95]=c,t[96]=l,t[97]=u,t[98]=_):_=t[98];let v;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[99]=v):v=t[99];let y=r.info.lastRun,b;t[100]!==n||t[101]!==r||t[102]!==a?(b=Ye(n,r,a),t[100]=n,t[101]=r,t[102]=a,t[103]=b):b=t[103];let x=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,S;t[104]!==r.info.lastRun||t[105]!==b||t[106]!==x?(S=(0,Z.jsx)(Rt,{icon:v,label:y,value:b,valueTone:x}),t[104]=r.info.lastRun,t[105]=b,t[106]=x,t[107]=S):S=t[107];let C;t[108]!==n.state.consecutiveFailures||t[109]!==n.state.lastError||t[110]!==r.dashboard?(C=n.state.consecutiveFailures?(0,Z.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[108]=n.state.consecutiveFailures,t[109]=n.state.lastError,t[110]=r.dashboard,t[111]=C):C=t[111];let E;t[112]!==r.info.technicalDetails||t[113]!==g?(E=g.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)(w,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:g.map(Lt)})]}):null,t[112]=r.info.technicalDetails,t[113]=g,t[114]=E):E=t[114];let O;t[115]!==_||t[116]!==S||t[117]!==C||t[118]!==E||t[119]!==d||t[120]!==f||t[121]!==p?(O=(0,Z.jsxs)(`div`,{className:d,children:[f,p,_,S,C,E]}),t[115]=_,t[116]=S,t[117]=C,t[118]=E,t[119]=d,t[120]=f,t[121]=p,t[122]=O):O=t[122];let A;return t[123]!==O||t[124]!==m||t[125]!==h?(A=(0,Z.jsxs)(`aside`,{className:m,children:[h,O]}),t[123]=O,t[124]=m,t[125]=h,t[126]=A):A=t[126],A}function Lt(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 Rt(e){let t=(0,G.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 f=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,p;t[4]===f?p=t[5]:(p=d(`mt-1 text-sm font-medium leading-5`,f),t[4]=f,t[5]=p);let m;t[6]!==p||t[7]!==i?(m=(0,Z.jsx)(`div`,{className:p,children:i}),t[6]=p,t[7]=i,t[8]=m):m=t[8];let h;t[9]!==a||t[10]!==o?(h=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=h):h=t[11];let g;t[12]!==u||t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,m,h]}),t[12]=u,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==l||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,g]}),t[16]=l,t[17]=g,t[18]=_):_=t[18],_}function zt(e){let t=(0,G.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 Bt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Vt(e){let t=(0,G.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 Ht(e){let t=(0,G.c)(5),{icon:n,title:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge-subtle bg-surface-base text-fg-muted shadow-surface`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Ut(e){let t=(0,G.c)(250),{form:n,labels:r,setForm:i,workflowDefinitions:a,selectedWorkflow:c,workflowsLoading:l,browserWorkflows:u,selectedBrowserWorkflow:f,browserWorkflowsLoading:m,agentOptions:h,agentsLoading:g,language:_}=e,v=p(_).agentsSettings,y;t[0]===i?y=t[1]:(y=e=>i(t=>({...t,...e})),t[0]=i,t[1]=y);let b=y,x=ze(n.intervalValue,n.intervalUnit),S=Date.now(),T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=[1,2,3],t[2]=T):T=t[2];let E;t[3]!==x||t[4]!==S||t[5]!==_?(E=T.map(e=>Ge(S+x*e,_,S)),t[3]=x,t[4]=S,t[5]=_,t[6]=E):E=t[6];let ee=E,D,O;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==a?(D=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=a[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},O=[n.actionMode,n.workflowId,i,a],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=a,t[11]=D,t[12]=O):(D=t[11],O=t[12]),(0,W.useEffect)(D,O);let k,A;t[13]!==u||t[14]!==n.actionMode||t[15]!==n.browserWorkflowId||t[16]!==i?(k=()=>{if(n.actionMode!==`browser_recipe`||n.browserWorkflowId.trim())return;let e=u[0];e&&i(t=>({...t,browserWorkflowId:e.id,browserWorkflowInputs:be(e)}))},A=[u,n.actionMode,n.browserWorkflowId,i],t[13]=u,t[14]=n.actionMode,t[15]=n.browserWorkflowId,t[16]=i,t[17]=k,t[18]=A):(k=t[17],A=t[18]),(0,W.useEffect)(k,A);let j;t[19]===b?j=t[20]:(j=e=>b({name:e.target.value}),t[19]=b,t[20]=j);let M;t[21]!==n.name||t[22]!==j?(M=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:j}),t[21]=n.name,t[22]=j,t[23]=M):M=t[23];let N;t[24]!==r.form.name||t[25]!==M?(N=(0,Z.jsx)($,{label:r.form.name,children:M}),t[24]=r.form.name,t[25]=M,t[26]=N):N=t[26];let te;t[27]===b?te=t[28]:(te=e=>b({description:e.target.value}),t[27]=b,t[28]=te);let ne;t[29]!==n.description||t[30]!==te?(ne=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:te}),t[29]=n.description,t[30]=te,t[31]=ne):ne=t[31];let re;t[32]!==r.form.description||t[33]!==ne?(re=(0,Z.jsx)($,{label:r.form.description,children:ne}),t[32]=r.form.description,t[33]=ne,t[34]=re):re=t[34];let ie;t[35]===r.form.trigger?ie=t[36]:(ie=(0,Z.jsx)(Kt,{title:r.form.trigger}),t[35]=r.form.trigger,t[36]=ie);let P;t[37]===b?P=t[38]:(P=e=>b({triggerMode:e.target.value}),t[37]=b,t[38]=P);let ae;t[39]===r.trigger.manual?ae=t[40]:(ae=(0,Z.jsx)(s,{value:`manual`,children:r.trigger.manual}),t[39]=r.trigger.manual,t[40]=ae);let oe;t[41]===r.trigger.once?oe=t[42]:(oe=(0,Z.jsx)(s,{value:`once`,children:r.trigger.once}),t[41]=r.trigger.once,t[42]=oe);let se;t[43]===r.trigger.daily?se=t[44]:(se=(0,Z.jsx)(s,{value:`daily`,children:r.trigger.daily}),t[43]=r.trigger.daily,t[44]=se);let F;t[45]===r.trigger.weekly?F=t[46]:(F=(0,Z.jsx)(s,{value:`weekly`,children:r.trigger.weekly}),t[45]=r.trigger.weekly,t[46]=F);let ce;t[47]===r.trigger.interval?ce=t[48]:(ce=(0,Z.jsx)(s,{value:`interval`,children:r.trigger.interval}),t[47]=r.trigger.interval,t[48]=ce);let le;t[49]===r.trigger.customCron?le=t[50]:(le=(0,Z.jsx)(s,{value:`cron`,children:r.trigger.customCron}),t[49]=r.trigger.customCron,t[50]=le);let ue;t[51]===r.trigger.webhook?ue=t[52]:(ue=(0,Z.jsx)(s,{value:`webhook`,children:r.trigger.webhook}),t[51]=r.trigger.webhook,t[52]=ue);let I;t[53]===r.trigger.taskBlocked?I=t[54]:(I=(0,Z.jsx)(s,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[53]=r.trigger.taskBlocked,t[54]=I);let L;t[55]===r.trigger.noteCreated?L=t[56]:(L=(0,Z.jsx)(s,{value:`noteCreated`,children:r.trigger.noteCreated}),t[55]=r.trigger.noteCreated,t[56]=L);let de;t[57]===r.trigger.workflowFailed?de=t[58]:(de=(0,Z.jsx)(s,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[57]=r.trigger.workflowFailed,t[58]=de);let R;t[59]===r.trigger.sessionUpdated?R=t[60]:(R=(0,Z.jsx)(s,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[59]=r.trigger.sessionUpdated,t[60]=R);let z;t[61]===r.trigger.customEvent?z=t[62]:(z=(0,Z.jsx)(s,{value:`event`,children:r.trigger.customEvent}),t[61]=r.trigger.customEvent,t[62]=z);let fe;t[63]!==n.triggerMode||t[64]!==P||t[65]!==ae||t[66]!==oe||t[67]!==se||t[68]!==F||t[69]!==ce||t[70]!==le||t[71]!==ue||t[72]!==I||t[73]!==L||t[74]!==de||t[75]!==R||t[76]!==z?(fe=(0,Z.jsxs)(o,{className:Q,value:n.triggerMode,onChange:P,children:[ae,oe,se,F,ce,le,ue,I,L,de,R,z]}),t[63]=n.triggerMode,t[64]=P,t[65]=ae,t[66]=oe,t[67]=se,t[68]=F,t[69]=ce,t[70]=le,t[71]=ue,t[72]=I,t[73]=L,t[74]=de,t[75]=R,t[76]=z,t[77]=fe):fe=t[77];let B;t[78]!==n.onceAt||t[79]!==n.triggerMode||t[80]!==r.form.onceAt||t[81]!==b?(B=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=>b({onceAt:e.target.value})})}):null,t[78]=n.onceAt,t[79]=n.triggerMode,t[80]=r.form.onceAt,t[81]=b,t[82]=B):B=t[82];let V;t[83]!==n.time||t[84]!==n.triggerMode||t[85]!==n.weekday||t[86]!==r.form.day||t[87]!==r.form.time||t[88]!==r.weekdays||t[89]!==b?(V=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)(pe,{value:n.time,onChange:e=>b({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(o,{className:Q,value:n.weekday,onChange:e=>b({weekday:e.target.value}),children:[(0,Z.jsx)(s,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(s,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(s,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(s,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(s,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(s,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(s,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[83]=n.time,t[84]=n.triggerMode,t[85]=n.weekday,t[86]=r.form.day,t[87]=r.form.time,t[88]=r.weekdays,t[89]=b,t[90]=V):V=t[90];let H=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/ze(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>b({intervalValue:e.target.value})}),(0,Z.jsxs)(o,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;b({intervalValue:Be(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(s,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(s,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(s,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(s,{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:Ze.map(e=>{let t=ze(e.value,e.unit),n=t===x;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:d(`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:()=>b({intervalValue:e.value,intervalUnit:e.unit}),children:Ve(t,_)},`${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:He(x,_)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,ee.join(_===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,he;t[91]!==n.cronExpr||t[92]!==n.triggerMode||t[93]!==r.form.expression||t[94]!==b?(he=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>b({cronExpr:e.target.value})})}):null,t[91]=n.cronExpr,t[92]=n.triggerMode,t[93]=r.form.expression,t[94]=b,t[95]=he):he=t[95];let ge;t[96]!==n.triggerMode||t[97]!==n.webhookSecretId||t[98]!==r.form.secretId||t[99]!==b?(ge=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>b({webhookSecretId:e.target.value})})}):null,t[96]=n.triggerMode,t[97]=n.webhookSecretId,t[98]=r.form.secretId,t[99]=b,t[100]=ge):ge=t[100];let U;t[101]!==n.eventPayloadMatch||t[102]!==n.eventSource||t[103]!==n.eventType||t[104]!==n.triggerMode||t[105]!==r.form.eventPayloadMatch||t[106]!==r.form.eventSource||t[107]!==r.form.eventType||t[108]!==r.form.invalidJsonObject||t[109]!==b?(U=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=>b({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>b({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:d(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>b({eventPayloadMatch:e.target.value}),placeholder:`{
|
|
5
|
+
"status": "blocked"
|
|
6
|
+
}`}),it(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[101]=n.eventPayloadMatch,t[102]=n.eventSource,t[103]=n.eventType,t[104]=n.triggerMode,t[105]=r.form.eventPayloadMatch,t[106]=r.form.eventSource,t[107]=r.form.eventType,t[108]=r.form.invalidJsonObject,t[109]=b,t[110]=U):U=t[110];let ve;t[111]===r.form.action?ve=t[112]:(ve=(0,Z.jsx)(Kt,{title:r.form.action}),t[111]=r.form.action,t[112]=ve);let ye;t[113]!==n.timeoutSeconds||t[114]!==n.workflowId||t[115]!==b||t[116]!==a?(ye=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);b({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_recipe`?`600`:`1800`}:{},...t===`browser_recipe`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&a[0]?{workflowId:a[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[113]=n.timeoutSeconds,t[114]=n.workflowId,t[115]=b,t[116]=a,t[117]=ye):ye=t[117];let Se;t[118]===r.action.runAgent?Se=t[119]:(Se=(0,Z.jsx)(s,{value:`agent`,children:r.action.runAgent}),t[118]=r.action.runAgent,t[119]=Se);let Ce;t[120]===r.action.runWorkflow?Ce=t[121]:(Ce=(0,Z.jsx)(s,{value:`workflow`,children:r.action.runWorkflow}),t[120]=r.action.runWorkflow,t[121]=Ce);let we=_===`zh`?`浏览器自动化`:`Browser automation`,K;t[122]===we?K=t[123]:(K=(0,Z.jsx)(s,{value:`browser_recipe`,children:we}),t[122]=we,t[123]=K);let Te;t[124]!==n.actionMode||t[125]!==ye||t[126]!==Se||t[127]!==Ce||t[128]!==K?(Te=(0,Z.jsxs)(o,{className:Q,value:n.actionMode,onChange:ye,children:[Se,Ce,K]}),t[124]=n.actionMode,t[125]=ye,t[126]=Se,t[127]=Ce,t[128]=K,t[129]=Te):Te=t[129];let Ee=n.actionMode===`browser_recipe`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(o,{className:Q,value:n.agentId,onChange:e=>b({agentId:e.target.value}),children:[(0,Z.jsx)(s,{value:``,children:g?r.form.loadingAgents:r.form.defaultAgent}),h.map(e=>(0,Z.jsx)(s,{value:e.id,children:C(e,v)},e.id))]})}),De;t[130]!==u||t[131]!==m||t[132]!==n.actionMode||t[133]!==n.agentId||t[134]!==n.browserWorkflowId||t[135]!==n.browserWorkflowInputs||t[136]!==n.description||t[137]!==n.instruction||t[138]!==n.name||t[139]!==n.triggerMode||t[140]!==n.workflowId||t[141]!==n.workflowInput||t[142]!==r.form.instruction||t[143]!==r.form.loadingWorkflows||t[144]!==r.form.noWorkflows||t[145]!==r.form.triggeredRun||t[146]!==r.form.workflow||t[147]!==_||t[148]!==f||t[149]!==c||t[150]!==b||t[151]!==a||t[152]!==l?(De=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(me,{value:n.instruction,onApply:e=>b({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:_,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:d(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>b({instruction:e.target.value})})]}):n.actionMode===`workflow`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(o,{className:Q,value:n.workflowId,onChange:e=>b({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:l||a.length===0,children:[l?(0,Z.jsx)(s,{value:``,children:r.form.loadingWorkflows}):null,!l&&a.length===0?(0,Z.jsx)(s,{value:``,children:r.form.noWorkflows}):null,a.map(Gt)]})}),c?(0,Z.jsx)(_e,{definition:c,language:_,value:n.workflowInput,onChange:e=>b({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>b({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:c.id,workflowTitle:c.title,workflowDescription:c.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:_===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(o,{className:Q,value:n.browserWorkflowId,onChange:e=>{let t=u.find(t=>t.id===e.target.value);b({browserWorkflowId:e.target.value,browserWorkflowInputs:t?be(t):{}})},disabled:m||u.length===0,children:[u.length===0?(0,Z.jsx)(s,{value:``,children:_===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,u.map(Wt)]})}),f&&Object.keys(f.inputs).length>0?(0,Z.jsx)($,{label:_===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(xe,{workflow:f,values:n.browserWorkflowInputs,language:_,onChange:e=>b({browserWorkflowInputs:e})})}):null]}),t[130]=u,t[131]=m,t[132]=n.actionMode,t[133]=n.agentId,t[134]=n.browserWorkflowId,t[135]=n.browserWorkflowInputs,t[136]=n.description,t[137]=n.instruction,t[138]=n.name,t[139]=n.triggerMode,t[140]=n.workflowId,t[141]=n.workflowInput,t[142]=r.form.instruction,t[143]=r.form.loadingWorkflows,t[144]=r.form.noWorkflows,t[145]=r.form.triggeredRun,t[146]=r.form.workflow,t[147]=_,t[148]=f,t[149]=c,t[150]=b,t[151]=a,t[152]=l,t[153]=De):De=t[153];let Oe;t[154]===r.form.advancedDescription?Oe=t[155]:(Oe=(0,Z.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[154]=r.form.advancedDescription,t[155]=Oe);let ke;t[156]!==r.form.advanced||t[157]!==Oe?(ke=(0,Z.jsxs)(`span`,{children:[r.form.advanced,Oe]}),t[156]=r.form.advanced,t[157]=Oe,t[158]=ke):ke=t[158];let q;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(w,{className:`size-4 transition-transform group-open:rotate-180`}),t[159]=q):q=t[159];let Ae;t[160]===ke?Ae=t[161]:(Ae=(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:[ke,q]}),t[160]=ke,t[161]=Ae);let J;t[162]!==n.actionMode||t[163]!==n.afterRunMode||t[164]!==n.safetyMode||t[165]!==r.form.safety||t[166]!==r.safety||t[167]!==b?(J=n.actionMode===`browser_recipe`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Kt,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(o,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;b({safetyMode:t,...t!==`auto_apply`&&n.afterRunMode===`webhook`?{afterRunMode:`none`,webhookUrl:``}:{}})},children:[(0,Z.jsx)(s,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(s,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(s,{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[162]=n.actionMode,t[163]=n.afterRunMode,t[164]=n.safetyMode,t[165]=r.form.safety,t[166]=r.safety,t[167]=b,t[168]=J):J=t[168];let Y;t[169]===r.form.afterRun?Y=t[170]:(Y=(0,Z.jsx)(Kt,{title:r.form.afterRun}),t[169]=r.form.afterRun,t[170]=Y);let X;t[171]===b?X=t[172]:(X=e=>b({afterRunMode:e.target.value}),t[171]=b,t[172]=X);let je;t[173]===r.afterRun.none?je=t[174]:(je=(0,Z.jsx)(s,{value:`none`,children:r.afterRun.none}),t[173]=r.afterRun.none,t[174]=je);let Me;t[175]===r.afterRun.saveToSession?Me=t[176]:(Me=(0,Z.jsx)(s,{value:`saveToSession`,children:r.afterRun.saveToSession}),t[175]=r.afterRun.saveToSession,t[176]=Me);let Ne=n.safetyMode!==`auto_apply`,Pe;t[177]!==r.afterRun.webhook||t[178]!==Ne?(Pe=(0,Z.jsx)(s,{value:`webhook`,disabled:Ne,children:r.afterRun.webhook}),t[177]=r.afterRun.webhook,t[178]=Ne,t[179]=Pe):Pe=t[179];let Fe;t[180]!==n.afterRunMode||t[181]!==X||t[182]!==je||t[183]!==Me||t[184]!==Pe?(Fe=(0,Z.jsxs)(o,{className:Q,value:n.afterRunMode,onChange:X,children:[je,Me,Pe]}),t[180]=n.afterRunMode,t[181]=X,t[182]=je,t[183]=Me,t[184]=Pe,t[185]=Fe):Fe=t[185];let Ie;t[186]!==n.afterRunMode||t[187]!==n.webhookUrl||t[188]!==r.form.webhookUrl||t[189]!==b?(Ie=n.afterRunMode===`webhook`?(0,Z.jsx)($,{label:r.form.webhookUrl,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookUrl,onChange:e=>b({webhookUrl:e.target.value})})}):null,t[186]=n.afterRunMode,t[187]=n.webhookUrl,t[188]=r.form.webhookUrl,t[189]=b,t[190]=Ie):Ie=t[190];let Le;t[191]===r.form.reliability?Le=t[192]:(Le=(0,Z.jsx)(Kt,{title:r.form.reliability}),t[191]=r.form.reliability,t[192]=Le);let Re;t[193]===b?Re=t[194]:(Re=e=>b({timeoutSeconds:e.target.value}),t[193]=b,t[194]=Re);let Ue;t[195]!==n.timeoutSeconds||t[196]!==Re?(Ue=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:Re}),t[195]=n.timeoutSeconds,t[196]=Re,t[197]=Ue):Ue=t[197];let We;t[198]!==r.form.timeoutSeconds||t[199]!==Ue?(We=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:Ue}),t[198]=r.form.timeoutSeconds,t[199]=Ue,t[200]=We):We=t[200];let Ke;t[201]===b?Ke=t[202]:(Ke=e=>b({disableAfterFailures:e.target.value}),t[201]=b,t[202]=Ke);let qe;t[203]!==n.disableAfterFailures||t[204]!==Ke?(qe=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:Ke}),t[203]=n.disableAfterFailures,t[204]=Ke,t[205]=qe):qe=t[205];let Je;t[206]!==r.form.disableAfterFailures||t[207]!==qe?(Je=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:qe}),t[206]=r.form.disableAfterFailures,t[207]=qe,t[208]=Je):Je=t[208];let Ye;t[209]!==We||t[210]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[We,Je]}),t[209]=We,t[210]=Je,t[211]=Ye):Ye=t[211];let Xe;t[212]===r.form.effectivePolicy?Xe=t[213]:(Xe=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[212]=r.form.effectivePolicy,t[213]=Xe);let Qe=n.timeoutSeconds||`—`,$e;t[214]!==r.form.executionDeadline||t[215]!==Qe?($e=(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,Qe,`s`]}),t[214]=r.form.executionDeadline,t[215]=Qe,t[216]=$e):$e=t[216];let et;t[217]===r.form.downstreamTimeoutHint?et=t[218]:(et=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[217]=r.form.downstreamTimeoutHint,t[218]=et);let tt;t[219]!==Xe||t[220]!==$e||t[221]!==et?(tt=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-muted/40 px-3 py-2.5`,children:[Xe,$e,et]}),t[219]=Xe,t[220]=$e,t[221]=et,t[222]=tt):tt=t[222];let nt;t[223]!==J||t[224]!==Y||t[225]!==Fe||t[226]!==Ie||t[227]!==Le||t[228]!==Ye||t[229]!==tt?(nt=(0,Z.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[J,Y,Fe,Ie,Le,Ye,tt]}),t[223]=J,t[224]=Y,t[225]=Fe,t[226]=Ie,t[227]=Le,t[228]=Ye,t[229]=tt,t[230]=nt):nt=t[230];let rt;t[231]!==Ae||t[232]!==nt?(rt=(0,Z.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[Ae,nt]}),t[231]=Ae,t[232]=nt,t[233]=rt):rt=t[233];let at;return t[234]!==N||t[235]!==re||t[236]!==ie||t[237]!==fe||t[238]!==B||t[239]!==V||t[240]!==H||t[241]!==he||t[242]!==ge||t[243]!==U||t[244]!==ve||t[245]!==Te||t[246]!==Ee||t[247]!==De||t[248]!==rt?(at=(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:[N,re,ie,fe,B,V,H,he,ge,U,ve,Te,Ee,De,rt]})}),t[234]=N,t[235]=re,t[236]=ie,t[237]=fe,t[238]=B,t[239]=V,t[240]=H,t[241]=he,t[242]=ge,t[243]=U,t[244]=ve,t[245]=Te,t[246]=Ee,t[247]=De,t[248]=rt,t[249]=at):at=t[249],at}function Wt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function Gt(e){return(0,Z.jsx)(s,{value:e.id,children:e.title||e.name},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,G.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 Kt(e){let t=(0,G.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(k,{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{Ct as AutomationsPage};
|
package/dist/gateway/static/root/assets/{binary-plugins-DGIF2ZAv.js → binary-plugins-CLlJsq5D.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-preview-renderer-Cmo-5BP5.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-D7kOD_o_.js";import{Aa as o,ka as s}from"./index-DRrjYYzZ.js";import{t as c}from"./preview-open-alternatives-C-b34dgQ.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let c=(0,u.useRef)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(c.current?.(),c.current=null,d(null),p(!1),!t||!n||!o||!r)return;let l=!1;return _(o,g(e,n)),(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-Cmo-5BP5.js`),__vite__mapDeps([0,1,2]));if(l)return;let u=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(o,t,{loadingText:u.attachmentPreviewPdfRendering,loadMoreHint:u.attachmentPreviewPdfLoadMore,onPageCount:s});c.current=e}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(o,t,{truncationNotice:u.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});c.current=e,l||p(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(o,t);c.current=e}}catch(e){l||d(e instanceof Error?e.message:String(e))}})(),()=>{l=!0,c.current?.(),c.current=null}},[t,n,o,r,e,s]),{error:l,excelTruncated:f}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=o(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,s]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||s({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(31),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;if(t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T),f){let n;t[17]===e?n=t[18]:(n=b(e),t[17]=e,t[18]=n);let r;t[19]!==e||t[20]!==n?(r=(0,p.jsx)(y,{props:e,message:n}),t[19]=e,t[20]=n,t[21]=r):r=t[21];let i;t[22]===f?i=t[23]:(i=(0,p.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),t[22]=f,t[23]=i);let a;return t[24]!==r||t[25]!==i?(a=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[r,i]}),t[24]=r,t[25]=i,t[26]=a):a=t[26],a}if(e.kind===`excel`){let n=m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,r;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[27]=r):r=t[27];let i;return t[28]===n?i=t[29]:(i=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[n,r]}),t[28]=n,t[29]=i),i}let E;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[30]=E):E=t[30],E}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,o=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,s):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==o?(u=o?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=o,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==o?(f=o?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=o,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-ELK_1h2D.js";import{Da as o,Ea as s}from"./index-CPTLS-Zn.js";import{t as c}from"./preview-open-alternatives-yjh1_7K3.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let c=(0,u.useRef)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(c.current?.(),c.current=null,d(null),p(!1),!t||!n||!o||!r)return;let l=!1;return _(o,g(e,n)),(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-Cmo-5BP5.js`),__vite__mapDeps([0,1,2]));if(l)return;let u=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(o,t,{loadingText:u.attachmentPreviewPdfRendering,loadMoreHint:u.attachmentPreviewPdfLoadMore,onPageCount:s});c.current=e}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(o,t,{truncationNotice:u.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});c.current=e,l||p(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(o,t);c.current=e}}catch(e){l||d(e instanceof Error?e.message:String(e))}})(),()=>{l=!0,c.current?.(),c.current=null}},[t,n,o,r,e,s]),{error:l,excelTruncated:f}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=o(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,s]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||s({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(31),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;if(t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T),f){let n;t[17]===e?n=t[18]:(n=b(e),t[17]=e,t[18]=n);let r;t[19]!==e||t[20]!==n?(r=(0,p.jsx)(y,{props:e,message:n}),t[19]=e,t[20]=n,t[21]=r):r=t[21];let i;t[22]===f?i=t[23]:(i=(0,p.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),t[22]=f,t[23]=i);let a;return t[24]!==r||t[25]!==i?(a=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[r,i]}),t[24]=r,t[25]=i,t[26]=a):a=t[26],a}if(e.kind===`excel`){let n=m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,r;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[27]=r):r=t[27];let i;return t[28]===n?i=t[29]:(i=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[n,r]}),t[28]=n,t[29]=i),i}let E;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[30]=E):E=t[30],E}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,o=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,s):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==o?(u=o?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=o,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==o?(f=o?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=o,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
|