@xopcai/xopc 0.0.104 → 0.0.105
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/agents-XzgIVKcI.js +396 -0
- package/dist/gateway/static/root/assets/{apps-page-L-IwQTe0.js → apps-page-B7Us3RMl.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BgeV6fzw.js +1 -0
- package/dist/gateway/static/root/assets/cron-page-DKGHEeAU.js +1 -0
- package/dist/gateway/static/root/assets/{dist-C6vclgEL.js → dist-DJDkNhu5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D4JYAbsX.js → extension-debug-page-DI1XJTJi.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-_T62gi6e.js → extension-page-SuafGTT_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CkJbjyM-.js → extension-settings-page-cKmGax9v.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-B5aiIguv.js → fetch-CkvRO30i.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DqmLXhs6.js → gateway-startup-retry-BkKyRDrF.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-HwJV1K_Y.js → heartbeat-config-api-CRiDcxtt.js} +1 -1
- package/dist/gateway/static/root/assets/index-50FVtgXU.js +4845 -0
- package/dist/gateway/static/root/assets/{logs-page-DsjtTjBy.js → logs-page-DM8o5-Bm.js} +2 -2
- package/dist/gateway/static/root/assets/{note-detail-page-B2V7RhgD.js → note-detail-page-j53jtvq9.js} +54 -54
- package/dist/gateway/static/root/assets/{note-time-BG8GCTr4.js → note-time-Ck2H2Qpw.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-xrcVBQ6Z.js → notes-page-CsWIw35Q.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-S-QUvhul.js → schema-form-BvmGNxiJ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CLPsbyOW.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-gate-DujQl9c7.js → settings-advanced-gate-DRdayl8P.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-r1V7dRV6.js → settings-form-section-BlIYg2gZ.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-CRGHT_bm.js +3 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DOFy0FNt.js → share-preview-page-BlT6Akvk.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-Ce-RIH2y.js +2 -0
- package/dist/gateway/static/root/assets/{theme-store-Bo3j5Ovv.js → theme-store-DYgVdRB4.js} +1 -1
- package/dist/gateway/static/root/assets/url-DPEStU4M.js +3 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-AjmUAlEQ.js → voice-api-key-field-CJGTidqc.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-page.utils-DLEJ92gK.js → workflow-page.utils-_sjXCMvi.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-o63aaARK.js +27 -0
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/context/workspace-seed.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js.map +1 -1
- package/dist/src/agent/prompt/memory/index.js +30 -2
- package/dist/src/agent/prompt/memory/index.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
- package/dist/src/agent/service/direct-turn-helpers.js +5 -2
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +2 -0
- package/dist/src/agent/service/process-direct-streaming.js +15 -1
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service.js +2 -1
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/service.types.d.ts +3 -0
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/source-context/index.d.ts +2 -0
- package/dist/src/agent/source-context/index.js +3 -0
- package/dist/src/agent/source-context/injector.d.ts +3 -0
- package/dist/src/agent/source-context/injector.js +36 -0
- package/dist/src/agent/source-context/injector.js.map +1 -0
- package/dist/src/agent/source-context/types.d.ts +19 -0
- package/dist/src/agent/source-context/types.js +10 -0
- package/dist/src/agent/source-context/types.js.map +1 -0
- package/dist/src/agent/tools/factory.js +5 -5
- package/dist/src/agent/tools/index.js +3 -3
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/shell.js +1 -1
- package/dist/src/agent/tools/web-extract.js +2 -2
- package/dist/src/agent/tools/web.js +1 -1
- package/dist/src/browser/actions/extension-registry-bridge.js +1 -1
- package/dist/src/browser/actions/registry.js +2 -2
- package/dist/src/browser/cdp-local-launcher.js +1 -1
- package/dist/src/browser/index.js +3 -3
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/browser/providers/cloakbrowser.js +1 -1
- package/dist/src/cli/commands/browser-cli-helpers.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/paths.d.ts +1 -0
- package/dist/src/config/paths.js +5 -1
- package/dist/src/config/paths.js.map +1 -1
- package/dist/src/document-understanding/extract.d.ts +13 -0
- package/dist/src/document-understanding/extract.js +63 -0
- package/dist/src/document-understanding/extract.js.map +1 -0
- package/dist/src/gateway/hono/routes/notes.js +46 -27
- package/dist/src/gateway/hono/routes/notes.js.map +1 -1
- package/dist/src/gateway/service.js +11 -0
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/notes/agent-context.d.ts +40 -0
- package/dist/src/notes/agent-context.js +383 -0
- package/dist/src/notes/agent-context.js.map +1 -0
- package/dist/src/notes/index.d.ts +2 -0
- package/dist/src/notes/index.js +2 -1
- package/dist/src/notes/service.d.ts +5 -0
- package/dist/src/notes/service.js +22 -0
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/notes/store.js +2 -0
- package/dist/src/notes/store.js.map +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/005_add_note_agent_contexts.sql +10 -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.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/note-agent-context-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/note-agent-context-repository.js +35 -0
- package/dist/src/storage/sqlite/note-agent-context-repository.js.map +1 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-CvsBrBfi.js +0 -396
- package/dist/gateway/static/root/assets/channels-settings-D95KuPeP.js +0 -1
- package/dist/gateway/static/root/assets/cron-page-CfkWXDAI.js +0 -1
- package/dist/gateway/static/root/assets/index-DvTb6wNR.js +0 -4845
- package/dist/gateway/static/root/assets/sessions-page-CrQer6Au.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-C9nrONQ2.js +0 -3
- package/dist/gateway/static/root/assets/skills-page-DmTsrs_a.js +0 -2
- package/dist/gateway/static/root/assets/url-WgQIjFZu.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BnjjKrM1.js +0 -27
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a,t as o}from"./url-WgQIjFZu.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./circle-check-C23XjkUj.js";import{a as l,n as u,t as d}from"./fetch-B5aiIguv.js";import{Cr as f,Da as p,Er as m,Ir as h,Qr as g,Sr as _,Tr as v,Wi as y,Xo as b,Zo as x,bn as S,br as C,ci as w,ea as T,ji as E,k as D,nn as O,pr as k,ra as A,rn as j,si as M,so as N,tn as P,ui as F,wr as ee,xr as I,yn as L}from"./index-DvTb6wNR.js";import{t as R}from"./schema-form-S-QUvhul.js";import{t as z}from"./browser-BLJWD7WI.js";var B=n(),V=e(z(),1),H=e(t(),1),U=r();function W(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}async function G(e){let t=await d(o(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function K(e){return e?.type===`poll`&&e.phase===`done`}function q(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function J(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function Y(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function te({entry:e,locale:t,messages:n,onChanged:r,autoStartPrimary:i=!1,compact:a=!1}){let o=(0,H.useMemo)(()=>W(e),[e]),s=(0,H.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[l,u]=(0,H.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,H.useEffect)(()=>{u({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let d=(0,H.useCallback)(async(n,i)=>{u(e=>({...e,busy:!0,error:null}));try{let a=await G({channelId:e.id,actionId:n,locale:t,input:i});u(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.sessionKey?{actionId:a.statusAction,sessionKey:a.sessionKey,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){u(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,H.useEffect)(()=>{!i||!o||o[1].result!==`qr`||l.payload||l.busy||l.error||d(o[0])},[i,o,d,l.busy,l.error,l.payload]),(0,H.useEffect)(()=>{let t=J(l.payload,e.id);if(!t){u(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return u(e=>e.generatedQr?{...e,generatedQr:null}:e),V.toDataURL(t,{width:220,margin:1}).then(e=>{n||u(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,l.payload]),(0,H.useEffect)(()=>{let n=l.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||G({channelId:e.id,actionId:n.actionId,locale:t,input:{sessionKey:n.sessionKey}}).then(async e=>{i||(u(t=>({...t,payload:e,poll:K(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),K(e)&&window.clearInterval(a))}).catch(e=>{i||u(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,l.poll]);let f=o?.[1].label??(e.configured?n.reconnect:n.connect),m=e.actions?.[`doctor.run`]?.label??n.diagnose,h=q(l.payload),g=J(l.payload,e.id),_=g?l.generatedQr:Y(l.payload),v=l.payload?.type===`form`?l.payload:null,y=l.payload?.type===`diagnostics`?l.payload.checks:null;return(0,U.jsxs)(`div`,{className:a?`space-y-3`:`rounded-lg border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsxs)(`div`,{className:w(`flex flex-wrap items-start gap-3`,a?`justify-end`:`justify-between`),children:[a?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o?(0,U.jsxs)(M,{type:`button`,variant:`primary`,disabled:l.busy,onClick:()=>void d(o[0]),children:[l.busy?(0,U.jsx)(p,{className:`size-4 animate-spin`}):(0,U.jsx)(A,{className:`size-4`}),f]}):null,e.actions?.[`doctor.run`]?(0,U.jsxs)(M,{type:`button`,variant:`secondary`,disabled:l.busy,onClick:()=>void d(`doctor.run`),children:[(0,U.jsx)(E,{className:`size-4`}),m]}):null]})]}),h?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:h}):null,l.error?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:l.error}):null,_?(0,U.jsxs)(`div`,{className:w(`flex flex-wrap items-start gap-4`,a?`justify-center`:`mt-4`),children:[(0,U.jsx)(`div`,{className:`rounded-lg border border-edge bg-white p-3`,children:(0,U.jsx)(`img`,{src:_,alt:`${e.label} setup QR`,className:`h-52 w-52 object-contain`})}),(0,U.jsxs)(`div`,{className:w(`max-w-sm text-sm text-fg-muted`,a&&`w-full text-center`),children:[(0,U.jsx)(`p`,{children:n.waitingConfirmation}),g?(0,U.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:g,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,U.jsx)(N,{className:`size-3.5`})]}):null]})]}):null,l.payload?.type===`poll`&&l.payload.phase===`done`?(0,U.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-sm`,children:[(0,U.jsx)(c,{className:l.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,U.jsx)(`span`,{className:l.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:l.payload.message??(l.payload.ok?n.complete:n.failed)})]}):null,v?(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsx)(R,{schema:v.schema,values:l.formDraft,onChange:e=>u(t=>({...t,formDraft:e})),disabled:l.busy,labels:s}),(0,U.jsx)(M,{type:`button`,variant:`primary`,disabled:l.busy,onClick:()=>void d(v.submitAction,l.formDraft),children:n.saveSetup})]}):null,y?(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:y.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}function ne(e,t=!1){return e===`drawer`?w(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,L):w(`fixed left-1/2 top-1/2 flex max-h-[min(90vh,52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`max-h-[min(90vh,48rem)] w-[min(calc(100%-2rem),36rem)]`,L,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`)}function re(e){let t=(0,B.c)(30),{presentation:n,open:r,onOpenChange:i,title:a,description:o,srTitle:s,srDescription:c,closeAriaLabel:l,children:u,footer:d,wide:p,headerExtra:h}=e,y=p===void 0?!1:p,b=n===`drawer`,x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,U.jsx)(f,{className:w(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),t[0]=x):x=t[0];let T;t[1]!==n||t[2]!==y?(T=ne(n,y),t[1]=n,t[2]=y,t[3]=T):T=t[3];let E;t[4]===s?E=t[5]:(E=s?(0,U.jsx)(m,{className:`sr-only`,children:s}):null,t[4]=s,t[5]=E);let D;t[6]===c?D=t[7]:(D=c?(0,U.jsx)(_,{className:`sr-only`,children:c}):null,t[6]=c,t[7]=D);let O;t[8]!==l||t[9]!==o||t[10]!==h||t[11]!==b||t[12]!==a?(O=b?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,U.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a}):null,o?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:o}):null]}),(0,U.jsx)(C,{asChild:!0,children:(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":l,children:(0,U.jsx)(F,{className:`size-5`,strokeWidth:1.75})})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(C,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:w(g,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":l,children:(0,U.jsx)(F,{className:`size-4`})})}),h]}),t[8]=l,t[9]=o,t[10]=h,t[11]=b,t[12]=a,t[13]=O):O=t[13];let k=b?`px-4 py-4`:`p-6`,A;t[14]===k?A=t[15]:(A=w(`min-h-0 flex-1 overflow-y-auto`,k),t[14]=k,t[15]=A);let j;t[16]!==u||t[17]!==A?(j=(0,U.jsx)(`div`,{className:A,children:u}),t[16]=u,t[17]=A,t[18]=j):j=t[18];let N;t[19]!==d||t[20]!==T||t[21]!==E||t[22]!==D||t[23]!==O||t[24]!==j?(N=(0,U.jsxs)(ee,{children:[x,(0,U.jsxs)(I,{className:T,onOpenAutoFocus:X,children:[E,D,O,j,d]})]}),t[19]=d,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=j,t[25]=N):N=t[25];let P;return t[26]!==i||t[27]!==r||t[28]!==N?(P=(0,U.jsx)(v,{open:r,onOpenChange:i,children:N}),t[26]=i,t[27]=r,t[28]=N,t[29]=P):P=t[29],P}function X(e){return e.preventDefault()}var ie=(0,H.memo)(function(e){let t=(0,B.c)(15),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,U.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s=n.refresh,c=n.refresh,l=r&&`animate-spin`,u;t[3]===l?u=t[4]:(u=w(`size-4`,l),t[3]=l,t[4]=u);let d;t[5]===u?d=t[6]:(d=(0,U.jsx)(T,{className:u,"aria-hidden":!0}),t[5]=u,t[6]=d);let f;t[7]!==n.refresh||t[8]!==a||t[9]!==r||t[10]!==d?(f=(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:r,title:s,"aria-label":c,onClick:a,children:d}),t[7]=n.refresh,t[8]=a,t[9]=r,t[10]=d,t[11]=f):f=t[11];let p;return t[12]!==o||t[13]!==f?(p=(0,U.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,f]}),t[12]=o,t[13]=f,t[14]=p):p=t[14],p});function ae(e){let t=(0,B.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,U.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,U.jsx)(M,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,U.jsx)(M,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,U.jsx)(M,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,U.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,U.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}function oe(e){return o(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function se(e){return(await u(oe(e))).payload?.channels??[]}function ce(e,t){let n=(0,B.c)(14),r;n[0]!==e||n[1]!==t?(r=e?oe(t):null,n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;n[3]===t?i=n[4]:(i=()=>se(t),n[3]=t,n[4]=i);let a;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},n[5]=a):a=n[5];let{data:o,error:c,isLoading:l,isValidating:u,mutate:d}=s(r,i,a),f;n[6]===o?f=n[7]:(f=o??[],n[6]=o,n[7]=f);let p;return n[8]!==c||n[9]!==l||n[10]!==u||n[11]!==d||n[12]!==f?(p={entries:f,isLoading:l,isValidating:u,error:c,mutate:d},n[8]=c,n[9]=l,n[10]=u,n[11]=d,n[12]=f,n[13]=p):p=n[13],p}function le(e){return e?o(`/api/channels/${encodeURIComponent(e)}/config`):null}async function ue(e){return(await u(o(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}async function de(){return(await u(o(`/api/config`))).payload?.config?.channels??{}}function Z(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function fe(e,t){return e.enabled&&e.runtime===`loaded`?t.hubStatusRunning:e.enabled?t.hubStatusEnabled:e.configured?t.hubStatusConfigured:t.hubStatusNotConfigured}function pe(e){return e.enabled&&e.runtime===`loaded`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e.enabled||e.configured?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`}function me(e){if(!e)return[`enabled`];let t=e.uiHints??{},n=Object.entries(t).filter(([,e])=>!Q(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e);return n.length>0?n:[`enabled`]}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function he(e,t){let n={...$(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!Q(r)||!Q(r[n]))break;let o=Q(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...$(r[n]),properties:{}}),e===t.length-1){o[n]=$(r[n]);break}i=r[n],a=o[n]}}return n}function ge(e){let t=e.properties;if(!Q(t))return!1;for(let[e,n]of Object.entries(t))Q(n)&&n.type===`object`&&ge(n)&&delete t[e];return Object.keys(t).length===0}function _e(e,t){let n=$(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!Q(i))break;if(e===t.length-1){delete i[n];break}if(!Q(i[n]))break;r=i[n]}}return ge(n),n}function ve(e){return e.type===`object`&&Q(e.properties)&&Object.keys(e.properties).length>0}function ye(e,t){let n=e;for(let e of t.split(`.`)){if(!Q(n))return;n=n[e]}return n}function be(e){let t=e.accounts;return Q(t)?Object.values(t).filter(e=>Q(e)&&e.enabled!==!1).length:+(e.configured===!0)}function xe(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Se(e,t,n){let r=[];if(t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=xe(e,ye(t,e),n);i&&r.push(i)}let a=be(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,3):e.configured?[n.hubStatusConfigured]:[]}function Ce(e,t){let n=W(e);return n?.[1].label?n[1].label:e.configured?t.manageChannel:t.startConfiguration}function we({entry:e}){let t=l(e=>e.token),[n,r]=(0,H.useState)(!1),i=(0,H.useMemo)(()=>{if(!e.ui?.icon||n)return null;let r=new URL(o(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Z(e.ui.icon)}`));return t?.trim()&&r.searchParams.set(`token`,t.trim()),r.toString()},[n,e.extensionId,e.ui?.icon,t]);return(0,U.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:i?(0,U.jsx)(`img`,{src:i,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>r(!0)}):(0,U.jsx)(k,{sourceChannel:e.id,className:`size-7`})})}function Te(e){let t=(0,B.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,o;t[0]===i?o=t[1]:(o=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=o);let s=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,c=r&&`cursor-not-allowed opacity-60`,l;t[2]!==s||t[3]!==c?(l=w(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,s,c),t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=n?`translate-x-5`:`translate-x-0.5`,d;t[5]===u?d=t[6]:(d=w(`size-5 rounded-full bg-white shadow-surface transition-transform`,u),t[5]=u,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,U.jsx)(`span`,{className:d}),t[7]=d,t[8]=f);let p;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==l||t[14]!==f?(p=(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:o,className:l,children:f}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function Ee(e){let t=(0,B.c)(64),{entry:n,config:r,busy:i,ch:a,onOpen:o,onToggle:s}=e,c,l,u,d,f,m,h;if(t[0]!==i||t[1]!==a||t[2]!==r||t[3]!==n||t[4]!==o||t[5]!==s){let e=Se(n,r,a);m=`flex min-h-[15.5rem] flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-surface transition-colors hover:border-edge`;let p;t[13]===n?p=t[14]:(p=(0,U.jsx)(we,{entry:n}),t[13]=n,t[14]=p);let g;t[15]===n.label?g=t[16]:(g=(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[15]=n.label,t[16]=g);let _;t[17]===n?_=t[18]:(_=w(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,pe(n)),t[17]=n,t[18]=_);let v;t[19]!==a||t[20]!==n?(v=fe(n,a),t[19]=a,t[20]=n,t[21]=v):v=t[21];let y;t[22]!==_||t[23]!==v?(y=(0,U.jsx)(`span`,{className:_,children:v}),t[22]=_,t[23]=v,t[24]=y):y=t[24];let b;t[25]!==y||t[26]!==g?(b=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[g,y]}),t[25]=y,t[26]=g,t[27]=b):b=t[27];let x;t[28]!==b||t[29]!==p?(x=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[p,b]}),t[28]=b,t[29]=p,t[30]=x):x=t[30];let S=n.enabled===!0,C;t[31]!==a.toggleChannel||t[32]!==n.label?(C=a.toggleChannel.replace(`{{channel}}`,n.label),t[31]=a.toggleChannel,t[32]=n.label,t[33]=C):C=t[33];let T;t[34]!==i||t[35]!==s||t[36]!==S||t[37]!==C?(T=(0,U.jsx)(Te,{checked:S,disabled:i,label:C,onToggle:s}),t[34]=i,t[35]=s,t[36]=S,t[37]=C,t[38]=T):T=t[38],t[39]!==x||t[40]!==T?(h=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[x,T]}),t[39]=x,t[40]=T,t[41]=h):h=t[41],c=`button`,l=o,u=`mt-5 min-h-[4.5rem] text-left`;let E=n.description??n.id;t[42]===E?d=t[43]:(d=(0,U.jsx)(`p`,{className:`line-clamp-3 text-sm leading-6 text-fg-muted`,children:E}),t[42]=E,t[43]=d),f=e.length>0?(0,U.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(De)}):null,t[0]=i,t[1]=a,t[2]=r,t[3]=n,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=m,t[12]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],m=t[11],h=t[12];let g;t[44]!==c||t[45]!==l||t[46]!==u||t[47]!==d||t[48]!==f?(g=(0,U.jsxs)(`button`,{type:c,onClick:l,className:u,children:[d,f]}),t[44]=c,t[45]=l,t[46]=u,t[47]=d,t[48]=f,t[49]=g):g=t[49];let _;t[50]===i?_=t[51]:(_=i?(0,U.jsx)(p,{className:`size-4 animate-spin`}):null,t[50]=i,t[51]=_);let v;t[52]!==a||t[53]!==n?(v=Ce(n,a),t[52]=a,t[53]=n,t[54]=v):v=t[54];let y;t[55]!==o||t[56]!==v||t[57]!==_?(y=(0,U.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,U.jsxs)(M,{type:`button`,variant:`primary`,className:`w-full rounded-2xl py-2.5`,onClick:o,children:[_,v]})}),t[55]=o,t[56]=v,t[57]=_,t[58]=y):y=t[58];let b;return t[59]!==y||t[60]!==m||t[61]!==h||t[62]!==g?(b=(0,U.jsxs)(`article`,{className:m,children:[h,g,y]}),t[59]=y,t[60]=m,t[61]=h,t[62]=g,t[63]=b):b=t[63],b}function De(e){return(0,U.jsx)(`p`,{children:e},e)}function Oe(){let e=i(e=>e.language),t=a(e),n=l(e=>!!e.token),r=b(),{channelId:c}=x(),u=j(c),f=ce(n,e),p=f.entries,{data:m={},mutate:g}=s(n?`channels-config-map`:null,de,{revalidateOnFocus:!1}),_=h(e=>e.setPageHeader),v=h(e=>e.clearPageHeader),S=(0,H.useMemo)(()=>p.find(e=>e.id===u),[u,p]),{data:C,mutate:T}=s(n&&S?le(S.id):null,()=>ue(S.id)),[E,k]=(0,H.useState)(null),[A,M]=(0,H.useState)(!1),[F,ee]=(0,H.useState)(null),[I,L]=(0,H.useState)(null),z=E??C??{},B=t.channelsSettings,V=(0,H.useMemo)(()=>S?.configSchema??{type:`object`,properties:{}},[S?.configSchema]),G=(0,H.useMemo)(()=>me(S),[S]),K=(0,H.useMemo)(()=>he(V,G),[G,V]),q=(0,H.useMemo)(()=>_e(V,G),[G,V]),J=(0,H.useMemo)(()=>({defaultBooleanLabel:B.schemaBooleanDefault,unsupportedArrayType:B.schemaUnsupportedArrayType,arrayAddPlaceholder:B.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>B.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[B]),Y=(0,H.useMemo)(()=>n?(0,U.jsx)(ie,{ch:B,refreshing:f.isValidating,saveOk:!1,onRefresh:()=>void f.mutate()}):null,[f,B,n]);(0,H.useLayoutEffect)(()=>(_({startExtra:null,main:(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.settingsSections.channels})}),end:Y}),()=>v()),[v,Y,t.settingsSections.channels,_]);let ne=(0,H.useCallback)(e=>{r(O(e)),k(null),L(null)},[r]),X=(0,H.useCallback)(()=>{r(P),k(null),L(null)},[r]),oe=(0,H.useCallback)(async()=>{if(!S||!E)return!1;M(!0),L(null);try{let e=await d(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[S.id]:E}})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error?.message??e.statusText)}return await T(E,!1),await g(),await f.mutate(),k(null),!0}catch(e){return L(e instanceof Error?e.message:String(e)),!1}finally{M(!1)}},[S,f,E,g,T]),se=(0,H.useCallback)(async e=>{ee(e.id),L(null);try{let t=await d(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[e.id]:{enabled:e.enabled!==!0}}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await f.mutate(),await g(),S?.id===e.id&&await T()}catch(e){L(e instanceof Error?e.message:String(e))}finally{ee(null)}},[S?.id,f,g,T]),Z=S?.ui?.modal,Q=Z?.placement!==`replace-config`;return n?(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-6`,children:[f.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:B.loadingChannels}):f.error?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(f.error)}):(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:p.map(e=>(0,U.jsx)(Ee,{entry:e,config:m[e.id]?.config,busy:F===e.id,ch:B,onOpen:()=>ne(e.id),onToggle:()=>void se(e)},e.id))}),I?(0,U.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:I}):null,(0,U.jsx)(re,{presentation:`modal`,open:!!S,onOpenChange:e=>{e||X()},closeAriaLabel:B.close,srTitle:S?.label??B.selectChannel,srDescription:S?.description,wide:!0,footer:S?(0,U.jsx)(ae,{ch:B,dirty:!!E,saving:A,onCancel:X,onDiscard:()=>k(null),onSave:oe}):null,children:S?(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-3 py-3`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,U.jsx)(we,{entry:S}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:S.label}),(0,U.jsx)(`span`,{className:w(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,pe(S)),children:fe(S,B)})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:W(S)?.[1].result===`qr`?B.scanLoginHint.replace(`{{channel}}`,S.label):S.description}),S.docsPath?(0,U.jsxs)(`a`,{href:S.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[B.docs,(0,U.jsx)(N,{className:`size-3.5`})]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,U.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:B.enabledLabel}),(0,U.jsx)(Te,{checked:S.enabled===!0,disabled:F===S.id,label:B.toggleChannel.replace(`{{channel}}`,S.label),onToggle:()=>void se(S)})]})]})}),Z?.entrypoint&&Z.placement===`before-config`?(0,U.jsx)(D,{extensionId:S.extensionId,extensionName:S.label,entrypoint:Z.entrypoint,permissions:Z.permissions,minHeight:Z.minHeight,maxHeight:Z.maxHeight,initialData:{channelId:S.id,entry:S,config:z}}):null,Z?.placement===`replace-config`?null:(0,U.jsx)(te,{entry:S,locale:e,messages:B,autoStartPrimary:!0,compact:!0,onChanged:async()=>{await T(),await f.mutate(),await g()}},S.id),Z?.entrypoint&&Z.placement!==`before-config`?(0,U.jsx)(D,{extensionId:S.extensionId,extensionName:S.label,entrypoint:Z.entrypoint,permissions:Z.permissions,minHeight:Z.minHeight,maxHeight:Z.maxHeight,initialData:{channelId:S.id,entry:S,config:z}}):null,Q?(0,U.jsxs)(`section`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:B.basicConfiguration}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B.basicConfigurationHint})]}),(0,U.jsx)(R,{schema:K,values:z,onChange:e=>k(e),disabled:A,labels:J})]}):null,Q&&ve(q)?(0,U.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-panel`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(y,{className:`size-4 text-fg-muted`}),B.advancedConfiguration]}),(0,U.jsx)(`div`,{className:`border-t border-edge-subtle p-4`,children:(0,U.jsx)(R,{schema:q,values:z,onChange:e=>k(e),disabled:A,labels:J})})]}):null,I?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:I}):null]}):null})]}):(0,U.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:B.tokenRequired})})}export{Oe as ChannelsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a,t as o}from"./url-WgQIjFZu.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{i as l}from"./theme-store-Bo3j5Ovv.js";import{a as u,n as d}from"./fetch-B5aiIguv.js";import{i as f,n as p,r as m}from"./gateway-startup-retry-DqmLXhs6.js";import{$a as h,$r as g,Ao as _,C as v,Cr as y,Da as b,Dt as x,Er as S,F as C,Fn as w,I as T,Ia as E,Ir as D,L as O,Mo as k,Oo as A,P as j,Pi as M,Pn as N,Qo as P,Rr as F,Sa as I,Sr as L,Tr as R,Ua as z,Wi as B,Yr as V,_o as H,ai as U,br as W,ca as G,ci as K,cr as q,dr as ee,ea as te,fr as ne,j as re,jo as J,lo as ie,ni as Y,o as ae,oa as oe,oi as se,oo as ce,qi as le,qo as ue,ri as de,si as X,ui as fe,wr as pe,xi as me,xr as he,yr as ge}from"./index-DvTb6wNR.js";import{n as _e,t as ve}from"./settings-form-section-r1V7dRV6.js";import{C as ye,E as be,S as xe,T as Se,_ as Ce,a as we,b as Te,c as Ee,d as De,f as Oe,g as ke,h as Ae,l as je,m as Me,n as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,u as ze,v as Be,w as Ve,x as He,y as Ue}from"./settings-advanced-gate-DujQl9c7.js";import{s as We,t as Ge}from"./heartbeat-config-api-HwJV1K_Y.js";import{m as Ke,p as qe,t as Je}from"./workflow-page.utils-DLEJ92gK.js";import{i as Ye,n as Xe,o as Ze,r as Qe,t as $e}from"./dist-C6vclgEL.js";var Z=e(t(),1),Q=n(),$=r();function et(e){let t=(0,Q.c)(25),{open:n,onOpenChange:r,action:i,c:a,onDismiss:o,onConfirm:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),t[0]=c):c=t[0];let l=i===`delete`?a.delete:a.runNow,u;t[1]===l?u=t[2]:(u=(0,$.jsx)(S,{className:`text-base font-semibold text-fg`,children:l}),t[1]=l,t[2]=u);let d=i===`delete`?a.confirmDelete:a.confirmRun,f;t[3]===d?f=t[4]:(f=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[3]=d,t[4]=f);let p;t[5]!==a.cancel||t[6]!==o?(p=(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:o,children:a.cancel}),t[5]=a.cancel,t[6]=o,t[7]=p):p=t[7];let m=i===`delete`?`bg-red-600 hover:bg-red-700`:void 0,h;t[8]===s?h=t[9]:(h=()=>void s(),t[8]=s,t[9]=h);let g=i===`delete`?a.delete:a.runNow,_;t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,$.jsx)(X,{type:`button`,variant:`primary`,className:m,onClick:h,children:g}),t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==_||t[15]!==p?(v=(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[p,_]}),t[14]=_,t[15]=p,t[16]=v):v=t[16];let b;t[17]!==v||t[18]!==u||t[19]!==f?(b=(0,$.jsxs)(pe,{children:[c,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(he,{className:`xopc-dialog-content-pane pointer-events-auto relative w-full max-w-md rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[u,f,v]})})]}),t[17]=v,t[18]=u,t[19]=f,t[20]=b):b=t[20];let x;return t[21]!==r||t[22]!==n||t[23]!==b?(x=(0,$.jsx)(R,{open:n,onOpenChange:r,children:b}),t[21]=r,t[22]=n,t[23]=b,t[24]=x):x=t[24],x}var tt={enabled:!0,maxConcurrentJobs:5,defaultTimezone:`UTC`,historyRetentionDays:7,enableMetrics:!0};function nt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rt(e){let t=nt(e)?e:{},n=nt(t.cron)?t.cron:{};return{enabled:n.enabled!==!1,maxConcurrentJobs:typeof n.maxConcurrentJobs==`number`&&Number.isFinite(n.maxConcurrentJobs)?Math.max(1,Math.min(100,Math.floor(n.maxConcurrentJobs))):tt.maxConcurrentJobs,defaultTimezone:typeof n.defaultTimezone==`string`&&n.defaultTimezone.trim()?n.defaultTimezone.trim():tt.defaultTimezone,historyRetentionDays:typeof n.historyRetentionDays==`number`&&Number.isFinite(n.historyRetentionDays)?Math.max(1,Math.min(365,Math.floor(n.historyRetentionDays))):tt.historyRetentionDays,enableMetrics:n.enableMetrics!==!1}}async function it(e){await d(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({cron:e})}),m()}function at(){return K(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,se,`dark:border-edge`)}function ot(){return{form:null,baseline:null,saving:!1,error:null,saveOk:!1,dirty:!1}}function st(e,t){switch(t.type){case`sync`:return{...e,form:structuredClone(t.parsed),baseline:structuredClone(t.parsed),saveOk:!1,dirty:!1};case`patch`:return e.form?{...e,form:{...e.form,...t.patch},dirty:!0,saveOk:!1}:e;case`discard`:return e.baseline?{...e,form:structuredClone(e.baseline),dirty:!1}:e;case`saveStart`:return{...e,saving:!0,error:null};case`saveSuccess`:return e.form?{...e,saving:!1,baseline:structuredClone(e.form),dirty:!1,saveOk:!0}:{...e,saving:!1};case`saveError`:return{...e,saving:!1,error:t.error};case`clearSaveOk`:return{...e,saveOk:!1}}}function ct(e){let t=(0,Q.c)(83),{hasToken:n}=e,r=i(lt),o;t[0]===r?o=t[1]:(o=a(r),t[0]=r,t[1]=o);let s=o.cron.globals,{data:c,isLoading:l}=f(n),u;t[2]===c?u=t[3]:(u=c?.payload?.config===void 0?null:structuredClone(rt(c.payload.config)),t[2]=c,t[3]=u);let d=u,[p,m]=(0,Z.useReducer)(st,void 0,ot),h=(0,Z.useRef)(null),g,_;t[4]!==n||t[5]!==d||t[6]!==p.dirty?(g=()=>{!n||d===null||p.dirty||h.current===d||(h.current=d,m({type:`sync`,parsed:d}))},_=[n,d,p.dirty],t[4]=n,t[5]=d,t[6]=p.dirty,t[7]=g,t[8]=_):(g=t[7],_=t[8]),(0,Z.useEffect)(g,_);let v;t[9]!==p.baseline||t[10]!==p.form?(v=p.form&&p.baseline&&JSON.stringify(p.form)!==JSON.stringify(p.baseline),t[9]=p.baseline,t[10]=p.form,t[11]=v):v=t[11];let y=!!v,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{m({type:`patch`,patch:e})},t[12]=x):x=t[12];let S=x,C;t[13]!==s.saveError||t[14]!==p.form||t[15]!==p.saving?(C=async()=>{if(!(!p.form||p.saving)){m({type:`saveStart`});try{await it(p.form),m({type:`saveSuccess`}),window.setTimeout(()=>m({type:`clearSaveOk`}),2500)}catch(e){let t=e;m({type:`saveError`,error:t instanceof Error?t.message:s.saveError})}}},t[13]=s.saveError,t[14]=p.form,t[15]=p.saving,t[16]=C):C=t[16];let w=C;if(!n||!p.form){if(l){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(b,{className:`size-4 animate-spin`}),t[17]=e):e=t[17];let n;return t[18]===s.loading?n=t[19]:(n=(0,$.jsx)(ve,{children:(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[e,s.loading]})}),t[18]=s.loading,t[19]=n),n}return null}let T;t[20]!==s.hint||t[21]!==s.title?(T=(0,$.jsx)(_e,{icon:H,title:s.title,subtitle:s.hint}),t[20]=s.hint,t[21]=s.title,t[22]=T):T=t[22];let E;t[23]!==s.saved||t[24]!==p.saveOk?(E=p.saveOk?(0,$.jsx)(`span`,{className:`text-sm text-fg-muted`,children:s.saved}):null,t[23]=s.saved,t[24]=p.saveOk,t[25]=E):E=t[25];let D=!y||p.saving,O;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>m({type:`discard`}),t[26]=O):O=t[26];let k;t[27]!==s.discard||t[28]!==D?(k=(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:D,onClick:O,children:s.discard}),t[27]=s.discard,t[28]=D,t[29]=k):k=t[29];let A=!y||p.saving,j;t[30]===w?j=t[31]:(j=()=>void w(),t[30]=w,t[31]=j);let M=p.saving?s.saving:s.save,N;t[32]!==A||t[33]!==j||t[34]!==M?(N=(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:A,onClick:j,children:M}),t[32]=A,t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==k||t[37]!==N||t[38]!==E?(P=(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[E,k,N]}),t[36]=k,t[37]=N,t[38]=E,t[39]=P):P=t[39];let F;t[40]===p.error?F=t[41]:(F=p.error?(0,$.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:p.error}):null,t[40]=p.error,t[41]=F);let I;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>S({enabled:e.target.checked}),t[42]=I):I=t[42];let L;t[43]===p.form.enabled?L=t[44]:(L=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:p.form.enabled,onChange:I}),t[43]=p.form.enabled,t[44]=L);let R;t[45]!==s.enabled||t[46]!==L?(R=(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg sm:col-span-2`,children:[L,s.enabled]}),t[45]=s.enabled,t[46]=L,t[47]=R):R=t[47];let z=!p.form.enabled,B;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>S({maxConcurrentJobs:e}),t[48]=B):B=t[48];let V;t[49]!==s.maxConcurrent||t[50]!==z||t[51]!==p.form.maxConcurrentJobs?(V=(0,$.jsx)(ut,{label:s.maxConcurrent,value:p.form.maxConcurrentJobs,min:1,max:100,disabled:z,onChange:B}),t[49]=s.maxConcurrent,t[50]=z,t[51]=p.form.maxConcurrentJobs,t[52]=V):V=t[52];let U=!p.form.enabled,W;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>S({defaultTimezone:e}),t[53]=W):W=t[53];let G;t[54]!==s.timezone||t[55]!==U||t[56]!==p.form.defaultTimezone?(G=(0,$.jsx)(ut,{label:s.timezone,text:!0,value:p.form.defaultTimezone,disabled:U,onTextChange:W}),t[54]=s.timezone,t[55]=U,t[56]=p.form.defaultTimezone,t[57]=G):G=t[57];let K=!p.form.enabled,q;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>S({historyRetentionDays:e}),t[58]=q):q=t[58];let ee;t[59]!==s.retentionDays||t[60]!==K||t[61]!==p.form.historyRetentionDays?(ee=(0,$.jsx)(ut,{label:s.retentionDays,value:p.form.historyRetentionDays,min:1,max:365,disabled:K,onChange:q}),t[59]=s.retentionDays,t[60]=K,t[61]=p.form.historyRetentionDays,t[62]=ee):ee=t[62];let te=!p.form.enabled,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>S({enableMetrics:e.target.checked}),t[63]=ne):ne=t[63];let re;t[64]!==te||t[65]!==p.form.enableMetrics?(re=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:p.form.enableMetrics,disabled:te,onChange:ne}),t[64]=te,t[65]=p.form.enableMetrics,t[66]=re):re=t[66];let J;t[67]!==s.metrics||t[68]!==re?(J=(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[re,s.metrics]}),t[67]=s.metrics,t[68]=re,t[69]=J):J=t[69];let ie;t[70]!==V||t[71]!==G||t[72]!==ee||t[73]!==J?(ie=(0,$.jsxs)(Re,{children:[V,G,ee,J]}),t[70]=V,t[71]=G,t[72]=ee,t[73]=J,t[74]=ie):ie=t[74];let Y;t[75]!==R||t[76]!==ie?(Y=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[R,ie]}),t[75]=R,t[76]=ie,t[77]=Y):Y=t[77];let ae;return t[78]!==P||t[79]!==F||t[80]!==Y||t[81]!==T?(ae=(0,$.jsxs)(ve,{children:[T,P,F,Y]}),t[78]=P,t[79]=F,t[80]=Y,t[81]=T,t[82]=ae):ae=t[82],ae}function lt(e){return e.language}function ut(e){let t=(0,Q.c)(13),{label:n,value:r,min:i,max:a,disabled:o,text:s,onChange:c,onTextChange:l}=e,u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]!==o||t[3]!==a||t[4]!==i||t[5]!==c||t[6]!==l||t[7]!==s||t[8]!==r?(d=s?(0,$.jsx)(`input`,{className:K(at(),`font-mono text-xs`),value:String(r),disabled:o,onChange:e=>l?.(e.target.value)}):(0,$.jsx)(`input`,{type:`number`,min:i,max:a,disabled:o,className:K(at(),`max-w-xs font-mono text-xs`),value:typeof r==`number`?r:0,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&c&&i!==void 0&&a!==void 0&&c(Math.max(i,Math.min(a,Math.floor(t))))}}),t[2]=o,t[3]=a,t[4]=i,t[5]=c,t[6]=l,t[7]=s,t[8]=r,t[9]=d):d=t[9];let f;return t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{children:[u,d]}),t[10]=u,t[11]=d,t[12]=f):f=t[12],f}var dt=`*/5 * * * *`,ft=2100*1e3;function pt(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function mt(e){let t=pt(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function ht(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function gt(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function _t(e){let t=e?.trim();t&&(window.location.hash=`/workflows?run=${encodeURIComponent(t)}`)}function vt(e){return K(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,Y,e&&`cursor-not-allowed opacity-60`)}function yt(){return K(U,de)}var bt=K(U,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),xt=K(U,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function St(e){return e===`settings`?`settings`:e===`system`||e===`systemTasks`?`systemTasks`:e===`history`?`history`:`myTasks`}function Ct(e){return e===`myTasks`?null:e===`systemTasks`?`system`:e===`history`?`history`:`settings`}function wt(e){switch(e){case`success`:return`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`;case`failed`:return`bg-red-500/15 text-red-800 dark:text-red-300`;case`running`:return`bg-accent/15 text-accent`;case`cancelled`:return`bg-surface-hover text-fg-muted`;default:return`bg-surface-hover text-fg-muted`}}function Tt(e,t){return e.payload.kind===`workflowRun`?t.taskKindWorkflowRun:e.payload.kind===`agentTurn`?t.taskKindMessage:t.modeDirectOption}function Et(e){return e.length===0?null:e.find(e=>e.status===`failed`)?.id??e[0]?.id??null}function Dt(e){let t=(0,Q.c)(56),{row:n,expanded:r,onToggle:i,c:a,statusLabels:o}=e,s=n.error||n.summary||n.output||``,c;t[0]===s?c=t[1]:(c=s.trim(),t[0]=s,t[1]=c);let l=c,u=l.length>0,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover`,children:(0,$.jsx)(H,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0})}),t[2]=d):d=t[2];let f=n.startedAt,p;t[3]===n.startedAt?p=t[4]:(p=Se(n.startedAt),t[3]=n.startedAt,t[4]=p);let m;t[5]!==n.startedAt||t[6]!==p?(m=(0,$.jsx)(`time`,{className:`text-sm font-medium text-fg`,dateTime:f,children:p}),t[5]=n.startedAt,t[6]=p,t[7]=m):m=t[7];let g;t[8]===n.status?g=t[9]:(g=K(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,wt(n.status)),t[8]=n.status,t[9]=g);let v;t[10]!==n.status||t[11]!==o?(v=Ue(n.status,o),t[10]=n.status,t[11]=o,t[12]=v):v=t[12];let y;t[13]!==g||t[14]!==v?(y=(0,$.jsx)(`span`,{className:g,children:v}),t[13]=g,t[14]=v,t[15]=y):y=t[15];let b;t[16]===n.duration?b=t[17]:(b=He(n.duration),t[16]=n.duration,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:b}),t[18]=b,t[19]=x);let S;t[20]!==x||t[21]!==m||t[22]!==y?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m,y,x]}),t[20]=x,t[21]=m,t[22]=y,t[23]=S):S=t[23];let C;t[24]!==l||t[25]!==r||t[26]!==u?(C=!r&&u?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:l}):null,t[24]=l,t[25]=r,t[26]=u,t[27]=C):C=t[27];let w;t[28]!==l||t[29]!==r||t[30]!==u?(w=r&&u?(0,$.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-edge-subtle bg-surface-panel/80 p-2.5 font-mono text-xs leading-relaxed text-fg-muted`,children:l}):null,t[28]=l,t[29]=r,t[30]=u,t[31]=w):w=t[31];let T;t[32]!==S||t[33]!==C||t[34]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[d,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C,w]})]}),t[32]=S,t[33]=C,t[34]=w,t[35]=T):T=t[35];let E;t[36]!==a||t[37]!==r||t[38]!==u||t[39]!==i?(E=u?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:i,children:[(0,$.jsx)(_,{className:K(`size-3.5 transition-transform`,r&&`rotate-180`),strokeWidth:1.75,"aria-hidden":!0}),r?a.detailCollapseRun:a.detailExpandRun]}):null,t[36]=a,t[37]=r,t[38]=u,t[39]=i,t[40]=E):E=t[40];let D;t[41]!==a||t[42]!==n.workflowRunId?(D=n.workflowRunId?.trim()?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:a.openWorkflowTitle,onClick:()=>_t(n.workflowRunId),children:[(0,$.jsx)(h,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),a.openWorkflow]}):null,t[41]=a,t[42]=n.workflowRunId,t[43]=D):D=t[43];let O;t[44]!==a||t[45]!==n.sessionKey?(O=n.sessionKey?.trim()?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:a.openChatTitle,onClick:()=>gt(n.sessionKey),children:[(0,$.jsx)(I,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),a.openChat]}):null,t[44]=a,t[45]=n.sessionKey,t[46]=O):O=t[46];let k;t[47]!==D||t[48]!==O?(k=(0,$.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[D,O]}),t[47]=D,t[48]=O,t[49]=k):k=t[49];let A;t[50]!==E||t[51]!==k?(A=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle px-3 py-2 dark:border-edge-subtle`,children:[E,k]}),t[50]=E,t[51]=k,t[52]=A):A=t[52];let j;return t[53]!==T||t[54]!==A?(j=(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:[T,A]}),t[53]=T,t[54]=A,t[55]=j):j=t[55],j}function Ot(e){let t=(0,Q.c)(13),{icon:n,label:r,value:i,valueClassName:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[o,r]}),t[2]=r,t[3]=o,t[4]=s):s=t[4];let c;t[5]===a?c=t[6]:(c=K(`mt-1 truncate text-sm font-medium text-fg`,a),t[5]=a,t[6]=c);let l;t[7]!==c||t[8]!==i?(l=(0,$.jsx)(`p`,{className:c,children:i}),t[7]=c,t[8]=i,t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==l?(u=(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-2.5 dark:border-edge-subtle`,children:[s,l]}),t[10]=s,t[11]=l,t[12]=u):u=t[12],u}function kt({open:e,onDismiss:t,detailJob:n,detailLoading:r,detailHistory:i,c:a,localeTag:o,scheduleBadgeLabels:s,chatWorkingDirNotSet:l,statusLabels:u,onEdit:d,onRunNow:f,onToggle:p,onDelete:m}){let[h,g]=(0,Z.useState)(!1),[v,x]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),T=(0,Z.useMemo)(()=>{let e=0,t=0;for(let n of i)n.status===`success`&&(e+=1),n.status===`failed`&&(t+=1);return{success:e,failed:t}},[i]),E=i[0]??null;(0,Z.useEffect)(()=>{if(!e){g(!1),x(null),w(!1);return}x(Et(i))},[e,n?.id,i]);let D=(0,Z.useCallback)(async()=>{n?.schedule&&await V(n.schedule)&&(w(!0),window.setTimeout(()=>w(!1),1500))},[n?.schedule]),O=n?Ve(n,o,s):`—`;return(0,$.jsx)(R,{open:e,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(pe,{children:[(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(he,{className:K(`xopc-dialog-content-pane pointer-events-auto relative flex w-full max-w-lg flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,`max-h-[min(85vh,44rem)]`,`dark:border-edge`),"aria-describedby":void 0,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n?.name?.trim()||n?.id||`—`}),n?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:O}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[n?(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n.enabled,"aria-label":n.enabled?a.enabled:a.disabled,className:K(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,n.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`),onClick:()=>p(n,!n.enabled),children:(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}):null,(0,$.jsx)(W,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:(0,$.jsx)(fe,{className:`size-5`,strokeWidth:1.75})})})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:r?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(b,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.scheduleLabel}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-3 dark:border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-sm font-medium leading-relaxed text-fg`,children:O}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 shrink-0 p-0`,title:a.detailCopySchedule,"aria-label":a.detailCopySchedule,onClick:()=>void D(),children:C?(0,$.jsx)(J,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75}):(0,$.jsx)(c,{className:`size-3.5`,strokeWidth:1.75})})]}),(0,$.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-subtle`,children:[a.detailCronTechnical,`: `]}),(0,$.jsx)(`code`,{className:`font-mono`,children:n.schedule})]})]})]}),(0,$.jsxs)(`section`,{"aria-label":a.statsRegion,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Ot,{icon:k,label:a.nextRun,value:n.next_run?xe(n.next_run,a.timeLabels):`—`}),(0,$.jsx)(Ot,{icon:H,label:a.detailLastRun,value:E?Ue(E.status,u):a.detailNoRecentRuns,valueClassName:E?.status===`failed`?`text-red-700 dark:text-red-300`:E?.status===`success`?`text-emerald-800 dark:text-emerald-300`:void 0})]}),i.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:a.detailRunCount.replace(`{{success}}`,String(T.success)).replace(`{{failed}}`,String(T.failed))}):null]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailWhatItDoes}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base/80 p-3 dark:border-edge-subtle`,children:[(0,$.jsx)(`div`,{className:`mb-2 inline-flex rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:Tt(n,a)}),(0,$.jsx)(`div`,{className:`min-w-0 break-words text-fg [&_.markdown-body]:text-sm [&_.markdown-body]:leading-relaxed`,children:(0,$.jsx)(N,{content:Pe(n),compact:!0,className:`text-sm`})})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base/35`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left`,"aria-expanded":h,onClick:()=>g(e=>!e),children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(B,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailRunSettings})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.detailRunSettingsHint})]}),(0,$.jsx)(_,{className:K(`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform`,h&&`rotate-180`),"aria-hidden":!0})]}),h?(0,$.jsxs)(`dl`,{className:`grid gap-3 border-t border-edge px-4 py-4 text-sm`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:a.mode}),(0,$.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.sessionTarget===`isolated`?a.modeAgentOption:a.modeDirectOption})]}),n.sessionTarget===`isolated`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:a.agentProfile}),(0,$.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.agentId?.trim()?n.agentId.trim():a.agentProfileDefault})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:a.workingDirectoryLabel}),(0,$.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:n.workingDirectory?.trim()?n.workingDirectory.trim():l})]})]}):null,n.delivery?.channel===`local`||n.sessionTarget===`isolated`&&!n.delivery?.to?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:a.deliveryTarget}),(0,$.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.delivery?.channel===`local`?a.deliveryTargetLocalChannel:a.deliveryLocalOnly})]}):n.delivery?.to?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:a.deliveryTarget}),(0,$.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,$.jsx)(`code`,{className:`text-xs`,children:n.delivery?.channel??``}),` → `,Te(n,a.channelLocal)]})]}):null,n.model?.trim()?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:a.model}),(0,$.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.model.trim()})]}):null]}):null]}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailRunHistory}),i.length>0?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.length}):null]}),i.length===0?(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-dashed border-edge-subtle px-4 py-8 text-center dark:border-edge-subtle`,children:[(0,$.jsx)(H,{className:`mx-auto size-8 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:a.noRunsYet})]}):(0,$.jsx)(`ul`,{className:`mt-2 space-y-2`,children:i.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Dt,{row:e,expanded:v===e.id,onToggle:()=>x(t=>t===e.id?null:e.id),c:a,statusLabels:u})},e.id))})]})]}):null}),n&&!r?(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(X,{type:`button`,className:`gap-1.5`,onClick:()=>f(n),children:[(0,$.jsx)(G,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),a.runNow]}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>d(n),children:a.edit}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`ml-auto text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:()=>m(n),children:[(0,$.jsx)(me,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),a.delete]})]})}):null]})})]})})}function At(e){let t=(0,Q.c)(31),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,title:s,maxWidthClass:c,clearLabel:l,onClear:u}=e,d;t[0]!==r||t[1]!==n?(d={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=d):d=t[2];let f=C(d),p;t[3]===n?p=t[4]:(p=n.trim(),t[3]=n,t[4]=p);let m=p,h=s??(m?`${m}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`),g=i||f.picking,_=o??a.notSet,v;t[5]!==c||t[6]!==f.pick||t[7]!==h||t[8]!==g||t[9]!==_||t[10]!==n?(v=(0,$.jsx)(T,{value:n,onPick:f.pick,disabled:g,placeholder:_,title:h,maxWidthClass:c}),t[5]=c,t[6]=f.pick,t[7]=h,t[8]=g,t[9]=_,t[10]=n,t[11]=v):v=t[11];let y;t[12]!==l||t[13]!==i||t[14]!==u||t[15]!==f.picking||t[16]!==m?(y=l&&m&&u?(0,$.jsx)(`button`,{type:`button`,disabled:i||f.picking,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:u,children:l}):null,t[12]=l,t[13]=i,t[14]=u,t[15]=f.picking,t[16]=m,t[17]=y):y=t[17];let b;t[18]!==v||t[19]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v,y]}),t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==f.confirmPick||t[22]!==f.hasNativePicker||t[23]!==f.modalOpen||t[24]!==f.setModalOpen||t[25]!==m||t[26]!==a?(x=f.hasNativePicker?null:(0,$.jsx)(re,{open:f.modalOpen,onOpenChange:f.setModalOpen,initialAbsolutePath:m||void 0,onConfirm:f.confirmPick,wd:a}),t[21]=f.confirmPick,t[22]=f.hasNativePicker,t[23]=f.modalOpen,t[24]=f.setModalOpen,t[25]=m,t[26]=a,t[27]=x):x=t[27];let S;return t[28]!==b||t[29]!==x?(S=(0,$.jsxs)($.Fragment,{children:[b,x]}),t[28]=b,t[29]=x,t[30]=S):S=t[30],S}function jt(e,t){return e[t]??t}function Mt(e,t){let n=ae[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function Nt(e,t){return(ae[e]??[]).every(e=>!e.required||!!t[e.key]?.trim())}function Pt(e){let t=(0,Q.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,$.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,$.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Ft(e){let t=(0,Q.c)(33),{workflowName:n,language:r,argValues:i,onArgValuesChange:o,goal:s,onGoalChange:c,examplePrompts:l,showGoal:u,inputClassName:d}=e,f;t[0]===l?f=t[1]:(f=l===void 0?[]:l,t[0]=l,t[1]=f);let p=f,m=u===void 0?!0:u,h,g,_,v,y,b,x;if(t[2]!==i||t[3]!==p||t[4]!==s||t[5]!==d||t[6]!==r||t[7]!==o||t[8]!==c||t[9]!==m||t[10]!==n){_=a(r).workflows;let e=ae[n]??[];g=e.length>0;let l=K(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,d),u;t[18]!==i||t[19]!==o||t[20]!==c?(u=e=>{qe(e,c,e=>{o(e(i))})},t[18]=i,t[19]=o,t[20]=c,t[21]=u):u=t[21],h=u,v=`flex flex-col gap-3`,y=e.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[jt(_.args,e.labelKey),e.required?` *`:``]}),e.multiline?(0,$.jsx)(`textarea`,{value:i[e.key]??``,onChange:t=>o({...i,[e.key]:t.target.value}),placeholder:jt(_.args,e.placeholderKey),className:K(l,`min-h-20 resize-y`)}):(0,$.jsx)(`input`,{value:i[e.key]??``,onChange:t=>o({...i,[e.key]:t.target.value}),placeholder:jt(_.args,e.placeholderKey),className:l})]},e.key)),b=g&&p.length>0?(0,$.jsx)(Pt,{examples:p,labels:_,onSelect:h}):null,x=m?(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:_.goalLabel}),(0,$.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),placeholder:_.goalPlaceholder,className:K(l,`min-h-20 resize-y`)})]}):null,t[2]=i,t[3]=p,t[4]=s,t[5]=d,t[6]=r,t[7]=o,t[8]=c,t[9]=m,t[10]=n,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17];let S;t[22]!==h||t[23]!==p||t[24]!==g||t[25]!==_?(S=!g&&p.length>0?(0,$.jsx)(Pt,{examples:p,labels:_,onSelect:h}):null,t[22]=h,t[23]=p,t[24]=g,t[25]=_,t[26]=S):S=t[26];let C;return t[27]!==v||t[28]!==y||t[29]!==b||t[30]!==x||t[31]!==S?(C=(0,$.jsxs)(`div`,{className:v,children:[y,b,x,S]}),t[27]=v,t[28]=y,t[29]=b,t[30]=x,t[31]=S,t[32]=C):C=t[32],C}function It(e){let t=(0,Q.c)(190),{open:n,onRequestClose:r,c:a,chatM:o,agentsMessages:s,isDark:c,channels:l,sessionChatIds:u,cronAgentSelectOptions:d,defaultModelResolver:f,formMode:p,formJobId:m,formName:h,onFormNameChange:g,formSchedule:_,onFormScheduleChange:v,formSubmitting:b,formTaskKind:C,onFormTaskKindChange:T,workflowDefinitions:E,workflowDefinitionsLoading:D,formWorkflowDefinitionId:k,onFormWorkflowDefinitionIdChange:A,formWorkflowGoal:j,onFormWorkflowGoalChange:P,formWorkflowArgValues:F,onFormWorkflowArgValuesChange:I,formSessionTarget:L,onFormSessionTargetChange:z,formAgentLocalOnly:B,onFormAgentLocalOnlyChange:V,formModel:H,onFormModelUserChange:U,formAgentId:G,onFormAgentIdChange:q,formWorkingDirectory:ee,onFormWorkingDirectoryChange:ne,formChannel:re,onFormChannelChange:J,formChatId:ie,onFormChatIdChange:Y,formMessage:ae,onFormMessageChange:oe,formMessageMdMode:se,onSetMessageMdMode:le,messageEditorNonce:ue,needsDeliveryChat:de,showChannelPicker:me,canSubmit:ge,onSubmit:_e,onRefreshRecipients:ve}=e,be=i(Bt),xe,Se;if(t[0]!==k||t[1]!==be||t[2]!==E){let e;t[5]===k?e=t[6]:(e=e=>e.id===k.trim(),t[5]=k,t[6]=e),xe=E.find(e),Se=xe?Ke(xe,be):null,t[0]=k,t[1]=be,t[2]=E,t[3]=xe,t[4]=Se}else xe=t[3],Se=t[4];let Ce=Se,we;t[7]===r?we=t[8]:(we=e=>!e&&r(),t[7]=r,t[8]=we);let Te;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[9]=Te):Te=t[9];let Ee=p===`edit`?a.editJob:a.addJob,De;t[10]===Ee?De=t[11]:(De=(0,$.jsx)(S,{className:`text-base font-semibold text-fg`,children:Ee}),t[10]=Ee,t[11]=De);let Oe;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,$.jsx)(fe,{className:`size-5`,strokeWidth:1.75}),t[12]=Oe):Oe=t[12];let ke;t[13]===a.close?ke=t[14]:(ke=(0,$.jsx)(W,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:Oe})}),t[13]=a.close,t[14]=ke);let Ae;t[15]!==De||t[16]!==ke?(Ae=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[De,ke]}),t[15]=De,t[16]=ke,t[17]=Ae):Ae=t[17];let je;t[18]===a.name?je=t[19]:(je=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.name}),t[18]=a.name,t[19]=je);let Me;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Me=vt(),t[20]=Me):Me=t[20];let Ne;t[21]===g?Ne=t[22]:(Ne=e=>g(e.target.value),t[21]=g,t[22]=Ne);let Pe;t[23]!==a.namePlaceholder||t[24]!==h||t[25]!==Ne?(Pe=(0,$.jsx)(`input`,{type:`text`,className:Me,value:h,onChange:Ne,placeholder:a.namePlaceholder}),t[23]=a.namePlaceholder,t[24]=h,t[25]=Ne,t[26]=Pe):Pe=t[26];let Fe;t[27]!==Pe||t[28]!==je?(Fe=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[je,Pe]}),t[27]=Pe,t[28]=je,t[29]=Fe):Fe=t[29];let Ie;t[30]!==a.schedulePicker||t[31]!==_||t[32]!==b||t[33]!==v?(Ie=(0,$.jsx)(We,{value:_,onChange:v,disabled:b,labels:a.schedulePicker}),t[30]=a.schedulePicker,t[31]=_,t[32]=b,t[33]=v,t[34]=Ie):Ie=t[34];let Le;t[35]===a.taskKind?Le=t[36]:(Le=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.taskKind}),t[35]=a.taskKind,t[36]=Le);let Re;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Re=yt(),t[37]=Re):Re=t[37];let ze;t[38]===T?ze=t[39]:(ze=e=>T(e.target.value),t[38]=T,t[39]=ze);let Be;t[40]===a.taskKindMessage?Be=t[41]:(Be=(0,$.jsx)(`option`,{value:`message`,children:a.taskKindMessage}),t[40]=a.taskKindMessage,t[41]=Be);let Ve;t[42]===a.taskKindWorkflowRun?Ve=t[43]:(Ve=(0,$.jsx)(`option`,{value:`workflowRun`,children:a.taskKindWorkflowRun}),t[42]=a.taskKindWorkflowRun,t[43]=Ve);let He;t[44]!==b||t[45]!==C||t[46]!==ze||t[47]!==Be||t[48]!==Ve?(He=(0,$.jsxs)(`select`,{className:Re,value:C,disabled:b,onChange:ze,children:[Be,Ve]}),t[44]=b,t[45]=C,t[46]=ze,t[47]=Be,t[48]=Ve,t[49]=He):He=t[49];let Ue;t[50]!==Le||t[51]!==He?(Ue=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[Le,He]}),t[50]=Le,t[51]=He,t[52]=Ue):Ue=t[52];let Ge;t[53]!==s||t[54]!==a.agentProfile||t[55]!==a.agentProfileDefault||t[56]!==a.agentProfileHint||t[57]!==a.channel||t[58]!==a.channelLocal||t[59]!==a.lastActiveLabels||t[60]!==a.noRecentChatsOption||t[61]!==a.recipient||t[62]!==a.recipientPlaceholder||t[63]!==a.refreshList||t[64]!==a.refreshRecipientHint||t[65]!==a.selectRecipient||t[66]!==a.workflowDefinition||t[67]!==a.workflowDefinitionCustom||t[68]!==a.workflowDefinitionMissing||t[69]!==a.workflowDefinitionPlaceholder||t[70]!==a.workflowDefinitionsEmpty||t[71]!==a.workflowDefinitionsLoading||t[72]!==a.workflowDeliveryHint||t[73]!==a.workflowLocalOnly||t[74]!==a.workflowLocalOnlyHint||t[75]!==l||t[76]!==d||t[77]!==G||t[78]!==B||t[79]!==re||t[80]!==ie||t[81]!==b||t[82]!==C||t[83]!==F||t[84]!==k||t[85]!==j||t[86]!==be||t[87]!==de||t[88]!==q||t[89]!==V||t[90]!==J||t[91]!==Y||t[92]!==I||t[93]!==A||t[94]!==P||t[95]!==ve||t[96]!==xe||t[97]!==Ce||t[98]!==u||t[99]!==me||t[100]!==E||t[101]!==D?(Ge=C===`workflowRun`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workflowDefinition}),(0,$.jsxs)(`select`,{className:yt(),value:k,disabled:b||D,onChange:e=>A(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:D?a.workflowDefinitionsLoading:a.workflowDefinitionPlaceholder}),k.trim()&&!E.some(e=>e.id===k.trim())?(0,$.jsx)(`option`,{value:k,children:k}):null,E.map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.title,e.metadata.source===`user`?` (${a.workflowDefinitionCustom})`:``]},e.id))]}),!D&&E.length===0?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workflowDefinitionsEmpty}):null,Ce?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:Ce.description}):k.trim()&&!xe?(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:a.workflowDefinitionMissing}):null]}),k.trim()?(0,$.jsx)(Ft,{workflowName:k.trim(),language:be,argValues:F,onArgValuesChange:I,goal:j,onGoalChange:P,examplePrompts:Ce?.examplePrompts??[],inputClassName:vt()}):null,(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.agentProfile}),(0,$.jsxs)(`select`,{className:yt(),value:G,disabled:b,onChange:e=>q(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),d.map(e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} — ${x(e,s)}`},e.id))]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.agentProfileHint})]}),(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-hover/45 px-3 py-2 dark:bg-surface-hover/30`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:K(`ui-checkbox`,`mt-0.5`),checked:B,onChange:e=>V(e.target.checked),"aria-label":a.workflowLocalOnly}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.workflowLocalOnly}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.workflowLocalOnlyHint})]})]}),me?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.channel}),(0,$.jsxs)(`select`,{className:yt(),value:re,onChange:e=>J(e.target.value),children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),l.map(Rt)]})]}),de?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.recipient}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ve(),children:[(0,$.jsx)(te,{className:`size-3.5`,strokeWidth:1.75}),a.refreshList]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,$.jsx)(`input`,{type:`text`,className:K(vt(),`min-w-0 w-full sm:flex-1`),value:ie,onChange:e=>Y(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:bt,value:ie,onChange:e=>{let t=e.target.value;t&&Y(t)},children:[(0,$.jsx)(`option`,{value:``,children:a.selectRecipient}),u.length>0?u.map(e=>(0,$.jsx)(`option`,{value:e.chatId,children:ye(e,a.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,$.jsx)(`option`,{value:``,disabled:!0,children:a.noRecentChatsOption})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workflowDeliveryHint})]}):null]}):null]}):null,t[53]=s,t[54]=a.agentProfile,t[55]=a.agentProfileDefault,t[56]=a.agentProfileHint,t[57]=a.channel,t[58]=a.channelLocal,t[59]=a.lastActiveLabels,t[60]=a.noRecentChatsOption,t[61]=a.recipient,t[62]=a.recipientPlaceholder,t[63]=a.refreshList,t[64]=a.refreshRecipientHint,t[65]=a.selectRecipient,t[66]=a.workflowDefinition,t[67]=a.workflowDefinitionCustom,t[68]=a.workflowDefinitionMissing,t[69]=a.workflowDefinitionPlaceholder,t[70]=a.workflowDefinitionsEmpty,t[71]=a.workflowDefinitionsLoading,t[72]=a.workflowDeliveryHint,t[73]=a.workflowLocalOnly,t[74]=a.workflowLocalOnlyHint,t[75]=l,t[76]=d,t[77]=G,t[78]=B,t[79]=re,t[80]=ie,t[81]=b,t[82]=C,t[83]=F,t[84]=k,t[85]=j,t[86]=be,t[87]=de,t[88]=q,t[89]=V,t[90]=J,t[91]=Y,t[92]=I,t[93]=A,t[94]=P,t[95]=ve,t[96]=xe,t[97]=Ce,t[98]=u,t[99]=me,t[100]=E,t[101]=D,t[102]=Ge):Ge=t[102];let qe;t[103]!==s||t[104]!==a.agentLocalOnly||t[105]!==a.agentLocalOnlyHint||t[106]!==a.agentProfile||t[107]!==a.agentProfileDefault||t[108]!==a.agentProfileHint||t[109]!==a.channel||t[110]!==a.channelLocal||t[111]!==a.enterManuallyOrSelect||t[112]!==a.lastActiveLabels||t[113]!==a.message||t[114]!==a.messageEdit||t[115]!==a.messageMarkdownHint||t[116]!==a.messagePlaceholder||t[117]!==a.messagePreview||t[118]!==a.mode||t[119]!==a.modeAgent||t[120]!==a.modeAgentOption||t[121]!==a.modeDirect||t[122]!==a.modeDirectOption||t[123]!==a.model||t[124]!==a.noRecentChats||t[125]!==a.noRecentChatsOption||t[126]!==a.recipient||t[127]!==a.recipientPlaceholder||t[128]!==a.refreshList||t[129]!==a.refreshRecipientHint||t[130]!==a.selectRecipient||t[131]!==a.workingDirectoryHint||t[132]!==a.workingDirectoryLabel||t[133]!==a.workingDirectoryReset||t[134]!==l||t[135]!==o||t[136]!==d||t[137]!==f||t[138]!==G||t[139]!==B||t[140]!==re||t[141]!==ie||t[142]!==m||t[143]!==ae||t[144]!==se||t[145]!==H||t[146]!==L||t[147]!==b||t[148]!==C||t[149]!==ee||t[150]!==c||t[151]!==ue||t[152]!==de||t[153]!==q||t[154]!==V||t[155]!==J||t[156]!==Y||t[157]!==oe||t[158]!==U||t[159]!==z||t[160]!==ne||t[161]!==ve||t[162]!==le||t[163]!==u||t[164]!==me?(qe=C===`message`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.mode}),(0,$.jsxs)(`select`,{className:yt(),value:L,onChange:e=>{let t=e.target.value;z(t,f,H.trim())},children:[(0,$.jsx)(`option`,{value:`main`,children:a.modeDirectOption}),(0,$.jsx)(`option`,{value:`isolated`,children:a.modeAgentOption})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:L===`main`?a.modeDirect:a.modeAgent})]}),L===`isolated`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.model}),(0,$.jsx)(O,{value:H,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:U})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.agentProfile}),(0,$.jsxs)(`select`,{className:yt(),value:G,disabled:b,onChange:e=>q(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),d.map(e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} — ${x(e,s)}`},e.id))]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.agentProfileHint})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workingDirectoryLabel}),(0,$.jsx)(At,{value:ee,onChange:ne,disabled:b,wd:o.workingDirectory,placeholder:o.workingDirectory.notSet,maxWidthClass:`max-w-[min(16rem,48vw)]`,clearLabel:a.workingDirectoryReset,onClear:()=>ne(``)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workingDirectoryHint})]}),(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-hover/45 px-3 py-2 dark:bg-surface-hover/30`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:K(`ui-checkbox`,`mt-0.5`),checked:B,onChange:e=>V(e.target.checked),"aria-label":a.agentLocalOnly}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.agentLocalOnly}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.agentLocalOnlyHint})]})]})]}):null,me?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.channel}),(0,$.jsxs)(`select`,{className:yt(),value:re,onChange:e=>{let t=e.target.value;J(t)},children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),l.map(Lt)]})]}),de?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.recipient}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ve(),children:[(0,$.jsx)(te,{className:`size-3.5`,strokeWidth:1.75}),a.refreshList]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,$.jsx)(`input`,{type:`text`,className:K(vt(),`min-w-0 w-full sm:flex-1`),value:ie,onChange:e=>Y(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:bt,value:ie,onChange:e=>{let t=e.target.value;t&&Y(t)},children:[(0,$.jsx)(`option`,{value:``,children:a.selectRecipient}),u.length>0?u.map(e=>(0,$.jsx)(`option`,{value:e.chatId,children:ye(e,a.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,$.jsx)(`option`,{value:``,disabled:!0,children:a.noRecentChatsOption})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:u.length>0?a.enterManuallyOrSelect:a.noRecentChats})]}):null]}):null,(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.message}),(0,$.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[(0,$.jsxs)(`button`,{type:`button`,className:K(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,se===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>le(`edit`),children:[(0,$.jsx)(M,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),a.messageEdit]}),(0,$.jsxs)(`button`,{type:`button`,className:K(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,se===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>le(`preview`),children:[(0,$.jsx)(ce,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),a.messagePreview]})]})]}),(0,$.jsx)(`div`,{className:K(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,b&&`pointer-events-none opacity-60`),children:se===`edit`?(0,$.jsx)(w,{initialContent:ae,onChange:oe,isDark:c,className:`h-[min(18rem,40vh)] min-h-[12rem]`},`cron-msg-${m??`new`}-${ue}`):(0,$.jsx)(`div`,{className:`h-[min(18rem,40vh)] min-h-[12rem] max-h-[min(24rem,50vh)] overflow-y-auto px-3 py-2`,children:ae.trim()?(0,$.jsx)(N,{content:ae,compact:!0,className:`text-sm`}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.messagePlaceholder})})}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.messageMarkdownHint})]})]}):null,t[103]=s,t[104]=a.agentLocalOnly,t[105]=a.agentLocalOnlyHint,t[106]=a.agentProfile,t[107]=a.agentProfileDefault,t[108]=a.agentProfileHint,t[109]=a.channel,t[110]=a.channelLocal,t[111]=a.enterManuallyOrSelect,t[112]=a.lastActiveLabels,t[113]=a.message,t[114]=a.messageEdit,t[115]=a.messageMarkdownHint,t[116]=a.messagePlaceholder,t[117]=a.messagePreview,t[118]=a.mode,t[119]=a.modeAgent,t[120]=a.modeAgentOption,t[121]=a.modeDirect,t[122]=a.modeDirectOption,t[123]=a.model,t[124]=a.noRecentChats,t[125]=a.noRecentChatsOption,t[126]=a.recipient,t[127]=a.recipientPlaceholder,t[128]=a.refreshList,t[129]=a.refreshRecipientHint,t[130]=a.selectRecipient,t[131]=a.workingDirectoryHint,t[132]=a.workingDirectoryLabel,t[133]=a.workingDirectoryReset,t[134]=l,t[135]=o,t[136]=d,t[137]=f,t[138]=G,t[139]=B,t[140]=re,t[141]=ie,t[142]=m,t[143]=ae,t[144]=se,t[145]=H,t[146]=L,t[147]=b,t[148]=C,t[149]=ee,t[150]=c,t[151]=ue,t[152]=de,t[153]=q,t[154]=V,t[155]=J,t[156]=Y,t[157]=oe,t[158]=U,t[159]=z,t[160]=ne,t[161]=ve,t[162]=le,t[163]=u,t[164]=me,t[165]=qe):qe=t[165];let Je;t[166]!==Fe||t[167]!==Ie||t[168]!==Ue||t[169]!==Ge||t[170]!==qe?(Je=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Fe,Ie,Ue,Ge,qe]})}),t[166]=Fe,t[167]=Ie,t[168]=Ue,t[169]=Ge,t[170]=qe,t[171]=Je):Je=t[171];let Ye;t[172]!==a.cancel||t[173]!==r?(Ye=(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:r,children:a.cancel}),t[172]=a.cancel,t[173]=r,t[174]=Ye):Ye=t[174];let Xe=b||!ge,Ze=b?a.loading:p===`edit`?a.save:a.create,Qe;t[175]!==_e||t[176]!==Xe||t[177]!==Ze?(Qe=(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:Xe,onClick:_e,children:Ze}),t[175]=_e,t[176]=Xe,t[177]=Ze,t[178]=Qe):Qe=t[178];let $e;t[179]!==Ye||t[180]!==Qe?($e=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Ye,Qe]}),t[179]=Ye,t[180]=Qe,t[181]=$e):$e=t[181];let Z;t[182]!==Je||t[183]!==$e||t[184]!==Ae?(Z=(0,$.jsxs)(pe,{children:[Te,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(he,{className:`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(90vh,800px)] w-full max-w-md flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none sm:max-w-lg lg:max-w-xl dark:border-edge`,onOpenAutoFocus:zt,children:[Ae,Je,$e]})})]}),t[182]=Je,t[183]=$e,t[184]=Ae,t[185]=Z):Z=t[185];let et;return t[186]!==n||t[187]!==we||t[188]!==Z?(et=(0,$.jsx)($.Fragment,{children:(0,$.jsx)(R,{open:n,onOpenChange:we,children:Z})}),t[186]=n,t[187]=we,t[188]=Z,t[189]=et):et=t[189],et}function Lt(e){return(0,$.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name)}function Rt(e){return(0,$.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name)}function zt(e){return e.preventDefault()}function Bt(e){return e.language}function Vt(e){let t=(0,Q.c)(76),{c:n,mainTab:r,onMainTabChange:i,jobSort:a,onJobSortChange:o,historyRange:s,onHistoryRangeChange:c,historyJobFilter:l,onHistoryJobFilterChange:u,historyStatusFilter:d,onHistoryStatusFilterChange:f,jobs:p}=e,m=n.title,h=r===`myTasks`,g=r===`myTasks`?`text-fg`:`text-fg-muted hover:text-fg`,_;t[0]===g?_=t[1]:(_=K(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,g),t[0]=g,t[1]=_);let v;t[2]===i?v=t[3]:(v=()=>i(`myTasks`),t[2]=i,t[3]=v);let y;t[4]!==n.tabMyTasks||t[5]!==h||t[6]!==_||t[7]!==v?(y=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":h,className:_,onClick:v,children:n.tabMyTasks}),t[4]=n.tabMyTasks,t[5]=h,t[6]=_,t[7]=v,t[8]=y):y=t[8];let b=r===`systemTasks`,x=r===`systemTasks`?`text-fg`:`text-fg-muted hover:text-fg`,S;t[9]===x?S=t[10]:(S=K(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,x),t[9]=x,t[10]=S);let C;t[11]===i?C=t[12]:(C=()=>i(`systemTasks`),t[11]=i,t[12]=C);let w;t[13]!==n.tabSystemTasks||t[14]!==C||t[15]!==b||t[16]!==S?(w=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":b,className:S,onClick:C,children:n.tabSystemTasks}),t[13]=n.tabSystemTasks,t[14]=C,t[15]=b,t[16]=S,t[17]=w):w=t[17];let T=r===`history`,E=r===`history`?`text-fg`:`text-fg-muted hover:text-fg`,D;t[18]===E?D=t[19]:(D=K(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,E),t[18]=E,t[19]=D);let O;t[20]===i?O=t[21]:(O=()=>i(`history`),t[20]=i,t[21]=O);let k;t[22]!==n.tabRunHistory||t[23]!==T||t[24]!==D||t[25]!==O?(k=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":T,className:D,onClick:O,children:n.tabRunHistory}),t[22]=n.tabRunHistory,t[23]=T,t[24]=D,t[25]=O,t[26]=k):k=t[26];let A=r===`settings`,j=r===`settings`?`text-fg`:`text-fg-muted hover:text-fg`,M;t[27]===j?M=t[28]:(M=K(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,j),t[27]=j,t[28]=M);let N;t[29]===i?N=t[30]:(N=()=>i(`settings`),t[29]=i,t[30]=N);let P;t[31]!==n.globals.title||t[32]!==A||t[33]!==M||t[34]!==N?(P=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":A,className:M,onClick:N,children:n.globals.title}),t[31]=n.globals.title,t[32]=A,t[33]=M,t[34]=N,t[35]=P):P=t[35];let F;t[36]!==n.title||t[37]!==w||t[38]!==k||t[39]!==P||t[40]!==y?(F=(0,$.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":m,children:[y,w,k,P]}),t[36]=n.title,t[37]=w,t[38]=k,t[39]=P,t[40]=y,t[41]=F):F=t[41];let I=r===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`,L;t[42]===I?L=t[43]:(L=K(`flex min-w-0 items-center gap-2`,I),t[42]=I,t[43]=L);let R;t[44]!==n.sortCreatedAsc||t[45]!==n.sortCreatedDesc||t[46]!==a||t[47]!==r||t[48]!==o?(R=r===`myTasks`||r===`systemTasks`?(0,$.jsxs)(`select`,{className:xt,value:a,onChange:e=>o(e.target.value),"aria-label":n.sortCreatedDesc,children:[(0,$.jsx)(`option`,{value:`created_desc`,children:n.sortCreatedDesc}),(0,$.jsx)(`option`,{value:`created_asc`,children:n.sortCreatedAsc})]}):null,t[44]=n.sortCreatedAsc,t[45]=n.sortCreatedDesc,t[46]=a,t[47]=r,t[48]=o,t[49]=R):R=t[49];let z;t[50]!==n.execStatusCancelled||t[51]!==n.execStatusFailed||t[52]!==n.execStatusRunning||t[53]!==n.execStatusSuccess||t[54]!==n.filterAllStatuses||t[55]!==n.filterAllTasks||t[56]!==n.historyRangeDay||t[57]!==n.historyRangeMonth||t[58]!==n.historyRangeWeek||t[59]!==n.runHistoryTitle||t[60]!==l||t[61]!==s||t[62]!==d||t[63]!==p||t[64]!==r||t[65]!==u||t[66]!==c||t[67]!==f?(z=r===`history`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:K(ne,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,$.jsx)(`button`,{type:`button`,className:K(ee,`px-2.5 py-1`,s===e&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,s===e&&`text-fg`),onClick:()=>c(e),children:e===`day`?n.historyRangeDay:e===`week`?n.historyRangeWeek:n.historyRangeMonth},e))}),(0,$.jsxs)(`select`,{className:xt,value:l,onChange:e=>u(e.target.value),"aria-label":n.filterAllTasks,children:[(0,$.jsx)(`option`,{value:``,children:n.filterAllTasks}),p.map(Ht)]}),(0,$.jsxs)(`select`,{className:xt,value:d,onChange:e=>f(e.target.value),"aria-label":n.filterAllStatuses,children:[(0,$.jsx)(`option`,{value:``,children:n.filterAllStatuses}),(0,$.jsx)(`option`,{value:`success`,children:n.execStatusSuccess}),(0,$.jsx)(`option`,{value:`failed`,children:n.execStatusFailed}),(0,$.jsx)(`option`,{value:`cancelled`,children:n.execStatusCancelled}),(0,$.jsx)(`option`,{value:`running`,children:n.execStatusRunning})]})]}):null,t[50]=n.execStatusCancelled,t[51]=n.execStatusFailed,t[52]=n.execStatusRunning,t[53]=n.execStatusSuccess,t[54]=n.filterAllStatuses,t[55]=n.filterAllTasks,t[56]=n.historyRangeDay,t[57]=n.historyRangeMonth,t[58]=n.historyRangeWeek,t[59]=n.runHistoryTitle,t[60]=l,t[61]=s,t[62]=d,t[63]=p,t[64]=r,t[65]=u,t[66]=c,t[67]=f,t[68]=z):z=t[68];let B;t[69]!==L||t[70]!==R||t[71]!==z?(B=(0,$.jsxs)(`div`,{className:L,children:[R,z]}),t[69]=L,t[70]=R,t[71]=z,t[72]=B):B=t[72];let V;return t[73]!==F||t[74]!==B?(V=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[F,B]}),t[73]=F,t[74]=B,t[75]=V):V=t[75],V}function Ht(e){return(0,$.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id)}function Ut(e){let t=(0,Q.c)(23),{c:n,loading:r,runHistoryLoading:i,onRefresh:a,onOpenTemplatePicker:o,onAddJob:s}=e,c=r||i,l=n.refresh,u=n.refresh,d;t[0]===a?d=t[1]:(d=()=>void a(),t[0]=a,t[1]=d);let f=c&&`animate-spin`,p;t[2]===f?p=t[3]:(p=K(`size-4`,f),t[2]=f,t[3]=p);let m;t[4]===p?m=t[5]:(m=(0,$.jsx)(te,{className:p,strokeWidth:1.75}),t[4]=p,t[5]=m);let h;t[6]!==c||t[7]!==n.refresh||t[8]!==d||t[9]!==m?(h=(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:c,title:l,"aria-label":u,onClick:d,children:m}),t[6]=c,t[7]=n.refresh,t[8]=d,t[9]=m,t[10]=h):h=t[10];let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(E,{className:`size-4`,strokeWidth:1.75}),t[11]=g):g=t[11];let _;t[12]!==n.fromTemplate||t[13]!==o?(_=(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:o,children:[g,n.fromTemplate]}),t[12]=n.fromTemplate,t[13]=o,t[14]=_):_=t[14];let v;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(oe,{className:`size-4`,strokeWidth:1.75}),t[15]=v):v=t[15];let y;t[16]!==n.addJob||t[17]!==s?(y=(0,$.jsxs)(X,{type:`button`,variant:`primary`,className:`gap-2`,onClick:s,children:[v,n.addJob]}),t[16]=n.addJob,t[17]=s,t[18]=y):y=t[18];let b;return t[19]!==y||t[20]!==h||t[21]!==_?(b=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[h,_,y]}),t[19]=y,t[20]=h,t[21]=_,t[22]=b):b=t[22],b}function Wt(e){let t=(0,Q.c)(46),{c:n,runHistoryLoading:r,runHistory:i,filteredRunHistory:a,jobs:o,onRefreshHistory:s,onOpenJobDetail:c,statusLabels:l}=e,u;t[0]===n.tabRunHistory?u=t[1]:(u=(0,$.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:n.tabRunHistory}),t[0]=n.tabRunHistory,t[1]=u);let d;t[2]===n.runHistoryHint?d=t[3]:(d=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.runHistoryHint}),t[2]=n.runHistoryHint,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=n.refresh,m=n.refresh,h;t[7]===s?h=t[8]:(h=()=>void s(),t[7]=s,t[8]=h);let g=r&&`animate-spin`,_;t[9]===g?_=t[10]:(_=K(`size-4`,g),t[9]=g,t[10]=_);let v;t[11]===_?v=t[12]:(v=(0,$.jsx)(te,{className:_,strokeWidth:1.75}),t[11]=_,t[12]=v);let y;t[13]!==n.refresh||t[14]!==r||t[15]!==h||t[16]!==v?(y=(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:r,title:p,"aria-label":m,onClick:h,children:v}),t[13]=n.refresh,t[14]=r,t[15]=h,t[16]=v,t[17]=y):y=t[17];let x;t[18]!==y||t[19]!==f?(x=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[f,y]}),t[18]=y,t[19]=f,t[20]=x):x=t[20];let S;t[21]!==n.colChat||t[22]!==n.colDetail||t[23]!==n.colDuration||t[24]!==n.colJob||t[25]!==n.colStarted||t[26]!==n.colWorkflow||t[27]!==n.emptyHistoryHint||t[28]!==n.emptyHistoryTitle||t[29]!==n.noRunsYet||t[30]!==n.openChat||t[31]!==n.openChatTitle||t[32]!==n.openWorkflow||t[33]!==n.openWorkflowTitle||t[34]!==n.runHistoryHint||t[35]!==n.status||t[36]!==a||t[37]!==o||t[38]!==c||t[39]!==i||t[40]!==r||t[41]!==l?(S=r&&i.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(b,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):a.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-edge-subtle px-6 py-16 text-center dark:border-edge-subtle`,children:[(0,$.jsx)(H,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:i.length===0?n.emptyHistoryTitle:n.noRunsYet}),(0,$.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:i.length===0?n.emptyHistoryHint:n.runHistoryHint})]}):(0,$.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colStarted}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colJob}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.status}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDuration}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDetail}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colWorkflow}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colChat})]})}),(0,$.jsx)(`tbody`,{children:a.map(e=>(0,$.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,$.jsx)(`time`,{dateTime:e.startedAt,children:Se(e.startedAt)})}),(0,$.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:o.some(t=>t.id===e.jobId)?(0,$.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let t=o.find(t=>t.id===e.jobId);t&&c(t)},children:e.jobName||e.jobId}):(0,$.jsx)(`span`,{className:`text-fg-muted`,children:e.jobName||e.jobId})}),(0,$.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,$.jsx)(`span`,{className:K(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,e.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,e.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`,e.status===`running`&&`bg-accent/15 text-accent`,e.status===`cancelled`&&`bg-surface-hover text-fg-muted`),children:Ue(e.status,l)})}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:He(e.duration)}),(0,$.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:e.summary||e.error||``,children:be(e.summary||e.error,96)}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.workflowRunId?.trim()?(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openWorkflowTitle,"aria-label":n.openWorkflowTitle,onClick:()=>_t(e.workflowRunId),children:n.openWorkflow}):(0,$.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.sessionKey?.trim()?(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>gt(e.sessionKey),children:n.openChat}):(0,$.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})}),t[21]=n.colChat,t[22]=n.colDetail,t[23]=n.colDuration,t[24]=n.colJob,t[25]=n.colStarted,t[26]=n.colWorkflow,t[27]=n.emptyHistoryHint,t[28]=n.emptyHistoryTitle,t[29]=n.noRunsYet,t[30]=n.openChat,t[31]=n.openChatTitle,t[32]=n.openWorkflow,t[33]=n.openWorkflowTitle,t[34]=n.runHistoryHint,t[35]=n.status,t[36]=a,t[37]=o,t[38]=c,t[39]=i,t[40]=r,t[41]=l,t[42]=S):S=t[42];let C;return t[43]!==x||t[44]!==S?(C=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[x,S]}),t[43]=x,t[44]=S,t[45]=C):C=t[45],C}function Gt(e){let t=(0,Q.c)(77),{job:n,c:r,localeTag:i,scheduleBadgeLabels:a,absorbCardClickJobIdRef:o,scheduleAbsorbNextMenuCardClick:s,onOpenDetail:c,onToggle:l,onEdit:u,onRunNow:d,onDelete:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=K(`flex h-full min-h-0 cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-base text-left transition-colors duration-150 ease-out dark:border-edge-subtle`,`hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[0]=p):p=t[0];let m,h;t[1]!==o||t[2]!==n||t[3]!==c?(m=()=>{if(o.current===n.id){o.current=null;return}c(n)},h=e=>{if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),o.current===n.id){o.current=null;return}c(n)}},t[1]=o,t[2]=n,t[3]=c,t[4]=m,t[5]=h):(m=t[4],h=t[5]);let g=n.enabled,_=n.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`,v;t[6]===_?v=t[7]:(v=K(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,_),t[6]=_,t[7]=v);let y;t[8]!==n||t[9]!==l?(y=e=>{e.stopPropagation(),l(n,!n.enabled)},t[8]=n,t[9]=l,t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[11]=b):b=t[11];let x;t[12]!==n.enabled||t[13]!==v||t[14]!==y?(x=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":g,className:v,onClick:y,children:b}),t[12]=n.enabled,t[13]=v,t[14]=y,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(ie,{className:`size-4`,strokeWidth:1.75}),t[16]=S):S=t[16];let C;t[17]===r.jobCardMenuAria?C=t[18]:(C=(0,$.jsx)(Ze,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":r.jobCardMenuAria,onClick:qt,children:S})}),t[17]=r.jobCardMenuAria,t[18]=C);let w;t[19]!==n||t[20]!==u||t[21]!==s?(w=()=>{s(n.id),u(n)},t[19]=n,t[20]=u,t[21]=s,t[22]=w):w=t[22];let T;t[23]!==r.edit||t[24]!==w?(T=(0,$.jsx)(Xe,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:w,children:r.edit}),t[23]=r.edit,t[24]=w,t[25]=T):T=t[25];let E;t[26]!==n||t[27]!==d||t[28]!==s?(E=()=>{s(n.id),d(n)},t[26]=n,t[27]=d,t[28]=s,t[29]=E):E=t[29];let D;t[30]!==r.runNow||t[31]!==E?(D=(0,$.jsx)(Xe,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:E,children:r.runNow}),t[30]=r.runNow,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==n||t[34]!==f||t[35]!==s?(O=()=>{s(n.id),f(n)},t[33]=n,t[34]=f,t[35]=s,t[36]=O):O=t[36];let k;t[37]!==r.delete||t[38]!==O?(k=(0,$.jsx)(Xe,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-red-600 outline-none data-highlighted:bg-red-500/10 dark:text-red-400`,onSelect:O,children:r.delete}),t[37]=r.delete,t[38]=O,t[39]=k):k=t[39];let A;t[40]!==T||t[41]!==D||t[42]!==k?(A=(0,$.jsx)(Qe,{children:(0,$.jsxs)($e,{className:`z-50 min-w-[10rem] rounded-xl border border-edge-subtle bg-surface-panel p-1 shadow-elevated dark:border-edge-subtle`,sideOffset:4,align:`end`,onCloseAutoFocus:Kt,children:[T,D,k]})}),t[40]=T,t[41]=D,t[42]=k,t[43]=A):A=t[43];let j;t[44]!==C||t[45]!==A?(j=(0,$.jsxs)(Ye,{children:[C,A]}),t[44]=C,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==j||t[48]!==x?(M=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[x,j]}),t[47]=j,t[48]=x,t[49]=M):M=t[49];let P=n.name||n.id,F;t[50]===P?F=t[51]:(F=(0,$.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:P}),t[50]=P,t[51]=F);let I;t[52]===n?I=t[53]:(I=Pe(n),t[52]=n,t[53]=I);let L;t[54]===n?L=t[55]:(L=Pe(n),t[54]=n,t[55]=L);let R;t[56]===L?R=t[57]:(R=(0,$.jsx)(N,{content:L,compact:!0}),t[56]=L,t[57]=R);let z;t[58]!==I||t[59]!==R?(z=(0,$.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:I,children:R}),t[58]=I,t[59]=R,t[60]=z):z=t[60];let B;t[61]!==F||t[62]!==z?(B=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[F,z]}),t[61]=F,t[62]=z,t[63]=B):B=t[63];let V;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(H,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[64]=V):V=t[64];let U;t[65]!==n||t[66]!==i||t[67]!==a?(U=Ve(n,i,a),t[65]=n,t[66]=i,t[67]=a,t[68]=U):U=t[68];let W;t[69]===U?W=t[70]:(W=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 border-t border-edge-subtle/90 px-4 py-2.5 text-xs text-fg-muted dark:border-edge-subtle`,children:[V,(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:U})]}),t[69]=U,t[70]=W);let G;return t[71]!==m||t[72]!==M||t[73]!==B||t[74]!==h||t[75]!==W?(G=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,className:p,onClick:m,onKeyDown:h,children:[M,B,W]}),t[71]=m,t[72]=M,t[73]=B,t[74]=h,t[75]=W,t[76]=G):G=t[76],G}function Kt(e){return e.preventDefault()}function qt(e){return e.stopPropagation()}function Jt(e){let t=(0,Q.c)(134),{c:n,language:r,localeTag:i,scheduleBadgeLabels:o,loading:s,sortedSystemJobs:c,heartbeat:l,keepAwake:u,wakeSupported:d,onWakeUnsupportedClick:f,onKeepAwakeToggle:p,absorbCardClickJobIdRef:m,scheduleAbsorbNextMenuCardClick:h,onOpenDetail:g,onToggle:_,onEdit:v,onRunNow:y,onDelete:x}=e,S,C,w,T,E,D,O,k,j,M,N,P;if(t[0]!==n.disabled||t[1]!==n.enabled||t[2]!==n.keepAwake||t[3]!==n.systemHeartbeatEvery||t[4]!==n.systemHeartbeatHint||t[5]!==n.systemHeartbeatInterval||t[6]!==n.systemHeartbeatSettingsLink||t[7]!==n.systemHeartbeatStatus||t[8]!==n.systemHeartbeatTitle||t[9]!==n.systemTasksIntro||t[10]!==n.tabSystemTasks||t[11]!==n.wakeBanner||t[12]!==n.wakeLockUnavailable||t[13]!==l.enabled||t[14]!==l.intervalMs||t[15]!==u||t[16]!==r||t[17]!==i||t[18]!==p||t[19]!==f||t[20]!==d){let e=Ie(l.intervalMs,i,a(r).heartbeatSettings.intervalPresets);N=`cron-system-tasks-panel`,P=`flex flex-col gap-4`,t[33]===n.tabSystemTasks?C=t[34]:(C=(0,$.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:n.tabSystemTasks}),t[33]=n.tabSystemTasks,t[34]=C),t[35]===n.systemTasksIntro?w=t[36]:(w=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.systemTasksIntro}),t[35]=n.systemTasksIntro,t[36]=w);let o;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(z,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[37]=o):o=t[37];let s;t[38]===n.wakeBanner?s=t[39]:(s=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[o,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[38]=n.wakeBanner,t[39]=s);let c;t[40]===n.keepAwake?c=t[41]:(c=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[40]=n.keepAwake,t[41]=c);let m=!d,h=d?void 0:n.wakeLockUnavailable,g=u?`justify-end bg-accent`:`justify-start bg-surface-hover`,_=!d&&`cursor-not-allowed opacity-50`,v;t[42]!==g||t[43]!==_?(v=K(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,g,_),t[42]=g,t[43]=_,t[44]=v):v=t[44];let y;t[45]!==p||t[46]!==f||t[47]!==d?(y=()=>{d?p():f()},t[45]=p,t[46]=f,t[47]=d,t[48]=y):y=t[48];let b;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[49]=b):b=t[49];let x;t[50]!==u||t[51]!==m||t[52]!==h||t[53]!==v||t[54]!==y?(x=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":u,disabled:m,title:h,className:v,onClick:y,children:b}),t[50]=u,t[51]=m,t[52]=h,t[53]=v,t[54]=y,t[55]=x):x=t[55];let F;t[56]!==c||t[57]!==x?(F=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[c,x]}),t[56]=c,t[57]=x,t[58]=F):F=t[58],t[59]!==s||t[60]!==F?(T=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[s,F]}),t[59]=s,t[60]=F,t[61]=T):T=t[61],j=`rounded-xl border border-edge bg-surface-base p-4 dark:bg-surface-hover/20`;let I;t[62]===n.systemHeartbeatTitle?I=t[63]:(I=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemHeartbeatTitle}),t[62]=n.systemHeartbeatTitle,t[63]=I);let L;t[64]===n.systemHeartbeatHint?L=t[65]:(L=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.systemHeartbeatHint}),t[64]=n.systemHeartbeatHint,t[65]=L);let R;t[66]!==I||t[67]!==L?(R=(0,$.jsxs)(`div`,{children:[I,L]}),t[66]=I,t[67]=L,t[68]=R):R=t[68];let B;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(A,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[69]=B):B=t[69];let V;t[70]===n.systemHeartbeatSettingsLink?V=t[71]:(V=(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(ue,{to:`/settings/heartbeat`,children:[n.systemHeartbeatSettingsLink,B]})}),t[70]=n.systemHeartbeatSettingsLink,t[71]=V),t[72]!==R||t[73]!==V?(M=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[R,V]}),t[72]=R,t[73]=V,t[74]=M):M=t[74],O=`mt-3 grid gap-2 text-sm sm:grid-cols-2`;let H;t[75]===n.systemHeartbeatStatus?H=t[76]:(H=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatStatus}),t[75]=n.systemHeartbeatStatus,t[76]=H);let U=l.enabled?n.enabled:n.disabled,W;t[77]===U?W=t[78]:(W=(0,$.jsx)(`dd`,{className:`text-fg`,children:U}),t[77]=U,t[78]=W),t[79]!==H||t[80]!==W?(k=(0,$.jsxs)(`div`,{children:[H,W]}),t[79]=H,t[80]=W,t[81]=k):k=t[81],t[82]===n.systemHeartbeatInterval?D=t[83]:(D=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatInterval}),t[82]=n.systemHeartbeatInterval,t[83]=D),S=`text-fg`;let G;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(G=/\{\{value\}\}/g,t[84]=G):G=t[84],E=n.systemHeartbeatEvery.replace(G,e),t[0]=n.disabled,t[1]=n.enabled,t[2]=n.keepAwake,t[3]=n.systemHeartbeatEvery,t[4]=n.systemHeartbeatHint,t[5]=n.systemHeartbeatInterval,t[6]=n.systemHeartbeatSettingsLink,t[7]=n.systemHeartbeatStatus,t[8]=n.systemHeartbeatTitle,t[9]=n.systemTasksIntro,t[10]=n.tabSystemTasks,t[11]=n.wakeBanner,t[12]=n.wakeLockUnavailable,t[13]=l.enabled,t[14]=l.intervalMs,t[15]=u,t[16]=r,t[17]=i,t[18]=p,t[19]=f,t[20]=d,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=j,t[30]=M,t[31]=N,t[32]=P}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],j=t[29],M=t[30],N=t[31],P=t[32];let F;t[85]!==S||t[86]!==E?(F=(0,$.jsx)(`dd`,{className:S,children:E}),t[85]=S,t[86]=E,t[87]=F):F=t[87];let I;t[88]!==F||t[89]!==D?(I=(0,$.jsxs)(`div`,{children:[D,F]}),t[88]=F,t[89]=D,t[90]=I):I=t[90];let L;t[91]!==I||t[92]!==O||t[93]!==k?(L=(0,$.jsxs)(`dl`,{className:O,children:[k,I]}),t[91]=I,t[92]=O,t[93]=k,t[94]=L):L=t[94];let R;t[95]!==L||t[96]!==j||t[97]!==M?(R=(0,$.jsxs)(`div`,{className:j,children:[M,L]}),t[95]=L,t[96]=j,t[97]=M,t[98]=R):R=t[98];let B;t[99]===n.systemDreamingTitle?B=t[100]:(B=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemDreamingTitle}),t[99]=n.systemDreamingTitle,t[100]=B);let V;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(A,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[101]=V):V=t[101];let H;t[102]===n.systemDreamingSettingsLink?H=t[103]:(H=(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(ue,{to:`/settings/dreams`,children:[n.systemDreamingSettingsLink,V]})}),t[102]=n.systemDreamingSettingsLink,t[103]=H);let U;t[104]!==B||t[105]!==H?(U=(0,$.jsxs)(`div`,{className:`mb-2 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[B,H]}),t[104]=B,t[105]=H,t[106]=U):U=t[106];let W;t[107]===n.systemDreamingHint?W=t[108]:(W=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n.systemDreamingHint}),t[107]=n.systemDreamingHint,t[108]=W);let G;t[109]!==m||t[110]!==n||t[111]!==s||t[112]!==i||t[113]!==x||t[114]!==v||t[115]!==g||t[116]!==y||t[117]!==_||t[118]!==h||t[119]!==o||t[120]!==c?(G=s&&c.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-12`,"aria-busy":`true`,children:(0,$.jsx)(b,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):c.length===0?(0,$.jsx)(`p`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/30 px-3 py-4 text-sm text-fg-muted dark:border-edge-subtle`,children:n.systemDreamingEmpty}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-[repeat(auto-fill,minmax(280px,1fr))]`,children:c.map(e=>(0,$.jsx)(Gt,{job:e,c:n,localeTag:i,scheduleBadgeLabels:o,absorbCardClickJobIdRef:m,scheduleAbsorbNextMenuCardClick:h,onOpenDetail:g,onToggle:_,onEdit:v,onRunNow:y,onDelete:x},e.id))}),t[109]=m,t[110]=n,t[111]=s,t[112]=i,t[113]=x,t[114]=v,t[115]=g,t[116]=y,t[117]=_,t[118]=h,t[119]=o,t[120]=c,t[121]=G):G=t[121];let q;t[122]!==U||t[123]!==W||t[124]!==G?(q=(0,$.jsxs)(`div`,{children:[U,W,G]}),t[122]=U,t[123]=W,t[124]=G,t[125]=q):q=t[125];let ee;return t[126]!==C||t[127]!==w||t[128]!==T||t[129]!==R||t[130]!==q||t[131]!==N||t[132]!==P?(ee=(0,$.jsxs)(`section`,{"aria-labelledby":N,className:P,children:[C,w,T,R,q]}),t[126]=C,t[127]=w,t[128]=T,t[129]=R,t[130]=q,t[131]=N,t[132]=P,t[133]=ee):ee=t[133],ee}function Yt(e,t){let n=e.templates;if(!n||typeof n!=`object`)return;let r=n[t];if(!r||typeof r!=`object`)return;let i=r.title?.trim(),a=r.prompt?.trim();if(!(!i||!a))return{title:i,description:(r.description??``).trim(),prompt:a}}var Xt=[`daily`,`monitoring`,`reports`,`automation`],Zt=[{templateId:`morning_briefing`,category:`daily`,defaultSchedule:`0 7 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`standup_prep`,category:`daily`,defaultSchedule:`0 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`meeting_prep`,category:`daily`,defaultSchedule:`0 9 * * 1-5`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`meeting_prep`},{templateId:`end_of_day_wrap_up`,category:`daily`,defaultSchedule:`0 18 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`inbox_triage`,category:`daily`,defaultSchedule:`30 8 * * 1-5`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`inbox_triage`},{templateId:`competitor_watch`,category:`monitoring`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`competitor_scan`},{templateId:`trending_topics_monitor`,category:`monitoring`,defaultSchedule:`0 10 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`tech_radar_stack`,category:`monitoring`,defaultSchedule:`0 11 * * 3`,defaultSessionTarget:`isolated`},{templateId:`dependency_check_audit`,category:`monitoring`,defaultSchedule:`0 9 * * 0`,defaultSessionTarget:`isolated`},{templateId:`weekly_review`,category:`reports`,defaultSchedule:`0 17 * * 5`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`weekly_review`},{templateId:`code_quality_report`,category:`reports`,defaultSchedule:`0 14 * * 1`,defaultSessionTarget:`isolated`},{templateId:`git_activity_summary`,category:`reports`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`user_feedback_digest`,category:`reports`,defaultSchedule:`0 16 * * 5`,defaultSessionTarget:`isolated`},{templateId:`content_repurpose`,category:`reports`,defaultSchedule:`0 11 * * 4`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`content_repurpose`},{templateId:`stale_todo_or_issue_sweep`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`},{templateId:`release_notes_or_changelog_draft`,category:`automation`,defaultSchedule:`0 10 * * 4`,defaultSessionTarget:`isolated`},{templateId:`client_proposal`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`client_proposal`},{templateId:`offer_design`,category:`automation`,defaultSchedule:`0 14 1 * *`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`offer_design`},{templateId:`decision_compare`,category:`automation`,defaultSchedule:`0 15 * * 3`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`decision_compare`},{templateId:`workspace_cleanup_suggestions`,category:`automation`,defaultSchedule:`30 18 * * 5`,defaultSessionTarget:`isolated`},{templateId:`smoke_or_ci_health_reminder`,category:`automation`,defaultSchedule:`0 8 * * 1`,defaultSessionTarget:`isolated`}];function Qt(e){return Zt.find(t=>t.templateId===e)}function $t(e,t,n){let r=t.trim().toLowerCase();return Zt.filter(t=>{if(n!==`all`&&t.category!==n)return!1;if(!r)return!0;let i=Yt(e,t.templateId);return[t.templateId,i?.title,i?.description,e.templateCategories[t.category]].filter(Boolean).join(` `).toLowerCase().includes(r)})}function en(e){let t=new Map;for(let n of e){let e=t.get(n.category)??[];e.push(n),t.set(n.category,e)}return Xt.flatMap(e=>{let n=t.get(e);return n?.length?[{category:e,items:n}]:[]})}function tn(e){let t=(0,Q.c)(23),{template:n,cron:r,localeTag:i,scheduleBadgeLabels:a,onSelectTemplate:o}=e,s;t[0]!==r||t[1]!==n.templateId?(s=Yt(r,n.templateId),t[0]=r,t[1]=n.templateId,t[2]=s):s=t[2];let c=s;if(!c)return null;let l;t[3]!==i||t[4]!==a||t[5]!==n.defaultSchedule?(l=Ve({schedule:n.defaultSchedule,timezone:void 0,next_run:void 0},i,a),t[3]=i,t[4]=a,t[5]=n.defaultSchedule,t[6]=l):l=t[6];let u=l,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=K(`flex h-full flex-col gap-1.5 rounded-xl border border-edge-subtle bg-surface-base p-4 text-left transition-colors`,`hover:border-accent/40 hover:bg-surface-hover`,g.focusRingPanel),t[7]=d):d=t[7];let f;t[8]!==o||t[9]!==n.templateId?(f=()=>o(n.templateId),t[8]=o,t[9]=n.templateId,t[10]=f):f=t[10];let p=`${r.templateCategories[n.category]} — ${c.title}`,m;t[11]===c.title?m=t[12]:(m=(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:c.title}),t[11]=c.title,t[12]=m);let h;t[13]===c.description?h=t[14]:(h=(0,$.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:c.description}),t[13]=c.description,t[14]=h);let _;t[15]===u?_=t[16]:(_=(0,$.jsx)(`span`,{className:`mt-auto flex items-center gap-1 pt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`span`,{className:`tabular-nums`,children:u})}),t[15]=u,t[16]=_);let v;return t[17]!==f||t[18]!==p||t[19]!==m||t[20]!==h||t[21]!==_?(v=(0,$.jsxs)(`button`,{type:`button`,className:d,onClick:f,"aria-label":p,children:[m,h,_]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=_,t[22]=v):v=t[22],v}function nn(e){let t=(0,Q.c)(49),{cron:n,localeTag:r,scheduleBadgeLabels:i,categoryFilter:a,onCategoryFilterChange:o,onSelectTemplate:s,variant:c}=e,l=c===void 0?`embedded`:c,[u,d]=(0,Z.useState)(``),f;t[0]!==a||t[1]!==n||t[2]!==u?(f=$t(n,u,a),t[0]=a,t[1]=n,t[2]=u,t[3]=f):f=t[3];let p=f,m;t[4]===p?m=t[5]:(m=en(p),t[4]=p,t[5]=m);let h=m,_;t[6]!==a||t[7]!==u?(_=a===`all`&&!u.trim(),t[6]=a,t[7]=u,t[8]=_):_=t[8];let v=_,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(le,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=y):y=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>d(e.target.value),t[10]=b):b=t[10];let x=n.templateSearchPlaceholder,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=K(`h-10 w-full rounded-xl border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,g.focusRingPanel),t[11]=S):S=t[11];let C;t[12]!==n.templateSearchPlaceholder||t[13]!==u?(C=(0,$.jsxs)(`div`,{className:`relative`,children:[y,(0,$.jsx)(`input`,{value:u,onChange:b,placeholder:x,className:S})]}),t[12]=n.templateSearchPlaceholder,t[13]=u,t[14]=C):C=t[14];let w=n.fromTemplate,T=a===`all`?`secondary`:`ghost`,E;t[15]===o?E=t[16]:(E=()=>o(`all`),t[15]=o,t[16]=E);let D;t[17]!==n.templateFilterAll||t[18]!==T||t[19]!==E?(D=(0,$.jsx)(X,{type:`button`,variant:T,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:E,children:n.templateFilterAll}),t[17]=n.templateFilterAll,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O;t[21]!==a||t[22]!==n.templateCategories||t[23]!==o?(O=Xt.map(e=>(0,$.jsx)(X,{type:`button`,variant:a===e?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>o(e),children:n.templateCategories[e]},e)),t[21]=a,t[22]=n.templateCategories,t[23]=o,t[24]=O):O=t[24];let k;t[25]!==n.fromTemplate||t[26]!==D||t[27]!==O?(k=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":w,children:[D,O]}),t[25]=n.fromTemplate,t[26]=D,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==k||t[30]!==C?(A=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[C,k]}),t[29]=k,t[30]=C,t[31]=A):A=t[31];let j=A,M;t[32]!==n||t[33]!==p||t[34]!==h||t[35]!==r||t[36]!==s||t[37]!==i||t[38]!==v||t[39]!==l?(M=p.length===0?(0,$.jsx)(`div`,{className:K(`text-center text-sm text-fg-muted`,l===`dialog`&&`flex h-full flex-col items-center justify-center px-4 py-12`),children:n.templatesEmptyHint}):v?(0,$.jsx)(`div`,{className:`flex flex-col gap-6 pb-1`,children:h.map(e=>(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n.templateCategories[e.category]}),(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:e.items.map(e=>(0,$.jsx)(tn,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:i,onSelectTemplate:s},e.templateId))})]},e.category))}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pb-1 sm:grid-cols-2 xl:grid-cols-3`,children:p.map(e=>(0,$.jsx)(tn,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:i,onSelectTemplate:s},e.templateId))}),t[32]=n,t[33]=p,t[34]=h,t[35]=r,t[36]=s,t[37]=i,t[38]=v,t[39]=l,t[40]=M):M=t[40];let N=M;if(l===`dialog`){let e;t[41]===N?e=t[42]:(e=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:N}),t[41]=N,t[42]=e);let n;return t[43]!==j||t[44]!==e?(n=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[j,e]}),t[43]=j,t[44]=e,t[45]=n):n=t[45],n}let P;return t[46]!==j||t[47]!==N?(P=(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[j,N]}),t[46]=j,t[47]=N,t[48]=P):P=t[48],P}function rn(e){let t=(0,Q.c)(49),{c:n,localeTag:r,scheduleBadgeLabels:i,loading:a,jobsCount:o,sortedJobs:s,templateCategoryFilter:c,onTemplateCategoryFilterChange:l,onSelectTemplate:u,keepAwake:d,wakeSupported:f,onWakeUnsupportedClick:p,onKeepAwakeToggle:m,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onAddJob:x,onRunNow:S,onDelete:C}=e,w;t[0]===n.tabMyTasks?w=t[1]:(w=(0,$.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),t[0]=n.tabMyTasks,t[1]=w);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(z,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=T):T=t[2];let E;t[3]===n.wakeBanner?E=t[4]:(E=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[T,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[3]=n.wakeBanner,t[4]=E);let D;t[5]===n.keepAwake?D=t[6]:(D=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[5]=n.keepAwake,t[6]=D);let O=!f,k=f?void 0:n.wakeLockUnavailable,A=d?`justify-end bg-accent`:`justify-start bg-surface-hover`,j=!f&&`cursor-not-allowed opacity-50`,M;t[7]!==A||t[8]!==j?(M=K(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,A,j),t[7]=A,t[8]=j,t[9]=M):M=t[9];let N;t[10]!==m||t[11]!==p||t[12]!==f?(N=()=>{f?m():p()},t[10]=m,t[11]=p,t[12]=f,t[13]=N):N=t[13];let P;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[14]=P):P=t[14];let F;t[15]!==d||t[16]!==N||t[17]!==O||t[18]!==k||t[19]!==M?(F=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:O,title:k,className:M,onClick:N,children:P}),t[15]=d,t[16]=N,t[17]=O,t[18]=k,t[19]=M,t[20]=F):F=t[20];let I;t[21]!==F||t[22]!==D?(I=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[D,F]}),t[21]=F,t[22]=D,t[23]=I):I=t[23];let L;t[24]!==I||t[25]!==E?(L=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[E,I]}),t[24]=I,t[25]=E,t[26]=L):L=t[26];let R;t[27]!==h||t[28]!==n||t[29]!==o||t[30]!==a||t[31]!==r||t[32]!==x||t[33]!==C||t[34]!==y||t[35]!==_||t[36]!==S||t[37]!==u||t[38]!==l||t[39]!==v||t[40]!==g||t[41]!==i||t[42]!==s||t[43]!==c?(R=a&&o===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,$.jsx)(b,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):o===0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-6 rounded-2xl bg-surface-base px-4 py-8 dark:bg-surface-hover/25 sm:px-6 sm:py-10`,children:[(0,$.jsx)(`div`,{className:`w-full max-w-6xl`,children:(0,$.jsx)(nn,{cron:n,localeTag:r,scheduleBadgeLabels:i,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u})}),(0,$.jsx)(`div`,{className:`flex justify-center`,children:(0,$.jsx)(X,{type:`button`,variant:`primary`,onClick:x,children:n.emptyStateCta})})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-[repeat(auto-fill,minmax(280px,1fr))]`,children:s.map(e=>(0,$.jsx)(Gt,{job:e,c:n,localeTag:r,scheduleBadgeLabels:i,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:e=>void _(e),onToggle:(e,t)=>void v(e,t),onEdit:y,onRunNow:S,onDelete:C},e.id))}),t[27]=h,t[28]=n,t[29]=o,t[30]=a,t[31]=r,t[32]=x,t[33]=C,t[34]=y,t[35]=_,t[36]=S,t[37]=u,t[38]=l,t[39]=v,t[40]=g,t[41]=i,t[42]=s,t[43]=c,t[44]=R):R=t[44];let B;return t[45]!==w||t[46]!==L||t[47]!==R?(B=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[w,L,R]}),t[45]=w,t[46]=L,t[47]=R,t[48]=B):B=t[48],B}function an(e){let t=(0,Q.c)(29),{open:n,onOpenChange:r,c:i,localeTag:a,scheduleBadgeLabels:o,categoryFilter:s,onCategoryFilterChange:c,onSelectTemplate:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=K(`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(90vh,840px)] w-full max-w-5xl flex-col`,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,g.focusRingPanel),t[1]=d):d=t[1];let f;t[2]===i.fromTemplate?f=t[3]:(f=(0,$.jsx)(S,{className:`text-lg font-semibold text-fg`,children:i.fromTemplate}),t[2]=i.fromTemplate,t[3]=f);let p;t[4]===i.templatePickerHint?p=t[5]:(p=(0,$.jsx)(L,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.templatePickerHint}),t[4]=i.templatePickerHint,t[5]=p);let m;t[6]!==f||t[7]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[6]=f,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(fe,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=h):h=t[9];let _;t[10]===i.close?_=t[11]:(_=(0,$.jsx)(W,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":i.close,children:h})}),t[10]=i.close,t[11]=_);let v;t[12]!==m||t[13]!==_?(v=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge-subtle px-6 py-5`,children:[m,_]}),t[12]=m,t[13]=_,t[14]=v):v=t[14];let b;t[15]!==i||t[16]!==s||t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==o?(b=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-6 py-5`,children:(0,$.jsx)(nn,{variant:`dialog`,cron:i,localeTag:a,scheduleBadgeLabels:o,categoryFilter:s,onCategoryFilterChange:c,onSelectTemplate:l})}),t[15]=i,t[16]=s,t[17]=a,t[18]=c,t[19]=l,t[20]=o,t[21]=b):b=t[21];let x;t[22]!==v||t[23]!==b?(x=(0,$.jsxs)(pe,{children:[u,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(he,{className:d,onOpenAutoFocus:on,children:[v,b]})})]}),t[22]=v,t[23]=b,t[24]=x):x=t[24];let C;return t[25]!==r||t[26]!==n||t[27]!==x?(C=(0,$.jsx)(R,{open:n,onOpenChange:r,children:x}),t[25]=r,t[26]=n,t[27]=x,t[28]=C):C=t[28],C}function on(e){return e.preventDefault()}function sn(){return{formOpen:!1,formMode:`add`,formJobId:null,formName:``,formSchedule:dt,formChannel:`local`,formChatId:``,formMessage:``,formMessageMdMode:`edit`,formTaskKind:`message`,formWorkflowDefinitionId:``,formWorkflowGoal:``,formWorkflowArgValues:{},messageEditorNonce:0,formSessionTarget:`main`,formAgentId:``,formAgentLocalOnly:!1,formWorkingDirectory:``,formModel:``,formSubmitting:!1}}function cn(e,t){switch(t.type){case`patch`:return{...e,...t.patch};case`replace`:return t.state;case`setMessageMdMode`:return{...e,formMessageMdMode:t.mode,messageEditorNonce:t.mode===`edit`?e.messageEditorNonce+1:e.messageEditorNonce}}}function ln(e,t){let n=sn();if(n.formOpen=!0,n.formMode=e?`edit`:`add`,n.formJobId=e?.id??null,!e)return n.formModel=t(),n;n.formName=e.name||``,n.formSchedule=e.schedule&&String(e.schedule).trim()||`*/5 * * * *`;let r=Pe(e);if(n.formMessage=r??``,e.payload.kind===`workflowRun`){n.formTaskKind=`workflowRun`,n.formWorkflowDefinitionId=e.payload.definitionId,n.formWorkflowGoal=e.payload.goal||``,n.formWorkflowArgValues=Mt(e.payload.definitionId,e.payload.inputEnvelope?.payload??e.payload.input??{});let t=e.payload.agentId?.trim().toLowerCase();t&&(n.formAgentId=t)}n.formSessionTarget=e.sessionTarget||`main`,n.formAgentId=(e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``,n.formWorkingDirectory=(e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``;let i=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;n.formModel=e.model?.trim()||i||t();let a=e.delivery?.channel===`local`,o=(e.sessionTarget||`main`)===`isolated`&&!a&&(!e.delivery?.to||e.delivery.mode===`none`);if(n.formAgentLocalOnly=o,a)n.formChannel=`local`,n.formChatId=``;else if(e.delivery&&e.delivery.mode!==`none`&&e.delivery.to)n.formChannel=e.delivery.channel||`telegram`,n.formChatId=e.delivery.to||``;else if(o)n.formChannel=`telegram`,n.formChatId=``;else{let e=r.split(`:`);e.length>=3&&[`telegram`,`cli`,`gateway`,`local`].includes(e[0])?(n.formChannel=e[0],n.formChatId=e[1],n.formMessage=e.slice(2).join(`:`)):(n.formChannel=`telegram`,n.formChatId=``)}return n.formMessageMdMode=`edit`,n.messageEditorNonce=1,n}function un(e){let{m:t,defaultModelForForm:n,channels:r,chatAgents:i}=e,[a,o]=(0,Z.useReducer)(cn,void 0,sn),s=(0,Z.useRef)(!1),c=(0,Z.useMemo)(()=>new Set([`local`,...r.map(e=>e.name)]),[r]);if(a.formOpen&&a.formMode===`add`&&!c.has(a.formChannel)&&o({type:`patch`,patch:{formChannel:`local`}}),a.formOpen&&a.formMode===`add`&&!s.current){let e=n();e&&e!==a.formModel&&o({type:`patch`,patch:{formModel:e}})}let l=ge(()=>Fe(a.formChannel),[a.formChannel],{enabled:a.formOpen&&a.formChannel!==`local`,initial:[],errorData:[]}),u=a.formChannel===`local`?[]:l.data,d=(0,Z.useMemo)(()=>{let e=new Set(i.map(e=>e.id)),t=[...i],n=a.formAgentId.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[i,a.formAgentId]),f=a.formChannel!==`local`&&(a.formTaskKind===`message`&&(a.formSessionTarget===`main`||a.formSessionTarget===`isolated`&&!a.formAgentLocalOnly)||a.formTaskKind===`workflowRun`&&!a.formAgentLocalOnly),p=a.formTaskKind===`workflowRun`?!a.formAgentLocalOnly:a.formTaskKind===`message`&&(a.formSessionTarget===`main`||a.formSessionTarget===`isolated`&&!a.formAgentLocalOnly),m=a.formTaskKind===`workflowRun`?!!a.formWorkflowDefinitionId.trim()&&Nt(a.formWorkflowDefinitionId.trim(),a.formWorkflowArgValues):!!a.formMessage.trim(),h=!!a.formName.trim()&&!!a.formSchedule.trim()&&m&&(!f||!!a.formChatId.trim()),g=(0,Z.useCallback)(e=>{s.current=!1,o({type:`replace`,state:ln(e,n)})},[n]),_=(0,Z.useCallback)(e=>{o({type:`setMessageMdMode`,mode:e})},[]),v=(0,Z.useCallback)(e=>{let r=Qt(e),i=r?Yt(t.cron,e):void 0;if(!r||!i)return!1;let a=r.taskKind===`workflowRun`&&!!r.workflowDefinitionId;return s.current=!1,o({type:`replace`,state:{...sn(),formOpen:!0,formMode:`add`,formName:i.title,formSchedule:r.defaultSchedule,formMessage:a?``:i.prompt,formTaskKind:a?`workflowRun`:`message`,formWorkflowDefinitionId:a?r.workflowDefinitionId:``,formWorkflowGoal:a?i.description:``,formSessionTarget:r.defaultSessionTarget,formModel:n(),formAgentLocalOnly:a,messageEditorNonce:1}}),!0},[n,t.cron]),y=(0,Z.useCallback)(()=>{s.current=!1,o({type:`replace`,state:sn()})},[]),b=(0,Z.useCallback)((e,t,n)=>{let r={formSessionTarget:e};e===`main`?(r.formAgentLocalOnly=!1,r.formAgentId=``,r.formWorkingDirectory=``):e===`isolated`&&!n&&(r.formModel=t()),o({type:`patch`,patch:r})},[]),x=(0,Z.useCallback)(e=>{o({type:`patch`,patch:{formChannel:e,formChatId:``,...e===`local`?{formAgentLocalOnly:!1}:{}}})},[]),S=(0,Z.useCallback)(e=>{s.current=!0,o({type:`patch`,patch:{formModel:e}})},[]),C=(0,Z.useCallback)(()=>{Fe(a.formChannel).then(l.setData)},[a.formChannel,l.setData]),w=(0,Z.useCallback)(e=>{o({type:`patch`,patch:e})},[]);return{formOpen:a.formOpen,formMode:a.formMode,formJobId:a.formJobId,formName:a.formName,formSchedule:a.formSchedule,formChannel:a.formChannel,formChatId:a.formChatId,formMessage:a.formMessage,formMessageMdMode:a.formMessageMdMode,formTaskKind:a.formTaskKind,formWorkflowDefinitionId:a.formWorkflowDefinitionId,formWorkflowGoal:a.formWorkflowGoal,formWorkflowArgValues:a.formWorkflowArgValues,messageEditorNonce:a.messageEditorNonce,formSessionTarget:a.formSessionTarget,formAgentId:a.formAgentId,formAgentLocalOnly:a.formAgentLocalOnly,formWorkingDirectory:a.formWorkingDirectory,formModel:a.formModel,formSubmitting:a.formSubmitting,sessionChatIds:u,setFormName:e=>w({formName:e}),setFormSchedule:e=>w({formSchedule:e}),setFormChatId:e=>w({formChatId:e}),setFormMessage:e=>w({formMessage:e}),setFormTaskKind:e=>w(e===`workflowRun`?{formTaskKind:e,formSessionTarget:`isolated`,formAgentLocalOnly:!1}:{formTaskKind:e}),setFormWorkflowDefinitionId:e=>w({formWorkflowDefinitionId:e,formWorkflowArgValues:{}}),setFormWorkflowGoal:e=>w({formWorkflowGoal:e}),setFormWorkflowArgValues:e=>w({formWorkflowArgValues:e}),setFormAgentId:e=>w({formAgentId:e}),setFormAgentLocalOnly:e=>w({formAgentLocalOnly:e}),setFormWorkingDirectory:e=>w({formWorkingDirectory:e}),setFormSubmitting:e=>w({formSubmitting:e}),canSubmit:h,needsDeliveryChat:f,showChannelPicker:p,cronAgentSelectOptions:d,openForm:g,closeForm:y,applyCronTemplate:v,setMessageMdMode:_,handleFormSessionTargetChange:b,handleFormChannelChange:x,handleFormModelUserChange:S,refreshRecipientsList:C}}function dn(e){let{onUnavailable:t}=e,[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(`none`),o=(0,Z.useRef)(n),s=typeof navigator<`u`&&`wakeLock`in navigator,c=s||F(),l=(0,Z.useCallback)(async()=>{if(a.current===`electron`){try{await window.electronAPI?.cron?.setDisplaySleepPrevented?.(!1)}catch{}a.current=`none`;return}try{await i.current?.release()}catch{}i.current=null,a.current=`none`},[]),u=(0,Z.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.cron?.setDisplaySleepPrevented:void 0;if(e)try{await e(!0),a.current=`electron`;return}catch{t(),r(!1);return}if(s)try{let e=await navigator.wakeLock.request(`screen`);i.current=e,a.current=`navigator`,e.addEventListener(`release`,()=>{i.current=null,a.current=`none`})}catch{t(),r(!1)}},[t,s]);return o.current=n,(0,Z.useEffect)(()=>{if(!n){l();return}u();let e=()=>{document.visibilityState===`visible`&&o.current&&u()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),l()}},[n,u,l]),{keepAwake:n,setKeepAwake:r,featureAvailable:c}}function fn(e){let{hasToken:t,failMessages:n,isHistoryTab:r}=e,[i,a]=(0,Z.useState)([]),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)([]),[u,d]=(0,Z.useState)(``),[f,m]=(0,Z.useState)([]),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)([]),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),T=(0,Z.useCallback)(async()=>{S(!0),w(null);try{a(await Me())}catch(e){w(e instanceof Error?e.message:n.failedToLoadJobs)}finally{S(!1)}},[n.failedToLoadJobs]),E=(0,Z.useCallback)(async()=>{try{let[e,t,n,r,i]=await Promise.all([Ee(),Oe(),je(),p(),q().catch(()=>null)]);s(e),l(t),d(n.model||``),g(r.payload?.config??null),i&&m(i.items)}catch{}},[]),D=(0,Z.useCallback)(async()=>{b(!0);try{v(await Le(400))}catch{}finally{b(!1)}},[]);return(0,Z.useEffect)(()=>{t&&(T(),E())},[t,T,E]),(0,Z.useEffect)(()=>{if(!t)return;let e=()=>{p().then(e=>{g(e.payload?.config??null)})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[t]),(0,Z.useEffect)(()=>{!t||!r||D()},[t,r,D]),{jobs:i,channels:o,availableModels:c,defaultModel:u,chatAgents:f,gatewayConfigRaw:h,runHistory:_,runHistoryLoading:y,loading:x,error:C,setError:w,userCronJobs:(0,Z.useMemo)(()=>i.filter(e=>!Ne(e)),[i]),systemCronJobs:(0,Z.useMemo)(()=>i.filter(e=>Ne(e)),[i]),heartbeatFromConfig:(0,Z.useMemo)(()=>Ge(h),[h]),loadJobs:T,loadAux:E,loadRunHistoryOnly:D,refreshAll:(0,Z.useCallback)(()=>{T(),E(),D()},[T,E,D])}}function pn(e,t){let n=[...e];return n.sort((e,n)=>{let r=new Date(e.created_at).getTime(),i=new Date(n.created_at).getTime();return t===`created_desc`?i-r:r-i}),n}function mn(e,t,n,r){let i=new Date,a=t===`day`?pt(i):t===`week`?mt(i):ht(i);return e.filter(e=>!(new Date(e.startedAt)<a||n&&e.jobId!==n||r&&e.status!==r))}var hn={mainTab:`myTasks`,jobSort:`created_desc`,historyRange:`day`,historyJobFilter:``,historyStatusFilter:``,detailOpen:!1,detailJob:null,detailHistory:[],detailLoading:!1,confirmOpen:!1,templatePickerOpen:!1,templateCategoryFilter:`all`};function gn(){let e=i(e=>e.language),t=a(e),n=t.cron,r=t.chat,o=u(e=>e.token),c=!!o,d=l(e=>e.resolved)===`dark`,f=e===`zh`?`zh-CN`:`en-US`,[p,m]=P(),[h,g]=(0,Z.useReducer)(j,p,e=>({...hn,mainTab:St(e.get(`tab`))})),{mainTab:_,jobSort:y,historyRange:b,historyJobFilter:x,historyStatusFilter:S,detailOpen:C,detailJob:w,detailHistory:T,detailLoading:E,confirmOpen:D,templatePickerOpen:O,templateCategoryFilter:k}=h,A=St(p.get(`tab`));(0,Z.useEffect)(()=>{A!==_&&g({type:`patch`,patch:{mainTab:A}})},[A,_]);let M=(0,Z.useCallback)(e=>{g({type:`patch`,patch:{mainTab:e}}),m(t=>{let n=new URLSearchParams(t),r=Ct(e);return r?n.set(`tab`,r):n.delete(`tab`),n},{replace:!0})},[m]),N=fn({hasToken:c,failMessages:{failedToLoadJobs:n.failedToLoadJobs},isHistoryTab:_===`history`}),{setError:F}=N,I=dn({onUnavailable:()=>F(n.wakeLockUnavailable)}),L=(0,Z.useCallback)(()=>N.defaultModel||(N.availableModels.length>0?N.availableModels[0].id:``),[N.defaultModel,N.availableModels]),R=un({m:t,defaultModelForForm:L,channels:N.channels,chatAgents:N.chatAgents}),z=s(c&&R.formOpen?[`workflow-definitions-cron`,o]:null,v,{revalidateOnFocus:!1}),B=z.data??[],V=(0,Z.useRef)(null),H=(0,Z.useRef)(null),U=(0,Z.useCallback)((e,t)=>{V.current=e,H.current=t,g({type:`patch`,patch:{confirmOpen:!0}})},[]),W=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{confirmOpen:!1}}),H.current=null,V.current=null},[]),G=(0,Z.useRef)(null),K=(0,Z.useCallback)(e=>{G.current=e,window.setTimeout(()=>{G.current===e&&(G.current=null)},400)},[]),q=(0,Z.useCallback)(e=>{R.applyCronTemplate(e)&&g({type:`patch`,patch:{templatePickerOpen:!1}})},[R]),ee=async()=>{if(!R.formName.trim()){F(n.nameRequired);return}if(!R.formSchedule.trim()){F(n.scheduleRequired);return}if(R.formTaskKind===`message`&&!R.formMessage.trim()){F(n.scheduleRequired);return}if(R.formTaskKind===`workflowRun`&&!R.formWorkflowDefinitionId.trim()){F(n.workflowDefinitionRequired);return}if(R.formTaskKind===`workflowRun`&&!Nt(R.formWorkflowDefinitionId.trim(),R.formWorkflowArgValues)){F(n.workflowArgsRequired);return}if(R.needsDeliveryChat&&!R.formChatId.trim()){F(n.chatIdRequired);return}R.setFormSubmitting(!0),F(null);try{let e=R.formMessage.trim(),t=R.formModel.trim(),n=R.formAgentId.trim().toLowerCase(),r=R.formWorkingDirectory.trim(),i=R.formTaskKind===`workflowRun`,a=R.formTaskKind===`message`&&R.formSessionTarget===`isolated`,o=i?`isolated`:R.formSessionTarget,s;s=i?R.formAgentLocalOnly?{mode:`none`}:R.formChannel===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:R.formChannel,to:R.formChatId.trim()}:R.formSessionTarget===`isolated`&&R.formAgentLocalOnly?{mode:`none`}:R.formChannel===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:R.formChannel,to:R.formChatId.trim()};let c;if(i){let e=R.formWorkflowDefinitionId.trim(),t=Je(R.formWorkflowArgValues);c={kind:`workflowRun`,definitionId:e,...t===void 0?{}:{inputEnvelope:{payload:t}},...R.formWorkflowGoal.trim()?{goal:R.formWorkflowGoal.trim()}:{},...n?{agentId:n}:{}}}else c=a?{kind:`agentTurn`,message:e,...t?{model:t}:{}}:{kind:`systemEvent`,text:e};let l=o===`main`?null:n||null,u={name:R.formName.trim(),schedule:R.formSchedule.trim(),sessionTarget:o,model:a&&t?t:void 0,...i?{timeout:ft}:{},delivery:s,payload:c,...R.formMode===`edit`?{agentId:l,workingDirectory:a&&r||null}:{...o===`isolated`&&n?{agentId:n}:{},...a&&r?{workingDirectory:r}:{}}};if(R.formMode===`edit`&&R.formJobId)await Be(R.formJobId,u);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=u;await we(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}R.closeForm(),await N.loadJobs()}catch(e){F(e instanceof Error?e.message:R.formMode===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{R.setFormSubmitting(!1)}},te=async e=>{g({type:`patch`,patch:{detailOpen:!0,detailJob:e,detailLoading:!0,detailHistory:[]}});try{let t=await De(e.id);t&&g({type:`patch`,patch:{detailJob:t,detailHistory:await ze(e.id,20)}})}catch{}finally{g({type:`patch`,patch:{detailLoading:!1}})}},ne=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{detailOpen:!1,detailJob:null}})},[]),re=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{templateCategoryFilter:`all`,templatePickerOpen:!0}})},[]),J=async(e,t)=>{try{await Ce(e.id,t),w?.id===e.id&&g({type:`patch`,patch:{detailJob:{...w,enabled:t}}}),await Promise.all([N.loadJobs(),N.loadAux()])}catch(e){F(e instanceof Error?e.message:n.failedToToggleJob)}},ie=async()=>{let e=H.current,t=V.current;if(!(!e||!t)){W();try{t===`run`?await ke(e):(await Ae(e),w?.id===e&&g({type:`patch`,patch:{detailOpen:!1,detailJob:null}})),await Promise.all([N.loadJobs(),N.loadAux(),N.loadRunHistoryOnly()])}catch(e){F(e instanceof Error?e.message:n.actionFailed)}}};(0,Z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(R.formOpen?R.closeForm():C&&g({type:`patch`,patch:{detailOpen:!1,detailJob:null}}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[R,C]);let Y=(0,Z.useMemo)(()=>({running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled}),[n.execStatusCancelled,n.execStatusFailed,n.execStatusRunning,n.execStatusSuccess]),ae=(0,Z.useMemo)(()=>pn(N.userCronJobs,y),[N.userCronJobs,y]),oe=(0,Z.useMemo)(()=>pn(N.systemCronJobs,y),[N.systemCronJobs,y]),se=(0,Z.useMemo)(()=>mn(N.runHistory,b,x,S),[N.runHistory,b,x,S]),ce=n.scheduleBadge;return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_n,{hasToken:c,c:n,loading:N.loading,runHistoryLoading:N.runHistoryLoading,onRefresh:N.refreshAll,onOpenTemplatePicker:re,onAddJob:()=>R.openForm()}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[N.error?(0,$.jsx)(`div`,{className:`rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,role:`alert`,children:N.error}):null,(0,$.jsx)(Vt,{c:n,mainTab:_,onMainTabChange:M,jobSort:y,onJobSortChange:e=>g({type:`patch`,patch:{jobSort:e}}),historyRange:b,onHistoryRangeChange:e=>g({type:`patch`,patch:{historyRange:e}}),historyJobFilter:x,onHistoryJobFilterChange:e=>g({type:`patch`,patch:{historyJobFilter:e}}),historyStatusFilter:S,onHistoryStatusFilterChange:e=>g({type:`patch`,patch:{historyStatusFilter:e}}),jobs:N.jobs}),_===`myTasks`?(0,$.jsx)(rn,{c:n,localeTag:f,scheduleBadgeLabels:ce,loading:N.loading,jobsCount:N.userCronJobs.length,sortedJobs:ae,templateCategoryFilter:k,onTemplateCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:q,keepAwake:I.keepAwake,wakeSupported:I.featureAvailable,onWakeUnsupportedClick:()=>F(n.wakeLockUnavailable),onKeepAwakeToggle:()=>I.setKeepAwake(e=>!e),absorbCardClickJobIdRef:G,scheduleAbsorbNextMenuCardClick:K,onOpenDetail:e=>void te(e),onToggle:(e,t)=>void J(e,t),onEdit:e=>R.openForm(e),onAddJob:()=>R.openForm(),onRunNow:e=>U(`run`,e.id),onDelete:e=>U(`delete`,e.id)}):_===`systemTasks`?(0,$.jsx)(Jt,{c:n,language:e,localeTag:f,scheduleBadgeLabels:ce,loading:N.loading,sortedSystemJobs:oe,heartbeat:N.heartbeatFromConfig,keepAwake:I.keepAwake,wakeSupported:I.featureAvailable,onWakeUnsupportedClick:()=>F(n.wakeLockUnavailable),onKeepAwakeToggle:()=>I.setKeepAwake(e=>!e),absorbCardClickJobIdRef:G,scheduleAbsorbNextMenuCardClick:K,onOpenDetail:e=>void te(e),onToggle:(e,t)=>void J(e,t),onEdit:e=>R.openForm(e),onRunNow:e=>U(`run`,e.id),onDelete:e=>U(`delete`,e.id)}):_===`history`?(0,$.jsx)(Wt,{c:n,runHistoryLoading:N.runHistoryLoading,runHistory:N.runHistory,filteredRunHistory:se,jobs:N.jobs,onRefreshHistory:()=>void N.loadRunHistoryOnly(),onOpenJobDetail:e=>void te(e),statusLabels:Y}):(0,$.jsx)(ct,{hasToken:c})]}),(0,$.jsx)(It,{open:R.formOpen,onRequestClose:R.closeForm,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:d,channels:N.channels,sessionChatIds:R.sessionChatIds,cronAgentSelectOptions:R.cronAgentSelectOptions,defaultModelResolver:L,formMode:R.formMode,formJobId:R.formJobId,formName:R.formName,onFormNameChange:R.setFormName,formSchedule:R.formSchedule,onFormScheduleChange:R.setFormSchedule,formSubmitting:R.formSubmitting,formTaskKind:R.formTaskKind,onFormTaskKindChange:R.setFormTaskKind,workflowDefinitions:B,workflowDefinitionsLoading:z.isLoading,formWorkflowDefinitionId:R.formWorkflowDefinitionId,onFormWorkflowDefinitionIdChange:R.setFormWorkflowDefinitionId,formWorkflowGoal:R.formWorkflowGoal,onFormWorkflowGoalChange:R.setFormWorkflowGoal,formWorkflowArgValues:R.formWorkflowArgValues,onFormWorkflowArgValuesChange:R.setFormWorkflowArgValues,formSessionTarget:R.formSessionTarget,onFormSessionTargetChange:R.handleFormSessionTargetChange,formAgentLocalOnly:R.formAgentLocalOnly,onFormAgentLocalOnlyChange:R.setFormAgentLocalOnly,formModel:R.formModel,onFormModelUserChange:R.handleFormModelUserChange,formAgentId:R.formAgentId,onFormAgentIdChange:R.setFormAgentId,formWorkingDirectory:R.formWorkingDirectory,onFormWorkingDirectoryChange:R.setFormWorkingDirectory,formChannel:R.formChannel,onFormChannelChange:R.handleFormChannelChange,formChatId:R.formChatId,onFormChatIdChange:R.setFormChatId,formMessage:R.formMessage,onFormMessageChange:R.setFormMessage,formMessageMdMode:R.formMessageMdMode,onSetMessageMdMode:R.setMessageMdMode,messageEditorNonce:R.messageEditorNonce,needsDeliveryChat:R.needsDeliveryChat,showChannelPicker:R.showChannelPicker,canSubmit:R.canSubmit,onSubmit:()=>void ee(),onRefreshRecipients:R.refreshRecipientsList}),(0,$.jsx)(an,{open:O,onOpenChange:e=>{g({type:`patch`,patch:{templatePickerOpen:e,...e?{templateCategoryFilter:`all`}:{}}})},c:n,localeTag:f,scheduleBadgeLabels:ce,categoryFilter:k,onCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:q}),(0,$.jsx)(kt,{open:C,onDismiss:ne,detailJob:w,detailLoading:E,detailHistory:T,c:n,localeTag:f,scheduleBadgeLabels:ce,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:Y,onEdit:e=>{ne(),R.openForm(e)},onRunNow:e=>U(`run`,e.id),onToggle:(e,t)=>void J(e,t),onDelete:e=>U(`delete`,e.id)}),(0,$.jsx)(et,{open:D,onOpenChange:e=>g({type:`patch`,patch:{confirmOpen:e}}),action:V.current,c:n,onDismiss:W,onConfirm:ie})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_n,{hasToken:c,c:n,loading:N.loading,runHistoryLoading:N.runHistoryLoading,onRefresh:N.refreshAll,onOpenTemplatePicker:re,onAddJob:()=>R.openForm()}),(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-16 text-center text-sm text-fg-muted sm:px-8`,children:n.needToken})]})}function _n(e){let t=(0,Q.c)(14),{hasToken:n,c:r,loading:i,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}=e,l=D(yn),u=D(vn),d;t[0]!==r||t[1]!==i||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==a?(d=(0,$.jsx)(Ut,{c:r,loading:i,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}),t[0]=r,t[1]=i,t[2]=c,t[3]=s,t[4]=o,t[5]=a,t[6]=d):d=t[6];let f=d,p,m;return t[7]!==r.title||t[8]!==u||t[9]!==f||t[10]!==n||t[11]!==l?(p=()=>n?(l({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:f}),()=>u()):(u(),()=>u()),m=[r.title,u,f,n,l],t[7]=r.title,t[8]=u,t[9]=f,t[10]=n,t[11]=l,t[12]=p,t[13]=m):(p=t[12],m=t[13]),(0,Z.useLayoutEffect)(p,m),null}function vn(e){return e.clearPageHeader}function yn(e){return e.setPageHeader}export{gn as CronPage};
|