@xopcai/xopc 0.0.199 → 0.0.201
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-DYVN1hRp.js → activity-store-DOhnAQOQ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bt70bZjv.js → agent-avatar-dicebear-D8Cw0Mve.js} +1 -1
- package/dist/gateway/static/root/assets/agents-ANavi648.js +68 -0
- package/dist/gateway/static/root/assets/{api-B8mzbAle.js → api-E9Bk-Idp.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B4x7JfL8.js → app-management-settings-panel-BubrReXg.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Dwdagf-Q.js → appearance-settings-BY5Az2p4.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DkTiesxe.js → apps-page-CFh9MBxc.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Cv0VXKLm.js → archive-plugin-BY8843mB.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CgidKrXn.js → attachment-load-DG45KScf.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-751CeNI3.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DN3CQgIq.js → binary-plugins-DGIF2ZAv.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BwkSl1F_.js → block-editor-C1Qktr1g.js} +5 -5
- package/dist/gateway/static/root/assets/browser-settings-page-CGAWs-TT.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-_ndaecsf.js → browser-workflow-inputs-D_jnndyz.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-C_I31wLm.js → browser-workflows-page-DyIRvPaq.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CghUK68J.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-Dy1jZJKs.js → capability-presets-api--tz0mGLY.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-XsTfkvUn.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-D-9qiuio.js → channel-recipient-api-CkOKF9nc.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-DV5BhAeu.js → channels-settings-DkoAZZMe.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +1 -0
- package/dist/gateway/static/root/assets/{connectors-api-5FEBYguL.js → connectors-api-FBOe9SWC.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-e4vekkAu.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-SEFx5rnr.js → cron-expression-Q4QaYjpI.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-D4zCUQJL.js → date-picker-Dtn7e6TW.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DpQAxS2k.js → dependency-picker-Br6nPaM6.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-B_5G3lQl.js → desktop-pet-DzTM6aH8.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-ClEyoUJe.js → desktop-pet-settings-FDmaty3P.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-AsFWmOjG.js → directory-picker-path-field-X2e8xn8j.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-C22Y2o5l.js → extension-debug-page-Dx4MBfga.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C61Ikawk.js → extension-page-Bf_FEDhM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-WlWWcDFr.js → extension-settings-page-CrOgZxkf.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-ByIOMQdc.js → gateway-config-api-CZ4r-7qT.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-jB0hAhWO.js → gateway-config-swr-Cv2ywpdb.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CzzS9A17.js → gateway-settings-DpWmVi0w.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C-fRlHCL.js → gateway-startup-retry-undf-k5g.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DSQZhSvT.js +1 -0
- package/dist/gateway/static/root/assets/home-page-L0uHiu0T.js +3 -0
- package/dist/gateway/static/root/assets/{index-CR233S0Q.css → index-Bp8I_eX4.css} +1 -1
- package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +152 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BD_TFz0_.js → keyboard-shortcuts-settings-Bc3Quw42.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Copi3sdP.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BwbUeLfm.js → local-apps-page-CP9X_vtz.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-xULEcFVs.js → locale-store-CnamlR07.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DMKq6e29.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-CW2VpqtT.js → management-settings-CJmcaVje.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-B1M9KO16.js → markdown-split-AcuFp0TH.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-B_QlNdqZ.js → media-plugins-BvFgsiJL.js} +1 -1
- package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-BTbD4GmH.js → notes-page-IW7IQ9nJ.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-Zb8U0anO.js +4 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CeqtArlZ.js → preview-open-alternatives-C-b34dgQ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DnalBZZs.js → product-open-page-CWEzLykF.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BuIbLnan.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BwUfRqNV.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BTaXxcEi.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-cGkBEfg4.js → runtime-tools-settings-panel-DAohEZrX.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-CmsrLlxu.js → schema-form-C_OBW8A5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BnHoTCD3.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DUWCbaMJ.js → settings-form-section-C7w2WS-A.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bvy5rdMY.js → settings-loading-skeleton-zwibve4m.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-cZSAwsRR.js → settings-page-B9W03dSW.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8Hec2Af.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BzA2NCAH.js → share-preview-page-6e3ks2be.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Bwc5HfLI.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Bvde7_i5.js → skills-page-WgkaNzpc.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-vXSqHR7g.js → skills-page.utils-D9QT5cxj.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-9cQGOGCK.js → system-settings-panel-c1HVtv1Y.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CjP-6WVU.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CHQRiuCF.js → theme-store-BDyUTObE.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-7XfKULPI.js → use-autosave-D6UkH_Ga.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-CZ9m9aC_.js → user-context-page-D8ZhPDNF.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DXr21v-3.js → voice-api-key-field-BOxkKbGh.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CeG7g_DZ.js → work-discovery-overlay-Dd19yK9t.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DUkdJl1e.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DSQQZP9T.js → workflow-run-setup-panel-ZA3bP65I.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-C2b5W5bw.js +5 -0
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-D-IgcHPp.js → working-directory-picker-modal-BcyiDXU3.js} +1 -1
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tasks.js +51 -9
- package/dist/src/agent/context/execution-scope.js +3 -1
- package/dist/src/agent/tasks/task-judge-service.d.ts +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -2
- package/dist/src/agent/tools/xopc-use-tool.js +13 -3
- package/dist/src/auth/oauth/types.d.ts +2 -0
- package/dist/src/auth/oauth/xopc-cloud.js +24 -2
- package/dist/src/automations/domain/validation.d.ts +0 -12
- package/dist/src/automations/draft/automation-draft-validator.d.ts +0 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/gateway/hono/app.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +2 -0
- package/dist/src/gateway/hono/routes/agent-stream.js +2 -74
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +62 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +82 -0
- package/dist/src/gateway/hono/routes/tasks.js +161 -2
- package/dist/src/gateway/service/task-conversation-query-service.d.ts +58 -0
- package/dist/src/gateway/service/task-conversation-query-service.js +84 -0
- package/dist/src/gateway/service.d.ts +10 -0
- package/dist/src/gateway/service.js +75 -42
- package/dist/src/projects/project-agent.js +1 -1
- package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +112 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/execution-context.js +8 -4
- package/dist/src/tasks/index.d.ts +2 -0
- package/dist/src/tasks/index.js +3 -1
- package/dist/src/tasks/task-application-service.js +10 -17
- package/dist/src/tasks/task-context-assembler.js +9 -4
- package/dist/src/tasks/task-context-repository.d.ts +0 -6
- package/dist/src/tasks/task-context-repository.js +0 -4
- package/dist/src/tasks/task-conversation-repository.d.ts +71 -0
- package/dist/src/tasks/task-conversation-repository.js +194 -0
- package/dist/src/tasks/task-handoff-service.d.ts +31 -0
- package/dist/src/tasks/task-handoff-service.js +143 -0
- package/dist/src/tasks/task-read-model-projector.js +1 -5
- package/dist/src/tasks/task-repository.d.ts +0 -2
- package/dist/src/tasks/task-repository.js +2 -9
- package/dist/src/tasks/task-run-coordinator.js +3 -1
- package/dist/src/workflows/service/workflow-run-service.js +4 -2
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-D19uNmJf.js +0 -68
- package/dist/gateway/static/root/assets/automations-page-BR6qMOVr.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CDFQWAxI.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D41mssOq.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-BXgCyuu2.js +0 -3
- package/dist/gateway/static/root/assets/channels-status-swr-B4Rbh3bM.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-C_qkEN0T.js +0 -2
- package/dist/gateway/static/root/assets/heartbeat-settings-B4A_CXUL.js +0 -1
- package/dist/gateway/static/root/assets/home-page-FVGYYPWo.js +0 -3
- package/dist/gateway/static/root/assets/index-CGbKTCST.js +0 -152
- package/dist/gateway/static/root/assets/local-app-workbench-page-BNpkigNb.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-DXP9OQQt.js +0 -2
- package/dist/gateway/static/root/assets/messages-3qRsLZuX.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-JRiq7QDW.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CjWA13aE.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-jsCkScbG.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CGPJTEkM.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BBHzziMd.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-2cGg8-9h.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cf06b66-.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-xlNKydYY.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C5Xu93c_.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bkno4tTe.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CQWZD03N.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Cs-MXFJ1.js +0 -5
|
@@ -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{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"./loader-circle-CifKLtgG.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./button-CSEbl4zT.js";import{t as d}from"./messages-3qRsLZuX.js";import{l as f,n as p,o as m,r as h,s as g}from"./locale-store-xULEcFVs.js";import{a as _,i as v,o as y,r as b,s as x,t as S}from"./dist-BPoKqzeH.js";import{a as C,i as w}from"./vendor-swr-BIWyz7Rc.js";import{r as T}from"./settings-form-draft-Dy10ldo8.js";import{Aa as E,As as D,Cl as O,Es as k,Fa as A,Ia as j,Ko as M,La as N,Ma as P,Nl as F,Pa as I,Qs as L,Ta as R,Va as z,Vs as B,Wl as ee,as as te,os as ne,ws as re,xi as ie}from"./index-CGbKTCST.js";import{t as V}from"./page-tabs-BaEQMYm_.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(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 ae(e){let t=await m(h(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await m(h(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await m(h(`/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 G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await m(h(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function oe(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var X={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Z({className:e}){let t=d(p(e=>e.language)).extensionsPage,n=f(e=>!!e.token),r=I(),{mutate:i}=C(),[a,o]=(0,H.useReducer)(T,X),{q:s,debounced:u,detailPkg:m,rowBusy:_,actionError:v,restartHint:y}=a,b=n?`marketplace-${u}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:x,isLoading:S,error:k}=w(b,async()=>g(u.length>0?h(`/api/marketplace?q=${encodeURIComponent(u)}`):h(`/api/marketplace`)),{revalidateOnFocus:!1}),A=(0,H.useCallback)(()=>{i(`gateway-extensions-list`),R()},[i]),j=(0,H.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});A(),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,A]),M=(0,H.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);A(),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,A]),N=x?.extensions??[];return(0,Y.jsxs)(`div`,{className:l(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(D,{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,Y.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`})]}),k?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k instanceof Error?k.message:t.marketplaceLoadFailed}):null,v?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v}):null,y?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,S&&!x?(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Y.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Y.jsx)(E,{className:`h-5 w-40`}),(0,Y.jsx)(E,{className:`h-4 w-full max-w-xl`}),(0,Y.jsx)(E,{className:`h-4 w-2/3 max-w-md`})]}),(0,Y.jsx)(E,{className:`h-8 w-20`})]})},e))}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:N.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):N.map(e=>{let n=oe(r,e.id),i=_===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.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:l(`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,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(O,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.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,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(L,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.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,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&M(e.id).catch(()=>{})},className:l(`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,Y.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(ne,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:l(`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)})}),m?(0,Y.jsx)(Q,{packageName:m,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:j,onUninstall:M}):null]})}function Q(e){let t=(0,U.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:u}=e,[d,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(!1),g=f(de)?`ext-mp-detail-${n}`:null,v;t[0]===n?v=t[1]:(v=async()=>ae(n),t[0]=n,t[1]=v);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[2]=C):C=t[2];let{data:T,error:D,isLoading:O}=w(g,v,C),k;t[3]!==i||t[4]!==n?(k=oe(i,n),t[3]=i,t[4]=n,t[5]=k):k=t[5];let A=k,j=A===`user`,N=T?.manifest?.permissions,P,F,I,L,R,z,B,V,W,G,K;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]!==T||t[29]!==D||t[30]!==A||t[31]!==O||t[32]!==o||t[33]!==N||t[34]!==m){let e=N&&typeof N==`object`&&!Array.isArray(N)?Object.entries(N):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==T?(n=T?.readme?.trim()||(T?.description?.trim()?`### ${T.name}\n\n${T.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=T,t[48]=n):n=t[48];let i=n;I=S,L=!0,t[49]===o?R=t[50]:(R=e=>!e&&o(),t[49]=o,t[50]=R),F=y,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Y.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=K):K=t[51],P=b,V=`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`,W=ue;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(ee,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,Y.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 c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,Y.jsx)(x,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(M,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,Y.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:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(G=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=G):G=t[65],z=`min-h-0 flex-1 overflow-y-auto p-5`,B=O&&!T?(0,Y.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Y.jsx)(E,{className:`h-6 w-48`}),(0,Y.jsx)(E,{className:`h-4 w-28`}),(0,Y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Y.jsx)(E,{className:`h-12`}),(0,Y.jsx)(E,{className:`h-12`})]}),(0,Y.jsx)(E,{className:`h-28 w-full`}),(0,Y.jsx)(E,{className:`h-36 w-full`})]}):D?(0,Y.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,Y.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Y.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:D instanceof Error?D.message:r.marketplaceLoadFailed})]}):T?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:T.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:T.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:T.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:T.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:T.downloads})]})]}),A===`bundled`?null:(0,Y.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[T.installability.available?(0,Y.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Y.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:T.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:T.installability.available?r.marketplaceCodeRisk:T.installability.reason??r.marketplaceUnavailableBody})]})]}),T.installability.available?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Y.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Y.jsx)(`dd`,{children:T.packageSummary?.dependencyCount??0})]})]}),(0,Y.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Y.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Y.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(le)}):(0,Y.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(T.packageSummary?.lifecycleScripts.length??0)>0?(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,T.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Y.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Y.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),T.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(ie,{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]=T,t[29]=D,t[30]=A,t[31]=O,t[32]=o,t[33]=N,t[34]=m,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z,t[41]=B,t[42]=V,t[43]=W,t[44]=G,t[45]=K}else P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40],B=t[41],V=t[42],W=t[43],G=t[44],K=t[45];let q;t[66]!==z||t[67]!==B?(q=(0,Y.jsx)(`div`,{className:z,children:B}),t[66]=z,t[67]=B,t[68]=q):q=t[68];let J;t[69]!==d||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]!==T||t[78]!==A||t[79]!==o||t[80]!==s||t[81]!==u||t[82]!==n||t[83]!==m||t[84]!==j?(J=T?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:A===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:d||!T.installability.available||!m,onClick:()=>{j&&!window.confirm(r.marketplaceReinstallConfirm)||(p(!0),s(n,j).catch(ce).finally(()=>p(!1)))},className:l(`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:[d?(0,Y.jsx)(c,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,j?r.marketplaceReinstall:r.marketplaceInstall]}),j?(0,Y.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(p(!0),u(n).then(()=>o()).catch(se).finally(()=>p(!1)))},className:l(`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,Y.jsx)(ne,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,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]=T,t[78]=A,t[79]=o,t[80]=s,t[81]=u,t[82]=n,t[83]=m,t[84]=j,t[85]=J):J=t[85];let X;t[86]!==P||t[87]!==q||t[88]!==J||t[89]!==V||t[90]!==W||t[91]!==G?(X=(0,Y.jsxs)(P,{className:V,onOpenAutoFocus:W,children:[G,q,J]}),t[86]=P,t[87]=q,t[88]=J,t[89]=V,t[90]=W,t[91]=G,t[92]=X):X=t[92];let Z;t[93]!==F||t[94]!==X||t[95]!==K?(Z=(0,Y.jsxs)(F,{children:[K,X]}),t[93]=F,t[94]=X,t[95]=K,t[96]=Z):Z=t[96];let Q;return t[97]!==I||t[98]!==L||t[99]!==R||t[100]!==Z?(Q=(0,Y.jsx)(I,{defaultOpen:L,onOpenChange:R,children:Z}),t[97]=I,t[98]=L,t[99]=R,t[100]=Z,t[101]=Q):Q=t[101],Q}function se(){}function ce(){}function le(e){let[t,n]=e;return(0,Y.jsxs)(`li`,{className:`break-words`,children:[(0,Y.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function ue(e){return e.preventDefault()}function de(e){return!!e.token}function fe(){let e=p(e=>e.language),t=d(e),n=z(e=>e.setPageHeader),r=z(e=>e.clearPageHeader),o=I(),s=A(),[c,l]=i(),f=W(c.get(`tab`)),m=c.get(`q`)??``,[h,g]=(0,H.useState)(f),[_,v]=(0,H.useState)(m),[y,b]=(0,H.useState)(null),x=c.toString(),S=(0,H.useRef)(x);if(S.current!==x){S.current=x;let e=W(c.get(`tab`)),t=c.get(`q`)??``;g(t=>t===e?t:e),v(e=>e===t?e:t)}(0,H.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=_.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,_,l]);let C=(0,H.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,H.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=h===`builtin`?C:w,E=(0,H.useMemo)(()=>{let t=_.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,_,e]);if((0,H.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?$(e)===$(t)&&e.active===t.active?e:t:null})},[o]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(u,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Y.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Y.jsx)(F,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Y.jsx)(u,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Y.jsxs)(a,{to:`/local-apps/new`,children:[(0,Y.jsx)(B,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&h!==`marketplace`)return(0,Y.jsx)(ye,{});let O=h!==`marketplace`&&T.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Y.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,Y.jsx)(V,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:h,onChange:g,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(D,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(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,Y.jsx)(Z,{}):h===`builtin`&&C.length===0?(0,Y.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):h===`user`&&w.length===0?(0,Y.jsx)(xe,{message:t.extensionsPage.emptyUser}):E.length===0?(0,Y.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,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,Y.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:h===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,Y.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function $(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=$(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,U.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=$(n),t[0]=n,t[1]=s);let c=s,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=l(`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 f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,Y.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:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==c?(v=c?(0,Y.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,Y.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.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,Y.jsx)(B,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,Y.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,Y.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,Y.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]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==m?(D=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[m,E]}),t[39]=E,t[40]=m,t[41]=D):D=t[41];let O;return t[42]!==a||t[43]!==D?(O=(0,Y.jsx)(`button`,{type:`button`,onClick:a,className:d,children:D}),t[42]=a,t[43]=D,t[44]=O):O=t[44],O}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=C(),[i,o]=(0,H.useState)(!1),[d,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(!1),h=e.activationEligible===!0,g=(0,H.useCallback)(async()=>{if(e.source===`bundled`){f(null),m(!1),o(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),R(),m(t)}catch(e){f(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[h,t.builtinToggleFailed,e.id,e.source,r]),w=e.ui?.contributions?.pages??[],T=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],D=e.ui?.contributions?.sidebarPanels??[],O=w.find(e=>e.showInNav)??w[0],A=T[0],F=O?P(e.id,O):null,I=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||j(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(S,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(y,{children:[(0,Y.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(b,{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,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.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,Y.jsx)(ee,{className:`size-5`})}),(0,Y.jsx)(x,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(v,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.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,Y.jsx)(M,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(u,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(c,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),d?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:d}):null,p?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.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&&(w.length>0||T.length>0||E.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)(ve,{template:t.badgePages,count:w.length,hidden:w.length===0}),(0,Y.jsx)(ve,{template:t.badgeSettings,count:T.length,hidden:T.length===0}),(0,Y.jsx)(ve,{template:t.badgeWidgets,count:E.length,hidden:E.length===0}),(0,Y.jsx)(ve,{template:t.badgeSidebar,count:D.length,hidden:D.length===0})]})]}):null,N(e)&&(F||I)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[F?(0,Y.jsxs)(a,{to:F,onClick:n,className:l(`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,Y.jsx)(s,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,I?(0,Y.jsxs)(a,{to:I,onClick:n,className:l(`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,Y.jsx)(k,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,U.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,Y.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,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.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,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Y.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,Y.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,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.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,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{fe as ExtensionsPage};
|
|
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"./loader-circle-CifKLtgG.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./button-CSEbl4zT.js";import{t as d}from"./messages-D7kOD_o_.js";import{l as f,n as p,o as m,r as h,s as g}from"./locale-store-CnamlR07.js";import{a as _,i as v,o as y,r as b,s as x,t as S}from"./dist-BPoKqzeH.js";import{a as C,i as w}from"./vendor-swr-BIWyz7Rc.js";import{r as T}from"./settings-form-draft-Dy10ldo8.js";import{Ba as E,Ds as D,El as O,Fa as k,Il as A,La as j,Na as M,Ns as N,Oa as P,Ra as F,Wa as I,Ws as L,Yo as ee,cs as te,ks as R,ls as ne,ql as re,tc as z,wi as ie,za as B}from"./index-DRrjYYzZ.js";import{t as V}from"./page-tabs-BaEQMYm_.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(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 ae(e){let t=await m(h(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await m(h(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await m(h(`/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 G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await m(h(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function oe(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var X={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Z({className:e}){let t=d(p(e=>e.language)).extensionsPage,n=f(e=>!!e.token),r=j(),{mutate:i}=C(),[a,o]=(0,H.useReducer)(T,X),{q:s,debounced:u,detailPkg:m,rowBusy:_,actionError:v,restartHint:y}=a,b=n?`marketplace-${u}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:x,isLoading:S,error:E}=w(b,async()=>g(u.length>0?h(`/api/marketplace?q=${encodeURIComponent(u)}`):h(`/api/marketplace`)),{revalidateOnFocus:!1}),D=(0,H.useCallback)(()=>{i(`gateway-extensions-list`),P()},[i]),k=(0,H.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});D(),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,D]),A=(0,H.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);D(),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,D]),F=x?.extensions??[];return(0,Y.jsxs)(`div`,{className:l(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(N,{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,Y.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`})]}),E?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E instanceof Error?E.message:t.marketplaceLoadFailed}):null,v?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v}):null,y?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,S&&!x?(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Y.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Y.jsx)(M,{className:`h-5 w-40`}),(0,Y.jsx)(M,{className:`h-4 w-full max-w-xl`}),(0,Y.jsx)(M,{className:`h-4 w-2/3 max-w-md`})]}),(0,Y.jsx)(M,{className:`h-8 w-20`})]})},e))}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:F.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):F.map(e=>{let n=oe(r,e.id),i=_===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.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:l(`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,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(O,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.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,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(z,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.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,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&A(e.id).catch(()=>{})},className:l(`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,Y.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(ne,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:l(`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)})}),m?(0,Y.jsx)(Q,{packageName:m,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:k,onUninstall:A}):null]})}function Q(e){let t=(0,U.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:u}=e,[d,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(!1),g=f(de)?`ext-mp-detail-${n}`:null,v;t[0]===n?v=t[1]:(v=async()=>ae(n),t[0]=n,t[1]=v);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[2]=C):C=t[2];let{data:T,error:E,isLoading:O}=w(g,v,C),k;t[3]!==i||t[4]!==n?(k=oe(i,n),t[3]=i,t[4]=n,t[5]=k):k=t[5];let A=k,j=A===`user`,N=T?.manifest?.permissions,P,F,I,L,R,z,B,V,W,G,K;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]!==T||t[29]!==E||t[30]!==A||t[31]!==O||t[32]!==o||t[33]!==N||t[34]!==m){let e=N&&typeof N==`object`&&!Array.isArray(N)?Object.entries(N):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==T?(n=T?.readme?.trim()||(T?.description?.trim()?`### ${T.name}\n\n${T.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=T,t[48]=n):n=t[48];let i=n;I=S,L=!0,t[49]===o?R=t[50]:(R=e=>!e&&o(),t[49]=o,t[50]=R),F=y,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Y.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=K):K=t[51],P=b,V=`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`,W=ue;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(re,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,Y.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 c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,Y.jsx)(x,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(ee,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,Y.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:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(G=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=G):G=t[65],z=`min-h-0 flex-1 overflow-y-auto p-5`,B=O&&!T?(0,Y.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Y.jsx)(M,{className:`h-6 w-48`}),(0,Y.jsx)(M,{className:`h-4 w-28`}),(0,Y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Y.jsx)(M,{className:`h-12`}),(0,Y.jsx)(M,{className:`h-12`})]}),(0,Y.jsx)(M,{className:`h-28 w-full`}),(0,Y.jsx)(M,{className:`h-36 w-full`})]}):E?(0,Y.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,Y.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Y.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:E instanceof Error?E.message:r.marketplaceLoadFailed})]}):T?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:T.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:T.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:T.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:T.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:T.downloads})]})]}),A===`bundled`?null:(0,Y.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[T.installability.available?(0,Y.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Y.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:T.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:T.installability.available?r.marketplaceCodeRisk:T.installability.reason??r.marketplaceUnavailableBody})]})]}),T.installability.available?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Y.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Y.jsx)(`dd`,{children:T.packageSummary?.dependencyCount??0})]})]}),(0,Y.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Y.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Y.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(le)}):(0,Y.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(T.packageSummary?.lifecycleScripts.length??0)>0?(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,T.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Y.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Y.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),T.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(ie,{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]=T,t[29]=E,t[30]=A,t[31]=O,t[32]=o,t[33]=N,t[34]=m,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z,t[41]=B,t[42]=V,t[43]=W,t[44]=G,t[45]=K}else P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40],B=t[41],V=t[42],W=t[43],G=t[44],K=t[45];let q;t[66]!==z||t[67]!==B?(q=(0,Y.jsx)(`div`,{className:z,children:B}),t[66]=z,t[67]=B,t[68]=q):q=t[68];let J;t[69]!==d||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]!==T||t[78]!==A||t[79]!==o||t[80]!==s||t[81]!==u||t[82]!==n||t[83]!==m||t[84]!==j?(J=T?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:A===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:d||!T.installability.available||!m,onClick:()=>{j&&!window.confirm(r.marketplaceReinstallConfirm)||(p(!0),s(n,j).catch(ce).finally(()=>p(!1)))},className:l(`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:[d?(0,Y.jsx)(c,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,j?r.marketplaceReinstall:r.marketplaceInstall]}),j?(0,Y.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(p(!0),u(n).then(()=>o()).catch(se).finally(()=>p(!1)))},className:l(`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,Y.jsx)(ne,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,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]=T,t[78]=A,t[79]=o,t[80]=s,t[81]=u,t[82]=n,t[83]=m,t[84]=j,t[85]=J):J=t[85];let X;t[86]!==P||t[87]!==q||t[88]!==J||t[89]!==V||t[90]!==W||t[91]!==G?(X=(0,Y.jsxs)(P,{className:V,onOpenAutoFocus:W,children:[G,q,J]}),t[86]=P,t[87]=q,t[88]=J,t[89]=V,t[90]=W,t[91]=G,t[92]=X):X=t[92];let Z;t[93]!==F||t[94]!==X||t[95]!==K?(Z=(0,Y.jsxs)(F,{children:[K,X]}),t[93]=F,t[94]=X,t[95]=K,t[96]=Z):Z=t[96];let Q;return t[97]!==I||t[98]!==L||t[99]!==R||t[100]!==Z?(Q=(0,Y.jsx)(I,{defaultOpen:L,onOpenChange:R,children:Z}),t[97]=I,t[98]=L,t[99]=R,t[100]=Z,t[101]=Q):Q=t[101],Q}function se(){}function ce(){}function le(e){let[t,n]=e;return(0,Y.jsxs)(`li`,{className:`break-words`,children:[(0,Y.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function ue(e){return e.preventDefault()}function de(e){return!!e.token}function fe(){let e=p(e=>e.language),t=d(e),n=I(e=>e.setPageHeader),r=I(e=>e.clearPageHeader),o=j(),s=F(),[c,l]=i(),f=W(c.get(`tab`)),m=c.get(`q`)??``,[h,g]=(0,H.useState)(f),[_,v]=(0,H.useState)(m),[y,b]=(0,H.useState)(null),x=c.toString(),S=(0,H.useRef)(x);if(S.current!==x){S.current=x;let e=W(c.get(`tab`)),t=c.get(`q`)??``;g(t=>t===e?t:e),v(e=>e===t?e:t)}(0,H.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=_.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,_,l]);let C=(0,H.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,H.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=h===`builtin`?C:w,E=(0,H.useMemo)(()=>{let t=_.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,_,e]);if((0,H.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?$(e)===$(t)&&e.active===t.active?e:t:null})},[o]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(u,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Y.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Y.jsx)(A,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Y.jsx)(u,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Y.jsxs)(a,{to:`/local-apps/new`,children:[(0,Y.jsx)(L,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&h!==`marketplace`)return(0,Y.jsx)(ye,{});let D=h!==`marketplace`&&T.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Y.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,Y.jsx)(V,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:h,onChange:g,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),D?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(N,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(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,Y.jsx)(Z,{}):h===`builtin`&&C.length===0?(0,Y.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):h===`user`&&w.length===0?(0,Y.jsx)(xe,{message:t.extensionsPage.emptyUser}):E.length===0?(0,Y.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,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,Y.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:h===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,Y.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function $(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=$(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,U.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=$(n),t[0]=n,t[1]=s);let c=s,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=l(`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 f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,Y.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:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==c?(v=c?(0,Y.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,Y.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.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,Y.jsx)(L,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,Y.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,Y.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,Y.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]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==m?(D=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[m,E]}),t[39]=E,t[40]=m,t[41]=D):D=t[41];let O;return t[42]!==a||t[43]!==D?(O=(0,Y.jsx)(`button`,{type:`button`,onClick:a,className:d,children:D}),t[42]=a,t[43]=D,t[44]=O):O=t[44],O}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=C(),[i,o]=(0,H.useState)(!1),[d,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(!1),h=e.activationEligible===!0,g=(0,H.useCallback)(async()=>{if(e.source===`bundled`){f(null),m(!1),o(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),P(),m(t)}catch(e){f(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[h,t.builtinToggleFailed,e.id,e.source,r]),w=e.ui?.contributions?.pages??[],T=e.ui?.contributions?.settingsPanels??[],D=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],A=w.find(e=>e.showInNav)??w[0],j=T[0],M=A?k(e.id,A):null,N=j?`/settings/ext/${e.id}/${j.id}`:e.hasConfigSchema||B(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(S,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(y,{children:[(0,Y.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(b,{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,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.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,Y.jsx)(re,{className:`size-5`})}),(0,Y.jsx)(x,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(v,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.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,Y.jsx)(ee,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(u,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(c,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),d?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:d}):null,p?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.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&&(w.length>0||T.length>0||D.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)(ve,{template:t.badgePages,count:w.length,hidden:w.length===0}),(0,Y.jsx)(ve,{template:t.badgeSettings,count:T.length,hidden:T.length===0}),(0,Y.jsx)(ve,{template:t.badgeWidgets,count:D.length,hidden:D.length===0}),(0,Y.jsx)(ve,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,E(e)&&(M||N)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[M?(0,Y.jsxs)(a,{to:M,onClick:n,className:l(`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,Y.jsx)(s,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,N?(0,Y.jsxs)(a,{to:N,onClick:n,className:l(`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,Y.jsx)(R,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,U.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,Y.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,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.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,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Y.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,Y.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,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.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,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{fe as ExtensionsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-Cv0VXKLm.js → archive-plugin-BY8843mB.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-D7kOD_o_.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-C-b34dgQ.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-CgidKrXn.js → attachment-load-DG45KScf.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{ja as t}from"./index-DRrjYYzZ.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"./cn-JdwAhgNB.js";import{t as l}from"./button-CSEbl4zT.js";import{t as u}from"./messages-D7kOD_o_.js";import{n as d}from"./locale-store-CnamlR07.js";import{a as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BPoKqzeH.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{Al as y,An as b,Dl as x,Ds as S,Hc as C,Jo as w,Ks as ee,Ls as T,Ma as E,Ml as D,Na as O,Ns as k,Ol as A,Ql as te,Qs as j,Ri as ne,Ss as re,Tl as ie,Wa as M,Ws as ae,Xs as oe,Yo as N,dr as P,fc as se,fr as F,gr as ce,hc as le,ls as ue,mr as de,nl as I,pr as L,u as R,v as fe,wi as pe}from"./index-DRrjYYzZ.js";import{a as z,i as B,o as me,r as V}from"./cron-expression-Q4QaYjpI.js";import{a as he,i as ge,n as _e,r as H,t as ve}from"./workflow-run-setup-panel-ZA3bP65I.js";import{i as ye,n as be,r as xe,t as Se}from"./browser-workflow-inputs-D_jnndyz.js";var U=e(t(),1),W=n(),Ce=z();function we(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function Te(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 G(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 Ee(e){return e.length===5&&e.every((e,t)=>e===t+1)}function De(e){if(e.length!==2)return!1;let t=[...e].toSorted((e,t)=>e-t);return t[0]===0&&t[1]===6}function Oe(e,t,n,r){try{let i=Ce.CronExpressionParser.parse(e,{...r?.timezone?{tz:r.timezone}:{}}).fields,a=V(i.minute.values),o=V(i.hour.values),s=V(i.dayOfWeek.values),c=V(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=B(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=B(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?we(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&&Ee(s))return n.weekdaysAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&De(s))return n.weekendsAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length===1){let e=Te(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=G(s.map(e=>Te(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 ke(e,t,n,r){let i=e.trim();return i?Oe(i,t,n,r)||Ae(r?.nextRun,t)||n.customSchedule:Ae(r?.nextRun,t)||`—`}function Ae(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 K=1e3,q=60*K,J=60*q,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:q,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(q,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(K,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:q},{unit:`second`,ms:K}]:n>=J?[{unit:`hour`,ms:J},{unit:`minute`,ms:q},{unit:`second`,ms:K}]:n>=q?[{unit:`minute`,ms:q},{unit:`second`,ms:K}]:[{unit:`second`,ms:K}],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):ke(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=H(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?_e(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,W.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)(O,{className:`h-4 w-36`}),(0,Z.jsx)(O,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(O,{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)(O,{className:`h-4 w-32`}),i=(0,Z.jsx)(O,{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)(O,{className:`h-12 rounded-lg`}),(0,Z.jsx)(O,{className:`h-12 rounded-lg`}),(0,Z.jsx)(O,{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)(O,{className:`size-4 rounded-full`}),(0,Z.jsx)(O,{className:`h-4 w-32`}),(0,Z.jsx)(O,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(O,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(O,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(O,{className:`h-8 w-24 rounded-md`})]})},t)}function Ct(){let e=d(e=>e.language),t=u(e),n=t.automations,r=t.cron,a=M(e=>e.setPageHeader),o=M(e=>e.clearPageHeader),[s,y]=i(),b=s.get(`run`)?.trim()??``,x=s.get(`view`)===`runs`,S=s.get(`automation`)?.trim()??``,C=s.get(`draft`)?.trim()??``,ee=s.get(`action`)?.trim()??``,T=s.get(`projectId`)?.trim()??``,D=s.get(`autogenerate`)===`1`,O=(0,U.useRef)(``),[A,j]=(0,U.useState)(`all`),[re,ie]=(0,U.useState)(``),[oe,P]=(0,U.useState)(!1),[se,F]=(0,U.useState)(`blank`),[ce,le]=(0,U.useState)(null),[ue,de]=(0,U.useState)(!1),[I,L]=(0,U.useState)(Xe),[pe,z]=(0,U.useState)(null),[B,me]=(0,U.useState)(null),[V,he]=(0,U.useState)(!1),[_e,H]=(0,U.useState)(null),[ve,xe]=(0,U.useState)(``),[Se,W]=(0,U.useState)(null),[Ce,we]=(0,U.useState)(!1),[Te,G]=(0,U.useState)(!1),[Ee,De]=(0,U.useState)(null),[Oe,ke]=(0,U.useState)(!1),[Ae,K]=(0,U.useState)(!1),[q,J]=(0,U.useState)(!1),[Y,X]=(0,U.useState)(null),je=v([`automations`,T],()=>R.list(T?{projectId:T}:void 0),{refreshInterval:15e3}),Me=v([`automation-runs`,T],()=>R.runs(50,void 0,T?{projectId:T}:void 0),{refreshInterval:1e4}),Ne=v(B?`automation-run-events:${B}`:null,()=>R.runEvents(B),{refreshInterval:5e3}),Pe=v(`automation-workflow-definitions`,fe),Fe=v(`automation-browser-workflows`,()=>ye.list()),Ie=v(`automation-chat-agents`,E),Le=je.isLoading&&!je.data||Me.isLoading&&!Me.data,Re=je.data?.automations??[],ze=(0,U.useMemo)(()=>bt(Me.data?.runs??[]),[Me.data?.runs]),Be=(0,U.useMemo)(()=>Re.filter(e=>!_t(e)),[Re]),Ve=(0,U.useMemo)(()=>Re.filter(_t),[Re]),He=(0,U.useMemo)(()=>new Set(Ve.map(e=>e.id)),[Ve]),Ue=(0,U.useMemo)(()=>ze.filter(e=>!He.has(e.automationId)),[ze,He]),We=(0,U.useMemo)(()=>ze.find(e=>e.id===B)??null,[ze,B]),Ge=(0,U.useMemo)(()=>Re.find(e=>e.id===_e)??null,[Re,_e]),Ke=(0,U.useMemo)(()=>Re.find(e=>e.id===ce)??null,[Re,ce]),Je=(0,U.useMemo)(()=>ze.filter(e=>e.automationId===_e).sort((e,t)=>t.createdAtMs-e.createdAtMs),[ze,_e]),Ye=Ne.data?.events??[],Ze=(0,U.useMemo)(()=>Be.filter(e=>mt(e,Ue)).length,[Be,Ue]),$e=re.trim().toLocaleLowerCase(),et=(0,U.useMemo)(()=>(A===`system`?Ve:Be).filter(t=>A===`active`&&!t.enabled||A===`paused`&&t.enabled||A===`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,A,n,e,$e,Ve,Be,Ue]),tt=(0,U.useMemo)(()=>Pe.data??[],[Pe.data]),nt=(0,U.useMemo)(()=>(Fe.data?.workflows??[]).filter(e=>e.enabled),[Fe.data]),rt=Ie.data?.items??[],st=(0,U.useMemo)(()=>tt.find(e=>e.id===I.workflowId.trim())??null,[I.workflowId,tt]),ct=(0,U.useMemo)(()=>nt.find(e=>e.id===I.browserWorkflowId.trim())??null,[nt,I.browserWorkflowId]),lt=I.actionMode===`workflow`&&(!I.workflowId.trim()||tt.length>0&&!tt.some(e=>e.id===I.workflowId)),ut=I.actionMode===`workflow`&&st?!ge(st,I.workflowInput,I.workflowInputValid).valid:!1,dt=!!I.name.trim()&&(I.triggerMode!==`once`||Number.isFinite(new Date(I.onceAt).getTime()))&&(I.triggerMode!==`event`||!!I.eventType.trim()&&it(I.eventPayloadMatch))&&(I.actionMode===`workflow`?!lt&&!ut:I.actionMode===`browser_recipe`?ct!==null&&be(ct,I.browserWorkflowInputs):!!I.instruction.trim())&&(I.afterRunMode!==`webhook`||!!I.webhookUrl.trim()),ft=(0,U.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,U.useEffect)(()=>{if(et.length===0){H(null);return}_e&&et.some(e=>e.id===_e)||H(et[0].id)},[et,_e]);let pt=(0,U.useCallback)(async()=>{await Promise.all([je.mutate(),Me.mutate(),Ne.mutate()])},[je.mutate,Ne.mutate,Me.mutate]),gt=(0,U.useCallback)(e=>{if(le(null),de(!1),F(e),P(!0),e===`blank`){L(Xe);return}xe(``),W(null),G(!1)},[]),yt=(0,U.useCallback)(e=>{L(at(e,tt)),le(e.id),de(!1),H(null),F(`blank`),P(!0)},[tt]),St=(0,U.useCallback)(()=>{Se&&(L(at(Se.automation,tt)),le(null),de(!0),F(`blank`))},[Se,tt]),Ct=(0,U.useCallback)(async()=>{J(!0),z(null);try{await pt()}catch(e){z(e instanceof Error?e.message:String(e))}finally{J(!1)}},[n.feedback.actionFailed,pt]);(0,U.useEffect)(()=>{b&&(me(b),he(!0))},[b]),(0,U.useEffect)(()=>{if(!S)return;let e=Re.find(e=>e.id===S);e&&(j(_t(e)?`system`:`all`),H(e.id),y(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[S,Re,y]),(0,U.useEffect)(()=>{ee===`create`&&(gt(`blank`),y(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[ee,gt,y]),(0,U.useEffect)(()=>{if(!C)return;let t=`${e}:${D?`auto`:`seed`}:${C}`;O.current!==t&&(O.current=t,xe(C),W(null),G(!1),F(`draft`),P(!0),y(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),D&&(z(null),we(!0),R.draft({prompt:C,language:e}).then(e=>{W(e.draft),G(!1)}).catch(e=>{z(e instanceof Error?e.message:String(e))}).finally(()=>{we(!1)})))},[D,C,e,y]);let Tt=(0,U.useCallback)(e=>{me(e),he(!0),y(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[y]);(0,U.useEffect)(()=>{De(null),K(!1)},[B]);async function Et(){if(z(null),dt){if(ue&&Se){X(`draft:edit`);try{let e=Qe(I,st),{simulation:t}=await R.simulate(e);W({...Se,automation:e,simulation:t}),G(!1),de(!1),F(`draft`)}catch(e){z(e instanceof Error?e.message:String(e))}finally{X(null)}return}if(Ke){let e=Ke.id;await Ot(`automation:${e}:edit`,()=>R.update(e,ot(Ke,I,st)))&&(P(!1),le(null),H(e));return}try{let{automation:e}=await R.create({...Qe(I,st),...T?{projectId:T}:{}});L(Xe),P(!1),j(`all`),ie(``),await pt(),H(e.id)}catch(e){z(e instanceof Error?e.message:String(e))}}}async function Ot(e,t){z(null),X(e);try{return await t(),await pt(),!0}catch(e){return z(e instanceof Error?e.message:String(e)),!1}finally{X(null)}}async function At(){let t=ve.trim();if(t){z(null),we(!0);try{W((await R.draft({prompt:t,language:e})).draft),G(!1)}catch(e){z(e instanceof Error?e.message:String(e))}finally{we(!1)}}}async function jt(){if(!Se)return;let e=``;await Ot(`draft:publish`,async()=>{let{automation:t}=await R.create({...Se.automation,...T?{projectId:T}:{}});W(null),xe(``),G(!1),P(!1),j(`all`),ie(``),e=t.id})&&e&&H(e)}async function Mt(t){z(null),ke(!0),De(null),K(!1);try{De((await R.repairDraft(t.id,{language:e})).repair)}catch(e){z(e instanceof Error?e.message:String(e))}finally{ke(!1)}}async function Ft(e){Ee&&await Ot(`run:${e.id}:repair`,async()=>{await R.update(e.automationId,Ee.patch),De(null),K(!1)})}let It=(0,U.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ne,{className:`size-9 shrink-0 p-0`,loading:q,label:n.refresh,onClick:Ct}),(0,Z.jsxs)(l,{variant:`secondary`,onClick:()=>y(e=>{let t=new URLSearchParams(e);return x?t.delete(`view`):t.set(`view`,`runs`),t}),children:[(0,Z.jsx)(te,{className:`size-4`}),x?n.dashboard.backToAutomations:n.dashboard.allRuns]}),(0,Z.jsxs)(l,{variant:`primary`,onClick:()=>gt(`draft`),children:[(0,Z.jsx)(ae,{className:`size-4`}),n.new]})]}),[n.dashboard.allRuns,n.dashboard.backToAutomations,n.new,n.refresh,gt,q,Ct,x,y]);return(0,U.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:[pe?(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:pe}):null,Le?(0,Z.jsx)(xt,{}):x?(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)(k,{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:re,onChange:e=>ie(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:c(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,A===e.id&&`bg-surface-hover text-fg`),onClick:()=>j(e.id),children:[e.label,e.count?` ${e.count}`:``]},e.id))})]}),(0,Z.jsx)(Dt,{automations:et,runs:A===`system`?ze:Ue,labels:n,cronLabels:r,language:e,selectedAutomationId:_e,onOpenDetails:H})]}),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)(w,{className:`size-5`}),title:n.empty.filtered})]})]}),(0,Z.jsx)(_,{open:oe,onOpenChange:e=>{P(e),e||(le(null),de(!1))},children:(0,Z.jsxs)(m,{children:[(0,Z.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(h,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(g,{className:`text-base font-semibold text-fg`,children:se===`draft`?n.draft.title:Ke?n.editTitle:ue?n.draft.editTitle:n.createTitle}),(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(l,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(N,{className:`size-4`})})})]}),se===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(wt,{labels:n,prompt:ve,draft:Se,loading:Ce,approved:Te,publishBusy:Y===`draft:publish`,templates:ft,onPromptChange:xe,onGenerate:At,onEdit:St,onPublish:jt,onApprovedChange:G,onDiscard:()=>{W(null),G(!1)},onTemplateSelect:e=>{L(e),F(`blank`)},onOpenAdvanced:()=>{L(Xe),F(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ut,{form:I,labels:n,setForm:L,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)(l,{variant:`ghost`,onClick:()=>{de(!1),F(`draft`)},children:n.cancel}):(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(l,{variant:`ghost`,children:n.cancel})}),(0,Z.jsx)(l,{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)(_,{open:V&&!!We,onOpenChange:e=>{he(e),!e&&y(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(m,{children:[(0,Z.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(h,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(g,{className:`truncate text-base font-semibold text-fg`,children:We?.automationName??n.dashboard.result}),(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(l,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(N,{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:Ee,repairLoading:Oe,repairApproved:Ae,busyAction:Y,onRepairApprovedChange:K,onSuggestRepair:Mt,onApplyRepair:Ft})})]})]})})]})}function wt(e){let t=(0,W.c)(58),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,templates:c,onPromptChange:u,onGenerate:d,onEdit:f,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)(re,{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 ee;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(re,{className:`size-4`}),t[11]=ee):ee=t[11];let T=a?n.draft.generating:n.draft.generate,E;t[12]!==d||t[13]!==w||t[14]!==T?(E=(0,Z.jsxs)(l,{variant:`primary`,onClick:d,disabled:w,children:[ee,T]}),t[12]=d,t[13]=w,t[14]=T,t[15]=E):E=t[15];let D;t[16]!==C||t[17]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[C,E]}),t[16]=C,t[17]=E,t[18]=D):D=t[18];let O;t[19]===u?O=t[20]:(O=e=>u(e.target.value),t[19]=u,t[20]=O);let k;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==O?(k=(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:O,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=O,t[24]=k):k=t[24];let A;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?(A=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)(l,{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]=A):A=t[32];let te;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]!==f||t[49]!==p||t[50]!==v||t[51]!==y?(te=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)(l,{variant:`ghost`,onClick:h,children:n.draft.discard}),(0,Z.jsxs)(l,{variant:`secondary`,onClick:f,children:[(0,Z.jsx)(oe,{className:`size-4`}),n.draft.edit]}),(0,Z.jsx)(l,{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]=f,t[49]=p,t[50]=v,t[51]=y,t[52]=te):te=t[52];let j;return t[53]!==D||t[54]!==k||t[55]!==A||t[56]!==te?(j=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[D,k,A,te]}),t[53]=D,t[54]=k,t[55]=A,t[56]=te,t[57]=j):j=t[57],j}function Tt(e){let t=(0,W.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,W.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:l}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(w,{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 u;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==l||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==l||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(Ot),n=t.find(ft),u=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:c(`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:()=>l(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:c(`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}),u?.status?(0,Z.jsx)(`span`,{className:c(`shrink-0 rounded-full px-1.5 py-0.5`,ut(u.status)),children:i.status[u.status]}):null]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=l,t[15]=r,t[16]=s,t[17]=e):e=t[17],u=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=l,t[8]=r,t[9]=s,t[10]=u}else u=t[10];let d;return t[18]===u?d=t[19]:(d=(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:u}),t[18]=u,t[19]=d),d}function Ot(e,t){return t.createdAtMs-e.createdAtMs}function kt(e){let t=(0,W.c)(23),{runs:n,labels:r,cronLabels:i,language:a,busyAction:o,onSelectRun:s,onAction:u}=e,d;t[0]===r.dashboard.allRuns?d=t[1]:(d=(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.dashboard.allRuns}),t[0]=r.dashboard.allRuns,t[1]=d);let f;t[2]===r.dashboard.runCenterDescription?f=t[3]:(f=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.dashboard.runCenterDescription}),t[2]=r.dashboard.runCenterDescription,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,Z.jsxs)(`div`,{children:[d,f]}),t[4]=d,t[5]=f,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]!==u||t[17]!==s||t[18]!==n?(g=n.length===0?(0,Z.jsx)(Ht,{icon:(0,Z.jsx)(te,{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:c(`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:c(`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)(l,{variant:`ghost`,disabled:o!==null,onClick:()=>void u(`run:${e.id}:cancel`,()=>R.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]=u,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,W.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,U.useState)(a===void 0?!1:a),l;t[0]===n?l=t[1]:(l=JSON.stringify(n,null,2),t[0]=n,t[1]=l);let u=l,d;t[2]===u?d=t[3]:(d=u.split(`
|
|
2
|
+
`),t[2]=u,t[3]=d);let f=d.length,p=u.length>720||f>18,m;t[4]!==p||t[5]!==u?(m=p?`${u.split(`
|
|
3
|
+
`).slice(0,10).join(`
|
|
4
|
+
`).trimEnd()}...`:u,t[4]=p,t[5]=u,t[6]=m):m=t[6];let h=m,g;t[7]!==o||t[8]!==p||t[9]!==r||t[10]!==i?(g=p?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>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)(y,{className:c(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=p,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=o||!p?u:h,v;t[12]===_?v=t[13]:(v=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let b;return t[14]!==g||t[15]!==v?(b=(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]=b):b=t[16],b}function Mt(e){return!e}function Nt(e){let t=(0,W.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:u,loading:d,repairDraft:f,repairLoading:p,repairApproved:m,busyAction:h,onRepairApprovedChange:g,onSuggestRepair:_,onApplyRepair:v}=e;if(!r){let e;t[0]===n?e=t[1]:(e=c(`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)(te,{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,S=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,w=r.sessionKey?o.runDetail.openConversation:o.runDetail.openWorkflow,ee=r.sessionKey?se:C,T=ft(r)?te:pt(r)?x:ie,E;t[8]===n?E=t[9]:(E=c(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=E);let D;t[10]===r.automationName?D=t[11]:(D=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=D);let k;t[12]===r.id?k=t[13]:(k=r.id.slice(0,8),t[12]=r.id,t[13]=k);let j;t[14]===k?j=t[15]:(j=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:k}),t[14]=k,t[15]=j);let ne;t[16]!==D||t[17]!==j?(ne=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[D,j]}),t[16]=D,t[17]=j,t[18]=ne):ne=t[18];let M;t[19]===r.status?M=t[20]:(M=c(`shrink-0 rounded-full px-2 py-0.5 text-xs`,ut(r.status)),t[19]=r.status,t[20]=M);let ae=o.status[r.status],oe;t[21]!==M||t[22]!==ae?(oe=(0,Z.jsx)(`span`,{className:M,children:ae}),t[21]=M,t[22]=ae,t[23]=oe):oe=t[23];let N;t[24]!==ne||t[25]!==oe?(N=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[ne,oe]}),t[24]=ne,t[25]=oe,t[26]=N):N=t[26];let P;t[27]!==o||t[28]!==u||t[29]!==r.createdAtMs?(P=st(r.createdAtMs,o,u),t[27]=o,t[28]=u,t[29]=r.createdAtMs,t[30]=P):P=t[30];let F;t[31]===P?F=t[32]:(F=(0,Z.jsx)(`span`,{children:P}),t[31]=P,t[32]=F);let ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=ce):ce=t[33];let ue=o.details.duration,de;t[34]!==o||t[35]!==r.durationMs?(de=dt(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=de):de=t[36];let I;t[37]!==o.details.duration||t[38]!==de?(I=(0,Z.jsxs)(`span`,{children:[ue,` `,de]}),t[37]=o.details.duration,t[38]=de,t[39]=I):I=t[39];let L;t[40]!==F||t[41]!==I?(L=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[F,ce,I]}),t[40]=F,t[41]=I,t[42]=L):L=t[42];let R;t[43]!==o.repair||t[44]!==_||t[45]!==p||t[46]!==r?(R=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(l,{variant:`secondary`,onClick:()=>_(r),disabled:p,children:[(0,Z.jsx)(re,{className:`size-4`}),p?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=_,t[45]=p,t[46]=r,t[47]=R):R=t[47];let fe;t[48]!==L||t[49]!==R||t[50]!==N?(fe=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[N,L,R]}),t[48]=L,t[49]=R,t[50]=N,t[51]=fe):fe=t[51];let z;t[52]===r?z=t[53]:(z=ft(r)?`text-blue-500`:pt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=z);let B;t[54]===z?B=t[55]:(B=c(`size-4`,z),t[54]=z,t[55]=B);let me;t[56]!==T||t[57]!==B?(me=(0,Z.jsx)(T,{className:B}),t[56]=T,t[57]=B,t[58]=me):me=t[58];let V;t[59]!==o.runDetail.resultTitle||t[60]!==me?(V=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[me,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=me,t[61]=V):V=t[61];let he;t[62]!==ee||t[63]!==w||t[64]!==S?(he=S?(0,Z.jsx)(l,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:S,children:[(0,Z.jsx)(ee,{className:`size-3.5`}),w,(0,Z.jsx)(A,{className:`size-3.5`})]})}):null,t[62]=ee,t[63]=w,t[64]=S,t[65]=he):he=t[65];let ge;t[66]!==V||t[67]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[V,he]}),t[66]=V,t[67]=he,t[68]=ge):ge=t[68];let _e=r.error&&`border-red-500/25 bg-red-500/5`,H;t[69]===_e?H=t[70]:(H=c(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,_e),t[69]=_e,t[70]=H);let ve;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==b||t[74]!==r?(ve=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)(pe,{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]=ve):ve=t[75];let ye;t[76]!==H||t[77]!==ve?(ye=(0,Z.jsx)(`div`,{className:H,children:ve}),t[76]=H,t[77]=ve,t[78]=ye):ye=t[78];let be;t[79]!==ge||t[80]!==ye?(be=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ge,ye]}),t[79]=ge,t[80]=ye,t[81]=be):be=t[81];let xe;t[82]===o.runDetail.runInfo?xe=t[83]:(xe=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=xe);let Se;t[84]!==s||t[85]!==o||t[86]!==u||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(Se=r.manual?o.trigger.manual:qe(r.triggerSnapshot,o,s,u),t[84]=s,t[85]=o,t[86]=u,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=Se):Se=t[89];let U;t[90]!==o.explain.whyRan||t[91]!==Se?(U=(0,Z.jsx)(zt,{label:o.explain.whyRan,value:Se}),t[90]=o.explain.whyRan,t[91]=Se,t[92]=U):U=t[92];let Ce=o.details.started,we;t[93]!==o||t[94]!==u||t[95]!==r.startedAtMs?(we=st(r.startedAtMs,o,u),t[93]=o,t[94]=u,t[95]=r.startedAtMs,t[96]=we):we=t[96];let Te;t[97]!==o.details.started||t[98]!==we?(Te=(0,Z.jsx)(zt,{label:Ce,value:we}),t[97]=o.details.started,t[98]=we,t[99]=Te):Te=t[99];let G;t[100]!==o.details.model||t[101]!==r.model?(G=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]=G):G=t[102];let Ee;t[103]!==U||t[104]!==Te||t[105]!==G?(Ee=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[U,Te,G]}),t[103]=U,t[104]=Te,t[105]=G,t[106]=Ee):Ee=t[106];let De;t[107]!==xe||t[108]!==Ee?(De=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[xe,Ee]}),t[107]=xe,t[108]=Ee,t[109]=De):De=t[109];let Oe;t[110]!==h||t[111]!==o||t[112]!==v||t[113]!==g||t[114]!==m||t[115]!==f||t[116]!==r?(Oe=f?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:f.explanation}),f.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:f.expectedEffect}):null,(0,Z.jsx)(Tt,{title:o.repair.risks,items:f.risks,empty:o.none}),(0,Z.jsx)(jt,{value:f.patch,labels:o,title:o.details.repairPatch}),f.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:m,onChange:e=>g(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)(l,{variant:`primary`,onClick:()=>v(r),disabled:h===`run:${r.id}:repair`||f.requiresApproval&&!m,children:h===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=h,t[111]=o,t[112]=v,t[113]=g,t[114]=m,t[115]=f,t[116]=r,t[117]=Oe):Oe=t[117];let ke;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(le,{className:`size-4 shrink-0`}),t[118]=ke):ke=t[118];let Ae;t[119]===o.runDetail.technicalEvents?Ae=t[120]:(Ae=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[ke,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=Ae);let K;t[121]!==i.length||t[122]!==o.runDetail.eventCount?(K=o.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=o.runDetail.eventCount,t[123]=K):K=t[123];let q;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(y,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=q):q=t[124];let J;t[125]===K?J=t[126]:(J=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[K,q]}),t[125]=K,t[126]=J);let Y;t[127]!==Ae||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:[Ae,J]}),t[127]=Ae,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]!==u||t[135]!==d?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:d?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":o.loading,children:[(0,Z.jsx)(O,{className:`h-10 w-full`}),(0,Z.jsx)(O,{className:`h-10 w-4/5`}),(0,Z.jsx)(O,{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:c(`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,u),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[o.details.eventData,(0,Z.jsx)(y,{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]=u,t[135]=d,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]!==E||t[142]!==fe||t[143]!==be||t[144]!==De||t[145]!==Oe||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:E,children:[fe,be,De,Oe,Me]}),t[141]=E,t[142]=fe,t[143]=be,t[144]=De,t[145]=Oe,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Pt(e){let t=(0,W.c)(82),{automation:n,runs:r,labels:i,cronLabels:a,language:o,busyAction:s,onEdit:u,onSelectRun:d,onAction:f}=e,p=s===`automation:${n.id}:run`,m=s===`automation:${n.id}:toggle`,h=s===`automation:${n.id}:delete`,g;t[0]===n?g=t[1]:(g=_t(n),t[0]=n,t[1]=g);let _=g,v;t[2]===n.name?v=t[3]:(v=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=v);let y=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,b;t[4]===y?b=t[5]:(b=c(`shrink-0 rounded-full px-2 py-0.5 text-xs`,y),t[4]=y,t[5]=b);let x=n.enabled?i.enabled:i.paused,S;t[6]!==b||t[7]!==x?(S=(0,Z.jsx)(`span`,{className:b,children:x}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let C;t[9]!==v||t[10]!==S?(C=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[v,S]}),t[9]=v,t[10]=S,t[11]=C):C=t[11];let w;t[12]===n?w=t[13]:(w=vt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:vt(n)}):null,t[12]=n,t[13]=w);let E;t[14]!==C||t[15]!==w?(E=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[C,w]}),t[14]=C,t[15]=w,t[16]=E):E=t[16];let D;t[17]!==n||t[18]!==s||t[19]!==h||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]!==f||t[30]!==u||t[31]!==_||t[32]!==p||t[33]!==m?(D=_?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(l,{variant:`secondary`,disabled:s!==null,onClick:()=>void f(`automation:${n.id}:toggle`,()=>n.enabled?R.pause(n.id):R.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[m?(0,Z.jsx)(T,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(j,{className:`size-4`}):(0,Z.jsx)(ee,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(l,{variant:`primary`,disabled:s!==null,onClick:()=>void f(`automation:${n.id}:run`,()=>R.runNow(n.id),i.feedback.rerunQueued),children:[p?(0,Z.jsx)(T,{className:`size-4 animate-spin`}):(0,Z.jsx)(ee,{className:`size-4`}),i.dashboard.runNow]}),(0,Z.jsxs)(de,{children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsx)(l,{variant:`ghost`,className:`size-9 p-0`,"aria-label":i.details.moreActions,children:(0,Z.jsx)(I,{className:`size-4`})})}),(0,Z.jsx)(L,{children:(0,Z.jsxs)(P,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(F,{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:()=>u(n),children:[(0,Z.jsx)(oe,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(F,{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 f(`automation:${n.id}:delete`,()=>R.remove(n.id),i.dashboard.deleted),children:[h?(0,Z.jsx)(T,{className:`size-4 animate-spin`}):(0,Z.jsx)(ue,{className:`size-4`}),i.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=s,t[19]=h,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]=f,t[30]=u,t[31]=_,t[32]=p,t[33]=m,t[34]=D):D=t[34];let O;t[35]!==D||t[36]!==E?(O=(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]=O):O=t[37];let k;t[38]===i.info.task?k=t[39]:(k=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.info.task}),t[38]=i.info.task,t[39]=k);let A;t[40]!==n||t[41]!==i?(A=ht(n,i),t[40]=n,t[41]=i,t[42]=A):A=t[42];let ne;t[43]===A?ne=t[44]:(ne=(0,Z.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsx)(pe,{content:A,compact:!0,openHttpLinksInNewTab:!0})}),t[43]=A,t[44]=ne);let re;t[45]!==k||t[46]!==ne?(re=(0,Z.jsxs)(`section`,{children:[k,ne]}),t[45]=k,t[46]=ne,t[47]=re):re=t[47];let M;t[48]!==n||t[49]!==a||t[50]!==i||t[51]!==o?(M=(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]=M):M=t[52];let ae;t[53]===i.dashboard.runHistory?ae=t[54]:(ae=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),t[53]=i.dashboard.runHistory,t[54]=ae);let N;t[55]===i.dashboard.runHistoryDescription?N=t[56]:(N=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription}),t[55]=i.dashboard.runHistoryDescription,t[56]=N);let se;t[57]!==ae||t[58]!==N?(se=(0,Z.jsxs)(`div`,{children:[ae,N]}),t[57]=ae,t[58]=N,t[59]=se):se=t[59];let le;t[60]===r.length?le=t[61]:(le=(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]=le);let fe;t[62]!==se||t[63]!==le?(fe=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[se,le]}),t[62]=se,t[63]=le,t[64]=fe):fe=t[64];let z;t[65]!==i||t[66]!==o||t[67]!==d||t[68]!==r?(z=r.length===0?(0,Z.jsx)(Ht,{icon:(0,Z.jsx)(te,{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:()=>d(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)(ie,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(te,{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:c(`shrink-0 rounded-full px-2 py-0.5 text-xs`,ut(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:c(`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]=d,t[68]=r,t[69]=z):z=t[69];let B;t[70]!==fe||t[71]!==z?(B=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[fe,z]}),t[70]=fe,t[71]=z,t[72]=B):B=t[72];let me;t[73]!==M||t[74]!==B?(me=(0,Z.jsxs)(`div`,{className:`grid items-start gap-5 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[M,B]}),t[73]=M,t[74]=B,t[75]=me):me=t[75];let V;t[76]!==re||t[77]!==me?(V=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[re,me]}),t[76]=re,t[77]=me,t[78]=V):V=t[78];let he;return t[79]!==O||t[80]!==V?(he=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[O,V]}),t[79]=O,t[80]=V,t[81]=he):he=t[81],he}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,W.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)(D,{className:`size-4`,"aria-hidden":!0}),t[72]=x):x=t[72];let ee=r.info.schedule,T;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(T=qe(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=T):T=t[77];let E=n.enabled?`${r.info.nextRun}:${v}`:v;t[78]!==r.info.schedule||t[79]!==b||t[80]!==T||t[81]!==E?(f=(0,Z.jsx)(Rt,{icon:x,label:ee,value:T,description:E,descriptionTitle:b}),t[78]=r.info.schedule,t[79]=b,t[80]=T,t[81]=E,t[82]=f):f=t[82];let O;t[83]===n.action.kind?O=t[84]:(O=n.action.kind===`workflow`?(0,Z.jsx)(C,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_recipe`?(0,Z.jsx)(le,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=O);let k=r.info.action,A;t[85]!==n.action||t[86]!==r?(A=ct(n.action,r),t[85]=n.action,t[86]=r,t[87]=A):A=t[87],t[88]!==r.info.action||t[89]!==O||t[90]!==A?(p=(0,Z.jsx)(Rt,{icon:O,label:k,value:A}),t[88]=r.info.action,t[89]=O,t[90]=A,t[91]=p):p=t[91],o=Rt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(S,{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)(te,{className:`size-4`,"aria-hidden":!0}),t[99]=v):v=t[99];let b=r.info.lastRun,x;t[100]!==n||t[101]!==r||t[102]!==a?(x=Ye(n,r,a),t[100]=n,t[101]=r,t[102]=a,t[103]=x):x=t[103];let ee=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,T;t[104]!==r.info.lastRun||t[105]!==x||t[106]!==ee?(T=(0,Z.jsx)(Rt,{icon:v,label:b,value:x,valueTone:ee}),t[104]=r.info.lastRun,t[105]=x,t[106]=ee,t[107]=T):T=t[107];let E;t[108]!==n.state.consecutiveFailures||t[109]!==n.state.lastError||t[110]!==r.dashboard?(E=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]=E):E=t[111];let O;t[112]!==r.info.technicalDetails||t[113]!==g?(O=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)(y,{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]=O):O=t[114];let k;t[115]!==_||t[116]!==T||t[117]!==E||t[118]!==O||t[119]!==d||t[120]!==f||t[121]!==p?(k=(0,Z.jsxs)(`div`,{className:d,children:[f,p,_,T,E,O]}),t[115]=_,t[116]=T,t[117]=E,t[118]=O,t[119]=d,t[120]=f,t[121]=p,t[122]=k):k=t[122];let A;return t[123]!==k||t[124]!==m||t[125]!==h?(A=(0,Z.jsxs)(`aside`,{className:m,children:[h,k]}),t[123]=k,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,W.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,l=s===void 0?`default`:s,u;t[0]===n?u=t[1]:(u=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=d);let f=l===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,p;t[4]===f?p=t[5]:(p=c(`mt-1 text-sm font-medium leading-5`,f),t[4]=f,t[5]=p);let m;t[6]!==p||t[7]!==i?(m=(0,Z.jsx)(`div`,{className:p,children:i}),t[6]=p,t[7]=i,t[8]=m):m=t[8];let h;t[9]!==a||t[10]!==o?(h=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=h):h=t[11];let g;t[12]!==d||t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[d,m,h]}),t[12]=d,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==u||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[u,g]}),t[16]=u,t[17]=g,t[18]=_):_=t[18],_}function zt(e){let t=(0,W.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,W.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,W.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,W.c)(250),{form:n,labels:r,setForm:i,workflowDefinitions:a,selectedWorkflow:l,workflowsLoading:d,browserWorkflows:f,selectedBrowserWorkflow:p,browserWorkflowsLoading:m,agentOptions:h,agentsLoading:g,language:_}=e,v=u(_).agentsSettings,x;t[0]===i?x=t[1]:(x=e=>i(t=>({...t,...e})),t[0]=i,t[1]=x);let S=x,C=ze(n.intervalValue,n.intervalUnit),w=Date.now(),ee;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ee=[1,2,3],t[2]=ee):ee=t[2];let T;t[3]!==C||t[4]!==w||t[5]!==_?(T=ee.map(e=>Ge(w+C*e,_,w)),t[3]=C,t[4]=w,t[5]=_,t[6]=T):T=t[6];let E=T,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,U.useEffect)(D,O);let k,A;t[13]!==f||t[14]!==n.actionMode||t[15]!==n.browserWorkflowId||t[16]!==i?(k=()=>{if(n.actionMode!==`browser_recipe`||n.browserWorkflowId.trim())return;let e=f[0];e&&i(t=>({...t,browserWorkflowId:e.id,browserWorkflowInputs:xe(e)}))},A=[f,n.actionMode,n.browserWorkflowId,i],t[13]=f,t[14]=n.actionMode,t[15]=n.browserWorkflowId,t[16]=i,t[17]=k,t[18]=A):(k=t[17],A=t[18]),(0,U.useEffect)(k,A);let te;t[19]===S?te=t[20]:(te=e=>S({name:e.target.value}),t[19]=S,t[20]=te);let j;t[21]!==n.name||t[22]!==te?(j=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:te}),t[21]=n.name,t[22]=te,t[23]=j):j=t[23];let ne;t[24]!==r.form.name||t[25]!==j?(ne=(0,Z.jsx)($,{label:r.form.name,children:j}),t[24]=r.form.name,t[25]=j,t[26]=ne):ne=t[26];let re;t[27]===S?re=t[28]:(re=e=>S({description:e.target.value}),t[27]=S,t[28]=re);let ie;t[29]!==n.description||t[30]!==re?(ie=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:re}),t[29]=n.description,t[30]=re,t[31]=ie):ie=t[31];let M;t[32]!==r.form.description||t[33]!==ie?(M=(0,Z.jsx)($,{label:r.form.description,children:ie}),t[32]=r.form.description,t[33]=ie,t[34]=M):M=t[34];let ae;t[35]===r.form.trigger?ae=t[36]:(ae=(0,Z.jsx)(Kt,{title:r.form.trigger}),t[35]=r.form.trigger,t[36]=ae);let oe;t[37]===S?oe=t[38]:(oe=e=>S({triggerMode:e.target.value}),t[37]=S,t[38]=oe);let N;t[39]===r.trigger.manual?N=t[40]:(N=(0,Z.jsx)(s,{value:`manual`,children:r.trigger.manual}),t[39]=r.trigger.manual,t[40]=N);let P;t[41]===r.trigger.once?P=t[42]:(P=(0,Z.jsx)(s,{value:`once`,children:r.trigger.once}),t[41]=r.trigger.once,t[42]=P);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 de;t[53]===r.trigger.taskBlocked?de=t[54]:(de=(0,Z.jsx)(s,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[53]=r.trigger.taskBlocked,t[54]=de);let I;t[55]===r.trigger.noteCreated?I=t[56]:(I=(0,Z.jsx)(s,{value:`noteCreated`,children:r.trigger.noteCreated}),t[55]=r.trigger.noteCreated,t[56]=I);let L;t[57]===r.trigger.workflowFailed?L=t[58]:(L=(0,Z.jsx)(s,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[57]=r.trigger.workflowFailed,t[58]=L);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 fe;t[61]===r.trigger.customEvent?fe=t[62]:(fe=(0,Z.jsx)(s,{value:`event`,children:r.trigger.customEvent}),t[61]=r.trigger.customEvent,t[62]=fe);let pe;t[63]!==n.triggerMode||t[64]!==oe||t[65]!==N||t[66]!==P||t[67]!==se||t[68]!==F||t[69]!==ce||t[70]!==le||t[71]!==ue||t[72]!==de||t[73]!==I||t[74]!==L||t[75]!==R||t[76]!==fe?(pe=(0,Z.jsxs)(o,{className:Q,value:n.triggerMode,onChange:oe,children:[N,P,se,F,ce,le,ue,de,I,L,R,fe]}),t[63]=n.triggerMode,t[64]=oe,t[65]=N,t[66]=P,t[67]=se,t[68]=F,t[69]=ce,t[70]=le,t[71]=ue,t[72]=de,t[73]=I,t[74]=L,t[75]=R,t[76]=fe,t[77]=pe):pe=t[77];let z;t[78]!==n.onceAt||t[79]!==n.triggerMode||t[80]!==r.form.onceAt||t[81]!==S?(z=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=>S({onceAt:e.target.value})})}):null,t[78]=n.onceAt,t[79]=n.triggerMode,t[80]=r.form.onceAt,t[81]=S,t[82]=z):z=t[82];let B;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]!==S?(B=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)(me,{value:n.time,onChange:e=>S({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=>S({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]=S,t[90]=B):B=t[90];let V=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=>S({intervalValue:e.target.value})}),(0,Z.jsxs)(o,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;S({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===C;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:c(`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:()=>S({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(C,_)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,E.join(_===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,ge;t[91]!==n.cronExpr||t[92]!==n.triggerMode||t[93]!==r.form.expression||t[94]!==S?(ge=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>S({cronExpr:e.target.value})})}):null,t[91]=n.cronExpr,t[92]=n.triggerMode,t[93]=r.form.expression,t[94]=S,t[95]=ge):ge=t[95];let _e;t[96]!==n.triggerMode||t[97]!==n.webhookSecretId||t[98]!==r.form.secretId||t[99]!==S?(_e=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>S({webhookSecretId:e.target.value})})}):null,t[96]=n.triggerMode,t[97]=n.webhookSecretId,t[98]=r.form.secretId,t[99]=S,t[100]=_e):_e=t[100];let H;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]!==S?(H=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=>S({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>S({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:c(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>S({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]=S,t[110]=H):H=t[110];let ye;t[111]===r.form.action?ye=t[112]:(ye=(0,Z.jsx)(Kt,{title:r.form.action}),t[111]=r.form.action,t[112]=ye);let be;t[113]!==n.timeoutSeconds||t[114]!==n.workflowId||t[115]!==S||t[116]!==a?(be=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);S({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]=S,t[116]=a,t[117]=be):be=t[117];let Ce;t[118]===r.action.runAgent?Ce=t[119]:(Ce=(0,Z.jsx)(s,{value:`agent`,children:r.action.runAgent}),t[118]=r.action.runAgent,t[119]=Ce);let we;t[120]===r.action.runWorkflow?we=t[121]:(we=(0,Z.jsx)(s,{value:`workflow`,children:r.action.runWorkflow}),t[120]=r.action.runWorkflow,t[121]=we);let Te=_===`zh`?`浏览器自动化`:`Browser automation`,G;t[122]===Te?G=t[123]:(G=(0,Z.jsx)(s,{value:`browser_recipe`,children:Te}),t[122]=Te,t[123]=G);let Ee;t[124]!==n.actionMode||t[125]!==be||t[126]!==Ce||t[127]!==we||t[128]!==G?(Ee=(0,Z.jsxs)(o,{className:Q,value:n.actionMode,onChange:be,children:[Ce,we,G]}),t[124]=n.actionMode,t[125]=be,t[126]=Ce,t[127]=we,t[128]=G,t[129]=Ee):Ee=t[129];let De=n.actionMode===`browser_recipe`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(o,{className:Q,value:n.agentId,onChange:e=>S({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:b(e,v)},e.id))]})}),Oe;t[130]!==f||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]!==p||t[149]!==l||t[150]!==S||t[151]!==a||t[152]!==d?(Oe=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(he,{value:n.instruction,onApply:e=>S({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:c(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>S({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=>S({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:d||a.length===0,children:[d?(0,Z.jsx)(s,{value:``,children:r.form.loadingWorkflows}):null,!d&&a.length===0?(0,Z.jsx)(s,{value:``,children:r.form.noWorkflows}):null,a.map(Gt)]})}),l?(0,Z.jsx)(ve,{definition:l,language:_,value:n.workflowInput,onChange:e=>S({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>S({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:l.id,workflowTitle:l.title,workflowDescription:l.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=f.find(t=>t.id===e.target.value);S({browserWorkflowId:e.target.value,browserWorkflowInputs:t?xe(t):{}})},disabled:m||f.length===0,children:[f.length===0?(0,Z.jsx)(s,{value:``,children:_===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,f.map(Wt)]})}),p&&Object.keys(p.inputs).length>0?(0,Z.jsx)($,{label:_===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(Se,{workflow:p,values:n.browserWorkflowInputs,language:_,onChange:e=>S({browserWorkflowInputs:e})})}):null]}),t[130]=f,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]=p,t[149]=l,t[150]=S,t[151]=a,t[152]=d,t[153]=Oe):Oe=t[153];let ke;t[154]===r.form.advancedDescription?ke=t[155]:(ke=(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]=ke);let Ae;t[156]!==r.form.advanced||t[157]!==ke?(Ae=(0,Z.jsxs)(`span`,{children:[r.form.advanced,ke]}),t[156]=r.form.advanced,t[157]=ke,t[158]=Ae):Ae=t[158];let K;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(y,{className:`size-4 transition-transform group-open:rotate-180`}),t[159]=K):K=t[159];let q;t[160]===Ae?q=t[161]:(q=(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:[Ae,K]}),t[160]=Ae,t[161]=q);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]!==S?(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;S({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]=S,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]===S?X=t[172]:(X=e=>S({afterRunMode:e.target.value}),t[171]=S,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]!==S?(Ie=n.afterRunMode===`webhook`?(0,Z.jsx)($,{label:r.form.webhookUrl,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookUrl,onChange:e=>S({webhookUrl:e.target.value})})}):null,t[186]=n.afterRunMode,t[187]=n.webhookUrl,t[188]=r.form.webhookUrl,t[189]=S,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]===S?Re=t[194]:(Re=e=>S({timeoutSeconds:e.target.value}),t[193]=S,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]===S?Ke=t[202]:(Ke=e=>S({disableAfterFailures:e.target.value}),t[201]=S,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]!==q||t[232]!==nt?(rt=(0,Z.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[q,nt]}),t[231]=q,t[232]=nt,t[233]=rt):rt=t[233];let at;return t[234]!==ne||t[235]!==M||t[236]!==ae||t[237]!==pe||t[238]!==z||t[239]!==B||t[240]!==V||t[241]!==ge||t[242]!==_e||t[243]!==H||t[244]!==ye||t[245]!==Ee||t[246]!==De||t[247]!==Oe||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:[ne,M,ae,pe,z,B,V,ge,_e,H,ye,Ee,De,Oe,rt]})}),t[234]=ne,t[235]=M,t[236]=ae,t[237]=pe,t[238]=z,t[239]=B,t[240]=V,t[241]=ge,t[242]=_e,t[243]=H,t[244]=ye,t[245]=Ee,t[246]=De,t[247]=Oe,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,W.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,W.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(C,{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-DN3CQgIq.js → binary-plugins-DGIF2ZAv.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-3qRsLZuX.js";import{Da as o,Ea as s}from"./index-CGbKTCST.js";import{t as c}from"./preview-open-alternatives-CeqtArlZ.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-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};
|