@xopcai/xopc 0.0.112 → 0.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/icons/icon-128.png +0 -0
- package/dist/browser-ext/icons/icon-16.png +0 -0
- package/dist/browser-ext/icons/icon-32.png +0 -0
- package/dist/browser-ext/icons/icon-48.png +0 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/delivery-to.d.ts +3 -3
- package/dist/extensions/weixin/src/delivery-to.js.map +1 -1
- package/dist/gateway/static/root/apple-touch-icon.png +0 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-EhRp-ZMa.js → agent-avatar-dicebear-CBlklyNr.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-browser-settings-page-H4foVCiS.js → agent-browser-settings-page-rGbKc2Hh.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-tabbed-page-DDNw2oNU.js → agent-defaults-tabbed-page-CtwVbjOA.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-E_X2kzS1.js → agents-CCBmGcwc.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BIy7KEsM.js → app-management-settings-panel-28E_WfMe.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DGQG8NwA.js → appearance-settings-Do1z0XgJ.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BZLvInLr.js → apps-page-xwCsJS15.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-uuQPupqx.js → archive-plugin-BAFlsov_.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DBkv0cAv.js → attachment-load-V3qGPC3x.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DxxN_VAR.js → binary-plugins-DT8NvA6W.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CwnUlRmO.js → block-editor-CdLMEcHd.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BHvUKlzw.js → channels-settings-C044DcYk.js} +1 -1
- package/dist/gateway/static/root/assets/{config-api-BD-NcD5d.js → config-api-Bf5mjpu7.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-settings-VBzXcEXL.js → connectors-settings-8VEWUOTj.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-api-C5DoipZA.js → cron-api--pAB_rps.js} +1 -1
- package/dist/gateway/static/root/assets/cron-page-DqmNGNOy.js +3 -0
- package/dist/gateway/static/root/assets/{dreaming-settings-DSVhXTPq.js → dreaming-settings-6UZE1FSK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BDHA9o_e.js → extension-debug-page-BGhE7msg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DmDLVSPE.js → extension-page-CvpI45WG.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-1124aHw_.js → extension-settings-page-DAmR5FUe.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-DOe56Wmy.js → fetch-NZmjSXLl.js} +1 -1
- package/dist/gateway/static/root/assets/{format-interval-label-tsMSvBSR.js → format-interval-label-qhth3BMV.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CsD4FC9D.js → gateway-config-api-CaXBt-9R.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-HQ8FBhY2.js → gateway-settings-DphpbLBc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C1zg7pH3.js → gateway-startup-retry-Be1omjh3.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-BG3Onph0.js → goal-detail-page-bv0VRDaf.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-1Ywnt4Cb.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-B5nI6lgz.js → goals-settings-ceEBjnfc.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-CIv42nJD.js → heartbeat-config-api-BzO6G4fD.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DFcVuJ3M.js → heartbeat-settings-DCST9-du.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BTmbp2AU.js → index-Cxm6xsps.js} +59 -58
- package/dist/gateway/static/root/assets/{index-5A_ZaABy.css → index-b_R4tKqt.css} +1 -1
- package/dist/gateway/static/root/assets/{interval-presets-DGP3S7OB.js → interval-presets-DJmshV8n.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-fETaDYQP.js → keyboard-shortcuts-settings-9AUUlQ5Q.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-B1-b27lK.js → logs-page-B_wrxhee.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-CgeBJMOD.js → markdown-split-CYYELqAr.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C30GzlV2.js → media-plugins-BEcMR2M8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CkT-lcgP.js +3 -0
- package/dist/gateway/static/root/assets/{models-hub-panel-DPcTS1-u.js → models-hub-panel-D0JDSbNu.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-page-xeGb4owe.js → note-detail-page-DpFV-EO6.js} +2 -2
- package/dist/gateway/static/root/assets/{note-image-lightbox-t1g0qZYh.js → note-image-lightbox-DNAoPcmm.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-C_TdnKBe.js → notes-page-CdkjTch8.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DeWp9x5g.js → preview-open-alternatives-BPLz0AIv.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BtkPmJIN.js → remote-access-hub-DSYVAi96.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BOaAOJI3.js → save-bar-controls-CrWwWRVK.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-BLWLKqgw.js → schedule-field-CF2sadvN.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-plqRFYT8.js → schema-form-Di5cKjYE.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-DOUjxzJm.js → sessions-page-CenkcVjF.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D9sva86V.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BP5zRrDI.js → settings-collapsible-section-Chh282jW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-Bv8MZplG.js → settings-form-section-Dq-83cQd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DmDfE1ww.js → settings-page-DL35U0x0.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BEFwNcIZ.js → setup-status-panel-Ctwbp9Er.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-4OX1YCgp.js → share-preview-page-0FXYnSUA.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CbKmJZot.js → shares-settings-DIM3JNsr.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DAlNaNzL.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CLrHVzAt.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CGy4f_s2.js → system-settings-panel-W1pTcojB.js} +1 -1
- package/dist/gateway/static/root/assets/use-agent-defaults-form-BVRvkK7m.js +1 -0
- package/dist/gateway/static/root/assets/{use-channel-catalog-CjGHnDvN.js → use-channel-catalog-CgJibfMM.js} +1 -1
- package/dist/gateway/static/root/assets/{use-settings-tab-guard-BMMFa0oA.js → use-settings-tab-guard-Bw_qkRQE.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DnRbhMNq.js → voice-api-key-field-vYAO71Gn.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-player-store-D5vzWwls.js → voice-player-store-C7lziaAx.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-page.utils-tjGpRVnw.js → workflow-page.utils-sgHjOXOm.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DqqHKGj2.js → workflows-page-DYyOTmFx.js} +1 -1
- package/dist/gateway/static/root/favicon-16x16.png +0 -0
- package/dist/gateway/static/root/favicon-32x32.png +0 -0
- package/dist/gateway/static/root/favicon-icon.svg +1 -0
- package/dist/gateway/static/root/favicon.ico +0 -0
- package/dist/gateway/static/root/favicon.png +0 -0
- package/dist/gateway/static/root/favicon.svg +24 -17
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/gateway/static/root/logo-dark.svg +23 -15
- package/dist/gateway/static/root/logo.svg +23 -16
- package/dist/package.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +9 -4
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/ai-assist/text-assist.d.ts +3 -0
- package/dist/src/ai-assist/text-assist.js +25 -7
- package/dist/src/ai-assist/text-assist.js.map +1 -1
- package/dist/src/channels/plugins/types.adapters.d.ts +2 -2
- package/dist/src/cron/executor.js.map +1 -1
- package/dist/src/cron/types.d.ts +2 -2
- package/dist/src/session/store-reader.d.ts +5 -0
- package/dist/src/session/store-reader.js +1 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/cron-page-BLTpdm34.js +0 -3
- package/dist/gateway/static/root/assets/goals-page-DgeKn8zL.js +0 -2
- package/dist/gateway/static/root/assets/messages-BUUfPaZ9.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-qK_bnTrw.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-YdtnUHtK.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DwW1IzQ0.js +0 -2
- package/dist/gateway/static/root/assets/use-agent-defaults-form-BMuMvzl_.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-CkT-lcgP.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{i as s}from"./theme-store-CD2wtgZV.js";import{c,i as l,n as u,t as d}from"./fetch-NZmjSXLl.js";import{r as f}from"./toast-z0toXu32.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{$r as m,B as h,Bo as g,Cr as _,Di as v,Ds as y,Ea as b,Fo as x,Ft as S,H as C,Ha as w,Hi as T,Jr as E,Kr as D,L as O,Oa as k,Oi as A,Oo as j,Qr as M,Ss as N,Ti as P,U as F,V as I,Xr as L,Yr as R,Zr as z,_i as B,_r as V,as as H,ba as U,bo as W,br as G,ii as ee,is as K,ji as te,jo as ne,k as re,ki as q,o as ie,oi as ae,pa as oe,qa as se,qr as ce,ra as le,ro as ue,rs as de,ta as fe,ts as J,ua as pe,uo as me,vr as he,wi as ge,wr as _e,xi as ve,yr as ye,zn as be}from"./index-Cxm6xsps.js";import{t as xe}from"./markdown-editor-AssmZFx4.js";import{t as Se}from"./settings-advanced-gate-D9sva86V.js";import{n as Ce,t as we}from"./settings-form-section-Dq-83cQd.js";import{C as Y,S as Te,T as Ee,_ as De,a as Oe,b as ke,c as Ae,d as je,f as Me,g as Ne,h as Pe,i as Fe,l as Ie,m as Le,n as Re,o as ze,p as Be,r as Ve,s as He,t as Ue,u as We,v as Ge,w as Ke,x as qe,y as Je}from"./cron-api--pAB_rps.js";import{t as Ye}from"./cron-dreaming-jobs-nCMWCf0p.js";import{r as Xe}from"./interval-presets-DJmshV8n.js";import{t as Ze}from"./format-interval-label-qhth3BMV.js";import{t as Qe}from"./heartbeat-config-api-BzO6G4fD.js";import{h as $e,m as et,t as tt}from"./workflow-page.utils-sgHjOXOm.js";import{i as nt,n as rt,o as it,r as at,t as ot}from"./dist-By6Rh2ee.js";var X=e(t(),1),Z=n(),Q=r();function st(e){let t=(0,Z.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,Q.jsx)(L,{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,Q.jsx)(m,{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,Q.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,Q.jsx)(q,{type:`button`,variant:`secondary`,onClick:o,children:a.cancel}),t[5]=a.cancel,t[6]=o,t[7]=p):p=t[7];let h=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]!==h||t[11]!==g||t[12]!==_?(v=(0,Q.jsx)(q,{type:`button`,variant:`primary`,className:h,onClick:g,children:_}),t[10]=h,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==v||t[15]!==p?(y=(0,Q.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,Q.jsxs)(z,{children:[c,(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,Q.jsxs)(E,{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,Q.jsx)(M,{open:n,onOpenChange:r,children:b}),t[21]=r,t[22]=n,t[23]=b,t[24]=x):x=t[24],x}var ct={enabled:!0,maxConcurrentJobs:5,historyRetentionDays:7,enableMetrics:!0};function lt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ut(e){let t=lt(e)?e:{},n=lt(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))):ct.maxConcurrentJobs,historyRetentionDays:typeof n.historyRetentionDays==`number`&&Number.isFinite(n.historyRetentionDays)?Math.max(1,Math.min(365,Math.floor(n.historyRetentionDays))):ct.historyRetentionDays,enableMetrics:n.enableMetrics!==!1}}async function dt(e){await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({cron:e})}),ye()}function ft(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,A,`dark:border-edge`)}function pt(){return{form:null,baseline:null,saving:!1,error:null,saveOk:!1,dirty:!1}}function mt(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 ht({hasToken:e}){let t=a(o(e=>e.language)).cron.globals,{data:n,isLoading:r}=G(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ut(n.payload.config)),[n]),[s,c]=(0,X.useReducer)(mt,void 0,pt),l=(0,X.useRef)(null);(0,X.useEffect)(()=>{!e||i===null||s.dirty||l.current===i||(l.current=i,c({type:`sync`,parsed:i}))},[e,i,s.dirty]);let u=(0,X.useMemo)(()=>!!(s.form&&s.baseline&&JSON.stringify(s.form)!==JSON.stringify(s.baseline)),[s.form,s.baseline]),d=(0,X.useCallback)(e=>{c({type:`patch`,patch:e})},[]),p=(0,X.useCallback)(async()=>{if(!(!s.form||s.saving)){c({type:`saveStart`});try{await dt(s.form),c({type:`saveSuccess`}),f({type:`success`,title:t.saved})}catch(e){c({type:`saveError`,error:e instanceof Error?e.message:t.saveError})}}},[t.saveError,s.form,s.saving]);return!e||!s.form?r?(0,Q.jsx)(we,{children:(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(se,{className:`size-4 animate-spin`}),t.loading]})}):null:(0,Q.jsxs)(we,{children:[(0,Q.jsx)(Ce,{icon:g,title:t.title,subtitle:t.hint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:!u||s.saving,onClick:()=>c({type:`discard`}),children:t.discard}),(0,Q.jsx)(q,{type:`button`,variant:`primary`,disabled:!u||s.saving,onClick:()=>void p(),children:s.saving?t.saving:t.save})]}),s.error?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:s.error}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg sm:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:s.form.enabled,onChange:e=>d({enabled:e.target.checked})}),t.enabled]}),(0,Q.jsxs)(Se,{children:[(0,Q.jsx)(gt,{label:t.maxConcurrent,value:s.form.maxConcurrentJobs,min:1,max:100,disabled:!s.form.enabled,onChange:e=>d({maxConcurrentJobs:e})}),(0,Q.jsx)(gt,{label:t.retentionDays,value:s.form.historyRetentionDays,min:1,max:365,disabled:!s.form.enabled,onChange:e=>d({historyRetentionDays:e})}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:s.form.enableMetrics,disabled:!s.form.enabled,onChange:e=>d({enableMetrics:e.target.checked})}),t.metrics]})]})]})]})}function gt(e){let t=(0,Z.c)(13),{label:n,value:r,min:a,max:o,disabled:s,text:c,onChange:l,onTextChange:u}=e,d;t[0]===n?d=t[1]:(d=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=d);let f;t[2]!==s||t[3]!==o||t[4]!==a||t[5]!==l||t[6]!==u||t[7]!==c||t[8]!==r?(f=c?(0,Q.jsx)(`input`,{className:i(ft(),`font-mono text-xs`),value:String(r),disabled:s,onChange:e=>u?.(e.target.value)}):(0,Q.jsx)(`input`,{type:`number`,min:a,max:o,disabled:s,className:i(ft(),`max-w-xs font-mono text-xs`),value:typeof r==`number`?r:0,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&l&&a!==void 0&&o!==void 0&&l(Math.max(a,Math.min(o,Math.floor(t))))}}),t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=u,t[7]=c,t[8]=r,t[9]=f):f=t[9];let p;return t[10]!==d||t[11]!==f?(p=(0,Q.jsxs)(`div`,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}var _t=`*/5 * * * *`;function vt(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function yt(e){let t=vt(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function bt(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function xt(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function St(e){let t=e?.trim();t&&(window.location.hash=`/workflows?run=${encodeURIComponent(t)}`)}function Ct(e){return i(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,ge,e&&`cursor-not-allowed opacity-60`)}function wt(){return i(v,P)}var Tt=i(v,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),Et=i(v,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function Dt(e){return e===`settings`?`settings`:e===`system`||e===`systemTasks`?`systemTasks`:e===`history`?`history`:`myTasks`}function Ot(e){return e===`myTasks`?null:e===`systemTasks`?`system`:e===`history`?`history`:`settings`}var kt=34,At=62,jt=46;function $(e){return Math.max(kt,Math.min(At,e))}function Mt(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 Nt(e,t){return e.payload.kind===`workflowRun`?t.taskKindWorkflowRun:e.payload.kind===`agentTurn`?t.taskKindMessage:t.modeDirectOption}function Pt(e){return e.length===0?null:e.find(e=>e.status===`failed`)?.id??e[0]?.id??null}function Ft(e){let t=(0,Z.c)(56),{row:n,expanded:r,onToggle:a,c:o,statusLabels:s}=e,c=n.error||n.summary||n.output||``,l;t[0]===c?l=t[1]:(l=c.trim(),t[0]=c,t[1]=l);let u=l,d=u.length>0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover`,children:(0,Q.jsx)(g,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0})}),t[2]=f):f=t[2];let p=n.startedAt,m;t[3]===n.startedAt?m=t[4]:(m=Y(n.startedAt),t[3]=n.startedAt,t[4]=m);let h;t[5]!==n.startedAt||t[6]!==m?(h=(0,Q.jsx)(`time`,{className:`text-sm font-medium text-fg`,dateTime:p,children:m}),t[5]=n.startedAt,t[6]=m,t[7]=h):h=t[7];let _;t[8]===n.status?_=t[9]:(_=i(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,Mt(n.status)),t[8]=n.status,t[9]=_);let v;t[10]!==n.status||t[11]!==s?(v=De(n.status,s),t[10]=n.status,t[11]=s,t[12]=v):v=t[12];let y;t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(`span`,{className:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===n.duration?b=t[17]:(b=Je(n.duration),t[16]=n.duration,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:b}),t[18]=b,t[19]=x);let S;t[20]!==x||t[21]!==h||t[22]!==y?(S=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[h,y,x]}),t[20]=x,t[21]=h,t[22]=y,t[23]=S):S=t[23];let C;t[24]!==u||t[25]!==r||t[26]!==d?(C=!r&&d?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:u}):null,t[24]=u,t[25]=r,t[26]=d,t[27]=C):C=t[27];let T;t[28]!==u||t[29]!==r||t[30]!==d?(T=r&&d?(0,Q.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:u}):null,t[28]=u,t[29]=r,t[30]=d,t[31]=T):T=t[31];let E;t[32]!==S||t[33]!==C||t[34]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[f,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C,T]})]}),t[32]=S,t[33]=C,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==o||t[37]!==r||t[38]!==d||t[39]!==a?(D=d?(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:a,children:[(0,Q.jsx)(de,{className:i(`size-3.5 transition-transform`,r&&`rotate-180`),strokeWidth:1.75,"aria-hidden":!0}),r?o.detailCollapseRun:o.detailExpandRun]}):null,t[36]=o,t[37]=r,t[38]=d,t[39]=a,t[40]=D):D=t[40];let O;t[41]!==o||t[42]!==n.workflowRunId?(O=n.workflowRunId?.trim()?(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:o.openWorkflowTitle,onClick:()=>St(n.workflowRunId),children:[(0,Q.jsx)(W,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),o.openWorkflow]}):null,t[41]=o,t[42]=n.workflowRunId,t[43]=O):O=t[43];let k;t[44]!==o||t[45]!==n.sessionKey?(k=n.sessionKey?.trim()?(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:o.openChatTitle,onClick:()=>xt(n.sessionKey),children:[(0,Q.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),o.openChat]}):null,t[44]=o,t[45]=n.sessionKey,t[46]=k):k=t[46];let A;t[47]!==O||t[48]!==k?(A=(0,Q.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[O,k]}),t[47]=O,t[48]=k,t[49]=A):A=t[49];let j;t[50]!==D||t[51]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle px-3 py-2 dark:border-edge-subtle`,children:[D,A]}),t[50]=D,t[51]=A,t[52]=j):j=t[52];let M;return t[53]!==E||t[54]!==j?(M=(0,Q.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:[E,j]}),t[53]=E,t[54]=j,t[55]=M):M=t[55],M}function It(e){let t=(0,Z.c)(13),{icon:n,label:r,value:a,valueClassName:o}=e,s;t[0]===n?s=t[1]:(s=(0,Q.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=n,t[1]=s);let c;t[2]!==r||t[3]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[s,r]}),t[2]=r,t[3]=s,t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=i(`mt-1 truncate text-sm font-medium text-fg`,o),t[5]=o,t[6]=l);let u;t[7]!==l||t[8]!==a?(u=(0,Q.jsx)(`p`,{className:l,children:a}),t[7]=l,t[8]=a,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.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:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function Lt({open:e,onDismiss:t,detailJob:n,detailLoading:r,actionNotice:a,detailHistory:o,c:s,localeTag:c,scheduleBadgeLabels:l,chatWorkingDirNotSet:u,statusLabels:d,onEdit:f,onRunNow:p,onToggle:h,onDelete:_}){let[v,y]=(0,X.useState)(null),[b,S]=(0,X.useState)(!1),[C,D]=(0,X.useState)(jt),[O,A]=(0,X.useState)(!1),j=(0,X.useRef)(null),N=(0,X.useMemo)(()=>{let e=0,t=0;for(let n of o)n.status===`success`&&(e+=1),n.status===`failed`&&(t+=1);return{success:e,failed:t}},[o]),P=o[0]??null;(0,X.useEffect)(()=>{if(!e){y(null),S(!1);return}y(Pt(o))},[e,n?.id,o]);let F=(0,X.useCallback)(async()=>{n?.schedule&&await B(Ke(n.schedule))&&(S(!0),window.setTimeout(()=>S(!1),1500))},[n?.schedule]),I=n?Te(n,c,l):`—`,R=(0,X.useCallback)(e=>{e.preventDefault();let t=j.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.currentTarget,i=e.pointerId;r.setPointerCapture(i),A(!0);let a=e=>{D($((e-n.left)/n.width*100))};a(e.clientX);let o=e=>{a(e.clientX)},s=()=>{try{r.releasePointerCapture(i)}catch{}A(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},[]),V=(0,X.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),D(e=>$(e-4))):e.key===`ArrowRight`?(e.preventDefault(),D(e=>$(e+4))):e.key===`Home`?(e.preventDefault(),D(kt)):e.key===`End`&&(e.preventDefault(),D(At))},[]);return(0,Q.jsx)(M,{open:e,onOpenChange:e=>{e||t()},children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,Q.jsxs)(E,{className:i(`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(86vh,46rem)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,`dark:border-edge`),"aria-describedby":void 0,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(m,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n?.name?.trim()||n?.id||`—`}),n?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:I}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[n?(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n.enabled,"aria-label":n.enabled?s.enabled:s.disabled,className:i(`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:()=>h(n,!n.enabled),children:(0,Q.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}):null,(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75})})})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 lg:overflow-hidden`,children:r?(0,Q.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,Q.jsx)(se,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):n?(0,Q.jsxs)(`div`,{className:`flex min-h-full flex-col gap-4 lg:h-full lg:min-h-0`,children:[a?(0,Q.jsx)(`div`,{className:i(`rounded-xl border px-3 py-2 text-sm`,a.kind===`error`?`border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`:`border-accent/25 bg-accent/5 text-fg dark:border-accent/30 dark:bg-accent/10`),role:`alert`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{children:a.message}),a.sessionKey?(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 gap-1.5 px-2.5 text-xs`,onClick:()=>xt(a.sessionKey),children:[(0,Q.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),s.openChat]}):null]})}):null,(0,Q.jsxs)(`div`,{ref:j,className:`grid min-h-0 grid-cols-1 gap-4 lg:flex-1 lg:[grid-template-columns:minmax(0,var(--cron-detail-config-pane))_0.75rem_minmax(23rem,1fr)] lg:gap-0`,style:{"--cron-detail-config-pane":`${C}%`},children:[(0,Q.jsx)(`div`,{className:`rounded-2xl border border-edge bg-surface-base/35 p-4 lg:min-h-0 lg:overflow-y-auto`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.scheduleLabel}),(0,Q.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,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 text-sm font-medium leading-relaxed text-fg`,children:I}),(0,Q.jsx)(q,{type:`button`,variant:`secondary`,className:`size-8 shrink-0 p-0`,title:s.detailCopySchedule,"aria-label":s.detailCopySchedule,onClick:()=>void F(),children:b?(0,Q.jsx)(K,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75}):(0,Q.jsx)(x,{className:`size-3.5`,strokeWidth:1.75})})]}),(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg-subtle`,children:[s.detailCronTechnical,`: `]}),(0,Q.jsx)(`code`,{className:`font-mono`,children:Ke(n.schedule)})]})]})]}),(0,Q.jsxs)(`section`,{"aria-label":s.statsRegion,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Q.jsx)(It,{icon:H,label:s.nextRun,value:n.nextRunAtMs?ke(new Date(n.nextRunAtMs).toISOString(),s.timeLabels):`—`}),(0,Q.jsx)(It,{icon:g,label:s.detailLastRun,value:P?De(P.status,d):s.detailNoRecentRuns,valueClassName:P?.status===`failed`?`text-red-700 dark:text-red-300`:P?.status===`success`?`text-emerald-800 dark:text-emerald-300`:void 0})]}),o.length>0?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:s.detailRunCount.replace(`{{success}}`,String(N.success)).replace(`{{failed}}`,String(N.failed))}):null]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailWhatItDoes}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base/80 p-3 dark:border-edge-subtle`,children:[(0,Q.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:Nt(n,s)}),(0,Q.jsx)(`div`,{className:`min-w-0 break-words text-fg [&_.markdown-body]:text-sm [&_.markdown-body]:leading-relaxed`,children:(0,Q.jsx)(be,{content:Fe(n),compact:!0,className:`text-sm`})})]})]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(pe,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailRunSettings})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:s.detailRunSettingsHint}),(0,Q.jsxs)(`dl`,{className:`mt-3 grid gap-3 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-3 text-sm dark:border-edge-subtle`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.mode}),(0,Q.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.sessionTarget===`isolated`?s.modeAgentOption:s.modeDirectOption})]}),n.sessionTarget===`isolated`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.agentProfile}),(0,Q.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.agentId?.trim()?n.agentId.trim():s.agentProfileDefault})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.workingDirectoryLabel}),(0,Q.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:n.workingDirectory?.trim()?n.workingDirectory.trim():u})]})]}):null,n.delivery?.channel===`local`||n.sessionTarget===`isolated`&&!n.delivery?.to?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.deliveryTarget}),(0,Q.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.delivery?.channel===`local`?s.deliveryTargetLocalChannel:s.deliveryLocalOnly})]}):n.delivery?.to?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.deliveryTarget}),(0,Q.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,Q.jsx)(`code`,{className:`text-xs`,children:n.delivery?.channel??``}),` → `,Ge(n,s.channelLocal)]})]}):null,n.model?.trim()?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.model}),(0,Q.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.model.trim()})]}):null]})]})]})}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":s.detailResizeColumns,"aria-valuemin":kt,"aria-valuemax":At,"aria-valuenow":Math.round(C),tabIndex:0,onPointerDown:R,onKeyDown:V,className:i(`group hidden h-full cursor-col-resize touch-none select-none items-stretch justify-center rounded-lg outline-none lg:flex`,`focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),children:(0,Q.jsx)(`span`,{className:i(`h-full w-px bg-edge-subtle transition-colors duration-150`,`group-hover:bg-edge`,O&&`bg-edge`)})}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base/35 p-4 lg:min-h-0 lg:overflow-y-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailRunHistory}),o.length>0?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:o.length}):null]}),o.length===0?(0,Q.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,Q.jsx)(g,{className:`mx-auto size-8 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:s.noRunsYet})]}):(0,Q.jsx)(`ul`,{className:`mt-2 space-y-2`,children:o.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(Ft,{row:e,expanded:v===e.id,onToggle:()=>y(t=>t===e.id?null:e.id),c:s,statusLabels:d})},e.id))})]})]})]}):null}),n&&!r?(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(q,{type:`button`,className:`gap-1.5`,onClick:()=>p(n),children:[(0,Q.jsx)(k,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),s.runNow]}),(0,Q.jsx)(q,{type:`button`,variant:`secondary`,onClick:()=>f(n),children:s.edit}),(0,Q.jsxs)(q,{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:()=>_(n),children:[(0,Q.jsx)(T,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),s.delete]})]})}):null]})})]})})}function Rt(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function zt(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function Bt(e,t={}){let n=Rt(e.split(`
|
|
2
|
+
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
3
|
+
`));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(zt(n));return null}async function Vt(e,t={}){let n=await d(l(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=Bt(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=Bt(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function Ht(){let[e,t]=(0,X.useState)(``),[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,X.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await Vt(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,X.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var Ut=5;function Wt(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function Gt(e){let t=(0,Z.c)(228),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:c,intent:l,locale:u,context:d,disabled:f,className:p,showLabel:h}=e,g=s===void 0?`generic.text`:s,_=c===void 0?`plain`:c,v=l===void 0?`improve`:l,y=h===void 0?!0:h,[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(n),[w,T]=(0,X.useState)(`preview`),[D,O]=(0,X.useState)(``),[k,A]=(0,X.useState)(`edit`),[N,P]=(0,X.useState)(!0),F=(0,X.useRef)(null),I=(0,X.useRef)(!0),{suggestion:R,thinking:B,loading:V,error:H,generate:W,reset:G}=Ht(),ee;t[0]===u?ee=t[1]:(ee=Wt(u),t[0]=u,t[1]=ee);let K=ee,ne;t[2]!==V||t[3]!==B?(ne=V&&B.trim().length>0,t[2]=V,t[3]=B,t[4]=ne):ne=t[4];let re=ne,ie,ae;t[5]!==b||t[6]!==n?(ie=()=>{b||C(n)},ae=[b,n],t[5]=b,t[6]=n,t[7]=ie,t[8]=ae):(ie=t[7],ae=t[8]),(0,X.useEffect)(ie,ae);let oe,se;t[9]===R?(oe=t[10],se=t[11]):(se=()=>{O(R)},oe=[R],t[9]=R,t[10]=oe,t[11]=se),(0,X.useEffect)(se,oe);let ue,J;t[12]===B?(ue=t[13],J=t[14]):(ue=()=>{B.trim()&&P(!0)},J=[B],t[12]=B,t[13]=ue,t[14]=J),(0,X.useEffect)(ue,J);let pe;t[15]!==re||t[16]!==N?(pe=()=>{let e=F.current;!e||!re||!N||I.current&&(e.scrollTop=e.scrollHeight)},t[15]=re,t[16]=N,t[17]=pe):pe=t[17];let me;t[18]!==re||t[19]!==B||t[20]!==N?(me=[re,B,N],t[18]=re,t[19]=B,t[20]=N,t[21]=me):me=t[21],(0,X.useLayoutEffect)(pe,me);let he;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=F.current;e&&(I.current=e.scrollHeight-e.scrollTop-e.clientHeight<=Ut)},t[22]=he):he=t[22];let ge=he,_e;t[23]!==d||t[24]!==a||t[25]!==o||t[26]!==_||t[27]!==W||t[28]!==v||t[29]!==u||t[30]!==g?(_e=async e=>{A(`edit`),P(!0),I.current=!0,await W({intent:v,scenario:g,input:e,locale:u,field:{id:a,label:o,format:_},context:d})},t[23]=d,t[24]=a,t[25]=o,t[26]=_,t[27]=W,t[28]=v,t[29]=u,t[30]=g,t[31]=_e):_e=t[31];let ve=_e,ye;t[32]!==ve||t[33]!==n?(ye=async()=>{C(n),T(`preview`),x(!0),await ve(n)},t[32]=ve,t[33]=n,t[34]=ye):ye=t[34];let xe=ye,Se;t[35]!==S||t[36]!==ve?(Se=async()=>{await ve(S)},t[35]=S,t[36]=ve,t[37]=Se):Se=t[37];let Ce=Se,we;t[38]!==G||t[39]!==n?(we=()=>{x(!1),C(n),T(`preview`),O(``),A(`edit`),P(!0),G()},t[38]=G,t[39]=n,t[40]=we):we=t[40];let Y=we,Te;t[41]!==Y||t[42]!==S||t[43]!==r?(Te=()=>{r(S),Y()},t[41]=Y,t[42]=S,t[43]=r,t[44]=Te):Te=t[44];let Ee=Te,De;t[45]!==Y||t[46]!==D||t[47]!==r?(De=()=>{D.trim()&&(r(D),Y())},t[45]=Y,t[46]=D,t[47]=r,t[48]=De):De=t[48];let Oe=De,ke;t[49]!==Y||t[50]!==S||t[51]!==D||t[52]!==r?(ke=()=>{if(!D.trim())return;let e=S.trimEnd();r(e?`${e}\n\n${D}`:D),Y()},t[49]=Y,t[50]=S,t[51]=D,t[52]=r,t[53]=ke):ke=t[53];let Ae=ke,je;t[54]!==D||t[55]!==H||t[56]!==V?(je=!V&&!H&&D.trim().length>0,t[54]=D,t[55]=H,t[56]=V,t[57]=je):je=t[57];let Me=je,Ne=S!==n,Pe=!y&&`size-7 p-0`,Fe;t[58]!==p||t[59]!==Pe?(Fe=i(`h-7 gap-1 px-2 text-xs`,Pe,p),t[58]=p,t[59]=Pe,t[60]=Fe):Fe=t[60];let Ie=f||V,Le;t[61]===xe?Le=t[62]:(Le=()=>void xe(),t[61]=xe,t[62]=Le);let Re;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Q.jsx)(le,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[63]=Re):Re=t[63];let ze=y?K.buttonTitle:null,Be;t[64]!==K.buttonTitle||t[65]!==Fe||t[66]!==Ie||t[67]!==Le||t[68]!==ze?(Be=(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:Fe,title:K.buttonTitle,"aria-label":K.buttonTitle,disabled:Ie,onClick:Le,children:[Re,ze]}),t[64]=K.buttonTitle,t[65]=Fe,t[66]=Ie,t[67]=Le,t[68]=ze,t[69]=Be):Be=t[69];let Ve;t[70]===Y?Ve=t[71]:(Ve=e=>e?x(!0):Y(),t[70]=Y,t[71]=Ve);let He;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Q.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[72]=He):He=t[72];let Ue;t[73]===K.title?Ue=t[74]:(Ue=(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:K.title}),t[73]=K.title,t[74]=Ue);let We;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[75]=We):We=t[75];let Ge;t[76]===K.close?Ge=t[77]:(Ge=(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":K.close,children:We})}),t[76]=K.close,t[77]=Ge);let Ke;t[78]!==Ue||t[79]!==Ge?(Ke=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Ue,Ge]}),t[78]=Ue,t[79]=Ge,t[80]=Ke):Ke=t[80];let qe;t[81]===K.current?qe=t[82]:(qe=(0,Q.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:K.current}),t[81]=K.current,t[82]=qe);let Je=w===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,Ye;t[83]===Je?Ye=t[84]:(Ye=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Je),t[83]=Je,t[84]=Ye);let Xe,Ze;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=()=>T(`edit`),Ze=(0,Q.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[85]=Xe,t[86]=Ze):(Xe=t[85],Ze=t[86]);let Qe;t[87]!==K.edit||t[88]!==Ye?(Qe=(0,Q.jsxs)(`button`,{type:`button`,className:Ye,onClick:Xe,children:[Ze,K.edit]}),t[87]=K.edit,t[88]=Ye,t[89]=Qe):Qe=t[89];let $e=w===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,et;t[90]===$e?et=t[91]:(et=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,$e),t[90]=$e,t[91]=et);let tt,nt;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>T(`preview`),nt=(0,Q.jsx)(j,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[92]=tt,t[93]=nt):(tt=t[92],nt=t[93]);let rt;t[94]!==K.preview||t[95]!==et?(rt=(0,Q.jsxs)(`button`,{type:`button`,className:et,onClick:tt,children:[nt,K.preview]}),t[94]=K.preview,t[95]=et,t[96]=rt):rt=t[96];let it;t[97]!==Qe||t[98]!==rt?(it=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Qe,rt]}),t[97]=Qe,t[98]=rt,t[99]=it):it=t[99];let at;t[100]!==qe||t[101]!==it?(at=(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[qe,it]}),t[100]=qe,t[101]=it,t[102]=at):at=t[102];let ot;t[103]!==S||t[104]!==w||t[105]!==_||t[106]!==K.current||t[107]!==K.empty?(ot=w===`preview`?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:_===`markdown`?(0,Q.jsx)(be,{content:S||K.empty,compact:!0,className:`text-sm`}):(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:S||K.empty})}):(0,Q.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:S,onChange:e=>C(e.currentTarget.value),placeholder:K.empty,"aria-label":K.current}),t[103]=S,t[104]=w,t[105]=_,t[106]=K.current,t[107]=K.empty,t[108]=ot):ot=t[108];let st;t[109]!==at||t[110]!==ot?(st=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[at,ot]}),t[109]=at,t[110]=ot,t[111]=st):st=t[111];let ct;t[112]===K.editedSuggestion?ct=t[113]:(ct=(0,Q.jsx)(`span`,{children:K.editedSuggestion}),t[112]=K.editedSuggestion,t[113]=ct);let lt;t[114]!==K.loading||t[115]!==V?(lt=V?(0,Q.jsx)(`span`,{className:`ml-2 font-normal`,children:K.loading}):null,t[114]=K.loading,t[115]=V,t[116]=lt):lt=t[116];let ut;t[117]!==ct||t[118]!==lt?(ut=(0,Q.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[ct,lt]}),t[117]=ct,t[118]=lt,t[119]=ut):ut=t[119];let dt=k===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[120]===dt?ft=t[121]:(ft=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[120]=dt,t[121]=ft);let pt,mt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>A(`edit`),mt=(0,Q.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[122]=pt,t[123]=mt):(pt=t[122],mt=t[123]);let ht;t[124]!==K.edit||t[125]!==ft?(ht=(0,Q.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,K.edit]}),t[124]=K.edit,t[125]=ft,t[126]=ht):ht=t[126];let gt=k===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,_t;t[127]===gt?_t=t[128]:(_t=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,gt),t[127]=gt,t[128]=_t);let vt,yt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>A(`preview`),yt=(0,Q.jsx)(j,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[129]=vt,t[130]=yt):(vt=t[129],yt=t[130]);let bt;t[131]!==K.preview||t[132]!==_t?(bt=(0,Q.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,K.preview]}),t[131]=K.preview,t[132]=_t,t[133]=bt):bt=t[133];let xt;t[134]!==ht||t[135]!==bt?(xt=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ht,bt]}),t[134]=ht,t[135]=bt,t[136]=xt):xt=t[136];let St;t[137]!==ut||t[138]!==xt?(St=(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[ut,xt]}),t[137]=ut,t[138]=xt,t[139]=St):St=t[139];let Ct=re?`opacity-100`:`pointer-events-none opacity-0`,wt;t[140]===Ct?wt=t[141]:(wt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ct),t[140]=Ct,t[141]=wt);let Tt=!re,Et;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(Et=()=>P(Kt),t[142]=Et):Et=t[142];let Dt;t[143]!==K.thinkingLoading||t[144]!==V?(Dt=V?(0,Q.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,K.thinkingLoading]}):null,t[143]=K.thinkingLoading,t[144]=V,t[145]=Dt):Dt=t[145];let Ot;t[146]!==K.thinking||t[147]!==Dt?(Ot=(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[K.thinking,Dt]}),t[146]=K.thinking,t[147]=Dt,t[148]=Ot):Ot=t[148];let kt=N&&`rotate-180`,At;t[149]===kt?At=t[150]:(At=i(`size-3.5 shrink-0 transition-transform`,kt),t[149]=kt,t[150]=At);let jt;t[151]===At?jt=t[152]:(jt=(0,Q.jsx)(de,{className:At,strokeWidth:1.75,"aria-hidden":!0}),t[151]=At,t[152]=jt);let $;t[153]!==Ot||t[154]!==jt?($=(0,Q.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Et,children:[Ot,jt]}),t[153]=Ot,t[154]=jt,t[155]=$):$=t[155];let Mt;t[156]!==B||t[157]!==N?(Mt=N?(0,Q.jsx)(`pre`,{ref:F,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:ge,children:B}):null,t[156]=B,t[157]=N,t[158]=Mt):Mt=t[158];let Nt;t[159]!==$||t[160]!==Mt?(Nt=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[$,Mt]}),t[159]=$,t[160]=Mt,t[161]=Nt):Nt=t[161];let Pt;t[162]!==wt||t[163]!==Tt||t[164]!==Nt?(Pt=(0,Q.jsx)(`div`,{className:wt,"aria-hidden":Tt,children:Nt}),t[162]=wt,t[163]=Tt,t[164]=Nt,t[165]=Pt):Pt=t[165];let Ft=re?`pointer-events-none opacity-0`:`opacity-100`,It;t[166]===Ft?It=t[167]:(It=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[166]=Ft,t[167]=It);let Lt;t[168]!==D||t[169]!==H||t[170]!==_||t[171]!==K.empty||t[172]!==K.loading||t[173]!==K.suggestion||t[174]!==V||t[175]!==k?(Lt=H?(0,Q.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:H}):k===`preview`?(0,Q.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:V&&!D.trim()?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:K.loading}):_===`markdown`?(0,Q.jsx)(be,{content:D||K.empty,compact:!0,className:`text-sm`}):(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:D||K.empty})}):(0,Q.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:D,onChange:e=>O(e.currentTarget.value),disabled:V,placeholder:V?K.loading:K.empty,"aria-label":K.suggestion}),t[168]=D,t[169]=H,t[170]=_,t[171]=K.empty,t[172]=K.loading,t[173]=K.suggestion,t[174]=V,t[175]=k,t[176]=Lt):Lt=t[176];let Rt;t[177]!==It||t[178]!==Lt?(Rt=(0,Q.jsx)(`div`,{className:It,children:Lt}),t[177]=It,t[178]=Lt,t[179]=Rt):Rt=t[179];let zt;t[180]!==Pt||t[181]!==Rt?(zt=(0,Q.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Pt,Rt]}),t[180]=Pt,t[181]=Rt,t[182]=zt):zt=t[182];let Bt;t[183]!==St||t[184]!==zt?(Bt=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[St,zt]}),t[183]=St,t[184]=zt,t[185]=Bt):Bt=t[185];let Vt;t[186]!==st||t[187]!==Bt?(Vt=(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[st,Bt]}),t[186]=st,t[187]=Bt,t[188]=Vt):Vt=t[188];let Gt;t[189]!==Y||t[190]!==K.cancel?(Gt=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,onClick:Y,children:K.cancel}),t[189]=Y,t[190]=K.cancel,t[191]=Gt):Gt=t[191];let Jt=!Ne,Yt;t[192]!==Ee||t[193]!==K.applyCurrent||t[194]!==Jt?(Yt=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:Jt,onClick:Ee,children:K.applyCurrent}),t[192]=Ee,t[193]=K.applyCurrent,t[194]=Jt,t[195]=Yt):Yt=t[195];let Xt;t[196]===Ce?Xt=t[197]:(Xt=()=>void Ce(),t[196]=Ce,t[197]=Xt);let Zt;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(Zt=(0,Q.jsx)(U,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[198]=Zt):Zt=t[198];let Qt;t[199]!==K.regenerate||t[200]!==V||t[201]!==Xt?(Qt=(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,disabled:V,onClick:Xt,children:[Zt,K.regenerate]}),t[199]=K.regenerate,t[200]=V,t[201]=Xt,t[202]=Qt):Qt=t[202];let $t=!Me,en;t[203]!==Ae||t[204]!==K.append||t[205]!==$t?(en=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,disabled:$t,onClick:Ae,children:K.append}),t[203]=Ae,t[204]=K.append,t[205]=$t,t[206]=en):en=t[206];let tn=!Me,nn;t[207]!==Oe||t[208]!==K.replace||t[209]!==tn?(nn=(0,Q.jsx)(q,{type:`button`,variant:`primary`,disabled:tn,onClick:Oe,children:K.replace}),t[207]=Oe,t[208]=K.replace,t[209]=tn,t[210]=nn):nn=t[210];let rn;t[211]!==Gt||t[212]!==Yt||t[213]!==Qt||t[214]!==en||t[215]!==nn?(rn=(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Gt,Yt,Qt,en,nn]}),t[211]=Gt,t[212]=Yt,t[213]=Qt,t[214]=en,t[215]=nn,t[216]=rn):rn=t[216];let an;t[217]!==Ke||t[218]!==Vt||t[219]!==rn?(an=(0,Q.jsxs)(z,{children:[He,(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,Q.jsxs)(E,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:qt,children:[Ke,Vt,rn]})})]}),t[217]=Ke,t[218]=Vt,t[219]=rn,t[220]=an):an=t[220];let on;t[221]!==b||t[222]!==Ve||t[223]!==an?(on=(0,Q.jsx)(M,{open:b,onOpenChange:Ve,children:an}),t[221]=b,t[222]=Ve,t[223]=an,t[224]=on):on=t[224];let sn;return t[225]!==Be||t[226]!==on?(sn=(0,Q.jsxs)(Q.Fragment,{children:[Be,on]}),t[225]=Be,t[226]=on,t[227]=sn):sn=t[227],sn}function Kt(e){return!e}function qt(e){return e.preventDefault()}function Jt(e){let t=(0,Z.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=I(d),p;t[3]===n?p=t[4]:(p=n.trim(),t[3]=n,t[4]=p);let m=p,h=s??(m?`${m}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`),g=i||f.picking,_=o??a.notSet,v;t[5]!==c||t[6]!==f.pick||t[7]!==h||t[8]!==g||t[9]!==_||t[10]!==n?(v=(0,Q.jsx)(C,{value:n,onPick:f.pick,disabled:g,placeholder:_,title:h,maxWidthClass:c}),t[5]=c,t[6]=f.pick,t[7]=h,t[8]=g,t[9]=_,t[10]=n,t[11]=v):v=t[11];let y;t[12]!==l||t[13]!==i||t[14]!==u||t[15]!==f.picking||t[16]!==m?(y=l&&m&&u?(0,Q.jsx)(`button`,{type:`button`,disabled:i||f.picking,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:u,children:l}):null,t[12]=l,t[13]=i,t[14]=u,t[15]=f.picking,t[16]=m,t[17]=y):y=t[17];let b;t[18]!==v||t[19]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v,y]}),t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==f.confirmPick||t[22]!==f.hasNativePicker||t[23]!==f.modalOpen||t[24]!==f.setModalOpen||t[25]!==m||t[26]!==a?(x=f.hasNativePicker?null:(0,Q.jsx)(O,{open:f.modalOpen,onOpenChange:f.setModalOpen,initialAbsolutePath:m||void 0,onConfirm:f.confirmPick,wd:a}),t[21]=f.confirmPick,t[22]=f.hasNativePicker,t[23]=f.modalOpen,t[24]=f.setModalOpen,t[25]=m,t[26]=a,t[27]=x):x=t[27];let S;return t[28]!==b||t[29]!==x?(S=(0,Q.jsxs)(Q.Fragment,{children:[b,x]}),t[28]=b,t[29]=x,t[30]=S):S=t[30],S}function Yt(e,t){return e[t]??t}function Xt(e,t){let n=ie[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 Zt(e,t){return(ie[e]??[]).every(e=>!e.required||!!t[e.key]?.trim())}function Qt(e){let t=(0,Z.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,Q.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,Q.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,Q.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,Q.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function $t(e){let t=(0,Z.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,x,S,C;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){y=a(r).workflows;let e=ie[n]??[];v=e.length>0;let u=i(`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`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{et(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,x=e.map(e=>{let t=Yt(y.args,e.labelKey),a=Yt(y.args,e.placeholderKey),c=o[e.key]??``;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,Q.jsx)(Gt,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,Q.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,Q.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),S=v&&h.length>0?(0,Q.jsx)(Qt,{examples:h,labels:y,onSelect:_}):null,C=g?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,Q.jsx)(Gt,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,Q.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:y.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else _=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let w;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(w=!v&&h.length>0?(0,Q.jsx)(Qt,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=w):w=t[27];let T;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,Q.jsxs)(`div`,{className:b,children:[x,S,C,w]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}var en=42,tn=68,nn=56;function rn(e){return Math.max(en,Math.min(tn,e))}function an(e){let t=(0,Z.c)(10),{title:n,children:r,className:a}=e,o;t[0]===a?o=t[1]:(o=i(`rounded-2xl border border-edge bg-surface-base/35 p-4`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=n?(0,Q.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-fg`,children:n}):null,t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:r}),t[4]=r,t[5]=c);let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Q.jsxs)(`section`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function on(e){let t=(0,Z.c)(301),{open:n,onRequestClose:r,c:a,chatM:s,agentsMessages:c,isDark:l,channels:u,sessionChatIds:d,cronAgentSelectOptions:f,defaultModelResolver:p,formMode:h,formJobId:g,formName:_,onFormNameChange:v,formSchedule:y,onFormScheduleChange:b,formSubmitting:x,formTaskKind:C,onFormTaskKindChange:w,workflowDefinitions:T,workflowDefinitionsLoading:D,formWorkflowDefinitionId:O,onFormWorkflowDefinitionIdChange:k,formWorkflowGoal:A,onFormWorkflowGoalChange:N,formWorkflowArgValues:P,onFormWorkflowArgValuesChange:I,formSessionTarget:R,onFormSessionTargetChange:B,formAgentLocalOnly:V,onFormAgentLocalOnlyChange:H,formModel:W,onFormModelUserChange:G,formAgentId:ee,onFormAgentIdChange:K,formWorkingDirectory:ne,onFormWorkingDirectoryChange:re,formChannel:ie,onFormChannelChange:ae,formChatId:oe,onFormChatIdChange:se,formMessage:le,onFormMessageChange:ue,formMessageMdMode:de,onSetMessageMdMode:J,messageEditorNonce:pe,needsDeliveryChat:me,showChannelPicker:he,canSubmit:ge,onSubmit:_e,onRefreshRecipients:ve}=e,ye=o(fn),[Se,Ce]=(0,X.useState)(nn),[we,Y]=(0,X.useState)(!1),[Te,Ee]=(0,X.useState)(0),De=(0,X.useRef)(null),Oe,ke;if(t[0]!==O||t[1]!==ye||t[2]!==T){let e;t[5]===O?e=t[6]:(e=e=>e.id===O.trim(),t[5]=O,t[6]=e),Oe=T.find(e),ke=Oe?$e(Oe,ye):null,t[0]=O,t[1]=ye,t[2]=T,t[3]=Oe,t[4]=ke}else Oe=t[3],ke=t[4];let Ae=ke,je;t[7]!==y.everyMs||t[8]!==y.kind?(je=y.kind===`every`?Math.max(1,Math.round(y.everyMs/6e4)):60,t[7]=y.everyMs,t[8]=y.kind,t[9]=je):je=t[9];let Me=je,Ne;t[10]!==y.at||t[11]!==y.kind?(Ne=y.kind===`at`&&y.at?new Date(y.at).toISOString().slice(0,16):``,t[10]=y.at,t[11]=y.kind,t[12]=Ne):Ne=t[12];let Pe=Ne,Fe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>{e.preventDefault();let t=De.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.currentTarget,i=e.pointerId;r.setPointerCapture(i),Y(!0);let a=e=>{Ce(rn((e-n.left)/n.width*100))};a(e.clientX);let o=e=>{a(e.clientX)},s=()=>{try{r.releasePointerCapture(i)}catch{}Y(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},t[13]=Fe):Fe=t[13];let Ie=Fe,Le;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>{e.key===`ArrowLeft`?(e.preventDefault(),Ce(dn)):e.key===`ArrowRight`?(e.preventDefault(),Ce(un)):e.key===`Home`?(e.preventDefault(),Ce(en)):e.key===`End`&&(e.preventDefault(),Ce(tn))},t[14]=Le):Le=t[14];let Re=Le,ze;t[15]===a.agentProfile?ze=t[16]:(ze=(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.agentProfile}),t[15]=a.agentProfile,t[16]=ze);let Be;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(Be=wt(),t[17]=Be):Be=t[17];let Ve;t[18]===K?Ve=t[19]:(Ve=e=>K(e.target.value),t[18]=K,t[19]=Ve);let He;t[20]===a.agentProfileDefault?He=t[21]:(He=(0,Q.jsx)(`option`,{value:``,children:a.agentProfileDefault}),t[20]=a.agentProfileDefault,t[21]=He);let Ue;if(t[22]!==c||t[23]!==f){let e;t[25]===c?e=t[26]:(e=e=>(0,Q.jsx)(`option`,{value:e.id,children:`${e.id} - ${S(e,c)}`},e.id),t[25]=c,t[26]=e),Ue=f.map(e),t[22]=c,t[23]=f,t[24]=Ue}else Ue=t[24];let We;t[27]!==ee||t[28]!==x||t[29]!==Ve||t[30]!==He||t[31]!==Ue?(We=(0,Q.jsxs)(`select`,{className:Be,value:ee,disabled:x,onChange:Ve,children:[He,Ue]}),t[27]=ee,t[28]=x,t[29]=Ve,t[30]=He,t[31]=Ue,t[32]=We):We=t[32];let Ge;t[33]===a.agentProfileHint?Ge=t[34]:(Ge=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.agentProfileHint}),t[33]=a.agentProfileHint,t[34]=Ge);let Je;t[35]!==We||t[36]!==Ge||t[37]!==ze?(Je=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[ze,We,Ge]}),t[35]=We,t[36]=Ge,t[37]=ze,t[38]=Je):Je=t[38];let Ye=Je,Ze;t[39]!==a.channel||t[40]!==a.channelLocal||t[41]!==a.enterManuallyOrSelect||t[42]!==a.lastActiveLabels||t[43]!==a.noRecentChats||t[44]!==a.noRecentChatsOption||t[45]!==a.recipient||t[46]!==a.recipientPlaceholder||t[47]!==a.refreshList||t[48]!==a.refreshRecipientHint||t[49]!==a.selectRecipient||t[50]!==a.workflowDeliveryHint||t[51]!==u||t[52]!==ie||t[53]!==oe||t[54]!==C||t[55]!==me||t[56]!==ae||t[57]!==se||t[58]!==ve||t[59]!==d||t[60]!==he?(Ze=he?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.channel}),(0,Q.jsxs)(`select`,{className:wt(),value:ie,onChange:e=>ae(e.target.value),children:[(0,Q.jsx)(`option`,{value:`local`,children:a.channelLocal}),u.map(ln)]})]}),me?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.recipient}),(0,Q.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ve(),children:[(0,Q.jsx)(U,{className:`size-3.5`,strokeWidth:1.75}),a.refreshList]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Ct(),`min-w-0 w-full sm:flex-1`),value:oe,onChange:e=>se(e.target.value),placeholder:a.recipientPlaceholder}),(0,Q.jsxs)(`select`,{className:Tt,value:oe,onChange:e=>{let t=e.target.value;t&&se(t)},children:[(0,Q.jsx)(`option`,{value:``,children:a.selectRecipient}),d.length>0?d.map(e=>(0,Q.jsx)(`option`,{value:e.chatId,children:qe(e,a.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,Q.jsx)(`option`,{value:``,disabled:!0,children:a.noRecentChatsOption})]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:C===`workflowRun`?a.workflowDeliveryHint:d.length>0?a.enterManuallyOrSelect:a.noRecentChats})]}):null]}):null,t[39]=a.channel,t[40]=a.channelLocal,t[41]=a.enterManuallyOrSelect,t[42]=a.lastActiveLabels,t[43]=a.noRecentChats,t[44]=a.noRecentChatsOption,t[45]=a.recipient,t[46]=a.recipientPlaceholder,t[47]=a.refreshList,t[48]=a.refreshRecipientHint,t[49]=a.selectRecipient,t[50]=a.workflowDeliveryHint,t[51]=u,t[52]=ie,t[53]=oe,t[54]=C,t[55]=me,t[56]=ae,t[57]=se,t[58]=ve,t[59]=d,t[60]=he,t[61]=Ze):Ze=t[61];let Qe=Ze,et;t[62]===a.schedule?et=t[63]:(et=(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.schedule}),t[62]=a.schedule,t[63]=et);let tt;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(tt=wt(),t[64]=tt):tt=t[64];let nt;t[65]===b?nt=t[66]:(nt=e=>{let t=e.target.value;b(t===`cron`?{kind:`cron`,expr:`*/5 * * * *`}:t===`at`?{kind:`at`,at:new Date(Date.now()+36e5).toISOString()}:{kind:`every`,everyMs:36e5})},t[65]=b,t[66]=nt);let rt,it,at;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Q.jsx)(`option`,{value:`cron`,children:`Cron`}),it=(0,Q.jsx)(`option`,{value:`at`,children:`One-time`}),at=(0,Q.jsx)(`option`,{value:`every`,children:`Interval`}),t[67]=rt,t[68]=it,t[69]=at):(rt=t[67],it=t[68],at=t[69]);let ot;t[70]!==y.kind||t[71]!==x||t[72]!==nt?(ot=(0,Q.jsxs)(`select`,{className:tt,value:y.kind,disabled:x,onChange:nt,children:[rt,it,at]}),t[70]=y.kind,t[71]=x,t[72]=nt,t[73]=ot):ot=t[73];let st;t[74]!==et||t[75]!==ot?(st=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[et,ot]}),t[74]=et,t[75]=ot,t[76]=st):st=t[76];let ct;t[77]!==Pe||t[78]!==a.nextRun||t[79]!==a.scheduleBadge||t[80]!==a.schedulePicker||t[81]!==y||t[82]!==x||t[83]!==Me||t[84]!==b?(ct=y.kind===`cron`?(0,Q.jsx)(Xe,{value:y.expr,onChange:e=>b({...y,expr:e}),disabled:x,labels:a.schedulePicker}):y.kind===`at`?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.nextRun}),(0,Q.jsx)(`input`,{type:`datetime-local`,className:Ct(x),value:Pe,disabled:x,onChange:e=>{let t=new Date(e.target.value).getTime();b({kind:`at`,at:Number.isFinite(t)?new Date(t).toISOString():``})}})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.scheduleBadge.everyNMinutes.replace(`{{n}}`,``)}),(0,Q.jsx)(`input`,{type:`number`,min:1,step:1,className:Ct(x),value:Me,disabled:x,onChange:e=>{let t=Number.parseInt(e.target.value,10);b({kind:`every`,everyMs:Math.max(1,Number.isFinite(t)?t:1)*6e4})}})]}),t[77]=Pe,t[78]=a.nextRun,t[79]=a.scheduleBadge,t[80]=a.schedulePicker,t[81]=y,t[82]=x,t[83]=Me,t[84]=b,t[85]=ct):ct=t[85];let lt;t[86]!==st||t[87]!==ct?(lt=(0,Q.jsxs)(Q.Fragment,{children:[st,ct]}),t[86]=st,t[87]=ct,t[88]=lt):lt=t[88];let ut=lt,dt;t[89]===a.message?dt=t[90]:(dt=(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.message}),t[89]=a.message,t[90]=dt);let ft;t[91]!==ue||t[92]!==J?(ft=e=>{ue(e),Ee(cn),J(`edit`)},t[91]=ue,t[92]=J,t[93]=ft):ft=t[93];let pt=a.message,mt;t[94]===y?mt=t[95]:(mt=Ke(y),t[94]=y,t[95]=mt);let ht;t[96]!==ie||t[97]!==_||t[98]!==R||t[99]!==C||t[100]!==mt?(ht={page:`cron`,taskKind:C,cronName:_,scheduleSummary:mt,sessionTarget:R,deliveryChannel:ie},t[96]=ie,t[97]=_,t[98]=R,t[99]=C,t[100]=mt,t[101]=ht):ht=t[101];let gt;t[102]!==a.message||t[103]!==le||t[104]!==x||t[105]!==ye||t[106]!==ft||t[107]!==ht?(gt=(0,Q.jsx)(Gt,{value:le,onApply:ft,fieldId:`cron.message`,fieldLabel:pt,scenario:`cron.message`,format:`markdown`,locale:ye,context:ht,disabled:x}),t[102]=a.message,t[103]=le,t[104]=x,t[105]=ye,t[106]=ft,t[107]=ht,t[108]=gt):gt=t[108];let _t=de===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`,vt;t[109]===_t?vt=t[110]:(vt=i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,_t),t[109]=_t,t[110]=vt);let yt;t[111]===J?yt=t[112]:(yt=()=>J(`edit`),t[111]=J,t[112]=yt);let bt;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Q.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[113]=bt):bt=t[113];let xt;t[114]!==a.messageEdit||t[115]!==vt||t[116]!==yt?(xt=(0,Q.jsxs)(`button`,{type:`button`,className:vt,onClick:yt,children:[bt,a.messageEdit]}),t[114]=a.messageEdit,t[115]=vt,t[116]=yt,t[117]=xt):xt=t[117];let St=de===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`,Et;t[118]===St?Et=t[119]:(Et=i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,St),t[118]=St,t[119]=Et);let Dt;t[120]===J?Dt=t[121]:(Dt=()=>J(`preview`),t[120]=J,t[121]=Dt);let Ot;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=(0,Q.jsx)(j,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[122]=Ot):Ot=t[122];let kt;t[123]!==a.messagePreview||t[124]!==Et||t[125]!==Dt?(kt=(0,Q.jsxs)(`button`,{type:`button`,className:Et,onClick:Dt,children:[Ot,a.messagePreview]}),t[123]=a.messagePreview,t[124]=Et,t[125]=Dt,t[126]=kt):kt=t[126];let At;t[127]!==xt||t[128]!==kt?(At=(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[xt,kt]}),t[127]=xt,t[128]=kt,t[129]=At):At=t[129];let jt;t[130]!==gt||t[131]!==At?(jt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[gt,At]}),t[130]=gt,t[131]=At,t[132]=jt):jt=t[132];let $;t[133]!==dt||t[134]!==jt?($=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[dt,jt]}),t[133]=dt,t[134]=jt,t[135]=$):$=t[135];let Mt=x&&`pointer-events-none opacity-60`,Nt;t[136]===Mt?Nt=t[137]:(Nt=i(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,Mt),t[136]=Mt,t[137]=Nt);let Pt;t[138]!==Te||t[139]!==a.messagePlaceholder||t[140]!==g||t[141]!==le||t[142]!==de||t[143]!==l||t[144]!==pe||t[145]!==ue?(Pt=de===`edit`?(0,Q.jsx)(xe,{initialContent:le,onChange:ue,isDark:l,className:`h-[min(22rem,44vh)] min-h-[16rem]`},`cron-msg-${g??`new`}-${pe}-${Te}`):(0,Q.jsx)(`div`,{className:`h-[min(22rem,44vh)] min-h-[16rem] max-h-[min(26rem,52vh)] overflow-y-auto px-3 py-2`,children:le.trim()?(0,Q.jsx)(be,{content:le,compact:!0,className:`text-sm`}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.messagePlaceholder})}),t[138]=Te,t[139]=a.messagePlaceholder,t[140]=g,t[141]=le,t[142]=de,t[143]=l,t[144]=pe,t[145]=ue,t[146]=Pt):Pt=t[146];let Ft;t[147]!==Nt||t[148]!==Pt?(Ft=(0,Q.jsx)(`div`,{className:Nt,children:Pt}),t[147]=Nt,t[148]=Pt,t[149]=Ft):Ft=t[149];let It;t[150]===a.messageMarkdownHint?It=t[151]:(It=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.messageMarkdownHint}),t[150]=a.messageMarkdownHint,t[151]=It);let Lt;t[152]!==$||t[153]!==Ft||t[154]!==It?(Lt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[$,Ft,It]}),t[152]=$,t[153]=Ft,t[154]=It,t[155]=Lt):Lt=t[155];let Rt=Lt,zt;t[156]===r?zt=t[157]:(zt=e=>!e&&r(),t[156]=r,t[157]=zt);let Bt;t[158]===Symbol.for(`react.memo_cache_sentinel`)?(Bt=(0,Q.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[158]=Bt):Bt=t[158];let Vt=h===`edit`?a.editJob:a.addJob,Ht;t[159]===Vt?Ht=t[160]:(Ht=(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:Vt}),t[159]=Vt,t[160]=Ht);let Ut;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(Ut=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[161]=Ut):Ut=t[161];let Wt;t[162]===a.close?Wt=t[163]:(Wt=(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:Ut})}),t[162]=a.close,t[163]=Wt);let Kt;t[164]!==Ht||t[165]!==Wt?(Kt=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Ht,Wt]}),t[164]=Ht,t[165]=Wt,t[166]=Kt):Kt=t[166];let qt=!we&&`lg:transition-[grid-template-columns] lg:duration-200 lg:ease-out`,Yt;t[167]===qt?Yt=t[168]:(Yt=i(`grid min-h-full grid-cols-1 gap-4 lg:h-full lg:min-h-0 lg:[grid-template-columns:minmax(0,var(--cron-form-primary-pane))_0.75rem_minmax(22rem,1fr)] lg:gap-0`,qt),t[167]=qt,t[168]=Yt);let Xt=`${Se}%`,Zt;t[169]===Xt?Zt=t[170]:(Zt={"--cron-form-primary-pane":Xt},t[169]=Xt,t[170]=Zt);let Qt=Zt,on;t[171]===a.name?on=t[172]:(on=(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.name}),t[171]=a.name,t[172]=on);let pn;t[173]===Symbol.for(`react.memo_cache_sentinel`)?(pn=Ct(),t[173]=pn):pn=t[173];let mn;t[174]===v?mn=t[175]:(mn=e=>v(e.target.value),t[174]=v,t[175]=mn);let hn;t[176]!==a.namePlaceholder||t[177]!==_||t[178]!==mn?(hn=(0,Q.jsx)(`input`,{type:`text`,className:pn,value:_,onChange:mn,placeholder:a.namePlaceholder}),t[176]=a.namePlaceholder,t[177]=_,t[178]=mn,t[179]=hn):hn=t[179];let gn;t[180]!==on||t[181]!==hn?(gn=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[on,hn]}),t[180]=on,t[181]=hn,t[182]=gn):gn=t[182];let _n;t[183]===a.taskKind?_n=t[184]:(_n=(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.taskKind}),t[183]=a.taskKind,t[184]=_n);let vn;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(vn=wt(),t[185]=vn):vn=t[185];let yn;t[186]===w?yn=t[187]:(yn=e=>w(e.target.value),t[186]=w,t[187]=yn);let bn;t[188]===a.taskKindMessage?bn=t[189]:(bn=(0,Q.jsx)(`option`,{value:`message`,children:a.taskKindMessage}),t[188]=a.taskKindMessage,t[189]=bn);let xn;t[190]===a.taskKindWorkflowRun?xn=t[191]:(xn=(0,Q.jsx)(`option`,{value:`workflowRun`,children:a.taskKindWorkflowRun}),t[190]=a.taskKindWorkflowRun,t[191]=xn);let Sn;t[192]!==x||t[193]!==C||t[194]!==yn||t[195]!==bn||t[196]!==xn?(Sn=(0,Q.jsxs)(`select`,{className:vn,value:C,disabled:x,onChange:yn,children:[bn,xn]}),t[192]=x,t[193]=C,t[194]=yn,t[195]=bn,t[196]=xn,t[197]=Sn):Sn=t[197];let Cn;t[198]!==_n||t[199]!==Sn?(Cn=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[_n,Sn]}),t[198]=_n,t[199]=Sn,t[200]=Cn):Cn=t[200];let wn;t[201]!==ut||t[202]!==gn||t[203]!==Cn?(wn=(0,Q.jsxs)(an,{children:[gn,ut,Cn]}),t[201]=ut,t[202]=gn,t[203]=Cn,t[204]=wn):wn=t[204];let Tn;t[205]!==a.message||t[206]!==a.workflowDefinition||t[207]!==a.workflowDefinitionCustom||t[208]!==a.workflowDefinitionMissing||t[209]!==a.workflowDefinitionPlaceholder||t[210]!==a.workflowDefinitionsEmpty||t[211]!==a.workflowDefinitionsLoading||t[212]!==_||t[213]!==y||t[214]!==x||t[215]!==C||t[216]!==P||t[217]!==O||t[218]!==A||t[219]!==ye||t[220]!==Rt||t[221]!==I||t[222]!==k||t[223]!==N||t[224]!==Oe||t[225]!==Ae||t[226]!==T||t[227]!==D?(Tn=C===`workflowRun`?(0,Q.jsxs)(an,{title:a.workflowDefinition,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workflowDefinition}),(0,Q.jsxs)(`select`,{className:wt(),value:O,disabled:x||D,onChange:e=>k(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:D?a.workflowDefinitionsLoading:a.workflowDefinitionPlaceholder}),O.trim()&&!T.some(e=>e.id===O.trim())?(0,Q.jsx)(`option`,{value:O,children:O}):null,T.map(e=>(0,Q.jsxs)(`option`,{value:e.id,children:[e.title,e.metadata.source===`user`?` (${a.workflowDefinitionCustom})`:``]},e.id))]}),!D&&T.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workflowDefinitionsEmpty}):null,Ae?(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:Ae.description}):O.trim()&&!Oe?(0,Q.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:a.workflowDefinitionMissing}):null]}),O.trim()?(0,Q.jsx)($t,{workflowName:O.trim(),language:ye,argValues:P,onArgValuesChange:I,goal:A,onGoalChange:N,examplePrompts:Ae?.examplePrompts??[],inputClassName:Ct(),aiAssist:{disabled:x,context:{page:`cron`,taskKind:C,cronName:_,scheduleSummary:Ke(y),workflowDefinitionId:O.trim(),workflowDescription:Ae?.description??``}}}):null]}):(0,Q.jsx)(an,{title:a.message,children:Rt}),t[205]=a.message,t[206]=a.workflowDefinition,t[207]=a.workflowDefinitionCustom,t[208]=a.workflowDefinitionMissing,t[209]=a.workflowDefinitionPlaceholder,t[210]=a.workflowDefinitionsEmpty,t[211]=a.workflowDefinitionsLoading,t[212]=_,t[213]=y,t[214]=x,t[215]=C,t[216]=P,t[217]=O,t[218]=A,t[219]=ye,t[220]=Rt,t[221]=I,t[222]=k,t[223]=N,t[224]=Oe,t[225]=Ae,t[226]=T,t[227]=D,t[228]=Tn):Tn=t[228];let En;t[229]!==wn||t[230]!==Tn?(En=(0,Q.jsx)(`div`,{className:`lg:min-h-0 lg:overflow-y-auto`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[wn,Tn]})}),t[229]=wn,t[230]=Tn,t[231]=En):En=t[231];let Dn=a.detailResizeColumns,On;t[232]===Se?On=t[233]:(On=Math.round(Se),t[232]=Se,t[233]=On);let kn;t[234]===Symbol.for(`react.memo_cache_sentinel`)?(kn=i(`group hidden h-full cursor-col-resize touch-none select-none items-stretch justify-center rounded-lg outline-none lg:flex`,`focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[234]=kn):kn=t[234];let An=we&&`bg-edge`,jn;t[235]===An?jn=t[236]:(jn=i(`h-full w-px bg-edge-subtle transition-colors duration-150`,`group-hover:bg-edge`,An),t[235]=An,t[236]=jn);let Mn;t[237]===jn?Mn=t[238]:(Mn=(0,Q.jsx)(`span`,{className:jn}),t[237]=jn,t[238]=Mn);let Nn;t[239]!==a.detailResizeColumns||t[240]!==On||t[241]!==Mn?(Nn=(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":Dn,"aria-valuemin":en,"aria-valuemax":tn,"aria-valuenow":On,tabIndex:0,onPointerDown:Ie,onKeyDown:Re,className:kn,children:Mn}),t[239]=a.detailResizeColumns,t[240]=On,t[241]=Mn,t[242]=Nn):Nn=t[242];let Pn;t[243]!==Ye||t[244]!==a.agentLocalOnly||t[245]!==a.agentLocalOnlyHint||t[246]!==a.detailRunSettings||t[247]!==a.mode||t[248]!==a.modeAgent||t[249]!==a.modeAgentOption||t[250]!==a.modeDirect||t[251]!==a.modeDirectOption||t[252]!==a.model||t[253]!==a.workflowLocalOnly||t[254]!==a.workflowLocalOnlyHint||t[255]!==a.workingDirectoryHint||t[256]!==a.workingDirectoryLabel||t[257]!==a.workingDirectoryReset||t[258]!==s||t[259]!==p||t[260]!==V||t[261]!==W||t[262]!==R||t[263]!==x||t[264]!==C||t[265]!==ne||t[266]!==H||t[267]!==G||t[268]!==B||t[269]!==re?(Pn=C===`message`?(0,Q.jsxs)(an,{title:a.detailRunSettings,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.mode}),(0,Q.jsxs)(`select`,{className:wt(),value:R,onChange:e=>{let t=e.target.value;B(t,p,W.trim())},children:[(0,Q.jsx)(`option`,{value:`main`,children:a.modeDirectOption}),(0,Q.jsx)(`option`,{value:`isolated`,children:a.modeAgentOption})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R===`main`?a.modeDirect:a.modeAgent})]}),R===`isolated`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.model}),(0,Q.jsx)(F,{value:W,placeholder:s.modelPlaceholder,searchPlaceholder:s.modelSearchPlaceholder,noMatches:s.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:G})]}),Ye,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workingDirectoryLabel}),(0,Q.jsx)(Jt,{value:ne,onChange:re,disabled:x,wd:s.workingDirectory,placeholder:s.workingDirectory.notSet,maxWidthClass:`max-w-[min(18rem,52vw)]`,clearLabel:a.workingDirectoryReset,onClear:()=>re(``)}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workingDirectoryHint})]}),(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,className:i(`ui-checkbox`,`mt-0.5`),checked:V,onChange:e=>H(e.target.checked),"aria-label":a.agentLocalOnly}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.agentLocalOnly}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.agentLocalOnlyHint})]})]})]}):null]}):(0,Q.jsxs)(an,{title:a.detailRunSettings,children:[Ye,(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,className:i(`ui-checkbox`,`mt-0.5`),checked:V,onChange:e=>H(e.target.checked),"aria-label":a.workflowLocalOnly}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.workflowLocalOnly}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.workflowLocalOnlyHint})]})]})]}),t[243]=Ye,t[244]=a.agentLocalOnly,t[245]=a.agentLocalOnlyHint,t[246]=a.detailRunSettings,t[247]=a.mode,t[248]=a.modeAgent,t[249]=a.modeAgentOption,t[250]=a.modeDirect,t[251]=a.modeDirectOption,t[252]=a.model,t[253]=a.workflowLocalOnly,t[254]=a.workflowLocalOnlyHint,t[255]=a.workingDirectoryHint,t[256]=a.workingDirectoryLabel,t[257]=a.workingDirectoryReset,t[258]=s,t[259]=p,t[260]=V,t[261]=W,t[262]=R,t[263]=x,t[264]=C,t[265]=ne,t[266]=H,t[267]=G,t[268]=B,t[269]=re,t[270]=Pn):Pn=t[270];let Fn;t[271]!==a.deliveryTarget||t[272]!==Qe?(Fn=Qe?(0,Q.jsx)(an,{title:a.deliveryTarget,children:Qe}):null,t[271]=a.deliveryTarget,t[272]=Qe,t[273]=Fn):Fn=t[273];let In;t[274]!==Pn||t[275]!==Fn?(In=(0,Q.jsx)(`aside`,{className:`lg:min-h-0 lg:overflow-y-auto`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[Pn,Fn]})}),t[274]=Pn,t[275]=Fn,t[276]=In):In=t[276];let Ln;t[277]!==Yt||t[278]!==Qt||t[279]!==En||t[280]!==Nn||t[281]!==In?(Ln=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 lg:overflow-hidden`,children:(0,Q.jsxs)(`div`,{ref:De,className:Yt,style:Qt,children:[En,Nn,In]})}),t[277]=Yt,t[278]=Qt,t[279]=En,t[280]=Nn,t[281]=In,t[282]=Ln):Ln=t[282];let Rn;t[283]!==a.cancel||t[284]!==r?(Rn=(0,Q.jsx)(q,{type:`button`,variant:`secondary`,onClick:r,children:a.cancel}),t[283]=a.cancel,t[284]=r,t[285]=Rn):Rn=t[285];let zn=x||!ge,Bn=x?a.loading:h===`edit`?a.save:a.create,Vn;t[286]!==_e||t[287]!==zn||t[288]!==Bn?(Vn=(0,Q.jsx)(q,{type:`button`,variant:`primary`,disabled:zn,onClick:_e,children:Bn}),t[286]=_e,t[287]=zn,t[288]=Bn,t[289]=Vn):Vn=t[289];let Hn;t[290]!==Rn||t[291]!==Vn?(Hn=(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Rn,Vn]}),t[290]=Rn,t[291]=Vn,t[292]=Hn):Hn=t[292];let Un;t[293]!==Kt||t[294]!==Ln||t[295]!==Hn?(Un=(0,Q.jsxs)(z,{children:[Bt,(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,Q.jsxs)(E,{className:`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(86vh,46rem)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,onOpenAutoFocus:sn,children:[Kt,Ln,Hn]})})]}),t[293]=Kt,t[294]=Ln,t[295]=Hn,t[296]=Un):Un=t[296];let Wn;return t[297]!==n||t[298]!==zt||t[299]!==Un?(Wn=(0,Q.jsx)(M,{open:n,onOpenChange:zt,children:Un}),t[297]=n,t[298]=zt,t[299]=Un,t[300]=Wn):Wn=t[300],Wn}function sn(e){return e.preventDefault()}function cn(e){return e+1}function ln(e){return(0,Q.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name)}function un(e){return rn(e+4)}function dn(e){return rn(e-4)}function fn(e){return e.language}function pn(e){let t=(0,Z.c)(76),{c:n,mainTab:r,onMainTabChange:a,jobSort:o,onJobSortChange:s,historyRange:c,onHistoryRangeChange:l,historyJobFilter:u,onHistoryJobFilterChange:d,historyStatusFilter:f,onHistoryStatusFilterChange:p,jobs:m}=e,h=n.title,g=r===`myTasks`,v=r===`myTasks`?`text-fg`:`text-fg-muted hover:text-fg`,y;t[0]===v?y=t[1]:(y=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,v),t[0]=v,t[1]=y);let b;t[2]===a?b=t[3]:(b=()=>a(`myTasks`),t[2]=a,t[3]=b);let x;t[4]!==n.tabMyTasks||t[5]!==g||t[6]!==y||t[7]!==b?(x=(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":g,className:y,onClick:b,children:n.tabMyTasks}),t[4]=n.tabMyTasks,t[5]=g,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S=r===`systemTasks`,C=r===`systemTasks`?`text-fg`:`text-fg-muted hover:text-fg`,w;t[9]===C?w=t[10]:(w=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,C),t[9]=C,t[10]=w);let T;t[11]===a?T=t[12]:(T=()=>a(`systemTasks`),t[11]=a,t[12]=T);let E;t[13]!==n.tabSystemTasks||t[14]!==T||t[15]!==S||t[16]!==w?(E=(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S,className:w,onClick:T,children:n.tabSystemTasks}),t[13]=n.tabSystemTasks,t[14]=T,t[15]=S,t[16]=w,t[17]=E):E=t[17];let D=r===`history`,O=r===`history`?`text-fg`:`text-fg-muted hover:text-fg`,k;t[18]===O?k=t[19]:(k=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,O),t[18]=O,t[19]=k);let A;t[20]===a?A=t[21]:(A=()=>a(`history`),t[20]=a,t[21]=A);let j;t[22]!==n.tabRunHistory||t[23]!==D||t[24]!==k||t[25]!==A?(j=(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":D,className:k,onClick:A,children:n.tabRunHistory}),t[22]=n.tabRunHistory,t[23]=D,t[24]=k,t[25]=A,t[26]=j):j=t[26];let M=r===`settings`,N=r===`settings`?`text-fg`:`text-fg-muted hover:text-fg`,P;t[27]===N?P=t[28]:(P=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,N),t[27]=N,t[28]=P);let F;t[29]===a?F=t[30]:(F=()=>a(`settings`),t[29]=a,t[30]=F);let I;t[31]!==n.globals.title||t[32]!==M||t[33]!==P||t[34]!==F?(I=(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":M,className:P,onClick:F,children:n.globals.title}),t[31]=n.globals.title,t[32]=M,t[33]=P,t[34]=F,t[35]=I):I=t[35];let L;t[36]!==n.title||t[37]!==E||t[38]!==j||t[39]!==I||t[40]!==x?(L=(0,Q.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":h,children:[x,E,j,I]}),t[36]=n.title,t[37]=E,t[38]=j,t[39]=I,t[40]=x,t[41]=L):L=t[41];let R=r===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`,z;t[42]===R?z=t[43]:(z=i(`flex min-w-0 items-center gap-2`,R),t[42]=R,t[43]=z);let B;t[44]!==n.sortCreatedAsc||t[45]!==n.sortCreatedDesc||t[46]!==o||t[47]!==r||t[48]!==s?(B=r===`myTasks`||r===`systemTasks`?(0,Q.jsxs)(`select`,{className:Et,value:o,onChange:e=>s(e.target.value),"aria-label":n.sortCreatedDesc,children:[(0,Q.jsx)(`option`,{value:`created_desc`,children:n.sortCreatedDesc}),(0,Q.jsx)(`option`,{value:`created_asc`,children:n.sortCreatedAsc})]}):null,t[44]=n.sortCreatedAsc,t[45]=n.sortCreatedDesc,t[46]=o,t[47]=r,t[48]=s,t[49]=B):B=t[49];let V;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]!==u||t[61]!==c||t[62]!==f||t[63]!==m||t[64]!==r||t[65]!==d||t[66]!==l||t[67]!==p?(V=r===`history`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:i(_e,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,Q.jsx)(`button`,{type:`button`,className:i(_,`px-2.5 py-1`,c===e&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,c===e&&`text-fg`),onClick:()=>l(e),children:e===`day`?n.historyRangeDay:e===`week`?n.historyRangeWeek:n.historyRangeMonth},e))}),(0,Q.jsxs)(`select`,{className:Et,value:u,onChange:e=>d(e.target.value),"aria-label":n.filterAllTasks,children:[(0,Q.jsx)(`option`,{value:``,children:n.filterAllTasks}),m.map(mn)]}),(0,Q.jsxs)(`select`,{className:Et,value:f,onChange:e=>p(e.target.value),"aria-label":n.filterAllStatuses,children:[(0,Q.jsx)(`option`,{value:``,children:n.filterAllStatuses}),(0,Q.jsx)(`option`,{value:`success`,children:n.execStatusSuccess}),(0,Q.jsx)(`option`,{value:`failed`,children:n.execStatusFailed}),(0,Q.jsx)(`option`,{value:`cancelled`,children:n.execStatusCancelled}),(0,Q.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]=u,t[61]=c,t[62]=f,t[63]=m,t[64]=r,t[65]=d,t[66]=l,t[67]=p,t[68]=V):V=t[68];let H;t[69]!==z||t[70]!==B||t[71]!==V?(H=(0,Q.jsxs)(`div`,{className:z,children:[B,V]}),t[69]=z,t[70]=B,t[71]=V,t[72]=H):H=t[72];let U;return t[73]!==L||t[74]!==H?(U=(0,Q.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:[L,H]}),t[73]=L,t[74]=H,t[75]=U):U=t[75],U}function mn(e){return(0,Q.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id)}function hn(e){let t=(0,Z.c)(23),{c:n,loading:r,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}=e,l=r||a,u=n.refresh,d=n.refresh,f;t[0]===o?f=t[1]:(f=()=>void o(),t[0]=o,t[1]=f);let p=l&&`animate-spin`,m;t[2]===p?m=t[3]:(m=i(`size-4`,p),t[2]=p,t[3]=m);let h;t[4]===m?h=t[5]:(h=(0,Q.jsx)(U,{className:m,strokeWidth:1.75}),t[4]=m,t[5]=h);let g;t[6]!==l||t[7]!==n.refresh||t[8]!==f||t[9]!==h?(g=(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:l,title:u,"aria-label":d,onClick:f,children:h}),t[6]=l,t[7]=n.refresh,t[8]=f,t[9]=h,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(ue,{className:`size-4`,strokeWidth:1.75}),t[11]=_):_=t[11];let v;t[12]!==n.fromTemplate||t[13]!==s?(v=(0,Q.jsxs)(q,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:s,children:[_,n.fromTemplate]}),t[12]=n.fromTemplate,t[13]=s,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(b,{className:`size-4`,strokeWidth:1.75}),t[15]=y):y=t[15];let x;t[16]!==n.addJob||t[17]!==c?(x=(0,Q.jsxs)(q,{type:`button`,variant:`primary`,className:`gap-2`,onClick:c,children:[y,n.addJob]}),t[16]=n.addJob,t[17]=c,t[18]=x):x=t[18];let S;return t[19]!==x||t[20]!==g||t[21]!==v?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[g,v,x]}),t[19]=x,t[20]=g,t[21]=v,t[22]=S):S=t[22],S}function gn(e){let t=(0,Z.c)(46),{c:n,runHistoryLoading:r,runHistory:a,filteredRunHistory:o,jobs:s,onRefreshHistory:c,onOpenJobDetail:l,statusLabels:u}=e,d;t[0]===n.tabRunHistory?d=t[1]:(d=(0,Q.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:n.tabRunHistory}),t[0]=n.tabRunHistory,t[1]=d);let f;t[2]===n.runHistoryHint?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.runHistoryHint}),t[2]=n.runHistoryHint,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,Q.jsxs)(`div`,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m=n.refresh,h=n.refresh,_;t[7]===c?_=t[8]:(_=()=>void c(),t[7]=c,t[8]=_);let v=r&&`animate-spin`,y;t[9]===v?y=t[10]:(y=i(`size-4`,v),t[9]=v,t[10]=y);let b;t[11]===y?b=t[12]:(b=(0,Q.jsx)(U,{className:y,strokeWidth:1.75}),t[11]=y,t[12]=b);let x;t[13]!==n.refresh||t[14]!==r||t[15]!==_||t[16]!==b?(x=(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:r,title:m,"aria-label":h,onClick:_,children:b}),t[13]=n.refresh,t[14]=r,t[15]=_,t[16]=b,t[17]=x):x=t[17];let S;t[18]!==x||t[19]!==p?(S=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[p,x]}),t[18]=x,t[19]=p,t[20]=S):S=t[20];let C;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]!==o||t[37]!==s||t[38]!==l||t[39]!==a||t[40]!==r||t[41]!==u?(C=r&&a.length===0?(0,Q.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,Q.jsx)(se,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):o.length===0?(0,Q.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,Q.jsx)(g,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:a.length===0?n.emptyHistoryTitle:n.noRunsYet}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:a.length===0?n.emptyHistoryHint:n.runHistoryHint})]}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colStarted}),(0,Q.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colJob}),(0,Q.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.status}),(0,Q.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDuration}),(0,Q.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDetail}),(0,Q.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colWorkflow}),(0,Q.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colChat})]})}),(0,Q.jsx)(`tbody`,{children:o.map(e=>(0,Q.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,Q.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,Q.jsx)(`time`,{dateTime:e.startedAt,children:Y(e.startedAt)})}),(0,Q.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:s.some(t=>t.id===e.jobId)?(0,Q.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let t=s.find(t=>t.id===e.jobId);t&&l(t)},children:e.jobName||e.jobId}):(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:e.jobName||e.jobId})}),(0,Q.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,Q.jsx)(`span`,{className:i(`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:De(e.status,u)})}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:Je(e.duration)}),(0,Q.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:e.summary||e.error||``,children:Ee(e.summary||e.error,96)}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.workflowRunId?.trim()?(0,Q.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openWorkflowTitle,"aria-label":n.openWorkflowTitle,onClick:()=>St(e.workflowRunId),children:n.openWorkflow}):(0,Q.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.sessionKey?.trim()?(0,Q.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>xt(e.sessionKey),children:n.openChat}):(0,Q.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]=o,t[37]=s,t[38]=l,t[39]=a,t[40]=r,t[41]=u,t[42]=C):C=t[42];let w;return t[43]!==S||t[44]!==C?(w=(0,Q.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[S,C]}),t[43]=S,t[44]=C,t[45]=w):w=t[45],w}function _n(e){let t=(0,Z.c)(77),{job:n,c:r,localeTag:a,scheduleBadgeLabels:o,absorbCardClickJobIdRef:s,scheduleAbsorbNextMenuCardClick:c,onOpenDetail:l,onToggle:u,onEdit:d,onRunNow:f,onDelete:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`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]=m):m=t[0];let h,_;t[1]!==s||t[2]!==n||t[3]!==l?(h=()=>{if(s.current===n.id){s.current=null;return}l(n)},_=e=>{if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),s.current===n.id){s.current=null;return}l(n)}},t[1]=s,t[2]=n,t[3]=l,t[4]=h,t[5]=_):(h=t[4],_=t[5]);let v=n.enabled,y=n.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`,b;t[6]===y?b=t[7]:(b=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,y),t[6]=y,t[7]=b);let x;t[8]!==n||t[9]!==u?(x=e=>{e.stopPropagation(),u(n,!n.enabled)},t[8]=n,t[9]=u,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[11]=S):S=t[11];let C;t[12]!==n.enabled||t[13]!==b||t[14]!==x?(C=(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":v,className:b,onClick:x,children:S}),t[12]=n.enabled,t[13]=b,t[14]=x,t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(ne,{className:`size-4`,strokeWidth:1.75}),t[16]=w):w=t[16];let T;t[17]===r.jobCardMenuAria?T=t[18]:(T=(0,Q.jsx)(it,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":r.jobCardMenuAria,onClick:yn,children:w})}),t[17]=r.jobCardMenuAria,t[18]=T);let E;t[19]!==n||t[20]!==d||t[21]!==c?(E=()=>{c(n.id),d(n)},t[19]=n,t[20]=d,t[21]=c,t[22]=E):E=t[22];let D;t[23]!==r.edit||t[24]!==E?(D=(0,Q.jsx)(rt,{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.edit}),t[23]=r.edit,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==n||t[27]!==f||t[28]!==c?(O=()=>{c(n.id),f(n)},t[26]=n,t[27]=f,t[28]=c,t[29]=O):O=t[29];let k;t[30]!==r.runNow||t[31]!==O?(k=(0,Q.jsx)(rt,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:O,children:r.runNow}),t[30]=r.runNow,t[31]=O,t[32]=k):k=t[32];let A;t[33]!==n||t[34]!==p||t[35]!==c?(A=()=>{c(n.id),p(n)},t[33]=n,t[34]=p,t[35]=c,t[36]=A):A=t[36];let j;t[37]!==r.delete||t[38]!==A?(j=(0,Q.jsx)(rt,{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:A,children:r.delete}),t[37]=r.delete,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==D||t[41]!==k||t[42]!==j?(M=(0,Q.jsx)(at,{children:(0,Q.jsxs)(ot,{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:vn,children:[D,k,j]})}),t[40]=D,t[41]=k,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==T||t[45]!==M?(N=(0,Q.jsxs)(nt,{children:[T,M]}),t[44]=T,t[45]=M,t[46]=N):N=t[46];let P;t[47]!==N||t[48]!==C?(P=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[C,N]}),t[47]=N,t[48]=C,t[49]=P):P=t[49];let F=n.name||n.id,I;t[50]===F?I=t[51]:(I=(0,Q.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:F}),t[50]=F,t[51]=I);let L;t[52]===n?L=t[53]:(L=Fe(n),t[52]=n,t[53]=L);let R;t[54]===n?R=t[55]:(R=Fe(n),t[54]=n,t[55]=R);let z;t[56]===R?z=t[57]:(z=(0,Q.jsx)(be,{content:R,compact:!0}),t[56]=R,t[57]=z);let B;t[58]!==L||t[59]!==z?(B=(0,Q.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:L,children:z}),t[58]=L,t[59]=z,t[60]=B):B=t[60];let V;t[61]!==I||t[62]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[I,B]}),t[61]=I,t[62]=B,t[63]=V):V=t[63];let H;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(g,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[64]=H):H=t[64];let U;t[65]!==n||t[66]!==a||t[67]!==o?(U=Te(n,a,o),t[65]=n,t[66]=a,t[67]=o,t[68]=U):U=t[68];let W;t[69]===U?W=t[70]:(W=(0,Q.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:[H,(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:U})]}),t[69]=U,t[70]=W);let G;return t[71]!==h||t[72]!==P||t[73]!==V||t[74]!==_||t[75]!==W?(G=(0,Q.jsxs)(`article`,{role:`button`,tabIndex:0,className:m,onClick:h,onKeyDown:_,children:[P,V,W]}),t[71]=h,t[72]=P,t[73]=V,t[74]=_,t[75]=W,t[76]=G):G=t[76],G}function vn(e){return e.preventDefault()}function yn(e){return e.stopPropagation()}function bn(e){let t=(0,Z.c)(134),{c:n,language:r,localeTag:o,scheduleBadgeLabels:s,loading:c,sortedSystemJobs:l,heartbeat:u,keepAwake:d,wakeSupported:f,onWakeUnsupportedClick:p,onKeepAwakeToggle:m,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:b,onDelete:x}=e,S,C,w,T,E,D,O,k,A,j,M,P;if(t[0]!==n.disabled||t[1]!==n.enabled||t[2]!==n.keepAwake||t[3]!==n.systemHeartbeatEvery||t[4]!==n.systemHeartbeatHint||t[5]!==n.systemHeartbeatInterval||t[6]!==n.systemHeartbeatSettingsLink||t[7]!==n.systemHeartbeatStatus||t[8]!==n.systemHeartbeatTitle||t[9]!==n.systemTasksIntro||t[10]!==n.tabSystemTasks||t[11]!==n.wakeBanner||t[12]!==n.wakeLockUnavailable||t[13]!==u.enabled||t[14]!==u.intervalMs||t[15]!==d||t[16]!==r||t[17]!==o||t[18]!==m||t[19]!==p||t[20]!==f){let e=Ze(u.intervalMs,o,a(r).heartbeatSettings.intervalPresets);M=`cron-system-tasks-panel`,P=`flex flex-col gap-4`,t[33]===n.tabSystemTasks?C=t[34]:(C=(0,Q.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:n.tabSystemTasks}),t[33]=n.tabSystemTasks,t[34]=C),t[35]===n.systemTasksIntro?w=t[36]:(w=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.systemTasksIntro}),t[35]=n.systemTasksIntro,t[36]=w);let s;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[37]=s):s=t[37];let c;t[38]===n.wakeBanner?c=t[39]:(c=(0,Q.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[s,(0,Q.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[38]=n.wakeBanner,t[39]=c);let l;t[40]===n.keepAwake?l=t[41]:(l=(0,Q.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[40]=n.keepAwake,t[41]=l);let h=!f,g=f?void 0:n.wakeLockUnavailable,_=d?`justify-end bg-accent`:`justify-start bg-surface-hover`,v=!f&&`cursor-not-allowed opacity-50`,y;t[42]!==_||t[43]!==v?(y=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,_,v),t[42]=_,t[43]=v,t[44]=y):y=t[44];let b;t[45]!==m||t[46]!==p||t[47]!==f?(b=()=>{f?m():p()},t[45]=m,t[46]=p,t[47]=f,t[48]=b):b=t[48];let x;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[49]=x):x=t[49];let F;t[50]!==d||t[51]!==h||t[52]!==g||t[53]!==y||t[54]!==b?(F=(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:h,title:g,className:y,onClick:b,children:x}),t[50]=d,t[51]=h,t[52]=g,t[53]=y,t[54]=b,t[55]=F):F=t[55];let I;t[56]!==l||t[57]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[l,F]}),t[56]=l,t[57]=F,t[58]=I):I=t[58],t[59]!==c||t[60]!==I?(T=(0,Q.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:[c,I]}),t[59]=c,t[60]=I,t[61]=T):T=t[61],A=`rounded-xl border border-edge bg-surface-base p-4 dark:bg-surface-hover/20`;let L;t[62]===n.systemHeartbeatTitle?L=t[63]:(L=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemHeartbeatTitle}),t[62]=n.systemHeartbeatTitle,t[63]=L);let R;t[64]===n.systemHeartbeatHint?R=t[65]:(R=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.systemHeartbeatHint}),t[64]=n.systemHeartbeatHint,t[65]=R);let z;t[66]!==L||t[67]!==R?(z=(0,Q.jsxs)(`div`,{children:[L,R]}),t[66]=L,t[67]=R,t[68]=z):z=t[68];let B;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(J,{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,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,Q.jsxs)(N,{to:`/settings/heartbeat`,children:[n.systemHeartbeatSettingsLink,B]})}),t[70]=n.systemHeartbeatSettingsLink,t[71]=V),t[72]!==z||t[73]!==V?(j=(0,Q.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],O=`mt-3 grid gap-2 text-sm sm:grid-cols-2`;let H;t[75]===n.systemHeartbeatStatus?H=t[76]:(H=(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatStatus}),t[75]=n.systemHeartbeatStatus,t[76]=H);let U=u.enabled?n.enabled:n.disabled,W;t[77]===U?W=t[78]:(W=(0,Q.jsx)(`dd`,{className:`text-fg`,children:U}),t[77]=U,t[78]=W),t[79]!==H||t[80]!==W?(k=(0,Q.jsxs)(`div`,{children:[H,W]}),t[79]=H,t[80]=W,t[81]=k):k=t[81],t[82]===n.systemHeartbeatInterval?D=t[83]:(D=(0,Q.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatInterval}),t[82]=n.systemHeartbeatInterval,t[83]=D),S=`text-fg`;let G;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(G=/\{\{value\}\}/g,t[84]=G):G=t[84],E=n.systemHeartbeatEvery.replace(G,e),t[0]=n.disabled,t[1]=n.enabled,t[2]=n.keepAwake,t[3]=n.systemHeartbeatEvery,t[4]=n.systemHeartbeatHint,t[5]=n.systemHeartbeatInterval,t[6]=n.systemHeartbeatSettingsLink,t[7]=n.systemHeartbeatStatus,t[8]=n.systemHeartbeatTitle,t[9]=n.systemTasksIntro,t[10]=n.tabSystemTasks,t[11]=n.wakeBanner,t[12]=n.wakeLockUnavailable,t[13]=u.enabled,t[14]=u.intervalMs,t[15]=d,t[16]=r,t[17]=o,t[18]=m,t[19]=p,t[20]=f,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=P}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30],M=t[31],P=t[32];let F;t[85]!==S||t[86]!==E?(F=(0,Q.jsx)(`dd`,{className:S,children:E}),t[85]=S,t[86]=E,t[87]=F):F=t[87];let I;t[88]!==F||t[89]!==D?(I=(0,Q.jsxs)(`div`,{children:[D,F]}),t[88]=F,t[89]=D,t[90]=I):I=t[90];let L;t[91]!==I||t[92]!==O||t[93]!==k?(L=(0,Q.jsxs)(`dl`,{className:O,children:[k,I]}),t[91]=I,t[92]=O,t[93]=k,t[94]=L):L=t[94];let R;t[95]!==L||t[96]!==A||t[97]!==j?(R=(0,Q.jsxs)(`div`,{className:A,children:[j,L]}),t[95]=L,t[96]=A,t[97]=j,t[98]=R):R=t[98];let z;t[99]===n.systemDreamingTitle?z=t[100]:(z=(0,Q.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,Q.jsx)(J,{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,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,Q.jsxs)(N,{to:`/settings/dreams`,children:[n.systemDreamingSettingsLink,B]})}),t[102]=n.systemDreamingSettingsLink,t[103]=V);let H;t[104]!==z||t[105]!==V?(H=(0,Q.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,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n.systemDreamingHint}),t[107]=n.systemDreamingHint,t[108]=U);let W;t[109]!==h||t[110]!==n||t[111]!==c||t[112]!==o||t[113]!==x||t[114]!==y||t[115]!==_||t[116]!==b||t[117]!==v||t[118]!==g||t[119]!==s||t[120]!==l?(W=c&&l.length===0?(0,Q.jsx)(`div`,{className:`flex justify-center py-12`,"aria-busy":`true`,children:(0,Q.jsx)(se,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):l.length===0?(0,Q.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,Q.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:l.map(e=>(0,Q.jsx)(_n,{job:e,c:n,localeTag:o,scheduleBadgeLabels:s,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:b,onDelete:x},e.id))}),t[109]=h,t[110]=n,t[111]=c,t[112]=o,t[113]=x,t[114]=y,t[115]=_,t[116]=b,t[117]=v,t[118]=g,t[119]=s,t[120]=l,t[121]=W):W=t[121];let G;t[122]!==H||t[123]!==U||t[124]!==W?(G=(0,Q.jsxs)(`div`,{children:[H,U,W]}),t[122]=H,t[123]=U,t[124]=W,t[125]=G):G=t[125];let ee;return t[126]!==C||t[127]!==w||t[128]!==T||t[129]!==R||t[130]!==G||t[131]!==M||t[132]!==P?(ee=(0,Q.jsxs)(`section`,{"aria-labelledby":M,className:P,children:[C,w,T,R,G]}),t[126]=C,t[127]=w,t[128]=T,t[129]=R,t[130]=G,t[131]=M,t[132]=P,t[133]=ee):ee=t[133],ee}function xn(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 Sn=[`daily`,`monitoring`,`reports`,`automation`],Cn=[{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 wn(e){return Cn.find(t=>t.templateId===e)}function Tn(e,t,n){let r=t.trim().toLowerCase();return Cn.filter(t=>{if(n!==`all`&&t.category!==n)return!1;if(!r)return!0;let i=xn(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 Sn.flatMap(e=>{let n=t.get(e);return n?.length?[{category:e,items:n}]:[]})}function Dn(e){let t=(0,Z.c)(23),{template:n,cron:r,localeTag:a,scheduleBadgeLabels:o,onSelectTemplate:s}=e,c;t[0]!==r||t[1]!==n.templateId?(c=xn(r,n.templateId),t[0]=r,t[1]=n.templateId,t[2]=c):c=t[2];let l=c;if(!l)return null;let u;t[3]!==a||t[4]!==o||t[5]!==n.defaultSchedule?(u=Te({schedule:Ve(n.defaultSchedule),nextRunAtMs:void 0},a,o),t[3]=a,t[4]=o,t[5]=n.defaultSchedule,t[6]=u):u=t[6];let d=u,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=i(`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`,ve.focusRingPanel),t[7]=f):f=t[7];let p;t[8]!==s||t[9]!==n.templateId?(p=()=>s(n.templateId),t[8]=s,t[9]=n.templateId,t[10]=p):p=t[10];let m=`${r.templateCategories[n.category]} — ${l.title}`,h;t[11]===l.title?h=t[12]:(h=(0,Q.jsx)(`span`,{className:`font-semibold text-fg`,children:l.title}),t[11]=l.title,t[12]=h);let g;t[13]===l.description?g=t[14]:(g=(0,Q.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:l.description}),t[13]=l.description,t[14]=g);let _;t[15]===d?_=t[16]:(_=(0,Q.jsx)(`span`,{className:`mt-auto flex items-center gap-1 pt-1 text-xs text-fg-muted`,children:(0,Q.jsx)(`span`,{className:`tabular-nums`,children:d})}),t[15]=d,t[16]=_);let v;return t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`button`,{type:`button`,className:f,onClick:p,"aria-label":m,children:[h,g,_]}),t[17]=p,t[18]=m,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}function On(e){let t=(0,Z.c)(49),{cron:n,localeTag:r,scheduleBadgeLabels:a,categoryFilter:o,onCategoryFilterChange:s,onSelectTemplate:c,variant:l}=e,u=l===void 0?`embedded`:l,[d,f]=(0,X.useState)(``),p;t[0]!==o||t[1]!==n||t[2]!==d?(p=Tn(n,d,o),t[0]=o,t[1]=n,t[2]=d,t[3]=p):p=t[3];let m=p,h;t[4]===m?h=t[5]:(h=En(m),t[4]=m,t[5]=h);let g=h,_;t[6]!==o||t[7]!==d?(_=o===`all`&&!d.trim(),t[6]=o,t[7]=d,t[8]=_):_=t[8];let v=_,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(oe,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=y):y=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>f(e.target.value),t[10]=b):b=t[10];let x=n.templateSearchPlaceholder,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=i(`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`,ve.focusRingPanel),t[11]=S):S=t[11];let C;t[12]!==n.templateSearchPlaceholder||t[13]!==d?(C=(0,Q.jsxs)(`div`,{className:`relative`,children:[y,(0,Q.jsx)(`input`,{value:d,onChange:b,placeholder:x,className:S})]}),t[12]=n.templateSearchPlaceholder,t[13]=d,t[14]=C):C=t[14];let w=n.fromTemplate,T=o===`all`?`secondary`:`ghost`,E;t[15]===s?E=t[16]:(E=()=>s(`all`),t[15]=s,t[16]=E);let D;t[17]!==n.templateFilterAll||t[18]!==T||t[19]!==E?(D=(0,Q.jsx)(q,{type:`button`,variant:T,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:E,children:n.templateFilterAll}),t[17]=n.templateFilterAll,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O;t[21]!==o||t[22]!==n.templateCategories||t[23]!==s?(O=Sn.map(e=>(0,Q.jsx)(q,{type:`button`,variant:o===e?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>s(e),children:n.templateCategories[e]},e)),t[21]=o,t[22]=n.templateCategories,t[23]=s,t[24]=O):O=t[24];let k;t[25]!==n.fromTemplate||t[26]!==D||t[27]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":w,children:[D,O]}),t[25]=n.fromTemplate,t[26]=D,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==k||t[30]!==C?(A=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[C,k]}),t[29]=k,t[30]=C,t[31]=A):A=t[31];let j=A,M;t[32]!==n||t[33]!==m||t[34]!==g||t[35]!==r||t[36]!==c||t[37]!==a||t[38]!==v||t[39]!==u?(M=m.length===0?(0,Q.jsx)(`div`,{className:i(`text-center text-sm text-fg-muted`,u===`dialog`&&`flex h-full flex-col items-center justify-center px-4 py-12`),children:n.templatesEmptyHint}):v?(0,Q.jsx)(`div`,{className:`flex flex-col gap-6 pb-1`,children:g.map(e=>(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n.templateCategories[e.category]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:e.items.map(e=>(0,Q.jsx)(Dn,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:a,onSelectTemplate:c},e.templateId))})]},e.category))}):(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pb-1 sm:grid-cols-2 xl:grid-cols-3`,children:m.map(e=>(0,Q.jsx)(Dn,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:a,onSelectTemplate:c},e.templateId))}),t[32]=n,t[33]=m,t[34]=g,t[35]=r,t[36]=c,t[37]=a,t[38]=v,t[39]=u,t[40]=M):M=t[40];let N=M;if(u===`dialog`){let e;t[41]===N?e=t[42]:(e=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:N}),t[41]=N,t[42]=e);let n;return t[43]!==j||t[44]!==e?(n=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[j,e]}),t[43]=j,t[44]=e,t[45]=n):n=t[45],n}let P;return t[46]!==j||t[47]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[j,N]}),t[46]=j,t[47]=N,t[48]=P):P=t[48],P}function kn(e){let t=(0,Z.c)(49),{c:n,localeTag:r,scheduleBadgeLabels:a,loading:o,jobsCount:s,sortedJobs:c,templateCategoryFilter:l,onTemplateCategoryFilterChange:u,onSelectTemplate:d,keepAwake:f,wakeSupported:p,onWakeUnsupportedClick:m,onKeepAwakeToggle:h,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:v,onToggle:y,onEdit:b,onAddJob:x,onRunNow:S,onDelete:C}=e,w;t[0]===n.tabMyTasks?w=t[1]:(w=(0,Q.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),t[0]=n.tabMyTasks,t[1]=w);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=T):T=t[2];let E;t[3]===n.wakeBanner?E=t[4]:(E=(0,Q.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[T,(0,Q.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[3]=n.wakeBanner,t[4]=E);let D;t[5]===n.keepAwake?D=t[6]:(D=(0,Q.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[5]=n.keepAwake,t[6]=D);let O=!p,k=p?void 0:n.wakeLockUnavailable,A=f?`justify-end bg-accent`:`justify-start bg-surface-hover`,j=!p&&`cursor-not-allowed opacity-50`,M;t[7]!==A||t[8]!==j?(M=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,A,j),t[7]=A,t[8]=j,t[9]=M):M=t[9];let N;t[10]!==h||t[11]!==m||t[12]!==p?(N=()=>{p?h():m()},t[10]=h,t[11]=m,t[12]=p,t[13]=N):N=t[13];let P;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[14]=P):P=t[14];let F;t[15]!==f||t[16]!==N||t[17]!==O||t[18]!==k||t[19]!==M?(F=(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":f,disabled:O,title:k,className:M,onClick:N,children:P}),t[15]=f,t[16]=N,t[17]=O,t[18]=k,t[19]=M,t[20]=F):F=t[20];let I;t[21]!==F||t[22]!==D?(I=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[D,F]}),t[21]=F,t[22]=D,t[23]=I):I=t[23];let L;t[24]!==I||t[25]!==E?(L=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[E,I]}),t[24]=I,t[25]=E,t[26]=L):L=t[26];let R;t[27]!==g||t[28]!==n||t[29]!==s||t[30]!==o||t[31]!==r||t[32]!==x||t[33]!==C||t[34]!==b||t[35]!==v||t[36]!==S||t[37]!==d||t[38]!==u||t[39]!==y||t[40]!==_||t[41]!==a||t[42]!==c||t[43]!==l?(R=o&&s===0?(0,Q.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,Q.jsx)(se,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):s===0?(0,Q.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,Q.jsx)(`div`,{className:`w-full max-w-6xl`,children:(0,Q.jsx)(On,{cron:n,localeTag:r,scheduleBadgeLabels:a,categoryFilter:l,onCategoryFilterChange:u,onSelectTemplate:d})}),(0,Q.jsx)(`div`,{className:`flex justify-center`,children:(0,Q.jsx)(q,{type:`button`,variant:`primary`,onClick:x,children:n.emptyStateCta})})]}):(0,Q.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,Q.jsx)(_n,{job:e,c:n,localeTag:r,scheduleBadgeLabels:a,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:e=>void v(e),onToggle:(e,t)=>void y(e,t),onEdit:b,onRunNow:S,onDelete:C},e.id))}),t[27]=g,t[28]=n,t[29]=s,t[30]=o,t[31]=r,t[32]=x,t[33]=C,t[34]=b,t[35]=v,t[36]=S,t[37]=d,t[38]=u,t[39]=y,t[40]=_,t[41]=a,t[42]=c,t[43]=l,t[44]=R):R=t[44];let z;return t[45]!==w||t[46]!==L||t[47]!==R?(z=(0,Q.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[w,L,R]}),t[45]=w,t[46]=L,t[47]=R,t[48]=z):z=t[48],z}function An(e){let t=(0,Z.c)(29),{open:n,onOpenChange:r,c:a,localeTag:o,scheduleBadgeLabels:s,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=i(`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`,ve.focusRingPanel),t[1]=f):f=t[1];let p;t[2]===a.fromTemplate?p=t[3]:(p=(0,Q.jsx)(m,{className:`text-lg font-semibold text-fg`,children:a.fromTemplate}),t[2]=a.fromTemplate,t[3]=p);let h;t[4]===a.templatePickerHint?h=t[5]:(h=(0,Q.jsx)(R,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.templatePickerHint}),t[4]=a.templatePickerHint,t[5]=h);let g;t[6]!==p||t[7]!==h?(g=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,h]}),t[6]=p,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=_):_=t[9];let v;t[10]===a.close?v=t[11]:(v=(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:_})}),t[10]=a.close,t[11]=v);let y;t[12]!==g||t[13]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge-subtle px-6 py-5`,children:[g,v]}),t[12]=g,t[13]=v,t[14]=y):y=t[14];let b;t[15]!==a||t[16]!==c||t[17]!==o||t[18]!==l||t[19]!==u||t[20]!==s?(b=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-6 py-5`,children:(0,Q.jsx)(On,{variant:`dialog`,cron:a,localeTag:o,scheduleBadgeLabels:s,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u})}),t[15]=a,t[16]=c,t[17]=o,t[18]=l,t[19]=u,t[20]=s,t[21]=b):b=t[21];let x;t[22]!==y||t[23]!==b?(x=(0,Q.jsxs)(z,{children:[d,(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,Q.jsxs)(E,{className:f,onOpenAutoFocus:jn,children:[y,b]})})]}),t[22]=y,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==r||t[26]!==n||t[27]!==x?(S=(0,Q.jsx)(M,{open:n,onOpenChange:r,children:x}),t[25]=r,t[26]=n,t[27]=x,t[28]=S):S=t[28],S}function jn(e){return e.preventDefault()}function Mn(){return{formOpen:!1,formMode:`add`,formJobId:null,formName:``,formSchedule:Ve(_t),formChannel:`local`,formChatId:``,formMessage:``,formMessageMdMode:`edit`,formTaskKind:`message`,formWorkflowDefinitionId:``,formWorkflowGoal:``,formWorkflowArgValues:{},messageEditorNonce:0,formSessionTarget:`main`,formAgentId:``,formAgentLocalOnly:!1,formWorkingDirectory:``,formModel:``,formSubmitting:!1}}function Nn(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 Pn(e,t){let n=Mn();if(n.formOpen=!0,n.formMode=e?`edit`:`add`,n.formJobId=e?.id??null,!e)return n.formModel=t(),n;if(n.formName=e.name||``,n.formSchedule=e.schedule,n.formMessage=Fe(e)??``,e.payload.kind===`workflowRun`){n.formTaskKind=`workflowRun`,n.formWorkflowDefinitionId=e.payload.definitionId,n.formWorkflowGoal=e.payload.goal||``,n.formWorkflowArgValues=Xt(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===`isolated`?`isolated`:`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 r=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;n.formModel=e.model?.trim()||r||t();let i=e.delivery?.channel===`local`;return n.formAgentLocalOnly=(e.sessionTarget||`main`)===`isolated`&&!i&&(!e.delivery?.to||e.delivery.mode===`none`),i?(n.formChannel=`local`,n.formChatId=``):e.delivery&&e.delivery.mode!==`none`&&e.delivery.to?(n.formChannel=e.delivery.channel||`telegram`,n.formChatId=e.delivery.to||``):(n.formChannel=`telegram`,n.formChatId=``),n.formMessageMdMode=`edit`,n.messageEditorNonce=1,n}function Fn(e){let{m:t,defaultModelForForm:n,channels:r,chatAgents:i}=e,[a,o]=(0,X.useReducer)(Nn,void 0,Mn),s=(0,X.useRef)(!1),c=(0,X.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=D(()=>je(a.formChannel),[a.formChannel],{enabled:a.formOpen&&a.formChannel!==`local`,initial:[],errorData:[]}),u=a.formChannel===`local`?[]:l.data,d=(0,X.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()&&Zt(a.formWorkflowDefinitionId.trim(),a.formWorkflowArgValues):!!a.formMessage.trim(),h=a.formSchedule.kind===`cron`?!!a.formSchedule.expr.trim():a.formSchedule.kind===`at`?!!a.formSchedule.at.trim():Number.isFinite(a.formSchedule.everyMs)&&a.formSchedule.everyMs>0,g=!!a.formName.trim()&&h&&m&&(!f||!!a.formChatId.trim()),_=(0,X.useCallback)(e=>{s.current=!1,o({type:`replace`,state:Pn(e,n)})},[n]),v=(0,X.useCallback)(e=>{o({type:`setMessageMdMode`,mode:e})},[]),y=(0,X.useCallback)(e=>{let r=wn(e),i=r?xn(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:{...Mn(),formOpen:!0,formMode:`add`,formName:i.title,formSchedule:Ve(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]),b=(0,X.useCallback)(()=>{s.current=!1,o({type:`replace`,state:Mn()})},[]),x=(0,X.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})},[]),S=(0,X.useCallback)(e=>{o({type:`patch`,patch:{formChannel:e,formChatId:``,...e===`local`?{formAgentLocalOnly:!1}:{}}})},[]),C=(0,X.useCallback)(e=>{s.current=!0,o({type:`patch`,patch:{formModel:e}})},[]),w=(0,X.useCallback)(()=>{je(a.formChannel).then(l.setData)},[a.formChannel,l.setData]),T=(0,X.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=>T({formName:e}),setFormSchedule:e=>T({formSchedule:e}),setFormChatId:e=>T({formChatId:e}),setFormMessage:e=>T({formMessage:e}),setFormTaskKind:e=>T(e===`workflowRun`?{formTaskKind:e,formSessionTarget:`isolated`,formAgentLocalOnly:!1}:{formTaskKind:e}),setFormWorkflowDefinitionId:e=>T({formWorkflowDefinitionId:e,formWorkflowArgValues:{}}),setFormWorkflowGoal:e=>T({formWorkflowGoal:e}),setFormWorkflowArgValues:e=>T({formWorkflowArgValues:e}),setFormAgentId:e=>T({formAgentId:e}),setFormAgentLocalOnly:e=>T({formAgentLocalOnly:e}),setFormWorkingDirectory:e=>T({formWorkingDirectory:e}),setFormSubmitting:e=>T({formSubmitting:e}),canSubmit:g,needsDeliveryChat:f,showChannelPicker:p,cronAgentSelectOptions:d,openForm:_,closeForm:b,applyCronTemplate:y,setMessageMdMode:v,handleFormSessionTargetChange:x,handleFormChannelChange:S,handleFormModelUserChange:C,refreshRecipientsList:w}}function In(e){let{onUnavailable:t}=e,[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(null),a=(0,X.useRef)(`none`),o=(0,X.useRef)(n),s=typeof navigator<`u`&&`wakeLock`in navigator,c=s||ae(),l=(0,X.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,X.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,X.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 Ln(e){let{hasToken:t,failMessages:n,isHistoryTab:r}=e,[i,a]=(0,X.useState)([]),[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)([]),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)([]),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)([]),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),w=(0,X.useCallback)(async()=>{x(!0),C(null);try{a(await Me())}catch(e){C(e instanceof Error?e.message:n.failedToLoadJobs)}finally{x(!1)}},[n.failedToLoadJobs]),T=(0,X.useCallback)(async()=>{try{let[e,t,n,r,i]=await Promise.all([ze(),We(),He(),he(),V().catch(()=>null)]);s(e),l(t),d(n.model||``),h(r.payload?.config??null),i&&p(i.items)}catch{}},[]),E=(0,X.useCallback)(async()=>{y(!0);try{_(await Oe(400))}catch{}finally{y(!1)}},[]);return(0,X.useEffect)(()=>{t&&(w(),T())},[t,w,T]),(0,X.useEffect)(()=>{if(!t)return;let e=()=>{he().then(e=>{h(e.payload?.config??null)})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[t]),(0,X.useEffect)(()=>{!t||!r||E()},[t,r,E]),{jobs:i,channels:o,availableModels:c,defaultModel:u,chatAgents:f,gatewayConfigRaw:m,runHistory:g,runHistoryLoading:v,loading:b,error:S,setError:C,userCronJobs:(0,X.useMemo)(()=>i.filter(e=>!Ye(e)),[i]),systemCronJobs:(0,X.useMemo)(()=>i.filter(e=>Ye(e)),[i]),heartbeatFromConfig:(0,X.useMemo)(()=>Qe(m),[m]),loadJobs:w,loadAux:T,loadRunHistoryOnly:E,refreshAll:(0,X.useCallback)(()=>{w(),T(),E()},[w,T,E])}}function Rn(e,t){let n=[...e];return n.sort((e,n)=>{let r=e.createdAtMs,i=n.createdAtMs;return t===`created_desc`?i-r:r-i}),n}function zn(e,t,n,r){let i=new Date,a=t===`day`?vt(i):t===`week`?yt(i):bt(i);return e.filter(e=>!(new Date(e.startedAt)<a||n&&e.jobId!==n||r&&e.status!==r))}var Bn={mainTab:`myTasks`,jobSort:`created_desc`,historyRange:`day`,historyJobFilter:``,historyStatusFilter:``,detailOpen:!1,detailJob:null,detailHistory:[],detailLoading:!1,detailActionNotice:null,confirmOpen:!1,templatePickerOpen:!1,templateCategoryFilter:`all`};function Vn(){let e=o(e=>e.language),t=a(e),n=t.cron,r=t.chat,i=c(e=>e.token),l=!!i,u=s(e=>e.resolved)===`dark`,d=e===`zh`?`zh-CN`:`en-US`,[f,m]=y(),[g,_]=(0,X.useReducer)(h,f,e=>({...Bn,mainTab:Dt(e.get(`tab`))})),{mainTab:v,jobSort:b,historyRange:x,historyJobFilter:S,historyStatusFilter:C,detailOpen:w,detailJob:T,detailHistory:E,detailLoading:D,detailActionNotice:O,confirmOpen:k,templatePickerOpen:A,templateCategoryFilter:j}=g,M=Dt(f.get(`tab`));(0,X.useEffect)(()=>{M!==v&&_({type:`patch`,patch:{mainTab:M}})},[M,v]);let N=(0,X.useCallback)(e=>{_({type:`patch`,patch:{mainTab:e}}),m(t=>{let n=new URLSearchParams(t),r=Ot(e);return r?n.set(`tab`,r):n.delete(`tab`),n},{replace:!0})},[m]),P=Ln({hasToken:l,failMessages:{failedToLoadJobs:n.failedToLoadJobs},isHistoryTab:v===`history`}),{setError:F}=P,I=In({onUnavailable:()=>F(n.wakeLockUnavailable)}),L=(0,X.useCallback)(()=>P.defaultModel||(P.availableModels.length>0?P.availableModels[0].id:``),[P.defaultModel,P.availableModels]),R=Fn({m:t,defaultModelForForm:L,channels:P.channels,chatAgents:P.chatAgents}),z=p(l&&R.formOpen?[`workflow-definitions-cron`,i]:null,re,{revalidateOnFocus:!1}),B=z.data??[],V=(0,X.useRef)(null),H=(0,X.useRef)(null),U=(0,X.useCallback)((e,t)=>{V.current=e,H.current=t,_({type:`patch`,patch:{confirmOpen:!0}})},[]),W=(0,X.useCallback)(()=>{_({type:`patch`,patch:{confirmOpen:!1}}),H.current=null,V.current=null},[]),G=(0,X.useRef)(null),ee=(0,X.useCallback)(e=>{G.current=e,window.setTimeout(()=>{G.current===e&&(G.current=null)},400)},[]),K=(0,X.useCallback)(e=>{R.applyCronTemplate(e)&&_({type:`patch`,patch:{templatePickerOpen:!1}})},[R]),te=async()=>{if(!R.formName.trim()){F(n.nameRequired);return}if(R.formSchedule.kind===`cron`&&!R.formSchedule.expr.trim()||R.formSchedule.kind===`at`&&!R.formSchedule.at.trim()||R.formSchedule.kind===`every`&&(!Number.isFinite(R.formSchedule.everyMs)||R.formSchedule.everyMs<=0)){F(n.scheduleRequired);return}if(R.formTaskKind===`message`&&!R.formMessage.trim()){F(n.scheduleRequired);return}if(R.formTaskKind===`workflowRun`&&!R.formWorkflowDefinitionId.trim()){F(n.workflowDefinitionRequired);return}if(R.formTaskKind===`workflowRun`&&!Zt(R.formWorkflowDefinitionId.trim(),R.formWorkflowArgValues)){F(n.workflowArgsRequired);return}if(R.needsDeliveryChat&&!R.formChatId.trim()){F(n.chatIdRequired);return}R.setFormSubmitting(!0),F(null);try{let e=R.formMessage.trim(),t=R.formModel.trim(),n=R.formAgentId.trim().toLowerCase(),r=R.formWorkingDirectory.trim(),i=R.formTaskKind===`workflowRun`,a=R.formTaskKind===`message`&&R.formSessionTarget===`isolated`,o=i?`isolated`:R.formSessionTarget,s;s=i?R.formAgentLocalOnly?{mode:`none`}:R.formChannel===`local`?{mode:`announce`,channel:`local`}:{mode:`announce`,channel:R.formChannel,to:R.formChatId.trim()}:R.formSessionTarget===`isolated`&&R.formAgentLocalOnly?{mode:`none`}:R.formChannel===`local`?{mode:`announce`,channel:`local`}:{mode:`announce`,channel:R.formChannel,to:R.formChatId.trim()};let c;if(i){let e=R.formWorkflowDefinitionId.trim(),t=tt(R.formWorkflowArgValues);c={kind:`workflowRun`,definitionId:e,...t===void 0?{}:{inputEnvelope:{payload:t}},...R.formWorkflowGoal.trim()?{goal:R.formWorkflowGoal.trim()}:{},...n?{agentId:n}:{}}}else c=a?{kind:`agentTurn`,message:e,...t?{model:t}:{}}:{kind:`systemEvent`,text:e};let l=o===`main`?null:n||null,u={name:R.formName.trim(),schedule:R.formSchedule,sessionTarget:o,delivery:s,payload:c,...R.formMode===`edit`?{...l?{agentId:l}:{},...a&&r?{workingDirectory:r}:{}}:{...o===`isolated`&&n?{agentId:n}:{},...a&&r?{workingDirectory:r}:{}}};if(R.formMode===`edit`&&R.formJobId)await Ne(R.formJobId,u);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=u;await Re(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}R.closeForm(),await P.loadJobs()}catch(e){F(e instanceof Error?e.message:R.formMode===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{R.setFormSubmitting(!1)}},ne=async e=>{_({type:`patch`,patch:{detailOpen:!0,detailJob:e,detailLoading:!0,detailHistory:[],detailActionNotice:null}});try{let t=await Ie(e.id);t&&_({type:`patch`,patch:{detailJob:t,detailHistory:await Ae(e.id,20)}})}catch{}finally{_({type:`patch`,patch:{detailLoading:!1}})}},q=(0,X.useCallback)(()=>{_({type:`patch`,patch:{detailOpen:!1,detailJob:null,detailActionNotice:null}})},[]),ie=(0,X.useCallback)(()=>{_({type:`patch`,patch:{templateCategoryFilter:`all`,templatePickerOpen:!0}})},[]),ae=async(e,t)=>{try{await Pe(e.id,t),T?.id===e.id&&_({type:`patch`,patch:{detailJob:{...T,enabled:t}}}),await Promise.all([P.loadJobs(),P.loadAux()])}catch(e){F(e instanceof Error?e.message:n.failedToToggleJob)}},oe=async()=>{let e=H.current,t=V.current;if(!(!e||!t)){W();try{if(t===`run`){let t=await Le(e);T?.id===e&&_({type:`patch`,patch:{detailJob:t.job??await Ie(e),detailHistory:t.history??await Ae(e,20),detailActionNotice:{kind:`info`,message:n.runStarted}}})}else await Be(e),T?.id===e&&_({type:`patch`,patch:{detailOpen:!1,detailJob:null}});await Promise.all([P.loadJobs(),P.loadAux(),P.loadRunHistoryOnly()])}catch(r){let i=r instanceof Error?r.message:n.actionFailed;if(t===`run`&&T?.id===e){let t=await Ie(e).catch(()=>null),a=await Ae(e,20).catch(()=>E),o=r instanceof Ue&&r.code===`job_already_running`?r.runningSessionKey||t?.state?.runningSessionKey||a.find(e=>e.status===`running`)?.sessionKey:t?.state?.runningSessionKey||a.find(e=>e.status===`running`)?.sessionKey;_({type:`patch`,patch:{...t?{detailJob:t}:{},detailHistory:a,detailActionNotice:{kind:`error`,message:i.includes(`already running`)?n.jobAlreadyRunning:i,...o?{sessionKey:o}:{}}}})}else F(i)}}};(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(R.formOpen?R.closeForm():w&&_({type:`patch`,patch:{detailOpen:!1,detailJob:null}}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[R,w]);let se=(0,X.useMemo)(()=>({running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled}),[n.execStatusCancelled,n.execStatusFailed,n.execStatusRunning,n.execStatusSuccess]),ce=(0,X.useMemo)(()=>Rn(P.userCronJobs,b),[P.userCronJobs,b]),le=(0,X.useMemo)(()=>Rn(P.systemCronJobs,b),[P.systemCronJobs,b]),ue=(0,X.useMemo)(()=>zn(P.runHistory,x,S,C),[P.runHistory,x,S,C]),de=n.scheduleBadge;return l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Hn,{hasToken:l,c:n,loading:P.loading,runHistoryLoading:P.runHistoryLoading,onRefresh:P.refreshAll,onOpenTemplatePicker:ie,onAddJob:()=>R.openForm()}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[P.error?(0,Q.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:P.error}):null,(0,Q.jsx)(pn,{c:n,mainTab:v,onMainTabChange:N,jobSort:b,onJobSortChange:e=>_({type:`patch`,patch:{jobSort:e}}),historyRange:x,onHistoryRangeChange:e=>_({type:`patch`,patch:{historyRange:e}}),historyJobFilter:S,onHistoryJobFilterChange:e=>_({type:`patch`,patch:{historyJobFilter:e}}),historyStatusFilter:C,onHistoryStatusFilterChange:e=>_({type:`patch`,patch:{historyStatusFilter:e}}),jobs:P.jobs}),v===`myTasks`?(0,Q.jsx)(kn,{c:n,localeTag:d,scheduleBadgeLabels:de,loading:P.loading,jobsCount:P.userCronJobs.length,sortedJobs:ce,templateCategoryFilter:j,onTemplateCategoryFilterChange:e=>_({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K,keepAwake:I.keepAwake,wakeSupported:I.featureAvailable,onWakeUnsupportedClick:()=>F(n.wakeLockUnavailable),onKeepAwakeToggle:()=>I.setKeepAwake(e=>!e),absorbCardClickJobIdRef:G,scheduleAbsorbNextMenuCardClick:ee,onOpenDetail:e=>void ne(e),onToggle:(e,t)=>void ae(e,t),onEdit:e=>R.openForm(e),onAddJob:()=>R.openForm(),onRunNow:e=>U(`run`,e.id),onDelete:e=>U(`delete`,e.id)}):v===`systemTasks`?(0,Q.jsx)(bn,{c:n,language:e,localeTag:d,scheduleBadgeLabels:de,loading:P.loading,sortedSystemJobs:le,heartbeat:P.heartbeatFromConfig,keepAwake:I.keepAwake,wakeSupported:I.featureAvailable,onWakeUnsupportedClick:()=>F(n.wakeLockUnavailable),onKeepAwakeToggle:()=>I.setKeepAwake(e=>!e),absorbCardClickJobIdRef:G,scheduleAbsorbNextMenuCardClick:ee,onOpenDetail:e=>void ne(e),onToggle:(e,t)=>void ae(e,t),onEdit:e=>R.openForm(e),onRunNow:e=>U(`run`,e.id),onDelete:e=>U(`delete`,e.id)}):v===`history`?(0,Q.jsx)(gn,{c:n,runHistoryLoading:P.runHistoryLoading,runHistory:P.runHistory,filteredRunHistory:ue,jobs:P.jobs,onRefreshHistory:()=>void P.loadRunHistoryOnly(),onOpenJobDetail:e=>void ne(e),statusLabels:se}):(0,Q.jsx)(ht,{hasToken:l})]}),(0,Q.jsx)(on,{open:R.formOpen,onRequestClose:R.closeForm,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:u,channels:P.channels,sessionChatIds:R.sessionChatIds,cronAgentSelectOptions:R.cronAgentSelectOptions,defaultModelResolver:L,formMode:R.formMode,formJobId:R.formJobId,formName:R.formName,onFormNameChange:R.setFormName,formSchedule:R.formSchedule,onFormScheduleChange:R.setFormSchedule,formSubmitting:R.formSubmitting,formTaskKind:R.formTaskKind,onFormTaskKindChange:R.setFormTaskKind,workflowDefinitions:B,workflowDefinitionsLoading:z.isLoading,formWorkflowDefinitionId:R.formWorkflowDefinitionId,onFormWorkflowDefinitionIdChange:R.setFormWorkflowDefinitionId,formWorkflowGoal:R.formWorkflowGoal,onFormWorkflowGoalChange:R.setFormWorkflowGoal,formWorkflowArgValues:R.formWorkflowArgValues,onFormWorkflowArgValuesChange:R.setFormWorkflowArgValues,formSessionTarget:R.formSessionTarget,onFormSessionTargetChange:R.handleFormSessionTargetChange,formAgentLocalOnly:R.formAgentLocalOnly,onFormAgentLocalOnlyChange:R.setFormAgentLocalOnly,formModel:R.formModel,onFormModelUserChange:R.handleFormModelUserChange,formAgentId:R.formAgentId,onFormAgentIdChange:R.setFormAgentId,formWorkingDirectory:R.formWorkingDirectory,onFormWorkingDirectoryChange:R.setFormWorkingDirectory,formChannel:R.formChannel,onFormChannelChange:R.handleFormChannelChange,formChatId:R.formChatId,onFormChatIdChange:R.setFormChatId,formMessage:R.formMessage,onFormMessageChange:R.setFormMessage,formMessageMdMode:R.formMessageMdMode,onSetMessageMdMode:R.setMessageMdMode,messageEditorNonce:R.messageEditorNonce,needsDeliveryChat:R.needsDeliveryChat,showChannelPicker:R.showChannelPicker,canSubmit:R.canSubmit,onSubmit:()=>void te(),onRefreshRecipients:R.refreshRecipientsList}),(0,Q.jsx)(An,{open:A,onOpenChange:e=>{_({type:`patch`,patch:{templatePickerOpen:e,...e?{templateCategoryFilter:`all`}:{}}})},c:n,localeTag:d,scheduleBadgeLabels:de,categoryFilter:j,onCategoryFilterChange:e=>_({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:K}),(0,Q.jsx)(Lt,{open:w,onDismiss:q,detailJob:T,detailLoading:D,actionNotice:O,detailHistory:E,c:n,localeTag:d,scheduleBadgeLabels:de,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:se,onEdit:e=>{R.openForm(e),window.requestAnimationFrame(()=>q())},onRunNow:e=>U(`run`,e.id),onToggle:(e,t)=>void ae(e,t),onDelete:e=>U(`delete`,e.id)}),(0,Q.jsx)(st,{open:k,onOpenChange:e=>_({type:`patch`,patch:{confirmOpen:e}}),action:V.current,c:n,onDismiss:W,onConfirm:oe})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Hn,{hasToken:l,c:n,loading:P.loading,runHistoryLoading:P.runHistoryLoading,onRefresh:P.refreshAll,onOpenTemplatePicker:ie,onAddJob:()=>R.openForm()}),(0,Q.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 Hn(e){let t=(0,Z.c)(14),{hasToken:n,c:r,loading:i,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}=e,l=ee(Wn),u=ee(Un),d;t[0]!==r||t[1]!==i||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==a?(d=(0,Q.jsx)(hn,{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,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.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,X.useLayoutEffect)(p,m),null}function Un(e){return e.clearPageHeader}function Wn(e){return e.setPageHeader}export{Vn as CronPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-BUUfPaZ9.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{c as s,i as c,n as l}from"./fetch-DOe56Wmy.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{B as d,Ds as f,Hi as p,Ji as m,Ka as h,Mi as g,Oa as _,Ra as v,ba as y,br as b,ga as x,ki as S,qa as C,ra as w,ua as T,wi as E,xi as D,xs as O,yr as k}from"./index-BTmbp2AU.js";import{n as ee,t as A}from"./settings-form-section-Bv8MZplG.js";import{t as j}from"./format-cron-label-BsotZDO5.js";import{t as M}from"./schedule-field-BLWLKqgw.js";import{t as N}from"./format-interval-label-tsMSvBSR.js";var P=e(t(),1),F=n();function te(){return c(`/api/dreaming`)}async function ne(){let e=await l(te());if(!e.payload)throw Error(`Missing payload`);return e.payload}async function re(e){await l(c(`/api/dreaming/action`),{method:`POST`,body:JSON.stringify({action:e})})}async function ie(e=`deep`){let t=await l(c(`/api/dreaming/run`),{method:`POST`,body:JSON.stringify({phase:e})}),n=!!t.payload?.triggered,r=typeof t.payload?.jobId==`string`?t.payload.jobId:``;if(!n||!r)throw Error(`Failed to trigger`);return{triggered:n,jobId:r,phase:e}}async function I(e){let t=await l(c(`/api/dreaming/preview${typeof e==`number`&&Number.isFinite(e)?`?limit=${encodeURIComponent(String(e))}`:``}`));if(!t.payload)throw Error(`Missing payload`);return t.payload}async function ae(e=50){return(await l(c(`/api/dreaming/events${`?limit=${encodeURIComponent(String(e))}`}`))).payload?.events??[]}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var R={enabled:!0,cron:`0 */6 * * *`,lookbackDays:1,limit:50,dedupeSimilarity:.85},z={enabled:!0,cron:`0 3 * * *`,minScore:.8,minRecallCount:3,limit:10,recencyHalfLifeDays:14,maxAgeDays:30},B={enabled:!0,cron:`0 5 * * 0`,lookbackDays:7,limit:20,minPatternStrength:.6},V={enabled:!1,frequency:`0 3 * * *`,timezone:``,deepEnabled:!0,minScore:.8,minRecallCount:3,limit:10,light:R,deep:z,rem:B};function H(e,t){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):t}function U(e,t){let n=typeof e==`string`?Number(e):e;return Number.isFinite(n)?Math.max(0,Math.floor(n)):t}function W(e,t){let n=typeof e==`string`?Number(e):e;return Number.isFinite(n)?n:t}function oe(e){let t=L(e)?e:{},n=L(t.agents)?t.agents:{},r=L(n.defaults)?n.defaults:{},i=L(r.memory)?r.memory:{},a=L(i.dreaming)?i.dreaming:{},o=L(a.phases)?a.phases:{},s=L(o.light)?o.light:{},c=L(o.deep)?o.deep:{},l=L(o.rem)?o.rem:{};return{enabled:a.enabled===!0,frequency:typeof a.frequency==`string`&&a.frequency.trim()?a.frequency.trim():V.frequency,timezone:typeof a.timezone==`string`?a.timezone:``,deepEnabled:c.enabled!==!1,minScore:H(typeof c.minScore==`number`?c.minScore:Number(c.minScore),V.minScore),minRecallCount:Math.max(1,U(c.minRecallCount,V.minRecallCount)),limit:U(c.limit,V.limit),light:{enabled:s.enabled!==!1,cron:typeof s.cron==`string`&&s.cron.trim()?s.cron.trim():R.cron,lookbackDays:Math.max(1,U(s.lookbackDays,R.lookbackDays)),limit:U(s.limit,R.limit),dedupeSimilarity:H(W(s.dedupeSimilarity,R.dedupeSimilarity),R.dedupeSimilarity)},deep:{enabled:c.enabled!==!1,cron:typeof c.cron==`string`&&c.cron.trim()?c.cron.trim():z.cron,minScore:H(W(c.minScore,z.minScore),z.minScore),minRecallCount:Math.max(1,U(c.minRecallCount,z.minRecallCount)),limit:U(c.limit,z.limit),recencyHalfLifeDays:Math.max(1,W(c.recencyHalfLifeDays,z.recencyHalfLifeDays)),maxAgeDays:Math.max(1,W(c.maxAgeDays,z.maxAgeDays))},rem:{enabled:l.enabled!==!1,cron:typeof l.cron==`string`&&l.cron.trim()?l.cron.trim():B.cron,lookbackDays:Math.max(1,U(l.lookbackDays,B.lookbackDays)),limit:U(l.limit,B.limit),minPatternStrength:H(W(l.minPatternStrength,B.minPatternStrength),B.minPatternStrength)}}}async function se(e){let t=e.frequency.trim(),n=e.timezone.trim();await l(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({agents:{defaults:{memory:{dreaming:{enabled:!!e.enabled,frequency:t||null,timezone:n||null,phases:{light:{enabled:!!e.light.enabled,cron:e.light.cron.trim()||null,lookbackDays:Math.max(1,Math.floor(e.light.lookbackDays)),limit:Math.max(0,Math.floor(e.light.limit)),dedupeSimilarity:H(e.light.dedupeSimilarity,R.dedupeSimilarity)},deep:{enabled:!!e.deep.enabled,cron:e.deep.cron.trim()||null,minScore:H(e.deep.minScore,z.minScore),minRecallCount:Math.max(1,Math.floor(e.deep.minRecallCount)),limit:Math.max(0,Math.floor(e.deep.limit)),recencyHalfLifeDays:Math.max(1,e.deep.recencyHalfLifeDays),maxAgeDays:Math.max(1,e.deep.maxAgeDays)},rem:{enabled:!!e.rem.enabled,cron:e.rem.cron.trim()||null,lookbackDays:Math.max(1,Math.floor(e.rem.lookbackDays)),limit:Math.max(0,Math.floor(e.rem.limit)),minPatternStrength:H(e.rem.minPatternStrength,B.minPatternStrength)}}}}}}})}),k()}var G=`p-4 sm:px-5`,ce=`mb-3`,K=`rounded-xl border border-edge-subtle bg-surface-panel/30 p-3 sm:p-4`,q=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,E);function le(e){return e?e.replace(`T`,` `).replace(`Z`,``):`—`}function ue(e){return e===void 0||!Number.isFinite(e)||e<0?`—`:e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(2)} s`}function de(e,t){return e.locked?{text:t.lockValueLocked,className:`text-amber-600 dark:text-amber-400`}:{text:t.lockValueUnlocked,className:`text-emerald-600 dark:text-emerald-400`}}var J=r(),Y=`text-xs font-medium text-fg-muted`,X=`text-sm font-medium text-fg`;function Z(e){let t=(0,F.c)(6),{label:n,children:r,className:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(`span`,{className:Y,children:n}),t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,J.jsxs)(`div`,{className:i,children:[a,r]}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function Q(e){let t=(0,F.c)(11),{label:n,children:r,className:a}=e,o;t[0]===a?o=t[1]:(o=i(`min-w-0`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,J.jsx)(`dt`,{className:Y,children:n}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=i(X,`mt-0.5`),t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,J.jsx)(`dd`,{className:c,children:r}),t[5]=r,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==l?(u=(0,J.jsxs)(`div`,{className:o,children:[s,l]}),t[7]=o,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function $(e){let t=(0,F.c)(5),{label:n,className:r}=e,a;t[0]===r?a=t[1]:(a=i(`text-[0.7rem] font-semibold uppercase tracking-wider text-fg-muted`,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,J.jsx)(`h3`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function fe(e){let t=(0,F.c)(38),{icon:n,title:r,hint:i,enabled:a,onEnabledChange:o,cron:s,onCronChange:c,scheduleLabels:l,disabled:u,onLabel:d,offLabel:f,cronLabel:p,children:m}=e,h;t[0]===n?h=t[1]:(h=(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:n}),t[0]=n,t[1]=h);let g;t[2]===r?g=t[3]:(g=(0,J.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=g);let _;t[4]===i?_=t[5]:(_=(0,J.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-fg-muted`,children:i}),t[4]=i,t[5]=_);let v;t[6]!==g||t[7]!==_?(v=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]!==h||t[10]!==v?(y=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[h,v]}),t[9]=h,t[10]=v,t[11]=y):y=t[11];let b;t[12]===o?b=t[13]:(b=e=>o(e.target.checked),t[12]=o,t[13]=b);let x;t[14]!==u||t[15]!==a||t[16]!==b?(x=(0,J.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:a,disabled:u,onChange:b}),t[14]=u,t[15]=a,t[16]=b,t[17]=x):x=t[17];let S=a?d:f,C;t[18]===S?C=t[19]:(C=(0,J.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==x||t[21]!==C?(w=(0,J.jsxs)(`label`,{className:`inline-flex shrink-0 items-center gap-2 text-xs text-fg`,children:[x,C]}),t[20]=x,t[21]=C,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==y?(T=(0,J.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-start justify-between gap-2 border-b border-edge-subtle/80 pb-2.5`,children:[y,w]}),t[23]=w,t[24]=y,t[25]=T):T=t[25];let E;t[26]!==s||t[27]!==p||t[28]!==u||t[29]!==c||t[30]!==l?(E=(0,J.jsx)(M,{kind:`cron`,className:`mb-2.5`,label:p,value:s,onChange:c,labels:l,disabled:u}),t[26]=s,t[27]=p,t[28]=u,t[29]=c,t[30]=l,t[31]=E):E=t[31];let D;t[32]===m?D=t[33]:(D=(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4`,children:m}),t[32]=m,t[33]=D);let O;return t[34]!==T||t[35]!==E||t[36]!==D?(O=(0,J.jsxs)(`div`,{className:K,children:[T,E,D]}),t[34]=T,t[35]=E,t[36]=D,t[37]=O):O=t[37],O}function pe(e){let t=(0,F.c)(23),{icon:n,label:r,enabled:a,cron:o,scheduleSummary:s,details:c,t:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(K,`space-y-1`),t[0]=u):u=t[0];let d;t[1]===r?d=t[2]:(d=(0,J.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r}),t[1]=r,t[2]=d);let f=a?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`,p;t[3]===f?p=t[4]:(p=i(`ml-auto text-xs font-medium`,f),t[3]=f,t[4]=p);let m=a?l.on:l.off,h;t[5]!==p||t[6]!==m?(h=(0,J.jsx)(`span`,{className:p,children:m}),t[5]=p,t[6]=m,t[7]=h):h=t[7];let g;t[8]!==n||t[9]!==d||t[10]!==h?(g=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n,d,h]}),t[8]=n,t[9]=d,t[10]=h,t[11]=g):g=t[11];let _;t[12]===s?_=t[13]:(_=(0,J.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s}),t[12]=s,t[13]=_);let v;t[14]===o?v=t[15]:(v=(0,J.jsx)(`p`,{className:`truncate font-mono text-[0.65rem] text-fg-subtle`,title:o,children:o}),t[14]=o,t[15]=v);let y;t[16]===c?y=t[17]:(y=(0,J.jsx)(`p`,{className:`text-[0.65rem] leading-snug text-fg-muted`,children:c}),t[16]=c,t[17]=y);let b;return t[18]!==y||t[19]!==g||t[20]!==_||t[21]!==v?(b=(0,J.jsxs)(`div`,{className:u,children:[g,_,v,y]}),t[18]=y,t[19]=g,t[20]=_,t[21]=v,t[22]=b):b=t[22],b}function me(e){let t=(0,F.c)(9),{label:n,lastRun:r,t:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)($,{label:n,className:`mb-2`}),t[0]=n,t[1]=a);let o;t[2]!==r||t[3]!==i.lastRunRaw||t[4]!==i.phaseLastRunEmpty?(o=r?.exists?(0,J.jsxs)(`details`,{className:`group rounded-lg border border-edge-subtle`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer list-none px-2.5 py-1.5 text-xs font-medium text-fg-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:(0,J.jsx)(`span`,{className:`underline decoration-edge underline-offset-2 group-open:text-fg`,children:i.lastRunRaw})}),(0,J.jsx)(`pre`,{className:`max-h-40 overflow-auto border-t border-edge-subtle p-2.5 text-xs text-fg-muted`,children:JSON.stringify(r.raw,null,2)})]}):(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.phaseLastRunEmpty}),t[2]=r,t[3]=i.lastRunRaw,t[4]=i.phaseLastRunEmpty,t[5]=o):o=t[5];let s;return t[6]!==a||t[7]!==o?(s=(0,J.jsxs)(`div`,{className:`border-t border-edge-subtle/80 pt-3`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function he(e){let t=(0,F.c)(39),{t:n,r}=e,i=r.deep?.skipped,a=r.ok?`text-emerald-600 dark:text-emerald-400`:`text-amber-600 dark:text-amber-400`,o=r.ok?n.lastRunSuccess:n.lastRunFailure,s;t[0]!==a||t[1]!==o?(s=(0,J.jsx)(`span`,{className:a,children:o}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c;t[3]!==n.lastRunStatus||t[4]!==s?(c=(0,J.jsx)(Q,{label:n.lastRunStatus,children:s}),t[3]=n.lastRunStatus,t[4]=s,t[5]=c):c=t[5];let l=n.lastRunDuration,u;t[6]===r.durationMs?u=t[7]:(u=ue(r.durationMs),t[6]=r.durationMs,t[7]=u);let d;t[8]!==n.lastRunDuration||t[9]!==u?(d=(0,J.jsx)(Q,{label:l,children:u}),t[8]=n.lastRunDuration,t[9]=u,t[10]=d):d=t[10];let f=n.lastRunRanked,p=String(r.deep?.candidatesRanked??`—`),m;t[11]!==n.lastRunRanked||t[12]!==p?(m=(0,J.jsx)(Q,{label:f,children:p}),t[11]=n.lastRunRanked,t[12]=p,t[13]=m):m=t[13];let h=n.lastRunApplied,g=String(r.deep?.applied??`—`),_;t[14]!==n.lastRunApplied||t[15]!==g?(_=(0,J.jsx)(Q,{label:h,children:g}),t[14]=n.lastRunApplied,t[15]=g,t[16]=_):_=t[16];let v;t[17]===r.reason?v=t[18]:(v=(0,J.jsx)(`span`,{className:`block text-pretty`,children:r.reason}),t[17]=r.reason,t[18]=v);let y;t[19]!==r.errorMessage||t[20]!==n.lastRunError?(y=r.errorMessage?(0,J.jsx)(`span`,{className:`mt-1 block text-xs text-amber-600 dark:text-amber-400`,children:`${n.lastRunError}: ${r.errorMessage}`}):null,t[19]=r.errorMessage,t[20]=n.lastRunError,t[21]=y):y=t[21];let b;t[22]!==n.lastRunReason||t[23]!==v||t[24]!==y?(b=(0,J.jsxs)(Q,{label:n.lastRunReason,className:`col-span-2 sm:col-span-3 lg:col-span-4`,children:[v,y]}),t[22]=n.lastRunReason,t[23]=v,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==i||t[27]!==n.lastRunSkipContaminated||t[28]!==n.lastRunSkipHash||t[29]!==n.lastRunSkipKey||t[30]!==n.lastRunSkipRehydrate?(x=i?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:n.lastRunSkipKey,children:String(i.alreadyPromotedKey)}),(0,J.jsx)(Q,{label:n.lastRunSkipRehydrate,children:String(i.rehydrateFailed)}),(0,J.jsx)(Q,{label:n.lastRunSkipContaminated,children:String(i.contaminated)}),(0,J.jsx)(Q,{label:n.lastRunSkipHash,children:String(i.hashDuplicate)})]}):null,t[26]=i,t[27]=n.lastRunSkipContaminated,t[28]=n.lastRunSkipHash,t[29]=n.lastRunSkipKey,t[30]=n.lastRunSkipRehydrate,t[31]=x):x=t[31];let S;return t[32]!==m||t[33]!==_||t[34]!==b||t[35]!==x||t[36]!==c||t[37]!==d?(S=(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3 lg:grid-cols-4`,children:[c,d,m,_,b,x]}),t[32]=m,t[33]=_,t[34]=b,t[35]=x,t[36]=c,t[37]=d,t[38]=S):S=t[38],S}function ge(e){let t=(0,F.c)(58),{t:n,schedulePickerLabels:r,hasToken:a,cfgForm:o,cfgBaseline:s,cfgSaving:c,cfgDirty:l,setCfgForm:u,setCfgOk:d,setCfgError:f,saveConfig:p}=e,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=i(`min-w-0`,G),t[0]=h):h=t[0];let g=!a||!o||c||!l,_;t[1]===p?_=t[2]:(_=()=>void p(),t[1]=p,t[2]=_);let y;t[3]===c?y=t[4]:(y=c?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,t[3]=c,t[4]=y);let b;t[5]!==n.saveConfig||t[6]!==g||t[7]!==_||t[8]!==y?(b=(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:g,onClick:_,children:[y,n.saveConfig]}),t[5]=n.saveConfig,t[6]=g,t[7]=_,t[8]=y,t[9]=b):b=t[9];let x=!a||!o||c||!l,E;t[10]!==s||t[11]!==f||t[12]!==u||t[13]!==d?(E=()=>{d(!1),f(null),u(s)},t[10]=s,t[11]=f,t[12]=u,t[13]=d,t[14]=E):E=t[14];let D;t[15]!==n.resetConfig||t[16]!==x||t[17]!==E?(D=(0,J.jsx)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:x,onClick:E,children:n.resetConfig}),t[15]=n.resetConfig,t[16]=x,t[17]=E,t[18]=D):D=t[18];let O;t[19]!==b||t[20]!==D?(O=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,D]}),t[19]=b,t[20]=D,t[21]=O):O=t[21];let k;t[22]!==n.configHint||t[23]!==n.configTitle||t[24]!==O?(k=(0,J.jsx)(ee,{className:ce,icon:T,title:n.configTitle,subtitle:n.configHint,trailing:O}),t[22]=n.configHint,t[23]=n.configTitle,t[24]=O,t[25]=k):k=t[25];let j;t[26]!==o||t[27]!==c||t[28]!==a||t[29]!==r||t[30]!==u||t[31]!==n.configDeepHalfLife||t[32]!==n.configDeepLimit||t[33]!==n.configDeepMaxAge||t[34]!==n.configDeepMinRecallCount||t[35]!==n.configDeepMinScore||t[36]!==n.configFrequency||t[37]!==n.configLightDedupe||t[38]!==n.configLightLimit||t[39]!==n.configLightLookbackDays||t[40]!==n.configLoading||t[41]!==n.configPhaseCron||t[42]!==n.configPhaseDeep||t[43]!==n.configPhaseDeepHint||t[44]!==n.configPhaseLight||t[45]!==n.configPhaseLightHint||t[46]!==n.configPhaseRem||t[47]!==n.configPhaseRemHint||t[48]!==n.configRemLimit||t[49]!==n.configRemLookbackDays||t[50]!==n.configRemMinStrength||t[51]!==n.configTimezone||t[52]!==n.off||t[53]!==n.on?(j=o?(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(`div`,{className:K,children:(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 lg:grid-cols-12`,children:[(0,J.jsx)(`div`,{className:`lg:col-span-9`,children:(0,J.jsx)(M,{kind:`cron`,label:n.configFrequency,value:o.frequency,onChange:e=>u(t=>t&&{...t,frequency:e}),labels:r,disabled:!a||c})}),(0,J.jsx)(Z,{label:n.configTimezone,className:`lg:col-span-3`,children:(0,J.jsx)(`input`,{className:q,value:o.timezone,disabled:!a||c,onChange:e=>u(t=>t&&{...t,timezone:e.target.value}),placeholder:`Asia/Shanghai`})})]})}),(0,J.jsxs)(fe,{icon:(0,J.jsx)(m,{className:`size-4 text-amber-500`}),title:n.configPhaseLight,hint:n.configPhaseLightHint,enabled:o.light.enabled,onEnabledChange:e=>u(t=>t&&{...t,light:{...t.light,enabled:e}}),cron:o.light.cron,onCronChange:e=>u(t=>t&&{...t,light:{...t.light,cron:e}}),scheduleLabels:r,disabled:!a||c,onLabel:n.on,offLabel:n.off,cronLabel:n.configPhaseCron,children:[(0,J.jsx)(Z,{label:n.configLightLookbackDays,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.light.lookbackDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,light:{...t.light,lookbackDays:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configLightLimit,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:0,className:q,value:o.light.limit,disabled:!a||c,onChange:e=>u(t=>t&&{...t,light:{...t.light,limit:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configLightDedupe,children:(0,J.jsx)(`input`,{type:`number`,step:`0.01`,min:0,max:1,className:q,value:o.light.dedupeSimilarity,disabled:!a||c,onChange:e=>u(t=>t&&{...t,light:{...t.light,dedupeSimilarity:Number(e.target.value)}})})})]}),(0,J.jsxs)(fe,{icon:(0,J.jsx)(v,{className:`size-4 text-indigo-500`}),title:n.configPhaseDeep,hint:n.configPhaseDeepHint,enabled:o.deep.enabled,onEnabledChange:e=>u(t=>t&&{...t,deep:{...t.deep,enabled:e}}),cron:o.deep.cron,onCronChange:e=>u(t=>t&&{...t,deep:{...t.deep,cron:e}}),scheduleLabels:r,disabled:!a||c,onLabel:n.on,offLabel:n.off,cronLabel:n.configPhaseCron,children:[(0,J.jsx)(Z,{label:n.configDeepMinScore,children:(0,J.jsx)(`input`,{type:`number`,step:`0.01`,min:0,max:1,className:q,value:o.deep.minScore,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,minScore:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepMinRecallCount,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.deep.minRecallCount,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,minRecallCount:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepLimit,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:0,className:q,value:o.deep.limit,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,limit:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepHalfLife,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.deep.recencyHalfLifeDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,recencyHalfLifeDays:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepMaxAge,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.deep.maxAgeDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,maxAgeDays:Number(e.target.value)}})})})]}),(0,J.jsxs)(fe,{icon:(0,J.jsx)(w,{className:`size-4 text-purple-500`}),title:n.configPhaseRem,hint:n.configPhaseRemHint,enabled:o.rem.enabled,onEnabledChange:e=>u(t=>t&&{...t,rem:{...t.rem,enabled:e}}),cron:o.rem.cron,onCronChange:e=>u(t=>t&&{...t,rem:{...t.rem,cron:e}}),scheduleLabels:r,disabled:!a||c,onLabel:n.on,offLabel:n.off,cronLabel:n.configPhaseCron,children:[(0,J.jsx)(Z,{label:n.configRemLookbackDays,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.rem.lookbackDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,rem:{...t.rem,lookbackDays:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configRemLimit,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:0,className:q,value:o.rem.limit,disabled:!a||c,onChange:e=>u(t=>t&&{...t,rem:{...t.rem,limit:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configRemMinStrength,children:(0,J.jsx)(`input`,{type:`number`,step:`0.01`,min:0,max:1,className:q,value:o.rem.minPatternStrength,disabled:!a||c,onChange:e=>u(t=>t&&{...t,rem:{...t.rem,minPatternStrength:Number(e.target.value)}})})})]})]}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.configLoading}),t[26]=o,t[27]=c,t[28]=a,t[29]=r,t[30]=u,t[31]=n.configDeepHalfLife,t[32]=n.configDeepLimit,t[33]=n.configDeepMaxAge,t[34]=n.configDeepMinRecallCount,t[35]=n.configDeepMinScore,t[36]=n.configFrequency,t[37]=n.configLightDedupe,t[38]=n.configLightLimit,t[39]=n.configLightLookbackDays,t[40]=n.configLoading,t[41]=n.configPhaseCron,t[42]=n.configPhaseDeep,t[43]=n.configPhaseDeepHint,t[44]=n.configPhaseLight,t[45]=n.configPhaseLightHint,t[46]=n.configPhaseRem,t[47]=n.configPhaseRemHint,t[48]=n.configRemLimit,t[49]=n.configRemLookbackDays,t[50]=n.configRemMinStrength,t[51]=n.configTimezone,t[52]=n.off,t[53]=n.on,t[54]=j):j=t[54];let N;return t[55]!==k||t[56]!==j?(N=(0,J.jsxs)(A,{className:h,children:[k,j]}),t[55]=k,t[56]=j,t[57]=N):N=t[57],N}function _e(e){let t=(0,F.c)(20),{t:n,hasToken:r,eventsLoading:i,events:a,loadEvents:o}=e,s=!r||i,c;t[0]===o?c=t[1]:(c=()=>void o(),t[0]=o,t[1]=c);let l;t[2]===i?l=t[3]:(l=i?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,t[2]=i,t[3]=l);let u;t[4]!==n.eventsLoad||t[5]!==s||t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:s,onClick:c,children:[l,n.eventsLoad]}),t[4]=n.eventsLoad,t[5]=s,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==n.eventsHint||t[10]!==n.eventsTitle||t[11]!==u?(d=(0,J.jsx)(ee,{className:ce,icon:O,title:n.eventsTitle,subtitle:n.eventsHint,trailing:u}),t[9]=n.eventsHint,t[10]=n.eventsTitle,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==a||t[14]!==n.eventsEmpty||t[15]!==n.eventsNotLoaded?(f=a?a.length>0?(0,J.jsx)(`div`,{className:`space-y-1.5`,children:a.map(ve)}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.eventsEmpty}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.eventsNotLoaded}),t[13]=a,t[14]=n.eventsEmpty,t[15]=n.eventsNotLoaded,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,J.jsxs)(A,{className:G,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function ve(e){let t=e.phase===`light`?`☀️`:e.phase===`rem`?`✨`:`🌙`,n=e.phase===`light`?`scanned=${e.scannedEntries??0} new=${e.newSignals??0} deduped=${e.deduped??0}`:e.phase===`rem`?`patterns=${e.patternsDiscovered??0} analyzed=${e.entriesAnalyzed??0}`:`candidates=${e.candidates??0} applied=${e.applied??0}`;return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 text-xs`,children:[(0,J.jsx)(`span`,{children:t}),(0,J.jsx)(`span`,{className:`font-medium text-fg`,children:e.phase}),(0,J.jsx)(`span`,{className:i(`font-medium`,e.ok?`text-emerald-600 dark:text-emerald-400`:`text-amber-600 dark:text-amber-400`),children:e.ok?`OK`:`FAIL`}),(0,J.jsx)(`span`,{className:`text-fg-muted`,children:n}),(0,J.jsx)(`span`,{className:`text-fg-muted`,children:ue(e.durationMs)}),(0,J.jsx)(`span`,{className:`ml-auto text-fg-subtle`,children:le(e.timestamp)})]},`${e.timestamp}:${e.phase}`)}function ye(e){let t=(0,F.c)(40),{t:n,cfgForm:r,dreamingEnabled:a,hasToken:o,cfgSaving:s,enableSaving:c,runPhase:l,setRunPhase:u,runBusy:d,doRunNow:f,doRefresh:p,setDreamingEnabled:m}=e,h;t[0]===n.title?h=t[1]:(h=(0,J.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=h);let g;t[2]===n.subtitle?g=t[3]:(g=(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle}),t[2]=n.subtitle,t[3]=g);let v;t[4]!==h||t[5]!==g?(v=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[4]=h,t[5]=g,t[6]=v):v=t[6];let b;t[7]!==r||t[8]!==s||t[9]!==a||t[10]!==c||t[11]!==o||t[12]!==m||t[13]!==n.configEnabled||t[14]!==n.off||t[15]!==n.on?(b=r?(0,J.jsxs)(`label`,{className:i(`inline-flex cursor-pointer items-center gap-2 rounded-xl border px-3 py-1.5 text-sm transition-colors`,a?`border-emerald-500/30 bg-emerald-500/5 text-fg`:`border-edge-subtle bg-surface-panel/50 text-fg-muted`),children:[(0,J.jsx)(`span`,{className:`text-xs font-medium`,children:n.configEnabled}),(0,J.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,disabled:!o||s||c,onChange:e=>void m(e.target.checked)}),c?(0,J.jsx)(C,{className:`size-3.5 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,J.jsx)(`span`,{className:i(`text-xs font-semibold`,a?`text-emerald-600 dark:text-emerald-400`:``),children:r.enabled?n.on:n.off})]}):null,t[7]=r,t[8]=s,t[9]=a,t[10]=c,t[11]=o,t[12]=m,t[13]=n.configEnabled,t[14]=n.off,t[15]=n.on,t[16]=b):b=t[16];let x;t[17]!==f||t[18]!==a||t[19]!==o||t[20]!==d||t[21]!==l||t[22]!==u||t[23]!==n.runNow||t[24]!==n.runNowHint?(x=a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`select`,{className:`rounded-lg border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`,value:l,onChange:e=>u(e.target.value),disabled:!o||d,children:[(0,J.jsx)(`option`,{value:`light`,children:`Light`}),(0,J.jsx)(`option`,{value:`deep`,children:`Deep`}),(0,J.jsx)(`option`,{value:`rem`,children:`REM`})]}),(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:!o||d,onClick:()=>void f(l),title:n.runNowHint,children:[d?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(_,{className:`mr-2 size-4`,"aria-hidden":!0}),n.runNow]})]}):null,t[17]=f,t[18]=a,t[19]=o,t[20]=d,t[21]=l,t[22]=u,t[23]=n.runNow,t[24]=n.runNowHint,t[25]=x):x=t[25];let w=!o,T;t[26]===p?T=t[27]:(T=()=>void p(),t[26]=p,t[27]=T);let E;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,J.jsx)(y,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[28]=E):E=t[28];let D;t[29]!==n.refresh||t[30]!==w||t[31]!==T?(D=(0,J.jsx)(S,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:w,title:n.refresh,"aria-label":n.refresh,onClick:T,children:E}),t[29]=n.refresh,t[30]=w,t[31]=T,t[32]=D):D=t[32];let O;t[33]!==b||t[34]!==x||t[35]!==D?(O=(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:[b,x,D]}),t[33]=b,t[34]=x,t[35]=D,t[36]=O):O=t[36];let k;return t[37]!==O||t[38]!==v?(k=(0,J.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[v,O]}),t[37]=O,t[38]=v,t[39]=k):k=t[39],k}function be(e){let t=(0,F.c)(30),{t:n,disabled:r,actionBusy:a,doAction:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-2xl`,G),t[0]=s):s=t[0];let c;t[1]!==n.maintenanceHint||t[2]!==n.maintenanceTitle?(c=(0,J.jsx)(ee,{className:ce,icon:g,title:n.maintenanceTitle,subtitle:n.maintenanceHint}),t[1]=n.maintenanceHint,t[2]=n.maintenanceTitle,t[3]=c):c=t[3];let l;t[4]!==o||t[5]!==n.confirmResetStore?(l=()=>{confirm(n.confirmResetStore)&&o(`reset_store`)},t[4]=o,t[5]=n.confirmResetStore,t[6]=l):l=t[6];let u;t[7]===a?u=t[8]:(u=a===`reset_store`?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(p,{className:`mr-2 size-4`,"aria-hidden":!0}),t[7]=a,t[8]=u);let d;t[9]!==r||t[10]!==n.resetStore||t[11]!==l||t[12]!==u?(d=(0,J.jsxs)(S,{variant:`secondary`,disabled:r,onClick:l,children:[u,n.resetStore]}),t[9]=r,t[10]=n.resetStore,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==o||t[15]!==n.confirmClearLock?(f=()=>{confirm(n.confirmClearLock)&&o(`clear_lock`)},t[14]=o,t[15]=n.confirmClearLock,t[16]=f):f=t[16];let m;t[17]===a?m=t[18]:(m=a===`clear_lock`?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(h,{className:`mr-2 size-4`,"aria-hidden":!0}),t[17]=a,t[18]=m);let _;t[19]!==r||t[20]!==n.clearLock||t[21]!==f||t[22]!==m?(_=(0,J.jsxs)(S,{variant:`secondary`,disabled:r,onClick:f,children:[m,n.clearLock]}),t[19]=r,t[20]=n.clearLock,t[21]=f,t[22]=m,t[23]=_):_=t[23];let v;t[24]!==d||t[25]!==_?(v=(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[d,_]}),t[24]=d,t[25]=_,t[26]=v):v=t[26];let y;return t[27]!==c||t[28]!==v?(y=(0,J.jsxs)(A,{className:s,children:[c,v]}),t[27]=c,t[28]=v,t[29]=y):y=t[29],y}function xe(e){let t=(0,F.c)(21),{t:n,hasToken:r,previewLoading:i,previewItems:a,loadPreview:o}=e,s=!r||i,c;t[0]===o?c=t[1]:(c=()=>void o(),t[0]=o,t[1]=c);let l;t[2]===i?l=t[3]:(l=i?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,t[2]=i,t[3]=l);let u;t[4]!==n.previewLoad||t[5]!==s||t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:s,onClick:c,children:[l,n.previewLoad]}),t[4]=n.previewLoad,t[5]=s,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==n.previewHint||t[10]!==n.previewTitle||t[11]!==u?(d=(0,J.jsx)(ee,{className:ce,icon:x,title:n.previewTitle,subtitle:n.previewHint,trailing:u}),t[9]=n.previewHint,t[10]=n.previewTitle,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==a||t[14]!==n.previewEligible||t[15]!==n.previewEmpty||t[16]!==n.previewNotLoaded?(f=a?a.length>0?(0,J.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>{let t=`${e.path}:${e.startLine}-${e.endLine}`,r=e.skippedReason;return(0,J.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel/60 px-2.5 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,J.jsxs)(`span`,{children:[`score=`,e.score.toFixed(3)]}),(0,J.jsxs)(`span`,{children:[`recalls=`,e.recallCount]}),(0,J.jsxs)(`span`,{children:[`avg=`,e.avgScore.toFixed(3)]}),(0,J.jsxs)(`span`,{children:[`decay=`,e.recencyDecay?.toFixed(3)??`—`]}),r?(0,J.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:r}):(0,J.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:n.previewEligible})]}),e.snippet?(0,J.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:e.snippet}):null]},`${e.key}:${e.hash}:${t}`)})}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.previewEmpty}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.previewNotLoaded}),t[13]=a,t[14]=n.previewEligible,t[15]=n.previewEmpty,t[16]=n.previewNotLoaded,t[17]=f):f=t[17];let p;return t[18]!==d||t[19]!==f?(p=(0,J.jsxs)(A,{className:G,children:[d,f]}),t[18]=d,t[19]=f,t[20]=p):p=t[20],p}function Se(e){let t=(0,F.c)(12),n;t[0]!==e.expression||t[1]!==e.kind||t[2]!==e.labels||t[3]!==e.locale||t[4]!==e.nextRun||t[5]!==e.presetLabels||t[6]!==e.timezone||t[7]!==e.valueMs?(n=e.kind===`cron`?j(e.expression,e.locale,e.labels,{timezone:e.timezone,nextRun:e.nextRun}):N(e.valueMs,e.locale,e.presetLabels),t[0]=e.expression,t[1]=e.kind,t[2]=e.labels,t[3]=e.locale,t[4]=e.nextRun,t[5]=e.presetLabels,t[6]=e.timezone,t[7]=e.valueMs,t[8]=n):n=t[8];let r=n,i;return t[9]!==e.className||t[10]!==r?(i=(0,J.jsx)(`span`,{className:e.className,children:r}),t[9]=e.className,t[10]=r,t[11]=i):i=t[11],i}function Ce(e){let t=(0,F.c)(100),{t:n,data:r,isLoading:a,localeTag:o,scheduleBadgeLabels:s}=e,c;t[0]!==r||t[1]!==n?(c=r?de(r.lock,n):null,t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`min-w-0`,G),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a?(0,J.jsx)(C,{className:`size-4 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):null,t[4]=a,t[5]=d);let f;t[6]!==n.runtimeHint||t[7]!==n.runtimeTitle||t[8]!==d?(f=(0,J.jsx)(ee,{className:ce,icon:O,title:n.runtimeTitle,subtitle:n.runtimeHint,trailing:d}),t[6]=n.runtimeHint,t[7]=n.runtimeTitle,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n.subsectionSchedule?p=t[11]:(p=(0,J.jsx)($,{label:n.subsectionSchedule,className:`mb-2`}),t[10]=n.subsectionSchedule,t[11]=p);let h=r?r.config.enabled?n.on:n.off:`—`,g;t[12]!==n.enabled||t[13]!==h?(g=(0,J.jsx)(Q,{label:n.enabled,children:h}),t[12]=n.enabled,t[13]=h,t[14]=g):g=t[14];let _=l?.className,y=l?l.text:`—`,b;t[15]!==_||t[16]!==y?(b=(0,J.jsx)(`span`,{className:_,children:y}),t[15]=_,t[16]=y,t[17]=b):b=t[17];let x;t[18]!==n.lock||t[19]!==b?(x=(0,J.jsx)(Q,{label:n.lock,children:b}),t[18]=n.lock,t[19]=b,t[20]=x):x=t[20];let S=r&&r.config.timezone||`—`,T;t[21]!==n.timezone||t[22]!==S?(T=(0,J.jsx)(Q,{label:n.timezone,children:S}),t[21]=n.timezone,t[22]=S,t[23]=T):T=t[23];let E;t[24]!==r||t[25]!==o||t[26]!==s?(E=r?(0,J.jsx)(Se,{kind:`cron`,expression:r.config.frequency,locale:o,labels:s,timezone:r.config.timezone||void 0}):`—`,t[24]=r,t[25]=o,t[26]=s,t[27]=E):E=t[27];let D;t[28]===r?D=t[29]:(D=r?.config.frequency?(0,J.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[0.65rem] text-fg-subtle`,title:r.config.frequency,children:r.config.frequency}):null,t[28]=r,t[29]=D);let k;t[30]!==n.schedule||t[31]!==E||t[32]!==D?(k=(0,J.jsxs)(Q,{label:n.schedule,className:`col-span-2 sm:col-span-2`,children:[E,D]}),t[30]=n.schedule,t[31]=E,t[32]=D,t[33]=k):k=t[33];let M;t[34]!==x||t[35]!==T||t[36]!==k||t[37]!==g?(M=(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-4`,children:[g,x,T,k]}),t[34]=x,t[35]=T,t[36]=k,t[37]=g,t[38]=M):M=t[38];let N;t[39]!==M||t[40]!==p?(N=(0,J.jsxs)(`div`,{className:K,children:[p,M]}),t[39]=M,t[40]=p,t[41]=N):N=t[41];let P;t[42]===n.subsectionStore?P=t[43]:(P=(0,J.jsx)($,{label:n.subsectionStore,className:`mb-2`}),t[42]=n.subsectionStore,t[43]=P);let te=r?String(r.store.entryCount):`—`,ne;t[44]!==n.storeEntries||t[45]!==te?(ne=(0,J.jsx)(Q,{label:n.storeEntries,children:te}),t[44]=n.storeEntries,t[45]=te,t[46]=ne):ne=t[46];let re=r?String(r.store.promotedCount):`—`,ie;t[47]!==n.storePromoted||t[48]!==re?(ie=(0,J.jsx)(Q,{label:n.storePromoted,children:re}),t[47]=n.storePromoted,t[48]=re,t[49]=ie):ie=t[49];let I;t[50]===r?I=t[51]:(I=r?le(r.store.updatedAt):`—`,t[50]=r,t[51]=I);let ae;t[52]!==n.storeUpdatedAt||t[53]!==I?(ae=(0,J.jsx)(Q,{label:n.storeUpdatedAt,children:I}),t[52]=n.storeUpdatedAt,t[53]=I,t[54]=ae):ae=t[54];let L;t[55]===r?L=t[56]:(L=r?le(r.store.lastPromotedAt):`—`,t[55]=r,t[56]=L);let R;t[57]!==n.storeLastPromotedAt||t[58]!==L?(R=(0,J.jsx)(Q,{label:n.storeLastPromotedAt,children:L}),t[57]=n.storeLastPromotedAt,t[58]=L,t[59]=R):R=t[59];let z;t[60]!==ne||t[61]!==ie||t[62]!==ae||t[63]!==R?(z=(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-4`,children:[ne,ie,ae,R]}),t[60]=ne,t[61]=ie,t[62]=ae,t[63]=R,t[64]=z):z=t[64];let B;t[65]!==P||t[66]!==z?(B=(0,J.jsxs)(`div`,{className:K,children:[P,z]}),t[65]=P,t[66]=z,t[67]=B):B=t[67];let V;t[68]!==r||t[69]!==o||t[70]!==s||t[71]!==n?(V=r?.config?.phases?(0,J.jsxs)(`div`,{children:[(0,J.jsx)($,{label:n.subsectionPhases,className:`mb-2`}),(0,J.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,J.jsx)(pe,{icon:(0,J.jsx)(m,{className:`size-4 text-amber-500`}),label:`Light`,enabled:r.config.phases.light.enabled,cron:r.config.phases.light.cron,scheduleSummary:j(r.config.phases.light.cron,o,s,{timezone:r.config.timezone||void 0}),details:`lookback=${r.config.phases.light.lookbackDays}d, limit=${r.config.phases.light.limit}, dedupe=${r.config.phases.light.dedupeSimilarity}`,t:n}),(0,J.jsx)(pe,{icon:(0,J.jsx)(v,{className:`size-4 text-indigo-500`}),label:`Deep`,enabled:r.config.phases.deep.enabled,cron:r.config.phases.deep.cron,scheduleSummary:j(r.config.phases.deep.cron,o,s,{timezone:r.config.timezone||void 0}),details:`minScore=${r.config.phases.deep.minScore}, recalls≥${r.config.phases.deep.minRecallCount}, limit=${r.config.phases.deep.limit}, halfLife=${r.config.phases.deep.recencyHalfLifeDays}d`,t:n}),(0,J.jsx)(pe,{icon:(0,J.jsx)(w,{className:`size-4 text-purple-500`}),label:`REM`,enabled:r.config.phases.rem.enabled,cron:r.config.phases.rem.cron,scheduleSummary:j(r.config.phases.rem.cron,o,s,{timezone:r.config.timezone||void 0}),details:`lookback=${r.config.phases.rem.lookbackDays}d, limit=${r.config.phases.rem.limit}, strength≥${r.config.phases.rem.minPatternStrength}`,t:n})]})]}):null,t[68]=r,t[69]=o,t[70]=s,t[71]=n,t[72]=V):V=t[72];let H;t[73]===n.subsectionLastRun?H=t[74]:(H=(0,J.jsx)($,{label:n.subsectionLastRun,className:`mb-2`}),t[73]=n.subsectionLastRun,t[74]=H);let U;t[75]===n.lastRunBlockHint?U=t[76]:(U=(0,J.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:n.lastRunBlockHint}),t[75]=n.lastRunBlockHint,t[76]=U);let W;t[77]!==r||t[78]!==n?(W=r?.lastRun?.exists?(0,J.jsxs)(`div`,{className:`space-y-2`,children:[r.lastRun.parseError?(0,J.jsxs)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:[n.lastRunParseError,`: `,r.lastRun.parseError]}):null,r.lastRun.record?(0,J.jsx)(`div`,{className:`rounded-lg border border-edge-subtle/80 bg-surface-panel/50 p-2.5`,children:(0,J.jsx)(he,{t:n,r:r.lastRun.record})}):null,r.lastRun.raw!==void 0&&r.lastRun.raw!==null?(0,J.jsxs)(`details`,{className:`group rounded-lg border border-edge-subtle`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer list-none px-2.5 py-1.5 text-xs font-medium text-fg-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:(0,J.jsx)(`span`,{className:`underline decoration-edge underline-offset-2 group-open:text-fg`,children:n.lastRunRaw})}),(0,J.jsx)(`pre`,{className:`max-h-40 overflow-auto border-t border-edge-subtle p-2.5 text-xs text-fg-muted`,children:JSON.stringify(r.lastRun.raw,null,2)})]}):null]}):(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.lastRunEmpty}),t[77]=r,t[78]=n,t[79]=W):W=t[79];let oe;t[80]!==H||t[81]!==U||t[82]!==W?(oe=(0,J.jsxs)(`div`,{className:K,children:[H,U,W]}),t[80]=H,t[81]=U,t[82]=W,t[83]=oe):oe=t[83];let se=r?.lightLastRun,q;t[84]!==n||t[85]!==se?(q=(0,J.jsx)(me,{label:n.subsectionLightLastRun,lastRun:se,t:n}),t[84]=n,t[85]=se,t[86]=q):q=t[86];let ue=r?.remLastRun,Y;t[87]!==n||t[88]!==ue?(Y=(0,J.jsx)(me,{label:n.subsectionRemLastRun,lastRun:ue,t:n}),t[87]=n,t[88]=ue,t[89]=Y):Y=t[89];let X;t[90]!==N||t[91]!==B||t[92]!==V||t[93]!==oe||t[94]!==q||t[95]!==Y?(X=(0,J.jsxs)(`div`,{className:`space-y-3`,children:[N,B,V,oe,q,Y]}),t[90]=N,t[91]=B,t[92]=V,t[93]=oe,t[94]=q,t[95]=Y,t[96]=X):X=t[96];let Z;return t[97]!==X||t[98]!==f?(Z=(0,J.jsxs)(A,{className:u,children:[f,X]}),t[97]=X,t[98]=f,t[99]=Z):Z=t[99],Z}var we=[`config`,`runtime`,`insights`,`maintenance`],Te={config:T,runtime:O,insights:x,maintenance:g};function Ee(e){return e&&we.includes(e)?e:`config`}function De(e,t){return t===`config`?e.tabConfig:t===`runtime`?e.tabRuntime:t===`insights`?e.tabInsights:e.tabMaintenance}function Oe(e,t){return t===`config`?e.configTabHint:t===`runtime`?e.runtimeTabHint:t===`insights`?e.insightsTabHint:e.maintenanceTabHint}function ke(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:return{form:t.value,baseline:t.value};case`set`:return{...e,form:t.value};case`saved`:return{form:t.value,baseline:t.value}}}var Ae={actionBusy:null,actionError:null,actionOk:!1,runBusy:!1,runOk:!1,runError:null,runPhase:`deep`,cfgSaving:!1,enableSaving:!1,cfgOk:!1,cfgError:null,previewLoading:!1,previewError:null,previewItems:null,eventsLoading:!1,eventsError:null,events:null};function je(){let e=o(e=>e.language),t=a(e),n=t.dreamingSettings,r=t.cron.schedulePicker,i=t.cron.scheduleBadge,c=e===`zh`?`zh-CN`:`en-US`,l=!!s(e=>e.token),[p,m]=f(),h=Ee(p.get(`tab`)),g=(0,P.useCallback)(e=>{m(t=>{let n=new URLSearchParams(t);return e===`config`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[m]),{data:_}=b(l),[v,y]=(0,P.useReducer)(d,Ae),{actionBusy:x,actionError:S,actionOk:C,runBusy:w,runOk:T,runError:E,runPhase:D,cfgSaving:O,enableSaving:k,cfgOk:ee,cfgError:A,previewLoading:j,previewError:M,previewItems:N,eventsLoading:F,eventsError:L,events:R}=v,[z,B]=(0,P.useReducer)(ke,{form:null,baseline:null}),V=z.form,H=z.baseline,U=(0,P.useRef)(!1),{data:W,error:G,isLoading:ce,mutate:K}=u(l?te():null,ne,{revalidateOnFocus:!1}),q=(0,P.useMemo)(()=>{let e=[];return G&&e.push(G instanceof Error?G.message:String(G)),S&&e.push(S),E&&e.push(E),M&&e.push(M),L&&e.push(L),A&&e.push(A),e},[G,S,E,M,L,A]),le=(0,P.useMemo)(()=>{let e=[];return ee&&e.push(n.configSaved),T&&e.push(n.runQueued),C&&e.push(n.actionOk),e},[ee,T,C,n]),ue=(0,P.useCallback)(async()=>{y({type:`patch`,patch:{actionOk:!1,actionError:null,runOk:!1,runError:null,cfgOk:!1,cfgError:null,previewError:null}}),await K()},[K]),de=(0,P.useCallback)(async()=>{y({type:`patch`,patch:{previewLoading:!0,previewError:null}});try{y({type:`patch`,patch:{previewItems:(await I(20)).items??[]}})}catch(e){y({type:`patch`,patch:{previewError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{previewLoading:!1}})}},[]),Y=(0,P.useCallback)(async()=>{y({type:`patch`,patch:{eventsLoading:!0,eventsError:null}});try{y({type:`patch`,patch:{events:await ae(50)}})}catch(e){y({type:`patch`,patch:{eventsError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{eventsLoading:!1}})}},[]),X=(0,P.useCallback)(async(e=`deep`)=>{y({type:`patch`,patch:{runBusy:!0,runOk:!1,runError:null}});try{await ie(e),y({type:`patch`,patch:{runOk:!0}}),await K()}catch(e){y({type:`patch`,patch:{runError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{runBusy:!1}})}},[K]),Z=(0,P.useCallback)(async e=>{y({type:`patch`,patch:{actionBusy:e,actionError:null,actionOk:!1}});try{await re(e),y({type:`patch`,patch:{actionOk:!0}}),await K()}catch(e){y({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{actionBusy:null}})}},[K]),Q=!l||ce||!!x,$=(0,P.useMemo)(()=>{let e=_?.payload?.config;return oe(e??{})},[_]);(0,P.useEffect)(()=>{if(!l){B({type:`reset`}),U.current=!1;return}U.current||B({type:`sync`,value:$})},[$,l]);let fe=(0,P.useMemo)(()=>!V||!H?!1:JSON.stringify(V)!==JSON.stringify(H),[V,H]),pe=(0,P.useCallback)(async()=>{if(V){y({type:`patch`,patch:{cfgSaving:!0,cfgOk:!1,cfgError:null}});try{await se(V),B({type:`saved`,value:V}),U.current=!1,y({type:`patch`,patch:{cfgOk:!0}}),await K()}catch(e){y({type:`patch`,patch:{cfgError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{cfgSaving:!1}})}}},[V,K]),me=(0,P.useCallback)(async e=>{if(!V||!l)return;let t={...V,enabled:e},n=V;U.current=!0,B({type:`set`,value:t}),y({type:`patch`,patch:{enableSaving:!0,cfgOk:!1,cfgError:null}});try{await se(t),B({type:`saved`,value:t}),U.current=!1,y({type:`patch`,patch:{cfgOk:!0}}),await K()}catch(e){B({type:`set`,value:n}),y({type:`patch`,patch:{cfgError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{enableSaving:!1}})}},[V,l,K]);return(0,J.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-4 px-4 py-6`,children:[(0,J.jsx)(ye,{t:n,cfgForm:V,dreamingEnabled:V?.enabled??$.enabled,hasToken:l,cfgSaving:O,enableSaving:k,runPhase:D,setRunPhase:e=>y({type:`patch`,patch:{runPhase:e}}),runBusy:w,doRunNow:X,doRefresh:ue,setDreamingEnabled:me}),q.length>0?(0,J.jsx)(`div`,{className:`space-y-1.5 rounded-2xl border border-amber-500/20 bg-amber-500/5 px-4 py-3`,role:`alert`,children:q.map(e=>(0,J.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200/90`,children:e},e))}):null,le.length>0?(0,J.jsx)(`div`,{className:`space-y-1.5 rounded-2xl border border-emerald-500/20 bg-emerald-500/5 px-4 py-3`,role:`status`,children:le.map(e=>(0,J.jsx)(`p`,{className:`text-sm text-emerald-800 dark:text-emerald-200/90`,children:e},e))}):null,(0,J.jsx)(Me,{t:n,activeTab:h,onChange:g}),(0,J.jsx)(Ne,{t:n,id:`config`,activeTab:h,children:(0,J.jsx)(ge,{t:n,schedulePickerLabels:r,hasToken:l,cfgForm:V,cfgBaseline:H,cfgSaving:O,cfgDirty:fe,setCfgForm:e=>{U.current=!0;let t=typeof e==`function`?e(V):e;t&&B({type:`set`,value:t})},setCfgOk:e=>y({type:`patch`,patch:{cfgOk:e}}),setCfgError:e=>y({type:`patch`,patch:{cfgError:e}}),saveConfig:pe})}),(0,J.jsx)(Ne,{t:n,id:`runtime`,activeTab:h,children:(0,J.jsx)(Ce,{t:n,data:W,isLoading:ce,localeTag:c,scheduleBadgeLabels:i})}),(0,J.jsx)(Ne,{t:n,id:`insights`,activeTab:h,children:(0,J.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,J.jsx)(xe,{t:n,hasToken:l,previewLoading:j,previewItems:N,loadPreview:de}),(0,J.jsx)(_e,{t:n,hasToken:l,eventsLoading:F,events:R,loadEvents:Y})]})}),(0,J.jsx)(Ne,{t:n,id:`maintenance`,activeTab:h,children:(0,J.jsx)(be,{t:n,disabled:Q,actionBusy:x,doAction:Z})})]})}function Me(e){let t=(0,F.c)(11),{t:n,activeTab:r,onChange:a}=e,o=n.tabsAriaLabel,s;t[0]!==r||t[1]!==a?(s=e=>{e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||(e.preventDefault(),a(we[(we.indexOf(r)+(e.key===`ArrowRight`?1:-1)+we.length)%we.length]))},t[0]=r,t[1]=a,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==a||t[5]!==n?(c=we.map(e=>{let t=Te[e],o=e===r;return(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o,id:`dreaming-settings-tab-${e}`,"aria-controls":`dreaming-settings-panel-${e}`,className:i(`inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,D.press,o?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>a(e),children:[(0,J.jsx)(t,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:De(n,e)})]},e)}),t[3]=r,t[4]=a,t[5]=n,t[6]=c):c=t[6];let l;return t[7]!==n.tabsAriaLabel||t[8]!==s||t[9]!==c?(l=(0,J.jsx)(`nav`,{"aria-label":o,className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,role:`tablist`,onKeyDown:s,children:c}),t[7]=n.tabsAriaLabel,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Ne(e){let t=(0,F.c)(18),{t:n,id:r,activeTab:i,children:a}=e;if(i!==r)return null;let o=`dreaming-settings-panel-${r}`,s=`dreaming-settings-tab-${r}`,c;t[0]!==r||t[1]!==n?(c=De(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,J.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c}),t[3]=c,t[4]=l);let u;t[5]!==r||t[6]!==n?(u=Oe(n,r),t[5]=r,t[6]=n,t[7]=u):u=t[7];let d;t[8]===u?d=t[9]:(d=(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}),t[8]=u,t[9]=d);let f;t[10]!==l||t[11]!==d?(f=(0,J.jsxs)(`div`,{className:`mb-5`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==f?(p=(0,J.jsxs)(`section`,{id:o,role:`tabpanel`,"aria-labelledby":s,className:`rounded-2xl border border-edge bg-surface-base px-4 py-5 sm:px-5`,children:[f,a]}),t[13]=a,t[14]=o,t[15]=s,t[16]=f,t[17]=p):p=t[17],p}export{je as DreamingSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-CkT-lcgP.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{c as s,i as c,n as l}from"./fetch-NZmjSXLl.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{B as d,Ds as f,Hi as p,Ji as m,Ka as h,Mi as g,Oa as _,Ra as v,ba as y,br as b,ga as x,ki as S,qa as C,ra as w,ua as T,wi as E,xi as D,xs as O,yr as k}from"./index-Cxm6xsps.js";import{n as ee,t as A}from"./settings-form-section-Dq-83cQd.js";import{t as j}from"./format-cron-label-BsotZDO5.js";import{t as M}from"./schedule-field-CF2sadvN.js";import{t as N}from"./format-interval-label-qhth3BMV.js";var P=e(t(),1),F=n();function te(){return c(`/api/dreaming`)}async function ne(){let e=await l(te());if(!e.payload)throw Error(`Missing payload`);return e.payload}async function re(e){await l(c(`/api/dreaming/action`),{method:`POST`,body:JSON.stringify({action:e})})}async function ie(e=`deep`){let t=await l(c(`/api/dreaming/run`),{method:`POST`,body:JSON.stringify({phase:e})}),n=!!t.payload?.triggered,r=typeof t.payload?.jobId==`string`?t.payload.jobId:``;if(!n||!r)throw Error(`Failed to trigger`);return{triggered:n,jobId:r,phase:e}}async function I(e){let t=await l(c(`/api/dreaming/preview${typeof e==`number`&&Number.isFinite(e)?`?limit=${encodeURIComponent(String(e))}`:``}`));if(!t.payload)throw Error(`Missing payload`);return t.payload}async function ae(e=50){return(await l(c(`/api/dreaming/events${`?limit=${encodeURIComponent(String(e))}`}`))).payload?.events??[]}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var R={enabled:!0,cron:`0 */6 * * *`,lookbackDays:1,limit:50,dedupeSimilarity:.85},z={enabled:!0,cron:`0 3 * * *`,minScore:.8,minRecallCount:3,limit:10,recencyHalfLifeDays:14,maxAgeDays:30},B={enabled:!0,cron:`0 5 * * 0`,lookbackDays:7,limit:20,minPatternStrength:.6},V={enabled:!1,frequency:`0 3 * * *`,timezone:``,deepEnabled:!0,minScore:.8,minRecallCount:3,limit:10,light:R,deep:z,rem:B};function H(e,t){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):t}function U(e,t){let n=typeof e==`string`?Number(e):e;return Number.isFinite(n)?Math.max(0,Math.floor(n)):t}function W(e,t){let n=typeof e==`string`?Number(e):e;return Number.isFinite(n)?n:t}function oe(e){let t=L(e)?e:{},n=L(t.agents)?t.agents:{},r=L(n.defaults)?n.defaults:{},i=L(r.memory)?r.memory:{},a=L(i.dreaming)?i.dreaming:{},o=L(a.phases)?a.phases:{},s=L(o.light)?o.light:{},c=L(o.deep)?o.deep:{},l=L(o.rem)?o.rem:{};return{enabled:a.enabled===!0,frequency:typeof a.frequency==`string`&&a.frequency.trim()?a.frequency.trim():V.frequency,timezone:typeof a.timezone==`string`?a.timezone:``,deepEnabled:c.enabled!==!1,minScore:H(typeof c.minScore==`number`?c.minScore:Number(c.minScore),V.minScore),minRecallCount:Math.max(1,U(c.minRecallCount,V.minRecallCount)),limit:U(c.limit,V.limit),light:{enabled:s.enabled!==!1,cron:typeof s.cron==`string`&&s.cron.trim()?s.cron.trim():R.cron,lookbackDays:Math.max(1,U(s.lookbackDays,R.lookbackDays)),limit:U(s.limit,R.limit),dedupeSimilarity:H(W(s.dedupeSimilarity,R.dedupeSimilarity),R.dedupeSimilarity)},deep:{enabled:c.enabled!==!1,cron:typeof c.cron==`string`&&c.cron.trim()?c.cron.trim():z.cron,minScore:H(W(c.minScore,z.minScore),z.minScore),minRecallCount:Math.max(1,U(c.minRecallCount,z.minRecallCount)),limit:U(c.limit,z.limit),recencyHalfLifeDays:Math.max(1,W(c.recencyHalfLifeDays,z.recencyHalfLifeDays)),maxAgeDays:Math.max(1,W(c.maxAgeDays,z.maxAgeDays))},rem:{enabled:l.enabled!==!1,cron:typeof l.cron==`string`&&l.cron.trim()?l.cron.trim():B.cron,lookbackDays:Math.max(1,U(l.lookbackDays,B.lookbackDays)),limit:U(l.limit,B.limit),minPatternStrength:H(W(l.minPatternStrength,B.minPatternStrength),B.minPatternStrength)}}}async function se(e){let t=e.frequency.trim(),n=e.timezone.trim();await l(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({agents:{defaults:{memory:{dreaming:{enabled:!!e.enabled,frequency:t||null,timezone:n||null,phases:{light:{enabled:!!e.light.enabled,cron:e.light.cron.trim()||null,lookbackDays:Math.max(1,Math.floor(e.light.lookbackDays)),limit:Math.max(0,Math.floor(e.light.limit)),dedupeSimilarity:H(e.light.dedupeSimilarity,R.dedupeSimilarity)},deep:{enabled:!!e.deep.enabled,cron:e.deep.cron.trim()||null,minScore:H(e.deep.minScore,z.minScore),minRecallCount:Math.max(1,Math.floor(e.deep.minRecallCount)),limit:Math.max(0,Math.floor(e.deep.limit)),recencyHalfLifeDays:Math.max(1,e.deep.recencyHalfLifeDays),maxAgeDays:Math.max(1,e.deep.maxAgeDays)},rem:{enabled:!!e.rem.enabled,cron:e.rem.cron.trim()||null,lookbackDays:Math.max(1,Math.floor(e.rem.lookbackDays)),limit:Math.max(0,Math.floor(e.rem.limit)),minPatternStrength:H(e.rem.minPatternStrength,B.minPatternStrength)}}}}}}})}),k()}var G=`p-4 sm:px-5`,ce=`mb-3`,K=`rounded-xl border border-edge-subtle bg-surface-panel/30 p-3 sm:p-4`,q=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,E);function le(e){return e?e.replace(`T`,` `).replace(`Z`,``):`—`}function ue(e){return e===void 0||!Number.isFinite(e)||e<0?`—`:e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(2)} s`}function de(e,t){return e.locked?{text:t.lockValueLocked,className:`text-amber-600 dark:text-amber-400`}:{text:t.lockValueUnlocked,className:`text-emerald-600 dark:text-emerald-400`}}var J=r(),Y=`text-xs font-medium text-fg-muted`,X=`text-sm font-medium text-fg`;function Z(e){let t=(0,F.c)(6),{label:n,children:r,className:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(`span`,{className:Y,children:n}),t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,J.jsxs)(`div`,{className:i,children:[a,r]}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function Q(e){let t=(0,F.c)(11),{label:n,children:r,className:a}=e,o;t[0]===a?o=t[1]:(o=i(`min-w-0`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,J.jsx)(`dt`,{className:Y,children:n}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=i(X,`mt-0.5`),t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,J.jsx)(`dd`,{className:c,children:r}),t[5]=r,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==l?(u=(0,J.jsxs)(`div`,{className:o,children:[s,l]}),t[7]=o,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function $(e){let t=(0,F.c)(5),{label:n,className:r}=e,a;t[0]===r?a=t[1]:(a=i(`text-[0.7rem] font-semibold uppercase tracking-wider text-fg-muted`,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,J.jsx)(`h3`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function fe(e){let t=(0,F.c)(38),{icon:n,title:r,hint:i,enabled:a,onEnabledChange:o,cron:s,onCronChange:c,scheduleLabels:l,disabled:u,onLabel:d,offLabel:f,cronLabel:p,children:m}=e,h;t[0]===n?h=t[1]:(h=(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:n}),t[0]=n,t[1]=h);let g;t[2]===r?g=t[3]:(g=(0,J.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=g);let _;t[4]===i?_=t[5]:(_=(0,J.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-fg-muted`,children:i}),t[4]=i,t[5]=_);let v;t[6]!==g||t[7]!==_?(v=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]!==h||t[10]!==v?(y=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[h,v]}),t[9]=h,t[10]=v,t[11]=y):y=t[11];let b;t[12]===o?b=t[13]:(b=e=>o(e.target.checked),t[12]=o,t[13]=b);let x;t[14]!==u||t[15]!==a||t[16]!==b?(x=(0,J.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:a,disabled:u,onChange:b}),t[14]=u,t[15]=a,t[16]=b,t[17]=x):x=t[17];let S=a?d:f,C;t[18]===S?C=t[19]:(C=(0,J.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==x||t[21]!==C?(w=(0,J.jsxs)(`label`,{className:`inline-flex shrink-0 items-center gap-2 text-xs text-fg`,children:[x,C]}),t[20]=x,t[21]=C,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==y?(T=(0,J.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-start justify-between gap-2 border-b border-edge-subtle/80 pb-2.5`,children:[y,w]}),t[23]=w,t[24]=y,t[25]=T):T=t[25];let E;t[26]!==s||t[27]!==p||t[28]!==u||t[29]!==c||t[30]!==l?(E=(0,J.jsx)(M,{kind:`cron`,className:`mb-2.5`,label:p,value:s,onChange:c,labels:l,disabled:u}),t[26]=s,t[27]=p,t[28]=u,t[29]=c,t[30]=l,t[31]=E):E=t[31];let D;t[32]===m?D=t[33]:(D=(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4`,children:m}),t[32]=m,t[33]=D);let O;return t[34]!==T||t[35]!==E||t[36]!==D?(O=(0,J.jsxs)(`div`,{className:K,children:[T,E,D]}),t[34]=T,t[35]=E,t[36]=D,t[37]=O):O=t[37],O}function pe(e){let t=(0,F.c)(23),{icon:n,label:r,enabled:a,cron:o,scheduleSummary:s,details:c,t:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(K,`space-y-1`),t[0]=u):u=t[0];let d;t[1]===r?d=t[2]:(d=(0,J.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r}),t[1]=r,t[2]=d);let f=a?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`,p;t[3]===f?p=t[4]:(p=i(`ml-auto text-xs font-medium`,f),t[3]=f,t[4]=p);let m=a?l.on:l.off,h;t[5]!==p||t[6]!==m?(h=(0,J.jsx)(`span`,{className:p,children:m}),t[5]=p,t[6]=m,t[7]=h):h=t[7];let g;t[8]!==n||t[9]!==d||t[10]!==h?(g=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n,d,h]}),t[8]=n,t[9]=d,t[10]=h,t[11]=g):g=t[11];let _;t[12]===s?_=t[13]:(_=(0,J.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s}),t[12]=s,t[13]=_);let v;t[14]===o?v=t[15]:(v=(0,J.jsx)(`p`,{className:`truncate font-mono text-[0.65rem] text-fg-subtle`,title:o,children:o}),t[14]=o,t[15]=v);let y;t[16]===c?y=t[17]:(y=(0,J.jsx)(`p`,{className:`text-[0.65rem] leading-snug text-fg-muted`,children:c}),t[16]=c,t[17]=y);let b;return t[18]!==y||t[19]!==g||t[20]!==_||t[21]!==v?(b=(0,J.jsxs)(`div`,{className:u,children:[g,_,v,y]}),t[18]=y,t[19]=g,t[20]=_,t[21]=v,t[22]=b):b=t[22],b}function me(e){let t=(0,F.c)(9),{label:n,lastRun:r,t:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)($,{label:n,className:`mb-2`}),t[0]=n,t[1]=a);let o;t[2]!==r||t[3]!==i.lastRunRaw||t[4]!==i.phaseLastRunEmpty?(o=r?.exists?(0,J.jsxs)(`details`,{className:`group rounded-lg border border-edge-subtle`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer list-none px-2.5 py-1.5 text-xs font-medium text-fg-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:(0,J.jsx)(`span`,{className:`underline decoration-edge underline-offset-2 group-open:text-fg`,children:i.lastRunRaw})}),(0,J.jsx)(`pre`,{className:`max-h-40 overflow-auto border-t border-edge-subtle p-2.5 text-xs text-fg-muted`,children:JSON.stringify(r.raw,null,2)})]}):(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.phaseLastRunEmpty}),t[2]=r,t[3]=i.lastRunRaw,t[4]=i.phaseLastRunEmpty,t[5]=o):o=t[5];let s;return t[6]!==a||t[7]!==o?(s=(0,J.jsxs)(`div`,{className:`border-t border-edge-subtle/80 pt-3`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function he(e){let t=(0,F.c)(39),{t:n,r}=e,i=r.deep?.skipped,a=r.ok?`text-emerald-600 dark:text-emerald-400`:`text-amber-600 dark:text-amber-400`,o=r.ok?n.lastRunSuccess:n.lastRunFailure,s;t[0]!==a||t[1]!==o?(s=(0,J.jsx)(`span`,{className:a,children:o}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c;t[3]!==n.lastRunStatus||t[4]!==s?(c=(0,J.jsx)(Q,{label:n.lastRunStatus,children:s}),t[3]=n.lastRunStatus,t[4]=s,t[5]=c):c=t[5];let l=n.lastRunDuration,u;t[6]===r.durationMs?u=t[7]:(u=ue(r.durationMs),t[6]=r.durationMs,t[7]=u);let d;t[8]!==n.lastRunDuration||t[9]!==u?(d=(0,J.jsx)(Q,{label:l,children:u}),t[8]=n.lastRunDuration,t[9]=u,t[10]=d):d=t[10];let f=n.lastRunRanked,p=String(r.deep?.candidatesRanked??`—`),m;t[11]!==n.lastRunRanked||t[12]!==p?(m=(0,J.jsx)(Q,{label:f,children:p}),t[11]=n.lastRunRanked,t[12]=p,t[13]=m):m=t[13];let h=n.lastRunApplied,g=String(r.deep?.applied??`—`),_;t[14]!==n.lastRunApplied||t[15]!==g?(_=(0,J.jsx)(Q,{label:h,children:g}),t[14]=n.lastRunApplied,t[15]=g,t[16]=_):_=t[16];let v;t[17]===r.reason?v=t[18]:(v=(0,J.jsx)(`span`,{className:`block text-pretty`,children:r.reason}),t[17]=r.reason,t[18]=v);let y;t[19]!==r.errorMessage||t[20]!==n.lastRunError?(y=r.errorMessage?(0,J.jsx)(`span`,{className:`mt-1 block text-xs text-amber-600 dark:text-amber-400`,children:`${n.lastRunError}: ${r.errorMessage}`}):null,t[19]=r.errorMessage,t[20]=n.lastRunError,t[21]=y):y=t[21];let b;t[22]!==n.lastRunReason||t[23]!==v||t[24]!==y?(b=(0,J.jsxs)(Q,{label:n.lastRunReason,className:`col-span-2 sm:col-span-3 lg:col-span-4`,children:[v,y]}),t[22]=n.lastRunReason,t[23]=v,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==i||t[27]!==n.lastRunSkipContaminated||t[28]!==n.lastRunSkipHash||t[29]!==n.lastRunSkipKey||t[30]!==n.lastRunSkipRehydrate?(x=i?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:n.lastRunSkipKey,children:String(i.alreadyPromotedKey)}),(0,J.jsx)(Q,{label:n.lastRunSkipRehydrate,children:String(i.rehydrateFailed)}),(0,J.jsx)(Q,{label:n.lastRunSkipContaminated,children:String(i.contaminated)}),(0,J.jsx)(Q,{label:n.lastRunSkipHash,children:String(i.hashDuplicate)})]}):null,t[26]=i,t[27]=n.lastRunSkipContaminated,t[28]=n.lastRunSkipHash,t[29]=n.lastRunSkipKey,t[30]=n.lastRunSkipRehydrate,t[31]=x):x=t[31];let S;return t[32]!==m||t[33]!==_||t[34]!==b||t[35]!==x||t[36]!==c||t[37]!==d?(S=(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3 lg:grid-cols-4`,children:[c,d,m,_,b,x]}),t[32]=m,t[33]=_,t[34]=b,t[35]=x,t[36]=c,t[37]=d,t[38]=S):S=t[38],S}function ge(e){let t=(0,F.c)(58),{t:n,schedulePickerLabels:r,hasToken:a,cfgForm:o,cfgBaseline:s,cfgSaving:c,cfgDirty:l,setCfgForm:u,setCfgOk:d,setCfgError:f,saveConfig:p}=e,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=i(`min-w-0`,G),t[0]=h):h=t[0];let g=!a||!o||c||!l,_;t[1]===p?_=t[2]:(_=()=>void p(),t[1]=p,t[2]=_);let y;t[3]===c?y=t[4]:(y=c?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,t[3]=c,t[4]=y);let b;t[5]!==n.saveConfig||t[6]!==g||t[7]!==_||t[8]!==y?(b=(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:g,onClick:_,children:[y,n.saveConfig]}),t[5]=n.saveConfig,t[6]=g,t[7]=_,t[8]=y,t[9]=b):b=t[9];let x=!a||!o||c||!l,E;t[10]!==s||t[11]!==f||t[12]!==u||t[13]!==d?(E=()=>{d(!1),f(null),u(s)},t[10]=s,t[11]=f,t[12]=u,t[13]=d,t[14]=E):E=t[14];let D;t[15]!==n.resetConfig||t[16]!==x||t[17]!==E?(D=(0,J.jsx)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:x,onClick:E,children:n.resetConfig}),t[15]=n.resetConfig,t[16]=x,t[17]=E,t[18]=D):D=t[18];let O;t[19]!==b||t[20]!==D?(O=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,D]}),t[19]=b,t[20]=D,t[21]=O):O=t[21];let k;t[22]!==n.configHint||t[23]!==n.configTitle||t[24]!==O?(k=(0,J.jsx)(ee,{className:ce,icon:T,title:n.configTitle,subtitle:n.configHint,trailing:O}),t[22]=n.configHint,t[23]=n.configTitle,t[24]=O,t[25]=k):k=t[25];let j;t[26]!==o||t[27]!==c||t[28]!==a||t[29]!==r||t[30]!==u||t[31]!==n.configDeepHalfLife||t[32]!==n.configDeepLimit||t[33]!==n.configDeepMaxAge||t[34]!==n.configDeepMinRecallCount||t[35]!==n.configDeepMinScore||t[36]!==n.configFrequency||t[37]!==n.configLightDedupe||t[38]!==n.configLightLimit||t[39]!==n.configLightLookbackDays||t[40]!==n.configLoading||t[41]!==n.configPhaseCron||t[42]!==n.configPhaseDeep||t[43]!==n.configPhaseDeepHint||t[44]!==n.configPhaseLight||t[45]!==n.configPhaseLightHint||t[46]!==n.configPhaseRem||t[47]!==n.configPhaseRemHint||t[48]!==n.configRemLimit||t[49]!==n.configRemLookbackDays||t[50]!==n.configRemMinStrength||t[51]!==n.configTimezone||t[52]!==n.off||t[53]!==n.on?(j=o?(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(`div`,{className:K,children:(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 lg:grid-cols-12`,children:[(0,J.jsx)(`div`,{className:`lg:col-span-9`,children:(0,J.jsx)(M,{kind:`cron`,label:n.configFrequency,value:o.frequency,onChange:e=>u(t=>t&&{...t,frequency:e}),labels:r,disabled:!a||c})}),(0,J.jsx)(Z,{label:n.configTimezone,className:`lg:col-span-3`,children:(0,J.jsx)(`input`,{className:q,value:o.timezone,disabled:!a||c,onChange:e=>u(t=>t&&{...t,timezone:e.target.value}),placeholder:`Asia/Shanghai`})})]})}),(0,J.jsxs)(fe,{icon:(0,J.jsx)(m,{className:`size-4 text-amber-500`}),title:n.configPhaseLight,hint:n.configPhaseLightHint,enabled:o.light.enabled,onEnabledChange:e=>u(t=>t&&{...t,light:{...t.light,enabled:e}}),cron:o.light.cron,onCronChange:e=>u(t=>t&&{...t,light:{...t.light,cron:e}}),scheduleLabels:r,disabled:!a||c,onLabel:n.on,offLabel:n.off,cronLabel:n.configPhaseCron,children:[(0,J.jsx)(Z,{label:n.configLightLookbackDays,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.light.lookbackDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,light:{...t.light,lookbackDays:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configLightLimit,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:0,className:q,value:o.light.limit,disabled:!a||c,onChange:e=>u(t=>t&&{...t,light:{...t.light,limit:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configLightDedupe,children:(0,J.jsx)(`input`,{type:`number`,step:`0.01`,min:0,max:1,className:q,value:o.light.dedupeSimilarity,disabled:!a||c,onChange:e=>u(t=>t&&{...t,light:{...t.light,dedupeSimilarity:Number(e.target.value)}})})})]}),(0,J.jsxs)(fe,{icon:(0,J.jsx)(v,{className:`size-4 text-indigo-500`}),title:n.configPhaseDeep,hint:n.configPhaseDeepHint,enabled:o.deep.enabled,onEnabledChange:e=>u(t=>t&&{...t,deep:{...t.deep,enabled:e}}),cron:o.deep.cron,onCronChange:e=>u(t=>t&&{...t,deep:{...t.deep,cron:e}}),scheduleLabels:r,disabled:!a||c,onLabel:n.on,offLabel:n.off,cronLabel:n.configPhaseCron,children:[(0,J.jsx)(Z,{label:n.configDeepMinScore,children:(0,J.jsx)(`input`,{type:`number`,step:`0.01`,min:0,max:1,className:q,value:o.deep.minScore,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,minScore:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepMinRecallCount,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.deep.minRecallCount,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,minRecallCount:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepLimit,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:0,className:q,value:o.deep.limit,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,limit:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepHalfLife,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.deep.recencyHalfLifeDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,recencyHalfLifeDays:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configDeepMaxAge,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.deep.maxAgeDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,deep:{...t.deep,maxAgeDays:Number(e.target.value)}})})})]}),(0,J.jsxs)(fe,{icon:(0,J.jsx)(w,{className:`size-4 text-purple-500`}),title:n.configPhaseRem,hint:n.configPhaseRemHint,enabled:o.rem.enabled,onEnabledChange:e=>u(t=>t&&{...t,rem:{...t.rem,enabled:e}}),cron:o.rem.cron,onCronChange:e=>u(t=>t&&{...t,rem:{...t.rem,cron:e}}),scheduleLabels:r,disabled:!a||c,onLabel:n.on,offLabel:n.off,cronLabel:n.configPhaseCron,children:[(0,J.jsx)(Z,{label:n.configRemLookbackDays,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:1,className:q,value:o.rem.lookbackDays,disabled:!a||c,onChange:e=>u(t=>t&&{...t,rem:{...t.rem,lookbackDays:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configRemLimit,children:(0,J.jsx)(`input`,{type:`number`,step:`1`,min:0,className:q,value:o.rem.limit,disabled:!a||c,onChange:e=>u(t=>t&&{...t,rem:{...t.rem,limit:Number(e.target.value)}})})}),(0,J.jsx)(Z,{label:n.configRemMinStrength,children:(0,J.jsx)(`input`,{type:`number`,step:`0.01`,min:0,max:1,className:q,value:o.rem.minPatternStrength,disabled:!a||c,onChange:e=>u(t=>t&&{...t,rem:{...t.rem,minPatternStrength:Number(e.target.value)}})})})]})]}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.configLoading}),t[26]=o,t[27]=c,t[28]=a,t[29]=r,t[30]=u,t[31]=n.configDeepHalfLife,t[32]=n.configDeepLimit,t[33]=n.configDeepMaxAge,t[34]=n.configDeepMinRecallCount,t[35]=n.configDeepMinScore,t[36]=n.configFrequency,t[37]=n.configLightDedupe,t[38]=n.configLightLimit,t[39]=n.configLightLookbackDays,t[40]=n.configLoading,t[41]=n.configPhaseCron,t[42]=n.configPhaseDeep,t[43]=n.configPhaseDeepHint,t[44]=n.configPhaseLight,t[45]=n.configPhaseLightHint,t[46]=n.configPhaseRem,t[47]=n.configPhaseRemHint,t[48]=n.configRemLimit,t[49]=n.configRemLookbackDays,t[50]=n.configRemMinStrength,t[51]=n.configTimezone,t[52]=n.off,t[53]=n.on,t[54]=j):j=t[54];let N;return t[55]!==k||t[56]!==j?(N=(0,J.jsxs)(A,{className:h,children:[k,j]}),t[55]=k,t[56]=j,t[57]=N):N=t[57],N}function _e(e){let t=(0,F.c)(20),{t:n,hasToken:r,eventsLoading:i,events:a,loadEvents:o}=e,s=!r||i,c;t[0]===o?c=t[1]:(c=()=>void o(),t[0]=o,t[1]=c);let l;t[2]===i?l=t[3]:(l=i?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,t[2]=i,t[3]=l);let u;t[4]!==n.eventsLoad||t[5]!==s||t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:s,onClick:c,children:[l,n.eventsLoad]}),t[4]=n.eventsLoad,t[5]=s,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==n.eventsHint||t[10]!==n.eventsTitle||t[11]!==u?(d=(0,J.jsx)(ee,{className:ce,icon:O,title:n.eventsTitle,subtitle:n.eventsHint,trailing:u}),t[9]=n.eventsHint,t[10]=n.eventsTitle,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==a||t[14]!==n.eventsEmpty||t[15]!==n.eventsNotLoaded?(f=a?a.length>0?(0,J.jsx)(`div`,{className:`space-y-1.5`,children:a.map(ve)}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.eventsEmpty}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.eventsNotLoaded}),t[13]=a,t[14]=n.eventsEmpty,t[15]=n.eventsNotLoaded,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,J.jsxs)(A,{className:G,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function ve(e){let t=e.phase===`light`?`☀️`:e.phase===`rem`?`✨`:`🌙`,n=e.phase===`light`?`scanned=${e.scannedEntries??0} new=${e.newSignals??0} deduped=${e.deduped??0}`:e.phase===`rem`?`patterns=${e.patternsDiscovered??0} analyzed=${e.entriesAnalyzed??0}`:`candidates=${e.candidates??0} applied=${e.applied??0}`;return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 text-xs`,children:[(0,J.jsx)(`span`,{children:t}),(0,J.jsx)(`span`,{className:`font-medium text-fg`,children:e.phase}),(0,J.jsx)(`span`,{className:i(`font-medium`,e.ok?`text-emerald-600 dark:text-emerald-400`:`text-amber-600 dark:text-amber-400`),children:e.ok?`OK`:`FAIL`}),(0,J.jsx)(`span`,{className:`text-fg-muted`,children:n}),(0,J.jsx)(`span`,{className:`text-fg-muted`,children:ue(e.durationMs)}),(0,J.jsx)(`span`,{className:`ml-auto text-fg-subtle`,children:le(e.timestamp)})]},`${e.timestamp}:${e.phase}`)}function ye(e){let t=(0,F.c)(40),{t:n,cfgForm:r,dreamingEnabled:a,hasToken:o,cfgSaving:s,enableSaving:c,runPhase:l,setRunPhase:u,runBusy:d,doRunNow:f,doRefresh:p,setDreamingEnabled:m}=e,h;t[0]===n.title?h=t[1]:(h=(0,J.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=h);let g;t[2]===n.subtitle?g=t[3]:(g=(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle}),t[2]=n.subtitle,t[3]=g);let v;t[4]!==h||t[5]!==g?(v=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[4]=h,t[5]=g,t[6]=v):v=t[6];let b;t[7]!==r||t[8]!==s||t[9]!==a||t[10]!==c||t[11]!==o||t[12]!==m||t[13]!==n.configEnabled||t[14]!==n.off||t[15]!==n.on?(b=r?(0,J.jsxs)(`label`,{className:i(`inline-flex cursor-pointer items-center gap-2 rounded-xl border px-3 py-1.5 text-sm transition-colors`,a?`border-emerald-500/30 bg-emerald-500/5 text-fg`:`border-edge-subtle bg-surface-panel/50 text-fg-muted`),children:[(0,J.jsx)(`span`,{className:`text-xs font-medium`,children:n.configEnabled}),(0,J.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,disabled:!o||s||c,onChange:e=>void m(e.target.checked)}),c?(0,J.jsx)(C,{className:`size-3.5 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,J.jsx)(`span`,{className:i(`text-xs font-semibold`,a?`text-emerald-600 dark:text-emerald-400`:``),children:r.enabled?n.on:n.off})]}):null,t[7]=r,t[8]=s,t[9]=a,t[10]=c,t[11]=o,t[12]=m,t[13]=n.configEnabled,t[14]=n.off,t[15]=n.on,t[16]=b):b=t[16];let x;t[17]!==f||t[18]!==a||t[19]!==o||t[20]!==d||t[21]!==l||t[22]!==u||t[23]!==n.runNow||t[24]!==n.runNowHint?(x=a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`select`,{className:`rounded-lg border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`,value:l,onChange:e=>u(e.target.value),disabled:!o||d,children:[(0,J.jsx)(`option`,{value:`light`,children:`Light`}),(0,J.jsx)(`option`,{value:`deep`,children:`Deep`}),(0,J.jsx)(`option`,{value:`rem`,children:`REM`})]}),(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:!o||d,onClick:()=>void f(l),title:n.runNowHint,children:[d?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(_,{className:`mr-2 size-4`,"aria-hidden":!0}),n.runNow]})]}):null,t[17]=f,t[18]=a,t[19]=o,t[20]=d,t[21]=l,t[22]=u,t[23]=n.runNow,t[24]=n.runNowHint,t[25]=x):x=t[25];let w=!o,T;t[26]===p?T=t[27]:(T=()=>void p(),t[26]=p,t[27]=T);let E;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,J.jsx)(y,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[28]=E):E=t[28];let D;t[29]!==n.refresh||t[30]!==w||t[31]!==T?(D=(0,J.jsx)(S,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:w,title:n.refresh,"aria-label":n.refresh,onClick:T,children:E}),t[29]=n.refresh,t[30]=w,t[31]=T,t[32]=D):D=t[32];let O;t[33]!==b||t[34]!==x||t[35]!==D?(O=(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:[b,x,D]}),t[33]=b,t[34]=x,t[35]=D,t[36]=O):O=t[36];let k;return t[37]!==O||t[38]!==v?(k=(0,J.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[v,O]}),t[37]=O,t[38]=v,t[39]=k):k=t[39],k}function be(e){let t=(0,F.c)(30),{t:n,disabled:r,actionBusy:a,doAction:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-2xl`,G),t[0]=s):s=t[0];let c;t[1]!==n.maintenanceHint||t[2]!==n.maintenanceTitle?(c=(0,J.jsx)(ee,{className:ce,icon:g,title:n.maintenanceTitle,subtitle:n.maintenanceHint}),t[1]=n.maintenanceHint,t[2]=n.maintenanceTitle,t[3]=c):c=t[3];let l;t[4]!==o||t[5]!==n.confirmResetStore?(l=()=>{confirm(n.confirmResetStore)&&o(`reset_store`)},t[4]=o,t[5]=n.confirmResetStore,t[6]=l):l=t[6];let u;t[7]===a?u=t[8]:(u=a===`reset_store`?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(p,{className:`mr-2 size-4`,"aria-hidden":!0}),t[7]=a,t[8]=u);let d;t[9]!==r||t[10]!==n.resetStore||t[11]!==l||t[12]!==u?(d=(0,J.jsxs)(S,{variant:`secondary`,disabled:r,onClick:l,children:[u,n.resetStore]}),t[9]=r,t[10]=n.resetStore,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==o||t[15]!==n.confirmClearLock?(f=()=>{confirm(n.confirmClearLock)&&o(`clear_lock`)},t[14]=o,t[15]=n.confirmClearLock,t[16]=f):f=t[16];let m;t[17]===a?m=t[18]:(m=a===`clear_lock`?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(h,{className:`mr-2 size-4`,"aria-hidden":!0}),t[17]=a,t[18]=m);let _;t[19]!==r||t[20]!==n.clearLock||t[21]!==f||t[22]!==m?(_=(0,J.jsxs)(S,{variant:`secondary`,disabled:r,onClick:f,children:[m,n.clearLock]}),t[19]=r,t[20]=n.clearLock,t[21]=f,t[22]=m,t[23]=_):_=t[23];let v;t[24]!==d||t[25]!==_?(v=(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[d,_]}),t[24]=d,t[25]=_,t[26]=v):v=t[26];let y;return t[27]!==c||t[28]!==v?(y=(0,J.jsxs)(A,{className:s,children:[c,v]}),t[27]=c,t[28]=v,t[29]=y):y=t[29],y}function xe(e){let t=(0,F.c)(21),{t:n,hasToken:r,previewLoading:i,previewItems:a,loadPreview:o}=e,s=!r||i,c;t[0]===o?c=t[1]:(c=()=>void o(),t[0]=o,t[1]=c);let l;t[2]===i?l=t[3]:(l=i?(0,J.jsx)(C,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,t[2]=i,t[3]=l);let u;t[4]!==n.previewLoad||t[5]!==s||t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(S,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:s,onClick:c,children:[l,n.previewLoad]}),t[4]=n.previewLoad,t[5]=s,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==n.previewHint||t[10]!==n.previewTitle||t[11]!==u?(d=(0,J.jsx)(ee,{className:ce,icon:x,title:n.previewTitle,subtitle:n.previewHint,trailing:u}),t[9]=n.previewHint,t[10]=n.previewTitle,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==a||t[14]!==n.previewEligible||t[15]!==n.previewEmpty||t[16]!==n.previewNotLoaded?(f=a?a.length>0?(0,J.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>{let t=`${e.path}:${e.startLine}-${e.endLine}`,r=e.skippedReason;return(0,J.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel/60 px-2.5 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,J.jsxs)(`span`,{children:[`score=`,e.score.toFixed(3)]}),(0,J.jsxs)(`span`,{children:[`recalls=`,e.recallCount]}),(0,J.jsxs)(`span`,{children:[`avg=`,e.avgScore.toFixed(3)]}),(0,J.jsxs)(`span`,{children:[`decay=`,e.recencyDecay?.toFixed(3)??`—`]}),r?(0,J.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:r}):(0,J.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:n.previewEligible})]}),e.snippet?(0,J.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:e.snippet}):null]},`${e.key}:${e.hash}:${t}`)})}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.previewEmpty}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.previewNotLoaded}),t[13]=a,t[14]=n.previewEligible,t[15]=n.previewEmpty,t[16]=n.previewNotLoaded,t[17]=f):f=t[17];let p;return t[18]!==d||t[19]!==f?(p=(0,J.jsxs)(A,{className:G,children:[d,f]}),t[18]=d,t[19]=f,t[20]=p):p=t[20],p}function Se(e){let t=(0,F.c)(12),n;t[0]!==e.expression||t[1]!==e.kind||t[2]!==e.labels||t[3]!==e.locale||t[4]!==e.nextRun||t[5]!==e.presetLabels||t[6]!==e.timezone||t[7]!==e.valueMs?(n=e.kind===`cron`?j(e.expression,e.locale,e.labels,{timezone:e.timezone,nextRun:e.nextRun}):N(e.valueMs,e.locale,e.presetLabels),t[0]=e.expression,t[1]=e.kind,t[2]=e.labels,t[3]=e.locale,t[4]=e.nextRun,t[5]=e.presetLabels,t[6]=e.timezone,t[7]=e.valueMs,t[8]=n):n=t[8];let r=n,i;return t[9]!==e.className||t[10]!==r?(i=(0,J.jsx)(`span`,{className:e.className,children:r}),t[9]=e.className,t[10]=r,t[11]=i):i=t[11],i}function Ce(e){let t=(0,F.c)(100),{t:n,data:r,isLoading:a,localeTag:o,scheduleBadgeLabels:s}=e,c;t[0]!==r||t[1]!==n?(c=r?de(r.lock,n):null,t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`min-w-0`,G),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a?(0,J.jsx)(C,{className:`size-4 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):null,t[4]=a,t[5]=d);let f;t[6]!==n.runtimeHint||t[7]!==n.runtimeTitle||t[8]!==d?(f=(0,J.jsx)(ee,{className:ce,icon:O,title:n.runtimeTitle,subtitle:n.runtimeHint,trailing:d}),t[6]=n.runtimeHint,t[7]=n.runtimeTitle,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n.subsectionSchedule?p=t[11]:(p=(0,J.jsx)($,{label:n.subsectionSchedule,className:`mb-2`}),t[10]=n.subsectionSchedule,t[11]=p);let h=r?r.config.enabled?n.on:n.off:`—`,g;t[12]!==n.enabled||t[13]!==h?(g=(0,J.jsx)(Q,{label:n.enabled,children:h}),t[12]=n.enabled,t[13]=h,t[14]=g):g=t[14];let _=l?.className,y=l?l.text:`—`,b;t[15]!==_||t[16]!==y?(b=(0,J.jsx)(`span`,{className:_,children:y}),t[15]=_,t[16]=y,t[17]=b):b=t[17];let x;t[18]!==n.lock||t[19]!==b?(x=(0,J.jsx)(Q,{label:n.lock,children:b}),t[18]=n.lock,t[19]=b,t[20]=x):x=t[20];let S=r&&r.config.timezone||`—`,T;t[21]!==n.timezone||t[22]!==S?(T=(0,J.jsx)(Q,{label:n.timezone,children:S}),t[21]=n.timezone,t[22]=S,t[23]=T):T=t[23];let E;t[24]!==r||t[25]!==o||t[26]!==s?(E=r?(0,J.jsx)(Se,{kind:`cron`,expression:r.config.frequency,locale:o,labels:s,timezone:r.config.timezone||void 0}):`—`,t[24]=r,t[25]=o,t[26]=s,t[27]=E):E=t[27];let D;t[28]===r?D=t[29]:(D=r?.config.frequency?(0,J.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[0.65rem] text-fg-subtle`,title:r.config.frequency,children:r.config.frequency}):null,t[28]=r,t[29]=D);let k;t[30]!==n.schedule||t[31]!==E||t[32]!==D?(k=(0,J.jsxs)(Q,{label:n.schedule,className:`col-span-2 sm:col-span-2`,children:[E,D]}),t[30]=n.schedule,t[31]=E,t[32]=D,t[33]=k):k=t[33];let M;t[34]!==x||t[35]!==T||t[36]!==k||t[37]!==g?(M=(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-4`,children:[g,x,T,k]}),t[34]=x,t[35]=T,t[36]=k,t[37]=g,t[38]=M):M=t[38];let N;t[39]!==M||t[40]!==p?(N=(0,J.jsxs)(`div`,{className:K,children:[p,M]}),t[39]=M,t[40]=p,t[41]=N):N=t[41];let P;t[42]===n.subsectionStore?P=t[43]:(P=(0,J.jsx)($,{label:n.subsectionStore,className:`mb-2`}),t[42]=n.subsectionStore,t[43]=P);let te=r?String(r.store.entryCount):`—`,ne;t[44]!==n.storeEntries||t[45]!==te?(ne=(0,J.jsx)(Q,{label:n.storeEntries,children:te}),t[44]=n.storeEntries,t[45]=te,t[46]=ne):ne=t[46];let re=r?String(r.store.promotedCount):`—`,ie;t[47]!==n.storePromoted||t[48]!==re?(ie=(0,J.jsx)(Q,{label:n.storePromoted,children:re}),t[47]=n.storePromoted,t[48]=re,t[49]=ie):ie=t[49];let I;t[50]===r?I=t[51]:(I=r?le(r.store.updatedAt):`—`,t[50]=r,t[51]=I);let ae;t[52]!==n.storeUpdatedAt||t[53]!==I?(ae=(0,J.jsx)(Q,{label:n.storeUpdatedAt,children:I}),t[52]=n.storeUpdatedAt,t[53]=I,t[54]=ae):ae=t[54];let L;t[55]===r?L=t[56]:(L=r?le(r.store.lastPromotedAt):`—`,t[55]=r,t[56]=L);let R;t[57]!==n.storeLastPromotedAt||t[58]!==L?(R=(0,J.jsx)(Q,{label:n.storeLastPromotedAt,children:L}),t[57]=n.storeLastPromotedAt,t[58]=L,t[59]=R):R=t[59];let z;t[60]!==ne||t[61]!==ie||t[62]!==ae||t[63]!==R?(z=(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-4`,children:[ne,ie,ae,R]}),t[60]=ne,t[61]=ie,t[62]=ae,t[63]=R,t[64]=z):z=t[64];let B;t[65]!==P||t[66]!==z?(B=(0,J.jsxs)(`div`,{className:K,children:[P,z]}),t[65]=P,t[66]=z,t[67]=B):B=t[67];let V;t[68]!==r||t[69]!==o||t[70]!==s||t[71]!==n?(V=r?.config?.phases?(0,J.jsxs)(`div`,{children:[(0,J.jsx)($,{label:n.subsectionPhases,className:`mb-2`}),(0,J.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,J.jsx)(pe,{icon:(0,J.jsx)(m,{className:`size-4 text-amber-500`}),label:`Light`,enabled:r.config.phases.light.enabled,cron:r.config.phases.light.cron,scheduleSummary:j(r.config.phases.light.cron,o,s,{timezone:r.config.timezone||void 0}),details:`lookback=${r.config.phases.light.lookbackDays}d, limit=${r.config.phases.light.limit}, dedupe=${r.config.phases.light.dedupeSimilarity}`,t:n}),(0,J.jsx)(pe,{icon:(0,J.jsx)(v,{className:`size-4 text-indigo-500`}),label:`Deep`,enabled:r.config.phases.deep.enabled,cron:r.config.phases.deep.cron,scheduleSummary:j(r.config.phases.deep.cron,o,s,{timezone:r.config.timezone||void 0}),details:`minScore=${r.config.phases.deep.minScore}, recalls≥${r.config.phases.deep.minRecallCount}, limit=${r.config.phases.deep.limit}, halfLife=${r.config.phases.deep.recencyHalfLifeDays}d`,t:n}),(0,J.jsx)(pe,{icon:(0,J.jsx)(w,{className:`size-4 text-purple-500`}),label:`REM`,enabled:r.config.phases.rem.enabled,cron:r.config.phases.rem.cron,scheduleSummary:j(r.config.phases.rem.cron,o,s,{timezone:r.config.timezone||void 0}),details:`lookback=${r.config.phases.rem.lookbackDays}d, limit=${r.config.phases.rem.limit}, strength≥${r.config.phases.rem.minPatternStrength}`,t:n})]})]}):null,t[68]=r,t[69]=o,t[70]=s,t[71]=n,t[72]=V):V=t[72];let H;t[73]===n.subsectionLastRun?H=t[74]:(H=(0,J.jsx)($,{label:n.subsectionLastRun,className:`mb-2`}),t[73]=n.subsectionLastRun,t[74]=H);let U;t[75]===n.lastRunBlockHint?U=t[76]:(U=(0,J.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:n.lastRunBlockHint}),t[75]=n.lastRunBlockHint,t[76]=U);let W;t[77]!==r||t[78]!==n?(W=r?.lastRun?.exists?(0,J.jsxs)(`div`,{className:`space-y-2`,children:[r.lastRun.parseError?(0,J.jsxs)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:[n.lastRunParseError,`: `,r.lastRun.parseError]}):null,r.lastRun.record?(0,J.jsx)(`div`,{className:`rounded-lg border border-edge-subtle/80 bg-surface-panel/50 p-2.5`,children:(0,J.jsx)(he,{t:n,r:r.lastRun.record})}):null,r.lastRun.raw!==void 0&&r.lastRun.raw!==null?(0,J.jsxs)(`details`,{className:`group rounded-lg border border-edge-subtle`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer list-none px-2.5 py-1.5 text-xs font-medium text-fg-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:(0,J.jsx)(`span`,{className:`underline decoration-edge underline-offset-2 group-open:text-fg`,children:n.lastRunRaw})}),(0,J.jsx)(`pre`,{className:`max-h-40 overflow-auto border-t border-edge-subtle p-2.5 text-xs text-fg-muted`,children:JSON.stringify(r.lastRun.raw,null,2)})]}):null]}):(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.lastRunEmpty}),t[77]=r,t[78]=n,t[79]=W):W=t[79];let oe;t[80]!==H||t[81]!==U||t[82]!==W?(oe=(0,J.jsxs)(`div`,{className:K,children:[H,U,W]}),t[80]=H,t[81]=U,t[82]=W,t[83]=oe):oe=t[83];let se=r?.lightLastRun,q;t[84]!==n||t[85]!==se?(q=(0,J.jsx)(me,{label:n.subsectionLightLastRun,lastRun:se,t:n}),t[84]=n,t[85]=se,t[86]=q):q=t[86];let ue=r?.remLastRun,Y;t[87]!==n||t[88]!==ue?(Y=(0,J.jsx)(me,{label:n.subsectionRemLastRun,lastRun:ue,t:n}),t[87]=n,t[88]=ue,t[89]=Y):Y=t[89];let X;t[90]!==N||t[91]!==B||t[92]!==V||t[93]!==oe||t[94]!==q||t[95]!==Y?(X=(0,J.jsxs)(`div`,{className:`space-y-3`,children:[N,B,V,oe,q,Y]}),t[90]=N,t[91]=B,t[92]=V,t[93]=oe,t[94]=q,t[95]=Y,t[96]=X):X=t[96];let Z;return t[97]!==X||t[98]!==f?(Z=(0,J.jsxs)(A,{className:u,children:[f,X]}),t[97]=X,t[98]=f,t[99]=Z):Z=t[99],Z}var we=[`config`,`runtime`,`insights`,`maintenance`],Te={config:T,runtime:O,insights:x,maintenance:g};function Ee(e){return e&&we.includes(e)?e:`config`}function De(e,t){return t===`config`?e.tabConfig:t===`runtime`?e.tabRuntime:t===`insights`?e.tabInsights:e.tabMaintenance}function Oe(e,t){return t===`config`?e.configTabHint:t===`runtime`?e.runtimeTabHint:t===`insights`?e.insightsTabHint:e.maintenanceTabHint}function ke(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:return{form:t.value,baseline:t.value};case`set`:return{...e,form:t.value};case`saved`:return{form:t.value,baseline:t.value}}}var Ae={actionBusy:null,actionError:null,actionOk:!1,runBusy:!1,runOk:!1,runError:null,runPhase:`deep`,cfgSaving:!1,enableSaving:!1,cfgOk:!1,cfgError:null,previewLoading:!1,previewError:null,previewItems:null,eventsLoading:!1,eventsError:null,events:null};function je(){let e=o(e=>e.language),t=a(e),n=t.dreamingSettings,r=t.cron.schedulePicker,i=t.cron.scheduleBadge,c=e===`zh`?`zh-CN`:`en-US`,l=!!s(e=>e.token),[p,m]=f(),h=Ee(p.get(`tab`)),g=(0,P.useCallback)(e=>{m(t=>{let n=new URLSearchParams(t);return e===`config`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[m]),{data:_}=b(l),[v,y]=(0,P.useReducer)(d,Ae),{actionBusy:x,actionError:S,actionOk:C,runBusy:w,runOk:T,runError:E,runPhase:D,cfgSaving:O,enableSaving:k,cfgOk:ee,cfgError:A,previewLoading:j,previewError:M,previewItems:N,eventsLoading:F,eventsError:L,events:R}=v,[z,B]=(0,P.useReducer)(ke,{form:null,baseline:null}),V=z.form,H=z.baseline,U=(0,P.useRef)(!1),{data:W,error:G,isLoading:ce,mutate:K}=u(l?te():null,ne,{revalidateOnFocus:!1}),q=(0,P.useMemo)(()=>{let e=[];return G&&e.push(G instanceof Error?G.message:String(G)),S&&e.push(S),E&&e.push(E),M&&e.push(M),L&&e.push(L),A&&e.push(A),e},[G,S,E,M,L,A]),le=(0,P.useMemo)(()=>{let e=[];return ee&&e.push(n.configSaved),T&&e.push(n.runQueued),C&&e.push(n.actionOk),e},[ee,T,C,n]),ue=(0,P.useCallback)(async()=>{y({type:`patch`,patch:{actionOk:!1,actionError:null,runOk:!1,runError:null,cfgOk:!1,cfgError:null,previewError:null}}),await K()},[K]),de=(0,P.useCallback)(async()=>{y({type:`patch`,patch:{previewLoading:!0,previewError:null}});try{y({type:`patch`,patch:{previewItems:(await I(20)).items??[]}})}catch(e){y({type:`patch`,patch:{previewError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{previewLoading:!1}})}},[]),Y=(0,P.useCallback)(async()=>{y({type:`patch`,patch:{eventsLoading:!0,eventsError:null}});try{y({type:`patch`,patch:{events:await ae(50)}})}catch(e){y({type:`patch`,patch:{eventsError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{eventsLoading:!1}})}},[]),X=(0,P.useCallback)(async(e=`deep`)=>{y({type:`patch`,patch:{runBusy:!0,runOk:!1,runError:null}});try{await ie(e),y({type:`patch`,patch:{runOk:!0}}),await K()}catch(e){y({type:`patch`,patch:{runError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{runBusy:!1}})}},[K]),Z=(0,P.useCallback)(async e=>{y({type:`patch`,patch:{actionBusy:e,actionError:null,actionOk:!1}});try{await re(e),y({type:`patch`,patch:{actionOk:!0}}),await K()}catch(e){y({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{actionBusy:null}})}},[K]),Q=!l||ce||!!x,$=(0,P.useMemo)(()=>{let e=_?.payload?.config;return oe(e??{})},[_]);(0,P.useEffect)(()=>{if(!l){B({type:`reset`}),U.current=!1;return}U.current||B({type:`sync`,value:$})},[$,l]);let fe=(0,P.useMemo)(()=>!V||!H?!1:JSON.stringify(V)!==JSON.stringify(H),[V,H]),pe=(0,P.useCallback)(async()=>{if(V){y({type:`patch`,patch:{cfgSaving:!0,cfgOk:!1,cfgError:null}});try{await se(V),B({type:`saved`,value:V}),U.current=!1,y({type:`patch`,patch:{cfgOk:!0}}),await K()}catch(e){y({type:`patch`,patch:{cfgError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{cfgSaving:!1}})}}},[V,K]),me=(0,P.useCallback)(async e=>{if(!V||!l)return;let t={...V,enabled:e},n=V;U.current=!0,B({type:`set`,value:t}),y({type:`patch`,patch:{enableSaving:!0,cfgOk:!1,cfgError:null}});try{await se(t),B({type:`saved`,value:t}),U.current=!1,y({type:`patch`,patch:{cfgOk:!0}}),await K()}catch(e){B({type:`set`,value:n}),y({type:`patch`,patch:{cfgError:e instanceof Error?e.message:String(e)}})}finally{y({type:`patch`,patch:{enableSaving:!1}})}},[V,l,K]);return(0,J.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-4 px-4 py-6`,children:[(0,J.jsx)(ye,{t:n,cfgForm:V,dreamingEnabled:V?.enabled??$.enabled,hasToken:l,cfgSaving:O,enableSaving:k,runPhase:D,setRunPhase:e=>y({type:`patch`,patch:{runPhase:e}}),runBusy:w,doRunNow:X,doRefresh:ue,setDreamingEnabled:me}),q.length>0?(0,J.jsx)(`div`,{className:`space-y-1.5 rounded-2xl border border-amber-500/20 bg-amber-500/5 px-4 py-3`,role:`alert`,children:q.map(e=>(0,J.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200/90`,children:e},e))}):null,le.length>0?(0,J.jsx)(`div`,{className:`space-y-1.5 rounded-2xl border border-emerald-500/20 bg-emerald-500/5 px-4 py-3`,role:`status`,children:le.map(e=>(0,J.jsx)(`p`,{className:`text-sm text-emerald-800 dark:text-emerald-200/90`,children:e},e))}):null,(0,J.jsx)(Me,{t:n,activeTab:h,onChange:g}),(0,J.jsx)(Ne,{t:n,id:`config`,activeTab:h,children:(0,J.jsx)(ge,{t:n,schedulePickerLabels:r,hasToken:l,cfgForm:V,cfgBaseline:H,cfgSaving:O,cfgDirty:fe,setCfgForm:e=>{U.current=!0;let t=typeof e==`function`?e(V):e;t&&B({type:`set`,value:t})},setCfgOk:e=>y({type:`patch`,patch:{cfgOk:e}}),setCfgError:e=>y({type:`patch`,patch:{cfgError:e}}),saveConfig:pe})}),(0,J.jsx)(Ne,{t:n,id:`runtime`,activeTab:h,children:(0,J.jsx)(Ce,{t:n,data:W,isLoading:ce,localeTag:c,scheduleBadgeLabels:i})}),(0,J.jsx)(Ne,{t:n,id:`insights`,activeTab:h,children:(0,J.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,J.jsx)(xe,{t:n,hasToken:l,previewLoading:j,previewItems:N,loadPreview:de}),(0,J.jsx)(_e,{t:n,hasToken:l,eventsLoading:F,events:R,loadEvents:Y})]})}),(0,J.jsx)(Ne,{t:n,id:`maintenance`,activeTab:h,children:(0,J.jsx)(be,{t:n,disabled:Q,actionBusy:x,doAction:Z})})]})}function Me(e){let t=(0,F.c)(11),{t:n,activeTab:r,onChange:a}=e,o=n.tabsAriaLabel,s;t[0]!==r||t[1]!==a?(s=e=>{e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||(e.preventDefault(),a(we[(we.indexOf(r)+(e.key===`ArrowRight`?1:-1)+we.length)%we.length]))},t[0]=r,t[1]=a,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==a||t[5]!==n?(c=we.map(e=>{let t=Te[e],o=e===r;return(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o,id:`dreaming-settings-tab-${e}`,"aria-controls":`dreaming-settings-panel-${e}`,className:i(`inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,D.press,o?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>a(e),children:[(0,J.jsx)(t,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:De(n,e)})]},e)}),t[3]=r,t[4]=a,t[5]=n,t[6]=c):c=t[6];let l;return t[7]!==n.tabsAriaLabel||t[8]!==s||t[9]!==c?(l=(0,J.jsx)(`nav`,{"aria-label":o,className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,role:`tablist`,onKeyDown:s,children:c}),t[7]=n.tabsAriaLabel,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Ne(e){let t=(0,F.c)(18),{t:n,id:r,activeTab:i,children:a}=e;if(i!==r)return null;let o=`dreaming-settings-panel-${r}`,s=`dreaming-settings-tab-${r}`,c;t[0]!==r||t[1]!==n?(c=De(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,J.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c}),t[3]=c,t[4]=l);let u;t[5]!==r||t[6]!==n?(u=Oe(n,r),t[5]=r,t[6]=n,t[7]=u):u=t[7];let d;t[8]===u?d=t[9]:(d=(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}),t[8]=u,t[9]=d);let f;t[10]!==l||t[11]!==d?(f=(0,J.jsxs)(`div`,{className:`mb-5`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==f?(p=(0,J.jsxs)(`section`,{id:o,role:`tabpanel`,"aria-labelledby":s,className:`rounded-2xl border border-edge bg-surface-base px-4 py-5 sm:px-5`,children:[f,a]}),t[13]=a,t[14]=o,t[15]=s,t[16]=f,t[17]=p):p=t[17],p}export{je as DreamingSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-CkT-lcgP.js";import{t as a}from"./locale-store-DjbfSsfA.js";import{Dr as o}from"./index-Cxm6xsps.js";var s=n(),c=e(t(),1),l=r(),u=`xopc.extensionUiGrants.v1`;function d(){let e=(0,s.c)(59),t=a(h),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let r=n.extensionDebug,u=o(),[d,_]=(0,c.useState)(m),v;e[2]===u?v=e[3]:(v=u.toSorted(p),e[2]=u,e[3]=v);let y=v,b;e[4]===r.title?b=e[5]:(b=(0,l.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:r.title}),e[4]=r.title,e[5]=b);let x;e[6]===r.subtitle?x=e[7]:(x=(0,l.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.subtitle}),e[6]=r.subtitle,e[7]=x);let S;e[8]!==b||e[9]!==x?(S=(0,l.jsxs)(`div`,{children:[b,x]}),e[8]=b,e[9]=x,e[10]=S):S=e[10];let C;e[11]===r.grantsHeading?C=e[12]:(C=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.grantsHeading}),e[11]=r.grantsHeading,e[12]=C);let w;e[13]===r.grantsHint?w=e[14]:(w=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.grantsHint}),e[13]=r.grantsHint,e[14]=w);let T;e[15]===d?T=e[16]:(T=(0,l.jsx)(`pre`,{className:`mt-3 max-h-48 overflow-auto rounded-lg border border-edge-subtle bg-surface-muted p-3 font-mono text-xs text-fg`,children:d}),e[15]=d,e[16]=T);let E;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>_(g()),e[17]=E):E=e[17];let D;e[18]===r.refresh?D=e[19]:(D=(0,l.jsx)(`button`,{type:`button`,className:`mt-3 rounded-lg border border-edge px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,onClick:E,children:r.refresh}),e[18]=r.refresh,e[19]=D);let O;e[20]!==C||e[21]!==w||e[22]!==T||e[23]!==D?(O=(0,l.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:[C,w,T,D]}),e[20]=C,e[21]=w,e[22]=T,e[23]=D,e[24]=O):O=e[24];let k;e[25]===r.listHeading?k=e[26]:(k=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.listHeading}),e[25]=r.listHeading,e[26]=k);let A;e[27]===r.colId?A=e[28]:(A=(0,l.jsx)(`th`,{className:`py-2 pr-2`,children:r.colId}),e[27]=r.colId,e[28]=A);let j;e[29]===r.colName?j=e[30]:(j=(0,l.jsx)(`th`,{className:`py-2 pr-2`,children:r.colName}),e[29]=r.colName,e[30]=j);let M;e[31]===r.colPermissions?M=e[32]:(M=(0,l.jsx)(`th`,{className:`py-2`,children:r.colPermissions}),e[31]=r.colPermissions,e[32]=M);let N;e[33]!==A||e[34]!==j||e[35]!==M?(N=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`border-b border-edge text-xs uppercase text-fg-muted`,children:[A,j,M]})}),e[33]=A,e[34]=j,e[35]=M,e[36]=N):N=e[36];let P;e[37]===y?P=e[38]:(P=y.map(f),e[37]=y,e[38]=P);let F;e[39]===P?F=e[40]:(F=(0,l.jsx)(`tbody`,{children:P}),e[39]=P,e[40]=F);let I;e[41]!==N||e[42]!==F?(I=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[N,F]})}),e[41]=N,e[42]=F,e[43]=I):I=e[43];let L;e[44]!==k||e[45]!==I?(L=(0,l.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:[k,I]}),e[44]=k,e[45]=I,e[46]=L):L=e[46];let R;e[47]===r.futureHeading?R=e[48]:(R=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.futureHeading}),e[47]=r.futureHeading,e[48]=R);let z;e[49]===r.futureBody?z=e[50]:(z=(0,l.jsx)(`p`,{className:`mt-2`,children:r.futureBody}),e[49]=r.futureBody,e[50]=z);let B;e[51]!==R||e[52]!==z?(B=(0,l.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-muted/50 p-4 text-sm text-fg-muted`,children:[R,z]}),e[51]=R,e[52]=z,e[53]=B):B=e[53];let V;return e[54]!==O||e[55]!==L||e[56]!==B||e[57]!==S?(V=(0,l.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[S,O,L,B]}),e[54]=O,e[55]=L,e[56]=B,e[57]=S,e[58]=V):V=e[58],V}function f(e){return(0,l.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,l.jsx)(`td`,{className:`py-2 pr-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`py-2 pr-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function p(e,t){return e.id.localeCompare(t.id)}function m(){return g()}function h(e){return e.language}function g(){try{let e=localStorage.getItem(u);if(!e)return`{}`;let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch(e){return e instanceof Error?e.message:String(e)}}export{d as ExtensionDebugPage};
|
package/dist/gateway/static/root/assets/{extension-page-DmDLVSPE.js → extension-page-CvpI45WG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{Ar as i,Dr as a,Es as o,b as s,ii as c}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{Ar as i,Dr as a,Es as o,b as s,ii as c}from"./index-Cxm6xsps.js";var l=n(),u=e(t(),1),d=r();function f(){let e=(0,l.c)(26),{extensionId:t,pageId:n}=o(),r=a(),f=c(m),g=c(p),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&i(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==f?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return f({startExtra:null,main:(0,d.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,d.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,f],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=f,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,u.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,d.jsx)(h,{message:`No extension ID provided.`}),e[13]=t):t=e[13],t}if(!_){let n=`Extension "${t}" not found or has no UI.`,r;return e[14]===n?r=e[15]:(r=(0,d.jsx)(h,{message:n}),e[14]=n,e[15]=r),r}if(!v?.length){let n=`Extension "${t}" has no page contributions.`,r;return e[16]===n?r=e[17]:(r=(0,d.jsx)(h,{message:n}),e[16]=n,e[17]=r),r}if(!b){let r=`Page "${n}" not found in extension "${t}".`,i;return e[18]===r?i=e[19]:(i=(0,d.jsx)(h,{message:r}),e[18]=r,e[19]=i),i}let C=_.ui?.permissions,w;return e[20]!==_.name||e[21]!==t||e[22]!==b.entrypoint||e[23]!==b.title||e[24]!==C?(w=(0,d.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,d.jsx)(s,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[20]=_.name,e[21]=t,e[22]=b.entrypoint,e[23]=b.title,e[24]=C,e[25]=w):w=e[25],w}function p(e){return e.clearPageHeader}function m(e){return e.setPageHeader}function h(e){let t=(0,l.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,d.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-1 items-center justify-center`,children:(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})})}),t[0]=n,t[1]=r),r}export{f as ExtensionPage};
|