@xopcai/xopc 0.0.107 → 0.0.109

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.
Files changed (34) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agents-BXg2_mE4.js → agents-D2VtykeA.js} +1 -1
  4. package/dist/gateway/static/root/assets/{apps-page-CJqQ-7Ss.js → apps-page-BPQ6ueG-.js} +1 -1
  5. package/dist/gateway/static/root/assets/{channels-settings-DvMZ6NAd.js → channels-settings-DgZc25cS.js} +1 -1
  6. package/dist/gateway/static/root/assets/{cron-page-BPBlvSl5.js → cron-page-BQFw5O-8.js} +1 -1
  7. package/dist/gateway/static/root/assets/{dist-CZh0c-s8.js → dist-BLMShn4_.js} +1 -1
  8. package/dist/gateway/static/root/assets/{extension-debug-page-DyJQR0SR.js → extension-debug-page-BbQ8uZY_.js} +1 -1
  9. package/dist/gateway/static/root/assets/{extension-page-CDTuUr9B.js → extension-page-DNcTendk.js} +1 -1
  10. package/dist/gateway/static/root/assets/{extension-settings-page-DszZ8zHD.js → extension-settings-page-ClWJvwHK.js} +1 -1
  11. package/dist/gateway/static/root/assets/{heartbeat-config-api-U10wnPdc.js → heartbeat-config-api-4O1U_Oki.js} +1 -1
  12. package/dist/gateway/static/root/assets/{index-DBc-bVOQ.js → index-S23p3aa0.js} +3 -3
  13. package/dist/gateway/static/root/assets/{logs-page-B6js8Bfi.js → logs-page-BAIdbvSC.js} +1 -1
  14. package/dist/gateway/static/root/assets/{note-detail-page-DFzAXR35.js → note-detail-page-BVDoLwec.js} +1 -1
  15. package/dist/gateway/static/root/assets/{note-time-DOiSU-10.js → note-time-COWUfBZO.js} +1 -1
  16. package/dist/gateway/static/root/assets/{notes-page-DAuZJMT8.js → notes-page-CI3aD7Tm.js} +1 -1
  17. package/dist/gateway/static/root/assets/{schema-form-zM36dvbY.js → schema-form-CDpBshDP.js} +1 -1
  18. package/dist/gateway/static/root/assets/{sessions-page-CAsV03BY.js → sessions-page-DM1S4eso.js} +1 -1
  19. package/dist/gateway/static/root/assets/{settings-advanced-gate-BCvObK1y.js → settings-advanced-gate-Bz_nYzvB.js} +1 -1
  20. package/dist/gateway/static/root/assets/{settings-form-section-Bvl-RInc.js → settings-form-section-BxhPoWWH.js} +1 -1
  21. package/dist/gateway/static/root/assets/{settings-page-DuCJDd74.js → settings-page-Ch_Sd28M.js} +1 -1
  22. package/dist/gateway/static/root/assets/{share-preview-page-rpL4DDTO.js → share-preview-page-D6u4llqD.js} +1 -1
  23. package/dist/gateway/static/root/assets/skills-page-XMi76Nps.js +2 -0
  24. package/dist/gateway/static/root/assets/{voice-api-key-field-D2RJaoj_.js → voice-api-key-field-CMt5Xc7_.js} +1 -1
  25. package/dist/gateway/static/root/assets/{workflow-page.utils-BxacHYen.js → workflow-page.utils-BcZQmKBX.js} +1 -1
  26. package/dist/gateway/static/root/assets/{workflows-page-B1B-est-.js → workflows-page-CxFbPBed.js} +1 -1
  27. package/dist/gateway/static/root/index.html +1 -1
  28. package/dist/package.js +1 -1
  29. package/dist/src/config/paths.js +4 -1
  30. package/dist/src/config/paths.js.map +1 -1
  31. package/dist/src/gateway/heartbeat/service.js +1 -1
  32. package/dist/src/heartbeat/index.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/gateway/static/root/assets/skills-page--BioR9J4.js +0 -2
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a,t as o}from"./url-DQRqHuL-.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-BZozwAeK.js";import{a as u,n as d}from"./fetch-CFdKBnE6.js";import{i as f,n as p,r as m}from"./gateway-startup-retry-DdngdObI.js";import{Ar as h,B as g,Ba as _,Bn as v,Dr as y,E as b,Ea as x,Ei as S,Er as C,F as w,Fo as T,Io as E,Ji as D,Mo as O,Nt as k,Or as A,Po as j,R as M,Tr as N,Ur as P,V as F,Vr as I,Zi as L,Zo as R,_r as z,ci as B,di as V,ei as H,fa as U,fi as W,gr as G,hi as K,ia as q,ii as ee,ja as te,jr as ne,kr as re,ns as ie,o as J,pi as Y,po as X,pr as ae,qa as oe,ro as se,si as ce,ua as le,ui as ue,uo as de,wr as fe,xo as pe,z as me,zi as he,zn as ge}from"./index-DBc-bVOQ.js";import{n as _e,t as ve}from"./settings-form-section-Bvl-RInc.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-BCvObK1y.js";import{s as We,t as Ge}from"./heartbeat-config-api-U10wnPdc.js";import{h as Ke,m as qe,t as Je}from"./workflow-page.utils-BxacHYen.js";import{i as Ye,n as Xe,o as Ze,r as Qe,t as $e}from"./dist-CZh0c-s8.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)(A,{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)(ne,{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)(W,{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,g;t[8]===s?g=t[9]:(g=()=>void s(),t[8]=s,t[9]=g);let _=i===`delete`?a.delete:a.runNow,v;t[10]!==m||t[11]!==g||t[12]!==_?(v=(0,$.jsx)(W,{type:`button`,variant:`primary`,className:m,onClick:g,children:_}),t[10]=m,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==v||t[15]!==p?(y=(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[p,v]}),t[14]=v,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==y||t[18]!==u||t[19]!==f?(b=(0,$.jsxs)(re,{children:[c,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(C,{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,y]})})]}),t[17]=y,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)(h,{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 Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,V,`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,b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{m({type:`patch`,patch:e})},t[12]=b):b=t[12];let x=b,S;t[13]!==s.saveError||t[14]!==p.form||t[15]!==p.saving?(S=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]=S):S=t[16];let C=S;if(!n||!p.form){if(l){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(te,{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 w;t[20]!==s.hint||t[21]!==s.title?(w=(0,$.jsx)(_e,{icon:pe,title:s.title,subtitle:s.hint}),t[20]=s.hint,t[21]=s.title,t[22]=w):w=t[22];let T;t[23]!==s.saved||t[24]!==p.saveOk?(T=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]=T):T=t[25];let E=!y||p.saving,D;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>m({type:`discard`}),t[26]=D):D=t[26];let O;t[27]!==s.discard||t[28]!==E?(O=(0,$.jsx)(W,{type:`button`,variant:`secondary`,disabled:E,onClick:D,children:s.discard}),t[27]=s.discard,t[28]=E,t[29]=O):O=t[29];let k=!y||p.saving,A;t[30]===C?A=t[31]:(A=()=>void C(),t[30]=C,t[31]=A);let j=p.saving?s.saving:s.save,M;t[32]!==k||t[33]!==A||t[34]!==j?(M=(0,$.jsx)(W,{type:`button`,variant:`primary`,disabled:k,onClick:A,children:j}),t[32]=k,t[33]=A,t[34]=j,t[35]=M):M=t[35];let N;t[36]!==O||t[37]!==M||t[38]!==T?(N=(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[T,O,M]}),t[36]=O,t[37]=M,t[38]=T,t[39]=N):N=t[39];let P;t[40]===p.error?P=t[41]:(P=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]=P);let F;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>x({enabled:e.target.checked}),t[42]=F):F=t[42];let I;t[43]===p.form.enabled?I=t[44]:(I=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:p.form.enabled,onChange:F}),t[43]=p.form.enabled,t[44]=I);let L;t[45]!==s.enabled||t[46]!==I?(L=(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg sm:col-span-2`,children:[I,s.enabled]}),t[45]=s.enabled,t[46]=I,t[47]=L):L=t[47];let R=!p.form.enabled,z;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x({maxConcurrentJobs:e}),t[48]=z):z=t[48];let B;t[49]!==s.maxConcurrent||t[50]!==R||t[51]!==p.form.maxConcurrentJobs?(B=(0,$.jsx)(ut,{label:s.maxConcurrent,value:p.form.maxConcurrentJobs,min:1,max:100,disabled:R,onChange:z}),t[49]=s.maxConcurrent,t[50]=R,t[51]=p.form.maxConcurrentJobs,t[52]=B):B=t[52];let V=!p.form.enabled,H;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>x({defaultTimezone:e}),t[53]=H):H=t[53];let U;t[54]!==s.timezone||t[55]!==V||t[56]!==p.form.defaultTimezone?(U=(0,$.jsx)(ut,{label:s.timezone,text:!0,value:p.form.defaultTimezone,disabled:V,onTextChange:H}),t[54]=s.timezone,t[55]=V,t[56]=p.form.defaultTimezone,t[57]=U):U=t[57];let G=!p.form.enabled,K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>x({historyRetentionDays:e}),t[58]=K):K=t[58];let q;t[59]!==s.retentionDays||t[60]!==G||t[61]!==p.form.historyRetentionDays?(q=(0,$.jsx)(ut,{label:s.retentionDays,value:p.form.historyRetentionDays,min:1,max:365,disabled:G,onChange:K}),t[59]=s.retentionDays,t[60]=G,t[61]=p.form.historyRetentionDays,t[62]=q):q=t[62];let ee=!p.form.enabled,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>x({enableMetrics:e.target.checked}),t[63]=ne):ne=t[63];let re;t[64]!==ee||t[65]!==p.form.enableMetrics?(re=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:p.form.enableMetrics,disabled:ee,onChange:ne}),t[64]=ee,t[65]=p.form.enableMetrics,t[66]=re):re=t[66];let ie;t[67]!==s.metrics||t[68]!==re?(ie=(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]=ie):ie=t[69];let J;t[70]!==B||t[71]!==U||t[72]!==q||t[73]!==ie?(J=(0,$.jsxs)(Re,{children:[B,U,q,ie]}),t[70]=B,t[71]=U,t[72]=q,t[73]=ie,t[74]=J):J=t[74];let Y;t[75]!==L||t[76]!==J?(Y=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[L,J]}),t[75]=L,t[76]=J,t[77]=Y):Y=t[77];let X;return t[78]!==N||t[79]!==P||t[80]!==Y||t[81]!==w?(X=(0,$.jsxs)(ve,{children:[w,N,P,Y]}),t[78]=N,t[79]=P,t[80]=Y,t[81]=w,t[82]=X):X=t[82],X}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:Y(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:Y(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 Y(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,ce,e&&`cursor-not-allowed opacity-60`)}function yt(){return Y(ue,B)}var bt=Y(ue,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),xt=Y(ue,`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)(pe,{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 h;t[8]===n.status?h=t[9]:(h=Y(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,wt(n.status)),t[8]=n.status,t[9]=h);let g;t[10]!==n.status||t[11]!==o?(g=Ue(n.status,o),t[10]=n.status,t[11]=o,t[12]=g):g=t[12];let _;t[13]!==h||t[14]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]===n.duration?v=t[17]:(v=He(n.duration),t[16]=n.duration,t[17]=v);let y;t[18]===v?y=t[19]:(y=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:v}),t[18]=v,t[19]=y);let b;t[20]!==y||t[21]!==m||t[22]!==_?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m,_,y]}),t[20]=y,t[21]=m,t[22]=_,t[23]=b):b=t[23];let S;t[24]!==l||t[25]!==r||t[26]!==u?(S=!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]=S):S=t[27];let C;t[28]!==l||t[29]!==r||t[30]!==u?(C=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]=C):C=t[31];let w;t[32]!==b||t[33]!==S||t[34]!==C?(w=(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:[b,S,C]})]}),t[32]=b,t[33]=S,t[34]=C,t[35]=w):w=t[35];let T;t[36]!==a||t[37]!==r||t[38]!==u||t[39]!==i?(T=u?(0,$.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:i,children:[(0,$.jsx)(j,{className:Y(`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]=T):T=t[40];let E;t[41]!==a||t[42]!==n.workflowRunId?(E=n.workflowRunId?.trim()?(0,$.jsxs)(W,{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)(se,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),a.openWorkflow]}):null,t[41]=a,t[42]=n.workflowRunId,t[43]=E):E=t[43];let D;t[44]!==a||t[45]!==n.sessionKey?(D=n.sessionKey?.trim()?(0,$.jsxs)(W,{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)(x,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),a.openChat]}):null,t[44]=a,t[45]=n.sessionKey,t[46]=D):D=t[46];let O;t[47]!==E||t[48]!==D?(O=(0,$.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[E,D]}),t[47]=E,t[48]=D,t[49]=O):O=t[49];let k;t[50]!==T||t[51]!==O?(k=(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:[T,O]}),t[50]=T,t[51]=O,t[52]=k):k=t[52];let A;return t[53]!==w||t[54]!==k?(A=(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:[w,k]}),t[53]=w,t[54]=k,t[55]=A):A=t[55],A}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=Y(`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[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(!1),w=(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]),O=i[0]??null;(0,Z.useEffect)(()=>{if(!e){_(!1),y(null),x(!1);return}y(Et(i))},[e,n?.id,i]);let k=(0,Z.useCallback)(async()=>{n?.schedule&&await H(n.schedule)&&(x(!0),window.setTimeout(()=>x(!1),1500))},[n?.schedule]),M=n?Ve(n,o,s):`—`;return(0,$.jsx)(h,{open:e,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(re,{children:[(0,$.jsx)(A,{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)(C,{className:Y(`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)(ne,{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:M}):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:Y(`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)(N,{asChild:!0,children:(0,$.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:(0,$.jsx)(K,{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)(te,{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:M}),(0,$.jsx)(W,{type:`button`,variant:`secondary`,className:`size-8 shrink-0 p-0`,title:a.detailCopySchedule,"aria-label":a.detailCopySchedule,onClick:()=>void k(),children:b?(0,$.jsx)(T,{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:E,label:a.nextRun,value:n.next_run?xe(n.next_run,a.timeLabels):`—`}),(0,$.jsx)(Ot,{icon:pe,label:a.detailLastRun,value:O?Ue(O.status,u):a.detailNoRecentRuns,valueClassName:O?.status===`failed`?`text-red-700 dark:text-red-300`:O?.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(w.success)).replace(`{{failed}}`,String(w.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)(ge,{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":g,onClick:()=>_(e=>!e),children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(D,{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)(j,{className:Y(`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform`,g&&`rotate-180`),"aria-hidden":!0})]}),g?(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)(pe,{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:()=>y(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)(W,{type:`button`,className:`gap-1.5`,onClick:()=>f(n),children:[(0,$.jsx)(U,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),a.runNow]}),(0,$.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>d(n),children:a.edit}),(0,$.jsxs)(W,{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)(S,{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=me(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}`),_=i||f.picking,v=o??a.notSet,y;t[5]!==c||t[6]!==f.pick||t[7]!==h||t[8]!==_||t[9]!==v||t[10]!==n?(y=(0,$.jsx)(g,{value:n,onPick:f.pick,disabled:_,placeholder:v,title:h,maxWidthClass:c}),t[5]=c,t[6]=f.pick,t[7]=h,t[8]=_,t[9]=v,t[10]=n,t[11]=y):y=t[11];let b;t[12]!==l||t[13]!==i||t[14]!==u||t[15]!==f.picking||t[16]!==m?(b=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]=b):b=t[17];let x;t[18]!==y||t[19]!==b?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y,b]}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]!==f.confirmPick||t[22]!==f.hasNativePicker||t[23]!==f.modalOpen||t[24]!==f.setModalOpen||t[25]!==m||t[26]!==a?(S=f.hasNativePicker?null:(0,$.jsx)(w,{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]=S):S=t[27];let C;return t[28]!==x||t[29]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[28]=x,t[29]=S,t[30]=C):C=t[30],C}function jt(e,t){return e[t]??t}function Mt(e,t){let n=J[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(J[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=J[n]??[];g=e.length>0;let l=Y(`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:Y(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:Y(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:g,onFormNameChange:_,formSchedule:y,onFormScheduleChange:b,formSubmitting:x,formTaskKind:S,onFormTaskKindChange:w,workflowDefinitions:T,workflowDefinitionsLoading:E,formWorkflowDefinitionId:D,onFormWorkflowDefinitionIdChange:O,formWorkflowGoal:j,onFormWorkflowGoalChange:M,formWorkflowArgValues:P,onFormWorkflowArgValuesChange:I,formSessionTarget:L,onFormSessionTargetChange:R,formAgentLocalOnly:z,onFormAgentLocalOnlyChange:B,formModel:V,onFormModelUserChange:H,formAgentId:U,onFormAgentIdChange:G,formWorkingDirectory:ee,onFormWorkingDirectoryChange:te,formChannel:ie,onFormChannelChange:J,formChatId:X,onFormChatIdChange:ae,formMessage:oe,onFormMessageChange:se,formMessageMdMode:ce,onSetMessageMdMode:le,messageEditorNonce:ue,needsDeliveryChat:fe,showChannelPicker:pe,canSubmit:me,onSubmit:_e,onRefreshRecipients:ve}=e,be=i(Bt),xe,Se;if(t[0]!==D||t[1]!==be||t[2]!==T){let e;t[5]===D?e=t[6]:(e=e=>e.id===D.trim(),t[5]=D,t[6]=e),xe=T.find(e),Se=xe?Ke(xe,be):null,t[0]=D,t[1]=be,t[2]=T,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)(A,{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)(ne,{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)(K,{className:`size-5`,strokeWidth:1.75}),t[12]=Oe):Oe=t[12];let ke;t[13]===a.close?ke=t[14]:(ke=(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(W,{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]===_?Ne=t[22]:(Ne=e=>_(e.target.value),t[21]=_,t[22]=Ne);let Pe;t[23]!==a.namePlaceholder||t[24]!==g||t[25]!==Ne?(Pe=(0,$.jsx)(`input`,{type:`text`,className:Me,value:g,onChange:Ne,placeholder:a.namePlaceholder}),t[23]=a.namePlaceholder,t[24]=g,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]!==y||t[32]!==x||t[33]!==b?(Ie=(0,$.jsx)(We,{value:y,onChange:b,disabled:x,labels:a.schedulePicker}),t[30]=a.schedulePicker,t[31]=y,t[32]=x,t[33]=b,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]===w?ze=t[39]:(ze=e=>w(e.target.value),t[38]=w,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]!==x||t[45]!==S||t[46]!==ze||t[47]!==Be||t[48]!==Ve?(He=(0,$.jsxs)(`select`,{className:Re,value:S,disabled:x,onChange:ze,children:[Be,Ve]}),t[44]=x,t[45]=S,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]!==U||t[78]!==z||t[79]!==ie||t[80]!==X||t[81]!==x||t[82]!==S||t[83]!==P||t[84]!==D||t[85]!==j||t[86]!==be||t[87]!==fe||t[88]!==G||t[89]!==B||t[90]!==J||t[91]!==ae||t[92]!==I||t[93]!==O||t[94]!==M||t[95]!==ve||t[96]!==xe||t[97]!==Ce||t[98]!==u||t[99]!==pe||t[100]!==T||t[101]!==E?(Ge=S===`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:D,disabled:x||E,onChange:e=>O(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:E?a.workflowDefinitionsLoading:a.workflowDefinitionPlaceholder}),D.trim()&&!T.some(e=>e.id===D.trim())?(0,$.jsx)(`option`,{value:D,children:D}):null,T.map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.title,e.metadata.source===`user`?` (${a.workflowDefinitionCustom})`:``]},e.id))]}),!E&&T.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}):D.trim()&&!xe?(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:a.workflowDefinitionMissing}):null]}),D.trim()?(0,$.jsx)(Ft,{workflowName:D.trim(),language:be,argValues:P,onArgValuesChange:I,goal:j,onGoalChange:M,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:U,disabled:x,onChange:e=>G(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),d.map(e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} — ${k(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:Y(`ui-checkbox`,`mt-0.5`),checked:z,onChange:e=>B(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})]})]}),pe?(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:ie,onChange:e=>J(e.target.value),children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),l.map(Rt)]})]}),fe?(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)(W,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ve(),children:[(0,$.jsx)(q,{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:Y(vt(),`min-w-0 w-full sm:flex-1`),value:X,onChange:e=>ae(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:bt,value:X,onChange:e=>{let t=e.target.value;t&&ae(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]=U,t[78]=z,t[79]=ie,t[80]=X,t[81]=x,t[82]=S,t[83]=P,t[84]=D,t[85]=j,t[86]=be,t[87]=fe,t[88]=G,t[89]=B,t[90]=J,t[91]=ae,t[92]=I,t[93]=O,t[94]=M,t[95]=ve,t[96]=xe,t[97]=Ce,t[98]=u,t[99]=pe,t[100]=T,t[101]=E,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]!==U||t[139]!==z||t[140]!==ie||t[141]!==X||t[142]!==m||t[143]!==oe||t[144]!==ce||t[145]!==V||t[146]!==L||t[147]!==x||t[148]!==S||t[149]!==ee||t[150]!==c||t[151]!==ue||t[152]!==fe||t[153]!==G||t[154]!==B||t[155]!==J||t[156]!==ae||t[157]!==se||t[158]!==H||t[159]!==R||t[160]!==te||t[161]!==ve||t[162]!==le||t[163]!==u||t[164]!==pe?(qe=S===`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;R(t,f,V.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)(F,{value:V,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:H})]}),(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:U,disabled:x,onChange:e=>G(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),d.map(e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} — ${k(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:te,disabled:x,wd:o.workingDirectory,placeholder:o.workingDirectory.notSet,maxWidthClass:`max-w-[min(16rem,48vw)]`,clearLabel:a.workingDirectoryReset,onClear:()=>te(``)}),(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:Y(`ui-checkbox`,`mt-0.5`),checked:z,onChange:e=>B(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,pe?(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:ie,onChange:e=>{let t=e.target.value;J(t)},children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),l.map(Lt)]})]}),fe?(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)(W,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ve(),children:[(0,$.jsx)(q,{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:Y(vt(),`min-w-0 w-full sm:flex-1`),value:X,onChange:e=>ae(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:bt,value:X,onChange:e=>{let t=e.target.value;t&&ae(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:Y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,ce===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>le(`edit`),children:[(0,$.jsx)(he,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),a.messageEdit]}),(0,$.jsxs)(`button`,{type:`button`,className:Y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,ce===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>le(`preview`),children:[(0,$.jsx)(de,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),a.messagePreview]})]})]}),(0,$.jsx)(`div`,{className:Y(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,x&&`pointer-events-none opacity-60`),children:ce===`edit`?(0,$.jsx)(v,{initialContent:oe,onChange:se,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:oe.trim()?(0,$.jsx)(ge,{content:oe,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]=U,t[139]=z,t[140]=ie,t[141]=X,t[142]=m,t[143]=oe,t[144]=ce,t[145]=V,t[146]=L,t[147]=x,t[148]=S,t[149]=ee,t[150]=c,t[151]=ue,t[152]=fe,t[153]=G,t[154]=B,t[155]=J,t[156]=ae,t[157]=se,t[158]=H,t[159]=R,t[160]=te,t[161]=ve,t[162]=le,t[163]=u,t[164]=pe,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)(W,{type:`button`,variant:`secondary`,onClick:r,children:a.cancel}),t[172]=a.cancel,t[173]=r,t[174]=Ye):Ye=t[174];let Xe=x||!me,Ze=x?a.loading:p===`edit`?a.save:a.create,Qe;t[175]!==_e||t[176]!==Xe||t[177]!==Ze?(Qe=(0,$.jsx)(W,{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)(re,{children:[Te,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(C,{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)(h,{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]:(_=Y(`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=Y(`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=Y(`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=Y(`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=Y(`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 B;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?(B=r===`history`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:Y(z,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,$.jsx)(`button`,{type:`button`,className:Y(G,`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]=B):B=t[68];let V;t[69]!==L||t[70]!==R||t[71]!==B?(V=(0,$.jsxs)(`div`,{className:L,children:[R,B]}),t[69]=L,t[70]=R,t[71]=B,t[72]=V):V=t[72];let H;return t[73]!==F||t[74]!==V?(H=(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,V]}),t[73]=F,t[74]=V,t[75]=H):H=t[75],H}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=Y(`size-4`,f),t[2]=f,t[3]=p);let m;t[4]===p?m=t[5]:(m=(0,$.jsx)(q,{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)(W,{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)(_,{className:`size-4`,strokeWidth:1.75}),t[11]=g):g=t[11];let v;t[12]!==n.fromTemplate||t[13]!==o?(v=(0,$.jsxs)(W,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:o,children:[g,n.fromTemplate]}),t[12]=n.fromTemplate,t[13]=o,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(le,{className:`size-4`,strokeWidth:1.75}),t[15]=y):y=t[15];let b;t[16]!==n.addJob||t[17]!==s?(b=(0,$.jsxs)(W,{type:`button`,variant:`primary`,className:`gap-2`,onClick:s,children:[y,n.addJob]}),t[16]=n.addJob,t[17]=s,t[18]=b):b=t[18];let x;return t[19]!==b||t[20]!==h||t[21]!==v?(x=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[h,v,b]}),t[19]=b,t[20]=h,t[21]=v,t[22]=x):x=t[22],x}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]:(_=Y(`size-4`,g),t[9]=g,t[10]=_);let v;t[11]===_?v=t[12]:(v=(0,$.jsx)(q,{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)(W,{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 b;t[18]!==y||t[19]!==f?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[f,y]}),t[18]=y,t[19]=f,t[20]=b):b=t[20];let x;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?(x=r&&i.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(te,{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)(pe,{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:Y(`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]=x):x=t[42];let S;return t[43]!==b||t[44]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[b,x]}),t[43]=b,t[44]=x,t[45]=S):S=t[45],S}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=Y(`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=Y(`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)(X,{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)(W,{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 N=n.name||n.id,P;t[50]===N?P=t[51]:(P=(0,$.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:N}),t[50]=N,t[51]=P);let F;t[52]===n?F=t[53]:(F=Pe(n),t[52]=n,t[53]=F);let I;t[54]===n?I=t[55]:(I=Pe(n),t[54]=n,t[55]=I);let L;t[56]===I?L=t[57]:(L=(0,$.jsx)(ge,{content:I,compact:!0}),t[56]=I,t[57]=L);let R;t[58]!==F||t[59]!==L?(R=(0,$.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:F,children:L}),t[58]=F,t[59]=L,t[60]=R):R=t[60];let z;t[61]!==P||t[62]!==R?(z=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[P,R]}),t[61]=P,t[62]=R,t[63]=z):z=t[63];let B;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(pe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[64]=B):B=t[64];let V;t[65]!==n||t[66]!==i||t[67]!==a?(V=Ve(n,i,a),t[65]=n,t[66]=i,t[67]=a,t[68]=V):V=t[68];let H;t[69]===V?H=t[70]:(H=(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:[B,(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]}),t[69]=V,t[70]=H);let U;return t[71]!==m||t[72]!==M||t[73]!==z||t[74]!==h||t[75]!==H?(U=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,className:p,onClick:m,onKeyDown:h,children:[M,z,H]}),t[71]=m,t[72]=M,t[73]=z,t[74]=h,t[75]=H,t[76]=U):U=t[76],U}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:b}=e,x,S,C,w,T,E,D,k,A,j,M,N;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);M=`cron-system-tasks-panel`,N=`flex flex-col gap-4`,t[33]===n.tabSystemTasks?S=t[34]:(S=(0,$.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:n.tabSystemTasks}),t[33]=n.tabSystemTasks,t[34]=S),t[35]===n.systemTasksIntro?C=t[36]:(C=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.systemTasksIntro}),t[35]=n.systemTasksIntro,t[36]=C);let o;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(oe,{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=Y(`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 P;t[50]!==u||t[51]!==m||t[52]!==h||t[53]!==v||t[54]!==y?(P=(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]=P):P=t[55];let F;t[56]!==c||t[57]!==P?(F=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[c,P]}),t[56]=c,t[57]=P,t[58]=F):F=t[58],t[59]!==s||t[60]!==F?(w=(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]=w):w=t[61],A=`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 z;t[66]!==I||t[67]!==L?(z=(0,$.jsxs)(`div`,{children:[I,L]}),t[66]=I,t[67]=L,t[68]=z):z=t[68];let B;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(O,{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)(W,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(R,{to:`/settings/heartbeat`,children:[n.systemHeartbeatSettingsLink,B]})}),t[70]=n.systemHeartbeatSettingsLink,t[71]=V),t[72]!==z||t[73]!==V?(j=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[z,V]}),t[72]=z,t[73]=V,t[74]=j):j=t[74],D=`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,G;t[77]===U?G=t[78]:(G=(0,$.jsx)(`dd`,{className:`text-fg`,children:U}),t[77]=U,t[78]=G),t[79]!==H||t[80]!==G?(k=(0,$.jsxs)(`div`,{children:[H,G]}),t[79]=H,t[80]=G,t[81]=k):k=t[81],t[82]===n.systemHeartbeatInterval?E=t[83]:(E=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatInterval}),t[82]=n.systemHeartbeatInterval,t[83]=E),x=`text-fg`;let K;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(K=/\{\{value\}\}/g,t[84]=K):K=t[84],T=n.systemHeartbeatEvery.replace(K,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]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=N}else x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],k=t[28],A=t[29],j=t[30],M=t[31],N=t[32];let P;t[85]!==x||t[86]!==T?(P=(0,$.jsx)(`dd`,{className:x,children:T}),t[85]=x,t[86]=T,t[87]=P):P=t[87];let F;t[88]!==P||t[89]!==E?(F=(0,$.jsxs)(`div`,{children:[E,P]}),t[88]=P,t[89]=E,t[90]=F):F=t[90];let I;t[91]!==F||t[92]!==D||t[93]!==k?(I=(0,$.jsxs)(`dl`,{className:D,children:[k,F]}),t[91]=F,t[92]=D,t[93]=k,t[94]=I):I=t[94];let L;t[95]!==I||t[96]!==A||t[97]!==j?(L=(0,$.jsxs)(`div`,{className:A,children:[j,I]}),t[95]=I,t[96]=A,t[97]=j,t[98]=L):L=t[98];let z;t[99]===n.systemDreamingTitle?z=t[100]:(z=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemDreamingTitle}),t[99]=n.systemDreamingTitle,t[100]=z);let B;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(O,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[101]=B):B=t[101];let V;t[102]===n.systemDreamingSettingsLink?V=t[103]:(V=(0,$.jsx)(W,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(R,{to:`/settings/dreams`,children:[n.systemDreamingSettingsLink,B]})}),t[102]=n.systemDreamingSettingsLink,t[103]=V);let H;t[104]!==z||t[105]!==V?(H=(0,$.jsxs)(`div`,{className:`mb-2 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[z,V]}),t[104]=z,t[105]=V,t[106]=H):H=t[106];let U;t[107]===n.systemDreamingHint?U=t[108]:(U=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n.systemDreamingHint}),t[107]=n.systemDreamingHint,t[108]=U);let G;t[109]!==m||t[110]!==n||t[111]!==s||t[112]!==i||t[113]!==b||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)(te,{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:b},e.id))}),t[109]=m,t[110]=n,t[111]=s,t[112]=i,t[113]=b,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 K;t[122]!==H||t[123]!==U||t[124]!==G?(K=(0,$.jsxs)(`div`,{children:[H,U,G]}),t[122]=H,t[123]=U,t[124]=G,t[125]=K):K=t[125];let q;return t[126]!==S||t[127]!==C||t[128]!==w||t[129]!==L||t[130]!==K||t[131]!==M||t[132]!==N?(q=(0,$.jsxs)(`section`,{"aria-labelledby":M,className:N,children:[S,C,w,L,K]}),t[126]=S,t[127]=C,t[128]=w,t[129]=L,t[130]=K,t[131]=M,t[132]=N,t[133]=q):q=t[133],q}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=Y(`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`,ee.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 g;t[15]===u?g=t[16]:(g=(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]=g);let _;return t[17]!==f||t[18]!==p||t[19]!==m||t[20]!==h||t[21]!==g?(_=(0,$.jsxs)(`button`,{type:`button`,className:d,onClick:f,"aria-label":p,children:[m,h,g]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}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,g;t[6]!==a||t[7]!==u?(g=a===`all`&&!u.trim(),t[6]=a,t[7]=u,t[8]=g):g=t[8];let _=g,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(L,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>d(e.target.value),t[10]=y):y=t[10];let b=n.templateSearchPlaceholder,x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=Y(`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`,ee.focusRingPanel),t[11]=x):x=t[11];let S;t[12]!==n.templateSearchPlaceholder||t[13]!==u?(S=(0,$.jsxs)(`div`,{className:`relative`,children:[v,(0,$.jsx)(`input`,{value:u,onChange:y,placeholder:b,className:x})]}),t[12]=n.templateSearchPlaceholder,t[13]=u,t[14]=S):S=t[14];let C=n.fromTemplate,w=a===`all`?`secondary`:`ghost`,T;t[15]===o?T=t[16]:(T=()=>o(`all`),t[15]=o,t[16]=T);let E;t[17]!==n.templateFilterAll||t[18]!==w||t[19]!==T?(E=(0,$.jsx)(W,{type:`button`,variant:w,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:T,children:n.templateFilterAll}),t[17]=n.templateFilterAll,t[18]=w,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==a||t[22]!==n.templateCategories||t[23]!==o?(D=Xt.map(e=>(0,$.jsx)(W,{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]=D):D=t[24];let O;t[25]!==n.fromTemplate||t[26]!==E||t[27]!==D?(O=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":C,children:[E,D]}),t[25]=n.fromTemplate,t[26]=E,t[27]=D,t[28]=O):O=t[28];let k;t[29]!==O||t[30]!==S?(k=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[S,O]}),t[29]=O,t[30]=S,t[31]=k):k=t[31];let A=k,j;t[32]!==n||t[33]!==p||t[34]!==h||t[35]!==r||t[36]!==s||t[37]!==i||t[38]!==_||t[39]!==l?(j=p.length===0?(0,$.jsx)(`div`,{className:Y(`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}):_?(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]=_,t[39]=l,t[40]=j):j=t[40];let M=j;if(l===`dialog`){let e;t[41]===M?e=t[42]:(e=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:M}),t[41]=M,t[42]=e);let n;return t[43]!==A||t[44]!==e?(n=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[A,e]}),t[43]=A,t[44]=e,t[45]=n):n=t[45],n}let N;return t[46]!==A||t[47]!==M?(N=(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[A,M]}),t[46]=A,t[47]=M,t[48]=N):N=t[48],N}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:b,onRunNow:x,onDelete:S}=e,C;t[0]===n.tabMyTasks?C=t[1]:(C=(0,$.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),t[0]=n.tabMyTasks,t[1]=C);let w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(oe,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=w):w=t[2];let T;t[3]===n.wakeBanner?T=t[4]:(T=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[w,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[3]=n.wakeBanner,t[4]=T);let E;t[5]===n.keepAwake?E=t[6]:(E=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[5]=n.keepAwake,t[6]=E);let D=!f,O=f?void 0:n.wakeLockUnavailable,k=d?`justify-end bg-accent`:`justify-start bg-surface-hover`,A=!f&&`cursor-not-allowed opacity-50`,j;t[7]!==k||t[8]!==A?(j=Y(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,k,A),t[7]=k,t[8]=A,t[9]=j):j=t[9];let M;t[10]!==m||t[11]!==p||t[12]!==f?(M=()=>{f?m():p()},t[10]=m,t[11]=p,t[12]=f,t[13]=M):M=t[13];let N;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[14]=N):N=t[14];let P;t[15]!==d||t[16]!==M||t[17]!==D||t[18]!==O||t[19]!==j?(P=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:D,title:O,className:j,onClick:M,children:N}),t[15]=d,t[16]=M,t[17]=D,t[18]=O,t[19]=j,t[20]=P):P=t[20];let F;t[21]!==P||t[22]!==E?(F=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[E,P]}),t[21]=P,t[22]=E,t[23]=F):F=t[23];let I;t[24]!==F||t[25]!==T?(I=(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:[T,F]}),t[24]=F,t[25]=T,t[26]=I):I=t[26];let L;t[27]!==h||t[28]!==n||t[29]!==o||t[30]!==a||t[31]!==r||t[32]!==b||t[33]!==S||t[34]!==y||t[35]!==_||t[36]!==x||t[37]!==u||t[38]!==l||t[39]!==v||t[40]!==g||t[41]!==i||t[42]!==s||t[43]!==c?(L=a&&o===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,$.jsx)(te,{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)(W,{type:`button`,variant:`primary`,onClick:b,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:x,onDelete:S},e.id))}),t[27]=h,t[28]=n,t[29]=o,t[30]=a,t[31]=r,t[32]=b,t[33]=S,t[34]=y,t[35]=_,t[36]=x,t[37]=u,t[38]=l,t[39]=v,t[40]=g,t[41]=i,t[42]=s,t[43]=c,t[44]=L):L=t[44];let R;return t[45]!==C||t[46]!==I||t[47]!==L?(R=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[C,I,L]}),t[45]=C,t[46]=I,t[47]=L,t[48]=R):R=t[48],R}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)(A,{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=Y(`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`,ee.focusRingPanel),t[1]=d):d=t[1];let f;t[2]===i.fromTemplate?f=t[3]:(f=(0,$.jsx)(ne,{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)(y,{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 g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(K,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=g):g=t[9];let _;t[10]===i.close?_=t[11]:(_=(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":i.close,children:g})}),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)(re,{children:[u,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(C,{className:d,onOpenAutoFocus:on,children:[v,b]})})]}),t[22]=v,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==r||t[26]!==n||t[27]!==x?(S=(0,$.jsx)(h,{open:n,onOpenChange:r,children:x}),t[25]=r,t[26]=n,t[27]=x,t[28]=S):S=t[28],S}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=fe(()=>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||P(),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(),ae().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]=ie(),[h,g]=(0,Z.useReducer)(M,p,e=>({...hn,mainTab:St(e.get(`tab`))})),{mainTab:_,jobSort:v,historyRange:y,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 j=(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:P}=N,F=dn({onUnavailable:()=>P(n.wakeLockUnavailable)}),I=(0,Z.useCallback)(()=>N.defaultModel||(N.availableModels.length>0?N.availableModels[0].id:``),[N.defaultModel,N.availableModels]),L=un({m:t,defaultModelForForm:I,channels:N.channels,chatAgents:N.chatAgents}),R=s(c&&L.formOpen?[`workflow-definitions-cron`,o]:null,b,{revalidateOnFocus:!1}),z=R.data??[],B=(0,Z.useRef)(null),V=(0,Z.useRef)(null),H=(0,Z.useCallback)((e,t)=>{B.current=e,V.current=t,g({type:`patch`,patch:{confirmOpen:!0}})},[]),U=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{confirmOpen:!1}}),V.current=null,B.current=null},[]),W=(0,Z.useRef)(null),G=(0,Z.useCallback)(e=>{W.current=e,window.setTimeout(()=>{W.current===e&&(W.current=null)},400)},[]),K=(0,Z.useCallback)(e=>{L.applyCronTemplate(e)&&g({type:`patch`,patch:{templatePickerOpen:!1}})},[L]),q=async()=>{if(!L.formName.trim()){P(n.nameRequired);return}if(!L.formSchedule.trim()){P(n.scheduleRequired);return}if(L.formTaskKind===`message`&&!L.formMessage.trim()){P(n.scheduleRequired);return}if(L.formTaskKind===`workflowRun`&&!L.formWorkflowDefinitionId.trim()){P(n.workflowDefinitionRequired);return}if(L.formTaskKind===`workflowRun`&&!Nt(L.formWorkflowDefinitionId.trim(),L.formWorkflowArgValues)){P(n.workflowArgsRequired);return}if(L.needsDeliveryChat&&!L.formChatId.trim()){P(n.chatIdRequired);return}L.setFormSubmitting(!0),P(null);try{let e=L.formMessage.trim(),t=L.formModel.trim(),n=L.formAgentId.trim().toLowerCase(),r=L.formWorkingDirectory.trim(),i=L.formTaskKind===`workflowRun`,a=L.formTaskKind===`message`&&L.formSessionTarget===`isolated`,o=i?`isolated`:L.formSessionTarget,s;s=i?L.formAgentLocalOnly?{mode:`none`}:L.formChannel===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:L.formChannel,to:L.formChatId.trim()}:L.formSessionTarget===`isolated`&&L.formAgentLocalOnly?{mode:`none`}:L.formChannel===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:L.formChannel,to:L.formChatId.trim()};let c;if(i){let e=L.formWorkflowDefinitionId.trim(),t=Je(L.formWorkflowArgValues);c={kind:`workflowRun`,definitionId:e,...t===void 0?{}:{inputEnvelope:{payload:t}},...L.formWorkflowGoal.trim()?{goal:L.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:L.formName.trim(),schedule:L.formSchedule.trim(),sessionTarget:o,model:a&&t?t:void 0,...i?{timeout:ft}:{},delivery:s,payload:c,...L.formMode===`edit`?{agentId:l,workingDirectory:a&&r||null}:{...o===`isolated`&&n?{agentId:n}:{},...a&&r?{workingDirectory:r}:{}}};if(L.formMode===`edit`&&L.formJobId)await Be(L.formJobId,u);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=u;await we(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}L.closeForm(),await N.loadJobs()}catch(e){P(e instanceof Error?e.message:L.formMode===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{L.setFormSubmitting(!1)}},ee=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}})}},te=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{detailOpen:!1,detailJob:null}})},[]),ne=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{templateCategoryFilter:`all`,templatePickerOpen:!0}})},[]),re=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){P(e instanceof Error?e.message:n.failedToToggleJob)}},J=async()=>{let e=V.current,t=B.current;if(!(!e||!t)){U();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){P(e instanceof Error?e.message:n.actionFailed)}}};(0,Z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(L.formOpen?L.closeForm():C&&g({type:`patch`,patch:{detailOpen:!1,detailJob:null}}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[L,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]),X=(0,Z.useMemo)(()=>pn(N.userCronJobs,v),[N.userCronJobs,v]),ae=(0,Z.useMemo)(()=>pn(N.systemCronJobs,v),[N.systemCronJobs,v]),oe=(0,Z.useMemo)(()=>mn(N.runHistory,y,x,S),[N.runHistory,y,x,S]),se=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:ne,onAddJob:()=>L.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:j,jobSort:v,onJobSortChange:e=>g({type:`patch`,patch:{jobSort:e}}),historyRange:y,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:se,loading:N.loading,jobsCount:N.userCronJobs.length,sortedJobs:X,templateCategoryFilter:k,onTemplateCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K,keepAwake:F.keepAwake,wakeSupported:F.featureAvailable,onWakeUnsupportedClick:()=>P(n.wakeLockUnavailable),onKeepAwakeToggle:()=>F.setKeepAwake(e=>!e),absorbCardClickJobIdRef:W,scheduleAbsorbNextMenuCardClick:G,onOpenDetail:e=>void ee(e),onToggle:(e,t)=>void re(e,t),onEdit:e=>L.openForm(e),onAddJob:()=>L.openForm(),onRunNow:e=>H(`run`,e.id),onDelete:e=>H(`delete`,e.id)}):_===`systemTasks`?(0,$.jsx)(Jt,{c:n,language:e,localeTag:f,scheduleBadgeLabels:se,loading:N.loading,sortedSystemJobs:ae,heartbeat:N.heartbeatFromConfig,keepAwake:F.keepAwake,wakeSupported:F.featureAvailable,onWakeUnsupportedClick:()=>P(n.wakeLockUnavailable),onKeepAwakeToggle:()=>F.setKeepAwake(e=>!e),absorbCardClickJobIdRef:W,scheduleAbsorbNextMenuCardClick:G,onOpenDetail:e=>void ee(e),onToggle:(e,t)=>void re(e,t),onEdit:e=>L.openForm(e),onRunNow:e=>H(`run`,e.id),onDelete:e=>H(`delete`,e.id)}):_===`history`?(0,$.jsx)(Wt,{c:n,runHistoryLoading:N.runHistoryLoading,runHistory:N.runHistory,filteredRunHistory:oe,jobs:N.jobs,onRefreshHistory:()=>void N.loadRunHistoryOnly(),onOpenJobDetail:e=>void ee(e),statusLabels:Y}):(0,$.jsx)(ct,{hasToken:c})]}),(0,$.jsx)(It,{open:L.formOpen,onRequestClose:L.closeForm,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:d,channels:N.channels,sessionChatIds:L.sessionChatIds,cronAgentSelectOptions:L.cronAgentSelectOptions,defaultModelResolver:I,formMode:L.formMode,formJobId:L.formJobId,formName:L.formName,onFormNameChange:L.setFormName,formSchedule:L.formSchedule,onFormScheduleChange:L.setFormSchedule,formSubmitting:L.formSubmitting,formTaskKind:L.formTaskKind,onFormTaskKindChange:L.setFormTaskKind,workflowDefinitions:z,workflowDefinitionsLoading:R.isLoading,formWorkflowDefinitionId:L.formWorkflowDefinitionId,onFormWorkflowDefinitionIdChange:L.setFormWorkflowDefinitionId,formWorkflowGoal:L.formWorkflowGoal,onFormWorkflowGoalChange:L.setFormWorkflowGoal,formWorkflowArgValues:L.formWorkflowArgValues,onFormWorkflowArgValuesChange:L.setFormWorkflowArgValues,formSessionTarget:L.formSessionTarget,onFormSessionTargetChange:L.handleFormSessionTargetChange,formAgentLocalOnly:L.formAgentLocalOnly,onFormAgentLocalOnlyChange:L.setFormAgentLocalOnly,formModel:L.formModel,onFormModelUserChange:L.handleFormModelUserChange,formAgentId:L.formAgentId,onFormAgentIdChange:L.setFormAgentId,formWorkingDirectory:L.formWorkingDirectory,onFormWorkingDirectoryChange:L.setFormWorkingDirectory,formChannel:L.formChannel,onFormChannelChange:L.handleFormChannelChange,formChatId:L.formChatId,onFormChatIdChange:L.setFormChatId,formMessage:L.formMessage,onFormMessageChange:L.setFormMessage,formMessageMdMode:L.formMessageMdMode,onSetMessageMdMode:L.setMessageMdMode,messageEditorNonce:L.messageEditorNonce,needsDeliveryChat:L.needsDeliveryChat,showChannelPicker:L.showChannelPicker,canSubmit:L.canSubmit,onSubmit:()=>void q(),onRefreshRecipients:L.refreshRecipientsList}),(0,$.jsx)(an,{open:O,onOpenChange:e=>{g({type:`patch`,patch:{templatePickerOpen:e,...e?{templateCategoryFilter:`all`}:{}}})},c:n,localeTag:f,scheduleBadgeLabels:se,categoryFilter:k,onCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K}),(0,$.jsx)(kt,{open:C,onDismiss:te,detailJob:w,detailLoading:E,detailHistory:T,c:n,localeTag:f,scheduleBadgeLabels:se,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:Y,onEdit:e=>{te(),L.openForm(e)},onRunNow:e=>H(`run`,e.id),onToggle:(e,t)=>void re(e,t),onDelete:e=>H(`delete`,e.id)}),(0,$.jsx)(et,{open:D,onOpenChange:e=>g({type:`patch`,patch:{confirmOpen:e}}),action:B.current,c:n,onDismiss:U,onConfirm:J})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_n,{hasToken:c,c:n,loading:N.loading,runHistoryLoading:N.runHistoryLoading,onRefresh:N.refreshAll,onOpenTemplatePicker:ne,onAddJob:()=>L.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=I(yn),u=I(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};
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-DQRqHuL-.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-BZozwAeK.js";import{a as u,n as d}from"./fetch-CFdKBnE6.js";import{i as f,n as p,r as m}from"./gateway-startup-retry-DdngdObI.js";import{Ar as h,B as g,Ba as _,Bn as v,Dr as y,E as b,Ea as x,Ei as S,Er as C,F as w,Fo as T,Io as E,Ji as D,Mo as O,Nt as k,Or as A,Po as j,R as M,Tr as N,Ur as P,V as F,Vr as I,Zi as L,Zo as R,_r as z,ci as B,di as V,ei as H,fa as U,fi as W,gr as G,hi as K,ia as q,ii as ee,ja as te,jr as ne,kr as re,ns as ie,o as J,pi as Y,po as X,pr as ae,qa as oe,ro as se,si as ce,ua as le,ui as ue,uo as de,wr as fe,xo as pe,z as me,zi as he,zn as ge}from"./index-S23p3aa0.js";import{n as _e,t as ve}from"./settings-form-section-BxhPoWWH.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-Bz_nYzvB.js";import{s as We,t as Ge}from"./heartbeat-config-api-4O1U_Oki.js";import{h as Ke,m as qe,t as Je}from"./workflow-page.utils-BcZQmKBX.js";import{i as Ye,n as Xe,o as Ze,r as Qe,t as $e}from"./dist-BLMShn4_.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)(A,{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)(ne,{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)(W,{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,g;t[8]===s?g=t[9]:(g=()=>void s(),t[8]=s,t[9]=g);let _=i===`delete`?a.delete:a.runNow,v;t[10]!==m||t[11]!==g||t[12]!==_?(v=(0,$.jsx)(W,{type:`button`,variant:`primary`,className:m,onClick:g,children:_}),t[10]=m,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==v||t[15]!==p?(y=(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[p,v]}),t[14]=v,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==y||t[18]!==u||t[19]!==f?(b=(0,$.jsxs)(re,{children:[c,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(C,{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,y]})})]}),t[17]=y,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)(h,{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 Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,V,`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,b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{m({type:`patch`,patch:e})},t[12]=b):b=t[12];let x=b,S;t[13]!==s.saveError||t[14]!==p.form||t[15]!==p.saving?(S=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]=S):S=t[16];let C=S;if(!n||!p.form){if(l){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(te,{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 w;t[20]!==s.hint||t[21]!==s.title?(w=(0,$.jsx)(_e,{icon:pe,title:s.title,subtitle:s.hint}),t[20]=s.hint,t[21]=s.title,t[22]=w):w=t[22];let T;t[23]!==s.saved||t[24]!==p.saveOk?(T=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]=T):T=t[25];let E=!y||p.saving,D;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>m({type:`discard`}),t[26]=D):D=t[26];let O;t[27]!==s.discard||t[28]!==E?(O=(0,$.jsx)(W,{type:`button`,variant:`secondary`,disabled:E,onClick:D,children:s.discard}),t[27]=s.discard,t[28]=E,t[29]=O):O=t[29];let k=!y||p.saving,A;t[30]===C?A=t[31]:(A=()=>void C(),t[30]=C,t[31]=A);let j=p.saving?s.saving:s.save,M;t[32]!==k||t[33]!==A||t[34]!==j?(M=(0,$.jsx)(W,{type:`button`,variant:`primary`,disabled:k,onClick:A,children:j}),t[32]=k,t[33]=A,t[34]=j,t[35]=M):M=t[35];let N;t[36]!==O||t[37]!==M||t[38]!==T?(N=(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[T,O,M]}),t[36]=O,t[37]=M,t[38]=T,t[39]=N):N=t[39];let P;t[40]===p.error?P=t[41]:(P=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]=P);let F;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>x({enabled:e.target.checked}),t[42]=F):F=t[42];let I;t[43]===p.form.enabled?I=t[44]:(I=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:p.form.enabled,onChange:F}),t[43]=p.form.enabled,t[44]=I);let L;t[45]!==s.enabled||t[46]!==I?(L=(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg sm:col-span-2`,children:[I,s.enabled]}),t[45]=s.enabled,t[46]=I,t[47]=L):L=t[47];let R=!p.form.enabled,z;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x({maxConcurrentJobs:e}),t[48]=z):z=t[48];let B;t[49]!==s.maxConcurrent||t[50]!==R||t[51]!==p.form.maxConcurrentJobs?(B=(0,$.jsx)(ut,{label:s.maxConcurrent,value:p.form.maxConcurrentJobs,min:1,max:100,disabled:R,onChange:z}),t[49]=s.maxConcurrent,t[50]=R,t[51]=p.form.maxConcurrentJobs,t[52]=B):B=t[52];let V=!p.form.enabled,H;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>x({defaultTimezone:e}),t[53]=H):H=t[53];let U;t[54]!==s.timezone||t[55]!==V||t[56]!==p.form.defaultTimezone?(U=(0,$.jsx)(ut,{label:s.timezone,text:!0,value:p.form.defaultTimezone,disabled:V,onTextChange:H}),t[54]=s.timezone,t[55]=V,t[56]=p.form.defaultTimezone,t[57]=U):U=t[57];let G=!p.form.enabled,K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>x({historyRetentionDays:e}),t[58]=K):K=t[58];let q;t[59]!==s.retentionDays||t[60]!==G||t[61]!==p.form.historyRetentionDays?(q=(0,$.jsx)(ut,{label:s.retentionDays,value:p.form.historyRetentionDays,min:1,max:365,disabled:G,onChange:K}),t[59]=s.retentionDays,t[60]=G,t[61]=p.form.historyRetentionDays,t[62]=q):q=t[62];let ee=!p.form.enabled,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>x({enableMetrics:e.target.checked}),t[63]=ne):ne=t[63];let re;t[64]!==ee||t[65]!==p.form.enableMetrics?(re=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:p.form.enableMetrics,disabled:ee,onChange:ne}),t[64]=ee,t[65]=p.form.enableMetrics,t[66]=re):re=t[66];let ie;t[67]!==s.metrics||t[68]!==re?(ie=(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]=ie):ie=t[69];let J;t[70]!==B||t[71]!==U||t[72]!==q||t[73]!==ie?(J=(0,$.jsxs)(Re,{children:[B,U,q,ie]}),t[70]=B,t[71]=U,t[72]=q,t[73]=ie,t[74]=J):J=t[74];let Y;t[75]!==L||t[76]!==J?(Y=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[L,J]}),t[75]=L,t[76]=J,t[77]=Y):Y=t[77];let X;return t[78]!==N||t[79]!==P||t[80]!==Y||t[81]!==w?(X=(0,$.jsxs)(ve,{children:[w,N,P,Y]}),t[78]=N,t[79]=P,t[80]=Y,t[81]=w,t[82]=X):X=t[82],X}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:Y(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:Y(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 Y(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,ce,e&&`cursor-not-allowed opacity-60`)}function yt(){return Y(ue,B)}var bt=Y(ue,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),xt=Y(ue,`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)(pe,{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 h;t[8]===n.status?h=t[9]:(h=Y(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,wt(n.status)),t[8]=n.status,t[9]=h);let g;t[10]!==n.status||t[11]!==o?(g=Ue(n.status,o),t[10]=n.status,t[11]=o,t[12]=g):g=t[12];let _;t[13]!==h||t[14]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]===n.duration?v=t[17]:(v=He(n.duration),t[16]=n.duration,t[17]=v);let y;t[18]===v?y=t[19]:(y=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:v}),t[18]=v,t[19]=y);let b;t[20]!==y||t[21]!==m||t[22]!==_?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m,_,y]}),t[20]=y,t[21]=m,t[22]=_,t[23]=b):b=t[23];let S;t[24]!==l||t[25]!==r||t[26]!==u?(S=!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]=S):S=t[27];let C;t[28]!==l||t[29]!==r||t[30]!==u?(C=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]=C):C=t[31];let w;t[32]!==b||t[33]!==S||t[34]!==C?(w=(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:[b,S,C]})]}),t[32]=b,t[33]=S,t[34]=C,t[35]=w):w=t[35];let T;t[36]!==a||t[37]!==r||t[38]!==u||t[39]!==i?(T=u?(0,$.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:i,children:[(0,$.jsx)(j,{className:Y(`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]=T):T=t[40];let E;t[41]!==a||t[42]!==n.workflowRunId?(E=n.workflowRunId?.trim()?(0,$.jsxs)(W,{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)(se,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),a.openWorkflow]}):null,t[41]=a,t[42]=n.workflowRunId,t[43]=E):E=t[43];let D;t[44]!==a||t[45]!==n.sessionKey?(D=n.sessionKey?.trim()?(0,$.jsxs)(W,{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)(x,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),a.openChat]}):null,t[44]=a,t[45]=n.sessionKey,t[46]=D):D=t[46];let O;t[47]!==E||t[48]!==D?(O=(0,$.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[E,D]}),t[47]=E,t[48]=D,t[49]=O):O=t[49];let k;t[50]!==T||t[51]!==O?(k=(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:[T,O]}),t[50]=T,t[51]=O,t[52]=k):k=t[52];let A;return t[53]!==w||t[54]!==k?(A=(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:[w,k]}),t[53]=w,t[54]=k,t[55]=A):A=t[55],A}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=Y(`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[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(!1),w=(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]),O=i[0]??null;(0,Z.useEffect)(()=>{if(!e){_(!1),y(null),x(!1);return}y(Et(i))},[e,n?.id,i]);let k=(0,Z.useCallback)(async()=>{n?.schedule&&await H(n.schedule)&&(x(!0),window.setTimeout(()=>x(!1),1500))},[n?.schedule]),M=n?Ve(n,o,s):`—`;return(0,$.jsx)(h,{open:e,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(re,{children:[(0,$.jsx)(A,{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)(C,{className:Y(`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)(ne,{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:M}):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:Y(`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)(N,{asChild:!0,children:(0,$.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:(0,$.jsx)(K,{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)(te,{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:M}),(0,$.jsx)(W,{type:`button`,variant:`secondary`,className:`size-8 shrink-0 p-0`,title:a.detailCopySchedule,"aria-label":a.detailCopySchedule,onClick:()=>void k(),children:b?(0,$.jsx)(T,{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:E,label:a.nextRun,value:n.next_run?xe(n.next_run,a.timeLabels):`—`}),(0,$.jsx)(Ot,{icon:pe,label:a.detailLastRun,value:O?Ue(O.status,u):a.detailNoRecentRuns,valueClassName:O?.status===`failed`?`text-red-700 dark:text-red-300`:O?.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(w.success)).replace(`{{failed}}`,String(w.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)(ge,{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":g,onClick:()=>_(e=>!e),children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(D,{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)(j,{className:Y(`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform`,g&&`rotate-180`),"aria-hidden":!0})]}),g?(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)(pe,{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:()=>y(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)(W,{type:`button`,className:`gap-1.5`,onClick:()=>f(n),children:[(0,$.jsx)(U,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),a.runNow]}),(0,$.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>d(n),children:a.edit}),(0,$.jsxs)(W,{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)(S,{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=me(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}`),_=i||f.picking,v=o??a.notSet,y;t[5]!==c||t[6]!==f.pick||t[7]!==h||t[8]!==_||t[9]!==v||t[10]!==n?(y=(0,$.jsx)(g,{value:n,onPick:f.pick,disabled:_,placeholder:v,title:h,maxWidthClass:c}),t[5]=c,t[6]=f.pick,t[7]=h,t[8]=_,t[9]=v,t[10]=n,t[11]=y):y=t[11];let b;t[12]!==l||t[13]!==i||t[14]!==u||t[15]!==f.picking||t[16]!==m?(b=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]=b):b=t[17];let x;t[18]!==y||t[19]!==b?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y,b]}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]!==f.confirmPick||t[22]!==f.hasNativePicker||t[23]!==f.modalOpen||t[24]!==f.setModalOpen||t[25]!==m||t[26]!==a?(S=f.hasNativePicker?null:(0,$.jsx)(w,{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]=S):S=t[27];let C;return t[28]!==x||t[29]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[28]=x,t[29]=S,t[30]=C):C=t[30],C}function jt(e,t){return e[t]??t}function Mt(e,t){let n=J[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(J[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=J[n]??[];g=e.length>0;let l=Y(`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:Y(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:Y(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:g,onFormNameChange:_,formSchedule:y,onFormScheduleChange:b,formSubmitting:x,formTaskKind:S,onFormTaskKindChange:w,workflowDefinitions:T,workflowDefinitionsLoading:E,formWorkflowDefinitionId:D,onFormWorkflowDefinitionIdChange:O,formWorkflowGoal:j,onFormWorkflowGoalChange:M,formWorkflowArgValues:P,onFormWorkflowArgValuesChange:I,formSessionTarget:L,onFormSessionTargetChange:R,formAgentLocalOnly:z,onFormAgentLocalOnlyChange:B,formModel:V,onFormModelUserChange:H,formAgentId:U,onFormAgentIdChange:G,formWorkingDirectory:ee,onFormWorkingDirectoryChange:te,formChannel:ie,onFormChannelChange:J,formChatId:X,onFormChatIdChange:ae,formMessage:oe,onFormMessageChange:se,formMessageMdMode:ce,onSetMessageMdMode:le,messageEditorNonce:ue,needsDeliveryChat:fe,showChannelPicker:pe,canSubmit:me,onSubmit:_e,onRefreshRecipients:ve}=e,be=i(Bt),xe,Se;if(t[0]!==D||t[1]!==be||t[2]!==T){let e;t[5]===D?e=t[6]:(e=e=>e.id===D.trim(),t[5]=D,t[6]=e),xe=T.find(e),Se=xe?Ke(xe,be):null,t[0]=D,t[1]=be,t[2]=T,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)(A,{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)(ne,{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)(K,{className:`size-5`,strokeWidth:1.75}),t[12]=Oe):Oe=t[12];let ke;t[13]===a.close?ke=t[14]:(ke=(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(W,{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]===_?Ne=t[22]:(Ne=e=>_(e.target.value),t[21]=_,t[22]=Ne);let Pe;t[23]!==a.namePlaceholder||t[24]!==g||t[25]!==Ne?(Pe=(0,$.jsx)(`input`,{type:`text`,className:Me,value:g,onChange:Ne,placeholder:a.namePlaceholder}),t[23]=a.namePlaceholder,t[24]=g,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]!==y||t[32]!==x||t[33]!==b?(Ie=(0,$.jsx)(We,{value:y,onChange:b,disabled:x,labels:a.schedulePicker}),t[30]=a.schedulePicker,t[31]=y,t[32]=x,t[33]=b,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]===w?ze=t[39]:(ze=e=>w(e.target.value),t[38]=w,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]!==x||t[45]!==S||t[46]!==ze||t[47]!==Be||t[48]!==Ve?(He=(0,$.jsxs)(`select`,{className:Re,value:S,disabled:x,onChange:ze,children:[Be,Ve]}),t[44]=x,t[45]=S,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]!==U||t[78]!==z||t[79]!==ie||t[80]!==X||t[81]!==x||t[82]!==S||t[83]!==P||t[84]!==D||t[85]!==j||t[86]!==be||t[87]!==fe||t[88]!==G||t[89]!==B||t[90]!==J||t[91]!==ae||t[92]!==I||t[93]!==O||t[94]!==M||t[95]!==ve||t[96]!==xe||t[97]!==Ce||t[98]!==u||t[99]!==pe||t[100]!==T||t[101]!==E?(Ge=S===`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:D,disabled:x||E,onChange:e=>O(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:E?a.workflowDefinitionsLoading:a.workflowDefinitionPlaceholder}),D.trim()&&!T.some(e=>e.id===D.trim())?(0,$.jsx)(`option`,{value:D,children:D}):null,T.map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.title,e.metadata.source===`user`?` (${a.workflowDefinitionCustom})`:``]},e.id))]}),!E&&T.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}):D.trim()&&!xe?(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:a.workflowDefinitionMissing}):null]}),D.trim()?(0,$.jsx)(Ft,{workflowName:D.trim(),language:be,argValues:P,onArgValuesChange:I,goal:j,onGoalChange:M,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:U,disabled:x,onChange:e=>G(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),d.map(e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} — ${k(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:Y(`ui-checkbox`,`mt-0.5`),checked:z,onChange:e=>B(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})]})]}),pe?(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:ie,onChange:e=>J(e.target.value),children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),l.map(Rt)]})]}),fe?(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)(W,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ve(),children:[(0,$.jsx)(q,{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:Y(vt(),`min-w-0 w-full sm:flex-1`),value:X,onChange:e=>ae(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:bt,value:X,onChange:e=>{let t=e.target.value;t&&ae(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]=U,t[78]=z,t[79]=ie,t[80]=X,t[81]=x,t[82]=S,t[83]=P,t[84]=D,t[85]=j,t[86]=be,t[87]=fe,t[88]=G,t[89]=B,t[90]=J,t[91]=ae,t[92]=I,t[93]=O,t[94]=M,t[95]=ve,t[96]=xe,t[97]=Ce,t[98]=u,t[99]=pe,t[100]=T,t[101]=E,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]!==U||t[139]!==z||t[140]!==ie||t[141]!==X||t[142]!==m||t[143]!==oe||t[144]!==ce||t[145]!==V||t[146]!==L||t[147]!==x||t[148]!==S||t[149]!==ee||t[150]!==c||t[151]!==ue||t[152]!==fe||t[153]!==G||t[154]!==B||t[155]!==J||t[156]!==ae||t[157]!==se||t[158]!==H||t[159]!==R||t[160]!==te||t[161]!==ve||t[162]!==le||t[163]!==u||t[164]!==pe?(qe=S===`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;R(t,f,V.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)(F,{value:V,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:H})]}),(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:U,disabled:x,onChange:e=>G(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),d.map(e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} — ${k(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:te,disabled:x,wd:o.workingDirectory,placeholder:o.workingDirectory.notSet,maxWidthClass:`max-w-[min(16rem,48vw)]`,clearLabel:a.workingDirectoryReset,onClear:()=>te(``)}),(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:Y(`ui-checkbox`,`mt-0.5`),checked:z,onChange:e=>B(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,pe?(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:ie,onChange:e=>{let t=e.target.value;J(t)},children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),l.map(Lt)]})]}),fe?(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)(W,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ve(),children:[(0,$.jsx)(q,{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:Y(vt(),`min-w-0 w-full sm:flex-1`),value:X,onChange:e=>ae(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:bt,value:X,onChange:e=>{let t=e.target.value;t&&ae(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:Y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,ce===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>le(`edit`),children:[(0,$.jsx)(he,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),a.messageEdit]}),(0,$.jsxs)(`button`,{type:`button`,className:Y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,ce===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>le(`preview`),children:[(0,$.jsx)(de,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),a.messagePreview]})]})]}),(0,$.jsx)(`div`,{className:Y(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,x&&`pointer-events-none opacity-60`),children:ce===`edit`?(0,$.jsx)(v,{initialContent:oe,onChange:se,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:oe.trim()?(0,$.jsx)(ge,{content:oe,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]=U,t[139]=z,t[140]=ie,t[141]=X,t[142]=m,t[143]=oe,t[144]=ce,t[145]=V,t[146]=L,t[147]=x,t[148]=S,t[149]=ee,t[150]=c,t[151]=ue,t[152]=fe,t[153]=G,t[154]=B,t[155]=J,t[156]=ae,t[157]=se,t[158]=H,t[159]=R,t[160]=te,t[161]=ve,t[162]=le,t[163]=u,t[164]=pe,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)(W,{type:`button`,variant:`secondary`,onClick:r,children:a.cancel}),t[172]=a.cancel,t[173]=r,t[174]=Ye):Ye=t[174];let Xe=x||!me,Ze=x?a.loading:p===`edit`?a.save:a.create,Qe;t[175]!==_e||t[176]!==Xe||t[177]!==Ze?(Qe=(0,$.jsx)(W,{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)(re,{children:[Te,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(C,{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)(h,{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]:(_=Y(`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=Y(`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=Y(`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=Y(`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=Y(`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 B;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?(B=r===`history`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:Y(z,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,$.jsx)(`button`,{type:`button`,className:Y(G,`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]=B):B=t[68];let V;t[69]!==L||t[70]!==R||t[71]!==B?(V=(0,$.jsxs)(`div`,{className:L,children:[R,B]}),t[69]=L,t[70]=R,t[71]=B,t[72]=V):V=t[72];let H;return t[73]!==F||t[74]!==V?(H=(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,V]}),t[73]=F,t[74]=V,t[75]=H):H=t[75],H}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=Y(`size-4`,f),t[2]=f,t[3]=p);let m;t[4]===p?m=t[5]:(m=(0,$.jsx)(q,{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)(W,{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)(_,{className:`size-4`,strokeWidth:1.75}),t[11]=g):g=t[11];let v;t[12]!==n.fromTemplate||t[13]!==o?(v=(0,$.jsxs)(W,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:o,children:[g,n.fromTemplate]}),t[12]=n.fromTemplate,t[13]=o,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(le,{className:`size-4`,strokeWidth:1.75}),t[15]=y):y=t[15];let b;t[16]!==n.addJob||t[17]!==s?(b=(0,$.jsxs)(W,{type:`button`,variant:`primary`,className:`gap-2`,onClick:s,children:[y,n.addJob]}),t[16]=n.addJob,t[17]=s,t[18]=b):b=t[18];let x;return t[19]!==b||t[20]!==h||t[21]!==v?(x=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[h,v,b]}),t[19]=b,t[20]=h,t[21]=v,t[22]=x):x=t[22],x}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]:(_=Y(`size-4`,g),t[9]=g,t[10]=_);let v;t[11]===_?v=t[12]:(v=(0,$.jsx)(q,{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)(W,{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 b;t[18]!==y||t[19]!==f?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[f,y]}),t[18]=y,t[19]=f,t[20]=b):b=t[20];let x;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?(x=r&&i.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(te,{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)(pe,{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:Y(`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]=x):x=t[42];let S;return t[43]!==b||t[44]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[b,x]}),t[43]=b,t[44]=x,t[45]=S):S=t[45],S}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=Y(`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=Y(`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)(X,{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)(W,{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 N=n.name||n.id,P;t[50]===N?P=t[51]:(P=(0,$.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:N}),t[50]=N,t[51]=P);let F;t[52]===n?F=t[53]:(F=Pe(n),t[52]=n,t[53]=F);let I;t[54]===n?I=t[55]:(I=Pe(n),t[54]=n,t[55]=I);let L;t[56]===I?L=t[57]:(L=(0,$.jsx)(ge,{content:I,compact:!0}),t[56]=I,t[57]=L);let R;t[58]!==F||t[59]!==L?(R=(0,$.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:F,children:L}),t[58]=F,t[59]=L,t[60]=R):R=t[60];let z;t[61]!==P||t[62]!==R?(z=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[P,R]}),t[61]=P,t[62]=R,t[63]=z):z=t[63];let B;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(pe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[64]=B):B=t[64];let V;t[65]!==n||t[66]!==i||t[67]!==a?(V=Ve(n,i,a),t[65]=n,t[66]=i,t[67]=a,t[68]=V):V=t[68];let H;t[69]===V?H=t[70]:(H=(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:[B,(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]}),t[69]=V,t[70]=H);let U;return t[71]!==m||t[72]!==M||t[73]!==z||t[74]!==h||t[75]!==H?(U=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,className:p,onClick:m,onKeyDown:h,children:[M,z,H]}),t[71]=m,t[72]=M,t[73]=z,t[74]=h,t[75]=H,t[76]=U):U=t[76],U}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:b}=e,x,S,C,w,T,E,D,k,A,j,M,N;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);M=`cron-system-tasks-panel`,N=`flex flex-col gap-4`,t[33]===n.tabSystemTasks?S=t[34]:(S=(0,$.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:n.tabSystemTasks}),t[33]=n.tabSystemTasks,t[34]=S),t[35]===n.systemTasksIntro?C=t[36]:(C=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.systemTasksIntro}),t[35]=n.systemTasksIntro,t[36]=C);let o;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(oe,{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=Y(`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 P;t[50]!==u||t[51]!==m||t[52]!==h||t[53]!==v||t[54]!==y?(P=(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]=P):P=t[55];let F;t[56]!==c||t[57]!==P?(F=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[c,P]}),t[56]=c,t[57]=P,t[58]=F):F=t[58],t[59]!==s||t[60]!==F?(w=(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]=w):w=t[61],A=`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 z;t[66]!==I||t[67]!==L?(z=(0,$.jsxs)(`div`,{children:[I,L]}),t[66]=I,t[67]=L,t[68]=z):z=t[68];let B;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(O,{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)(W,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(R,{to:`/settings/heartbeat`,children:[n.systemHeartbeatSettingsLink,B]})}),t[70]=n.systemHeartbeatSettingsLink,t[71]=V),t[72]!==z||t[73]!==V?(j=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[z,V]}),t[72]=z,t[73]=V,t[74]=j):j=t[74],D=`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,G;t[77]===U?G=t[78]:(G=(0,$.jsx)(`dd`,{className:`text-fg`,children:U}),t[77]=U,t[78]=G),t[79]!==H||t[80]!==G?(k=(0,$.jsxs)(`div`,{children:[H,G]}),t[79]=H,t[80]=G,t[81]=k):k=t[81],t[82]===n.systemHeartbeatInterval?E=t[83]:(E=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatInterval}),t[82]=n.systemHeartbeatInterval,t[83]=E),x=`text-fg`;let K;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(K=/\{\{value\}\}/g,t[84]=K):K=t[84],T=n.systemHeartbeatEvery.replace(K,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]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=N}else x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],k=t[28],A=t[29],j=t[30],M=t[31],N=t[32];let P;t[85]!==x||t[86]!==T?(P=(0,$.jsx)(`dd`,{className:x,children:T}),t[85]=x,t[86]=T,t[87]=P):P=t[87];let F;t[88]!==P||t[89]!==E?(F=(0,$.jsxs)(`div`,{children:[E,P]}),t[88]=P,t[89]=E,t[90]=F):F=t[90];let I;t[91]!==F||t[92]!==D||t[93]!==k?(I=(0,$.jsxs)(`dl`,{className:D,children:[k,F]}),t[91]=F,t[92]=D,t[93]=k,t[94]=I):I=t[94];let L;t[95]!==I||t[96]!==A||t[97]!==j?(L=(0,$.jsxs)(`div`,{className:A,children:[j,I]}),t[95]=I,t[96]=A,t[97]=j,t[98]=L):L=t[98];let z;t[99]===n.systemDreamingTitle?z=t[100]:(z=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemDreamingTitle}),t[99]=n.systemDreamingTitle,t[100]=z);let B;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(O,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[101]=B):B=t[101];let V;t[102]===n.systemDreamingSettingsLink?V=t[103]:(V=(0,$.jsx)(W,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(R,{to:`/settings/dreams`,children:[n.systemDreamingSettingsLink,B]})}),t[102]=n.systemDreamingSettingsLink,t[103]=V);let H;t[104]!==z||t[105]!==V?(H=(0,$.jsxs)(`div`,{className:`mb-2 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[z,V]}),t[104]=z,t[105]=V,t[106]=H):H=t[106];let U;t[107]===n.systemDreamingHint?U=t[108]:(U=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n.systemDreamingHint}),t[107]=n.systemDreamingHint,t[108]=U);let G;t[109]!==m||t[110]!==n||t[111]!==s||t[112]!==i||t[113]!==b||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)(te,{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:b},e.id))}),t[109]=m,t[110]=n,t[111]=s,t[112]=i,t[113]=b,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 K;t[122]!==H||t[123]!==U||t[124]!==G?(K=(0,$.jsxs)(`div`,{children:[H,U,G]}),t[122]=H,t[123]=U,t[124]=G,t[125]=K):K=t[125];let q;return t[126]!==S||t[127]!==C||t[128]!==w||t[129]!==L||t[130]!==K||t[131]!==M||t[132]!==N?(q=(0,$.jsxs)(`section`,{"aria-labelledby":M,className:N,children:[S,C,w,L,K]}),t[126]=S,t[127]=C,t[128]=w,t[129]=L,t[130]=K,t[131]=M,t[132]=N,t[133]=q):q=t[133],q}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=Y(`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`,ee.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 g;t[15]===u?g=t[16]:(g=(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]=g);let _;return t[17]!==f||t[18]!==p||t[19]!==m||t[20]!==h||t[21]!==g?(_=(0,$.jsxs)(`button`,{type:`button`,className:d,onClick:f,"aria-label":p,children:[m,h,g]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}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,g;t[6]!==a||t[7]!==u?(g=a===`all`&&!u.trim(),t[6]=a,t[7]=u,t[8]=g):g=t[8];let _=g,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(L,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>d(e.target.value),t[10]=y):y=t[10];let b=n.templateSearchPlaceholder,x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=Y(`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`,ee.focusRingPanel),t[11]=x):x=t[11];let S;t[12]!==n.templateSearchPlaceholder||t[13]!==u?(S=(0,$.jsxs)(`div`,{className:`relative`,children:[v,(0,$.jsx)(`input`,{value:u,onChange:y,placeholder:b,className:x})]}),t[12]=n.templateSearchPlaceholder,t[13]=u,t[14]=S):S=t[14];let C=n.fromTemplate,w=a===`all`?`secondary`:`ghost`,T;t[15]===o?T=t[16]:(T=()=>o(`all`),t[15]=o,t[16]=T);let E;t[17]!==n.templateFilterAll||t[18]!==w||t[19]!==T?(E=(0,$.jsx)(W,{type:`button`,variant:w,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:T,children:n.templateFilterAll}),t[17]=n.templateFilterAll,t[18]=w,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==a||t[22]!==n.templateCategories||t[23]!==o?(D=Xt.map(e=>(0,$.jsx)(W,{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]=D):D=t[24];let O;t[25]!==n.fromTemplate||t[26]!==E||t[27]!==D?(O=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":C,children:[E,D]}),t[25]=n.fromTemplate,t[26]=E,t[27]=D,t[28]=O):O=t[28];let k;t[29]!==O||t[30]!==S?(k=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[S,O]}),t[29]=O,t[30]=S,t[31]=k):k=t[31];let A=k,j;t[32]!==n||t[33]!==p||t[34]!==h||t[35]!==r||t[36]!==s||t[37]!==i||t[38]!==_||t[39]!==l?(j=p.length===0?(0,$.jsx)(`div`,{className:Y(`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}):_?(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]=_,t[39]=l,t[40]=j):j=t[40];let M=j;if(l===`dialog`){let e;t[41]===M?e=t[42]:(e=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:M}),t[41]=M,t[42]=e);let n;return t[43]!==A||t[44]!==e?(n=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[A,e]}),t[43]=A,t[44]=e,t[45]=n):n=t[45],n}let N;return t[46]!==A||t[47]!==M?(N=(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[A,M]}),t[46]=A,t[47]=M,t[48]=N):N=t[48],N}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:b,onRunNow:x,onDelete:S}=e,C;t[0]===n.tabMyTasks?C=t[1]:(C=(0,$.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),t[0]=n.tabMyTasks,t[1]=C);let w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(oe,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=w):w=t[2];let T;t[3]===n.wakeBanner?T=t[4]:(T=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[w,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[3]=n.wakeBanner,t[4]=T);let E;t[5]===n.keepAwake?E=t[6]:(E=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[5]=n.keepAwake,t[6]=E);let D=!f,O=f?void 0:n.wakeLockUnavailable,k=d?`justify-end bg-accent`:`justify-start bg-surface-hover`,A=!f&&`cursor-not-allowed opacity-50`,j;t[7]!==k||t[8]!==A?(j=Y(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,k,A),t[7]=k,t[8]=A,t[9]=j):j=t[9];let M;t[10]!==m||t[11]!==p||t[12]!==f?(M=()=>{f?m():p()},t[10]=m,t[11]=p,t[12]=f,t[13]=M):M=t[13];let N;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[14]=N):N=t[14];let P;t[15]!==d||t[16]!==M||t[17]!==D||t[18]!==O||t[19]!==j?(P=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:D,title:O,className:j,onClick:M,children:N}),t[15]=d,t[16]=M,t[17]=D,t[18]=O,t[19]=j,t[20]=P):P=t[20];let F;t[21]!==P||t[22]!==E?(F=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[E,P]}),t[21]=P,t[22]=E,t[23]=F):F=t[23];let I;t[24]!==F||t[25]!==T?(I=(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:[T,F]}),t[24]=F,t[25]=T,t[26]=I):I=t[26];let L;t[27]!==h||t[28]!==n||t[29]!==o||t[30]!==a||t[31]!==r||t[32]!==b||t[33]!==S||t[34]!==y||t[35]!==_||t[36]!==x||t[37]!==u||t[38]!==l||t[39]!==v||t[40]!==g||t[41]!==i||t[42]!==s||t[43]!==c?(L=a&&o===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,$.jsx)(te,{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)(W,{type:`button`,variant:`primary`,onClick:b,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:x,onDelete:S},e.id))}),t[27]=h,t[28]=n,t[29]=o,t[30]=a,t[31]=r,t[32]=b,t[33]=S,t[34]=y,t[35]=_,t[36]=x,t[37]=u,t[38]=l,t[39]=v,t[40]=g,t[41]=i,t[42]=s,t[43]=c,t[44]=L):L=t[44];let R;return t[45]!==C||t[46]!==I||t[47]!==L?(R=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[C,I,L]}),t[45]=C,t[46]=I,t[47]=L,t[48]=R):R=t[48],R}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)(A,{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=Y(`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`,ee.focusRingPanel),t[1]=d):d=t[1];let f;t[2]===i.fromTemplate?f=t[3]:(f=(0,$.jsx)(ne,{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)(y,{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 g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(K,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=g):g=t[9];let _;t[10]===i.close?_=t[11]:(_=(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":i.close,children:g})}),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)(re,{children:[u,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(C,{className:d,onOpenAutoFocus:on,children:[v,b]})})]}),t[22]=v,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==r||t[26]!==n||t[27]!==x?(S=(0,$.jsx)(h,{open:n,onOpenChange:r,children:x}),t[25]=r,t[26]=n,t[27]=x,t[28]=S):S=t[28],S}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=fe(()=>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||P(),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(),ae().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]=ie(),[h,g]=(0,Z.useReducer)(M,p,e=>({...hn,mainTab:St(e.get(`tab`))})),{mainTab:_,jobSort:v,historyRange:y,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 j=(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:P}=N,F=dn({onUnavailable:()=>P(n.wakeLockUnavailable)}),I=(0,Z.useCallback)(()=>N.defaultModel||(N.availableModels.length>0?N.availableModels[0].id:``),[N.defaultModel,N.availableModels]),L=un({m:t,defaultModelForForm:I,channels:N.channels,chatAgents:N.chatAgents}),R=s(c&&L.formOpen?[`workflow-definitions-cron`,o]:null,b,{revalidateOnFocus:!1}),z=R.data??[],B=(0,Z.useRef)(null),V=(0,Z.useRef)(null),H=(0,Z.useCallback)((e,t)=>{B.current=e,V.current=t,g({type:`patch`,patch:{confirmOpen:!0}})},[]),U=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{confirmOpen:!1}}),V.current=null,B.current=null},[]),W=(0,Z.useRef)(null),G=(0,Z.useCallback)(e=>{W.current=e,window.setTimeout(()=>{W.current===e&&(W.current=null)},400)},[]),K=(0,Z.useCallback)(e=>{L.applyCronTemplate(e)&&g({type:`patch`,patch:{templatePickerOpen:!1}})},[L]),q=async()=>{if(!L.formName.trim()){P(n.nameRequired);return}if(!L.formSchedule.trim()){P(n.scheduleRequired);return}if(L.formTaskKind===`message`&&!L.formMessage.trim()){P(n.scheduleRequired);return}if(L.formTaskKind===`workflowRun`&&!L.formWorkflowDefinitionId.trim()){P(n.workflowDefinitionRequired);return}if(L.formTaskKind===`workflowRun`&&!Nt(L.formWorkflowDefinitionId.trim(),L.formWorkflowArgValues)){P(n.workflowArgsRequired);return}if(L.needsDeliveryChat&&!L.formChatId.trim()){P(n.chatIdRequired);return}L.setFormSubmitting(!0),P(null);try{let e=L.formMessage.trim(),t=L.formModel.trim(),n=L.formAgentId.trim().toLowerCase(),r=L.formWorkingDirectory.trim(),i=L.formTaskKind===`workflowRun`,a=L.formTaskKind===`message`&&L.formSessionTarget===`isolated`,o=i?`isolated`:L.formSessionTarget,s;s=i?L.formAgentLocalOnly?{mode:`none`}:L.formChannel===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:L.formChannel,to:L.formChatId.trim()}:L.formSessionTarget===`isolated`&&L.formAgentLocalOnly?{mode:`none`}:L.formChannel===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:L.formChannel,to:L.formChatId.trim()};let c;if(i){let e=L.formWorkflowDefinitionId.trim(),t=Je(L.formWorkflowArgValues);c={kind:`workflowRun`,definitionId:e,...t===void 0?{}:{inputEnvelope:{payload:t}},...L.formWorkflowGoal.trim()?{goal:L.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:L.formName.trim(),schedule:L.formSchedule.trim(),sessionTarget:o,model:a&&t?t:void 0,...i?{timeout:ft}:{},delivery:s,payload:c,...L.formMode===`edit`?{agentId:l,workingDirectory:a&&r||null}:{...o===`isolated`&&n?{agentId:n}:{},...a&&r?{workingDirectory:r}:{}}};if(L.formMode===`edit`&&L.formJobId)await Be(L.formJobId,u);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=u;await we(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}L.closeForm(),await N.loadJobs()}catch(e){P(e instanceof Error?e.message:L.formMode===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{L.setFormSubmitting(!1)}},ee=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}})}},te=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{detailOpen:!1,detailJob:null}})},[]),ne=(0,Z.useCallback)(()=>{g({type:`patch`,patch:{templateCategoryFilter:`all`,templatePickerOpen:!0}})},[]),re=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){P(e instanceof Error?e.message:n.failedToToggleJob)}},J=async()=>{let e=V.current,t=B.current;if(!(!e||!t)){U();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){P(e instanceof Error?e.message:n.actionFailed)}}};(0,Z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(L.formOpen?L.closeForm():C&&g({type:`patch`,patch:{detailOpen:!1,detailJob:null}}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[L,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]),X=(0,Z.useMemo)(()=>pn(N.userCronJobs,v),[N.userCronJobs,v]),ae=(0,Z.useMemo)(()=>pn(N.systemCronJobs,v),[N.systemCronJobs,v]),oe=(0,Z.useMemo)(()=>mn(N.runHistory,y,x,S),[N.runHistory,y,x,S]),se=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:ne,onAddJob:()=>L.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:j,jobSort:v,onJobSortChange:e=>g({type:`patch`,patch:{jobSort:e}}),historyRange:y,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:se,loading:N.loading,jobsCount:N.userCronJobs.length,sortedJobs:X,templateCategoryFilter:k,onTemplateCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K,keepAwake:F.keepAwake,wakeSupported:F.featureAvailable,onWakeUnsupportedClick:()=>P(n.wakeLockUnavailable),onKeepAwakeToggle:()=>F.setKeepAwake(e=>!e),absorbCardClickJobIdRef:W,scheduleAbsorbNextMenuCardClick:G,onOpenDetail:e=>void ee(e),onToggle:(e,t)=>void re(e,t),onEdit:e=>L.openForm(e),onAddJob:()=>L.openForm(),onRunNow:e=>H(`run`,e.id),onDelete:e=>H(`delete`,e.id)}):_===`systemTasks`?(0,$.jsx)(Jt,{c:n,language:e,localeTag:f,scheduleBadgeLabels:se,loading:N.loading,sortedSystemJobs:ae,heartbeat:N.heartbeatFromConfig,keepAwake:F.keepAwake,wakeSupported:F.featureAvailable,onWakeUnsupportedClick:()=>P(n.wakeLockUnavailable),onKeepAwakeToggle:()=>F.setKeepAwake(e=>!e),absorbCardClickJobIdRef:W,scheduleAbsorbNextMenuCardClick:G,onOpenDetail:e=>void ee(e),onToggle:(e,t)=>void re(e,t),onEdit:e=>L.openForm(e),onRunNow:e=>H(`run`,e.id),onDelete:e=>H(`delete`,e.id)}):_===`history`?(0,$.jsx)(Wt,{c:n,runHistoryLoading:N.runHistoryLoading,runHistory:N.runHistory,filteredRunHistory:oe,jobs:N.jobs,onRefreshHistory:()=>void N.loadRunHistoryOnly(),onOpenJobDetail:e=>void ee(e),statusLabels:Y}):(0,$.jsx)(ct,{hasToken:c})]}),(0,$.jsx)(It,{open:L.formOpen,onRequestClose:L.closeForm,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:d,channels:N.channels,sessionChatIds:L.sessionChatIds,cronAgentSelectOptions:L.cronAgentSelectOptions,defaultModelResolver:I,formMode:L.formMode,formJobId:L.formJobId,formName:L.formName,onFormNameChange:L.setFormName,formSchedule:L.formSchedule,onFormScheduleChange:L.setFormSchedule,formSubmitting:L.formSubmitting,formTaskKind:L.formTaskKind,onFormTaskKindChange:L.setFormTaskKind,workflowDefinitions:z,workflowDefinitionsLoading:R.isLoading,formWorkflowDefinitionId:L.formWorkflowDefinitionId,onFormWorkflowDefinitionIdChange:L.setFormWorkflowDefinitionId,formWorkflowGoal:L.formWorkflowGoal,onFormWorkflowGoalChange:L.setFormWorkflowGoal,formWorkflowArgValues:L.formWorkflowArgValues,onFormWorkflowArgValuesChange:L.setFormWorkflowArgValues,formSessionTarget:L.formSessionTarget,onFormSessionTargetChange:L.handleFormSessionTargetChange,formAgentLocalOnly:L.formAgentLocalOnly,onFormAgentLocalOnlyChange:L.setFormAgentLocalOnly,formModel:L.formModel,onFormModelUserChange:L.handleFormModelUserChange,formAgentId:L.formAgentId,onFormAgentIdChange:L.setFormAgentId,formWorkingDirectory:L.formWorkingDirectory,onFormWorkingDirectoryChange:L.setFormWorkingDirectory,formChannel:L.formChannel,onFormChannelChange:L.handleFormChannelChange,formChatId:L.formChatId,onFormChatIdChange:L.setFormChatId,formMessage:L.formMessage,onFormMessageChange:L.setFormMessage,formMessageMdMode:L.formMessageMdMode,onSetMessageMdMode:L.setMessageMdMode,messageEditorNonce:L.messageEditorNonce,needsDeliveryChat:L.needsDeliveryChat,showChannelPicker:L.showChannelPicker,canSubmit:L.canSubmit,onSubmit:()=>void q(),onRefreshRecipients:L.refreshRecipientsList}),(0,$.jsx)(an,{open:O,onOpenChange:e=>{g({type:`patch`,patch:{templatePickerOpen:e,...e?{templateCategoryFilter:`all`}:{}}})},c:n,localeTag:f,scheduleBadgeLabels:se,categoryFilter:k,onCategoryFilterChange:e=>g({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K}),(0,$.jsx)(kt,{open:C,onDismiss:te,detailJob:w,detailLoading:E,detailHistory:T,c:n,localeTag:f,scheduleBadgeLabels:se,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:Y,onEdit:e=>{te(),L.openForm(e)},onRunNow:e=>H(`run`,e.id),onToggle:(e,t)=>void re(e,t),onDelete:e=>H(`delete`,e.id)}),(0,$.jsx)(et,{open:D,onOpenChange:e=>g({type:`patch`,patch:{confirmOpen:e}}),action:B.current,c:n,onDismiss:U,onConfirm:J})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_n,{hasToken:c,c:n,loading:N.loading,runHistoryLoading:N.runHistoryLoading,onRefresh:N.refreshAll,onOpenTemplatePicker:ne,onAddJob:()=>L.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=I(yn),u=I(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};