@nextclaw/ui 0.22.1 → 0.22.2
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/CHANGELOG.md +7 -0
- package/dist/assets/{api-m33O1Kb0.js → api-DU3C4HfX.js} +1 -1
- package/dist/assets/{appearance-settings-page-x4Vjnfmz.js → appearance-settings-page-BLaxNij2.js} +1 -1
- package/dist/assets/{book-open-BHiasMCg.js → book-open-DMnwJfVM.js} +1 -1
- package/dist/assets/{channels-list-page-DOxJZeXq.js → channels-list-page-eUVEhukh.js} +1 -1
- package/dist/assets/{config-split-page-DBnMEP1o.js → config-split-page-DON62DcK.js} +1 -1
- package/dist/assets/{confirm-dialog-f5NKLh5I.js → confirm-dialog-B539oJpr.js} +1 -1
- package/dist/assets/{createLucideIcon-CHALGA42.js → createLucideIcon-CLfqNlvk.js} +1 -1
- package/dist/assets/{desktop-capabilities-page-DixayAe6.js → desktop-capabilities-page-FV7xowDx.js} +1 -1
- package/dist/assets/{desktop-update-config-ChhfeOHj.js → desktop-update-config-BWP2Pr4u.js} +1 -1
- package/dist/assets/{dist-sD6V4nHX.js → dist-GWWehc4w.js} +1 -1
- package/dist/assets/{dist-_UMsWSY0.js → dist-WPei0-v8.js} +1 -1
- package/dist/assets/{doc-browser-Bq7LJsQY.js → doc-browser-CKpps-rb.js} +1 -1
- package/dist/assets/{doc-browser-context-Capim3og.js → doc-browser-context-Vx418ptC.js} +1 -1
- package/dist/assets/doc-browser-y3e2_MXe.js +1 -0
- package/dist/assets/{extensions-Bdclr3Wr.js → extensions-Mc3juAVp.js} +1 -1
- package/dist/assets/{form-actions-CH0kWhEt.js → form-actions-DJlfyLEH.js} +1 -1
- package/dist/assets/{index-BjxnLYE3.js → index-DIkMNtbu.js} +4 -4
- package/dist/assets/loader-circle-DXH2fVRq.js +1 -0
- package/dist/assets/{mcp-marketplace-page-BUsxLVB5.js → mcp-marketplace-page-CEr3FgVp.js} +1 -1
- package/dist/assets/mcp-marketplace-page-Dj0xiFAV.js +1 -0
- package/dist/assets/{model-config-page-CIevwqp4.js → model-config-page-DAseq1vr.js} +1 -1
- package/dist/assets/{navigation-link-CAUiM3zS.js → navigation-link-DI0mOIVl.js} +1 -1
- package/dist/assets/plus-C6Kx4b6T.js +1 -0
- package/dist/assets/{privacy-settings-page-CNKfZsYH.js → privacy-settings-page-COFa7LrK.js} +1 -1
- package/dist/assets/{providers-config-page-DAah2NIS.js → providers-config-page-zP-J1Asx.js} +1 -1
- package/dist/assets/react-BwGMzqXA.js +8 -0
- package/dist/assets/{refresh-cw-BG_LX3SS.js → refresh-cw-DmR6-f9A.js} +1 -1
- package/dist/assets/remote-EeKMCoyb.js +1 -0
- package/dist/assets/{rotate-cw-Cz7I_m7O.js → rotate-cw-BUWqEgob.js} +1 -1
- package/dist/assets/runtime-config-page-D5KbQ3ue.js +1 -0
- package/dist/assets/{save-BiHnb8ps.js → save-DdohrEEJ.js} +1 -1
- package/dist/assets/{search-C47TyRg0.js → search-BVeIVVGT.js} +1 -1
- package/dist/assets/{search-config-page-BAIzd6gN.js → search-config-page-Bi9J2kYR.js} +1 -1
- package/dist/assets/{secrets-config-page-Ddi-n43R.js → secrets-config-page-0MP2MSvq.js} +1 -1
- package/dist/assets/security-config-CNdun2s-.js +1 -0
- package/dist/assets/{select-BzQKfW1e.js → select-DvuHOwPH.js} +1 -1
- package/dist/assets/skeleton-u2lc3JJg.js +1 -0
- package/dist/assets/{tag-chip-C3K814HZ.js → tag-chip-BI9NffVf.js} +1 -1
- package/dist/assets/x-27QFIvUt.js +1 -0
- package/dist/index.html +20 -20
- package/package.json +4 -4
- package/src/features/agents/components/__tests__/agents-page.test.tsx +0 -2
- package/src/features/agents/components/agent-details-dialog.tsx +0 -9
- package/src/features/system-status/components/config/runtime-agent-list-card.tsx +8 -17
- package/src/features/system-status/utils/runtime-config-agent.utils.ts +2 -3
- package/src/shared/lib/api/types.ts +0 -2
- package/src/shared/lib/i18n/locales/en-US/agents.json +0 -2
- package/src/shared/lib/i18n/locales/en-US/core.json +0 -2
- package/src/shared/lib/i18n/locales/zh-CN/agents.json +0 -2
- package/src/shared/lib/i18n/locales/zh-CN/core.json +0 -2
- package/dist/assets/doc-browser-BuDgpY2e.js +0 -1
- package/dist/assets/loader-circle-CH_0iPLy.js +0 -1
- package/dist/assets/mcp-marketplace-page-GPRV3fB0.js +0 -1
- package/dist/assets/plus-B3obD55V.js +0 -1
- package/dist/assets/react-Co6JiC1n.js +0 -8
- package/dist/assets/remote-DuscgfvR.js +0 -1
- package/dist/assets/runtime-config-page-Cl1RpmSC.js +0 -1
- package/dist/assets/security-config-C8MHnE1r.js +0 -1
- package/dist/assets/skeleton-BXFAE9SE.js +0 -1
- package/dist/assets/x-C1r9IXet.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-ySrvolIe.js","assets/preload-helper-D4M6sveU.js","assets/chunk-HOUHSVGY-DPkq8FCm.js","assets/src-Bw-mzbQb.js","assets/chunk-DseTPa7n.js","assets/chunk-Y2CYZVJY-D1mAU_Po.js","assets/chunk-WYO6CB5R-Dn9To_OI.js","assets/chunk-ICXQ74PX-FAatv5fC.js","assets/dist--ta5rX12.js","assets/chunk-Q4XR5HBZ-DQFeUPxZ.js","assets/chunk-52WLFC77-viIcqj9q.js","assets/line-Cos7PIOj.js","assets/path-10BjdyLh.js","assets/array-BQVzeGRt.js","assets/chunk-7BUUIJ7U-BvydOcm3.js","assets/chunk-C7G6YPKG-DAizzYwr.js","assets/chunk-OGEWGWER-C3jdH3Ty.js","assets/chunk-ZGVPDNZ5-C6YtZDU0.js","assets/rough.esm-DxgC_14r.js","assets/chunk-FWX5IMBZ-D0ksHZZ9.js","assets/chunk-VAUOI2AC-BGvh3yIx.js","assets/chunk-ZIRB5QZD-DMuYtnHF.js","assets/docx-preview-BqwAjrj3.js","assets/jszip.min-8hyJpgpx.js","assets/aiden0z-pptx-renderer.es-Dp2ezlQn.js","assets/doc-browser-
|
|
2
|
-
import{i as e,n as t,t as n}from"./chunk-DseTPa7n.js";import{A as r,B as i,C as a,D as o,E as s,F as c,H as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,V as v,_ as y,a as b,b as x,c as S,f as C,g as w,h as T,i as E,j as D,k as O,n as k,o as A,p as j,r as M,s as N,t as P,v as ee,w as te,x as ne,y as re,z as ie}from"./react-Co6JiC1n.js";import{t as ae}from"./preload-helper-D4M6sveU.js";import{a as oe,c as se,d as ce,f as le,i as ue,l as de,n as fe,o as pe,r as me,s as he,t as ge,u as _e}from"./navigation-link-CAUiM3zS.js";import{$ as ve,$t as ye,A as be,An as F,B as xe,Bt as Se,C as Ce,Cn as we,Ct as Te,D as Ee,Dn as De,Dt as Oe,E as ke,En as Ae,Et as je,F as Me,Fn as Ne,Ft as Pe,Ht as Fe,I as Ie,In as Le,It as I,Jt as Re,L as ze,Ln as Be,Lt as Ve,M as He,N as Ue,Nt as We,O as Ge,On as eee,Ot as Ke,P as qe,Pn as Je,Pt as Ye,Q as Xe,Qt as Ze,R as Qe,Rn as $e,S as et,Sn as tt,St as nt,T as rt,Tn as it,Tt as at,Ut as ot,V as st,Vt as ct,X as lt,Yt as ut,Z as dt,Zt as ft,_ as pt,_n as L,_t as mt,a as ht,an as gt,at as _t,b as vt,bt as yt,c as bt,cn as xt,ct as tee,d as nee,dn as St,dt as Ct,en as wt,et as Tt,fn as R,ft as Et,g as Dt,gn as Ot,gt as kt,h as At,hn as jt,ht as Mt,i as Nt,it as Pt,j as Ft,k as It,kn as Lt,kt as Rt,l as zt,ln as Bt,lt as Vt,m as Ht,mn as Ut,mt as Wt,n as Gt,nn as Kt,nt as qt,o as Jt,on as Yt,ot as Xt,p as Zt,pn as Qt,pt as $t,qt as en,r as tn,rn as nn,rt as rn,s as an,sn as on,st as sn,t as cn,tt as ln,u as un,un as dn,ut as fn,v as pn,vn as z,vt as mn,w as hn,wn as gn,wt as _n,x as vn,xn as yn,xt as bn,y as xn,yn as Sn,yt as Cn,z as wn,zn as Tn,zt as En}from"./api-m33O1Kb0.js";import{C as Dn,S as On,T as kn,_ as An,a as jn,b as Mn,c as Nn,d as Pn,f as Fn,g as In,h as Ln,i as Rn,l as zn,m as Bn,n as Vn,o as ree,p as iee,r as aee,s as oee,u as see,v as Hn,w as Un,x as Wn,y as cee}from"./mcp-marketplace-page-BUsxLVB5.js";import{a as Gn,b as Kn,c as qn,d as Jn,f as Yn,h as Xn,i as Zn,l as Qn,m as $n,o as er,r as tr,s as nr,v as rr,y as ir}from"./dist-_UMsWSY0.js";import{C as ar,D as or,E as sr,O as cr,S as lr,T as ur,_ as dr,a as fr,b as pr,c as mr,d as hr,f as gr,g as _r,h as vr,i as yr,l as br,m as xr,n as Sr,o as Cr,p as wr,r as Tr,s as Er,t as Dr,u as Or,v as kr,w as Ar,x as jr,y as Mr}from"./select-BzQKfW1e.js";import{t as Nr}from"./dist-sD6V4nHX.js";import{a as Pr,c as Fr,d as Ir,f as Lr,g as Rr,h as zr,i as Br,l as Vr,m as Hr,n as Ur,o as Wr,p as Gr,r as Kr,s as qr,t as Jr,u as Yr}from"./confirm-dialog-f5NKLh5I.js";import{t as B}from"./createLucideIcon-CHALGA42.js";import{C as Xr,D as Zr,E as Qr,O as $r,S as ei,T as ti,_ as ni,a as ri,b as ii,c as ai,d as oi,f as si,g as ci,h as li,i as ui,k as di,l as fi,m as pi,n as mi,o as hi,p as V,r as gi,s as _i,u as vi,v as yi,w as bi,x as xi,y as Si}from"./doc-browser-Bq7LJsQY.js";import{n as Ci,t as wi}from"./search-C47TyRg0.js";import{t as Ti}from"./book-open-BHiasMCg.js";import{t as Ei}from"./loader-circle-CH_0iPLy.js";import{t as Di}from"./plus-B3obD55V.js";import{t as Oi}from"./refresh-cw-BG_LX3SS.js";import{t as ki}from"./x-C1r9IXet.js";import{t as Ai}from"./host-capabilities-Tk038i04.js";import{n as ji,t as Mi}from"./middleware-DXsbf9xI.js";import{t as Ni}from"./skeleton-BXFAE9SE.js";import{_ as Pi,a as Fi,c as Ii,d as Li,g as Ri,h as zi,i as Bi,l as Vi,n as Hi,o as Ui,p as Wi,r as Gi,s as Ki,t as qi,u as Ji,v as Yi}from"./doc-browser-context-Capim3og.js";import{t as Xi}from"./tag-chip-C3K814HZ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Zi=n((e=>{var t=v();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function Qi(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function $i(e,t,n){let r=e.slice(0);return r[t]=n,r}var ea=class extends Tn{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Ne.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!$e(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Qi(e,n).forEach(e=>{e.destroy()}),Qi(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Be(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Je(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=$i(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&Ne.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(l(),1);function ta({queries:e,...t},n){let r=F(n),i=eee(),a=De(),o=H.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{yn(e),gn(e,a,r.getQueryCache().get(e.queryHash))}),Ae(a);let[s]=H.useState(()=>new ea(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;H.useSyncExternalStore(H.useCallback(e=>d?s.subscribe(Ne.batchCalls(e)):Le,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),H.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>we(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&we(n,e)?tt(n,new Je(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&it({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var na=B(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ra=B(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),ia=B(`Archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),lee=B(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),uee=B(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),aa=B(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),dee=B(`Blocks`,[[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`path`,{d:`M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3`,key:`1fpvtg`}]]),fee=B(`BookOpenText`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),pee=B(`Bookmark`,[[`path`,{d:`m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z`,key:`1fy3hk`}]]),oa=B(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),mee=B(`Braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),sa=B(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),ca=B(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),hee=B(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),la=B(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),ua=B(`CalendarDays`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),gee=B(`ChartNoAxesColumnIncreasing`,[[`line`,{x1:`12`,x2:`12`,y1:`20`,y2:`10`,key:`1vz5eb`}],[`line`,{x1:`18`,x2:`18`,y1:`20`,y2:`4`,key:`cun8e5`}],[`line`,{x1:`6`,x2:`6`,y1:`20`,y2:`16`,key:`hq0ia6`}]]),_ee=B(`ChartNoAxesColumn`,[[`line`,{x1:`18`,x2:`18`,y1:`20`,y2:`10`,key:`1xfpm4`}],[`line`,{x1:`12`,x2:`12`,y1:`20`,y2:`4`,key:`be30l9`}],[`line`,{x1:`6`,x2:`6`,y1:`20`,y2:`14`,key:`1r4le6`}]]),da=B(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),fa=B(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),vee=B(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),pa=B(`ChevronsUp`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),ma=B(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ha=B(`CircleDashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),ga=B(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_a=B(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),va=B(`CirclePlay`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polygon`,{points:`10 8 16 12 10 16 10 8`,key:`1cimsy`}]]),ya=B(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ba=B(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),xa=B(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Sa=B(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Ca=B(`Command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),wa=B(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ta=B(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ea=B(`CornerDownRight`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),Da=B(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Oa=B(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),ka=B(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Aa=B(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ja=B(`Expand`,[[`path`,{d:`m21 21-6-6m6 6v-4.8m0 4.8h-4.8`,key:`1c15vz`}],[`path`,{d:`M3 16.2V21m0 0h4.8M3 21l6-6`,key:`1fsnz2`}],[`path`,{d:`M21 7.8V3m0 0h-4.8M21 3l-6 6`,key:`hawz9i`}],[`path`,{d:`M3 7.8V3m0 0h4.8M3 3l6 6`,key:`u9ee12`}]]),Ma=B(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Na=B(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),Pa=B(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),Fa=B(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Ia=B(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),La=B(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Ra=B(`FilePlus2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),za=B(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Ba=B(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),Va=B(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ha=B(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),Ua=B(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Wa=B(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ga=B(`FolderPlus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ka=B(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),qa=B(`FolderUp`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),Ja=B(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),Ya=B(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xa=B(`Forward`,[[`polyline`,{points:`15 17 20 12 15 7`,key:`1w3sku`}],[`path`,{d:`M4 18v-2a4 4 0 0 1 4-4h12`,key:`jmiej9`}]]),Za=B(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Qa=B(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),$a=B(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),eo=B(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),to=B(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),no=B(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),ro=B(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),io=B(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ao=B(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),oo=B(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),so=B(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),co=B(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),lo=B(`LayoutDashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),uo=B(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),fo=B(`Lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),po=B(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),mo=B(`ListCollapse`,[[`path`,{d:`m3 10 2.5-2.5L3 5`,key:`i6eama`}],[`path`,{d:`m3 19 2.5-2.5L3 14`,key:`w2gmor`}],[`path`,{d:`M10 6h11`,key:`c7qv1k`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 18h11`,key:`11hvi2`}]]),ho=B(`ListTodo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),go=B(`ListTree`,[[`path`,{d:`M21 12h-8`,key:`1bmf0i`}],[`path`,{d:`M21 6H8`,key:`1pqkrb`}],[`path`,{d:`M21 18h-8`,key:`1tm79t`}],[`path`,{d:`M3 6v4c0 1.1.9 2 2 2h3`,key:`1ywdgy`}],[`path`,{d:`M3 10v6c0 1.1.9 2 2 2h3`,key:`2wc746`}]]),_o=B(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),vo=B(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),yo=B(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),bo=B(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),xo=B(`MessageSquarePlus`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),So=B(`MessageSquareQuote`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M8 12a2 2 0 0 0 2-2V8H8`,key:`1jfesj`}],[`path`,{d:`M14 12a2 2 0 0 0 2-2V8h-2`,key:`1dq9mh`}]]),Co=B(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),wo=B(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),To=B(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),Eo=B(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Do=B(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Oo=B(`MonitorCog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m15.2 4.9-.9-.4`,key:`12wd2u`}],[`path`,{d:`m15.2 7.1-.9.4`,key:`1r2vl7`}],[`path`,{d:`m16.9 3.2-.4-.9`,key:`3zbo91`}],[`path`,{d:`m16.9 8.8-.4.9`,key:`1qr2dn`}],[`path`,{d:`m19.5 2.3-.4.9`,key:`1rjrkq`}],[`path`,{d:`m19.5 9.7-.4-.9`,key:`heryx5`}],[`path`,{d:`m21.7 4.5-.9.4`,key:`17fqt1`}],[`path`,{d:`m21.7 7.5-.9-.4`,key:`14zyni`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),ko=B(`Monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Ao=B(`Newspaper`,[[`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`,key:`7pis2x`}],[`path`,{d:`M18 14h-8`,key:`sponae`}],[`path`,{d:`M15 18h-5`,key:`95g1m2`}],[`path`,{d:`M10 6h8v4h-8V6Z`,key:`smlsk5`}]]),jo=B(`NotebookText`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),Mo=B(`PackagePlus`,[[`path`,{d:`M16 16h6`,key:`100bgy`}],[`path`,{d:`M19 13v6`,key:`85cyf1`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),No=B(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Po=B(`PanelLeftClose`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Fo=B(`PanelLeftDashed`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 14v1`,key:`askpd8`}],[`path`,{d:`M9 19v2`,key:`16tejx`}],[`path`,{d:`M9 3v2`,key:`1noubl`}],[`path`,{d:`M9 9v1`,key:`19ebxg`}]]),Io=B(`PanelLeftOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Lo=B(`PanelLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Ro=B(`PanelRightClose`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),zo=B(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),Bo=B(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),Vo=B(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),Ho=B(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Uo=B(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Wo=B(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Go=B(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),Ko=B(`RefreshCcw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),qo=B(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Jo=B(`Send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Yo=B(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Xo=B(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Zo=B(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Qo=B(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),$o=B(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),es=B(`ShieldPlus`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9 12h6`,key:`1c52cq`}],[`path`,{d:`M12 9v6`,key:`199k2o`}]]),ts=B(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),ns=B(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),rs=B(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),is=B(`SquareCheck`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),as=B(`SquarePen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),os=B(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ss=B(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),cs=B(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ls=B(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),us=B(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ds=B(`TextQuote`,[[`path`,{d:`M17 6H3`,key:`16j9eg`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 18H8`,key:`1wfozv`}],[`path`,{d:`M3 12v6`,key:`fv4c87`}]]),fs=B(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),ps=B(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ms=B(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),hs=B(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),gs=B(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),_s=B(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),vs=B(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),ys=B(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),bs=Zi(),U=i(),xs={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function Ss({status:e,label:t,className:n}){let r=xs[e];return(0,U.jsxs)(`div`,{className:u(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,r.bg,n),children:[(0,U.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,U.jsx)(`span`,{className:u(`text-[11px] font-medium`,r.text),children:t})]})}function Cs(){return Sn({queryKey:Es,queryFn:At,staleTime:5e3,refetchOnWindowFocus:!0})}function ws(e){let{label:t,muted:n,value:r}=e;return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:t}),(0,U.jsx)(`span`,{className:n?`text-right text-muted-foreground`:`text-right text-foreground`,children:r==null||r===``?`-`:String(r)})]})}function Ts(){let e=P9(),t=Cs(),n=t.data,r=Ps(e=>e.actionLabel),i=(0,H.useMemo)(()=>Bs(n),[n]),a=!!r,o=n?.runtime?.deviceName?.trim()||n?.settings.deviceName?.trim()||b(`remoteDeviceNameAuto`),s=!!(n?.account.loggedIn&&Ns(n)),{hero:c,issueHint:l}=i;return(0,H.useEffect)(()=>{e.remoteAccessManager.syncStatus(n)},[e,n]),t.isLoading&&!n?(0,U.jsx)(on,{title:b(`remotePageTitle`),description:b(`remotePageDescription`),children:(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:b(`remoteLoading`)})}):(0,U.jsx)(on,{title:b(`remotePageTitle`),description:b(`remotePageDescription`),children:(0,U.jsxs)(`div`,{className:`grid gap-7 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,U.jsx)(Yt,{title:c.title,description:c.description,actions:(0,U.jsx)(Ss,{status:c.badgeStatus,label:c.badgeLabel}),children:(0,U.jsx)(gt,{children:(0,U.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(ws,{label:b(`remoteSignedInAccount`),value:n?.account.email}),(0,U.jsx)(ws,{label:b(`remoteDeviceName`),value:o}),(0,U.jsx)(ws,{label:b(`remoteConnectionStatus`),value:c.badgeLabel}),(0,U.jsx)(ws,{label:b(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?M(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[i.primaryAction?(0,U.jsxs)(R,{onClick:()=>{if(i.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(n);return}if(i.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(n);return}e.remoteAccessManager.enableRemoteAccess(n)},disabled:a,children:[i.primaryAction.showRefreshIcon?(0,U.jsx)(Ko,{className:`mr-2 h-4 w-4`}):null,r||i.primaryAction.label]}):null,(0,U.jsxs)(R,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:a||!s,children:[(0,U.jsx)(rs,{className:`mr-2 h-4 w-4`}),b(`remoteOpenDeviceList`)]}),n?.settings.enabled?(0,U.jsx)(R,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(n),disabled:a,children:b(`remoteDisable`)}):null]}),i.shouldShowIssueHint&&l?(0,U.jsx)(Dn,{tone:`warning`,title:l.title,description:l.body}):null,(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`remoteOpenWebHint`)})]})})}),(0,U.jsx)(Yt,{title:(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(co,{className:`h-4 w-4 text-primary`}),b(`remoteDeviceSectionTitle`)]}),description:b(`remoteDeviceSectionDescription`),children:(0,U.jsx)(gt,{children:(0,U.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(Ss,{status:n?.account.loggedIn?`ready`:`inactive`,label:n?.account.loggedIn?b(`remoteAccountConnected`):b(`remoteAccountNotConnected`)}),(0,U.jsx)(Ss,{status:n?.settings.enabled?`active`:`inactive`,label:n?.settings.enabled?b(`remoteEnabled`):b(`remoteStateDisabled`)}),(0,U.jsx)(Ss,{status:n?.service.running?`active`:`inactive`,label:n?.service.running?b(`remoteServiceRunning`):b(`remoteServiceStopped`)})]}),(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(ws,{label:b(`remoteDeviceName`),value:o}),(0,U.jsx)(ws,{label:b(`remoteConnectionStatus`),value:c.badgeLabel}),(0,U.jsx)(ws,{label:b(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?M(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,U.jsx)(Dn,{tone:`neutral`,borderStyle:`dashed`,description:n?.account.loggedIn?b(`remoteOpenWebHint`):b(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})})})]})})}var Es=[`remote-status`],Ds=`https://platform.nextclaw.io`,Os=`https://nextclaw-platform-console.pages.dev`,ks=async()=>await jt.fetchQuery({queryKey:Es,queryFn:At,staleTime:5e3}),As=async()=>(await jt.invalidateQueries({queryKey:Es}),await ks()),js=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function Ms(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return Ds;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return Os}var Ns=e=>Ms(e?.account.apiBase)||Ms(e?.settings.platformApiBase)||Ms(e?.platformBase)||Ms(e?.account.platformBase)||void 0,Ps=P(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),Fs=class{constructor(e){this.params=e,this.syncStatus=e=>{if(!e)return;let t=Ps.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{Ps.getState().setEnabled(e)},this.setDeviceName=e=>{Ps.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{Ps.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{Ps.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await As(),n=Ps.getState(),r=await this.ensureRemoteAccount(t,n.platformApiBase);await this.applyEnabledState(!0,r)},this.disableRemoteAccess=async e=>{let t=e??await As();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await As(),n=(await this.ensureRemoteAccount(t)).service.running?`restart`:`start`;await this.runManagedAction({actionLabel:b(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await Zt(n);let e=await As();this.hydrateDraftFromStatus(e)},successMessage:b(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await As(),n=await this.params.accountManager.startBrowserSignInAndWait({status:t,apiBase:Ps.getState().platformApiBase});await this.repairRemoteAccess(n)},this.saveAdvancedSettings=async e=>{let t=e??await As(),n=Ps.getState();await this.runManagedAction({actionLabel:b(`remoteActionSavingAdvanced`),job:async()=>{await vt({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await As();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?b(`remoteSettingsSaved`):b(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:b(`remoteDoctorRunning`),job:async()=>{let e=await Ht();Ps.getState().setDoctor(e)},successMessage:b(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,b(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,b(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,b(`remoteActionStopping`))},this.applyEnabledState=async(e,t)=>{let n=Ps.getState();await this.runManagedAction({actionLabel:b(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await vt({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await As();this.hydrateDraftFromStatus(r),e?await Zt(r.service.running?`restart`:`start`):t.service.running&&await Zt(`restart`);let i=await As();this.hydrateDraftFromStatus(i)},successMessage:b(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.ensureRemoteAccount=async(e,t)=>e.account.loggedIn?e:await this.params.accountManager.ensureSignedIn({apiBase:t,status:e}),this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await Zt(e),n=await As();this.hydrateDraftFromStatus(n),L.success(t.message)}})},this.hydrateDraftFromStatus=e=>{Ps.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{let{actionLabel:t,job:n,successMessage:r}=e;Ps.getState().beginAction(t);try{await n(),r&&L.success(r)}catch(e){let t=e instanceof Error?e.message:b(`error`);throw L.error(t),e}finally{Ps.getState().finishAction()}}}},Is=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function Ls(e){return e?.runtime?.lastError?.trim()||``}function Rs(e){let t=b(`remoteStatusIssueDetailGeneric`),n=Ls(e);return n?`${t} (${n})`:t}function zs(e){if(!e?.settings.enabled)return!1;let t=Ls(e);return Is.some(e=>e.test(t))}function Bs(e){return zs(e)?{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteStateReauthorizationRequired`),title:b(`remoteStatusReauthorizationTitle`),description:b(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:b(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:b(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:b(`statusReady`),title:b(`remoteStatusReadyTitle`),description:b(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:b(`connecting`),title:b(`remoteStatusConnectingTitle`),description:b(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteStateDisconnected`),title:b(`remoteStatusIssueTitle`),description:b(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:Rs(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteServiceStopped`),title:b(`remoteStatusNeedsServiceTitle`),description:b(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:b(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:b(`statusInactive`),title:b(`remoteStatusNeedsEnable`),description:b(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:b(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:b(`statusSetup`),title:b(`remoteStatusNeedsSignIn`),description:b(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:b(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var Vs=P(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function Hs({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,U.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function Us(e){let{email:t,username:n,role:r,canSubmitUsername:i,savingUsername:a,usernameDraft:o,onUsernameDraftChange:s,onSubmitUsername:c,onOpenDeviceList:l,onLogout:u}=e;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`success`,title:b(`accountPanelSignedInTitle`),description:b(`accountPanelSignedInDescription`)}),(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(Hs,{label:b(`remoteAccountEmail`),value:t}),(0,U.jsx)(Hs,{label:b(`remoteAccountUsername`),value:n}),(0,U.jsx)(Hs,{label:b(`remoteAccountRole`),value:r})]}),n?(0,U.jsx)(`p`,{className:`text-xs text-gray-500`,children:b(`remoteAccountUsernameLockedHelp`)}):(0,U.jsxs)(Dn,{tone:`warning`,title:b(`remoteAccountUsernameRequiredTitle`),description:b(`remoteAccountUsernameRequiredDescription`),children:[(0,U.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`account-panel-username`,children:b(`remoteAccountUsername`)}),(0,U.jsx)(St,{id:`account-panel-username`,value:o,onChange:e=>s(e.target.value),placeholder:b(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,U.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,U.jsx)(R,{disabled:!i,onClick:()=>void c(),children:b(a?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,U.jsxs)(R,{onClick:()=>void l(),children:[(0,U.jsx)(rs,{className:`mr-2 h-4 w-4`}),b(`remoteOpenDeviceList`)]}),(0,U.jsxs)(R,{variant:`outline`,onClick:()=>void u(),children:[(0,U.jsx)(vo,{className:`mr-2 h-4 w-4`}),b(`remoteLogout`)]})]})]})}function Ws(e){let{authSessionId:t,authExpiresAt:n,authStatusMessage:r,authVerificationUri:i,onStartBrowserSignIn:a,onResumeBrowserSignIn:o}=e;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`neutral`,title:b(`accountPanelSignedOutTitle`),description:b(`accountPanelSignedOutDescription`),children:t?(0,U.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,U.jsx)(Hs,{label:b(`remoteBrowserAuthSession`),value:t}),(0,U.jsx)(Hs,{label:b(`remoteBrowserAuthExpiresAt`),value:n?M(n):`-`})]}):null}),r?(0,U.jsx)(`p`,{className:`text-sm text-gray-600`,children:r}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,U.jsx)(R,{onClick:()=>void a(),children:b(t?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),i?(0,U.jsx)(R,{variant:`outline`,onClick:()=>void o(),children:b(`remoteBrowserAuthResume`)}):null]})]})}function Gs(){let e=A9(),t=Cs(),n=Vs(e=>e.panelOpen),r=Vs(e=>e.authSessionId),i=Vs(e=>e.authVerificationUri),a=Vs(e=>e.authExpiresAt),o=Vs(e=>e.authStatusMessage),s=t.data,[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1);(0,H.useEffect)(()=>{e.accountManager.syncRemoteStatus(s)},[e,s]);let f=!u&&c.trim().length>0&&!s?.account.username;return(0,U.jsx)(Ur,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,U.jsxs)(Kr,{className:`max-w-xl`,children:[(0,U.jsxs)(Wr,{children:[(0,U.jsxs)(qr,{className:`flex items-center gap-2`,children:[(0,U.jsx)(oo,{className:`h-5 w-5 text-primary`}),b(`accountPanelTitle`)]}),(0,U.jsx)(Br,{children:b(`accountPanelDescription`)})]}),s?.account.loggedIn?(0,U.jsx)(Us,{email:s.account.email,username:s.account.username,role:s.account.role,canSubmitUsername:f,savingUsername:u,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:async()=>{d(!0);try{await e.accountManager.updateUsername(c)}finally{d(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,U.jsx)(Ws,{authSessionId:r,authExpiresAt:a,authStatusMessage:o,authVerificationUri:i,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}var Ks=H.forwardRef(({className:e,hover:t=!0,surface:n=`raised`,...r},i)=>(0,U.jsx)(`div`,{ref:i,className:u(`rounded-2xl border bg-card text-card-foreground transition-colors duration-base`,n===`raised`?`border-border shadow-card`:`border-border/75 shadow-none`,t&&n===`raised`&&`hover:border-primary/25 hover:shadow-card-hover`,t&&n===`flat`&&`hover:bg-muted/40`,e),...r}));Ks.displayName=`Card`;var qs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`flex flex-col space-y-1.5 p-6`,e),...t}));qs.displayName=`CardHeader`;var Js=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`h3`,{ref:n,className:u(`text-[15px] font-semibold leading-tight tracking-tight text-foreground`,e),...t}));Js.displayName=`CardTitle`;var Ys=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`p`,{ref:n,className:u(`text-[13px] text-muted-foreground leading-relaxed`,e),...t}));Ys.displayName=`CardDescription`;var Xs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`p-6 pt-0`,e),...t}));Xs.displayName=`CardContent`;var Zs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`flex items-center justify-between p-6 pt-0`,e),...t}));Zs.displayName=`CardFooter`;function Qs({username:e}){let t=ct(),[n,r]=(0,H.useState)(e??``),[i,a]=(0,H.useState)(``),o=n.trim().length>0&&i.length>0&&!t.isPending;return(0,U.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,U.jsxs)(Ks,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,U.jsxs)(qs,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:b(`authBrand`)}),(0,U.jsx)(Js,{className:`text-2xl`,children:b(`authLoginTitle`)}),(0,U.jsx)(Ys,{children:b(`authLoginDescription`)})]}),(0,U.jsx)(Xs,{children:(0,U.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),o&&t.mutate({username:n.trim(),password:i})},children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:b(`authUsername`)}),(0,U.jsx)(St,{value:n,onChange:e=>r(e.target.value),placeholder:b(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:b(`authPassword`)}),(0,U.jsx)(St,{type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:b(`authPasswordPlaceholder`)})]}),(0,U.jsx)(R,{type:`submit`,className:`w-full`,disabled:!o,children:t.isPending?b(`authLoggingIn`):b(`authLoginAction`)})]})})]})})}var $s=class{constructor(){this.authPollTimerId=null,this.browserSignInCompletion=null,this.openAccountPanel=()=>{Vs.getState().openPanel()},this.closeAccountPanel=()=>{Vs.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),this.resolveBrowserSignIn(e),Vs.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=e?.status??await ks();return t.account.loggedIn?t:(this.openAccountPanel(),await this.startBrowserSignInAndWait({apiBase:e?.apiBase,status:t}))},this.startBrowserSignInAndWait=async e=>{let t=this.createBrowserSignInCompletion();return await this.startBrowserSignIn(e),await t},this.startBrowserSignIn=async e=>{try{let t=e?.apiBase,n=await pn({apiBase:js(e?.status??await ks(),t)});Vs.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:b(`remoteBrowserAuthWaiting`)}),(await Ai.openExternalUrl(n.verificationUri)).opened||Vs.getState().setAuthStatusMessage(b(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:b(`remoteBrowserAuthStartFailed`);this.rejectBrowserSignIn(e),L.error(`${b(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=async()=>{let e=Vs.getState().authVerificationUri;e&&await Ai.openExternalUrl(e)},this.logout=async()=>{try{await Dt(),this.rejectBrowserSignIn(Error(`Signed out before browser sign-in completed.`)),Vs.getState().clearBrowserAuth(),await As(),L.success(b(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:b(`remoteLogoutFailed`);L.error(`${b(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await xn({username:e.trim()}),await As(),L.success(b(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:b(`remoteAccountUsernameSetFailed`);L.error(`${b(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=Ns(await ks());if(!t){L.error(b(`remoteOpenWebUnavailable`));return}let n=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();await Ai.openExternalUrl(n)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=Vs.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=Vs.getState();if(e.authSessionId)try{let t=await ks(),n=await pt({sessionId:e.authSessionId,apiBase:js(t)});if(n.status===`pending`){Vs.getState().updateBrowserAuth({statusMessage:b(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),this.rejectBrowserSignIn(Error(n.message||b(`remoteBrowserAuthExpired`))),Vs.getState().clearBrowserAuth(),L.error(n.message||b(`remoteBrowserAuthExpired`));return}Vs.getState().setAuthStatusMessage(b(`remoteBrowserAuthCompleted`));let r=await As();this.clearPollTimer(),this.resolveBrowserSignIn(r),Vs.getState().clearBrowserAuth(),L.success(b(`remoteLoginSuccess`))}catch(e){this.clearPollTimer(),this.rejectBrowserSignIn(e),Vs.getState().clearBrowserAuth();let t=e instanceof Error?e.message:b(`remoteBrowserAuthPollFailed`);L.error(`${b(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.createBrowserSignInCompletion=()=>(this.rejectBrowserSignIn(Error(`Browser sign-in was replaced by a newer request.`)),new Promise((e,t)=>{this.browserSignInCompletion={resolve:e,reject:t}})),this.resolveBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.resolve(e))},this.rejectBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.reject(e instanceof Error?e:Error(String(e))))},this.getBrowserAuthSummary=()=>{let e=Vs.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?M(e.authExpiresAt):`-`}}}},ec=`nextclaw.app.viewport-layout`,tc=1;function nc(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function rc(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:nc(e),width:e,isSidebarCollapsed:!1,isMainSidebarAppGroupCollapsed:!1}}function ic(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}var ac=P()(ji(()=>rc(),{name:ec,version:tc,storage:Mi(()=>window.localStorage),partialize:e=>({isSidebarCollapsed:e.isSidebarCollapsed,isMainSidebarAppGroupCollapsed:e.isMainSidebarAppGroupCollapsed}),merge:(e,t)=>{let n=ic(e,`isSidebarCollapsed`),r=ic(e,`isMainSidebarAppGroupCollapsed`);return{...t,...n===null?{}:{isSidebarCollapsed:n},...r===null?{}:{isMainSidebarAppGroupCollapsed:r}}}})),oc=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>ac.getState(),this.setSidebarCollapsed=e=>{ac.setState({isSidebarCollapsed:e})},this.setMainSidebarAppGroupCollapsed=e=>{ac.setState({isMainSidebarAppGroupCollapsed:e})},this.collapseSidebarForDenseRightPanels=e=>{if(!e.isDocBrowserOpen||!e.isDocBrowserDocked||!e.isWorkspacePanelOpen)return;let t=this.getSnapshot();if(t.mode!==`desktop`||t.isSidebarCollapsed)return;let n=typeof t.width==`number`?t.width:typeof window>`u`?null:window.innerWidth;typeof n!=`number`||!Number.isFinite(n)||n>1800||this.setSidebarCollapsed(!0)},this.toggleSidebarCollapsed=()=>{ac.setState(e=>({isSidebarCollapsed:!e.isSidebarCollapsed}))},this.toggleMainSidebarAppGroupCollapsed=()=>{ac.setState(e=>({isMainSidebarAppGroupCollapsed:!e.isMainSidebarAppGroupCollapsed}))},this.resetForTests=()=>{this.consumerCount=0,this.stop(),ac.setState(rc())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;ac.setState({width:e,mode:nc(e)})}}};function sc({parentSessionLabel:e,onGoToParentSession:t}){if(!e)return null;let n=e.trim();return(0,U.jsx)(`div`,{"data-theme-surface":`header`,className:`bg-background/75 px-4 py-2 backdrop-blur-sm sm:px-5`,children:(0,U.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:[(0,U.jsx)(Ci,{className:`h-3.5 w-3.5`}),(0,U.jsxs)(`span`,{children:[b(`chatBackToParent`),n?` · ${n}`:``]})]})})}function cc({layoutMode:e,actions:t,leading:n,onBackToList:r,projectBadge:i,sessionTypeBadge:a,shouldShow:o,title:s,titleContent:c}){let l=e===`mobile`;return(0,U.jsxs)(`div`,{"data-testid":`chat-conversation-header`,"data-theme-surface":`header`,className:u(`bg-background/80 backdrop-blur-sm flex items-center justify-between shrink-0 overflow-hidden transition-colors duration-200`,l?`px-3 sm:px-3`:`px-4 sm:px-5`,o?`opacity-100`:`h-0 py-0 opacity-0`,o&&(l?`min-h-12 pb-2 pt-2`:`h-[52px]`)),style:l&&o?{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.5rem)`}:void 0,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-center gap-2`,children:[l&&r?(0,U.jsx)(V,{icon:(0,U.jsx)(Ci,{className:`h-4 w-4`}),label:b(`chat`),onClick:r,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`}):null,n,c??(0,U.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:s}),a,i]}),t]})}function lc(){let e=F();return(0,H.useCallback)(async t=>{let{invalidateSessionSkills:n=!0,sessionKey:r,patch:i,successMessage:a}=t;try{Ce(e,await Qe(r,i)),n&&await e.invalidateQueries({queryKey:[`ncp-session-skills`,r]}),a!==null&&L.success(a??b(`configSavedApplied`))}catch(e){throw L.error(b(`configSaveFailed`)+`: `+(e instanceof Error?e.message:String(e))),e}},[e])}function uc(){let e=lc();return async t=>{await e({sessionKey:t.sessionKey,patch:{label:t.label},successMessage:b(`configSavedApplied`)})}}function dc(){let e=lc();return async t=>{let{persistToServer:n,projectRoot:r,sessionKey:i}=t,a=b(r?`chatSessionProjectUpdated`:`chatSessionProjectCleared`);if(!n){L.success(a);return}await e({sessionKey:i,patch:{projectRoot:r},successMessage:a})}}function fc({icon:e,label:t,onClick:n,disabled:r=!1,destructive:i=!1}){return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),onClick:n,disabled:r,children:[(0,U.jsx)(e,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:t})]})}var pc={key:`slash`,marker:`/`};function mc(){return`composer-${Math.random().toString(36).slice(2,10)}`}function hc(e=``){return{id:mc(),type:`text`,text:e}}function gc(e){let{data:t,label:n,previewUrl:r,tokenKey:i,tokenKind:a}=e;return{id:mc(),type:`token`,tokenKind:a,tokenKey:i,label:n,previewUrl:r,data:t}}function _c(e){return e.type===`text`?e.text.length:1}function vc(){return[hc(``)]}function yc(e){return[hc(e)]}function bc(e){let t=[];for(let n of e){if(n.type===`text`){if(n.text.length===0)continue;let e=t[t.length-1];if(e?.type===`text`){t[t.length-1]={...e,text:e.text+n.text};continue}}t.push(n)}return t.length===0?vc():t}function xc(e){return e.map(e=>e.type===`text`?e.text:``).join(``)}function Sc(e){return e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Cc(e,t){let n=[],r=new Set;for(let i of e)i.type!==`token`||i.tokenKind!==t||r.has(i.tokenKey)||(r.add(i.tokenKey),n.push(i.tokenKey));return n}function wc(e,t,n,r){let i=Math.max(0,n-t),a=Math.max(0,t+e.text.length-r),o=[];return i>0&&o.push({...e,text:e.text.slice(0,i)}),a>0&&o.push({...e,text:e.text.slice(e.text.length-a)}),o}function Tc(e,t,n,r){return t<=n||e>=r}function Ec(e,t,n,r,i){return!n&&r>=i?(e.push(...t),!0):n}function Dc(e,t,n,r,i,a,o){let s=wc(t,n,r,i);s[0]&&e.push(s[0]);let c=o;return c||=(e.push(...a),!0),s[1]&&e.push(s[1]),c}function Oc(e,t,n,r,i,a){return!r&&i<=a?(e.push(...n),!0):(e.push(t),r)}function kc(e,t,n,r){let i=Math.max(0,t),a=Math.max(i,n),o=[],s=0,c=!1;for(let t of e){let e=_c(t),n=s,l=s+e;if(Tc(n,l,i,a)){c=Ec(o,r,c,n,a),o.push(t),s=l;continue}c=t.type===`text`?Dc(o,t,n,i,a,r,c):Oc(o,t,r,c,i,n),s=l}return c||o.push(...r),bc(o)}function Ac(e,t){return bc(e.filter(e=>e.type!==`token`||!t(e)))}function jc(e,t){return t===0||/\s/.test(e[t-1]??``)}function Mc(e,t,n){if(!t||t.start!==t.end)return null;let r=xc(e),i=t.end,a=r.slice(0,i),o=a.lastIndexOf(n.marker);if(o<0||!jc(a,o))return null;let s=a.slice(o+n.marker.length);return/[\s\uFFFC]/.test(s)?null:{key:n.key,marker:n.marker,query:s.trim().toLowerCase(),start:o,end:i}}function Nc(e,t,n=[pc]){let r=null;for(let i of n){let n=Mc(e,t,i);n&&(!r||n.start>r.start)&&(r=n)}return r}function Pc(e,t){let n=Mc(e,t,pc);return n?{query:n.query,start:n.start,end:n.end}:null}var Fc=e=>`[data-item-index="${e}"]`;function Ic(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??Fc;(0,H.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function Lc(){let e=(0,H.useRef)(null),[t,n]=(0,H.useState)(null);return(0,H.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function W(...e){return h(ie(e))}var Rc=H.forwardRef(({className:e,type:t,...n},r)=>(0,U.jsx)(`input`,{type:t,className:W(`flex h-9 w-full rounded-xl border border-border bg-card px-3.5 py-2 text-sm text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/55 placeholder:font-normal focus:outline-none focus:ring-0 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Rc.displayName=`ChatInput`;var zc=zr,Bc=Rr,Vc=Lr,Hc=H.forwardRef(({className:e,children:t,closeLabel:n,...r},i)=>(0,U.jsxs)(Hr,{children:[(0,U.jsx)(Gr,{className:`fixed inset-0 z-[var(--z-modal-backdrop,10000)] bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,U.jsxs)(Ir,{ref:i,className:W(`fixed left-[50%] top-[50%] z-[var(--z-modal,10050)] grid max-h-[min(42rem,calc(100vh-2rem))] w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto rounded-2xl border border-border bg-background p-6 text-foreground shadow-xl outline-none duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...r,children:[t,(0,U.jsxs)(Yr,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none`,children:[(0,U.jsx)(ki,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:n})]})]})]}));Hc.displayName=Ir.displayName;var Uc=({className:e,...t})=>(0,U.jsx)(`div`,{className:W(`flex flex-col gap-2 text-center sm:text-left`,e),...t}),Wc=`Popover`,[Gc,yee]=rr(Wc,[nr]),Kc=nr(),[qc,Jc]=Gc(Wc),Yc=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Kc(t),c=H.useRef(null),[l,u]=H.useState(!1),[d,f]=$n({prop:r,defaultProp:i??!1,onChange:a,caller:Wc});return(0,U.jsx)(er,{...s,children:(0,U.jsx)(qc,{scope:t,contentId:Xn(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:H.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:n})})};Yc.displayName=Wc;var Xc=`PopoverAnchor`,Zc=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Jc(Xc,n),a=Kc(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return H.useEffect(()=>(o(),()=>s()),[o,s]),(0,U.jsx)(tr,{...a,...r,ref:t})});Zc.displayName=Xc;var Qc=`PopoverTrigger`,$c=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Jc(Qc,n),a=Kc(n),o=ir(t,i.triggerRef),s=(0,U.jsx)(Jn.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ml(i.open),...r,ref:o,onClick:Kn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,U.jsx)(tr,{asChild:!0,...a,children:s})});$c.displayName=Qc;var el=`PopoverPortal`,[tl,nl]=Gc(el,{forceMount:void 0}),rl=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Jc(el,t);return(0,U.jsx)(tl,{scope:t,forceMount:n,children:(0,U.jsx)(Nr,{present:n||a.open,children:(0,U.jsx)(qn,{asChild:!0,container:i,children:r})})})};rl.displayName=el;var il=`PopoverContent`,al=H.forwardRef((e,t)=>{let n=nl(il,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Jc(il,e.__scopePopover);return(0,U.jsx)(Nr,{present:r||a.open,children:a.modal?(0,U.jsx)(sl,{...i,ref:t}):(0,U.jsx)(cl,{...i,ref:t})})});al.displayName=il;var ol=Yn(`PopoverContent.RemoveScroll`),sl=H.forwardRef((e,t)=>{let n=Jc(il,e.__scopePopover),r=H.useRef(null),i=ir(t,r),a=H.useRef(!1);return H.useEffect(()=>{let e=r.current;if(e)return ur(e)},[]),(0,U.jsx)(sr,{as:ol,allowPinchZoom:!0,children:(0,U.jsx)(ll,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kn(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Kn(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:Kn(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),cl=H.forwardRef((e,t)=>{let n=Jc(il,e.__scopePopover),r=H.useRef(!1),i=H.useRef(!1);return(0,U.jsx)(ll,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),ll=H.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Jc(il,n),p=Kc(n);return or(),(0,U.jsx)(cr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(Qn,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,U.jsx)(Gn,{"data-state":ml(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ul=`PopoverClose`,dl=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Jc(ul,n);return(0,U.jsx)(Jn.button,{type:`button`,...r,ref:t,onClick:Kn(e.onClick,()=>i.onOpenChange(!1))})});dl.displayName=ul;var fl=`PopoverArrow`,pl=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Kc(n);return(0,U.jsx)(Zn,{...i,...r,ref:t})});pl.displayName=fl;function ml(e){return e?`open`:`closed`}var hl=Yc,gl=Zc,_l=$c,vl=rl,yl=al,bee=`2rem`;function bl(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${bee})))`}var xee=bl(`24rem`),See=hl,Cee=_l,wee=gl,xl=H.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:r=12,style:i,...a},o)=>(0,U.jsx)(vl,{children:(0,U.jsx)(yl,{ref:o,sideOffset:t,align:n,collisionPadding:r,className:W(`z-[var(--z-popover,50)] w-72 overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-popover p-4 text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2`,e),style:{maxHeight:xee,...i},...a})}));xl.displayName=yl.displayName;var Tee=vr,Eee=mr,Dee=pr,Oee=`2rem`;function Sl(e){return`min(${e}, max(0px, calc(var(--radix-select-content-available-height, 100vh) - ${Oee})))`}var kee=Sl(`24rem`),Cl=H.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(Mr,{ref:r,className:W(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-border bg-card px-3 py-2 text-sm text-foreground shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-0 focus:border-border disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,U.jsx)(br,{asChild:!0,children:(0,U.jsx)(ar,{className:`h-4 w-4 opacity-50`})})]}));Cl.displayName=Mr.displayName;var wl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(dr,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(lr,{className:`h-4 w-4`})}));wl.displayName=dr.displayName;var Tl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(_r,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(ar,{className:`h-4 w-4`})}));Tl.displayName=_r.displayName;var El=H.forwardRef(({className:e,children:t,collisionPadding:n=12,position:r=`popper`,style:i,viewportClassName:a,...o},s)=>(0,U.jsx)(xr,{children:(0,U.jsxs)(Er,{ref:s,className:W(`relative z-50 flex max-h-96 min-w-[8rem] flex-col overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),collisionPadding:n,position:r,style:{maxHeight:kee,...i},...o,children:[(0,U.jsx)(wl,{}),(0,U.jsx)(jr,{className:W(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-1`,r===`popper`&&`w-full min-w-[var(--radix-select-trigger-width)]`,a),children:t}),(0,U.jsx)(Tl,{})]})}));El.displayName=Er.displayName;var Dl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(wr,{ref:n,className:W(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,e),...t}));Dl.displayName=wr.displayName;var Ol=H.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(Or,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(hr,{children:(0,U.jsx)(Ar,{className:`h-4 w-4`})})}),(0,U.jsx)(gr,{children:t})]}));Ol.displayName=Or.displayName;var kl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(kr,{ref:n,className:W(`-mx-1 my-1 h-px bg-border`,e),...t}));kl.displayName=kr.displayName;var Aee=ii,jee=xi,Mee=ei,Al=H.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,U.jsx)(Si,{children:(0,U.jsx)(yi,{ref:r,sideOffset:t,className:W(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));Al.displayName=yi.displayName;var jl={Dialog:zc,DialogContent:Hc,DialogDescription:Vc,DialogHeader:Uc,DialogTitle:Bc,Popover:See,PopoverAnchor:wee,PopoverContent:xl,PopoverTrigger:Cee,Input:Rc,Select:Tee,SelectContent:El,SelectGroup:Eee,SelectItem:Ol,SelectLabel:Dl,SelectSeparator:kl,SelectTrigger:Cl,SelectValue:Dee,Tooltip:jee,TooltipContent:Al,TooltipProvider:Aee,TooltipTrigger:Mee};function Nee({pathPreview:e}){return(0,U.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-gray-50/70 px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-gray-600`,children:[(0,U.jsx)(Ya,{"aria-hidden":`true`,className:`h-4 w-4 text-gray-400`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.rootLabel})]}),(0,U.jsx)(`div`,{className:`mt-2`,children:e.segments.map((e,t)=>{let n=e.kind===`directory`?Ya:Va;return(0,U.jsxs)(`div`,{className:`relative flex min-w-0 items-center gap-2 py-1 text-xs text-gray-700`,style:{paddingLeft:`${(t+1)*18}px`},children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-1/2 top-[-0.25rem] w-px bg-gray-200`,style:{left:`${t*18+7}px`}}),(0,U.jsx)(n,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-gray-400`}),(0,U.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]},`${t}:${e.label}`)})})]})}var Pee=680,Fee=.82,Iee=560,Ml=bl(`24rem`),Lee={back:Ci,"calendar-clock":la,command:Ca,file:Va,files:Ha,folder:Ya,inbox:ao,"list-collapse":mo,"message-square-plus":xo,"panel-app":di,project:Ua,skill:Fr};function Nl(e,t){return!t.sectionKeys||t.sectionKeys.length===0?!0:!!(e.sectionKey&&t.sectionKeys.includes(e.sectionKey))}function Ree(e,t){return e?.length?e.some(e=>e.key===t)?t:e[0].key:null}function zee({icon:e}){let t=Lee[e];return(0,U.jsx)(`span`,{"aria-hidden":`true`,"data-input-surface-icon":e,className:`inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-gray-100 text-gray-500`,children:(0,U.jsx)(t,{className:`h-3.5 w-3.5`})})}function Bee({item:e,texts:t}){return e?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.subtitle?(0,U.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:e.subtitle}):null,(0,U.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:e.title})]}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description}),e.pathPreview?(0,U.jsx)(Nee,{pathPreview:e.pathPreview}):null,(0,U.jsx)(`div`,{className:`space-y-1`,children:e.detailLines.map(e=>(0,U.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,U.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:e.hintLabel??t.itemHintLabel})]}):(0,U.jsx)(`div`,{className:`text-xs text-gray-500`,children:t.hintLabel})}function Pl(e){let{activeIndex:t,event:n,isOpen:r,items:i,onOpenChange:a,onSelectItem:o,setActiveIndex:s}=e;return r?n.key===`Escape`?(n.preventDefault(),a(!1),!0):i.length===0?!1:n.key===`ArrowDown`?(n.preventDefault(),s(e=>(e+1)%i.length),!0):n.key===`ArrowUp`?(n.preventDefault(),s(e=>(e-1+i.length)%i.length),!0):n.key===`Enter`&&!n.shiftKey||n.key===`Tab`?(n.preventDefault(),o(i[t]),!0):!1:!1}var Fl=(0,H.forwardRef)(function(e,t){let{Popover:n,PopoverAnchor:r,PopoverContent:i}=jl,{elementRef:a,width:o}=Lc(),s=(0,H.useRef)(null),[c,l]=(0,H.useState)({index:0,itemsSignature:``}),{isOpen:u,isLoading:d,filterOptions:f,items:p,notice:m,texts:h,onSelectItem:g,onOpenChange:_,onDetailsPointerDown:v}=e,[y,b]=(0,H.useState)(f?.[0]?.key??null),x=(0,H.useMemo)(()=>Ree(f,y),[y,f]),S=(0,H.useMemo)(()=>f?.find(e=>e.key===x)??null,[f,x]),C=(0,H.useMemo)(()=>f?.map(e=>({...e,count:p.filter(t=>Nl(t,e)).length}))??[],[f,p]),w=(0,H.useMemo)(()=>S?p.filter(e=>Nl(e,S)):p,[S,p]),T=(0,H.useMemo)(()=>w.map(e=>e.key).join(``),[w]),E=(0,H.useMemo)(()=>w.some(e=>!!e.sectionLabel?.trim()),[w]),D=c.itemsSignature===T?c.index:0,O=w.length===0?0:Math.min(D,w.length-1),k=w[O]??null,A=(0,H.useCallback)(e=>{b(e),l({index:0,itemsSignature:``})},[]),j=(0,H.useCallback)(e=>{l(t=>{let n=t.itemsSignature===T?t.index:0;return{index:typeof e==`function`?e(n):e,itemsSignature:T}})},[T]),M=(0,H.useCallback)(e=>{e.selectionBehavior===`navigate`&&l({index:0,itemsSignature:``}),g(e)},[g]),N=(0,H.useMemo)(()=>{if(o)return Math.min(o>Iee?o*Fee:o,Pee)},[o]);return(0,H.useImperativeHandle)(t,()=>({handleKeyDown:e=>Pl({activeIndex:O,event:e,isOpen:u,items:w,onOpenChange:_,onSelectItem:M,setActiveIndex:j})}),[O,u,_,M,j,w]),Ic({containerRef:s,activeIndex:O,itemCount:w.length,isEnabled:u&&!d,getItemSelector:e=>`[data-input-surface-index="${e}"]`}),(0,U.jsxs)(n,{open:u,onOpenChange:_,children:[(0,U.jsx)(r,{asChild:!0,children:(0,U.jsx)(`div`,{ref:a,className:`pointer-events-none absolute bottom-0 left-3 right-3 top-0`})}),(0,U.jsx)(i,{side:`top`,align:`start`,sideOffset:10,className:`z-[70] flex max-w-[calc(100vw-1.5rem)] flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md`,onOpenAutoFocus:e=>e.preventDefault(),style:{height:Ml,maxHeight:Ml,width:N?`${N}px`:void 0},children:(0,U.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col border-r border-gray-200`,children:[!d&&C.length>0?(0,U.jsx)(`div`,{className:`flex shrink-0 gap-0.5 overflow-x-auto px-2 pb-1.5 pt-2`,children:C.map(({count:e,key:t,label:n})=>{let r=t===x;return(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":r,onPointerDown:e=>e.preventDefault(),onClick:()=>A(t),className:`inline-flex h-7 shrink-0 items-center gap-1 rounded-md px-2 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 ${r?`bg-gray-100 text-gray-900`:`text-gray-600 hover:bg-gray-100 hover:text-gray-900`}`,children:[(0,U.jsx)(`span`,{children:n}),(0,U.jsx)(`span`,{className:r?`text-gray-500`:`text-gray-400`,children:e})]},t)})}):null,!d&&m?(0,U.jsxs)(`div`,{className:`mx-2 mb-1.5 flex items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-2.5 py-2 text-xs leading-4 text-red-700`,children:[(0,U.jsx)(Vr,{"aria-hidden":`true`,className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:m.message})]}):null,(0,U.jsx)(`div`,{ref:s,role:`listbox`,"aria-label":h.sectionLabel,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain ${!d&&C.length>0?`px-2 pb-2`:`p-2`}`,children:d?(0,U.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:h.loadingLabel}):(0,U.jsxs)(U.Fragment,{children:[E?null:(0,U.jsx)(`div`,{className:`mb-1 px-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:h.sectionLabel}),w.length===0?(0,U.jsx)(`div`,{className:`px-1.5 text-xs text-gray-400`,children:h.emptyLabel}):(0,U.jsx)(`div`,{children:w.map((e,t)=>{let{icon:n,key:r,sectionKey:i,sectionLabel:a,title:o,subtitle:s}=e,c=t===O,l=w[t-1];return(0,U.jsxs)(`div`,{children:[E&&a?.trim()&&l?.sectionKey!==i?(0,U.jsx)(`div`,{className:`px-1.5 pb-1 pt-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:a}):null,(0,U.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":c,"data-input-surface-index":t,onPointerMove:e=>{e.pointerType!==`touch`&&j(t)},onPointerDown:t=>{t.button>0||(t.preventDefault(),M(e))},onClick:t=>{t.detail===0&&M(e)},className:`flex w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left leading-4 transition-colors ${c?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-100`}`,children:[n?(0,U.jsx)(zee,{icon:n}):null,(0,U.jsx)(`span`,{className:`truncate text-xs font-medium`,children:o}),(0,U.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:s})]})]},r)})})]})})]}),(0,U.jsx)(`div`,{className:`custom-scrollbar min-h-0 min-w-0 select-text overflow-y-auto overscroll-contain p-2.5`,onPointerDown:v,children:(0,U.jsx)(Bee,{item:k,texts:h})})]})})]})});function Il(e){return`${e.key}:${e.marker}:${e.start}`}function Ll(e,t){return t.type===`insert-text`&&e.query===``&&e.end===e.start+e.marker.length}function Rl(e,t,n){if(!t)return null;let r=Il(t);return e===r?e:Ll(t,n)?r:null}function zl(e){let{children:t,inputSurface:n,onInputSurfaceTriggerChange:r,onSelectItem:i,triggerSpecs:a=[pc]}=e,o=(0,H.useRef)(null),s=(0,H.useRef)(!1),c=(0,H.useRef)(null),[l,u]=(0,H.useState)(null),d=!!n&&l!==null,f=(0,H.useCallback)((e,t)=>{c.current=e,u(e),r?.(e?t:null)},[r]),p=(0,H.useCallback)((e,t,n)=>{let r=Nc(e,t,a),i=Rl(c.current,r,n);f(i,i?r:null)},[f,a]),m=(0,H.useCallback)(e=>o.current?.handleKeyDown(e)??!1,[]),h=(0,H.useCallback)(e=>{!e&&!s.current&&f(null,null)},[f]);return(0,U.jsxs)(U.Fragment,{children:[t((0,H.useMemo)(()=>({onInputSurfaceKeyDown:m,onInputSurfaceOpenChange:h,onInputSurfaceSnapshotChange:p}),[m,h,p])),n&&d?(0,U.jsx)(Fl,{ref:o,isOpen:d,isLoading:n.isLoading,filterOptions:n.filterOptions,items:n.items,notice:n.notice,texts:n.texts,onSelectItem:e=>{e.selectionBehavior!==`navigate`&&f(null,null),i(e)},onOpenChange:h,onDetailsPointerDown:()=>{s.current=!0,requestAnimationFrame(()=>{s.current=!1})}},l):null]})}var Bl=Ut(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-border bg-card text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,secondary:`bg-muted text-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,ghost:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-muted text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Vl=H.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,U.jsx)(`button`,{className:W(Bl({variant:t,size:n,className:e})),ref:i,...r}));Vl.displayName=`ChatButton`;function Hl(){return(0,U.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-foreground shadow-[inset_0_0_0_1px_hsl(var(--border))]`})}function Ul({contextWindow:e}){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=jl,a=Math.max(0,Math.min(1,e.ratio)),o=Math.round(a*360);return(0,U.jsx)(r,{delayDuration:0,children:(0,U.jsxs)(t,{children:[(0,U.jsx)(i,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"aria-label":e.label,title:e.label,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[7px] rounded-full`,style:{background:`conic-gradient(hsl(var(--muted-foreground)) ${o}deg, hsl(var(--border)) 0deg)`}}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[10px] rounded-full bg-card`})]})}),(0,U.jsx)(n,{side:`top`,className:`max-w-[18rem]`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-5 font-semibold text-foreground`,children:[(0,U.jsx)(`span`,{children:e.label}),(0,U.jsx)(`span`,{children:e.percentLabel})]}),e.details.map(e=>(0,U.jsxs)(H.Fragment,{children:[e.dividerBefore?(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`my-2 border-t border-border/70`,"data-testid":`context-window-detail-divider`}):null,(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-5 text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:e.label}),(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:e.value})]})]},e.label))]})})]})})}function Wl({children:e,label:t}){let{Tooltip:n,TooltipContent:r,TooltipProvider:i,TooltipTrigger:a}=jl;return(0,U.jsx)(i,{delayDuration:250,children:(0,U.jsxs)(n,{children:[(0,U.jsx)(a,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:e})}),(0,U.jsx)(r,{side:`top`,className:`text-xs`,children:t})]})})}function Gl({isSending:e,canStopGeneration:t,sendDisabled:n,stopDisabled:r,stopHint:i,sendButtonLabel:a,sendIcon:o=`send`,stopButtonLabel:s,contextWindow:c,onSend:l,onStop:u}){return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?(0,U.jsx)(Ul,{contextWindow:c}):null,!e||!n?(0,U.jsx)(Wl,{label:a,children:(0,U.jsx)(Vl,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":a,onClick:()=>void l(),disabled:n,children:o===`continue`?(0,U.jsx)(Uo,{"data-testid":`chat-continue-input-icon`,className:`h-4 w-4`}):(0,U.jsx)(aa,{className:`h-5 w-5`})})}):t?(0,U.jsx)(Wl,{label:s,children:(0,U.jsx)(Vl,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void u(),disabled:r,children:(0,U.jsx)(Hl,{})})}):(0,U.jsx)(Wl,{label:i,children:(0,U.jsx)(Vl,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,disabled:!0,children:(0,U.jsx)(Hl,{})})})]})}function Kl(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}var ql=bl(`20rem`),Jl=`flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left text-sm text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50`;function Yl(e){let{Input:t}=jl,{onBack:n,picker:r}=e,i=(0,H.useRef)(null),a=(0,H.useId)(),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(0),u=(0,H.useMemo)(()=>new Set(r.selectedKeys),[r.selectedKeys]),d=(0,H.useMemo)(()=>r.groups?.filter(e=>e.options.length>0)??[],[r.groups]),f=(0,H.useMemo)(()=>d.length===0?null:d.map(e=>({...e,options:Kl(e.options,o)})).filter(e=>e.options.length>0),[d,o]),p=(0,H.useMemo)(()=>f===null?Kl(r.options,o):f.flatMap(e=>e.options),[f,r.options,o]),m=p.length===0?0:Math.min(c,p.length-1);Ic({containerRef:i,activeIndex:m,itemCount:p.length,isEnabled:p.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let h=e=>{if(u.has(e)){r.onSelectedKeysChange(r.selectedKeys.filter(t=>t!==e));return}r.onSelectedKeysChange([...r.selectedKeys,e])};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`shrink-0 space-y-1.5 p-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex h-7 items-center gap-1 rounded-md pr-2 text-sm font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,children:[(0,U.jsx)(da,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{children:r.title})]}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground/60`}),(0,U.jsx)(t,{value:o,onChange:e=>{s(e.target.value),l(0)},onKeyDown:e=>{if(p.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),l(Math.min(m+1,p.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),l(Math.max(m-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=p[m];t&&h(t.key)}}},placeholder:r.searchPlaceholder,role:`combobox`,"aria-controls":a,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":p[m]?`${a}-option-${m}`:void 0,className:`h-8 rounded-lg border-0 bg-muted/45 pl-7 text-xs shadow-none`})]})]}),(0,U.jsx)(`div`,{ref:i,id:a,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pb-1`,children:r.isLoading?(0,U.jsx)(`div`,{className:`p-4 text-xs text-muted-foreground`,children:r.loadingLabel}):p.length===0?(0,U.jsx)(`div`,{className:`p-4 text-center text-xs text-muted-foreground`,children:r.emptyLabel}):(0,U.jsx)(`div`,{children:(()=>{let e=f??[{key:`all-skills`,options:p}],t=0;return e.map(e=>(0,U.jsxs)(`div`,{children:[e.label?(0,U.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-medium text-muted-foreground/80`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=u.has(e.key),i=n===m;return(0,U.jsxs)(`button`,{type:`button`,id:`${a}-option-${n}`,role:`option`,"aria-selected":r,"aria-label":e.label,"data-skill-index":n,onMouseEnter:()=>l(n),onClick:()=>h(e.key),className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors ${i?`bg-[var(--interaction-hover)]`:`hover:bg-[var(--interaction-hover)]`}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm text-foreground`,children:e.label}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.description||e.key})]}),r?(0,U.jsx)(Ar,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]},e.key)})]},e.key))})()})}),r.manageHref&&r.manageLabel?(0,U.jsx)(`div`,{className:`shrink-0 px-2 pb-2 pt-1`,children:(0,U.jsxs)(`a`,{href:r.manageHref,className:`inline-flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,children:[r.manageLabel,(0,U.jsx)(fe,{className:`h-3 w-3`})]})}):null]})}function Xl(e){let{Popover:t,PopoverContent:n,PopoverTrigger:r,Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=jl,{accessories:c,label:l,picker:u}=e,[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(`actions`);return(0,U.jsxs)(t,{open:d,onOpenChange:e=>{f(e),e||m(`actions`)},children:[(0,U.jsx)(o,{children:(0,U.jsxs)(i,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:(0,U.jsx)(r,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":l,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,children:(0,U.jsx)(Di,{className:`h-4 w-4`})})})})}),(0,U.jsx)(a,{side:`top`,children:(0,U.jsx)(`p`,{className:`text-xs`,children:l})})]})}),(0,U.jsx)(n,{side:`top`,align:`start`,className:p===`skills`?`flex w-[min(340px,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border-border/80 p-0 shadow-md`:`w-[min(220px,calc(100vw-1rem))] rounded-xl border-border/80 p-1.5 shadow-md`,style:{maxHeight:ql},children:p===`actions`?(0,U.jsxs)(U.Fragment,{children:[c.map(e=>(0,U.jsxs)(`button`,{type:`button`,"aria-label":e.label,disabled:e.disabled,onClick:()=>{e.onClick?.(),f(!1)},className:Jl,children:[e.icon===`paperclip`?(0,U.jsx)(zo,{className:`h-4 w-4`}):null,(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label})]},e.key)),u?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>m(`skills`),className:Jl,children:[(0,U.jsx)(Fr,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:u.title}),(0,U.jsx)(fa,{className:`h-4 w-4 shrink-0 text-muted-foreground/60`})]}):null]}):u?(0,U.jsx)(Yl,{picker:u,onBack:()=>m(`actions`)}):null})]})}function Zl(e,t){let n=0;for(let r of t)if(r===e[n]&&(n+=1,n===e.length))return!0;return e.length===0}function Ql(e,t){let n=e.filter(Boolean).join(` `).toLowerCase(),r=n.replace(/[\s/_.-]+/g,``);return t.split(/\s+/).filter(Boolean).every(e=>{let t=e.replace(/[\s/_.-]+/g,``);return n.includes(e)||Zl(t,r)})}function $l(e,t,n){let r=n.trim().toLowerCase();return e.groups.filter(e=>e.options.length>0).filter(e=>t===`all`||e.key===t).map(e=>({...e,options:r?e.options.filter(e=>Ql([e.label,e.value,e.description],r)):e.options})).filter(e=>e.options.length>0)}function eu({discovery:e,onOpen:t}){return(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border/60 px-1.5 py-1`,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:t,children:[(0,U.jsx)(Fr,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.summaryLabel}),(0,U.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:e.viewLabel})]})})}function tu({discovery:e,open:t,onOpenChange:n,renderOption:r,restoreFocusRef:i}){let{Dialog:a,DialogContent:o,DialogDescription:s,DialogHeader:c,DialogTitle:l,Input:u}=jl,[d,f]=(0,H.useState)(``),[p,m]=(0,H.useState)(`all`),[h,g]=(0,H.useState)(null),[_,v]=(0,H.useState)(()=>new Set),y=(0,H.useMemo)(()=>e.groups.filter(e=>e.options.length>0),[e.groups]),b=p===`all`||y.some(e=>e.key===p)?p:`all`,x=(0,H.useMemo)(()=>$l(e,b,d),[e,d,b]),S=e=>{n(e),e||(f(``),m(`all`),g(null),v(new Set))},C=async t=>{if(!(h||_.has(t))){g(t);try{await e.onSelect(t),v(e=>new Set(e).add(t))}catch{return}finally{g(null)}}};return(0,U.jsx)(a,{open:t,onOpenChange:S,children:(0,U.jsxs)(o,{closeLabel:e.closeLabel,className:`flex h-[calc(100vh-1rem)] max-h-[42rem] w-[calc(100%-1rem)] max-w-2xl flex-col gap-0 overflow-hidden p-0 sm:h-[min(42rem,calc(100vh-2rem))]`,onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()},children:[(0,U.jsxs)(c,{className:`shrink-0 gap-1 border-b border-border/70 px-5 pb-4 pt-5 text-left`,children:[(0,U.jsx)(l,{className:`pr-8 text-lg font-semibold text-foreground`,children:e.groupLabel}),(0,U.jsx)(s,{className:`text-sm text-muted-foreground`,children:e.summaryLabel}),(0,U.jsxs)(`div`,{className:`relative pt-3`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-3 top-[1.375rem] h-4 w-4 text-muted-foreground/60`}),(0,U.jsx)(u,{autoFocus:!0,value:d,onChange:e=>f(e.currentTarget.value),placeholder:e.searchPlaceholder,className:`h-9 rounded-xl border-0 bg-muted/45 pl-9 text-sm shadow-none`})]}),(0,U.jsxs)(`div`,{role:`tablist`,"aria-label":e.groupLabel,className:`custom-scrollbar flex gap-1 overflow-x-auto overscroll-contain pt-2`,children:[(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":b===`all`,className:`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors ${b===`all`?`bg-foreground text-background`:`bg-muted/55 text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>m(`all`),children:e.allGroupLabel}),y.map(e=>(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":b===e.key,className:`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors ${b===e.key?`bg-foreground text-background`:`bg-muted/55 text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>m(e.key),children:e.label},e.key))]})]}),(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,children:[x.length===0?(0,U.jsx)(`p`,{className:`px-3 py-10 text-center text-sm text-muted-foreground`,children:e.searchEmptyLabel}):null,x.map(t=>(0,U.jsxs)(`div`,{children:[b===`all`?(0,U.jsx)(`div`,{className:`px-3 pb-1 pt-3 text-xs font-medium text-muted-foreground`,children:t.label}):null,t.options.map(t=>{let n=_.has(t.value);return(0,U.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-xl px-3 py-2 hover:bg-[var(--interaction-hover)]`,children:[(0,U.jsx)(`div`,{className:`min-w-0 overflow-hidden`,title:t.label,children:r(t)}),(0,U.jsxs)(`button`,{type:`button`,disabled:h!==null||n,className:`inline-flex h-8 min-w-16 shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-lg bg-primary/10 px-3 text-xs font-medium text-primary transition-colors hover:bg-primary/15 disabled:cursor-default disabled:bg-muted disabled:text-muted-foreground`,onClick:()=>void C(t.value),children:[h===t.value?(0,U.jsx)(Ei,{className:`h-3.5 w-3.5 animate-spin`}):null,n?e.addedLabel:e.actionLabel]})]},t.value)})]},t.key))]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-border/70 px-5 py-3`,children:[(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:()=>{e.onDismiss(),S(!1)},children:e.dismissLabel}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg bg-foreground px-4 py-2 text-xs font-medium text-background transition-opacity hover:opacity-85`,onClick:()=>S(!1),children:e.doneLabel})]})]})})}function nu({icon:e,className:t=``}){return e===`sparkles`?(0,U.jsx)(Fr,{className:`h-3.5 w-3.5 shrink-0 text-primary ${t}`}):e===`brain`?(0,U.jsx)(ca,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground ${t}`}):null}var ru={model:`min-w-0 max-w-[18rem]`,"session-type":`shrink-0`,thinking:`shrink-0`},iu={model:`w-[min(340px,calc(100vw-1rem))]`,"session-type":`w-[220px]`,thinking:`w-[180px]`},au=bl(`18rem`),ou=Sl(`18rem`);function su(e){return e.key===`model`&&e.selectedLabel&&e.selectedLabel.split(`/`).slice(1).join(`/`).trim()||e.selectedLabel}function cu(e){return e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[])}function lu({item:e}){let t=su(e);return e.selectedLabel?(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,U.jsx)(nu,{icon:e.icon,className:e.key===`model`?`hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:block`:void 0}),(0,U.jsx)(`span`,{className:`nextclaw-chat-toolbar-mobile-label truncate sm:hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`,children:t}),(0,U.jsx)(`span`,{className:`nextclaw-chat-toolbar-label hidden truncate sm:inline [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`,children:t})]}):e.loading?(0,U.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-muted`}):(0,U.jsx)(`span`,{className:`truncate`,children:e.placeholder})}function uu({option:e}){return e.description?(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label}),(0,U.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:e.description})]}):(0,U.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label})}function du({item:e}){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i,Tooltip:a,TooltipContent:o,TooltipProvider:s,TooltipTrigger:c}=jl,[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(``),h=(0,H.useRef)(null),g=cu(e),_=(0,H.useMemo)(()=>{let e=p.trim().toLowerCase();return e?g.map(t=>({...t,options:t.options.filter(t=>Ql([t.label,t.value,t.description],e))})).filter(e=>e.options.length>0):g},[g,p]),v=g.some(e=>e.options.length>0),y=_.some(e=>e.options.length>0),{discovery:b,optionAction:x}=e,S=new Set(x?.activeValues??[]),C=t=>{if(u(t),t){e.onOpen?.();return}m(``)};return(0,U.jsxs)(n,{open:l,onOpenChange:C,children:[(0,U.jsx)(i,{asChild:!0,children:(0,U.jsxs)(`button`,{ref:h,type:`button`,"aria-label":e.selectedLabel?`${e.placeholder}: ${e.selectedLabel}`:e.placeholder,disabled:e.disabled,className:`nextclaw-chat-toolbar-select-trigger inline-flex h-8 w-auto items-center justify-between rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50 sm:px-3 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!basis-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!justify-center [@container_nextclaw-chat-input-bar_(max-width:440px)]:!max-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!min-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!px-0 ${ru[e.key]??``}`,children:[(0,U.jsx)(lu,{item:e}),(0,U.jsx)(ar,{className:`ml-1 h-3.5 w-3.5 shrink-0 text-muted-foreground/70 [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`})]})}),(0,U.jsxs)(r,{className:`flex flex-col overflow-hidden rounded-2xl border-border/80 p-0 shadow-md ${iu[e.key]??``}`,style:{maxHeight:au},children:[(0,U.jsxs)(`div`,{className:`relative shrink-0 px-2 pb-1 pt-1.5`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-[18px] top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,U.jsx)(t,{value:p,onChange:e=>m(e.currentTarget.value),placeholder:e.search?.placeholder??e.placeholder,className:`h-7 rounded-lg border-0 bg-muted/45 pl-7 text-xs shadow-none`})]}),(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[v?null:e.loading?(0,U.jsxs)(`div`,{className:`space-y-2 px-2 py-1`,children:[(0,U.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,U.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.emptyLabel}):null,v&&!y?(0,U.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.search?.emptyLabel??e.emptyLabel}):null,(0,U.jsx)(`div`,{className:`px-1.5 pb-0.5`,children:_.map(t=>(0,U.jsxs)(`div`,{children:[t.label?(0,U.jsx)(`div`,{className:`px-2 pb-0.5 pt-1.5 text-[11px] font-medium text-muted-foreground/80`,children:t.label}):null,t.options.map(t=>{let n=e.value===t.value,r=S.has(t.value),i=r?x?.activeLabel:x?.inactiveLabel;return(0,U.jsxs)(`div`,{className:`group flex items-center gap-1 rounded-lg hover:bg-[var(--interaction-hover)]`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1 text-left leading-4`,onClick:()=>{e.onValueChange(t.value),C(!1)},children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(uu,{option:t})}),n?(0,U.jsx)(Ar,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]}),x&&i?(0,U.jsx)(s,{children:(0,U.jsxs)(a,{children:[(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":i,"aria-pressed":r,className:`mr-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-[background-color,color,opacity] hover:bg-card hover:text-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 ${r?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,onClick:e=>{e.stopPropagation(),x.onToggle(t.value,!r)},children:(0,U.jsx)(cs,{className:`h-3.5 w-3.5 ${r?`fill-current text-foreground`:``}`})})}),(0,U.jsx)(o,{side:`left`,children:(0,U.jsx)(`p`,{className:`text-xs`,children:i})})]})}):null]},t.value)})]},t.key))})]}),b?(0,U.jsx)(eu,{discovery:b,onOpen:()=>{C(!1),f(!0)}}):null,e.manageHref&&e.manageLabel?(0,U.jsx)(`div`,{className:`shrink-0 px-1.5 pb-1.5 pt-0.5`,children:(0,U.jsxs)(`a`,{href:e.manageHref,className:`inline-flex w-full items-center gap-1.5 rounded-lg px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,children:[e.manageLabel,(0,U.jsx)(fe,{className:`h-3 w-3`})]})}):null]}),b?(0,U.jsx)(tu,{discovery:b,open:d,onOpenChange:f,restoreFocusRef:h,renderOption:e=>(0,U.jsx)(uu,{option:e})}):null]})}function fu({item:e}){if(e.search)return(0,U.jsx)(du,{item:e});let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=jl,l=cu(e),u=l.some(e=>e.options.length>0);return(0,U.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,U.jsx)(s,{"aria-label":e.selectedLabel?`${e.placeholder}: ${e.selectedLabel}`:e.placeholder,title:e.selectedLabel,className:`nextclaw-chat-toolbar-select-trigger h-8 w-auto rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:ring-0 sm:px-3 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!basis-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!justify-center [@container_nextclaw-chat-input-bar_(max-width:440px)]:!max-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!min-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!px-0 ${ru[e.key]??``}`,children:e.selectedLabel||e.loading?(0,U.jsx)(lu,{item:e}):(0,U.jsx)(c,{placeholder:e.placeholder})}),(0,U.jsxs)(n,{className:iu[e.key]??``,style:{maxHeight:ou},children:[u?null:e.loading?(0,U.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:e.emptyLabel}):null,l.map((e,t)=>(0,U.jsxs)(`div`,{children:[t>0?(0,U.jsx)(o,{}):null,(0,U.jsxs)(r,{children:[e.label?(0,U.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,U.jsx)(i,{value:e.value,className:`py-1.5`,children:(0,U.jsx)(uu,{option:e})},e.value))]})]},e.key))]})]})}function pu({actions:e,accessories:t=[],addMenuLabel:n,selects:r,skillPicker:i,trailingSelects:a=[]}){let o=n??i?.title??t[0]?.label;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-2 px-3 pb-3`,children:[(0,U.jsxs)(`div`,{className:`nextclaw-chat-toolbar-leading-controls flex min-w-0 flex-1 flex-wrap items-center gap-1 overflow-hidden`,children:[o?(0,U.jsx)(Xl,{label:o,accessories:t,picker:i}):null,r.map(e=>(0,U.jsx)(fu,{item:e},e.key))]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-end gap-1`,children:[a.length>0?(0,U.jsx)(`div`,{className:`nextclaw-chat-toolbar-trailing-selects flex min-w-0 items-center gap-1`,children:a.map(e=>(0,U.jsx)(fu,{item:e},e.key))}):null,(0,U.jsx)(Gl,{...e})]})]})}var mu=(0,H.createContext)(null);function hu(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function gu(){let e=(0,H.useContext)(mu);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function G(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _u(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var vu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,yu=vu&&`documentMode`in document?document.documentMode:null,bu=vu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xu=vu&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Su=!(!vu||!(`InputEvent`in window)||yu)&&`getTargetRanges`in new window.InputEvent(`input`),Cu=vu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,wu=vu&&/Android/.test(navigator.userAgent),Tu=vu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!wu,Eu=vu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Du=vu&&wu&&Eu,Ou=vu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bu&&!Eu,ku=0,Au=1,ju=2,Mu=1,Nu=2,Pu=3,Fu=4,Iu=5,Lu=6,Ru=Tu||Cu||Ou?`\xA0`:``,zu=`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-ySrvolIe.js","assets/preload-helper-D4M6sveU.js","assets/chunk-HOUHSVGY-DPkq8FCm.js","assets/src-Bw-mzbQb.js","assets/chunk-DseTPa7n.js","assets/chunk-Y2CYZVJY-D1mAU_Po.js","assets/chunk-WYO6CB5R-Dn9To_OI.js","assets/chunk-ICXQ74PX-FAatv5fC.js","assets/dist--ta5rX12.js","assets/chunk-Q4XR5HBZ-DQFeUPxZ.js","assets/chunk-52WLFC77-viIcqj9q.js","assets/line-Cos7PIOj.js","assets/path-10BjdyLh.js","assets/array-BQVzeGRt.js","assets/chunk-7BUUIJ7U-BvydOcm3.js","assets/chunk-C7G6YPKG-DAizzYwr.js","assets/chunk-OGEWGWER-C3jdH3Ty.js","assets/chunk-ZGVPDNZ5-C6YtZDU0.js","assets/rough.esm-DxgC_14r.js","assets/chunk-FWX5IMBZ-D0ksHZZ9.js","assets/chunk-VAUOI2AC-BGvh3yIx.js","assets/chunk-ZIRB5QZD-DMuYtnHF.js","assets/docx-preview-BqwAjrj3.js","assets/jszip.min-8hyJpgpx.js","assets/aiden0z-pptx-renderer.es-Dp2ezlQn.js","assets/doc-browser-y3e2_MXe.js","assets/doc-browser-CKpps-rb.js","assets/dist-WPei0-v8.js","assets/react-BwGMzqXA.js","assets/dist-GWWehc4w.js","assets/createLucideIcon-CLfqNlvk.js","assets/search-BVeIVVGT.js","assets/book-open-DMnwJfVM.js","assets/navigation-link-DI0mOIVl.js","assets/host-capabilities-Tk038i04.js","assets/plus-C6Kx4b6T.js","assets/refresh-cw-DmR6-f9A.js","assets/x-27QFIvUt.js","assets/doc-browser-context-Vx418ptC.js","assets/middleware-DXsbf9xI.js","assets/model-config-page-DAseq1vr.js","assets/api-DU3C4HfX.js","assets/loader-circle-DXH2fVRq.js","assets/form-actions-DJlfyLEH.js","assets/skeleton-u2lc3JJg.js","assets/config-hints-nV5HPOvq.js","assets/appearance-settings-page-BLaxNij2.js","assets/select-DvuHOwPH.js","assets/mcp-marketplace-page-CEr3FgVp.js","assets/confirm-dialog-B539oJpr.js","assets/tag-chip-BI9NffVf.js","assets/search-config-page-Bi9J2kYR.js","assets/config-split-page-DON62DcK.js","assets/providers-config-page-zP-J1Asx.js","assets/extensions-Mc3juAVp.js","assets/channels-list-page-eUVEhukh.js","assets/runtime-config-page-D5KbQ3ue.js","assets/rotate-cw-BUWqEgob.js","assets/save-DdohrEEJ.js","assets/desktop-update-config-BWP2Pr4u.js","assets/security-config-CNdun2s-.js","assets/secrets-config-page-0MP2MSvq.js","assets/privacy-settings-page-COFa7LrK.js","assets/desktop-capabilities-page-FV7xowDx.js","assets/mcp-marketplace-page-Dj0xiFAV.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,t as n}from"./chunk-DseTPa7n.js";import{A as r,B as i,C as a,D as o,E as s,F as c,H as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,V as v,_ as y,a as b,b as x,c as S,f as C,g as w,h as T,i as E,j as D,k as O,n as k,o as A,p as j,r as M,s as N,t as P,v as ee,w as te,x as ne,y as re,z as ie}from"./react-BwGMzqXA.js";import{t as ae}from"./preload-helper-D4M6sveU.js";import{a as oe,c as se,d as ce,f as le,i as ue,l as de,n as fe,o as pe,r as me,s as he,t as ge,u as _e}from"./navigation-link-DI0mOIVl.js";import{$ as ve,$t as ye,A as be,An as F,B as xe,Bt as Se,C as Ce,Cn as we,Ct as Te,D as Ee,Dn as De,Dt as Oe,E as ke,En as Ae,Et as je,F as Me,Fn as Ne,Ft as Pe,Ht as Fe,I as Ie,In as Le,It as I,Jt as Re,L as ze,Ln as Be,Lt as Ve,M as He,N as Ue,Nt as We,O as Ge,On as eee,Ot as Ke,P as qe,Pn as Je,Pt as Ye,Q as Xe,Qt as Ze,R as Qe,Rn as $e,S as et,Sn as tt,St as nt,T as rt,Tn as it,Tt as at,Ut as ot,V as st,Vt as ct,X as lt,Yt as ut,Z as dt,Zt as ft,_ as pt,_n as L,_t as mt,a as ht,an as gt,at as _t,b as vt,bt as yt,c as bt,cn as xt,ct as tee,d as nee,dn as St,dt as Ct,en as wt,et as Tt,fn as R,ft as Et,g as Dt,gn as Ot,gt as kt,h as At,hn as jt,ht as Mt,i as Nt,it as Pt,j as Ft,k as It,kn as Lt,kt as Rt,l as zt,ln as Bt,lt as Vt,m as Ht,mn as Ut,mt as Wt,n as Gt,nn as Kt,nt as qt,o as Jt,on as Yt,ot as Xt,p as Zt,pn as Qt,pt as $t,qt as en,r as tn,rn as nn,rt as rn,s as an,sn as on,st as sn,t as cn,tt as ln,u as un,un as dn,ut as fn,v as pn,vn as z,vt as mn,w as hn,wn as gn,wt as _n,x as vn,xn as yn,xt as bn,y as xn,yn as Sn,yt as Cn,z as wn,zn as Tn,zt as En}from"./api-DU3C4HfX.js";import{C as Dn,S as On,T as kn,_ as An,a as jn,b as Mn,c as Nn,d as Pn,f as Fn,g as In,h as Ln,i as Rn,l as zn,m as Bn,n as Vn,o as ree,p as iee,r as aee,s as oee,u as see,v as Hn,w as Un,x as Wn,y as cee}from"./mcp-marketplace-page-CEr3FgVp.js";import{a as Gn,b as Kn,c as qn,d as Jn,f as Yn,h as Xn,i as Zn,l as Qn,m as $n,o as er,r as tr,s as nr,v as rr,y as ir}from"./dist-WPei0-v8.js";import{C as ar,D as or,E as sr,O as cr,S as lr,T as ur,_ as dr,a as fr,b as pr,c as mr,d as hr,f as gr,g as _r,h as vr,i as yr,l as br,m as xr,n as Sr,o as Cr,p as wr,r as Tr,s as Er,t as Dr,u as Or,v as kr,w as Ar,x as jr,y as Mr}from"./select-DvuHOwPH.js";import{t as Nr}from"./dist-GWWehc4w.js";import{a as Pr,c as Fr,d as Ir,f as Lr,g as Rr,h as zr,i as Br,l as Vr,m as Hr,n as Ur,o as Wr,p as Gr,r as Kr,s as qr,t as Jr,u as Yr}from"./confirm-dialog-B539oJpr.js";import{t as B}from"./createLucideIcon-CLfqNlvk.js";import{C as Xr,D as Zr,E as Qr,O as $r,S as ei,T as ti,_ as ni,a as ri,b as ii,c as ai,d as oi,f as si,g as ci,h as li,i as ui,k as di,l as fi,m as pi,n as mi,o as hi,p as V,r as gi,s as _i,u as vi,v as yi,w as bi,x as xi,y as Si}from"./doc-browser-CKpps-rb.js";import{n as Ci,t as wi}from"./search-BVeIVVGT.js";import{t as Ti}from"./book-open-DMnwJfVM.js";import{t as Ei}from"./loader-circle-DXH2fVRq.js";import{t as Di}from"./plus-C6Kx4b6T.js";import{t as Oi}from"./refresh-cw-DmR6-f9A.js";import{t as ki}from"./x-27QFIvUt.js";import{t as Ai}from"./host-capabilities-Tk038i04.js";import{n as ji,t as Mi}from"./middleware-DXsbf9xI.js";import{t as Ni}from"./skeleton-u2lc3JJg.js";import{_ as Pi,a as Fi,c as Ii,d as Li,g as Ri,h as zi,i as Bi,l as Vi,n as Hi,o as Ui,p as Wi,r as Gi,s as Ki,t as qi,u as Ji,v as Yi}from"./doc-browser-context-Vx418ptC.js";import{t as Xi}from"./tag-chip-BI9NffVf.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Zi=n((e=>{var t=v();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function Qi(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function $i(e,t,n){let r=e.slice(0);return r[t]=n,r}var ea=class extends Tn{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Ne.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!$e(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Qi(e,n).forEach(e=>{e.destroy()}),Qi(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Be(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Je(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=$i(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&Ne.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(l(),1);function ta({queries:e,...t},n){let r=F(n),i=eee(),a=De(),o=H.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{yn(e),gn(e,a,r.getQueryCache().get(e.queryHash))}),Ae(a);let[s]=H.useState(()=>new ea(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;H.useSyncExternalStore(H.useCallback(e=>d?s.subscribe(Ne.batchCalls(e)):Le,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),H.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>we(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&we(n,e)?tt(n,new Je(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&it({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var na=B(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ra=B(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),ia=B(`Archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),lee=B(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),uee=B(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),aa=B(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),dee=B(`Blocks`,[[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`path`,{d:`M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3`,key:`1fpvtg`}]]),fee=B(`BookOpenText`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),pee=B(`Bookmark`,[[`path`,{d:`m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z`,key:`1fy3hk`}]]),oa=B(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),mee=B(`Braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),sa=B(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),ca=B(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),hee=B(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),la=B(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),ua=B(`CalendarDays`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),gee=B(`ChartNoAxesColumnIncreasing`,[[`line`,{x1:`12`,x2:`12`,y1:`20`,y2:`10`,key:`1vz5eb`}],[`line`,{x1:`18`,x2:`18`,y1:`20`,y2:`4`,key:`cun8e5`}],[`line`,{x1:`6`,x2:`6`,y1:`20`,y2:`16`,key:`hq0ia6`}]]),_ee=B(`ChartNoAxesColumn`,[[`line`,{x1:`18`,x2:`18`,y1:`20`,y2:`10`,key:`1xfpm4`}],[`line`,{x1:`12`,x2:`12`,y1:`20`,y2:`4`,key:`be30l9`}],[`line`,{x1:`6`,x2:`6`,y1:`20`,y2:`14`,key:`1r4le6`}]]),da=B(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),fa=B(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),vee=B(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),pa=B(`ChevronsUp`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),ma=B(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ha=B(`CircleDashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),ga=B(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_a=B(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),va=B(`CirclePlay`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polygon`,{points:`10 8 16 12 10 16 10 8`,key:`1cimsy`}]]),ya=B(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ba=B(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),xa=B(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Sa=B(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Ca=B(`Command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),wa=B(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ta=B(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ea=B(`CornerDownRight`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),Da=B(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Oa=B(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),ka=B(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Aa=B(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ja=B(`Expand`,[[`path`,{d:`m21 21-6-6m6 6v-4.8m0 4.8h-4.8`,key:`1c15vz`}],[`path`,{d:`M3 16.2V21m0 0h4.8M3 21l6-6`,key:`1fsnz2`}],[`path`,{d:`M21 7.8V3m0 0h-4.8M21 3l-6 6`,key:`hawz9i`}],[`path`,{d:`M3 7.8V3m0 0h4.8M3 3l6 6`,key:`u9ee12`}]]),Ma=B(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Na=B(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),Pa=B(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),Fa=B(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Ia=B(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),La=B(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Ra=B(`FilePlus2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),za=B(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Ba=B(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),Va=B(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ha=B(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),Ua=B(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Wa=B(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ga=B(`FolderPlus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ka=B(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),qa=B(`FolderUp`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),Ja=B(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),Ya=B(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xa=B(`Forward`,[[`polyline`,{points:`15 17 20 12 15 7`,key:`1w3sku`}],[`path`,{d:`M4 18v-2a4 4 0 0 1 4-4h12`,key:`jmiej9`}]]),Za=B(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Qa=B(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),$a=B(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),eo=B(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),to=B(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),no=B(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),ro=B(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),io=B(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ao=B(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),oo=B(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),so=B(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),co=B(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),lo=B(`LayoutDashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),uo=B(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),fo=B(`Lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),po=B(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),mo=B(`ListCollapse`,[[`path`,{d:`m3 10 2.5-2.5L3 5`,key:`i6eama`}],[`path`,{d:`m3 19 2.5-2.5L3 14`,key:`w2gmor`}],[`path`,{d:`M10 6h11`,key:`c7qv1k`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 18h11`,key:`11hvi2`}]]),ho=B(`ListTodo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),go=B(`ListTree`,[[`path`,{d:`M21 12h-8`,key:`1bmf0i`}],[`path`,{d:`M21 6H8`,key:`1pqkrb`}],[`path`,{d:`M21 18h-8`,key:`1tm79t`}],[`path`,{d:`M3 6v4c0 1.1.9 2 2 2h3`,key:`1ywdgy`}],[`path`,{d:`M3 10v6c0 1.1.9 2 2 2h3`,key:`2wc746`}]]),_o=B(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),vo=B(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),yo=B(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),bo=B(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),xo=B(`MessageSquarePlus`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),So=B(`MessageSquareQuote`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M8 12a2 2 0 0 0 2-2V8H8`,key:`1jfesj`}],[`path`,{d:`M14 12a2 2 0 0 0 2-2V8h-2`,key:`1dq9mh`}]]),Co=B(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),wo=B(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),To=B(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),Eo=B(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Do=B(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Oo=B(`MonitorCog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m15.2 4.9-.9-.4`,key:`12wd2u`}],[`path`,{d:`m15.2 7.1-.9.4`,key:`1r2vl7`}],[`path`,{d:`m16.9 3.2-.4-.9`,key:`3zbo91`}],[`path`,{d:`m16.9 8.8-.4.9`,key:`1qr2dn`}],[`path`,{d:`m19.5 2.3-.4.9`,key:`1rjrkq`}],[`path`,{d:`m19.5 9.7-.4-.9`,key:`heryx5`}],[`path`,{d:`m21.7 4.5-.9.4`,key:`17fqt1`}],[`path`,{d:`m21.7 7.5-.9-.4`,key:`14zyni`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),ko=B(`Monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Ao=B(`Newspaper`,[[`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`,key:`7pis2x`}],[`path`,{d:`M18 14h-8`,key:`sponae`}],[`path`,{d:`M15 18h-5`,key:`95g1m2`}],[`path`,{d:`M10 6h8v4h-8V6Z`,key:`smlsk5`}]]),jo=B(`NotebookText`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),Mo=B(`PackagePlus`,[[`path`,{d:`M16 16h6`,key:`100bgy`}],[`path`,{d:`M19 13v6`,key:`85cyf1`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),No=B(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Po=B(`PanelLeftClose`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Fo=B(`PanelLeftDashed`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 14v1`,key:`askpd8`}],[`path`,{d:`M9 19v2`,key:`16tejx`}],[`path`,{d:`M9 3v2`,key:`1noubl`}],[`path`,{d:`M9 9v1`,key:`19ebxg`}]]),Io=B(`PanelLeftOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Lo=B(`PanelLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Ro=B(`PanelRightClose`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),zo=B(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),Bo=B(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),Vo=B(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),Ho=B(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Uo=B(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Wo=B(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Go=B(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),Ko=B(`RefreshCcw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),qo=B(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Jo=B(`Send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Yo=B(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Xo=B(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Zo=B(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Qo=B(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),$o=B(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),es=B(`ShieldPlus`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9 12h6`,key:`1c52cq`}],[`path`,{d:`M12 9v6`,key:`199k2o`}]]),ts=B(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),ns=B(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),rs=B(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),is=B(`SquareCheck`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),as=B(`SquarePen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),os=B(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ss=B(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),cs=B(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ls=B(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),us=B(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ds=B(`TextQuote`,[[`path`,{d:`M17 6H3`,key:`16j9eg`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 18H8`,key:`1wfozv`}],[`path`,{d:`M3 12v6`,key:`fv4c87`}]]),fs=B(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),ps=B(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ms=B(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),hs=B(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),gs=B(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),_s=B(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),vs=B(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),ys=B(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),bs=Zi(),U=i(),xs={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function Ss({status:e,label:t,className:n}){let r=xs[e];return(0,U.jsxs)(`div`,{className:u(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,r.bg,n),children:[(0,U.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,U.jsx)(`span`,{className:u(`text-[11px] font-medium`,r.text),children:t})]})}function Cs(){return Sn({queryKey:Es,queryFn:At,staleTime:5e3,refetchOnWindowFocus:!0})}function ws(e){let{label:t,muted:n,value:r}=e;return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:t}),(0,U.jsx)(`span`,{className:n?`text-right text-muted-foreground`:`text-right text-foreground`,children:r==null||r===``?`-`:String(r)})]})}function Ts(){let e=P9(),t=Cs(),n=t.data,r=Ps(e=>e.actionLabel),i=(0,H.useMemo)(()=>Bs(n),[n]),a=!!r,o=n?.runtime?.deviceName?.trim()||n?.settings.deviceName?.trim()||b(`remoteDeviceNameAuto`),s=!!(n?.account.loggedIn&&Ns(n)),{hero:c,issueHint:l}=i;return(0,H.useEffect)(()=>{e.remoteAccessManager.syncStatus(n)},[e,n]),t.isLoading&&!n?(0,U.jsx)(on,{title:b(`remotePageTitle`),description:b(`remotePageDescription`),children:(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:b(`remoteLoading`)})}):(0,U.jsx)(on,{title:b(`remotePageTitle`),description:b(`remotePageDescription`),children:(0,U.jsxs)(`div`,{className:`grid gap-7 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,U.jsx)(Yt,{title:c.title,description:c.description,actions:(0,U.jsx)(Ss,{status:c.badgeStatus,label:c.badgeLabel}),children:(0,U.jsx)(gt,{children:(0,U.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(ws,{label:b(`remoteSignedInAccount`),value:n?.account.email}),(0,U.jsx)(ws,{label:b(`remoteDeviceName`),value:o}),(0,U.jsx)(ws,{label:b(`remoteConnectionStatus`),value:c.badgeLabel}),(0,U.jsx)(ws,{label:b(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?M(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[i.primaryAction?(0,U.jsxs)(R,{onClick:()=>{if(i.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(n);return}if(i.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(n);return}e.remoteAccessManager.enableRemoteAccess(n)},disabled:a,children:[i.primaryAction.showRefreshIcon?(0,U.jsx)(Ko,{className:`mr-2 h-4 w-4`}):null,r||i.primaryAction.label]}):null,(0,U.jsxs)(R,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:a||!s,children:[(0,U.jsx)(rs,{className:`mr-2 h-4 w-4`}),b(`remoteOpenDeviceList`)]}),n?.settings.enabled?(0,U.jsx)(R,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(n),disabled:a,children:b(`remoteDisable`)}):null]}),i.shouldShowIssueHint&&l?(0,U.jsx)(Dn,{tone:`warning`,title:l.title,description:l.body}):null,(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`remoteOpenWebHint`)})]})})}),(0,U.jsx)(Yt,{title:(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(co,{className:`h-4 w-4 text-primary`}),b(`remoteDeviceSectionTitle`)]}),description:b(`remoteDeviceSectionDescription`),children:(0,U.jsx)(gt,{children:(0,U.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(Ss,{status:n?.account.loggedIn?`ready`:`inactive`,label:n?.account.loggedIn?b(`remoteAccountConnected`):b(`remoteAccountNotConnected`)}),(0,U.jsx)(Ss,{status:n?.settings.enabled?`active`:`inactive`,label:n?.settings.enabled?b(`remoteEnabled`):b(`remoteStateDisabled`)}),(0,U.jsx)(Ss,{status:n?.service.running?`active`:`inactive`,label:n?.service.running?b(`remoteServiceRunning`):b(`remoteServiceStopped`)})]}),(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(ws,{label:b(`remoteDeviceName`),value:o}),(0,U.jsx)(ws,{label:b(`remoteConnectionStatus`),value:c.badgeLabel}),(0,U.jsx)(ws,{label:b(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?M(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,U.jsx)(Dn,{tone:`neutral`,borderStyle:`dashed`,description:n?.account.loggedIn?b(`remoteOpenWebHint`):b(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})})})]})})}var Es=[`remote-status`],Ds=`https://platform.nextclaw.io`,Os=`https://nextclaw-platform-console.pages.dev`,ks=async()=>await jt.fetchQuery({queryKey:Es,queryFn:At,staleTime:5e3}),As=async()=>(await jt.invalidateQueries({queryKey:Es}),await ks()),js=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function Ms(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return Ds;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return Os}var Ns=e=>Ms(e?.account.apiBase)||Ms(e?.settings.platformApiBase)||Ms(e?.platformBase)||Ms(e?.account.platformBase)||void 0,Ps=P(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),Fs=class{constructor(e){this.params=e,this.syncStatus=e=>{if(!e)return;let t=Ps.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{Ps.getState().setEnabled(e)},this.setDeviceName=e=>{Ps.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{Ps.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{Ps.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await As(),n=Ps.getState(),r=await this.ensureRemoteAccount(t,n.platformApiBase);await this.applyEnabledState(!0,r)},this.disableRemoteAccess=async e=>{let t=e??await As();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await As(),n=(await this.ensureRemoteAccount(t)).service.running?`restart`:`start`;await this.runManagedAction({actionLabel:b(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await Zt(n);let e=await As();this.hydrateDraftFromStatus(e)},successMessage:b(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await As(),n=await this.params.accountManager.startBrowserSignInAndWait({status:t,apiBase:Ps.getState().platformApiBase});await this.repairRemoteAccess(n)},this.saveAdvancedSettings=async e=>{let t=e??await As(),n=Ps.getState();await this.runManagedAction({actionLabel:b(`remoteActionSavingAdvanced`),job:async()=>{await vt({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await As();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?b(`remoteSettingsSaved`):b(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:b(`remoteDoctorRunning`),job:async()=>{let e=await Ht();Ps.getState().setDoctor(e)},successMessage:b(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,b(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,b(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,b(`remoteActionStopping`))},this.applyEnabledState=async(e,t)=>{let n=Ps.getState();await this.runManagedAction({actionLabel:b(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await vt({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await As();this.hydrateDraftFromStatus(r),e?await Zt(r.service.running?`restart`:`start`):t.service.running&&await Zt(`restart`);let i=await As();this.hydrateDraftFromStatus(i)},successMessage:b(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.ensureRemoteAccount=async(e,t)=>e.account.loggedIn?e:await this.params.accountManager.ensureSignedIn({apiBase:t,status:e}),this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await Zt(e),n=await As();this.hydrateDraftFromStatus(n),L.success(t.message)}})},this.hydrateDraftFromStatus=e=>{Ps.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{let{actionLabel:t,job:n,successMessage:r}=e;Ps.getState().beginAction(t);try{await n(),r&&L.success(r)}catch(e){let t=e instanceof Error?e.message:b(`error`);throw L.error(t),e}finally{Ps.getState().finishAction()}}}},Is=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function Ls(e){return e?.runtime?.lastError?.trim()||``}function Rs(e){let t=b(`remoteStatusIssueDetailGeneric`),n=Ls(e);return n?`${t} (${n})`:t}function zs(e){if(!e?.settings.enabled)return!1;let t=Ls(e);return Is.some(e=>e.test(t))}function Bs(e){return zs(e)?{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteStateReauthorizationRequired`),title:b(`remoteStatusReauthorizationTitle`),description:b(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:b(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:b(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:b(`statusReady`),title:b(`remoteStatusReadyTitle`),description:b(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:b(`connecting`),title:b(`remoteStatusConnectingTitle`),description:b(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteStateDisconnected`),title:b(`remoteStatusIssueTitle`),description:b(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:Rs(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteServiceStopped`),title:b(`remoteStatusNeedsServiceTitle`),description:b(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:b(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:b(`statusInactive`),title:b(`remoteStatusNeedsEnable`),description:b(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:b(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:b(`statusSetup`),title:b(`remoteStatusNeedsSignIn`),description:b(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:b(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var Vs=P(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function Hs({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,U.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function Us(e){let{email:t,username:n,role:r,canSubmitUsername:i,savingUsername:a,usernameDraft:o,onUsernameDraftChange:s,onSubmitUsername:c,onOpenDeviceList:l,onLogout:u}=e;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`success`,title:b(`accountPanelSignedInTitle`),description:b(`accountPanelSignedInDescription`)}),(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(Hs,{label:b(`remoteAccountEmail`),value:t}),(0,U.jsx)(Hs,{label:b(`remoteAccountUsername`),value:n}),(0,U.jsx)(Hs,{label:b(`remoteAccountRole`),value:r})]}),n?(0,U.jsx)(`p`,{className:`text-xs text-gray-500`,children:b(`remoteAccountUsernameLockedHelp`)}):(0,U.jsxs)(Dn,{tone:`warning`,title:b(`remoteAccountUsernameRequiredTitle`),description:b(`remoteAccountUsernameRequiredDescription`),children:[(0,U.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`account-panel-username`,children:b(`remoteAccountUsername`)}),(0,U.jsx)(St,{id:`account-panel-username`,value:o,onChange:e=>s(e.target.value),placeholder:b(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,U.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,U.jsx)(R,{disabled:!i,onClick:()=>void c(),children:b(a?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,U.jsxs)(R,{onClick:()=>void l(),children:[(0,U.jsx)(rs,{className:`mr-2 h-4 w-4`}),b(`remoteOpenDeviceList`)]}),(0,U.jsxs)(R,{variant:`outline`,onClick:()=>void u(),children:[(0,U.jsx)(vo,{className:`mr-2 h-4 w-4`}),b(`remoteLogout`)]})]})]})}function Ws(e){let{authSessionId:t,authExpiresAt:n,authStatusMessage:r,authVerificationUri:i,onStartBrowserSignIn:a,onResumeBrowserSignIn:o}=e;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`neutral`,title:b(`accountPanelSignedOutTitle`),description:b(`accountPanelSignedOutDescription`),children:t?(0,U.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,U.jsx)(Hs,{label:b(`remoteBrowserAuthSession`),value:t}),(0,U.jsx)(Hs,{label:b(`remoteBrowserAuthExpiresAt`),value:n?M(n):`-`})]}):null}),r?(0,U.jsx)(`p`,{className:`text-sm text-gray-600`,children:r}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,U.jsx)(R,{onClick:()=>void a(),children:b(t?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),i?(0,U.jsx)(R,{variant:`outline`,onClick:()=>void o(),children:b(`remoteBrowserAuthResume`)}):null]})]})}function Gs(){let e=A9(),t=Cs(),n=Vs(e=>e.panelOpen),r=Vs(e=>e.authSessionId),i=Vs(e=>e.authVerificationUri),a=Vs(e=>e.authExpiresAt),o=Vs(e=>e.authStatusMessage),s=t.data,[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1);(0,H.useEffect)(()=>{e.accountManager.syncRemoteStatus(s)},[e,s]);let f=!u&&c.trim().length>0&&!s?.account.username;return(0,U.jsx)(Ur,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,U.jsxs)(Kr,{className:`max-w-xl`,children:[(0,U.jsxs)(Wr,{children:[(0,U.jsxs)(qr,{className:`flex items-center gap-2`,children:[(0,U.jsx)(oo,{className:`h-5 w-5 text-primary`}),b(`accountPanelTitle`)]}),(0,U.jsx)(Br,{children:b(`accountPanelDescription`)})]}),s?.account.loggedIn?(0,U.jsx)(Us,{email:s.account.email,username:s.account.username,role:s.account.role,canSubmitUsername:f,savingUsername:u,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:async()=>{d(!0);try{await e.accountManager.updateUsername(c)}finally{d(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,U.jsx)(Ws,{authSessionId:r,authExpiresAt:a,authStatusMessage:o,authVerificationUri:i,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}var Ks=H.forwardRef(({className:e,hover:t=!0,surface:n=`raised`,...r},i)=>(0,U.jsx)(`div`,{ref:i,className:u(`rounded-2xl border bg-card text-card-foreground transition-colors duration-base`,n===`raised`?`border-border shadow-card`:`border-border/75 shadow-none`,t&&n===`raised`&&`hover:border-primary/25 hover:shadow-card-hover`,t&&n===`flat`&&`hover:bg-muted/40`,e),...r}));Ks.displayName=`Card`;var qs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`flex flex-col space-y-1.5 p-6`,e),...t}));qs.displayName=`CardHeader`;var Js=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`h3`,{ref:n,className:u(`text-[15px] font-semibold leading-tight tracking-tight text-foreground`,e),...t}));Js.displayName=`CardTitle`;var Ys=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`p`,{ref:n,className:u(`text-[13px] text-muted-foreground leading-relaxed`,e),...t}));Ys.displayName=`CardDescription`;var Xs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`p-6 pt-0`,e),...t}));Xs.displayName=`CardContent`;var Zs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`flex items-center justify-between p-6 pt-0`,e),...t}));Zs.displayName=`CardFooter`;function Qs({username:e}){let t=ct(),[n,r]=(0,H.useState)(e??``),[i,a]=(0,H.useState)(``),o=n.trim().length>0&&i.length>0&&!t.isPending;return(0,U.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,U.jsxs)(Ks,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,U.jsxs)(qs,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:b(`authBrand`)}),(0,U.jsx)(Js,{className:`text-2xl`,children:b(`authLoginTitle`)}),(0,U.jsx)(Ys,{children:b(`authLoginDescription`)})]}),(0,U.jsx)(Xs,{children:(0,U.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),o&&t.mutate({username:n.trim(),password:i})},children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:b(`authUsername`)}),(0,U.jsx)(St,{value:n,onChange:e=>r(e.target.value),placeholder:b(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:b(`authPassword`)}),(0,U.jsx)(St,{type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:b(`authPasswordPlaceholder`)})]}),(0,U.jsx)(R,{type:`submit`,className:`w-full`,disabled:!o,children:t.isPending?b(`authLoggingIn`):b(`authLoginAction`)})]})})]})})}var $s=class{constructor(){this.authPollTimerId=null,this.browserSignInCompletion=null,this.openAccountPanel=()=>{Vs.getState().openPanel()},this.closeAccountPanel=()=>{Vs.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),this.resolveBrowserSignIn(e),Vs.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=e?.status??await ks();return t.account.loggedIn?t:(this.openAccountPanel(),await this.startBrowserSignInAndWait({apiBase:e?.apiBase,status:t}))},this.startBrowserSignInAndWait=async e=>{let t=this.createBrowserSignInCompletion();return await this.startBrowserSignIn(e),await t},this.startBrowserSignIn=async e=>{try{let t=e?.apiBase,n=await pn({apiBase:js(e?.status??await ks(),t)});Vs.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:b(`remoteBrowserAuthWaiting`)}),(await Ai.openExternalUrl(n.verificationUri)).opened||Vs.getState().setAuthStatusMessage(b(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:b(`remoteBrowserAuthStartFailed`);this.rejectBrowserSignIn(e),L.error(`${b(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=async()=>{let e=Vs.getState().authVerificationUri;e&&await Ai.openExternalUrl(e)},this.logout=async()=>{try{await Dt(),this.rejectBrowserSignIn(Error(`Signed out before browser sign-in completed.`)),Vs.getState().clearBrowserAuth(),await As(),L.success(b(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:b(`remoteLogoutFailed`);L.error(`${b(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await xn({username:e.trim()}),await As(),L.success(b(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:b(`remoteAccountUsernameSetFailed`);L.error(`${b(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=Ns(await ks());if(!t){L.error(b(`remoteOpenWebUnavailable`));return}let n=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();await Ai.openExternalUrl(n)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=Vs.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=Vs.getState();if(e.authSessionId)try{let t=await ks(),n=await pt({sessionId:e.authSessionId,apiBase:js(t)});if(n.status===`pending`){Vs.getState().updateBrowserAuth({statusMessage:b(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),this.rejectBrowserSignIn(Error(n.message||b(`remoteBrowserAuthExpired`))),Vs.getState().clearBrowserAuth(),L.error(n.message||b(`remoteBrowserAuthExpired`));return}Vs.getState().setAuthStatusMessage(b(`remoteBrowserAuthCompleted`));let r=await As();this.clearPollTimer(),this.resolveBrowserSignIn(r),Vs.getState().clearBrowserAuth(),L.success(b(`remoteLoginSuccess`))}catch(e){this.clearPollTimer(),this.rejectBrowserSignIn(e),Vs.getState().clearBrowserAuth();let t=e instanceof Error?e.message:b(`remoteBrowserAuthPollFailed`);L.error(`${b(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.createBrowserSignInCompletion=()=>(this.rejectBrowserSignIn(Error(`Browser sign-in was replaced by a newer request.`)),new Promise((e,t)=>{this.browserSignInCompletion={resolve:e,reject:t}})),this.resolveBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.resolve(e))},this.rejectBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.reject(e instanceof Error?e:Error(String(e))))},this.getBrowserAuthSummary=()=>{let e=Vs.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?M(e.authExpiresAt):`-`}}}},ec=`nextclaw.app.viewport-layout`,tc=1;function nc(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function rc(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:nc(e),width:e,isSidebarCollapsed:!1,isMainSidebarAppGroupCollapsed:!1}}function ic(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}var ac=P()(ji(()=>rc(),{name:ec,version:tc,storage:Mi(()=>window.localStorage),partialize:e=>({isSidebarCollapsed:e.isSidebarCollapsed,isMainSidebarAppGroupCollapsed:e.isMainSidebarAppGroupCollapsed}),merge:(e,t)=>{let n=ic(e,`isSidebarCollapsed`),r=ic(e,`isMainSidebarAppGroupCollapsed`);return{...t,...n===null?{}:{isSidebarCollapsed:n},...r===null?{}:{isMainSidebarAppGroupCollapsed:r}}}})),oc=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>ac.getState(),this.setSidebarCollapsed=e=>{ac.setState({isSidebarCollapsed:e})},this.setMainSidebarAppGroupCollapsed=e=>{ac.setState({isMainSidebarAppGroupCollapsed:e})},this.collapseSidebarForDenseRightPanels=e=>{if(!e.isDocBrowserOpen||!e.isDocBrowserDocked||!e.isWorkspacePanelOpen)return;let t=this.getSnapshot();if(t.mode!==`desktop`||t.isSidebarCollapsed)return;let n=typeof t.width==`number`?t.width:typeof window>`u`?null:window.innerWidth;typeof n!=`number`||!Number.isFinite(n)||n>1800||this.setSidebarCollapsed(!0)},this.toggleSidebarCollapsed=()=>{ac.setState(e=>({isSidebarCollapsed:!e.isSidebarCollapsed}))},this.toggleMainSidebarAppGroupCollapsed=()=>{ac.setState(e=>({isMainSidebarAppGroupCollapsed:!e.isMainSidebarAppGroupCollapsed}))},this.resetForTests=()=>{this.consumerCount=0,this.stop(),ac.setState(rc())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;ac.setState({width:e,mode:nc(e)})}}};function sc({parentSessionLabel:e,onGoToParentSession:t}){if(!e)return null;let n=e.trim();return(0,U.jsx)(`div`,{"data-theme-surface":`header`,className:`bg-background/75 px-4 py-2 backdrop-blur-sm sm:px-5`,children:(0,U.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:[(0,U.jsx)(Ci,{className:`h-3.5 w-3.5`}),(0,U.jsxs)(`span`,{children:[b(`chatBackToParent`),n?` · ${n}`:``]})]})})}function cc({layoutMode:e,actions:t,leading:n,onBackToList:r,projectBadge:i,sessionTypeBadge:a,shouldShow:o,title:s,titleContent:c}){let l=e===`mobile`;return(0,U.jsxs)(`div`,{"data-testid":`chat-conversation-header`,"data-theme-surface":`header`,className:u(`bg-background/80 backdrop-blur-sm flex items-center justify-between shrink-0 overflow-hidden transition-colors duration-200`,l?`px-3 sm:px-3`:`px-4 sm:px-5`,o?`opacity-100`:`h-0 py-0 opacity-0`,o&&(l?`min-h-12 pb-2 pt-2`:`h-[52px]`)),style:l&&o?{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.5rem)`}:void 0,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-center gap-2`,children:[l&&r?(0,U.jsx)(V,{icon:(0,U.jsx)(Ci,{className:`h-4 w-4`}),label:b(`chat`),onClick:r,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`}):null,n,c??(0,U.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:s}),a,i]}),t]})}function lc(){let e=F();return(0,H.useCallback)(async t=>{let{invalidateSessionSkills:n=!0,sessionKey:r,patch:i,successMessage:a}=t;try{Ce(e,await Qe(r,i)),n&&await e.invalidateQueries({queryKey:[`ncp-session-skills`,r]}),a!==null&&L.success(a??b(`configSavedApplied`))}catch(e){throw L.error(b(`configSaveFailed`)+`: `+(e instanceof Error?e.message:String(e))),e}},[e])}function uc(){let e=lc();return async t=>{await e({sessionKey:t.sessionKey,patch:{label:t.label},successMessage:b(`configSavedApplied`)})}}function dc(){let e=lc();return async t=>{let{persistToServer:n,projectRoot:r,sessionKey:i}=t,a=b(r?`chatSessionProjectUpdated`:`chatSessionProjectCleared`);if(!n){L.success(a);return}await e({sessionKey:i,patch:{projectRoot:r},successMessage:a})}}function fc({icon:e,label:t,onClick:n,disabled:r=!1,destructive:i=!1}){return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),onClick:n,disabled:r,children:[(0,U.jsx)(e,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:t})]})}var pc={key:`slash`,marker:`/`};function mc(){return`composer-${Math.random().toString(36).slice(2,10)}`}function hc(e=``){return{id:mc(),type:`text`,text:e}}function gc(e){let{data:t,label:n,previewUrl:r,tokenKey:i,tokenKind:a}=e;return{id:mc(),type:`token`,tokenKind:a,tokenKey:i,label:n,previewUrl:r,data:t}}function _c(e){return e.type===`text`?e.text.length:1}function vc(){return[hc(``)]}function yc(e){return[hc(e)]}function bc(e){let t=[];for(let n of e){if(n.type===`text`){if(n.text.length===0)continue;let e=t[t.length-1];if(e?.type===`text`){t[t.length-1]={...e,text:e.text+n.text};continue}}t.push(n)}return t.length===0?vc():t}function xc(e){return e.map(e=>e.type===`text`?e.text:``).join(``)}function Sc(e){return e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Cc(e,t){let n=[],r=new Set;for(let i of e)i.type!==`token`||i.tokenKind!==t||r.has(i.tokenKey)||(r.add(i.tokenKey),n.push(i.tokenKey));return n}function wc(e,t,n,r){let i=Math.max(0,n-t),a=Math.max(0,t+e.text.length-r),o=[];return i>0&&o.push({...e,text:e.text.slice(0,i)}),a>0&&o.push({...e,text:e.text.slice(e.text.length-a)}),o}function Tc(e,t,n,r){return t<=n||e>=r}function Ec(e,t,n,r,i){return!n&&r>=i?(e.push(...t),!0):n}function Dc(e,t,n,r,i,a,o){let s=wc(t,n,r,i);s[0]&&e.push(s[0]);let c=o;return c||=(e.push(...a),!0),s[1]&&e.push(s[1]),c}function Oc(e,t,n,r,i,a){return!r&&i<=a?(e.push(...n),!0):(e.push(t),r)}function kc(e,t,n,r){let i=Math.max(0,t),a=Math.max(i,n),o=[],s=0,c=!1;for(let t of e){let e=_c(t),n=s,l=s+e;if(Tc(n,l,i,a)){c=Ec(o,r,c,n,a),o.push(t),s=l;continue}c=t.type===`text`?Dc(o,t,n,i,a,r,c):Oc(o,t,r,c,i,n),s=l}return c||o.push(...r),bc(o)}function Ac(e,t){return bc(e.filter(e=>e.type!==`token`||!t(e)))}function jc(e,t){return t===0||/\s/.test(e[t-1]??``)}function Mc(e,t,n){if(!t||t.start!==t.end)return null;let r=xc(e),i=t.end,a=r.slice(0,i),o=a.lastIndexOf(n.marker);if(o<0||!jc(a,o))return null;let s=a.slice(o+n.marker.length);return/[\s\uFFFC]/.test(s)?null:{key:n.key,marker:n.marker,query:s.trim().toLowerCase(),start:o,end:i}}function Nc(e,t,n=[pc]){let r=null;for(let i of n){let n=Mc(e,t,i);n&&(!r||n.start>r.start)&&(r=n)}return r}function Pc(e,t){let n=Mc(e,t,pc);return n?{query:n.query,start:n.start,end:n.end}:null}var Fc=e=>`[data-item-index="${e}"]`;function Ic(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??Fc;(0,H.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function Lc(){let e=(0,H.useRef)(null),[t,n]=(0,H.useState)(null);return(0,H.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function W(...e){return h(ie(e))}var Rc=H.forwardRef(({className:e,type:t,...n},r)=>(0,U.jsx)(`input`,{type:t,className:W(`flex h-9 w-full rounded-xl border border-border bg-card px-3.5 py-2 text-sm text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/55 placeholder:font-normal focus:outline-none focus:ring-0 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Rc.displayName=`ChatInput`;var zc=zr,Bc=Rr,Vc=Lr,Hc=H.forwardRef(({className:e,children:t,closeLabel:n,...r},i)=>(0,U.jsxs)(Hr,{children:[(0,U.jsx)(Gr,{className:`fixed inset-0 z-[var(--z-modal-backdrop,10000)] bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,U.jsxs)(Ir,{ref:i,className:W(`fixed left-[50%] top-[50%] z-[var(--z-modal,10050)] grid max-h-[min(42rem,calc(100vh-2rem))] w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto rounded-2xl border border-border bg-background p-6 text-foreground shadow-xl outline-none duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...r,children:[t,(0,U.jsxs)(Yr,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none`,children:[(0,U.jsx)(ki,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:n})]})]})]}));Hc.displayName=Ir.displayName;var Uc=({className:e,...t})=>(0,U.jsx)(`div`,{className:W(`flex flex-col gap-2 text-center sm:text-left`,e),...t}),Wc=`Popover`,[Gc,yee]=rr(Wc,[nr]),Kc=nr(),[qc,Jc]=Gc(Wc),Yc=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Kc(t),c=H.useRef(null),[l,u]=H.useState(!1),[d,f]=$n({prop:r,defaultProp:i??!1,onChange:a,caller:Wc});return(0,U.jsx)(er,{...s,children:(0,U.jsx)(qc,{scope:t,contentId:Xn(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:H.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:n})})};Yc.displayName=Wc;var Xc=`PopoverAnchor`,Zc=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Jc(Xc,n),a=Kc(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return H.useEffect(()=>(o(),()=>s()),[o,s]),(0,U.jsx)(tr,{...a,...r,ref:t})});Zc.displayName=Xc;var Qc=`PopoverTrigger`,$c=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Jc(Qc,n),a=Kc(n),o=ir(t,i.triggerRef),s=(0,U.jsx)(Jn.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ml(i.open),...r,ref:o,onClick:Kn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,U.jsx)(tr,{asChild:!0,...a,children:s})});$c.displayName=Qc;var el=`PopoverPortal`,[tl,nl]=Gc(el,{forceMount:void 0}),rl=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Jc(el,t);return(0,U.jsx)(tl,{scope:t,forceMount:n,children:(0,U.jsx)(Nr,{present:n||a.open,children:(0,U.jsx)(qn,{asChild:!0,container:i,children:r})})})};rl.displayName=el;var il=`PopoverContent`,al=H.forwardRef((e,t)=>{let n=nl(il,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Jc(il,e.__scopePopover);return(0,U.jsx)(Nr,{present:r||a.open,children:a.modal?(0,U.jsx)(sl,{...i,ref:t}):(0,U.jsx)(cl,{...i,ref:t})})});al.displayName=il;var ol=Yn(`PopoverContent.RemoveScroll`),sl=H.forwardRef((e,t)=>{let n=Jc(il,e.__scopePopover),r=H.useRef(null),i=ir(t,r),a=H.useRef(!1);return H.useEffect(()=>{let e=r.current;if(e)return ur(e)},[]),(0,U.jsx)(sr,{as:ol,allowPinchZoom:!0,children:(0,U.jsx)(ll,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kn(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Kn(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:Kn(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),cl=H.forwardRef((e,t)=>{let n=Jc(il,e.__scopePopover),r=H.useRef(!1),i=H.useRef(!1);return(0,U.jsx)(ll,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),ll=H.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Jc(il,n),p=Kc(n);return or(),(0,U.jsx)(cr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(Qn,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,U.jsx)(Gn,{"data-state":ml(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ul=`PopoverClose`,dl=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Jc(ul,n);return(0,U.jsx)(Jn.button,{type:`button`,...r,ref:t,onClick:Kn(e.onClick,()=>i.onOpenChange(!1))})});dl.displayName=ul;var fl=`PopoverArrow`,pl=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Kc(n);return(0,U.jsx)(Zn,{...i,...r,ref:t})});pl.displayName=fl;function ml(e){return e?`open`:`closed`}var hl=Yc,gl=Zc,_l=$c,vl=rl,yl=al,bee=`2rem`;function bl(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${bee})))`}var xee=bl(`24rem`),See=hl,Cee=_l,wee=gl,xl=H.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:r=12,style:i,...a},o)=>(0,U.jsx)(vl,{children:(0,U.jsx)(yl,{ref:o,sideOffset:t,align:n,collisionPadding:r,className:W(`z-[var(--z-popover,50)] w-72 overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-popover p-4 text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2`,e),style:{maxHeight:xee,...i},...a})}));xl.displayName=yl.displayName;var Tee=vr,Eee=mr,Dee=pr,Oee=`2rem`;function Sl(e){return`min(${e}, max(0px, calc(var(--radix-select-content-available-height, 100vh) - ${Oee})))`}var kee=Sl(`24rem`),Cl=H.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(Mr,{ref:r,className:W(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-border bg-card px-3 py-2 text-sm text-foreground shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-0 focus:border-border disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,U.jsx)(br,{asChild:!0,children:(0,U.jsx)(ar,{className:`h-4 w-4 opacity-50`})})]}));Cl.displayName=Mr.displayName;var wl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(dr,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(lr,{className:`h-4 w-4`})}));wl.displayName=dr.displayName;var Tl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(_r,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(ar,{className:`h-4 w-4`})}));Tl.displayName=_r.displayName;var El=H.forwardRef(({className:e,children:t,collisionPadding:n=12,position:r=`popper`,style:i,viewportClassName:a,...o},s)=>(0,U.jsx)(xr,{children:(0,U.jsxs)(Er,{ref:s,className:W(`relative z-50 flex max-h-96 min-w-[8rem] flex-col overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),collisionPadding:n,position:r,style:{maxHeight:kee,...i},...o,children:[(0,U.jsx)(wl,{}),(0,U.jsx)(jr,{className:W(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-1`,r===`popper`&&`w-full min-w-[var(--radix-select-trigger-width)]`,a),children:t}),(0,U.jsx)(Tl,{})]})}));El.displayName=Er.displayName;var Dl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(wr,{ref:n,className:W(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,e),...t}));Dl.displayName=wr.displayName;var Ol=H.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(Or,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(hr,{children:(0,U.jsx)(Ar,{className:`h-4 w-4`})})}),(0,U.jsx)(gr,{children:t})]}));Ol.displayName=Or.displayName;var kl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(kr,{ref:n,className:W(`-mx-1 my-1 h-px bg-border`,e),...t}));kl.displayName=kr.displayName;var Aee=ii,jee=xi,Mee=ei,Al=H.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,U.jsx)(Si,{children:(0,U.jsx)(yi,{ref:r,sideOffset:t,className:W(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));Al.displayName=yi.displayName;var jl={Dialog:zc,DialogContent:Hc,DialogDescription:Vc,DialogHeader:Uc,DialogTitle:Bc,Popover:See,PopoverAnchor:wee,PopoverContent:xl,PopoverTrigger:Cee,Input:Rc,Select:Tee,SelectContent:El,SelectGroup:Eee,SelectItem:Ol,SelectLabel:Dl,SelectSeparator:kl,SelectTrigger:Cl,SelectValue:Dee,Tooltip:jee,TooltipContent:Al,TooltipProvider:Aee,TooltipTrigger:Mee};function Nee({pathPreview:e}){return(0,U.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-gray-50/70 px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-gray-600`,children:[(0,U.jsx)(Ya,{"aria-hidden":`true`,className:`h-4 w-4 text-gray-400`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.rootLabel})]}),(0,U.jsx)(`div`,{className:`mt-2`,children:e.segments.map((e,t)=>{let n=e.kind===`directory`?Ya:Va;return(0,U.jsxs)(`div`,{className:`relative flex min-w-0 items-center gap-2 py-1 text-xs text-gray-700`,style:{paddingLeft:`${(t+1)*18}px`},children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-1/2 top-[-0.25rem] w-px bg-gray-200`,style:{left:`${t*18+7}px`}}),(0,U.jsx)(n,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-gray-400`}),(0,U.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]},`${t}:${e.label}`)})})]})}var Pee=680,Fee=.82,Iee=560,Ml=bl(`24rem`),Lee={back:Ci,"calendar-clock":la,command:Ca,file:Va,files:Ha,folder:Ya,inbox:ao,"list-collapse":mo,"message-square-plus":xo,"panel-app":di,project:Ua,skill:Fr};function Nl(e,t){return!t.sectionKeys||t.sectionKeys.length===0?!0:!!(e.sectionKey&&t.sectionKeys.includes(e.sectionKey))}function Ree(e,t){return e?.length?e.some(e=>e.key===t)?t:e[0].key:null}function zee({icon:e}){let t=Lee[e];return(0,U.jsx)(`span`,{"aria-hidden":`true`,"data-input-surface-icon":e,className:`inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-gray-100 text-gray-500`,children:(0,U.jsx)(t,{className:`h-3.5 w-3.5`})})}function Bee({item:e,texts:t}){return e?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.subtitle?(0,U.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:e.subtitle}):null,(0,U.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:e.title})]}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description}),e.pathPreview?(0,U.jsx)(Nee,{pathPreview:e.pathPreview}):null,(0,U.jsx)(`div`,{className:`space-y-1`,children:e.detailLines.map(e=>(0,U.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,U.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:e.hintLabel??t.itemHintLabel})]}):(0,U.jsx)(`div`,{className:`text-xs text-gray-500`,children:t.hintLabel})}function Pl(e){let{activeIndex:t,event:n,isOpen:r,items:i,onOpenChange:a,onSelectItem:o,setActiveIndex:s}=e;return r?n.key===`Escape`?(n.preventDefault(),a(!1),!0):i.length===0?!1:n.key===`ArrowDown`?(n.preventDefault(),s(e=>(e+1)%i.length),!0):n.key===`ArrowUp`?(n.preventDefault(),s(e=>(e-1+i.length)%i.length),!0):n.key===`Enter`&&!n.shiftKey||n.key===`Tab`?(n.preventDefault(),o(i[t]),!0):!1:!1}var Fl=(0,H.forwardRef)(function(e,t){let{Popover:n,PopoverAnchor:r,PopoverContent:i}=jl,{elementRef:a,width:o}=Lc(),s=(0,H.useRef)(null),[c,l]=(0,H.useState)({index:0,itemsSignature:``}),{isOpen:u,isLoading:d,filterOptions:f,items:p,notice:m,texts:h,onSelectItem:g,onOpenChange:_,onDetailsPointerDown:v}=e,[y,b]=(0,H.useState)(f?.[0]?.key??null),x=(0,H.useMemo)(()=>Ree(f,y),[y,f]),S=(0,H.useMemo)(()=>f?.find(e=>e.key===x)??null,[f,x]),C=(0,H.useMemo)(()=>f?.map(e=>({...e,count:p.filter(t=>Nl(t,e)).length}))??[],[f,p]),w=(0,H.useMemo)(()=>S?p.filter(e=>Nl(e,S)):p,[S,p]),T=(0,H.useMemo)(()=>w.map(e=>e.key).join(``),[w]),E=(0,H.useMemo)(()=>w.some(e=>!!e.sectionLabel?.trim()),[w]),D=c.itemsSignature===T?c.index:0,O=w.length===0?0:Math.min(D,w.length-1),k=w[O]??null,A=(0,H.useCallback)(e=>{b(e),l({index:0,itemsSignature:``})},[]),j=(0,H.useCallback)(e=>{l(t=>{let n=t.itemsSignature===T?t.index:0;return{index:typeof e==`function`?e(n):e,itemsSignature:T}})},[T]),M=(0,H.useCallback)(e=>{e.selectionBehavior===`navigate`&&l({index:0,itemsSignature:``}),g(e)},[g]),N=(0,H.useMemo)(()=>{if(o)return Math.min(o>Iee?o*Fee:o,Pee)},[o]);return(0,H.useImperativeHandle)(t,()=>({handleKeyDown:e=>Pl({activeIndex:O,event:e,isOpen:u,items:w,onOpenChange:_,onSelectItem:M,setActiveIndex:j})}),[O,u,_,M,j,w]),Ic({containerRef:s,activeIndex:O,itemCount:w.length,isEnabled:u&&!d,getItemSelector:e=>`[data-input-surface-index="${e}"]`}),(0,U.jsxs)(n,{open:u,onOpenChange:_,children:[(0,U.jsx)(r,{asChild:!0,children:(0,U.jsx)(`div`,{ref:a,className:`pointer-events-none absolute bottom-0 left-3 right-3 top-0`})}),(0,U.jsx)(i,{side:`top`,align:`start`,sideOffset:10,className:`z-[70] flex max-w-[calc(100vw-1.5rem)] flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md`,onOpenAutoFocus:e=>e.preventDefault(),style:{height:Ml,maxHeight:Ml,width:N?`${N}px`:void 0},children:(0,U.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col border-r border-gray-200`,children:[!d&&C.length>0?(0,U.jsx)(`div`,{className:`flex shrink-0 gap-0.5 overflow-x-auto px-2 pb-1.5 pt-2`,children:C.map(({count:e,key:t,label:n})=>{let r=t===x;return(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":r,onPointerDown:e=>e.preventDefault(),onClick:()=>A(t),className:`inline-flex h-7 shrink-0 items-center gap-1 rounded-md px-2 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 ${r?`bg-gray-100 text-gray-900`:`text-gray-600 hover:bg-gray-100 hover:text-gray-900`}`,children:[(0,U.jsx)(`span`,{children:n}),(0,U.jsx)(`span`,{className:r?`text-gray-500`:`text-gray-400`,children:e})]},t)})}):null,!d&&m?(0,U.jsxs)(`div`,{className:`mx-2 mb-1.5 flex items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-2.5 py-2 text-xs leading-4 text-red-700`,children:[(0,U.jsx)(Vr,{"aria-hidden":`true`,className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:m.message})]}):null,(0,U.jsx)(`div`,{ref:s,role:`listbox`,"aria-label":h.sectionLabel,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain ${!d&&C.length>0?`px-2 pb-2`:`p-2`}`,children:d?(0,U.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:h.loadingLabel}):(0,U.jsxs)(U.Fragment,{children:[E?null:(0,U.jsx)(`div`,{className:`mb-1 px-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:h.sectionLabel}),w.length===0?(0,U.jsx)(`div`,{className:`px-1.5 text-xs text-gray-400`,children:h.emptyLabel}):(0,U.jsx)(`div`,{children:w.map((e,t)=>{let{icon:n,key:r,sectionKey:i,sectionLabel:a,title:o,subtitle:s}=e,c=t===O,l=w[t-1];return(0,U.jsxs)(`div`,{children:[E&&a?.trim()&&l?.sectionKey!==i?(0,U.jsx)(`div`,{className:`px-1.5 pb-1 pt-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:a}):null,(0,U.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":c,"data-input-surface-index":t,onPointerMove:e=>{e.pointerType!==`touch`&&j(t)},onPointerDown:t=>{t.button>0||(t.preventDefault(),M(e))},onClick:t=>{t.detail===0&&M(e)},className:`flex w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left leading-4 transition-colors ${c?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-100`}`,children:[n?(0,U.jsx)(zee,{icon:n}):null,(0,U.jsx)(`span`,{className:`truncate text-xs font-medium`,children:o}),(0,U.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:s})]})]},r)})})]})})]}),(0,U.jsx)(`div`,{className:`custom-scrollbar min-h-0 min-w-0 select-text overflow-y-auto overscroll-contain p-2.5`,onPointerDown:v,children:(0,U.jsx)(Bee,{item:k,texts:h})})]})})]})});function Il(e){return`${e.key}:${e.marker}:${e.start}`}function Ll(e,t){return t.type===`insert-text`&&e.query===``&&e.end===e.start+e.marker.length}function Rl(e,t,n){if(!t)return null;let r=Il(t);return e===r?e:Ll(t,n)?r:null}function zl(e){let{children:t,inputSurface:n,onInputSurfaceTriggerChange:r,onSelectItem:i,triggerSpecs:a=[pc]}=e,o=(0,H.useRef)(null),s=(0,H.useRef)(!1),c=(0,H.useRef)(null),[l,u]=(0,H.useState)(null),d=!!n&&l!==null,f=(0,H.useCallback)((e,t)=>{c.current=e,u(e),r?.(e?t:null)},[r]),p=(0,H.useCallback)((e,t,n)=>{let r=Nc(e,t,a),i=Rl(c.current,r,n);f(i,i?r:null)},[f,a]),m=(0,H.useCallback)(e=>o.current?.handleKeyDown(e)??!1,[]),h=(0,H.useCallback)(e=>{!e&&!s.current&&f(null,null)},[f]);return(0,U.jsxs)(U.Fragment,{children:[t((0,H.useMemo)(()=>({onInputSurfaceKeyDown:m,onInputSurfaceOpenChange:h,onInputSurfaceSnapshotChange:p}),[m,h,p])),n&&d?(0,U.jsx)(Fl,{ref:o,isOpen:d,isLoading:n.isLoading,filterOptions:n.filterOptions,items:n.items,notice:n.notice,texts:n.texts,onSelectItem:e=>{e.selectionBehavior!==`navigate`&&f(null,null),i(e)},onOpenChange:h,onDetailsPointerDown:()=>{s.current=!0,requestAnimationFrame(()=>{s.current=!1})}},l):null]})}var Bl=Ut(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-border bg-card text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,secondary:`bg-muted text-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,ghost:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-muted text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Vl=H.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,U.jsx)(`button`,{className:W(Bl({variant:t,size:n,className:e})),ref:i,...r}));Vl.displayName=`ChatButton`;function Hl(){return(0,U.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-foreground shadow-[inset_0_0_0_1px_hsl(var(--border))]`})}function Ul({contextWindow:e}){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=jl,a=Math.max(0,Math.min(1,e.ratio)),o=Math.round(a*360);return(0,U.jsx)(r,{delayDuration:0,children:(0,U.jsxs)(t,{children:[(0,U.jsx)(i,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"aria-label":e.label,title:e.label,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[7px] rounded-full`,style:{background:`conic-gradient(hsl(var(--muted-foreground)) ${o}deg, hsl(var(--border)) 0deg)`}}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[10px] rounded-full bg-card`})]})}),(0,U.jsx)(n,{side:`top`,className:`max-w-[18rem]`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-5 font-semibold text-foreground`,children:[(0,U.jsx)(`span`,{children:e.label}),(0,U.jsx)(`span`,{children:e.percentLabel})]}),e.details.map(e=>(0,U.jsxs)(H.Fragment,{children:[e.dividerBefore?(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`my-2 border-t border-border/70`,"data-testid":`context-window-detail-divider`}):null,(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-5 text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:e.label}),(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:e.value})]})]},e.label))]})})]})})}function Wl({children:e,label:t}){let{Tooltip:n,TooltipContent:r,TooltipProvider:i,TooltipTrigger:a}=jl;return(0,U.jsx)(i,{delayDuration:250,children:(0,U.jsxs)(n,{children:[(0,U.jsx)(a,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:e})}),(0,U.jsx)(r,{side:`top`,className:`text-xs`,children:t})]})})}function Gl({isSending:e,canStopGeneration:t,sendDisabled:n,stopDisabled:r,stopHint:i,sendButtonLabel:a,sendIcon:o=`send`,stopButtonLabel:s,contextWindow:c,onSend:l,onStop:u}){return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?(0,U.jsx)(Ul,{contextWindow:c}):null,!e||!n?(0,U.jsx)(Wl,{label:a,children:(0,U.jsx)(Vl,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":a,onClick:()=>void l(),disabled:n,children:o===`continue`?(0,U.jsx)(Uo,{"data-testid":`chat-continue-input-icon`,className:`h-4 w-4`}):(0,U.jsx)(aa,{className:`h-5 w-5`})})}):t?(0,U.jsx)(Wl,{label:s,children:(0,U.jsx)(Vl,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void u(),disabled:r,children:(0,U.jsx)(Hl,{})})}):(0,U.jsx)(Wl,{label:i,children:(0,U.jsx)(Vl,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,disabled:!0,children:(0,U.jsx)(Hl,{})})})]})}function Kl(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}var ql=bl(`20rem`),Jl=`flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left text-sm text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50`;function Yl(e){let{Input:t}=jl,{onBack:n,picker:r}=e,i=(0,H.useRef)(null),a=(0,H.useId)(),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(0),u=(0,H.useMemo)(()=>new Set(r.selectedKeys),[r.selectedKeys]),d=(0,H.useMemo)(()=>r.groups?.filter(e=>e.options.length>0)??[],[r.groups]),f=(0,H.useMemo)(()=>d.length===0?null:d.map(e=>({...e,options:Kl(e.options,o)})).filter(e=>e.options.length>0),[d,o]),p=(0,H.useMemo)(()=>f===null?Kl(r.options,o):f.flatMap(e=>e.options),[f,r.options,o]),m=p.length===0?0:Math.min(c,p.length-1);Ic({containerRef:i,activeIndex:m,itemCount:p.length,isEnabled:p.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let h=e=>{if(u.has(e)){r.onSelectedKeysChange(r.selectedKeys.filter(t=>t!==e));return}r.onSelectedKeysChange([...r.selectedKeys,e])};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`shrink-0 space-y-1.5 p-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex h-7 items-center gap-1 rounded-md pr-2 text-sm font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,children:[(0,U.jsx)(da,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{children:r.title})]}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground/60`}),(0,U.jsx)(t,{value:o,onChange:e=>{s(e.target.value),l(0)},onKeyDown:e=>{if(p.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),l(Math.min(m+1,p.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),l(Math.max(m-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=p[m];t&&h(t.key)}}},placeholder:r.searchPlaceholder,role:`combobox`,"aria-controls":a,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":p[m]?`${a}-option-${m}`:void 0,className:`h-8 rounded-lg border-0 bg-muted/45 pl-7 text-xs shadow-none`})]})]}),(0,U.jsx)(`div`,{ref:i,id:a,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pb-1`,children:r.isLoading?(0,U.jsx)(`div`,{className:`p-4 text-xs text-muted-foreground`,children:r.loadingLabel}):p.length===0?(0,U.jsx)(`div`,{className:`p-4 text-center text-xs text-muted-foreground`,children:r.emptyLabel}):(0,U.jsx)(`div`,{children:(()=>{let e=f??[{key:`all-skills`,options:p}],t=0;return e.map(e=>(0,U.jsxs)(`div`,{children:[e.label?(0,U.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-medium text-muted-foreground/80`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=u.has(e.key),i=n===m;return(0,U.jsxs)(`button`,{type:`button`,id:`${a}-option-${n}`,role:`option`,"aria-selected":r,"aria-label":e.label,"data-skill-index":n,onMouseEnter:()=>l(n),onClick:()=>h(e.key),className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors ${i?`bg-[var(--interaction-hover)]`:`hover:bg-[var(--interaction-hover)]`}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm text-foreground`,children:e.label}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.description||e.key})]}),r?(0,U.jsx)(Ar,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]},e.key)})]},e.key))})()})}),r.manageHref&&r.manageLabel?(0,U.jsx)(`div`,{className:`shrink-0 px-2 pb-2 pt-1`,children:(0,U.jsxs)(`a`,{href:r.manageHref,className:`inline-flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,children:[r.manageLabel,(0,U.jsx)(fe,{className:`h-3 w-3`})]})}):null]})}function Xl(e){let{Popover:t,PopoverContent:n,PopoverTrigger:r,Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=jl,{accessories:c,label:l,picker:u}=e,[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(`actions`);return(0,U.jsxs)(t,{open:d,onOpenChange:e=>{f(e),e||m(`actions`)},children:[(0,U.jsx)(o,{children:(0,U.jsxs)(i,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:(0,U.jsx)(r,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":l,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,children:(0,U.jsx)(Di,{className:`h-4 w-4`})})})})}),(0,U.jsx)(a,{side:`top`,children:(0,U.jsx)(`p`,{className:`text-xs`,children:l})})]})}),(0,U.jsx)(n,{side:`top`,align:`start`,className:p===`skills`?`flex w-[min(340px,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border-border/80 p-0 shadow-md`:`w-[min(220px,calc(100vw-1rem))] rounded-xl border-border/80 p-1.5 shadow-md`,style:{maxHeight:ql},children:p===`actions`?(0,U.jsxs)(U.Fragment,{children:[c.map(e=>(0,U.jsxs)(`button`,{type:`button`,"aria-label":e.label,disabled:e.disabled,onClick:()=>{e.onClick?.(),f(!1)},className:Jl,children:[e.icon===`paperclip`?(0,U.jsx)(zo,{className:`h-4 w-4`}):null,(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label})]},e.key)),u?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>m(`skills`),className:Jl,children:[(0,U.jsx)(Fr,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:u.title}),(0,U.jsx)(fa,{className:`h-4 w-4 shrink-0 text-muted-foreground/60`})]}):null]}):u?(0,U.jsx)(Yl,{picker:u,onBack:()=>m(`actions`)}):null})]})}function Zl(e,t){let n=0;for(let r of t)if(r===e[n]&&(n+=1,n===e.length))return!0;return e.length===0}function Ql(e,t){let n=e.filter(Boolean).join(` `).toLowerCase(),r=n.replace(/[\s/_.-]+/g,``);return t.split(/\s+/).filter(Boolean).every(e=>{let t=e.replace(/[\s/_.-]+/g,``);return n.includes(e)||Zl(t,r)})}function $l(e,t,n){let r=n.trim().toLowerCase();return e.groups.filter(e=>e.options.length>0).filter(e=>t===`all`||e.key===t).map(e=>({...e,options:r?e.options.filter(e=>Ql([e.label,e.value,e.description],r)):e.options})).filter(e=>e.options.length>0)}function eu({discovery:e,onOpen:t}){return(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border/60 px-1.5 py-1`,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:t,children:[(0,U.jsx)(Fr,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.summaryLabel}),(0,U.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:e.viewLabel})]})})}function tu({discovery:e,open:t,onOpenChange:n,renderOption:r,restoreFocusRef:i}){let{Dialog:a,DialogContent:o,DialogDescription:s,DialogHeader:c,DialogTitle:l,Input:u}=jl,[d,f]=(0,H.useState)(``),[p,m]=(0,H.useState)(`all`),[h,g]=(0,H.useState)(null),[_,v]=(0,H.useState)(()=>new Set),y=(0,H.useMemo)(()=>e.groups.filter(e=>e.options.length>0),[e.groups]),b=p===`all`||y.some(e=>e.key===p)?p:`all`,x=(0,H.useMemo)(()=>$l(e,b,d),[e,d,b]),S=e=>{n(e),e||(f(``),m(`all`),g(null),v(new Set))},C=async t=>{if(!(h||_.has(t))){g(t);try{await e.onSelect(t),v(e=>new Set(e).add(t))}catch{return}finally{g(null)}}};return(0,U.jsx)(a,{open:t,onOpenChange:S,children:(0,U.jsxs)(o,{closeLabel:e.closeLabel,className:`flex h-[calc(100vh-1rem)] max-h-[42rem] w-[calc(100%-1rem)] max-w-2xl flex-col gap-0 overflow-hidden p-0 sm:h-[min(42rem,calc(100vh-2rem))]`,onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()},children:[(0,U.jsxs)(c,{className:`shrink-0 gap-1 border-b border-border/70 px-5 pb-4 pt-5 text-left`,children:[(0,U.jsx)(l,{className:`pr-8 text-lg font-semibold text-foreground`,children:e.groupLabel}),(0,U.jsx)(s,{className:`text-sm text-muted-foreground`,children:e.summaryLabel}),(0,U.jsxs)(`div`,{className:`relative pt-3`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-3 top-[1.375rem] h-4 w-4 text-muted-foreground/60`}),(0,U.jsx)(u,{autoFocus:!0,value:d,onChange:e=>f(e.currentTarget.value),placeholder:e.searchPlaceholder,className:`h-9 rounded-xl border-0 bg-muted/45 pl-9 text-sm shadow-none`})]}),(0,U.jsxs)(`div`,{role:`tablist`,"aria-label":e.groupLabel,className:`custom-scrollbar flex gap-1 overflow-x-auto overscroll-contain pt-2`,children:[(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":b===`all`,className:`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors ${b===`all`?`bg-foreground text-background`:`bg-muted/55 text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>m(`all`),children:e.allGroupLabel}),y.map(e=>(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":b===e.key,className:`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors ${b===e.key?`bg-foreground text-background`:`bg-muted/55 text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>m(e.key),children:e.label},e.key))]})]}),(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,children:[x.length===0?(0,U.jsx)(`p`,{className:`px-3 py-10 text-center text-sm text-muted-foreground`,children:e.searchEmptyLabel}):null,x.map(t=>(0,U.jsxs)(`div`,{children:[b===`all`?(0,U.jsx)(`div`,{className:`px-3 pb-1 pt-3 text-xs font-medium text-muted-foreground`,children:t.label}):null,t.options.map(t=>{let n=_.has(t.value);return(0,U.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-xl px-3 py-2 hover:bg-[var(--interaction-hover)]`,children:[(0,U.jsx)(`div`,{className:`min-w-0 overflow-hidden`,title:t.label,children:r(t)}),(0,U.jsxs)(`button`,{type:`button`,disabled:h!==null||n,className:`inline-flex h-8 min-w-16 shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-lg bg-primary/10 px-3 text-xs font-medium text-primary transition-colors hover:bg-primary/15 disabled:cursor-default disabled:bg-muted disabled:text-muted-foreground`,onClick:()=>void C(t.value),children:[h===t.value?(0,U.jsx)(Ei,{className:`h-3.5 w-3.5 animate-spin`}):null,n?e.addedLabel:e.actionLabel]})]},t.value)})]},t.key))]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-border/70 px-5 py-3`,children:[(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:()=>{e.onDismiss(),S(!1)},children:e.dismissLabel}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg bg-foreground px-4 py-2 text-xs font-medium text-background transition-opacity hover:opacity-85`,onClick:()=>S(!1),children:e.doneLabel})]})]})})}function nu({icon:e,className:t=``}){return e===`sparkles`?(0,U.jsx)(Fr,{className:`h-3.5 w-3.5 shrink-0 text-primary ${t}`}):e===`brain`?(0,U.jsx)(ca,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground ${t}`}):null}var ru={model:`min-w-0 max-w-[18rem]`,"session-type":`shrink-0`,thinking:`shrink-0`},iu={model:`w-[min(340px,calc(100vw-1rem))]`,"session-type":`w-[220px]`,thinking:`w-[180px]`},au=bl(`18rem`),ou=Sl(`18rem`);function su(e){return e.key===`model`&&e.selectedLabel&&e.selectedLabel.split(`/`).slice(1).join(`/`).trim()||e.selectedLabel}function cu(e){return e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[])}function lu({item:e}){let t=su(e);return e.selectedLabel?(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,U.jsx)(nu,{icon:e.icon,className:e.key===`model`?`hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:block`:void 0}),(0,U.jsx)(`span`,{className:`nextclaw-chat-toolbar-mobile-label truncate sm:hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`,children:t}),(0,U.jsx)(`span`,{className:`nextclaw-chat-toolbar-label hidden truncate sm:inline [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`,children:t})]}):e.loading?(0,U.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-muted`}):(0,U.jsx)(`span`,{className:`truncate`,children:e.placeholder})}function uu({option:e}){return e.description?(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label}),(0,U.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:e.description})]}):(0,U.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label})}function du({item:e}){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i,Tooltip:a,TooltipContent:o,TooltipProvider:s,TooltipTrigger:c}=jl,[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(``),h=(0,H.useRef)(null),g=cu(e),_=(0,H.useMemo)(()=>{let e=p.trim().toLowerCase();return e?g.map(t=>({...t,options:t.options.filter(t=>Ql([t.label,t.value,t.description],e))})).filter(e=>e.options.length>0):g},[g,p]),v=g.some(e=>e.options.length>0),y=_.some(e=>e.options.length>0),{discovery:b,optionAction:x}=e,S=new Set(x?.activeValues??[]),C=t=>{if(u(t),t){e.onOpen?.();return}m(``)};return(0,U.jsxs)(n,{open:l,onOpenChange:C,children:[(0,U.jsx)(i,{asChild:!0,children:(0,U.jsxs)(`button`,{ref:h,type:`button`,"aria-label":e.selectedLabel?`${e.placeholder}: ${e.selectedLabel}`:e.placeholder,disabled:e.disabled,className:`nextclaw-chat-toolbar-select-trigger inline-flex h-8 w-auto items-center justify-between rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50 sm:px-3 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!basis-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!justify-center [@container_nextclaw-chat-input-bar_(max-width:440px)]:!max-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!min-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!px-0 ${ru[e.key]??``}`,children:[(0,U.jsx)(lu,{item:e}),(0,U.jsx)(ar,{className:`ml-1 h-3.5 w-3.5 shrink-0 text-muted-foreground/70 [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`})]})}),(0,U.jsxs)(r,{className:`flex flex-col overflow-hidden rounded-2xl border-border/80 p-0 shadow-md ${iu[e.key]??``}`,style:{maxHeight:au},children:[(0,U.jsxs)(`div`,{className:`relative shrink-0 px-2 pb-1 pt-1.5`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-[18px] top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,U.jsx)(t,{value:p,onChange:e=>m(e.currentTarget.value),placeholder:e.search?.placeholder??e.placeholder,className:`h-7 rounded-lg border-0 bg-muted/45 pl-7 text-xs shadow-none`})]}),(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[v?null:e.loading?(0,U.jsxs)(`div`,{className:`space-y-2 px-2 py-1`,children:[(0,U.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,U.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.emptyLabel}):null,v&&!y?(0,U.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.search?.emptyLabel??e.emptyLabel}):null,(0,U.jsx)(`div`,{className:`px-1.5 pb-0.5`,children:_.map(t=>(0,U.jsxs)(`div`,{children:[t.label?(0,U.jsx)(`div`,{className:`px-2 pb-0.5 pt-1.5 text-[11px] font-medium text-muted-foreground/80`,children:t.label}):null,t.options.map(t=>{let n=e.value===t.value,r=S.has(t.value),i=r?x?.activeLabel:x?.inactiveLabel;return(0,U.jsxs)(`div`,{className:`group flex items-center gap-1 rounded-lg hover:bg-[var(--interaction-hover)]`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1 text-left leading-4`,onClick:()=>{e.onValueChange(t.value),C(!1)},children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(uu,{option:t})}),n?(0,U.jsx)(Ar,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]}),x&&i?(0,U.jsx)(s,{children:(0,U.jsxs)(a,{children:[(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":i,"aria-pressed":r,className:`mr-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-[background-color,color,opacity] hover:bg-card hover:text-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 ${r?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,onClick:e=>{e.stopPropagation(),x.onToggle(t.value,!r)},children:(0,U.jsx)(cs,{className:`h-3.5 w-3.5 ${r?`fill-current text-foreground`:``}`})})}),(0,U.jsx)(o,{side:`left`,children:(0,U.jsx)(`p`,{className:`text-xs`,children:i})})]})}):null]},t.value)})]},t.key))})]}),b?(0,U.jsx)(eu,{discovery:b,onOpen:()=>{C(!1),f(!0)}}):null,e.manageHref&&e.manageLabel?(0,U.jsx)(`div`,{className:`shrink-0 px-1.5 pb-1.5 pt-0.5`,children:(0,U.jsxs)(`a`,{href:e.manageHref,className:`inline-flex w-full items-center gap-1.5 rounded-lg px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,children:[e.manageLabel,(0,U.jsx)(fe,{className:`h-3 w-3`})]})}):null]}),b?(0,U.jsx)(tu,{discovery:b,open:d,onOpenChange:f,restoreFocusRef:h,renderOption:e=>(0,U.jsx)(uu,{option:e})}):null]})}function fu({item:e}){if(e.search)return(0,U.jsx)(du,{item:e});let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=jl,l=cu(e),u=l.some(e=>e.options.length>0);return(0,U.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,U.jsx)(s,{"aria-label":e.selectedLabel?`${e.placeholder}: ${e.selectedLabel}`:e.placeholder,title:e.selectedLabel,className:`nextclaw-chat-toolbar-select-trigger h-8 w-auto rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:ring-0 sm:px-3 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!basis-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!justify-center [@container_nextclaw-chat-input-bar_(max-width:440px)]:!max-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!min-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!px-0 ${ru[e.key]??``}`,children:e.selectedLabel||e.loading?(0,U.jsx)(lu,{item:e}):(0,U.jsx)(c,{placeholder:e.placeholder})}),(0,U.jsxs)(n,{className:iu[e.key]??``,style:{maxHeight:ou},children:[u?null:e.loading?(0,U.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:e.emptyLabel}):null,l.map((e,t)=>(0,U.jsxs)(`div`,{children:[t>0?(0,U.jsx)(o,{}):null,(0,U.jsxs)(r,{children:[e.label?(0,U.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,U.jsx)(i,{value:e.value,className:`py-1.5`,children:(0,U.jsx)(uu,{option:e})},e.value))]})]},e.key))]})]})}function pu({actions:e,accessories:t=[],addMenuLabel:n,selects:r,skillPicker:i,trailingSelects:a=[]}){let o=n??i?.title??t[0]?.label;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-2 px-3 pb-3`,children:[(0,U.jsxs)(`div`,{className:`nextclaw-chat-toolbar-leading-controls flex min-w-0 flex-1 flex-wrap items-center gap-1 overflow-hidden`,children:[o?(0,U.jsx)(Xl,{label:o,accessories:t,picker:i}):null,r.map(e=>(0,U.jsx)(fu,{item:e},e.key))]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-end gap-1`,children:[a.length>0?(0,U.jsx)(`div`,{className:`nextclaw-chat-toolbar-trailing-selects flex min-w-0 items-center gap-1`,children:a.map(e=>(0,U.jsx)(fu,{item:e},e.key))}):null,(0,U.jsx)(Gl,{...e})]})]})}var mu=(0,H.createContext)(null);function hu(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function gu(){let e=(0,H.useContext)(mu);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function G(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _u(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var vu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,yu=vu&&`documentMode`in document?document.documentMode:null,bu=vu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xu=vu&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Su=!(!vu||!(`InputEvent`in window)||yu)&&`getTargetRanges`in new window.InputEvent(`input`),Cu=vu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,wu=vu&&/Android/.test(navigator.userAgent),Tu=vu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!wu,Eu=vu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Du=vu&&wu&&Eu,Ou=vu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bu&&!Eu,ku=0,Au=1,ju=2,Mu=1,Nu=2,Pu=3,Fu=4,Iu=5,Lu=6,Ru=Tu||Cu||Ou?`\xA0`:``,zu=`
|
|
3
3
|
|
|
4
4
|
`,Bu=xu?`\xA0`:Ru,Vu={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Hu={directionless:1,unmergeable:2},Uu={center:2,end:6,justify:4,left:1,right:3,start:5},Wu={[Nu]:`center`,[Lu]:`end`,[Fu]:`justify`,[Mu]:`left`,[Pu]:`right`,[Iu]:`start`},Gu={normal:0,segmented:2,token:1},Ku={[ku]:`normal`,[ju]:`segmented`,[Au]:`token`},qu=`$config`;function Ju(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(Y(o)&&Ju(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var Yu=!1,Xu=0;function Zu(e){Xu=e.timeStamp}function Qu(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Uh(e,n)!==void 0}function $u(e,t,n){let r=Mg(wg(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&ng(t,o,i,a,!1)}function ed(e,t,n){if(q(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Ph(t)&&n.isAttached()}function td(e,t,n,r){for(let i=e;i&&!qg(i);i=vg(i)){let e=Uh(i,t);if(e!==void 0){let t=Vh(e,n);if(t)return ch(t)||!Pg(i)?void 0:[i,t]}else if(i===r)return[r,Jh(n)]}}function nd(e,t,n){Yu=!0;let r=performance.now()-Xu>100;try{nh(e,()=>{let i=J()||function(e){return e.getEditorState().read(()=>{let e=J();return e===null?null:e.clone()})}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=td(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&K(g)&&Ph(p)&&ed(i,p,g)&&$u(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Hh(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!Qu(r,a,e)){if(xu){let e=(Pg(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(Qu(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||Qu(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&Yh(i),xu&&gg(e)&&i.insertRawText(u))})}finally{Yu=!1}}function rd(e){let t=e._observer;t!==null&&nd(e,t.takeRecords(),t)}function id(e){(function(e){Xu===0&&wg(e).addEventListener(`textInput`,Zu,!0)})(e),e._observer=new MutationObserver((t,n)=>{nd(e,t,n)})}var ad=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||fd).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function od(e,t){return new ad(e,t)}function sd(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=Yg(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var cd=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState;this.size=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return dd(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=dd(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function ld(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new cd(t,ud(t));return t.__state=n,n}function ud(e){return e.__state?e.__state.sharedNodeState:wh(Bg(),e.getType()).sharedNodeState}function dd(e){if(e)for(let t in e)return e}function fd(e){return e}function pd(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function md(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function hd(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function gd(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&pd(n,e,t)||t&&pd(n,t,e)||e&&md(n,e,t)||t&&md(n,t,e))}(c,l))}function _d(e,t){let n=e.mergeWithSibling(t),r=Um()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function vd(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&K(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(gd(t,r)){r=_d(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&K(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(gd(r,n)){r=_d(r,n);break}break}n.remove()}}else r.remove()}function yd(e){return bd(e.anchor),bd(e.focus),e}function bd(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),K(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!Y(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd=``,Md=null,Nd=null,Pd=!1,Fd=!1;function Id(e,t){let n=Dd.get(e);if(t!==null){let n=ef(e);n.parentNode===t&&t.removeChild(n)}if(Od.has(e)||Sd._keyToDOMMap.delete(e),Y(n)){let e=Jd(n,Dd);Ld(e,0,e.length-1,null)}n!==void 0&&pg(Ad,Cd,wd,n,`destroyed`)}function Ld(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Id(t,r)}}function Rd(e,t){e.setProperty(`text-align`,t)}var zd=`40px`;function Bd(e,t){let n=xd.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty(`padding-inline-start`,``);let r=getComputedStyle(Sd._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||zd;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function Vd(e,t){let n=e.style;t===0?Rd(n,``):t===1?Rd(n,`left`):t===2?Rd(n,`center`):t===3?Rd(n,`right`):t===4?Rd(n,`justify`):t===5?Rd(n,`start`):t===6&&Rd(n,`end`)}function Hd(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(uh(e))return null;let n=e.getParentOrThrow();return uh(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function Ud(e,t){let n=Od.get(e);n===void 0&&G(60);let r=n.createDOM(xd,Sd);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,Sd),K(n)?r.setAttribute(`data-lexical-text`,`true`):ch(n)&&r.setAttribute(`data-lexical-decorator`,`true`),Y(n)){let e=n.__indent,t=n.__size;if(Hd(r,n),e!==0&&Bd(r,e),t!==0){let e=t-1;Wd(Jd(n,Od),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&Vd(r,i),n.isInline()||Kd(null,n,r)}else{let t=n.getTextContent();if(ch(n)){let t=n.decorate(Sd,xd);t!==null&&Xd(e,t),r.contentEditable=`false`}jd+=t}return t!==null&&t.insertChild(r),pg(Ad,Cd,wd,n,`created`),r}function Wd(e,t,n,r,i){let a=jd;jd=``;let o=n;for(;o<=r;++o){Ud(e[o],i);let t=Od.get(e[o]);t!==null&&K(t)?Md===null&&(Md=t.getFormat(),Nd=t.getStyle()):Y(t)&&o<r&&!t.isInline()&&(jd+=zu)}i.element.__lexicalTextContent=jd,jd=a+jd}function Gd(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Pp(e)?`line-break`:ch(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function Kd(e,t,n){let r=Gd(e,Dd),i=Gd(t,Od);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function qd(e,t,n){var r;Md=null,Nd=null,function(e,t,n){let r=jd,i=e.__size,a=t.__size;jd=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)Yd(n,o);else{let e=ef(n),t=Ud(r,null);try{o.replaceChild(t,e)}catch(i){if(typeof i==`object`&&i){let a=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw Error(a)}throw i}Id(n,null)}let i=Od.get(r);K(i)&&Md===null&&(Md=i.getFormat(),Nd=i.getStyle())}else{let r=Jd(e,Dd),s=Jd(t,Od);if(r.length!==i&&G(227),s.length!==a&&G(228),i===0)a!==0&&Wd(s,0,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;Ld(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else (function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f];if(e===r)u=Zd(Yd(r,a.element)),d++,f++;else{if(l===void 0&&(l=Qd(n,f)),c===void 0)c=Qd(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=Zd(ef(e)),Id(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=_g(Sd,r);e!==u&&a.withBefore(u).insertChild(e),u=Zd(Yd(r,a.element)),d++,f++}else Ud(r,a.withBefore(u)),f++}let i=Od.get(r);i!==null&&K(i)?Md===null&&(Md=i.getFormat(),Nd=i.getStyle()):Y(i)&&f<=s&&!i.isInline()&&(jd+=zu)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:Sd.getElementByKey(e);Wd(n,0,f,s,a.withBefore(t))}else m&&!p&&Ld(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=jd,jd=r+jd}(e,t,t.getDOMSlot(n)),r=t,Md==null||Md===r.__textFormat||Fd||r.setTextFormat(Md),function(e){Nd==null||Nd===e.__textStyle||Fd||e.setTextStyle(Nd)}(t)}function Jd(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&G(101),n.push(r),r=e.__next}return n}function Yd(e,t){let n=Dd.get(e),r=Od.get(e);n!==void 0&&r!==void 0||G(61);let i=Pd||Ed.has(e)||Td.has(e),a=_g(Sd,e);if(n===r&&!i){let e;if(Y(n)){let t=a.__lexicalTextContent;typeof t==`string`?e=t:(e=n.getTextContent(),a.__lexicalTextContent=e)}else e=n.getTextContent();return jd+=e,a}if(n!==r&&i&&pg(Ad,Cd,wd,r,`updated`),r.updateDOM(n,a,xd)){let n=Ud(e,null);return t===null&&G(62),t.replaceChild(n,a),Id(e,null),n}if(Y(n)){Y(r)||G(334,e);let t=r.__indent;(Pd||t!==n.__indent)&&Bd(a,t);let o=r.__format;if((Pd||o!==n.__format)&&Vd(a,o),i)qd(n,r,a),uh(r)||r.isInline()||Kd(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),jd+=t}if((Pd||r.__dir!==n.__dir)&&(Hd(a,r),uh(r)&&!Pd))for(let e of r.getChildren())Y(e)&&Hd(_g(Sd,e.getKey()),e)}else{let t=r.getTextContent();if(ch(r)){let t=r.decorate(Sd,xd);t!==null&&Xd(e,t)}jd+=t}if(!Fd&&uh(r)&&r.__cachedText!==jd){let e=r.getWritable();e.__cachedText=jd,r=e}return a}function Xd(e,t){let n=Sd._pendingDecorators,r=Sd._decorators;if(n===null){if(r[e]===t)return;n=Gh(Sd)}n[e]=t}function Zd(e){let t=e.nextSibling;return t!==null&&t===Sd._blockCursorElement&&(t=t.nextSibling),t}function Qd(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function $d(e,t,n,r,i,a){jd=``,Pd=r===2,Sd=n,xd=n._config,Cd=n._nodes,wd=Sd._listeners.mutation,Td=i,Ed=a,Dd=e._nodeMap,Od=t._nodeMap,Fd=t._readOnly,kd=new Map(n._keyToDOMMap);let o=new Map;return Ad=o,Yd(`root`,null),Sd=void 0,Cd=void 0,Td=void 0,Ed=void 0,Dd=void 0,Od=void 0,xd=void 0,kd=void 0,Ad=void 0,o}function ef(e){let t=kd.get(e);return t===void 0&&G(75,e),t}function tf(e){return{type:e}}var nf=tf(`SELECTION_CHANGE_COMMAND`),rf=tf(`CLICK_COMMAND`),af=tf(`BEFORE_INPUT_COMMAND`),of=tf(`INPUT_COMMAND`),sf=tf(`COMPOSITION_START_COMMAND`),cf=tf(`COMPOSITION_END_COMMAND`),lf=tf(`DELETE_CHARACTER_COMMAND`),uf=tf(`INSERT_LINE_BREAK_COMMAND`),df=tf(`INSERT_PARAGRAPH_COMMAND`),ff=tf(`CONTROLLED_TEXT_INSERTION_COMMAND`),pf=tf(`PASTE_COMMAND`),mf=tf(`REMOVE_TEXT_COMMAND`),hf=tf(`DELETE_WORD_COMMAND`),gf=tf(`DELETE_LINE_COMMAND`),_f=tf(`FORMAT_TEXT_COMMAND`),vf=tf(`UNDO_COMMAND`),yf=tf(`REDO_COMMAND`),bf=tf(`KEYDOWN_COMMAND`),xf=tf(`KEY_ARROW_RIGHT_COMMAND`),Sf=tf(`MOVE_TO_END`),Cf=tf(`KEY_ARROW_LEFT_COMMAND`),wf=tf(`MOVE_TO_START`),Tf=tf(`KEY_ARROW_UP_COMMAND`),Ef=tf(`KEY_ARROW_DOWN_COMMAND`),Df=tf(`KEY_ENTER_COMMAND`),Of=tf(`KEY_SPACE_COMMAND`),kf=tf(`KEY_BACKSPACE_COMMAND`),Af=tf(`KEY_ESCAPE_COMMAND`),jf=tf(`KEY_DELETE_COMMAND`),Mf=tf(`KEY_TAB_COMMAND`),Nf=tf(`DROP_COMMAND`),Pf=tf(`DRAGSTART_COMMAND`),Ff=tf(`DRAGOVER_COMMAND`),If=tf(`DRAGEND_COMMAND`),Lf=tf(`COPY_COMMAND`),Rf=tf(`CUT_COMMAND`),zf=tf(`SELECT_ALL_COMMAND`),Bf=tf(`FOCUS_COMMAND`),Vf=tf(`BLUR_COMMAND`),Hf=tf(`KEY_MODIFIER_COMMAND`),Uf=Object.freeze({}),Wf=[[`keydown`,function(e,t){Gf=e.timeStamp,Kf=e.key,!t.isComposing()&&X(t,bf,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;Fg(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&nh(t,()=>{Eh(n)||(Qf=!0)})}],[`compositionstart`,function(e,t){X(t,sf,e)}],[`compositionend`,function(e,t){xu?ep=!0:Cu||!Tu&&!Ou?X(t,cf,e):(tp=!0,np=e.data)}],[`input`,function(e,t){e.stopPropagation(),nh(t,()=>{t.dispatchCommand(of,e)},{event:e}),Jf=null}],[`click`,function(e,t){nh(t,()=>{let n=J(),r=Mg(wg(t)),i=Sm();if(r){if(q(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!uh(a)&&qh().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&a!==n.focus.getNode()){let e=Zg(a,e=>Y(e)&&!e.isInline());Y(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(Pg(n)||Ph(n))&&Yh(xm(i,r,t,e))}}X(t,rf,e)})}],[`cut`,Uf],[`copy`,Uf],[`dragstart`,Uf],[`dragover`,Uf],[`dragend`,Uf],[`paste`,Uf],[`focus`,Uf],[`blur`,Uf],[`drop`,Uf]];Su&&Wf.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||xu&&gg(t)||n!==`insertCompositionText`&&X(t,af,e)}(e,t)]);var Gf=0,Kf=null,qf=0,Jf=null,Yf=new WeakMap,Xf=new WeakMap,Zf=!1,Qf=!1,$f=!1,ep=!1,tp=!1,np=``,rp=null,ip=[0,``,0,`root`,0];function ap(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=Um(),l=Mg(wg(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!K(s)||(!i&&(!Su||qf<r+50)||s.isDirty()&&p<2||Zh(n))&&a.offset!==o.offset&&!s.isComposing()||Nh(s)||s.isDirty()&&p>1||(i||!Su)&&f!==null&&!s.isComposing()&&u!==Fh(f)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Mh(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(K(t)||Y(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function op(e,t){return Ph(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function sp(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;Zf&&(Zf=!1,op(r,i)&&op(a,o)&&!rp)||nh(t,()=>{if(!n)return void Yh(null);if(!Oh(t,r,a))return;let s=J();if(rp&&q(s)&&s.isCollapsed()){let e=s.anchor,t=rp.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=rp.clone(),Yh(s))}if(rp=null,q(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=wg(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=ip,f=qh(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)cp(s,o,c);else if(n.type===`text`)K(r)||G(141),lp(s,r);else if(n.type===`element`&&!p){Y(r)||G(259);let e=n.getNode();e.isEmpty()?function(e,t){cp(e,t.getTextFormat(),t.getTextStyle())}(s,e):cp(s,s.format,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(K(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}X(t,nf,void 0)})}function cp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function lp(e,t){cp(e,t.getFormat(),t.getStyle())}function up(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function dp(e){let t=e.inputType,n=up(e),r=Um(),i=J();if(t===`deleteContentBackward`){if(i===null){let e=Sm();if(!q(e))return!0;Yh(e.clone())}if(q(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,Kf===`MediaLast`&&a<Gf+30&&r.isComposing()&&t){if(zh(null),Gf=0,setTimeout(()=>{nh(r,()=>{zh(null)})},30),q(i)){let e=i.anchor.getNode();e.markDirty(),K(e)||G(142),lp(i,e)}}else{zh(null),e.preventDefault();let n=i.anchor.getNode(),a=n.getTextContent(),o=n.canInsertTextAfter(),s=i.anchor.offset===0&&i.focus.offset===a.length,c=Du&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!ch(hg(i.anchor,!0))),!c){X(r,lf,!0);let e=J();Du&&q(e)&&e.isCollapsed()&&(rp=e,setTimeout(()=>rp=null))}}return!0}}var a;if(!q(i))return!0;let o=e.data;Jf!==null&&tg(!1,r,Jf),i.dirty&&Jf===null||!i.isCollapsed()||uh(i.anchor.getNode())||n===null||i.applyDOMRange(n),Jf=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
5
5
|
`)e.preventDefault(),X(r,uf,!1);else if(o===zu)e.preventDefault(),X(r,df,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&ap(i,n,o,e.timeStamp,!0)?(e.preventDefault(),X(r,ff,o)):Jf=o;return qf=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:X(r,ff,e);break;case`insertFromComposition`:zh(null),X(r,ff,e);break;case`insertLineBreak`:zh(null),X(r,uf,!1);break;case`insertParagraph`:zh(null),$f&&!Cu?($f=!1,X(r,uf,!1)):X(r,df,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:X(r,pf,e);break;case`deleteByComposition`:(function(e,t){return e!==t||Y(e)||Y(t)||!Mh(e)||!Mh(t)})(l,u)&&X(r,mf,e);break;case`deleteByDrag`:case`deleteByCut`:X(r,mf,e);break;case`deleteContent`:X(r,lf,!1);break;case`deleteWordBackward`:X(r,hf,!0);break;case`deleteWordForward`:X(r,hf,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:X(r,gf,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:X(r,gf,!1);break;case`formatStrikeThrough`:X(r,_f,`strikethrough`);break;case`formatBold`:X(r,_f,`bold`);break;case`formatItalic`:X(r,_f,`italic`);break;case`formatUnderline`:X(r,_f,`underline`);break;case`historyUndo`:X(r,vf,void 0);break;case`historyRedo`:X(r,yf,void 0)}return!0}function fp(e){if(Pg(e.target)&&Eh(e.target))return!0;let t=Um(),n=J(),r=e.data,i=up(e);if(r!=null&&q(n)&&ap(n,i,r,e.timeStamp,!1)){ep&&=(hp(t,r),!1);let i=n.anchor.getNode(),a=Mg(wg(t));if(a===null)return!0;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;Su&&!n.isCollapsed()&&K(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===eg(a.anchorNode)||X(t,ff,r);let l=r.length;xu&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),Du&&t.isComposing()&&(Gf=0,zh(null))}else tg(!1,t,r===null?void 0:r),ep&&=(hp(t,r||void 0),!1);return function(){Bm(),rd(Um())}(),!0}function pp(e){let t=Um(),n=J();if(q(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();zh(r.key),bg(kp),(e.timeStamp<Gf+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||K(i)&&i.getStyle()!==n.style)&&X(t,ff,Bu)}return!0}function mp(e){return hp(Um(),e.data),bg(Ap),!0}function hp(e,t){let n=e._compositionKey;if(zh(null),n!==null&&t!=null){if(t===``){let t=Vh(n),r=Fh(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&K(t)){let n=Mg(wg(e)),i=null,a=null;n!==null&&n.anchorNode===r&&(i=n.anchorOffset,a=n.focusOffset),ng(t,r.nodeValue,i,a,!0)}return}if(t[t.length-1]===`
|
|
@@ -105,5 +105,5 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
105
105
|
`)}}async function*d2(e,t={}){let n=e.getReader(),r=new TextDecoder,i=``;try{for(;;){let{value:e,done:a}=await n.read();if(a)break;t.onActivity?.(),i+=r.decode(e,{stream:!0});let{frames:o,rest:s}=f2(i);i=s;for(let e of o)yield e}i+=r.decode();let{frames:e}=f2(i,!0);for(let t of e)yield t}finally{n.releaseLock()}}function f2(e,t=!1){let n=e.split(/\r?\n\r?\n/),r=n.pop()??``,i=[];for(let e of n){let t=u2(e);t&&i.push(t)}if(t&&r.trim()){let e=u2(r);return e&&i.push(e),{frames:i,rest:``}}return{frames:i,rest:r}}var p2=`/ncp/agent`,m2=class extends Error{ncpError;alreadyPublished;constructor(e,t=!1){super(e.message),this.name=`NcpHttpAgentClientError(${e.code})`,this.ncpError=e,this.alreadyPublished=t}};function h2(e){let t=e.trim();if(!t)throw Error(`NcpHttpAgentClient requires a non-empty baseUrl.`);return new URL(t)}function g2(e){if(e)return e;if(typeof globalThis.fetch==`function`)return globalThis.fetch.bind(globalThis);throw Error(`No fetch implementation found. Pass options.fetchImpl explicitly.`)}function _2(e){let t=(e??`/ncp/agent`).trim();if(!t)return p2;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n.slice(0,-1):n}async function v2(e){try{return(await e.text()).trim()}catch{return``}}function y2(e){if(C2(e))return e.ncpError;if(x2(e))return e;let t=e instanceof Error?e.message:String(e??`Unknown error`);return{code:T2(void 0),message:t,...e instanceof Error&&e.stack?{details:{stack:e.stack}}:{}}}function b2(e,t={}){return new m2(e,t.alreadyPublished??!1)}function x2(e){return S2(e)&&typeof e.code==`string`&&typeof e.message==`string`}function S2(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function C2(e){return e instanceof m2}var w2={"config-error":`config-error`,"auth-error":`auth-error`,"runtime-error":`runtime-error`,"timeout-error":`timeout-error`,"abort-error":`abort-error`};function T2(e){if(!e)return`runtime-error`;let t=w2[e];if(t)return t;let n=e.toLowerCase();return n.includes(`timeout`)?`timeout-error`:n.includes(`abort`)||n.includes(`cancel`)?`abort-error`:n.includes(`auth`)?`auth-error`:n.includes(`config`)?`config-error`:`runtime-error`}function E2(e){let t=O2(e);return!t||typeof t.type!=`string`||!t.type.trim()?null:t}function D2(e){let t=O2(e);if(!t)return{code:`runtime-error`,message:e||`Unknown stream error.`};let n=typeof t.code==`string`?t.code:void 0,r=T2(n),i=S2(t.details)?t.details:{};return n&&n!==r&&(i.originalCode=n),{code:r,message:typeof t.message==`string`&&t.message?t.message:`Unknown stream error.`,...Object.keys(i).length>0?{details:i}:{}}}function O2(e){try{let t=JSON.parse(e);return S2(t)?t:null}catch{return null}}var k2=[`text`,`file`,`source`,`step-start`,`reasoning`,`tool-invocation`,`card`,`rich-text`,`action`,`extension`];function A2(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.trunc(e):null}var j2=class{manifest;baseUrl;basePath;fetchImpl;defaultHeaders;streamOpenTimeoutMs;streamIdleTimeoutMs;subscribers=new Set;activeControllers=new Set;started=!1;constructor(e){let{basePath:t,baseUrl:n,endpointId:r,fetchImpl:i,headers:a,streamIdleTimeoutMs:o,streamOpenTimeoutMs:s}=e;this.baseUrl=h2(n),this.basePath=_2(t),this.fetchImpl=g2(i),this.defaultHeaders=a??{},this.streamOpenTimeoutMs=A2(s),this.streamIdleTimeoutMs=A2(o),this.manifest={endpointKind:`custom`,endpointId:r?.trim()||`ncp-http-agent-client`,version:`0.1.0`,supportsStreaming:!0,supportsAbort:!0,supportsProactiveMessages:!1,supportsLiveSessionStream:!0,supportedPartTypes:k2,expectedLatency:`seconds`,metadata:{transport:`http+sse`,scope:`agent`}}}start=async()=>{this.started||(this.started=!0,this.publish(_K({type:gK.EndpointReady})))};stop=async()=>{if(this.started){this.started=!1;for(let e of this.activeControllers)e.abort();this.activeControllers.clear()}};emit=async e=>{switch(e.type){case`message.request`:await this.send(e.payload);return;case`message.stream-request`:await this.stream(e.payload);return;case`message.abort`:await this.abort(e.payload);return;default:this.publish(e);return}};subscribe=e=>(this.subscribers.add(e),()=>{this.subscribers.delete(e)});send=async e=>{await this.ensureStarted();let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(`/send`),{method:`POST`,headers:{...this.defaultHeaders,accept:`application/json`,"content-type":`application/json`},body:JSON.stringify(e),signal:t.signal});if(!n.ok)throw Error(`NCP send command failed with HTTP ${n.status}: ${await v2(n)}`);let r=await n.json();if(!r.ok||!r.data)throw Error(r.error?.message??`NCP send command returned an invalid handle.`);return r.data}catch(e){if(t.signal.aborted)throw Error(`NCP send command was cancelled.`);if(C2(e))throw e;let n=y2(e);throw this.publish(_K({type:gK.EndpointError,payload:n})),b2(n)}finally{this.activeControllers.delete(t)}};stream=async(e,t)=>{await this.ensureStarted();let n=new URLSearchParams({sessionId:e.sessionId});await this.streamRequest({path:`/stream?${n.toString()}`,method:`GET`},t)};abort=async e=>{await this.ensureStarted();let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(`/abort`),{method:`POST`,headers:{...this.defaultHeaders,"content-type":`application/json`,accept:`application/json`},body:JSON.stringify(e),signal:t.signal});if(!n.ok)throw Error(`Abort request failed with HTTP ${n.status}: ${await v2(n)}`)}catch(e){if(t.signal.aborted)return;let n=y2(e);throw this.publish(_K({type:gK.EndpointError,payload:n})),b2(n)}finally{this.activeControllers.delete(t)}};ensureStarted=async()=>{this.started||await this.start()};publish=e=>{for(let t of this.subscribers)t(e)};resolveUrl=e=>new URL(`${this.basePath}${e}`,this.baseUrl);streamRequest=async(e,t)=>{let{body:n,method:r,path:i}=e,a=new AbortController;this.activeControllers.add(a);let o=null,s=null,c=()=>{o&&=(clearTimeout(o),null)},l=(e,t)=>{c(),e&&(o=setTimeout(()=>{s={code:`timeout-error`,message:t},a.abort(s)},e))};try{l(this.streamOpenTimeoutMs,`NCP stream did not open within ${this.streamOpenTimeoutMs}ms.`);let e=await this.fetchImpl(this.resolveUrl(i),{method:r,headers:{...this.defaultHeaders,accept:`text/event-stream`,...n===void 0?{}:{"content-type":`application/json`}},body:n===void 0?void 0:JSON.stringify(n),signal:a.signal});if(!e.ok)throw Error(`NCP stream request failed with HTTP ${e.status}: ${await v2(e)}`);if(!e.body)throw Error(`NCP stream response has no body.`);t?.onOpen?.(),l(this.streamIdleTimeoutMs,`NCP stream received no data for ${this.streamIdleTimeoutMs}ms.`);for await(let t of d2(e.body,{onActivity:()=>{l(this.streamIdleTimeoutMs,`NCP stream received no data for ${this.streamIdleTimeoutMs}ms.`)}})){if(a.signal.aborted)return;this.handleSseFrame(t)}}catch(e){if(a.signal.aborted&&!s)return;throw C2(e)?e:b2(s??y2(e))}finally{c(),this.activeControllers.delete(a)}};handleSseFrame=e=>{if(e.event===`ncp-event`){let t=E2(e.data);if(!t){this.publish(_K({type:gK.EndpointError,payload:{code:`runtime-error`,message:`Received malformed ncp-event frame.`}}));return}this.publish(t);return}if(e.event===`error`){let t=D2(e.data);throw this.publish(_K({type:gK.EndpointError,payload:t})),b2(t,{alreadyPublished:!0})}}};function M2(e){return{...e,parts:e.parts.map(e=>e.type===`tool-invocation`?{...e,...e.execution?{execution:{...e.execution}}:{}}:e),lifecycle:e.lifecycle?{...e.lifecycle}:void 0,metadata:e.metadata?{...e.metadata}:void 0}}function N2(e){return M2(OK(e))}var P2=class{execution=null;trigger=null;get isEmpty(){return!this.execution&&!this.trigger}clear=()=>{this.execution=null,this.trigger=null};beginRun=e=>{this.execution=null,(!this.trigger||!e?.trim()||this.trigger.targetRunId!==e)&&(this.trigger=null)};observe=e=>{let t=hK(e.metadata);t&&(!e.runId||e.runId===t.runId)&&(this.execution=structuredClone(t));let n=CK(e.metadata);n&&(!e.runId||e.runId===n.targetRunId)&&(this.trigger=structuredClone(n))};take=e=>{let t=this.execution,n=this.trigger;return this.execution=null,this.trigger=null,{execution:t&&(!e?.trim()||t.runId===e)?t:null,trigger:n&&(!e?.trim()||n.targetRunId===e)?n:null}};attach=(e,t)=>{let{execution:n,trigger:r}=t;return!n&&!r?e:{...e,metadata:{...e.metadata??{},...n?{[uK]:structuredClone(n)}:{},...r?{[vK]:structuredClone(r)}:{}}}}},F2=`__nextclaw_aborted_tool_call__`;function I2(e,t){switch(t.type){case gK.MessageSent:e.handleMessageSent(t.payload);break;case gK.MessageCompleted:e.handleMessageCompleted(t.payload);break;case gK.MessageAbort:e.handleMessageAbort(t.payload,t.occurredAt);break;case gK.MessageFailed:e.handleMessageFailed(t.payload,t.occurredAt);break;case gK.MessageTextStart:e.handleMessageTextStart(t.payload);break;case gK.MessageTextDelta:e.handleMessageTextDelta(t.payload);break;case gK.MessageTextEnd:e.handleMessageTextEnd(t.payload);break;case gK.MessageReasoningStart:e.handleMessageReasoningStart(t.payload);break;case gK.MessageReasoningDelta:e.handleMessageReasoningDelta(t.payload);break;case gK.MessageReasoningEnd:e.handleMessageReasoningEnd(t.payload);break;case gK.MessageToolCallStart:e.handleMessageToolCallStart(t.payload);break;case gK.MessageToolCallArgs:e.handleMessageToolCallArgs(t.payload);break;case gK.MessageToolCallArgsDelta:e.handleMessageToolCallArgsDelta(t.payload);break;case gK.MessageToolCallEnd:e.handleMessageToolCallEnd(t.payload);break;case gK.MessageToolExecutionStarted:e.handleMessageToolExecutionStarted(t.payload,t.occurredAt);break;case gK.MessageToolCallResult:e.handleMessageToolCallResult(t.payload,t.occurredAt);break;case gK.RunStarted:e.handleRunStarted(t.payload,t.occurredAt);break;case gK.RunFinished:e.handleRunFinished(t.payload,t.occurredAt);break;case gK.RunError:e.handleRunError(t.payload,t.occurredAt);break;case gK.RunMetadata:e.handleRunMetadata(t.payload);break;case gK.ContextWindowUpdated:e.handleContextWindowUpdated(t.payload);break;case gK.EndpointError:e.handleEndpointError(t.payload,t.occurredAt);break;default:break}}function L2(e,t){let n=R2(e?.startedAt),r=R2(e?.endedAt??t),i=e?.durationMs,a=typeof i==`number`&&Number.isFinite(i)&&i>=0?i:void 0;if(!(!n&&!r&&a===void 0))return{...n?{startedAt:n}:{},...r?{endedAt:r}:{},...a===void 0?{}:{durationMs:a}}}function R2(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():void 0}function z2(e,t){if(!e)return t;if(!t)return e;let n=L2(e),r=L2(t),i=n?.startedAt,a=r?.startedAt,o=i&&a?Date.parse(i)<=Date.parse(a)?i:a:i??a,s=n?.durationMs,c=r?.durationMs,l=s??c,u=s===void 0?c===void 0?n?.endedAt??r?.endedAt:r?.endedAt??n?.endedAt:n?.endedAt??r?.endedAt;return{...o?{startedAt:o}:{},...u?{endedAt:u}:{},...l===void 0?{}:{durationMs:l}}}function B2(e){let t=e.error?.trim();return{code:e.interrupted?`run-interrupted`:`runtime-error`,message:t&&t.length>0?t:`Agent run failed.`,details:{sessionId:e.sessionId,messageId:e.messageId,threadId:e.threadId,runId:e.runId}}}function V2(e){if(!(!e.startedAt&&!e.endedAt))return{startedAt:e.startedAt,endedAt:e.endedAt}}function H2(e,t,n){let r=t===`error`||n?.endedAt?Q2(e.parts,n?.endedAt).parts:e.parts;return n?{...e,status:t,parts:r,lifecycle:n}:{...e,status:t,parts:r}}function U2(e,t){let n=Date.parse(t.timestamp);if(!Number.isFinite(n))return e.length;let r=e.findIndex(e=>{let t=Date.parse(e.timestamp);return Number.isFinite(t)&&t>n});return r<0?e.length:r}function W2(e,t){let n=[...e];return n.splice(U2(e,t),0,t),n}function G2(e,t,n){let r=n>0?e[n-1]?.id:null,i=e[n]?.id,a=i?t.findIndex(e=>e.id===i):-1;if(a>=0)return a;let o=r?t.findIndex(e=>e.id===r):-1;return o>=0?o+1:t.length}function K2(e,t,n,r){let i=N2(r),a=t?.id===i.id,o=e.findIndex(e=>e.id===i.id),s=[...e];if(o>=0)s[o]=i;else{let t=a?Math.min(Math.max(n??e.length,0),e.length):e.length;s.splice(t,0,i)}return{messages:s,streamingMessage:a?null:t,streamingMessageIndex:a?null:n}}function q2(e,t,n){let r=new Set(e.map(e=>e.id));t&&r.add(t.id);let i=e;for(let e of n)r.has(e.id)||(r.add(e.id),i=W2(i,N2(e)));return i}function J2(e,t){return t.trim()?e.id.startsWith(`tool-`)?!0:e.parts.some(e=>e.type===`tool-invocation`):!1}function Y2(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n];if(r.type===`tool-invocation`&&r.toolCallId===t)return r}return null}function X2(e,t){return Y2(e,t)?.toolName??null}function Z2(e,t){let n=[...e];for(let e=n.length-1;e>=0;--e){let r=n[e];if(r.type===`tool-invocation`&&r.toolCallId===t.toolCallId)return n[e]={...r,...t,...r.execution||t.execution?{execution:{...r.execution,...t.execution}}:{}},n}return n.push(t),n}function Q2(e,t){let n=[],r=t?Date.parse(t):NaN,i=Number.isFinite(r)?new Date(r).toISOString():void 0;return{parts:e.map(e=>e.type!==`tool-invocation`||!e.toolCallId||e.state===`result`||e.state===`cancelled`?e:(n.push(e.toolCallId),{...e,state:`cancelled`,...e.execution?.startedAt&&!e.execution.endedAt?{execution:{...e.execution,...i?{endedAt:i}:{}}}:{}})),toolCallIds:n}}function $2(e){return e.state===`result`||e.state===`cancelled`||!!e.execution?.endedAt||typeof e.execution?.durationMs==`number`}var e4=class{messageIdByCallId=new Map;argsRawByCallId=new Map;constructor(e){this.port=e}isEmpty=()=>this.messageIdByCallId.size===0&&this.argsRawByCallId.size===0;clear=()=>{this.messageIdByCallId.clear(),this.argsRawByCallId.clear()};hydrate=e=>{this.clear(),e.forEach(e=>{e.parts.forEach(t=>{if(t.type!==`tool-invocation`||!t.toolCallId||t.state===`result`||t.state===`cancelled`)return;let n=typeof t.args==`string`?t.args:JSON.stringify(t.args??{});this.messageIdByCallId.set(t.toolCallId,e.id),this.argsRawByCallId.set(t.toolCallId,n)})})};clearByMessageId=e=>{for(let[t,n]of this.messageIdByCallId)n===e&&(this.messageIdByCallId.delete(t),this.argsRawByCallId.delete(t))};markAborted=e=>{e.forEach(e=>this.argsRawByCallId.set(e,F2))};remapMessageId=(e,t)=>{for(let[n,r]of this.messageIdByCallId)r===e&&this.messageIdByCallId.set(n,t)};handleToolCallStart=e=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId,e.messageId);this.argsRawByCallId.set(e.toolCallId,``),this.port.replaceStreamingMessage({...t,parts:Z2(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:e.toolName,state:`partial-call`,args:``}),status:`streaming`})};handleToolCallArgs=e=>{this.argsRawByCallId.get(e.toolCallId)!==`__nextclaw_aborted_tool_call__`&&(this.argsRawByCallId.set(e.toolCallId,e.args),this.applyToolCallArgs(e.sessionId,e.toolCallId,e.args))};handleToolCallArgsDelta=e=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=`${this.argsRawByCallId.get(e.toolCallId)??``}${e.delta}`;this.argsRawByCallId.set(e.toolCallId,t),this.applyToolCallArgs(e.sessionId,e.toolCallId,t,e.messageId)};handleToolCallEnd=e=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId),n=this.argsRawByCallId.get(e.toolCallId)??``;this.port.replaceStreamingMessage({...t,parts:Z2(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:X2(t.parts,e.toolCallId)??`unknown`,state:`call`,args:n}),status:`streaming`})};handleToolExecutionStarted=(e,t)=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let n=R2(t);if(!n||this.port.updateMessageContainingToolCall(e.toolCallId,(e,t)=>{if($2(t))return e.parts;let r=R2(t.execution?.startedAt),i=r&&Date.parse(r)<=Date.parse(n)?r:n;return Z2(e.parts,{...t,execution:{...t.execution,startedAt:i}})}))return;let r=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId,e.messageId);this.port.replaceStreamingMessage({...r,parts:Z2(r.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:`unknown`,state:`call`,execution:{startedAt:n}}),status:`streaming`})};handleToolCallResult=(e,t)=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let n=e.final!==!1,r=L2(e.execution,n?t:void 0);if(this.port.updateMessageContainingToolCall(e.toolCallId,(t,i)=>i.state===`cancelled`||!n&&$2(i)?t.parts:Z2(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:i.toolName,state:n?`result`:`call`,args:i.args,result:e.content,...e.contentItems?{resultContentItems:e.contentItems}:{},...r?{execution:z2(i.execution,r)}:{}})))return;let i=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId);this.port.replaceStreamingMessage({...i,parts:Z2(i.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:`unknown`,state:n?`result`:`call`,result:e.content,...e.contentItems?{resultContentItems:e.contentItems}:{},...r?{execution:r}:{}}),status:`streaming`})};applyToolCallArgs=(e,t,n,r)=>{let i=this.resolveToolCallTargetMessage(e,t,r),a=X2(i.parts,t)??`unknown`;this.port.replaceStreamingMessage({...i,parts:Z2(i.parts,{type:`tool-invocation`,toolCallId:t,toolName:a,state:`partial-call`,args:n}),status:`streaming`})};resolveToolCallTargetMessage=(e,t,n)=>{let r=n?.trim()||this.messageIdByCallId.get(t)||this.port.readStreamingMessageId()||`tool-${t}`;return this.messageIdByCallId.set(t,r),this.port.ensureStreamingMessage(e,r,`streaming`)}},t4=`assistant`,n4=class{messages=[];streamingMessage=null;streamingMessageIndex=null;error=null;activeRun=null;contextWindow=null;listeners=new Set;runExecution=new P2;toolCalls;lastSettledRunId=null;snapshotCache=null;snapshotVersion=-1;stateVersion=0;constructor(){this.toolCalls=new e4({ensureStreamingMessage:this.ensureStreamingMessage,readStreamingMessageId:()=>this.streamingMessage?.id??null,replaceStreamingMessage:this.replaceStreamingMessage,updateMessageContainingToolCall:this.updateMessageContainingToolCall})}getSnapshot=()=>{if(this.snapshotCache&&this.snapshotVersion===this.stateVersion)return this.snapshotCache;let e={messages:this.messages,streamingMessage:this.streamingMessage,streamingMessageIndex:this.streamingMessageIndex,error:this.error?{...this.error,details:this.error.details?{...this.error.details}:void 0}:null,activeRun:this.activeRun?{...this.activeRun}:null,contextWindow:this.contextWindow?{...this.contextWindow}:null};return this.snapshotCache=e,this.snapshotVersion=this.stateVersion,e};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));reset=()=>{this.messages.length===0&&!this.streamingMessage&&!this.error&&!this.activeRun&&this.runExecution.isEmpty&&!this.contextWindow&&this.toolCalls.isEmpty()||(this.messages=[],this.streamingMessage=null,this.streamingMessageIndex=null,this.error=null,this.activeRun=null,this.runExecution.clear(),this.contextWindow=null,this.toolCalls.clear(),this.lastSettledRunId=null,this.stateVersion+=1,this.notifyListeners())};clearError=()=>{let e=this.stateVersion;this.setError(null),this.stateVersion!==e&&this.notifyListeners()};hydrate=e=>{this.messages=[...new Map(e.messages.map(e=>[e.id,N2(e)])).values()],this.streamingMessage=null,this.streamingMessageIndex=null,this.error=null,this.contextWindow=e.contextWindow?{...e.contextWindow}:null,this.activeRun=e.activeRun?{...e.activeRun,sessionId:e.activeRun.sessionId??e.sessionId,abortDisabledReason:e.activeRun.abortDisabledReason??null}:null,this.runExecution.clear(),this.toolCalls.hydrate(this.messages),this.lastSettledRunId=null,this.stateVersion+=1,this.notifyListeners()};prependHistory=e=>{let t=this.messages,n=q2(this.messages,this.streamingMessage,e);n!==t&&(this.messages=n,this.streamingMessageIndex!==null&&(this.streamingMessageIndex=G2(t,n,this.streamingMessageIndex)),this.toolCalls.hydrate(this.messages),this.stateVersion+=1,this.notifyListeners())};dispatch=e=>this.dispatchBatch([e]);dispatchBatch=async e=>{if(!e.length)return;let t=this.stateVersion;e.forEach(e=>I2(this,e)),this.stateVersion!==t&&this.notifyListeners()};handleMessageSent=e=>{this.upsertMessage(e.message),this.setError(null)};handleMessageCompleted=e=>{let t=this.activeRun?.runId,n=this.runExecution.attach(N2({...e.message,status:`final`}),this.runExecution.take(t));if(this.streamingMessage?.id===n.id){this.upsertMessage(n),this.toolCalls.clearByMessageId(n.id);return}this.upsertMessage(n)};handleMessageAbort=(e,t)=>{let n=e.messageId?.trim(),r=e.runId??this.activeRun?.runId,i=this.runExecution.take(r);if(this.clearActiveRun(),this.setError(null),this.streamingMessage&&(!n||this.streamingMessage.id===n)){let e=this.streamingMessage.id,{parts:r,toolCallIds:a}=Q2(this.streamingMessage.parts,t);this.upsertMessage(this.runExecution.attach({...this.streamingMessage,status:`final`,parts:r},i)),this.replaceStreamingMessage(null),this.toolCalls.clearByMessageId(n||e),this.toolCalls.markAborted(a)}};handleMessageFailed=(e,t)=>{this.streamingMessage&&(!e.messageId||this.streamingMessage.id===e.messageId)&&this.settleStreamingMessage(`error`,t?{endedAt:t}:void 0,this.activeRun?.runId),this.clearActiveRun(),this.setError(e.error)};handleMessageTextStart=e=>{let t=this.streamingMessage?.id===e.messageId,n=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),r=n.parts[n.parts.length-1];t&&r?.type===`text`&&r.text.length>0&&this.replaceStreamingMessage({...n,parts:[...n.parts,{type:`text`,text:``}],status:`streaming`}),this.setError(null)};handleMessageTextDelta=e=>{if(!e.delta)return;let t=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),n=[...t.parts],r=n[n.length-1];r?.type===`text`?n[n.length-1]={type:`text`,text:`${r.text}${e.delta}`}:n.push({type:`text`,text:e.delta}),this.replaceStreamingMessage({...t,parts:n,status:`streaming`})};handleMessageTextEnd=e=>{this.streamingMessage?.id===e.messageId&&this.streamingMessage.status===`streaming`&&this.replaceStreamingMessage({...this.streamingMessage,status:`pending`})};handleMessageReasoningStart=e=>{this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`)};handleMessageReasoningDelta=e=>{if(!e.delta)return;let t=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),n=[...t.parts],r=n[n.length-1];r?.type===`reasoning`?n[n.length-1]={type:`reasoning`,text:`${r.text}${e.delta}`}:n.push({type:`reasoning`,text:e.delta}),this.replaceStreamingMessage({...t,parts:n,status:`streaming`})};handleMessageReasoningEnd=e=>{this.streamingMessage?.id,e.messageId};handleMessageToolCallStart=e=>{this.toolCalls.handleToolCallStart(e),this.setError(null)};handleMessageToolCallArgs=e=>{this.toolCalls.handleToolCallArgs(e)};handleMessageToolCallArgsDelta=e=>{this.toolCalls.handleToolCallArgsDelta(e)};handleMessageToolCallEnd=e=>{this.toolCalls.handleToolCallEnd(e)};handleMessageToolExecutionStarted=(e,t)=>{this.toolCalls.handleToolExecutionStarted(e,t)};handleMessageToolCallResult=(e,t)=>{this.toolCalls.handleToolCallResult(e,t)};handleRunStarted=(e,t)=>{this.isSettledRunId(e.runId)||e.runId&&this.activeRun?.runId===e.runId||(this.streamingMessage&&this.activeRun?.runId!==e.runId&&this.handleMessageAbort({sessionId:this.streamingMessage.sessionId,messageId:this.streamingMessage.id},t),this.runExecution.beginRun(e.runId),this.setError(null),this.activeRun={runId:e.runId??null,sessionId:e.sessionId},this.stateVersion+=1)};handleRunFinished=(e,t)=>{this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.settleStreamingMessage(`final`,V2({...e,endedAt:e.endedAt??t}),e.runId??this.activeRun?.runId),this.setError(null),this.clearActiveRun()};handleRunError=(e,t)=>{this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.settleStreamingMessage(`error`,V2({...e,endedAt:e.endedAt??t}),e.runId??this.activeRun?.runId),this.setError(B2(e)),this.clearActiveRun()};handleRunMetadata=e=>{this.runExecution.observe(e);let t=e.metadata;if(t?.kind===`ready`){let e=t;if(this.isSettledRunId(e.runId))return;this.activeRun={runId:e.runId??this.activeRun?.runId??null,sessionId:e.sessionId??this.activeRun?.sessionId,abortDisabledReason:e.supportsAbort===!1?e.abortDisabledReason??`Unsupported`:null},this.stateVersion+=1}else t?.kind===`final`&&(this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.clearActiveRun())};handleContextWindowUpdated=e=>{this.contextWindow={...e.contextWindow},this.stateVersion+=1};handleEndpointError=(e,t)=>{if(e.code===`abort-error`){this.handleMessageAbort({sessionId:this.activeRun?.sessionId??this.streamingMessage?.sessionId??``,...this.streamingMessage?.id?{messageId:this.streamingMessage.id}:{}},t);return}this.settleStreamingMessage(`error`,t?{endedAt:t}:void 0),this.clearActiveRun(),this.setError(e)};ensureStreamingMessage=(e,t,n)=>{if(this.streamingMessage?.id===t){if(this.streamingMessage.status===n)return this.streamingMessage;let e={...this.streamingMessage,status:n};return this.replaceStreamingMessage(e),e}let r=this.messages.findIndex(e=>e.id===t);if(r>=0){let t=M2(this.messages[r]),i=[...this.messages];i.splice(r,1),this.messages=i,this.streamingMessageIndex=r,this.stateVersion+=1;let a={...t,sessionId:e,status:n};return this.replaceStreamingMessage(a),a}let i=this.streamingMessage;if(i&&i.id!==t&&i.sessionId===e&&J2(i,t)){let r={...i,id:t,sessionId:e,status:n};return this.toolCalls.remapMessageId(i.id,t),this.replaceStreamingMessage(r),r}let a={id:t,sessionId:e,role:t4,status:n,parts:[],timestamp:new Date().toISOString()};return this.streamingMessageIndex=this.messages.length,this.replaceStreamingMessage(a),a};updateMessageContainingToolCall=(e,t)=>{if(this.streamingMessage){let n=Y2(this.streamingMessage.parts,e);if(n){let e=t(this.streamingMessage,n);return this.replaceStreamingMessage({...this.streamingMessage,parts:e}),!0}}for(let n=this.messages.length-1;n>=0;--n){let r=this.messages[n],i=Y2(r.parts,e);if(!i)continue;let a=[...this.messages];return a[n]={...r,parts:t(r,i)},this.messages=a,this.stateVersion+=1,!0}return!1};upsertMessage=e=>{let t=K2(this.messages,this.streamingMessage,this.streamingMessageIndex,e);this.messages=t.messages,this.streamingMessage=t.streamingMessage,this.streamingMessageIndex=t.streamingMessageIndex,this.stateVersion+=1};replaceStreamingMessage=e=>{!e&&!this.streamingMessage&&this.streamingMessageIndex===null||(this.streamingMessageIndex=e?this.streamingMessageIndex??this.messages.length:null,this.streamingMessage=e?N2(e):null,this.stateVersion+=1)};setError=e=>{this.error?.code===e?.code&&this.error?.message===e?.message&&this.error?.details===e?.details&&this.error?.cause===e?.cause||(this.error=e?{...e,details:e.details?{...e.details}:void 0}:null,this.stateVersion+=1)};clearActiveRun=()=>{this.activeRun&&(this.activeRun=null,this.stateVersion+=1)};isSettledRunId=e=>!!e?.trim()&&e===this.lastSettledRunId;markRunAsSettled=e=>{this.lastSettledRunId=e?.trim()||null};settleStreamingMessage=(e,t,n)=>{let r=this.runExecution.take(n);if(!this.streamingMessage)return;let i=this.runExecution.attach(H2(this.streamingMessage,e,t),r);this.upsertMessage(i),this.replaceStreamingMessage(null),this.toolCalls.clearByMessageId(i.id)};notifyListeners=()=>{let e=this.getSnapshot();for(let t of this.listeners)t(e)}},r4=16,i4={code:`abort-error`,message:`User stopped the current run.`,details:{source:`chat-ui`}},a4=class{constructor(e){this.dispatchBatch=e,this.queue=[],this.flushTimerId=null,this.isFlushing=!1,this.isDisposed=!1,this.enqueue=e=>{this.isDisposed||(this.queue.push(e),this.scheduleFlush())},this.dispose=()=>{this.isDisposed=!0,this.flushTimerId!==null&&(window.clearTimeout(this.flushTimerId),this.flushTimerId=null),this.queue.length=0},this.scheduleFlush=()=>{this.flushTimerId!==null||this.isFlushing||this.queue.length===0||(this.flushTimerId=window.setTimeout(()=>{this.flushTimerId=null,this.flush()},r4))},this.flush=async()=>{if(!(this.isDisposed||this.isFlushing||this.queue.length===0)){this.isFlushing=!0;try{for(;this.queue.length>0;){let e=this.queue.splice(0);await this.dispatchBatch(e)}}finally{this.isFlushing=!1,this.scheduleFlush()}}}}};function o4(e,t){if(!t)return!0;let n=`payload`in e?e.payload:null;return!n||typeof n!=`object`||!(`sessionId`in n)||typeof n.sessionId!=`string`?!0:n.sessionId===t}function s4(e){return e.parts.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function c4(e,t){if(typeof e==`string`){let n=e.trim();return n?{...t?{sessionId:t}:{},message:{id:`user-${Date.now().toString(36)}`,...t?{sessionId:t}:{},role:`user`,status:`final`,parts:[{type:`text`,text:n}],timestamp:new Date().toISOString()}}:null}if(!s4(e.message))return null;let n=e.sessionId||e.message.sessionId||t;return{...e,...n?{sessionId:n}:{},message:{...e.message,...n?{sessionId:n}:{}}}}function l4(e,t){return{...e.message,sessionId:t}}function u4(e,t,n){let r=[...e];return r.splice(Math.min(Math.max(n,0),r.length),0,t),r}function d4(e){let t=(0,H.useRef)();return t.current?e&&t.current.sessionId===null?t.current.sessionId=e:t.current.sessionId!==(e??null)&&(t.current={sessionId:e??null,manager:new n4}):t.current={sessionId:e??null,manager:new n4},t.current.manager}function f4({sessionId:e,client:t,manager:n}){let r=(0,H.useRef)(e),i=(0,H.useSyncExternalStore)(e=>n.subscribe(()=>e()),()=>n.getSnapshot(),()=>n.getSnapshot()),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(null);(0,H.useEffect)(()=>{r.current=e},[e]),(0,H.useEffect)(()=>{let e=new a4(n.dispatchBatch),i=t.subscribe(t=>{o4(t,r.current)&&e.enqueue(t)});return()=>{i(),e.dispose(),t.stop()}},[t,n]);let l=i.messages;if(i.streamingMessage){let e=i.streamingMessageIndex;if(e===null)throw Error(`Streaming conversation snapshot is missing its event-order insertion boundary.`);l=u4(i.messages,i.streamingMessage,e)}let u=s&&(!e||s.sessionId===e)&&!i.messages.some(e=>e.id===s.id)?W2(l,s):l,d=i.activeRun?.runId??null,f=!!i.activeRun,p=a===e,m=async(e,t)=>{e.runId===null||e.delivery===`steered`||(n.clearError(),await n.dispatchBatch([...t?[{type:gK.MessageSent,payload:{sessionId:e.sessionId,message:t}}]:[],{type:gK.RunStarted,payload:{sessionId:e.sessionId,runId:e.runId}}]))};return{snapshot:i,visibleMessages:u,activeRunId:d,acceptRun:m,isRunning:f,isSending:p,send:async r=>{if(p)return null;let i=c4(r,e);if(!i)return null;n.clearError(),o(e);let a=i.sessionId?l4(i,i.sessionId):null,s=async()=>{c(null),a&&await n.dispatch({type:gK.MessageSent,payload:{sessionId:a.sessionId,message:{...a,status:`error`}}})};c(f?null:a);try{let e=await t.send(i);return e?(e.runId===null||await m(e,l4(i,e.sessionId)),c(null),e):(await s(),null)}catch(e){throw await s(),e}finally{o(t=>t===e?null:t)}},abort:async()=>{e&&await t.abort({sessionId:e,runId:d??void 0,reason:i4})},streamRun:async()=>{e&&(await t.stop(),await t.stream({sessionId:e}))}}}var p4=500,m4=1e4,h4=3;function g4(e){return e instanceof Error?e:Error(String(e))}function _4(e,t){let n=e.getSnapshot();return n.activeRun?.sessionId===t||n.streamingMessage?.sessionId===t||n.messages.some(e=>e.sessionId===t)}function v4(){return new Promise(e=>window.setTimeout(e,p4))}function y4(e,t,n){let r=e.consecutiveFailures+1;return n(!e.hasHydrated||r>=h4?g4(t):null),{...e,consecutiveFailures:r}}function b4(e,t,n){return t.stable?(n(null),{...e,consecutiveFailures:0}):y4(e,t.error,n)}function x4(e){return[...e.messages,...e.streamingMessage?[e.streamingMessage]:[]]}function S4(e){let{current:t,messages:n,activeRun:r}=e,i=x4(t);return i.length!==n.length||JSON.stringify(t.activeRun)!==JSON.stringify(r)?!1:i.every((e,t)=>e===n[t]||JSON.stringify(e)===JSON.stringify(n[t]))}async function C4(e){let{loadSeed:t,manager:n,reconcileFrom:r,sessionId:i,signal:a}=e,o=await t(i,a);if(a.aborted)return;let s=n.getSnapshot(),c=!!(r&&s!==r),l=c?w4(o,s):o.messages,u=c?s.activeRun:o.status===`running`?{runId:null,sessionId:i,abortDisabledReason:null}:null;S4({current:s,messages:l,activeRun:u})||n.hydrate({sessionId:i,messages:l,activeRun:u})}function w4(e,t){let n=x4(t),r=new Map(n.map(e=>[e.id,e])),i=e.messages.map(e=>{let t=r.get(e.id);if(!t)return e;r.delete(e.id);let n=e.status===`final`||e.status===`error`,i=t.status===`final`||t.status===`error`;return n&&!i?e:t});for(let n of r.values())(n.status===`final`||n.status===`error`||n.role===`user`||e.status===`running`||t.activeRun)&&i.push(n);return i}async function T4(e){let{client:t,onOpen:n,sessionId:r,signal:i}=e,a=Date.now(),o;try{await t.stream({sessionId:r},{onOpen:n}),o=Error(`Live conversation stream disconnected.`)}catch(e){o=e}return i.aborted?null:{error:o,stable:Date.now()-a>=m4}}async function E4(e,t,n){t.reset(),n(null),await e.stop()}function D4({sessionId:e,client:t,loadSeed:n}){let r=d4(e),i=f4({sessionId:e,client:t,manager:r}),[a,o]=(0,H.useState)({sessionId:null,error:null});(0,H.useEffect)(()=>{let i=new AbortController,{signal:a}=i,s=t=>{o({sessionId:e??null,error:t})};return(async()=>{if(!e){await E4(t,r,s);return}let i=!_4(r,e),c={consecutiveFailures:0,hasHydrated:!i};for(i?(r.reset(),o({sessionId:null,error:null})):s(null),await t.stop();!a.aborted;){if(i)try{if(await C4({loadSeed:n,manager:r,sessionId:e,signal:a}),a.aborted)return;s(null),c={...c,hasHydrated:!0},i=!1}catch(e){if(a.aborted)return;c=y4(c,e,s),await v4();continue}let o=Promise.resolve(),l=await T4({client:t,sessionId:e,signal:a,onOpen:()=>{o=C4({loadSeed:n,manager:r,reconcileFrom:r.getSnapshot(),sessionId:e,signal:a}).then(()=>{a.aborted||(s(null),c={...c,hasHydrated:!0})}).catch(e=>{a.aborted||(c=y4(c,e,s))})}});if(await o,!l)return;c=b4(c,l,s),i=!0,await v4()}})().catch(e=>{a.aborted||s(g4(e))}),()=>{i.abort()}},[t,n,r,e]);let s=(0,H.useCallback)(e=>r.prependHistory(e),[r]),c=(0,H.useCallback)(t=>{e&&r.hydrate({sessionId:e,messages:t.messages,activeRun:t.status===`running`?{runId:null,sessionId:e,abortDisabledReason:null}:null})},[r,e]);return{...i,isHydrating:!!(e&&a.sessionId!==e),hydrateError:a.error,prependHistory:s,replaceHistory:c}}var O4=200*1024*1024,k4=`application/octet-stream`;function A4(e){let t=e.type.trim().toLowerCase();return t.length>0?t:k4}function j4(e,t){let n=t.acceptedMimeTypes&&t.acceptedMimeTypes.length>0?new Set(t.acceptedMimeTypes.map(e=>e.trim().toLowerCase())):null,r=t.maxBytes??209715200,i=A4(e);return n&&!n.has(i)?{ok:!1,rejected:{fileName:e.name,mimeType:i,sizeBytes:e.size,reason:`unsupported-type`}}:e.size>r?{ok:!1,rejected:{fileName:e.name,mimeType:i,sizeBytes:e.size,reason:`too-large`}}:{ok:!0,mimeType:i}}function M4(e){let t=e.parts&&e.parts.length>0?e.parts.map(e=>structuredClone(e)):[...e.text?.trim()??``?[{type:`text`,text:e.text.trim()}]:[],...(e.attachments??[]).map(e=>({type:`file`,name:e.name,mimeType:e.mimeType,...e.assetUri?.trim()?{assetUri:e.assetUri.trim()}:{},...e.url?.trim()?{url:e.url.trim()}:{},...e.contentBase64?.trim()?{contentBase64:e.contentBase64.trim()}:{},sizeBytes:e.sizeBytes}))];if(t.length===0)return null;let n=e.timestamp??new Date().toISOString(),r=e.messageId??`user-${Date.now().toString(36)}`;return{...e.sessionId?{sessionId:e.sessionId}:{},message:{id:r,...e.sessionId?{sessionId:e.sessionId}:{},role:`user`,status:`final`,parts:t,timestamp:n,...e.metadata?{metadata:e.metadata}:{}},...e.metadata?{metadata:e.metadata}:{}}}async function N4(e,t){let n=[],r=[];for(let i of e){let e=j4(i,t);if(!e.ok){r.push(e.rejected);continue}n.push(i)}if(n.length===0)return{attachments:[],rejected:r};try{return{attachments:await t.uploadBatch(n),rejected:r}}catch{return r.push(...n.map(e=>({fileName:e.name,mimeType:A4(e),sizeBytes:e.size,reason:`read-failed`}))),{attachments:[],rejected:r}}}function P4(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function F4(e){if(e instanceof Error){let t=e.name?.trim(),n=e.message?.trim();return t&&n?`${t}: ${n}`:n||t||`Unknown Error`}return String(e??`Unknown error`)}function I4(e,t){let n=Error(e);return t!==void 0&&(n.cause=t),n}function L4(){return async(e,t)=>{try{return await fetch(e,{credentials:`include`,...t})}catch(n){throw wt.reportTransportFailure(F4(n)),I4(`NCP fetch failed for ${(t?.method||`GET`).toUpperCase()} ${P4(e)}: ${F4(n)}`,n)}}}function R4(e){return e instanceof Error&&e.message.includes(`ncp session not found:`)}function z4(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}async function B4(e,t){return t.throwIfAborted(),await new Promise((n,r)=>{let i=()=>r(new DOMException(`Aborted`,`AbortError`));t.addEventListener(`abort`,i,{once:!0}),e.then(n,r).finally(()=>{t.removeEventListener(`abort`,i)})})}async function V4(e){let{messageLimit:t,sessionId:n,signal:r}=e,i=window.__NEXTCLAW_INITIAL_SESSION_MESSAGES_PREFETCH__;if(!i||i.consumed||i.sessionId!==n||i.limit!==t)return null;i.consumed=!0;let a=await B4(i.promise,r);if(r.throwIfAborted(),!a?.responseOk||!z4(a.payload))return null;let{payload:o}=a;if(o.ok!==!0||!z4(o.data))return null;let{data:s}=o;return s.sessionId!==n||!Array.isArray(s.messages)||!z4(s.pageInfo)?null:s}async function H4(e,t,n=20,r=`compact`){t.throwIfAborted();try{let i=(r===`compact`?await V4({sessionId:e,messageLimit:n,signal:t}):null)??await Ue(e,{limit:n,toolPayload:`summary`,initialPayload:r===`compact`?`compact`:void 0,signal:t});return t.throwIfAborted(),{messages:i.messages,status:i.status??`idle`,contextWindow:i.contextWindow??null,deferredToolPayloads:i.deferredToolPayloads??{},total:i.total,pageInfo:i.pageInfo}}catch(e){if(t.throwIfAborted(),!R4(e))throw e;return{messages:[],status:`idle`,total:0,deferredToolPayloads:{},pageInfo:{startCursor:null,hasPreviousPage:!1}}}}function U4(e){let{hydrationRetryVersion:t,messageLimit:n,onSeedLoaded:r}=e,i=(0,H.useRef)(new Set);return(0,H.useCallback)(async(e,t)=>{let a=await H4(e,t,n,i.current.has(e)?`standard`:`compact`);return t.aborted||(i.current.add(e),r(e,a)),{messages:a.messages,status:a.status}},[t,n,r])}var W4={sessionId:null,contextWindow:null,total:0,cursor:null,hasPreviousPage:!1,isLoading:!1,error:null,deferredToolPayloads:{},messageDetails:{},messageDetailStates:{}};function G4(e){let{historyStateRef:t,sessionId:n,updateHistoryState:r}=e,i=(0,H.useRef)(new Map);return(0,H.useEffect)(()=>{let e=i.current;for(let t of e.values())t.controller.abort();return e.clear(),()=>{for(let t of e.values())t.controller.abort();e.clear()}},[n]),(0,H.useCallback)(async e=>{if(!n)return;let a=t.current;if(a.sessionId!==n||a.messageDetails[e])return;let o=a.deferredToolPayloads[e]?.cursor;if(!o)return;let s=i.current.get(e);if(s)return await s.promise;let c=new AbortController;r(n,t=>({...t,messageDetailStates:{...t.messageDetailStates,[e]:`loading`}}));let l=(async()=>{try{let t=await He(n,e,o,c.signal);if(c.signal.aborted)return;r(n,n=>({...n,messageDetails:{...n.messageDetails,[e]:t},messageDetailStates:{...n.messageDetailStates,[e]:`ready`}}))}catch{if(c.signal.aborted)return;r(n,t=>({...t,messageDetailStates:{...t.messageDetailStates,[e]:`error`}}))}finally{i.current.get(e)?.controller===c&&i.current.delete(e)}})();i.current.set(e,{controller:c,promise:l}),await l},[t,n,r])}function K4(e){let{hydrationRetryVersion:t,messageLimit:n,sessionId:r}=e,[i,a]=(0,H.useState)(W4),o=(0,H.useRef)(W4),s=(0,H.useRef)(null),c=(0,H.useCallback)((e,t)=>{let n=t(o.current.sessionId===e?o.current:{...W4,sessionId:e});o.current=n,a(n)},[]);(0,H.useEffect)(()=>(s.current?.abort(),s.current=null,()=>{s.current?.abort()}),[r]);let l=G4({historyStateRef:o,sessionId:r,updateHistoryState:c});return{loadSeed:U4({hydrationRetryVersion:t,messageLimit:n,onSeedLoaded:(0,H.useCallback)((e,t)=>{c(e,e=>({...e,contextWindow:t.contextWindow??null,deferredToolPayloads:t.deferredToolPayloads,messageDetails:{},messageDetailStates:Object.fromEntries(Object.keys(t.deferredToolPayloads).map(e=>[e,`summary`])),total:t.total,cursor:t.pageInfo.startCursor,hasPreviousPage:t.pageInfo.hasPreviousPage,error:null}))},[c])}),loadPreviousMessages:(0,H.useCallback)(async e=>{let t=o.current;if(!r||t.sessionId!==r||!t.hasPreviousPage||!t.cursor||s.current)return;let i=new AbortController;s.current=i,c(r,e=>({...e,isLoading:!0,error:null}));try{let a=await Ue(r,{limit:n,cursor:t.cursor,toolPayload:`summary`,signal:i.signal});if(i.signal.aborted||s.current!==i)return;e(a.messages),c(r,e=>({...e,contextWindow:a.contextWindow??e.contextWindow,deferredToolPayloads:{...e.deferredToolPayloads,...a.deferredToolPayloads??{}},messageDetailStates:{...Object.fromEntries(Object.keys(a.deferredToolPayloads??{}).map(e=>[e,`summary`])),...e.messageDetailStates},total:a.total,cursor:a.pageInfo.startCursor,hasPreviousPage:a.pageInfo.hasPreviousPage}))}catch(e){i.signal.aborted||c(r,t=>({...t,error:e instanceof Error?e:Error(String(e))}))}finally{s.current===i&&(s.current=null,c(r,e=>({...e,isLoading:!1})))}},[n,r,c]),loadMessageDetails:l,state:i.sessionId===r?i:W4}}var q4=`ncp agent unavailable during startup`,J4=15e3,Y4=7e4;function X4(e){return e?.trim().toLowerCase().includes(q4)??!1}function Z4(){return new j2({baseUrl:Kt,basePath:`/api/ncp/agent`,fetchImpl:L4(),streamOpenTimeoutMs:J4,streamIdleTimeoutMs:Y4})}function Q4(e,t){let n=(0,H.useRef)(null),r=(0,H.useCallback)(e=>{if(!e){n.current=null;return}n.current!==e&&(n.current=e,t())},[t]);(0,H.useEffect)(()=>{r(e)},[e,r])}function $4(e,t){return e.map(e=>{let n=t[e.id];return n?!e.metadata&&!n.metadata?n:{...n,metadata:{...e.metadata??{},...n.metadata??{}}}:e})}function e3(e,t={}){let[n]=(0,H.useState)(()=>Z4()),r=Ze(),[i,a]=(0,H.useState)(0),[o,s]=(0,H.useState)(null),c=(0,H.useRef)(null),{loadSeed:l,loadMessageDetails:u,loadPreviousMessages:d,state:f}=K4({sessionId:e,messageLimit:t.messageLimit??20,hydrationRetryVersion:i}),p=D4({sessionId:e,client:n,loadSeed:l}),{acceptRun:m}=p,h=(0,H.useCallback)(async(e,t)=>{if(c.current)throw Error(`A session command is already in progress.`);c.current=e,s(e);try{let e=await t();return await m(e),e}finally{c.current===e&&(c.current=null),s(t=>t===e?null:t)}},[m]),g=(0,H.useCallback)(async e=>await h(e.sessionId,async()=>{let t={messages:p.visibleMessages,status:p.isRunning?`running`:`idle`},n=p.visibleMessages.findIndex(t=>t.id===e.messageId);if(n<0)throw Error(`The message being edited is no longer in the current session history.`);p.replaceHistory({messages:[...p.visibleMessages.slice(0,n),{...e.message,sessionId:e.sessionId}],status:`idle`});try{return await I.agentRuns.editMessage(e)}catch(n){p.replaceHistory(t);try{let t=new AbortController;p.replaceHistory(await l(e.sessionId,t.signal))}catch{}throw n}}),[p,h,l]),_=(0,H.useCallback)(async e=>await h(e.sessionId,()=>I.agentRuns.continue(e)),[h]),v=(0,H.useCallback)(async()=>await d(p.prependHistory),[p.prependHistory,d]),y=p.hydrateError?.message??p.snapshot.error?.message??null;Q4(e&&r.phase===`ready`&&X4(y)?`${e}:${r.lastReadyAt??0}`:null,()=>{a(e=>e+1)});let b=(0,H.useMemo)(()=>$4(p.visibleMessages,f.messageDetails),[p.visibleMessages,f.messageDetails]);return(0,H.useMemo)(()=>({...p,visibleMessages:b,isSending:p.isSending||o===e,editMessage:g,continueRun:_,snapshot:{...p.snapshot,contextWindow:p.snapshot.contextWindow??f.contextWindow},hasPreviousMessages:f.hasPreviousPage,historyError:f.error,isLoadingPreviousMessages:f.isLoading,loadPreviousMessages:v,loadMessageDetails:u,messageDetailStates:f.messageDetailStates,messageTotal:f.total}),[p,_,g,u,v,o,e,f,b])}function t3(e){return e.bootstrapStatus?.ncpAgent.state!==`ready`}function n3(e){return e.activeSystemAction?.message?.trim()||(e.lifecyclePhase===`cold-starting`?b(`chatRuntimeInitializing`):e.lifecyclePhase===`startup-failed`?e.bootstrapStatus?.ncpAgent.error?.trim()||e.bootstrapStatus?.lastError?.trim()||e.lastError?.trim()||b(`chatRuntimeInitializationFailed`):null)}function r3(e){let{message:t,status:n}=e,r=t?.trim();if(!r)return n3(n);let i=n.activeSystemAction?.message?.trim();if(n.phase===`service-transitioning`&&i)return i;let a=Ve(r);return n.phase===`recovering`&&a?b(`runtimeControlRecoveringHelp`):n.phase===`stalled`&&a?null:r}function i3(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function a3(e){if(!e||e.completeInputBudget!==!0||!e.fixedInputTokens||e.totalContextTokens<=0)return null;let t=e.triggerContextTokens??e.totalContextTokens,n=e.usedContextTokens/Math.max(1,t),r=Math.max(0,Math.min(1,n)),i=`${Math.round(r*100)}%`,a=r>=.9?`danger`:r>=.75?`warning`:`neutral`,o=[{label:b(`chatContextWindowUsed`),value:i3(e.usedContextTokens)}];return e.triggerContextTokens!==void 0&&o.push({label:b(`chatContextWindowTrigger`),value:i3(e.triggerContextTokens)}),o.push(e.availableBeforeCompactionTokens===void 0?{label:b(`chatContextWindowAvailable`),value:i3(e.availableContextTokens)}:{label:b(`chatContextWindowAvailableBeforeCompaction`),value:i3(e.availableBeforeCompactionTokens)}),e.fixedInputTokens!==void 0&&o.push({label:b(`chatContextWindowFixed`),value:i3(e.fixedInputTokens),dividerBefore:!0}),e.dynamicInputTokens!==void 0&&o.push({label:b(`chatContextWindowDynamic`),value:i3(e.dynamicInputTokens)}),e.reservedContextTokens!==void 0&&o.push({label:b(`chatContextWindowReserve`),value:i3(e.reservedContextTokens)}),o.push({label:b(`chatContextWindowTotal`),value:i3(e.totalContextTokens)}),e.prunedUsedContextTokens!==e.usedContextTokens&&o.push({label:b(`chatContextWindowPruned`),value:i3(e.prunedUsedContextTokens)}),e.droppedHistoryCount>0&&o.push({label:b(`chatContextWindowDroppedHistory`),value:String(e.droppedHistoryCount)}),e.truncatedToolResultCount>0&&o.push({label:b(`chatContextWindowTruncatedTools`),value:String(e.truncatedToolResultCount)}),{label:b(`chatContextWindow`),percentLabel:i,ratio:r,tone:a,details:o}}var o3=Cr(`18rem`);function s3({agents:e,selectedAgent:t,selectedAgentId:n,onSelectAgent:r}){return(0,U.jsxs)(Dr,{value:n,onValueChange:r,children:[(0,U.jsxs)(yr,{"aria-label":b(`chatDraftAgentTitle`),className:`h-auto w-auto min-w-0 gap-1 rounded-lg border-0 bg-transparent px-2 py-1.5 text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:ring-0`,children:[(0,U.jsx)(`span`,{className:`sr-only`,children:b(`chatDraftAgentTitle`)}),(0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(az,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,U.jsx)(`span`,{className:`max-w-28 truncate text-sm font-medium`,children:t.displayName?.trim()||t.id})]}):null})]}),(0,U.jsx)(Sr,{className:`rounded-xl border-border shadow-lg`,style:{maxHeight:o3},children:e.map(e=>(0,U.jsx)(Tr,{value:e.id,className:`rounded-lg pr-10`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(az,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName?.trim()||e.id})]})},e.id))})]})}var c3=[{labelKey:`chatWelcomeSuggestion1Label`,promptKey:`chatWelcomeSuggestion1Prompt`},{labelKey:`chatWelcomeSuggestion2Label`,promptKey:`chatWelcomeSuggestion2Prompt`},{labelKey:`chatWelcomeSuggestion3Label`,promptKey:`chatWelcomeSuggestion3Prompt`}];function l3({onSelectPrompt:e}){return(0,U.jsx)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-2`,children:c3.map(t=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>e(b(t.promptKey)),className:`rounded-full bg-muted/55 px-3.5 py-2 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:b(t.labelKey)},t.labelKey))})}var u3=xF(`20rem`);function d3({isSaving:e,projectOptions:t,projectRoot:n,selectable:r,onOpenProjectDialog:i,onSelectProjectRoot:a}){let[o,s]=(0,H.useState)(!1),c=mI(n)??b(`chatWelcomeProjectPickerPlaceholder`),l=async e=>{s(!1),await a(e)};return(0,U.jsxs)(CF,{open:o,onOpenChange:s,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:n??void 0,"aria-label":b(`chatWelcomeProjectPickerLabel`),disabled:!r||e,children:[(0,U.jsx)(Wa,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:c}),(0,U.jsx)(ar,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,U.jsxs)(EF,{align:`start`,className:`flex w-[min(20rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-border bg-popover p-0 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,style:{maxHeight:u3},children:[(0,U.jsx)(`div`,{className:`shrink-0 px-3 pb-2 pt-3 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:b(`chatWelcomeProjectRecentTitle`)}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1.5 pb-1.5`,children:t.length>0?t.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-start gap-2 rounded-xl px-2 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)]`,title:e.projectRoot,onClick:()=>{l(e.isDefault?null:e.projectRoot)},children:[(0,U.jsx)(Wa,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] font-semibold text-foreground`,children:e.projectName}),e.isDefault?(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:b(`chatWelcomeProjectDefaultBadge`)}):null]}),(0,U.jsx)(`span`,{className:`block truncate text-[11px] leading-4 text-muted-foreground`,children:e.projectRoot})]}),e.sessionCount>0?(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:e.sessionCount}):null]},e.projectRoot)):(0,U.jsx)(`div`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:b(`chatWelcomeProjectNoRecent`)})}),(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border p-1.5`,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-xl px-2.5 py-2 text-left text-[13px] font-semibold text-foreground transition-colors hover:bg-[var(--interaction-hover)]`,onClick:()=>{s(!1),i()},children:[(0,U.jsx)(Wa,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{children:b(`chatWelcomeProjectOpenFolder`)})]})})]})]})}function f3(e){let{disabled:t=!1,option:n,onSelect:r,selected:i=!1}=e,a=n.ready===!1?n.reasonMessage?.trim()||b(`statusSetup`):null;return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i,disabled:t,onClick:r,className:u(`w-full rounded-2xl px-3 py-2.5 text-left transition-colors`,i?`bg-gray-50`:`hover:bg-gray-50`,t?`cursor-not-allowed opacity-70`:null),children:(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[n.icon?.src?(0,U.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:n.icon.src,alt:n.icon.alt??null,name:n.label}})}):(0,U.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-muted-foreground`,children:(0,U.jsx)(oa,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:n.label}),(0,U.jsx)(Ss,{status:n.ready===!1?`warning`:`ready`,label:n.ready===!1?b(`statusSetup`):b(`statusReady`),className:`bg-transparent px-0`})]}),a?(0,U.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:a}):null]})]}),i?(0,U.jsx)(Ar,{className:`mt-1 h-3.5 w-3.5 shrink-0 text-primary`}):null]})})}var p3=xF(`18rem`);function m3({options:e,selectedSessionType:t,onSelectSessionType:n}){let[r,i]=(0,H.useState)(!1),a=e.find(e=>e.value===t)??e[0]??null;return a?(0,U.jsxs)(CF,{open:r,onOpenChange:i,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":b(`chatWelcomeSessionTypePickerLabel`),children:[a.icon?.src?(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},className:`h-4 w-4`}):(0,U.jsx)(oa,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:a.label}),(0,U.jsx)(ar,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,U.jsx)(EF,{align:`start`,className:`flex w-[min(16rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,style:{maxHeight:p3},children:(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e.map(e=>(0,U.jsx)(f3,{option:e,onSelect:()=>{n(e.value),i(!1)}},e.value))})})]}):null}function h3({agents:e,defaultProjectRoot:t,inputSlot:n,projectOptions:r,selectedAgentId:i,selectedProjectRoot:a,selectedSessionType:o,sessionTypeOptions:s,onSelectAgent:c,onSelectPrompt:l,onSelectProjectRoot:u,onSelectSessionType:d}){let f=e.find(e=>e.id===i)??null,[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(!1),_=a??t??null,v=async e=>{if(u){g(!0);try{await u(e),m(!1)}finally{g(!1)}}},y=!!u;return(0,U.jsxs)(`div`,{className:`flex min-h-full items-center justify-center px-4 py-10 sm:p-8`,children:[(0,U.jsxs)(`div`,{className:`w-full min-w-0 max-w-[min(680px,100%)]`,children:[(0,U.jsx)(`div`,{className:`text-center`,children:(0,U.jsx)(`h2`,{className:`text-2xl font-semibold leading-tight text-foreground sm:text-[2rem]`,children:b(`chatWelcomeTitle`)})}),n?(0,U.jsx)(`div`,{className:`mt-6`,children:n}):null,(0,U.jsx)(`div`,{className:`mt-2 flex justify-center px-1`,children:(0,U.jsxs)(`div`,{role:`group`,"aria-label":b(`chatWelcomeContextLabel`),className:`flex min-w-0 max-w-full flex-wrap items-center justify-center gap-0.5 rounded-xl bg-muted/40 p-1 text-sm text-muted-foreground`,children:[u?(0,U.jsx)(d3,{isSaving:h,projectOptions:r,projectRoot:_,selectable:y,onOpenProjectDialog:()=>m(!0),onSelectProjectRoot:v}):null,(0,U.jsx)(s3,{agents:e,selectedAgent:f,selectedAgentId:i,onSelectAgent:c}),(0,U.jsx)(m3,{options:s,selectedSessionType:o,onSelectSessionType:d})]})}),(0,U.jsx)(l3,{onSelectPrompt:l})]}),u?(0,U.jsx)(qF,{open:p,currentProjectRoot:_,defaultWorkspacePath:t,isSaving:h,onOpenChange:m,onSave:v}):null]})}function g3(e){let{agents:t,fallbackAgentId:n}=e;return(t?.length??0)>0?t??[]:[{id:n}]}function _3(e){return e.agents.find(t=>t.id===e.agentId)??null}function v3(e,t){if(typeof e!=`string`||e.trim().length===0)return null;let n=EL(e);return t.some(e=>e.value===n)?n:null}function y3(e){let{agentId:t,agents:n,defaultSessionType:r,pendingSessionType:i,selectedSessionType:a,sessionTypeOptions:o}=e;return(v3(a,o)??v3(i,o))||((n&&t?v3(DL(_3({agents:n,agentId:t}),r),o):null)??v3(r,o)??o[0]?.value??EL(r))}function b3(e){return new Date(e.lastMessageAt??e.createdAt).getTime()}function x3(e){let{defaultProjectRoot:t,projects:n=[],sessionSummaries:r}=e,i=new Map;for(let e of n)e.rootPath!==t&&i.set(e.rootPath,{projectRoot:e.rootPath,projectName:e.name,sessionCount:0,isDefault:!1,latestUpdatedAt:new Date(e.updatedAt).getTime()});for(let e of qI([...r])){let n=e.projectRoot?.trim();if(!n||n===t)continue;let r=i.get(n),a=b3(e);if(r){r.sessionCount+=1,r.latestUpdatedAt=Math.max(r.latestUpdatedAt,a);continue}i.set(n,{projectRoot:n,projectName:e.projectName?.trim()||mI(n)||n,sessionCount:1,isDefault:!1,latestUpdatedAt:a})}return t&&i.set(t,{projectRoot:t,projectName:mI(t)||t,sessionCount:0,isDefault:!0,latestUpdatedAt:1/0}),[...i.values()].sort((e,t)=>t.latestUpdatedAt-e.latestUpdatedAt).map(({latestUpdatedAt:e,...t})=>t)}var S3=[];function C3({inputSlot:e,pendingProjectRoot:t,pendingSessionType:n,selectedSessionTypeValue:r,onSelectProjectRoot:i,onSelectPrompt:a,onSelectSessionType:o}){let s=eI(),c=aL(e=>e.snapshot.selectedAgentId),l=$(e=>e.snapshot),u=eR(e=>e.snapshot.configQuery?.data??null),d=eR(e=>e.snapshot.sessionsQuery?.data?.sessions??S3),f=eR(e=>e.snapshot.sessionTypesQuery?.data??null),p=oz(),m=nR(),h=l.agentId??c,g=g3({agents:p.data?.agents,fallbackAgentId:h}),_=pI(u?.agents.defaults.workspace),v=pI(t),y=kL(f?.options??[]),b=EL(f?.defaultType??`native`),x=y3({defaultSessionType:b,pendingSessionType:n,selectedSessionType:r,sessionTypeOptions:y}),S=x3({defaultProjectRoot:_,projects:m.data?.projects??[],sessionSummaries:d});return(0,U.jsx)(h3,{agents:g,defaultProjectRoot:_,inputSlot:e,projectOptions:S,selectedAgentId:h,selectedProjectRoot:v,selectedSessionType:x,sessionTypeOptions:y,onSelectAgent:e=>{s.chatSessionListManager.setSelectedAgentId(e),o(y3({agents:g,agentId:e,defaultSessionType:b,pendingSessionType:null,selectedSessionType:null,sessionTypeOptions:y}))},onSelectPrompt:a,onSelectProjectRoot:i,onSelectSessionType:o})}function w3(e){return e.modelOptions.length>0}function T3(e){return!e.isProviderStateResolved&&!w3(e)}function E3(e){return e.isProviderStateResolved&&!w3(e)}function D3(e){return!1}function O3(e){let{hasSendableDraft:t,isRuntimeBlocked:n}=e;return n||!t}function k3(e){return{...e.metadata,...e.message.metadata}}function A3(e){let t=gW(k3(e)),n=e.message.parts.flatMap(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?[e.text]:[]).join(` `);return t.reduce((e,t)=>e.split(t.rawText).join(``),n).replace(/\s+/g,` `).trim()}function j3(e){if(!e.mimeType?.startsWith(`image/`))return;let t=e.url?.trim();if(t)return t;let n=e.contentBase64?.trim();if(n)return`data:${e.mimeType};base64,${n}`;let r=e.assetUri?.trim();return r?xe(r):void 0}function M3(e){return{attachments:e.message.parts.flatMap((e,t)=>{if(e.type!==`file`)return[];let n=e.mimeType??`application/octet-stream`,r=j3(e);return[{mimeType:n,name:e.name?.trim()||`attachment-${t+1}`,...r?{previewUrl:r}:{}}]}),preview:A3(e)}}function N3(e,t){return K0({attachmentIdPrefix:`queued-attachment-${e.id}`,availableSkills:t,message:e.message,metadata:k3(e)})}function P3(e){return e instanceof nn&&e.status===404&&e.code===`NOT_FOUND`}function F3(e){let t=e.sessionId?.trim();if(!t)return null;let n={id:`submitting-${e.message.id}`,sessionId:t,enqueuedAt:new Date().toISOString(),message:{...e.message,sessionId:t},metadata:structuredClone(e.metadata??{})},r=M3(n);return{attachments:r.attachments,id:n.id,preview:r.preview,sessionId:t,userMessageId:n.message.id}}function I3(e,t){let[n,r]=(0,H.useState)(null),i=(0,H.useCallback)(e=>{let t=F3(e);return t&&r(t),t},[]);return{clearSubmittingInput:(0,H.useCallback)(e=>{r(t=>t?.userMessageId===e.userMessageId?null:t)},[]),queuedInputs:(0,H.useMemo)(()=>{let r=e.map(e=>({...M3(e),id:e.id}));return n?.sessionId===t&&!e.some(e=>e.message.id===n.userMessageId)&&r.push({attachments:n.attachments,id:n.id,isSubmitting:!0,preview:n.preview}),r},[e,t,n]),stageSubmittingInput:i}}function L3(e){let{availableSkills:t,hasComposerContent:n,restoreComposer:r,runQueue:i,setSendError:a}=e,o=(0,H.useCallback)(e=>{if(n){a(b(`chatQueuedEditComposerNotEmpty`));return}i.inputs.some(t=>t.id===e)&&i.removeQueuedInput(e).then(e=>{e&&(r(N3(e,t)),a(null))}).catch(e=>{a(e instanceof Error?e.message:String(e))})},[t,n,r,i,a]);return{deleteQueuedInput:(0,H.useCallback)(e=>{i.removeQueuedInput(e).then(()=>a(null)).catch(e=>{a(e instanceof Error?e.message:String(e))})},[i,a]),editQueuedInput:o,steerQueuedInput:(0,H.useCallback)(e=>{i.steerQueuedInput(e).then(e=>{e&&a(null)}).catch(async e=>{if(P3(e))try{await i.refreshPendingInputs(),a(null);return}catch(e){a(e instanceof Error?e.message:String(e));return}a(e instanceof Error?e.message:String(e))})},[i,a])}}function R3({agent:e,sessionKey:t,setSendError:n}){return{continueRun:(0,H.useCallback)(async()=>{if(!(!t||e.isSending||e.isRunning)){n(null);try{await e.continueRun({sessionId:t})}catch(e){throw n(e instanceof Error?e.message:String(e)),e}}},[e,t,n]),editMessage:(0,H.useCallback)(async r=>{if(!(!t||e.isSending||e.isRunning)){n(null);try{await e.editMessage({message:r.message,messageId:r.messageId,sessionId:t})}catch(e){throw n(e instanceof Error?e.message:String(e)),e}}},[e,t,n])}}var z3=e=>e.some(e=>e.type!==`text`||e.text.trim().length>0),B3=e=>e?.trim()||void 0;function V3(e){return{isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeState.sessionTypeUnavailable}}function H3(e){let{agentIsSending:t,composerSnapshot:n,inputQuery:r,inputSnapshot:i,isRuntimeBlocked:a,materializationContext:o,selectedAgentId:s,sessionKey:c}=e,l=n??{text:i.text,nodes:[...i.nodes],selectedSkills:[...i.selectedSkills],skillRecords:[...i.skillRecords],attachments:[...i.attachments]},u=L0([...l.nodes],l.attachments);return O3({snapshot:V3(r),hasSendableDraft:z3(u),isRuntimeBlocked:a})||t?null:{composerSnapshot:l,metadata:B0({agentId:o?void 0:r.selectedSession?.agentId?.trim()||s,model:B3(o?i.selectedModel:i.selectedModel??r.fallbackPreferredModel??r.defaultModel),thinkingLevel:o?i.selectedThinkingLevel??void 0:i.selectedThinkingLevel??r.fallbackPreferredThinking??void 0,sessionType:o?void 0:r.sessionTypeState.selectedSessionType,projectRoot:o?i.pendingProjectRoot:c?r.selectedSession?.projectRoot??null:i.pendingProjectRoot,requestedSkills:[...l.selectedSkills],skillRecords:r.skillRecords.filter(e=>l.selectedSkills.includes(e.ref)),composerNodes:[...l.nodes],sessionMaterialization:o?{kind:o.kind,parentSessionId:o.parentSessionKey,inheritContext:o.inheritContext}:null})}}function U3(e,t,n=`queue`){let r=M4({sessionId:t??void 0,text:e.composerSnapshot.text.trim(),attachments:[...e.composerSnapshot.attachments],parts:L0([...e.composerSnapshot.nodes],e.composerSnapshot.attachments),metadata:e.metadata});return r?{...r,delivery:n}:null}function W3(e){let{agent:t,clearSubmittingInput:n,materializationContext:r,onSessionMaterialized:i,resetComposer:a,restoreComposer:o,runQueue:s,sessionKey:c,setSendError:l,stageSubmittingInput:u}=e;return(0,H.useCallback)(async(e,d,f=`queue`)=>{let p=U3(e,c??(r?null:JI()),f);if(!p)return;let m=t.isRunning&&f===`queue`?u(p):null;d===`reset-and-restore`&&a(),l(null);try{let e=await t.send(p);e?.delivery===`steered`?await s.refreshPendingInputs().catch(()=>void 0):e?.delivery===`queued`&&await s.refreshQueuedInputs().catch(()=>void 0),m&&n(m);let r=e?.sessionId?.trim()||t.snapshot.activeRun?.sessionId?.trim()||null;!c&&r&&i?.(r)}catch(t){throw m&&n(m),d===`reset-and-restore`&&o(e.composerSnapshot),l(t instanceof Error?t.message:String(t)),t}},[t,n,r,i,a,o,s,c,l,u])}function G3(e){let{agent:t,inputQuery:n,inputSnapshot:r,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:o,sessionKey:s,submitDraft:c}=e;return(0,H.useCallback)(async()=>{let e=H3({agentIsSending:t.isSending,inputSnapshot:r,inputQuery:n,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:o,sessionKey:s});e&&await c(e,`reset-and-restore`,`prefer-steer`)},[t.isSending,n,r,i,a,o,s,c])}function K3(e){let{agent:t,continueRun:n,inputQuery:r,inputSnapshot:i,isRuntimeBlocked:a,materializationContext:o,primaryAction:s,selectedAgentId:c,sessionKey:l,submitDraft:u}=e;return(0,H.useCallback)(async()=>{if(s===`continue`)return await n();let e=H3({agentIsSending:t.isSending,inputSnapshot:i,inputQuery:r,isRuntimeBlocked:a,materializationContext:o,selectedAgentId:c,sessionKey:l});e&&await u(e,`reset-and-restore`)},[t.isSending,n,r,i,a,o,s,c,l,u])}function q3(e){let{agent:t,inputSnapshot:n,inputQuery:r,isRuntimeBlocked:i,materializationContext:a,runQueue:o,selectedAgentId:s,sessionKey:c,onSessionMaterialized:l,resetComposer:u,restoreComposer:d,setSendError:f}=e,{clearSubmittingInput:p,queuedInputs:m,stageSubmittingInput:h}=I3(o.inputs,c),g=z3((0,H.useMemo)(()=>L0([...n.nodes],n.attachments),[n.attachments,n.nodes])),{deleteQueuedInput:_,editQueuedInput:v,steerQueuedInput:y}=L3({availableSkills:r.skillRecords,hasComposerContent:g,restoreComposer:d,runQueue:o,setSendError:f}),b=t.isSending||t.isRunning,x=r.selectedSession?.activityPreview?.state,S=!!(c&&!b&&!i&&(x===`cancelled`||x===`failed`)),C=S&&!g?`continue`:`send`,w=C===`continue`?!1:O3({snapshot:V3(r),hasSendableDraft:g,isRuntimeBlocked:i})||t.isSending,{continueRun:T,editMessage:E}=R3({agent:t,sessionKey:c,setSendError:f}),D=W3({agent:t,clearSubmittingInput:p,materializationContext:a,onSessionMaterialized:l,resetComposer:u,restoreComposer:d,runQueue:o,sessionKey:c,setSendError:f,stageSubmittingInput:h}),O=K3({agent:t,continueRun:T,inputQuery:r,inputSnapshot:n,isRuntimeBlocked:i,materializationContext:a,primaryAction:C,selectedAgentId:s,sessionKey:c,submitDraft:D}),k=G3({agent:t,inputQuery:r,inputSnapshot:n,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:s,sessionKey:c,submitDraft:D}),A=(0,H.useCallback)(async e=>{let o=e.trim();if(!o)return;let l=H3({agentIsSending:t.isSending,composerSnapshot:{text:o,nodes:j0(o),selectedSkills:[],skillRecords:[],attachments:[]},inputSnapshot:n,inputQuery:r,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:s,sessionKey:c});l&&await D(l,`preserve`)},[t.isSending,r,n,i,a,s,c,D]),j=(0,H.useCallback)(async()=>{await t.abort()},[t]);return{canContinue:S,canStopGeneration:t.isRunning,continueRun:T,deleteQueuedInput:_,editMessage:E,editQueuedInput:v,canEditQueuedInput:!g,hasSendableDraft:g,isSending:b,queuedInputs:m,send:O,sendSteering:k,sendPresetMessage:A,sendDisabled:w,primaryAction:C,stop:j,stopDisabled:!t.isRunning,steerQueuedInput:y}}var J3=[`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`],Y3=new Set(J3);function X3(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Z3(e,t){let n=e.trim(),r=t.trim();if(!n||!r)return n;let i=`${r}/`;return n.startsWith(i)?n.slice(i.length):n}function Q3(e,t){let n=e.trim();if(!n)return``;for(let e of t)n=Z3(n,e);return n.trim()}function $3(e,t){let n=t.trim(),r=e.trim();return n?r?`${r}/${n}`:n:``}function e6(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t&&Y3.has(t)?t:null}function t6(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=e6(n);!e||t.includes(e)||t.push(e)}return t}function n6(e){return e.includes(`off`)?[...e]:[`off`,...e]}function r6(e,t){if(!e)return{};let n={};for(let[r,i]of Object.entries(e)){let e=Q3(r,t);if(!e)continue;let a={},o=t6(i?.thinking?.supported);if(o.length>0){let e=e6(i?.thinking?.default);a.thinking=e&&o.includes(e)?{supported:o,default:e}:{supported:o}}i?.vision===!0&&(a.vision=!0),(a.thinking||a.vision===!0)&&(n[e]=a)}return n}function i6(e){return Object.fromEntries(Object.entries(e).filter(e=>!!e[1].thinking).map(([e,t])=>[e,t.thinking]))}function a6(e,t,n){let r=Q3(t,n);return r?e[r]??null:null}function o6(e,t){let n=e.trim();if(!n)return null;let r=null;for(let e of t)for(let t of e.aliases){let i=t.trim();i&&(n===i||n.startsWith(`${i}/`))&&(!r||i.length>r.score)&&(r={name:e.name,score:i.length})}if(r)return r.name;for(let e of t){let t=Q3(n,e.aliases);if(t&&X3(e.models??[]).some(e=>e===t))return e.name}return null}function s6(e){return e?e.enabled!==!1&&(e.apiKeyRequired===!1||e.apiKeySet===!0):!1}function c6(e){let{providersView:t,templatesView:n,config:r,onlyConfigured:i=!1}=e,a=new Map((n?.providerTemplates??[]).map(e=>[e.providerType,e])),o=Object.values(t?.providers??r?.providers??{}).map(e=>{let{providerId:t}=e,n=e.providerType?a.get(e.providerType):void 0,r=t.trim(),i=X3([t,n?.modelPrefix||``,n?.providerType||``]),o=X3((e?.models??[]).map(e=>Q3(e,i))),s={...r6(n?.modelConfig,i),...r6(e?.modelConfig,i)},c=i6(s),l=e?.displayName?.trim(),u=s6(e);return{name:t,displayName:l||n?.displayName||t,prefix:r,aliases:i,models:o,modelConfig:s,modelThinking:c,configured:u}});return i?o.filter(e=>e.configured&&e.models.length>0):o}function l6(e,t){return{value:D,modelLabel:e,providerLabel:``,isRuntimeDefault:!0,thinkingCapability:t??null}}function u6(e){let t=new Set;return c6({providersView:e.providersView??void 0,templatesView:e.templatesView??void 0,config:e.config??void 0,onlyConfigured:!0}).flatMap(e=>e.models.map(n=>{let r=$3(e.prefix,n);return!r||t.has(r)?null:(t.add(r),{value:r,modelLabel:n,providerLabel:e.displayName,thinkingCapability:a6(e.modelThinking,n,e.aliases)})})).filter(e=>e!==null).sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})}function d6(e){let{catalogView:t,config:n,providersView:r,templatesView:i}=e,a=t?.providers??{},o=new Set;return c6({providersView:r??void 0,templatesView:i??void 0,config:n??void 0}).flatMap(e=>{if(!e.configured)return[];let t=new Set(e.models);return(a[e.name]?.models??[]).map(n=>{let r=Q3(n,e.aliases),i=$3(e.prefix,r);return!r||!i||t.has(r)||o.has(i)?null:(o.add(i),{value:i,providerId:e.name,providerModel:r,modelLabel:r,providerLabel:e.displayName,thinkingCapability:a6(e.modelThinking,r,e.aliases)})}).filter(e=>e!==null)})}function f6(e){let{modelOptions:t,modelSelectionMode:n,supportedModels:r}=e;if(n===`runtime-default`)return[];if(!r||r.length===0)return t;let i=new Set(r);return t.filter(e=>i.has(e.value))}function p6(e){let{modelOptions:t,modelSelectionMode:n,runtimeDefaultThinkingCapability:r,runtimeDefaultModelLabel:i=`Runtime default`,supportedModels:a}=e,o=l6(i,r);if(n===`runtime-default`)return[o];if(!a||a.length===0)return n===`optional`?[o,...t]:t;let s=new Set(a),c=t.filter(e=>s.has(e.value)),l=c.length>0?c:t;return n===`optional`?[o,...l]:l}function m6(e){return e?.trim().toLowerCase()||`native`}function h6(e,t){if(typeof t!=`string`)return!1;let n=t.trim();return n?e.some(e=>e.value===n):!1}function g6(e,t){return typeof t==`string`&&e.includes(t)}function _6(e){return e.length===0?null:e.includes(`off`)?`off`:e[0]??null}function v6(e){let{currentValue:t,selectedSessionPreferredValue:n,fallbackPreferredValue:r,defaultValue:i,isValueSupported:a,firstAvailableValue:o,preferSessionPreferredValue:s=!1,preserveCurrentValueOnSessionChange:c=!1}=e;return a(t)&&(!s||c)?t:a(n)?n:a(r)?r:a(i)?i:o}function y6(e){let{modelOptions:t,currentSelectedModel:n,selectedSessionPreferredModel:r,fallbackPreferredModel:i,defaultModel:a,preferSessionPreferredModel:o,preserveCurrentSelectedModelOnSessionChange:s}=e;return t.length===0?``:v6({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>h6(t,e),firstAvailableValue:t[0]?.value??``,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function b6(e){let{supportedThinkingLevels:t,currentSelectedThinkingLevel:n,selectedSessionPreferredThinking:r,fallbackPreferredThinking:i,defaultThinkingLevel:a,preferSessionPreferredThinking:o,preserveCurrentSelectedThinkingOnSessionChange:s}=e;if(t.length===0)return null;let c=n6(t);return v6({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>g6(c,e),firstAvailableValue:_6(c)??`off`,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function x6(e){let{sessions:t,selectedSessionKey:n,sessionType:r,readPreference:i}=e,a=m6(r),o,s=-1/0;for(let e of t){if(e.key===n||m6(e.sessionType)!==a)continue;let t=i(e);if(t==null)continue;let r=Date.parse(e.updatedAt),c=Number.isFinite(r)?r:-1/0;(o===void 0||c>s)&&(o=t,s=c)}return o}function S6(e){let{selectedSession:t,pendingSessionType:n,setPendingSessionType:r,sessionTypesData:i}=e,a=(0,H.useMemo)(()=>kL(i?.options??[]),[i?.options]),o=(0,H.useMemo)(()=>{let e=[...a],n=EL(t?.sessionType);return e.some(e=>e.value===n)||e.push({value:n,label:OL(n),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,modelSelectionMode:`nextclaw`,runtimeDefaultThinking:null,cta:null}),e.sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))},[a,t?.sessionType]),s=(0,H.useMemo)(()=>EL(i?.defaultType??`native`),[i?.defaultType]),c=(0,H.useRef)(null),l=typeof n==`string`&&n.trim().length>0?n:void 0,u=(0,H.useMemo)(()=>EL(t?.sessionType??l??s),[s,l,t?.sessionType]),d=(0,H.useMemo)(()=>o.find(e=>e.value===u)??null,[u,o]);(0,H.useEffect)(()=>{if(t)return;let e=typeof n==`string`?n.trim():``,i=EL(n);(e.length===0||c.current===i||c.current===null&&i===`native`)&&(c.current=s,i!==s&&r(s))},[s,n,t,r]);let f=!t||!!t.sessionTypeMutable,p=(0,H.useMemo)(()=>new Set(a.map(e=>e.value)),[a]),m=(0,H.useMemo)(()=>t&&!p.has(EL(t.sessionType))?!0:d?.ready===!1,[p,t,d?.ready]),h=(0,H.useMemo)(()=>t&&!p.has(EL(t.sessionType))?`${OL(u)} ${b(`chatSessionTypeUnavailableSuffix`)}`:d?.ready===!1?d.reasonMessage?.trim()||`${d.label} setup required`:null,[p,t,u,d]);return(0,H.useMemo)(()=>({sessionTypeOptions:o,selectedSessionTypeOption:d,defaultSessionType:s,selectedSessionType:u,canEditSessionType:f,sessionTypeUnavailable:m,sessionTypeUnavailableMessage:h}),[f,s,u,d,o,m,h])}var C6=`nextclaw.chat.recent-selection.store`;function w6(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function T6(e,t){return Array.isArray(e)?Array.from(new Set(e.map(w6).filter(e=>!!e))).slice(0,t):[]}function E6(e,t){let n=w6(t?.namespace);return n?`${e.storageKey}.${encodeURIComponent(n.toLowerCase())}`:e.storageKey}function D6(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){let e=w6(n);if(!e)continue;let i=T6(r,1/0);i.length>0&&(t[e]=i)}return t}var O6=P()(ji(e=>({entriesByKey:{},setEntries:(t,n)=>e(e=>({entriesByKey:{...e.entriesByKey,[t]:T6(n,1/0)}}))}),{name:C6,storage:Mi(()=>window.localStorage),partialize:e=>({entriesByKey:e.entriesByKey}),merge:(e,t)=>({...t,entriesByKey:D6(e?.entriesByKey)})})),k6=class{constructor(e){this.options=e,this.read=(e={})=>{let t=E6(this.options,e);return T6(O6.getState().entriesByKey[t],this.options.limit)},this.remember=(e,t={})=>{let n=w6(e);if(!n)return this.read(t);let r=E6(this.options,t),i=[n,...this.read(t).filter(e=>e!==n)].slice(0,this.options.limit);return O6.getState().setEntries(r,i),i},this.resolveVisible=e=>{let t=T6(e.availableValues,1/0);if(t.length<=e.minAvailableCount)return[];let n=new Set(t),r=[],i=Math.max(1,e.limit??this.options.limit);for(let t of this.read(e))if(!(!n.has(t)||r.includes(t))&&(r.push(t),r.length>=i))break;return r}}},A6=new k6({storageKey:`nextclaw.chat.recent-models`,limit:3});function j6(){return Sn({queryKey:[`config`],queryFn:tee,staleTime:3e4,refetchOnWindowFocus:!0})}function M6(){return Sn({queryKey:[`config-meta`],queryFn:Vt,staleTime:1/0})}function N6(){return Sn({queryKey:[`product-analytics-status`],queryFn:$t,staleTime:15e3,refetchOnWindowFocus:!0})}function P6(){return Sn({queryKey:[`providers`],queryFn:kt,staleTime:3e4,refetchOnWindowFocus:!0})}function F6(){return Sn({queryKey:[`provider-templates`],queryFn:Mt,staleTime:1/0})}function I6(e={}){return Sn({queryKey:[`provider-model-catalog`],queryFn:Wt,staleTime:3e4,refetchInterval:t=>e.pollWhileRefreshing&&t.state.data?.refreshing?1e3:!1,refetchOnMount:e.refreshOnMount?`always`:!0,refetchOnWindowFocus:!0})}function L6(){return Sn({queryKey:[`config-schema`],queryFn:fn,staleTime:1/0})}function R6(){let e=F();return z({mutationFn:_n,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),L.success(b(`configSaved`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function z6(){let e=F();return z({mutationFn:({data:e})=>at(e),onSuccess:t=>{e.setQueryData([`config`],e=>e&&{...e,productAnalytics:t}),e.invalidateQueries({queryKey:[`product-analytics-status`]}),L.success(b(`configSavedApplied`))},onError:e=>{L.error(`${b(`configSaveFailed`)}: ${e.message}`)}})}function B6(){let e=F();return z({mutationFn:({data:e})=>Ke(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),L.success(b(`configSavedApplied`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function V6(){let e=F();return z({mutationFn:({provider:e,data:t})=>je(e,t),onSuccess:(t,n)=>{e.setQueryData([`providers`],e=>e&&{providers:{...e.providers,[n.provider]:t}}),e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),n.silentSuccess||L.success(b(`configSaved`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function H6(){let e=F();return z({mutationFn:({data:e})=>qt(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),L.success(b(`configSaved`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function U6(){let e=F();return z({mutationFn:({provider:e})=>Pt(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),L.success(b(`configSaved`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function W6(){return z({mutationFn:({provider:e,data:t})=>nt(e,t)})}function G6(){return z({mutationFn:({provider:e,data:t})=>_t(e,t)})}function K6(){return z({mutationFn:({provider:e,data:t})=>bn(e,t)})}function q6(){return z({mutationFn:({provider:e,data:t})=>mn(e,t)})}function J6(){return z({mutationFn:({provider:e})=>mt(e)})}function Y6(){let e=F();return z({mutationFn:({channel:e,data:t})=>Te(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),L.success(b(`configSavedApplying`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function X6(){let e=F();return z({mutationFn:({data:e})=>Oe(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),L.success(b(`configSavedApplied`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function Z6(){let e=F();return z({mutationFn:({data:e})=>Rt(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),L.success(b(`configSavedApplied`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}})}function Q6(){return z({mutationFn:({actionId:e,data:t})=>Xt(e,t),onError:e=>{L.error(b(`error`)+`: `+e.message)}})}var $6=`nextclaw.chat.provider-model-catalog-notices`,e8=1,t8={version:e8,acknowledgedModelsByProvider:{}};function n8(){return typeof window>`u`?null:window.localStorage}function r8(e){let t=new Map;for(let n of e){let e=t.get(n.providerId)??[];e.includes(n.value)||(e.push(n.value),t.set(n.providerId,e))}return t}var i8=new class{constructor(){this.read=()=>{let e=n8();if(!e)return t8;try{let t=JSON.parse(e.getItem($6)??`null`);return t?.version===e8&&t.acknowledgedModelsByProvider?{version:e8,acknowledgedModelsByProvider:t.acknowledgedModelsByProvider}:t8}catch{return t8}},this.write=e=>{let t=n8();if(!t)return!1;try{return t.setItem($6,JSON.stringify(e)),!0}catch{return!1}},this.initializeLargeCatalogs=e=>{let t={...this.read().acknowledgedModelsByProvider},n=!1;for(let[r,i]of r8(e))i.length>50&&!Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=i,n=!0);return n&&this.write({version:e8,acknowledgedModelsByProvider:t})},this.filterUnseen=e=>{let t=this.read().acknowledgedModelsByProvider,n=r8(e);return e.filter(e=>{let r=t[e.providerId];return r?!r.includes(e.value):(n.get(e.providerId)?.length??0)<=50})},this.acknowledge=e=>{if(e.length===0)return!1;let t={...this.read().acknowledgedModelsByProvider},n=!1;for(let[r,i]of r8(e)){let e=t[r]??[],a=new Set(e),o=[...e];for(let e of i)a.has(e)||(a.add(e),o.push(e),n=!0);t[r]=o}return n&&this.write({version:e8,acknowledgedModelsByProvider:t})}}},a8=`__nextclaw-preview__`,o8=[{providerId:`opencode`,providerLabel:`OpenCode Zen Free Trial`,models:[`deepseek-v4-flash-free`,`laguna-s-2.1-free`,`longcat-2.0-free`,`mimo-v2.5-free`,`nemotron-3-ultra-free`,`north-mini-code-free`,`trinity-large-preview-free`]},{providerId:`openrouter`,providerLabel:`OpenRouter`,models:[`inclusionai/ling-3.0-tiny:free`,`qwen/qwen3-coder:free`,`deepseek/deepseek-r1:free`,`mistralai/mistral-small:free`,`google/gemma-3-27b-it:free`]},{providerId:`kimi`,providerLabel:`Kimi`,models:[`kimi-k2.5-preview`,`kimi-dev-72b`,`moonshot-v1-128k-preview`]}];function s8(e){return!e.enabled||new URLSearchParams(e.search).get(`preview`)!==`model-discovery`?[]:o8.flatMap(e=>e.models.map(t=>({value:`${a8}${e.providerId}/${t}`,providerId:`${a8}${e.providerId}`,providerModel:t,modelLabel:t,providerLabel:e.providerLabel,thinkingCapability:null})))}function c8(e){return e.providerId.startsWith(a8)}function l8(e){let{config:t,modelSelectionMode:n,providersView:r,supportedModels:i,templatesView:a}=e,o=I6(),{mutateAsync:s}=V6(),[c,l]=(0,H.useState)(0),[u,d]=(0,H.useState)(!1),f=(0,H.useMemo)(()=>s8({enabled:!1,search:typeof window>`u`?``:window.location.search}),[]),p=(0,H.useMemo)(()=>d6({catalogView:o.data??null,config:t,providersView:r,templatesView:a}),[o.data,t,r,a]);(0,H.useEffect)(()=>{i8.initializeLargeCatalogs(p)},[p]);let m=(0,H.useMemo)(()=>f.length>0&&!u?f:f6({modelOptions:i8.filterUnseen(p),modelSelectionMode:n,supportedModels:i}),[p,n,c,u,f,i]);return{addDiscoveredModel:(0,H.useCallback)(async e=>{let t=m.find(t=>t.value===e);if(t&&c8(t))return t;let n=t?r?.providers[t.providerId]:void 0;return!t||!n?null:(await s({provider:t.providerId,data:{models:X3([...n.models??[],t.providerModel])},silentSuccess:!0}),i8.acknowledge([t]),l(e=>e+1),t)},[m,r,s]),dismissDiscoveredModels:(0,H.useCallback)(()=>{if(m.some(c8)){d(!0);return}i8.acknowledge(m)&&l(e=>e+1)},[m]),discoveredModelOptions:m,refreshProviderModelCatalog:o.refetch}}var u8=[],d8=[];function f8(e){let{sessionKey:t,inputSnapshot:n,setPendingSessionType:r}=e,i=t??null,a=vR(),o=eR(e=>e.snapshot),s=o.configQuery?.data??null,c=o.providersQuery?.data??null,l=o.providerTemplatesQuery?.data??null,u=o.sessionsQuery?.data?.sessions??d8,d=lL({sessionId:i?.trim()||`draft-session`,projectRoot:pI(n.pendingProjectRoot)}),f=d.data?.records??u8,p=!!(d.isLoading||d.isFetching),m=(0,H.useMemo)(()=>qI(u),[u]),h=(0,H.useMemo)(()=>m.find(e=>e.key===i)??null,[i,m]),g=S6({selectedSession:h,pendingSessionType:n.pendingSessionType,setPendingSessionType:r,sessionTypesData:o.sessionTypesQuery?.data??null}),_=(0,H.useMemo)(()=>u6({config:s,providersView:c,templatesView:l}),[s,c,l]),v=(0,H.useMemo)(()=>p6({modelOptions:_,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,runtimeDefaultThinkingCapability:g.selectedSessionTypeOption?.runtimeDefaultThinking??null,runtimeDefaultModelLabel:b(`chatRuntimeDefaultModel`),supportedModels:g.selectedSessionTypeOption?.supportedModels}),[_,g.selectedSessionTypeOption?.modelSelectionMode,g.selectedSessionTypeOption?.runtimeDefaultThinking,g.selectedSessionTypeOption?.supportedModels]),{addDiscoveredModel:y,dismissDiscoveredModels:x,discoveredModelOptions:S,refreshProviderModelCatalog:C}=l8({config:s,providersView:c,templatesView:l,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,supportedModels:g.selectedSessionTypeOption?.supportedModels}),w=(0,H.useMemo)(()=>new Set(v.map(e=>e.value)),[v]),T=A6.read({namespace:g.selectedSessionType}).find(e=>w.has(e)),E=(0,H.useMemo)(()=>T??x6({sessions:m,selectedSessionKey:i,sessionType:g.selectedSessionType,readPreference:e=>e.preferredModel?.trim()||void 0}),[T,i,g.selectedSessionType,m]),D=(0,H.useMemo)(()=>x6({sessions:m,selectedSessionKey:i,sessionType:g.selectedSessionType,readPreference:e=>e.preferredThinking??void 0}),[i,g.selectedSessionType,m]),O=pI(s?.agents.defaults.workspace);return(0,H.useMemo)(()=>({addDiscoveredModel:y,defaultModel:g.selectedSessionTypeOption?.recommendedModel??s?.agents.defaults.model,defaultProjectRoot:O,dismissDiscoveredModels:x,discoveredModelOptions:S,fallbackPreferredModel:E,fallbackPreferredThinking:D,isProviderStateResolved:a,isSkillsLoading:p,modelOptions:v,providersView:c,refreshProviderModelCatalog:C,selectedSession:h,selectedSessionKey:i,sessionTypeState:g,skillRecords:f}),[s?.agents.defaults.model,O,E,D,a,p,v,y,x,S,C,c,h,i,g,f])}var p8=`new-session`,m8=`nextclaw.chat.composer-drafts`,h8=1;function g8(e){let t=e?.trim();return t?`session:${t}`:p8}var _8=P()(ji(e=>({drafts:{},ensureDraft:(t,n)=>{e(e=>e.drafts[t]?e:{drafts:{...e.drafts,[t]:n}})},updateDraft:(t,n,r)=>{e(e=>({drafts:{...e.drafts,[t]:r(e.drafts[t]??n)}}))}}),{name:m8,version:h8,storage:Mi(()=>window.localStorage),partialize:e=>({drafts:Object.fromEntries(Object.entries(e.drafts).map(([e,t])=>[e,{...t,composerFocusRequestId:0,sendError:null}]))})})),v8=({preferenceOwnerKey:e,selectedModel:t,selectedThinkingLevel:n,updatePreferences:r})=>{let i=(0,H.useRef)(void 0),a=(0,H.useRef)(null),o=(0,H.useCallback)(t=>{a.current={ownerKey:e,value:t},r({selectedThinkingLevel:t})},[e,r]),s=(0,H.useCallback)(({defaultModel:o,fallbackPreferredModel:s,fallbackPreferredThinking:c,modelOptions:l,selectedSessionExists:u,selectedSessionKey:d,selectedSessionType:f,selectedSessionPreferredModel:p,selectedSessionPreferredThinking:m})=>{let h=d??null,g=JSON.stringify([f,h]),_=i.current!==g,v=_&&!!h&&!u,y=a.current,b=y?.ownerKey===e&&u&&m===y.value;b&&(a.current=null);let x=y?.ownerKey===e&&!b,S=y6({currentSelectedModel:t??void 0,modelOptions:l,selectedSessionPreferredModel:p,fallbackPreferredModel:s,defaultModel:o,preferSessionPreferredModel:_,preserveCurrentSelectedModelOnSessionChange:v}),C=l.find(e=>e.value===S),w=b6({currentSelectedThinkingLevel:n,supportedThinkingLevels:C?.thinkingCapability?.supported??[],selectedSessionPreferredThinking:m,fallbackPreferredThinking:c,defaultThinkingLevel:C?.thinkingCapability?.default??null,preferSessionPreferredThinking:_,preserveCurrentSelectedThinkingOnSessionChange:v||x});(t!==S||n!==w)&&r({selectedModel:S,selectedThinkingLevel:w}),(!h||u)&&(i.current=g)},[t,n,e,r]);return(0,H.useMemo)(()=>({setSelectedThinkingLevel:o,syncSessionPreferences:s}),[o,s])},y8={text:``,nodes:[],selectedSkills:[],skillRecords:[]},b8=e=>{let t=e?.trim()??``;return{...t?{...y8,text:t,nodes:j0(t)}:y8,attachments:[],selectedModel:void 0,selectedThinkingLevel:null,pendingSessionType:TL,selectedSessionType:TL,composerFocusRequestId:t?1:0,sendError:null}},x8=e=>e?.trim()||TL,S8=e=>[e.assetUri??``,e.url??``,e.name,e.mimeType,String(e.sizeBytes),e.contentBase64??``].join(`:`),C8=(e,t)=>{let n=new Set(e.map(S8)),r=[...e];return t.forEach(e=>{let t=S8(e);n.has(t)||(n.add(t),r.push(e))}),r};function w8(e){let{attachments:t,update:n}=e,r=(0,H.useCallback)(e=>{n({attachments:e})},[n]);return{addAttachments:(0,H.useCallback)(e=>{if(e.length===0)return[];let r=new Set(t.map(S8)),i=C8(t,e),a=i.filter(e=>!r.has(S8(e)));return a.length>0&&n({attachments:i}),a},[t,n]),removeAttachment:(0,H.useCallback)(e=>{n(t=>({attachments:t.attachments.filter(t=>t.id!==e)}))},[n]),setAttachments:r}}function T8(e,t){let n=g8(t),r=(0,H.useMemo)(()=>b8(e),[e]),i=_8(e=>e.drafts[n]??r);return(0,H.useEffect)(()=>{_8.getState().ensureDraft(n,r)},[n,r]),{draftKey:n,snapshot:i,update:(0,H.useCallback)(e=>{_8.getState().updateDraft(n,r,t=>{let n=typeof e==`function`?e({...t,pendingProjectRoot:$.getState().snapshot.draftProjectRoot}):e;return{...t,...n}})},[n,r])}}var E8=(e,t=null)=>{let n=$(e=>e.snapshot.draftProjectRoot),{draftKey:r,snapshot:i,update:a}=T8(e,t),o=(0,H.useCallback)(e=>{a({text:e.text,nodes:e.nodes,selectedSkills:e.selectedSkills,skillRecords:e.skillRecords,sendError:null})},[a]),s=(0,H.useCallback)(()=>{a({...y8,attachments:[],sendError:null})},[a]),c=(0,H.useCallback)(e=>{a({...e})},[a]),l=(0,H.useCallback)(e=>{a({text:e,nodes:j0(e),selectedSkills:[],skillRecords:[],sendError:null,composerFocusRequestId:Date.now()})},[a]),u=(0,H.useCallback)(()=>{a(e=>({composerFocusRequestId:e.composerFocusRequestId+1}))},[a]),d=(0,H.useCallback)(()=>{a({composerFocusRequestId:0})},[a]),{addAttachments:f,removeAttachment:p,setAttachments:m}=w8({attachments:i.attachments,update:a}),h=v8({preferenceOwnerKey:r,selectedModel:i.selectedModel,selectedThinkingLevel:i.selectedThinkingLevel,updatePreferences:a}),g=(0,H.useCallback)(e=>{a(t=>{let n=x8(typeof e==`function`?e(t.pendingSessionType):e);return{pendingSessionType:n,selectedSessionType:n}})},[a]),_=(0,H.useCallback)(e=>{$.getState().setSnapshot({draftProjectRoot:e})},[]),v=(0,H.useCallback)((e,t)=>{a({selectedSkills:e,skillRecords:t,sendError:null})},[a]),y=(0,H.useCallback)(e=>{a({sendError:e})},[a]),b=(0,H.useMemo)(()=>({update:a,syncComposer:o,resetComposer:s,restoreComposer:c,applyPromptSuggestion:l,requestComposerFocusAtEnd:u,consumeComposerFocusRequest:d,setAttachments:m,addAttachments:f,removeAttachment:p,...h,setPendingSessionType:g,setPendingProjectRoot:_,setSelectedSkills:v,setSendError:y}),[a,o,s,c,l,u,d,m,f,p,h,g,_,v,y]);return{inputSnapshot:{...i,pendingProjectRoot:n},inputActions:b}},D8=`ncp-session-run-queue`;function O8(e){let t=F(),n=e?.trim()||null,{data:r,isLoading:i,refetch:a}=Sn({queryKey:[D8,n],queryFn:()=>I.sessions.listPendingInputs(n),enabled:!!n,retry:!1,staleTime:5e3});(0,H.useEffect)(()=>{if(n)return I.eventBus.on(c.sessionRunQueueUpdated,async({sessionKey:e})=>{if(e!==n)return;let r=[D8,n];await t.cancelQueries({queryKey:r,exact:!0}),await t.invalidateQueries({queryKey:r,exact:!0})})},[n,t]);let o=(0,H.useCallback)(async e=>n?await I.sessions.deleteQueuedInput(n,e):null,[n]),s=(0,H.useCallback)(async()=>n?(await a()).data?.inputs??[]:[],[n,a]),l=(0,H.useCallback)(async()=>(await s()).filter(({placement:e})=>e===`queued`),[s]),u=(0,H.useCallback)(async e=>n?await I.sessions.steerQueuedInput(n,e):null,[n]),d=r?.inputs??[];return{inputs:d.filter(({placement:e})=>e===`queued`),pendingInputs:d,isLoading:i,refreshPendingInputs:s,refreshQueuedInputs:l,removeQueuedInput:o,steerQueuedInput:u}}function k8(){return(0,H.useEffect)(()=>oc.attach(),[]),{isMobile:ac(e=>e.mode)===`mobile`}}var A8={exactId:1200,exactLabel:1150,prefixId:1e3,prefixLabel:950,prefixToken:900,containsId:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function j8(e){return(e??``).trim().toLowerCase()}function M8(e,t){if(!e||!t)return!1;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n>=e.length))return!0;return!1}function N8(e,t){let n=j8(t);if(!n)return A8.fallback;let r=j8(e.id),i=j8(e.label||e.id),a=j8(e.description),o=(e.aliases??[]).map(j8).filter(Boolean),s=i.split(/[\s/_-]+/).filter(Boolean),c=[r,...o];return c.some(e=>e===n)?A8.exactId:i===n?A8.exactLabel:c.some(e=>e.startsWith(n))?A8.prefixId:i.startsWith(n)?A8.prefixLabel:s.some(e=>e.startsWith(n))?A8.prefixToken:c.some(e=>e.includes(n))?A8.containsId:i.includes(n)?A8.containsLabel:a.includes(n)?A8.containsDescription:M8(n,i)||c.some(e=>M8(n,e))?A8.subsequence:0}function P8(e){return e>=A8.exactLabel?4:e>=A8.prefixToken?3:e>=A8.containsLabel?2:e>0?1:0}var F8=`context-reference:navigate:files`,I8=`context-reference:navigate:folders`,L8=`context-reference:navigate:projects`,R8=`context-reference:navigate:root`,z8=`context-reference:navigate:system-object-group:`,B8=`context-reference:system-object:`,V8=`workspace-files`,H8=`workspace-folders`,U8=`projects`;function W8(e,t){return e.translations?.[t]??e.default}function G8(e){return e.groups.map(t=>({key:`${z8}${t.objectType}`,icon:t.icon,title:W8(t.label,e.language),subtitle:e.texts.systemObjectSectionLabel,description:W8(t.description,e.language),detailLines:[],hintLabel:e.texts.systemObjectGroupHintLabel,sectionKey:`system-object-groups`,sectionLabel:e.texts.systemObjectSectionLabel,selectionBehavior:`navigate`,value:t.objectType}))}function K8(e){return e.groups.flatMap(t=>{let n=W8(t.label,e.language);return t.items.map(e=>({key:`${B8}${e.uri}`,icon:t.icon,title:e.label,subtitle:n,description:e.description??e.objectId,detailLines:[e.uri],sectionKey:`system-objects:${t.objectType}`,sectionLabel:n,selectionBehavior:`action`,value:e.uri}))})}function q8(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function J8(e){let{kind:t,projectRoot:n,relativePath:r}=e,i=r.split(`/`).filter(Boolean);return{rootLabel:q8(n),segments:i.map((e,n)=>({label:e,kind:n===i.length-1?t:`directory`}))}}function Y8(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.projects.map((t,n)=>({order:n,project:t,score:N8({id:t.rootPath,label:t.name,description:t.rootPath,aliases:t.template?[t.template]:[]},e.query)})).filter(({score:e})=>e>0).sort((e,n)=>{let r=P8(e.score),i=P8(n.score);return i===r?n.score===e.score?t.compare(e.project.name,n.project.name)||e.order-n.order:n.score-e.score:i-r}).map(({project:t})=>({key:`context-reference:project:${t.rootPath}`,icon:`project`,title:t.name,subtitle:e.texts.projectSubtitle,description:e.texts.projectDescription,detailLines:[`${e.texts.projectPathLabel}: ${t.rootPath}`],sectionKey:U8,sectionLabel:e.texts.projectSectionLabel,value:t.rootPath,tokenKind:s,tokenKey:t.rootPath}))}function X8(e){let t=q8(e.projectRoot);return e.entries.map(n=>{let i=e.navigateDirectories&&n.kind===`directory`;return{key:`workspace:${n.kind}:${n.relativePath}`,icon:n.kind===`directory`?`folder`:`file`,title:n.name,subtitle:n.parentRelativePath||t,description:n.kind===`directory`?e.texts.directoryDescription:e.texts.fileDescription,detailLines:[`${e.texts.projectRootLabel}: ${e.projectRoot}`,n.relativePath],sectionKey:e.sectionKey,sectionLabel:e.sectionLabel,value:n.relativePath,tokenKind:i?void 0:n.kind===`directory`?p:r,tokenKey:i?void 0:n.relativePath,selectionBehavior:i?`navigate`:void 0,pathPreview:J8({kind:n.kind,projectRoot:e.projectRoot,relativePath:n.relativePath})}})}function Z8(e){let{projectRoot:t,referencePath:n,texts:r}=e,i=n.split(`/`).filter(Boolean).join(`/`),a=i||`.`,o=i.split(`/`).filter(Boolean).at(-1)??q8(t);return{key:`context-reference:current-directory:${a}`,icon:`folder`,title:r.currentDirectoryLabel,subtitle:o,description:r.directoryDescription,detailLines:[`${r.projectRootLabel}: ${t}`,a],sectionKey:H8,sectionLabel:r.foldersLabel,value:a,tokenKind:p,tokenKey:a,pathPreview:J8({kind:`directory`,projectRoot:t,relativePath:i})}}function Q8(e){return{key:F8,icon:`files`,title:e.filesLabel,subtitle:e.filesSubtitle,description:e.filesDescription,detailLines:[],hintLabel:e.filesHintLabel,selectionBehavior:`navigate`}}function $8(e){return{key:I8,icon:`folder`,title:e.foldersLabel,subtitle:e.foldersSubtitle,description:e.foldersDescription,detailLines:[],hintLabel:e.foldersHintLabel,selectionBehavior:`navigate`}}function e5(e){return{key:L8,icon:`project`,title:e.projectsLabel,subtitle:e.projectsSubtitle,description:e.projectsDescription,detailLines:[],hintLabel:e.projectsHintLabel,selectionBehavior:`navigate`}}function t5(e){let t=e.split(`/`).filter(Boolean);return t.length===0?null:t.slice(0,-1).join(`/`)}function n5(e){let{location:t,texts:n}=e,r=t.view===`files`||t.view===`folders`,i=r?t.path:``,a=!r||!i;return{key:R8,icon:`back`,title:a?n.backLabel:n.parentLabel,subtitle:``,description:a?n.backDescription:n.parentDescription,detailLines:[],hintLabel:a?n.backHintLabel:n.parentHintLabel,value:t5(i)??``,selectionBehavior:`navigate`}}var r5=`panel-apps`;function i5(e){return Date.parse(e.lastOpenedAt??e.updatedAt)||0}function Zne(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.entries.map((t,n)=>({entry:t,order:n,score:N8({id:t.appId,label:t.title||t.appId,description:t.description,aliases:[t.id,t.fileName]},e.query)})).filter(e=>e.score>0).sort((e,n)=>{let r=P8(e.score),i=P8(n.score);if(i!==r)return i-r;if(e.entry.favorite!==n.entry.favorite)return e.entry.favorite?-1:1;let a=i5(n.entry),o=i5(e.entry);return a===o?n.score===e.score?t.compare(e.entry.title||e.entry.appId,n.entry.title||n.entry.appId)||e.order-n.order:n.score-e.score:a-o}).map(({entry:e})=>e)}function a5(e){let t=e.keyPrefix??`panel-app`;return Zne({entries:e.entries,query:e.query}).map(n=>({entry:n,item:{key:`${t}:${n.appId}`,icon:`panel-app`,title:n.title||n.appId,subtitle:e.texts.subtitle,description:(n.description??``).trim()||e.texts.noDescriptionLabel,detailLines:[`${e.texts.appIdLabel}: ${n.appId}`,`${e.texts.fileLabel}: ${n.fileName}`]}}))}function Qne(e){return a5(e).map(({item:e})=>e)}function $ne(e){return a5(e).map(({entry:t,item:n})=>({...n,sectionKey:r5,sectionLabel:e.sectionLabel,tokenKind:`panel_app`,tokenKey:t.appId,value:t.appId}))}var o5={key:`context-reference`,marker:`@`};function ere(e){let{entries:t,isBrowsing:n,isFoldersMode:r,projectRoot:i,texts:a}=e,o=(e,t,n)=>X8({entries:e,navigateDirectories:n,projectRoot:i,sectionKey:t===`folders`?H8:V8,sectionLabel:t===`folders`?a.foldersLabel:a.filesLabel,texts:a});return{browsedItems:o(t,r?`folders`:`files`,n),fileItems:o(t.filter(({kind:e})=>e===`file`),`files`,!1),folderItems:o(t.filter(({kind:e})=>e===`directory`),`folders`,!1)}}function tre(e){let{isFoldersMode:t,isWorkspaceMode:n,item:r,onNavigate:i,onSelectSystemObject:a,referencePath:o}=e;r.key===`context-reference:navigate:files`?i({view:`files`,path:``}):r.key===`context-reference:navigate:folders`?i({view:`folders`,path:``}):r.key===`context-reference:navigate:projects`?i({view:`projects`}):r.key===`context-reference:navigate:root`?i(n&&o?{view:t?`folders`:`files`,path:r.value??``}:{view:`root`}):r.key.startsWith(`context-reference:navigate:system-object-group:`)&&r.value?i({view:`system-objects`,objectType:r.value}):r.selectionBehavior===`navigate`&&r.value?i({view:t?`folders`:`files`,path:r.value}):r.key.startsWith(`context-reference:system-object:`)&&r.value&&a(r.value)}function nre(e){return vF({key:`context-reference`,trigger:o5,resolvePanel:({data:t,trigger:n})=>{let r=t.referenceLocation.view===`files`,i=t.referenceLocation.view===`folders`,a=t.referenceLocation.view===`projects`,o=t.referenceLocation.view===`system-objects`,s=r||i,c=!!n.query.trim(),l=s&&!c,u=t.referenceLocation.view===`files`||t.referenceLocation.view===`folders`?t.referenceLocation.path:``,{browsedItems:d,fileItems:f,folderItems:p}=ere({entries:t.serverPathEntries,isBrowsing:l,isFoldersMode:i,projectRoot:t.projectRoot,texts:e.itemTexts.context}),m=Y8({projects:t.projects,query:n.query,texts:e.itemTexts.context}),h=i&&l?Z8({projectRoot:t.projectRoot,referencePath:u,texts:e.itemTexts.context}):null,g=t.systemObjectGroups??[],_=K8({groups:g,language:e.language,texts:e.itemTexts.context}),v=r?[n5({location:t.referenceLocation,texts:e.itemTexts.context}),...l?d:f]:i?[n5({location:t.referenceLocation,texts:e.itemTexts.context}),...h?[h]:[],...l?d:p]:a?[n5({location:t.referenceLocation,texts:e.itemTexts.context}),...m]:o?[n5({location:t.referenceLocation,texts:e.itemTexts.context}),..._]:[Q8(e.itemTexts.context),$8(e.itemTexts.context),e5(e.itemTexts.context),...c?f:[],...c?p:[],...c?m:[],...c?_:G8({groups:g,language:e.language,texts:e.itemTexts.context}),...$ne({entries:t.panelApps,query:n.query,sectionLabel:e.itemTexts.context.panelAppSectionLabel,texts:e.itemTexts.panelApp})],y=s?t.isServerPathSearchLoading:a?t.isProjectsLoading:o?!!t.isSystemObjectsLoading:t.isPanelAppsLoading||!!t.isSystemObjectsLoading||c&&(t.isProjectsLoading||t.isServerPathSearchLoading),b=!s&&!a&&!o,x=null;return a&&t.projectsError?x=`${e.itemTexts.context.projectsLoadFailedLabel}: ${t.projectsError}`:(o||b)&&t.systemObjectsError?x=`${e.itemTexts.context.searchFailedLabel}: ${t.systemObjectsError}`:(s||b)&&t.serverPathSearchError&&(x=`${e.itemTexts.context.searchFailedLabel}: ${t.serverPathSearchError}`),{isLoading:a?y:y&&v.length===0,items:v,notice:x?{message:x,tone:`error`}:void 0,onSelectItem:t=>tre({isFoldersMode:i,isWorkspaceMode:s,item:t,onNavigate:e.onNavigate,onSelectSystemObject:e.onSelectSystemObject,referencePath:u}),texts:e.menuTexts}}})}function s5(e){let t=e.modelLabel.trim(),n=e.providerLabel.trim();return n?`${n}/${t}`:t}function rre(e){let t=new Map;for(let n of e){let e=n.value.indexOf(`/`),r=e>0?n.value.slice(0,e):n.providerLabel,i=t.get(r)??{key:r,label:n.providerLabel,options:[]};i.options.push({value:n.value,label:n.modelLabel}),t.set(r,i)}return[...t.values()]}function c5(e){return e.map(e=>({value:e.value,modelLabel:e.modelLabel,providerLabel:e.providerLabel,thinkingCapability:e.thinkingCapability?{supported:e.thinkingCapability.supported,default:e.thinkingCapability.default??null}:null}))}function ire(e){let{isModelOptionsEmpty:t,onGoToProviders:n,texts:r}=e;return t?{tone:`warning`,text:r.noModelOptionsLabel,actionLabel:r.configureProviderLabel,onAction:n}:null}function are(e){let{onDismiss:t,onSelect:n,options:r,texts:i}=e;if(!(!t||!n||r.length===0))return{summaryLabel:i.discoveredModelsSummaryLabel.replace(`{count}`,String(r.length)),viewLabel:i.discoveredModelsViewLabel,groupLabel:i.discoveredModelsGroupLabel,allGroupLabel:i.allModelsLabel,actionLabel:i.discoveredModelAddLabel,addedLabel:i.discoveredModelAddedLabel,dismissLabel:i.discoveredModelsDismissLabel,doneLabel:i.discoveredModelsDoneLabel,closeLabel:i.discoveredModelsCloseLabel,searchPlaceholder:i.modelSearchPlaceholder,searchEmptyLabel:i.modelSearchEmptyLabel,groups:rre(r),onDismiss:t,onSelect:n}}function ore({modelOptions:e,discoveredModelOptions:t,favoriteModelValues:n,recentModelValues:r,selectedModel:i,isModelOptionsLoading:a,hasModelOptions:o,onFavoriteToggle:s,onDiscoveredModelSelect:c,onDiscoveredModelsDismiss:l,onOpen:u,onValueChange:d,texts:f}){let p=e.find(e=>e.value===i)??e[0],m=o?p?.value:void 0,h=new Map(e.map(e=>[e.value,e])),g=(n??[]).map(e=>h.get(e)).filter(e=>!!e),_=new Set(g.map(e=>e.value)),v=(r??[]).map(e=>h.get(e)).filter(e=>e!==void 0&&!_.has(e.value)),y=new Set(v.map(e=>e.value)),b=e.filter(e=>!_.has(e.value)&&!y.has(e.value)),x=g.length>0||v.length>0?[{key:`favorite-models`,label:f.favoriteModelsLabel,options:g.map(e=>({value:e.value,label:s5(e)}))},{key:`recent-models`,label:f.recentModelsLabel,options:v.map(e=>({value:e.value,label:s5(e)}))},{key:`all-models`,label:f.allModelsLabel,options:b.map(e=>({value:e.value,label:s5(e)}))}].filter(e=>e.options.length>0):void 0,S=t??[];return{key:`model`,value:m,placeholder:f.modelSelectPlaceholder,selectedLabel:p?s5(p):void 0,icon:`sparkles`,options:e.map(e=>({value:e.value,label:s5(e)})),groups:x,disabled:!o&&S.length===0,loading:a,emptyLabel:f.modelNoOptionsLabel,search:{placeholder:f.modelSearchPlaceholder,emptyLabel:f.modelSearchEmptyLabel},optionAction:s?{kind:`favorite`,activeValues:g.map(e=>e.value),activeLabel:f.unfavoriteModelLabel,inactiveLabel:f.favoriteModelLabel,onToggle:s}:void 0,discovery:are({options:S,onDismiss:l,onSelect:c,texts:f}),manageLabel:f.manageModelsLabel,manageHref:`/providers`,onOpen:u,onValueChange:d}}function sre(e){let{defaultThinkingLevel:t,onValueChange:n,selectedThinkingLevel:r,supportedLevels:i,texts:a}=e;if(i.length===0)return null;let o=n6(i),s=o.includes(`off`)?`off`:o[0],c=r&&o.includes(r)&&r||t&&o.includes(t)&&t||s;return{key:`thinking`,value:c,placeholder:a.thinkingLabels[c],selectedLabel:a.thinkingLabels[c],icon:`brain`,options:o.map(e=>({value:e,label:a.thinkingLabels[e]})),onValueChange:e=>n(e)}}var l5={exactSpec:1200,exactLabel:1150,prefixSpec:1e3,prefixLabel:950,prefixToken:900,containsSpec:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function u5(e){return(e??``).trim().toLowerCase()}function d5(e,t){if(!e||!t)return!1;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n>=e.length))return!0;return!1}function cre(e,t){let n=u5(t);if(!n)return l5.fallback;let r=u5(e.key),i=u5(e.label||e.key),a=u5(`${e.descriptionZh??``} ${e.description??``}`),o=i.split(/[\s/_-]+/).filter(Boolean);return r===n?l5.exactSpec:i===n?l5.exactLabel:r.startsWith(n)?l5.prefixSpec:i.startsWith(n)?l5.prefixLabel:o.some(e=>e.startsWith(n))?l5.prefixToken:r.includes(n)?l5.containsSpec:i.includes(n)?l5.containsLabel:a.includes(n)?l5.containsDescription:d5(n,i)||d5(n,r)?l5.subsequence:0}function f5(e){return e>=l5.exactLabel?4:e>=l5.prefixToken?3:e>=l5.containsLabel?2:e>0?1:0}function p5(e){return new Map(e.map((e,t)=>[e,t]))}function lre(e,t){let n=p5(t),r=[],i=[];for(let t of e){if(n.has(t.key)){r.push(t);continue}i.push(t)}return r.sort((e,t)=>(n.get(e.key)??1/0)-(n.get(t.key)??1/0)),[...r,...i]}function ure(e,t,n,r=[]){let i=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),a=p5(r),o=new Map;for(let t of e){let e=t.groupKey?.trim();e&&!o.has(e)&&o.set(e,o.size)}return e.map((e,n)=>({record:e,order:n,score:cre(e,t)})).filter(e=>e.score>0).sort((e,t)=>{let n=o.get(e.record.groupKey?.trim()??``)??1/0,r=o.get(t.record.groupKey?.trim()??``)??1/0;if(n!==r)return n-r;let s=f5(e.score),c=f5(t.score);if(c!==s)return c-s;let l=a.get(e.record.key)??1/0,u=a.get(t.record.key)??1/0;if(l!==u)return l-u;if(t.score!==e.score)return t.score-e.score;let d=(e.record.label||e.record.key).trim(),f=(t.record.label||t.record.key).trim(),p=i.compare(d,f);return p===0?e.order-t.order:p}).map(({record:e})=>({key:`skill:${e.key}`,title:e.label||e.key,subtitle:n.slashSkillSubtitle,description:(e.descriptionZh??e.description??``).trim()||n.noSkillDescription,detailLines:[`${n.slashSkillSpecLabel}: ${e.key}`,...e.scopeLabel?[`${n.slashSkillScopeLabel}: ${e.scopeLabel}`]:[]],sectionKey:e.groupKey,sectionLabel:e.groupLabel,tokenKind:`skill`,tokenKey:e.key,value:e.key}))}function m5(e){return e.map(e=>({key:e.key,label:e.label,description:e.descriptionZh||e.description||``,badgeLabel:e.badgeLabel}))}function dre(e){let{allSkillsLabel:t,recentKeySet:n,recentSkillsLabel:r,skillRecords:i}=e,a=i.filter(e=>n.has(e.key)),o=new Map;for(let e of i){if(n.has(e.key))continue;let r=e.groupKey?.trim()||`all-skills`,i=e.groupLabel?.trim()||t,a=o.get(r)??{label:i,records:[]};a.records.push(e),o.set(r,a)}let s=[...o].map(([e,t])=>({key:e,label:t.label,options:m5(t.records)})),c=s.some(e=>e.key!==`all-skills`);if(!(a.length===0&&!c))return[...a.length>0?[{key:`recent-skills`,label:r,options:m5(a)}]:[],...s].filter(e=>e.options.length>0)}function fre(e){let{groupedRecentSkillValues:t,isLoading:n,onSelectedKeysChange:r,recentSkillValues:i,selectedSkills:a,skillRecords:o,texts:s}=e,c=lre(o,i??[]),l=new Set(t??[]);return{title:s.title,searchPlaceholder:s.searchPlaceholder,emptyLabel:s.emptyLabel,loadingLabel:s.loadingLabel,isLoading:n,manageLabel:s.manageLabel,manageHref:`/marketplace/skills`,options:m5(c),groups:dre({skillRecords:c,recentKeySet:l,recentSkillsLabel:s.recentSkillsLabel,allSkillsLabel:s.allSkillsLabel}),selectedKeys:a,onSelectedKeysChange:r}}var h5=`commands`,g5=`panel-app-action`,_5=`panel-apps`,v5=`skills`;function pre(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.commands.map((t,n)=>({command:t,order:n,score:N8({id:t.key,label:t.title,description:t.description,aliases:t.keywords},e.query)})).filter(e=>e.score>0).sort((e,n)=>{let r=P8(e.score),i=P8(n.score);return i===r?n.score===e.score?t.compare(e.command.title,n.command.title)||e.order-n.order:n.score-e.score:i-r}).map(({command:t})=>({key:`command:${t.key}`,icon:t.icon,title:t.title,subtitle:e.texts.commandSubtitle,description:t.description,detailLines:[...t.detailLines??[]],hintLabel:e.texts.commandHintLabel,sectionKey:h5,sectionLabel:e.texts.commandSectionLabel}))}function mre(e){let{data:t,itemTexts:n,query:r,skillHintLabel:i,skillSectionLabel:a}=e;return ure([...t.skillRecords],r,n,[...t.recentSkillValues]).map(e=>({...e,icon:`skill`,hintLabel:i,sectionKey:e.sectionKey?`${v5}:${e.sectionKey}`:v5,sectionLabel:e.sectionLabel||a}))}function hre(e){return Qne({entries:e.data.panelApps,keyPrefix:g5,query:e.query,texts:e.itemTexts}).map(t=>({...t,icon:`panel-app`,hintLabel:e.panelAppHintLabel,sectionKey:_5,sectionLabel:e.panelAppSectionLabel}))}function gre(e){let t=`${g5}:`;return e.key.startsWith(t)?e.key.slice(t.length):null}function _re(e){return vF({key:`slash-command`,trigger:pc,resolvePanel:t=>{let{data:n,trigger:r}=t,i=mre({data:n,itemTexts:e.itemTexts.skillTexts,query:r.query,skillHintLabel:e.labels.skillHintLabel,skillSectionLabel:e.labels.skillSectionLabel}),a=[...new Set(i.flatMap(e=>e.sectionKey?[e.sectionKey]:[]))];return{filterOptions:[{key:`all`,label:e.labels.filterAllLabel},{key:h5,label:e.labels.filterCommandsLabel,sectionKeys:[h5]},{key:v5,label:e.labels.filterSkillsLabel,sectionKeys:a.length>0?a:[v5]},{key:_5,label:e.labels.filterPanelAppsLabel,sectionKeys:[_5]}],isLoading:n.isPanelAppsLoading||n.isSkillsLoading,items:[...pre({commands:e.commands,query:r.query,texts:{commandHintLabel:e.labels.commandHintLabel,commandSectionLabel:e.labels.commandSectionLabel,commandSubtitle:e.labels.commandSubtitle}}),...i,...hre({data:n,itemTexts:e.itemTexts.panelAppTexts,panelAppHintLabel:e.labels.panelAppHintLabel,panelAppSectionLabel:e.labels.panelAppSectionLabel,query:r.query})],onSelectItem:t=>{if(t.key.startsWith(`command:`)){e.commands.find(e=>t.key===`command:${e.key}`)?.onSelect();return}let n=gre(t);if(n){e.onSelectPanelApp(n);return}let r=t.tokenKey??t.value;r&&e.onSelectSkill?.(r)},texts:e.menuTexts}}})}function vre(e){let{commands:t,language:n,onNavigate:r,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,slashTexts:s}=e,c={appIdLabel:b(`chatPanelAppReferenceAppId`,n),fileLabel:b(`chatPanelAppReferenceFile`,n),noDescriptionLabel:b(`chatPanelAppReferenceNoDescription`,n),subtitle:b(`chatPanelAppReferenceType`,n)};return[_re({commands:t,itemTexts:{panelAppTexts:c,skillTexts:s},menuTexts:{loadingLabel:b(`chatSlashLoading`,n),sectionLabel:b(`chatSlashSection`,n),emptyLabel:b(`chatSlashNoResult`,n),hintLabel:b(`chatSlashHint`,n),itemHintLabel:b(`chatSlashSkillHint`,n)},labels:{commandHintLabel:b(`chatSlashCommandHint`,n),commandSectionLabel:b(`chatSlashSectionCommands`,n),commandSubtitle:b(`chatSlashTypeCommand`,n),filterAllLabel:b(`chatSlashFilterAll`,n),filterCommandsLabel:b(`chatSlashFilterCommands`,n),filterPanelAppsLabel:b(`chatSlashFilterPanelApps`,n),filterSkillsLabel:b(`chatSlashFilterSkills`,n),panelAppHintLabel:b(`chatSlashPanelAppHint`,n),panelAppSectionLabel:b(`chatPanelAppReferenceSection`,n),skillHintLabel:b(`chatSlashSkillHint`,n),skillSectionLabel:b(`chatSlashSectionSkills`,n)},onSelectPanelApp:i,onSelectSkill:a}),nre({itemTexts:{context:{backLabel:b(`chatContextReferenceBack`,n),backDescription:b(`chatContextReferenceBackDescription`,n),backHintLabel:b(`chatContextReferenceBackHint`,n),currentDirectoryLabel:b(`chatContextReferenceCurrentDirectory`,n),directoryDescription:b(`chatContextReferenceDirectoryDescription`,n),fileDescription:b(`chatContextReferenceFileDescription`,n),filesDescription:b(`chatContextReferenceFilesDescription`,n),filesHintLabel:b(`chatContextReferenceFilesHint`,n),filesLabel:b(`chatContextReferenceFilesLabel`,n),filesSubtitle:b(`chatContextReferenceFilesType`,n),foldersDescription:b(`chatContextReferenceFoldersDescription`,n),foldersHintLabel:b(`chatContextReferenceFoldersHint`,n),foldersLabel:b(`chatContextReferenceFoldersLabel`,n),foldersSubtitle:b(`chatContextReferenceFoldersType`,n),panelAppSectionLabel:b(`chatPanelAppReferenceSection`,n),parentLabel:b(`chatContextReferenceParent`,n),parentDescription:b(`chatContextReferenceParentDescription`,n),parentHintLabel:b(`chatContextReferenceParentHint`,n),projectDescription:b(`chatContextReferenceProjectDescription`,n),projectPathLabel:b(`chatContextReferenceProjectPath`,n),projectSectionLabel:b(`chatContextReferenceProjectSection`,n),projectSubtitle:b(`chatContextReferenceProjectType`,n),projectsDescription:b(`chatContextReferenceProjectsDescription`,n),projectsHintLabel:b(`chatContextReferenceProjectsHint`,n),projectsLabel:b(`chatContextReferenceProjectsLabel`,n),projectsLoadFailedLabel:b(`chatContextReferenceProjectsLoadFailed`,n),projectsSubtitle:b(`chatContextReferenceProjectsType`,n),projectRootLabel:b(`chatContextReferenceProjectRoot`,n),searchFailedLabel:b(`chatContextReferenceSearchFailed`,n),systemObjectGroupHintLabel:b(`chatSystemObjectGroupHint`,n),systemObjectSectionLabel:b(`chatSystemObjectSection`,n)},panelApp:c},menuTexts:{loadingLabel:b(`chatContextReferenceLoading`,n),sectionLabel:b(`chatContextReferenceSection`,n),emptyLabel:b(`chatContextReferenceNoResult`,n),hintLabel:b(`chatContextReferenceHint`,n),itemHintLabel:b(`chatContextReferenceItemHint`,n)},language:n,onNavigate:r,onSelectSystemObject:o})]}function yre(e){return[`server-path-search`,e.basePath.trim(),e.query?.trim()??``,e.limit??null]}function bre(e){let{enabled:t,limit:n}=e,r=e.basePath.trim(),i=e.query?.trim()??``;return Sn({queryKey:yre({basePath:r,query:i,limit:n}),queryFn:()=>an({basePath:r,query:i,limit:n}),enabled:(t??!0)&&!!r,staleTime:5e3})}function xre(e){let{enabled:t,limit:n,objectType:r}=e,i=e.query.trim();return Sn({queryKey:[`system-object-references`,r??null,i,n??null],queryFn:()=>I.systemObjectReferences.list({query:i||void 0,limit:n,objectType:r}),enabled:t,staleTime:1e4})}function Sre(e){let t=e.parentRelativePath.split(`/`).filter(Boolean).join(`/`);return e.entries.map(e=>({name:e.name,path:e.path,relativePath:[t,e.name].filter(Boolean).join(`/`),parentRelativePath:t,kind:e.kind,hidden:e.hidden}))}function Cre(e){let{inputSurfaceTrigger:t,isContextReferenceTrigger:n,query:r,referenceLocation:i}=e,a=OY({enabled:n&&i.view===`root`||t?.key===pc.key}),o=nR({enabled:!!(n&&(i.view===`root`||i.view===`projects`))}),s=i.view===`system-objects`?i.objectType:void 0;return{panelApps:a,projects:o,systemObjects:xre({enabled:!!(n&&(i.view===`root`||i.view===`system-objects`)),query:r,limit:s?20:6,objectType:s})}}function wre(e){let{isSkillsLoading:t,itemTexts:n,language:r,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,projectRoot:s,recentSkillValues:c,skillRecords:l,commands:u}=e,[d,f]=(0,H.useState)({view:`root`}),[p,m]=(0,H.useState)(null),h=(0,H.useRef)(`null`),g=(0,H.useCallback)(e=>{let t=JSON.stringify(e?[e.key,e.marker,e.query,e.start,e.end]:null);h.current!==t&&(h.current=t,e||f({view:`root`}),m(e))},[]),_=p?.key===o5.key,v=d.view===`files`||d.view===`folders`,y=v?d.path:``,b=(0,H.useDeferredValue)(_?p.query:``),x=!!(_&&s&&v&&!b.trim()),S=!!(_&&s&&(d.view===`root`||v)&&b.trim()),C=MF({path:y||`.`,basePath:s,includeFiles:d.view===`files`,enabled:x}),w=bre({basePath:s,query:b,enabled:S}),T=x?C:w,E=(0,H.useMemo)(()=>x?Sre({entries:C.data?.entries??[],parentRelativePath:y}):w.data?.entries??[],[x,y,C.data?.entries,w.data?.entries]),{panelApps:D,projects:O,systemObjects:k}=Cre({inputSurfaceTrigger:p,isContextReferenceTrigger:_,query:b,referenceLocation:d}),A=(0,H.useMemo)(()=>vre({commands:u,language:r,onNavigate:f,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,slashTexts:n.slashTexts}),[u,n.slashTexts,r,i,a,o]);return{inputSurfaceState:(0,H.useMemo)(()=>yF({data:{isPanelAppsLoading:D.isLoading||D.isFetching,isProjectsLoading:O.isLoading||O.isFetching,isServerPathSearchLoading:T.isLoading||T.isFetching,isSkillsLoading:t,isSystemObjectsLoading:k.isLoading||k.isFetching,panelApps:D.data?.entries??[],projectRoot:s,projects:O.data?.projects??[],projectsError:O.error instanceof Error?O.error.message:null,recentSkillValues:c,referenceLocation:d,serverPathEntries:E,serverPathSearchError:T.error instanceof Error?T.error.message:null,skillRecords:l,systemObjectGroups:k.data?.groups??[],systemObjectsError:k.error instanceof Error?k.error.message:null},plugins:A,trigger:p}),[A,p,D.data?.entries,D.isFetching,D.isLoading,s,O.data?.projects,O.error,O.isFetching,O.isLoading,T.error,T.isFetching,T.isLoading,d,E,t,c,l,k.data?.groups,k.error,k.isFetching,k.isLoading]),setInputSurfaceTrigger:g}}var y5=hn.chat.modelFavorites,b5=[`preference`,y5];function Tre(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();e&&!t.includes(e)&&t.push(e)}return t}function Ere(e){let t=F(),n=(0,H.useMemo)(()=>new Set(e),[e]),r=Sn({queryKey:b5,queryFn:()=>rt(y5),staleTime:3e4}),i=(0,H.useMemo)(()=>Tre(r.data?.value),[r.data?.value]),a=(0,H.useMemo)(()=>i.filter(e=>n.has(e)),[n,i]),o=z({mutationFn:async e=>await ke(y5,e),onMutate:async e=>{await t.cancelQueries({queryKey:b5});let n=t.getQueryData(b5);return t.setQueryData(b5,{key:y5,value:e,updatedAt:new Date().toISOString()}),{previous:n}},onError:(e,n,r)=>{r?.previous&&t.setQueryData(b5,r.previous)},onSuccess:e=>{t.setQueryData(b5,e)}}),s=(0,H.useCallback)((e,t)=>{let n=e.trim();if(!n)return;let r=t?[n,...i.filter(e=>e!==n)]:i.filter(e=>e!==n);o.mutate(r)},[i,o]);return{favoriteModelValues:a,isLoading:r.isLoading,setModelFavorite:s}}var x5=new k6({storageKey:`nextclaw.chat.recent-skills`,limit:5});function Dre(e){let{addAttachments:t,attachmentSupported:n,inputBarRef:r}=e,i=(0,H.useCallback)(e=>{if(e===`unsupported-type`){L.error(b(`chatInputAttachmentUnsupported`));return}if(e===`too-large`){L.error(b(`chatInputAttachmentTooLarge`).replace(`{maxMb}`,String(O4/(1024*1024))));return}L.error(b(`chatInputAttachmentReadFailed`))},[]),a=(0,H.useCallback)(async e=>{if(!n||e.length===0)return;let a=await N4(e,{uploadBatch:st});if(a.attachments.length>0){let e=t(a.attachments);e.length>0&&r.current?.insertFileTokens(e.map(e=>({tokenKey:e.id,label:e.name,previewUrl:e.mimeType.startsWith(`image/`)?e.url:void 0})))}a.rejected.length>0&&i(a.rejected[0].reason)},[t,n,r,i]);return{handleFilesAdd:a,handleFileInputChange:(0,H.useCallback)(async e=>{let t=Array.from(e.target.files??[]);e.currentTarget.value=``,await a(t)},[a])}}function Ore(e){let{inputBarRef:t,intentManager:n,selectedSessionKey:r}=e;(0,H.useEffect)(()=>{let e=r?.trim()||null,i=e=>{let r=t.current;r&&(r.insertToken({tokenKind:e.kind,tokenKey:e.tokenKey,label:e.label,data:e.kind===`workspace_excerpt`?{path:e.path,excerpt:e.excerpt,startLine:e.startLine,endLine:e.endLine}:e.kind===`conversation_excerpt`?{messageId:e.messageId,role:e.role,excerpt:e.excerpt}:e.kind===`ui_resource`?{reference:e.reference}:void 0}),n.markConsumed(e.id))},a=n.subscribe(e,i),o=n.consumePending(e);return o&&i(o),a},[t,n,r])}function kre(e){return(0,H.useCallback)(t=>{let n=[...t];e.update(e=>({nodes:n,attachments:I0(n,e.attachments),text:M0(n),selectedSkills:N0(n),sendError:null}))},[e])}function S5(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Are(e){let{inputActions:t,selectedSessionKey:n}=e,r=lc(),i=(0,H.useRef)(0),a=(0,H.useRef)(new Map),o=(0,H.useRef)(Promise.resolve());return(0,H.useCallback)((e,s,c)=>{let l=n?.trim();if(!l)return;let u=++i.current,d=`${l}:model`,f=`${l}:thinking`;S5(e,`preferredModel`)&&a.current.set(d,u),S5(e,`preferredThinking`)&&a.current.set(f,u);let p=o.current.then(()=>r({invalidateSessionSkills:!1,sessionKey:l,patch:e,successMessage:null}));o.current=p.catch(()=>void 0),p.catch(()=>{t.update(t=>{let n={};return S5(e,`preferredModel`)&&a.current.get(d)===u&&t.selectedModel===s.selectedModel&&S5(c,`selectedModel`)&&(n.selectedModel=c.selectedModel),S5(e,`preferredThinking`)&&a.current.get(f)===u&&t.selectedThinkingLevel===s.selectedThinkingLevel&&S5(c,`selectedThinkingLevel`)&&(n.selectedThinkingLevel=c.selectedThinkingLevel),n})})},[t,n,r])}function jre(e){let{language:t,onContextCompactingChange:n,onSendPresetMessage:r,selectedSessionKey:i}=e,a=eI(),o=(0,H.useRef)(new Set),s=(0,H.useCallback)(async e=>{if(!o.current.has(e)){o.current.add(e),n?.(e,!0);try{await be(e),L.success(b(`chatSlashCommandCompactContextSuccess`,t))}catch(e){let n=e instanceof Error?e.message:String(e);L.error(`${b(`chatSlashCommandCompactContextFailed`,t)}: ${n}`)}finally{o.current.delete(e),n?.(e,!1)}}},[t,n]);return(0,H.useMemo)(()=>{let e=i?.trim();return e?[{key:`side-chat`,icon:`message-square-plus`,title:b(`chatSlashCommandSideChatTitle`,t),description:b(`chatSlashCommandSideChatDescription`,t),detailLines:[b(`chatSlashCommandSideChatDetail`,t)],keywords:[`side`,`chat`,`child`,`branch`,`new`],onSelect:()=>a.chatThreadManager.openSideChatDraft(e)},{key:`update-session-title`,icon:`command`,title:b(`chatSlashCommandUpdateSessionTitleTitle`,t),description:b(`chatSlashCommandUpdateSessionTitleDescription`,t),detailLines:[b(`chatSlashCommandUpdateSessionTitleDetail`,t)],keywords:[`update`,`rename`,`title`,`session`,`更新`,`重命名`,`标题`,`会话`],onSelect:()=>void r(b(`chatSlashCommandUpdateSessionTitlePrompt`,t))},{key:`compact-context`,icon:`list-collapse`,title:b(`chatSlashCommandCompactContextTitle`,t),description:b(`chatSlashCommandCompactContextDescription`,t),detailLines:[b(`chatSlashCommandCompactContextDetail`,t)],keywords:[`compact`,`compress`,`context`,`summary`,`压缩`,`上下文`],onSelect:()=>void s(e)}]:[]},[s,t,r,a.chatThreadManager,i])}function Mre(e){return(0,H.useCallback)(t=>{I.systemObjectReferences.resolve(t).then(t=>{e.current?.insertInputSurfaceToken({tokenKind:o,tokenKey:t.uri,label:t.label,data:{reference:t}})}).catch(e=>{let t=e instanceof Error?e.message:b(`error`);L.error(`${b(`chatSystemObjectResolveFailed`)}: ${t}`)})},[e])}function Nre(){return{off:b(`chatThinkingLevelOff`),minimal:b(`chatThinkingLevelMinimal`),low:b(`chatThinkingLevelLow`),medium:b(`chatThinkingLevelMedium`),high:b(`chatThinkingLevelHigh`),adaptive:b(`chatThinkingLevelAdaptive`),xhigh:b(`chatThinkingLevelXhigh`)}}function Pre(e){let{allModelsLabel:t,favoriteModelLabel:n,favoriteModelValues:r,favoriteModelsLabel:i,hasModelOptions:a,isModelOptionsLoading:o,modelRecords:s,discoveredModelRecords:c,modelSearchEmptyLabel:l,modelSearchPlaceholder:u,onFavoriteModelToggle:d,onDiscoveredModelSelect:f,onDiscoveredModelsDismiss:p,onModelSelectOpen:m,onModelChange:h,onThinkingChange:g,recentModelValues:_,recentModelsLabel:v,selectedModel:y,selectedThinkingLevel:x,thinkingDefaultLevel:S,thinkingSupportedLevels:C,unfavoriteModelLabel:w}=e;return[ore({modelOptions:s,discoveredModelOptions:c,favoriteModelValues:r,recentModelValues:_,selectedModel:y,isModelOptionsLoading:o,hasModelOptions:a,onFavoriteToggle:d,onDiscoveredModelSelect:f,onDiscoveredModelsDismiss:p,onOpen:m,onValueChange:h,texts:{modelSelectPlaceholder:b(`chatSelectModel`),modelNoOptionsLabel:b(`chatModelNoOptions`),modelSearchPlaceholder:u,modelSearchEmptyLabel:l,favoriteModelsLabel:i,favoriteModelLabel:n,unfavoriteModelLabel:w,manageModelsLabel:b(`chatManageModels`),discoveredModelsSummaryLabel:b(`chatDiscoveredModelsSummary`),discoveredModelsViewLabel:b(`chatDiscoveredModelsView`),discoveredModelsGroupLabel:b(`chatDiscoveredModelsGroup`),discoveredModelAddLabel:b(`chatDiscoveredModelAdd`),discoveredModelAddedLabel:b(`chatDiscoveredModelAddedShort`),discoveredModelsDismissLabel:b(`chatDiscoveredModelsDismiss`),discoveredModelsDoneLabel:b(`chatDiscoveredModelsDone`),discoveredModelsCloseLabel:b(`chatDiscoveredModelsClose`),recentModelsLabel:v,allModelsLabel:t}}),sre({supportedLevels:C,selectedThinkingLevel:x,defaultThinkingLevel:S,onValueChange:g,texts:{thinkingLabels:Nre()}})].filter(e=>e!==null)}function Fre(e){let{allSkillsLabel:t,isSkillsLoading:n,onSelectedKeysChange:r,recentSkillGroupValues:i,recentSkillValues:a,recentSkillsLabel:o,selectedSkills:s,skillRecords:c}=e;return fre({skillRecords:c,recentSkillValues:a,groupedRecentSkillValues:i,selectedSkills:[...s],isLoading:n,onSelectedKeysChange:r,texts:{title:b(`chatSkillsPickerTitle`),searchPlaceholder:b(`chatSkillsPickerSearchPlaceholder`),emptyLabel:b(`chatSkillsPickerEmpty`),loadingLabel:b(`sessionsLoading`),manageLabel:b(`chatSkillsPickerManage`),recentSkillsLabel:o,allSkillsLabel:t}})}function Ire(e,t){let n=e?.thinkingCapability;return!n||n.supported.length===0?null:t===`off`?`off`:t&&n.supported.includes(t)?t:n.default&&n.supported.includes(n.default)?n.default:`off`}function Lre({item:e}){let t=e.attachments??[],n=t.slice(0,3);return(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n.map((e,t)=>e.previewUrl?(0,U.jsx)(`img`,{alt:e.name,loading:`lazy`,src:e.previewUrl,title:e.name,className:`h-9 w-9 shrink-0 rounded-md border border-border/70 object-cover`},`${e.name}-${t}`):(0,U.jsxs)(`span`,{title:e.name,className:`inline-flex min-w-0 max-w-36 shrink items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(zo,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]},`${e.name}-${t}`)),t.length>n.length?(0,U.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`+`,t.length-n.length]}):null,e.preview||t.length===0?(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground/80`,children:e.preview||b(`chatQueuedBannerAttachmentFallback`)}):null]})}function C5({children:e,disabled:t=!1,label:n,onClick:r}){return(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":n,disabled:t,onClick:r,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:text-muted-foreground/50`,children:e})})}),(0,U.jsx)(li,{side:`top`,children:n})]})}function Rre({controller:e}){return e.queuedInputs.length===0?null:(0,U.jsx)(ci,{delayDuration:120,children:(0,U.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.queuedInputs.map(t=>(0,U.jsxs)(`div`,{className:`flex min-h-8 min-w-0 items-center gap-2 text-sm`,children:[(0,U.jsx)(Ea,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(Lre,{item:t}),t.isSubmitting?(0,U.jsxs)(`span`,{"aria-label":b(`chatQueuedSubmitting`),className:`inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Ei,{className:`h-3.5 w-3.5 animate-spin`}),b(`chatQueuedSubmitting`)]}):(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,U.jsx)(C5,{disabled:!e.canEditQueuedInput,label:e.canEditQueuedInput?b(`chatQueuedEdit`):b(`chatQueuedEditComposerNotEmpty`),onClick:()=>e.editQueuedInput(t.id),children:(0,U.jsx)(Ho,{className:`h-4 w-4`})}),(0,U.jsx)(C5,{label:b(`chatQueuedSteer`),onClick:()=>e.steerQueuedInput(t.id),children:(0,U.jsx)(Xa,{className:`h-4 w-4`})}),(0,U.jsx)(C5,{label:b(`chatQueuedDelete`),onClick:()=>e.deleteQueuedInput(t.id),children:(0,U.jsx)(fs,{className:`h-4 w-4`})})]})]},t.id))})})}function zre(e,t,n){return e.map(e=>({key:e.ref,label:e.name,scopeLabel:t[e.source],groupKey:e.source,groupLabel:n[e.source],description:e.description,descriptionZh:e.descriptionZh,badgeLabel:t[e.source]}))}function Bre(e){let{skillGroupLabels:t,skillScopeLabels:n}=(0,H.useMemo)(()=>({skillScopeLabels:{builtin:b(`chatSkillScopeBuiltin`),global:b(`chatSkillScopeGlobal`),project:b(`chatSkillScopeProject`),workspace:b(`chatSkillScopeWorkspace`)},skillGroupLabels:{builtin:b(`chatSkillGroupBuiltin`),global:b(`chatSkillGroupGlobal`),project:b(`chatSkillGroupProject`),workspace:b(`chatSkillGroupWorkspace`)}}),[e]);return{skillScopeLabels:n,skillGroupLabels:t,slashTexts:(0,H.useMemo)(()=>({slashSkillSubtitle:b(`chatSlashTypeSkill`),slashSkillSpecLabel:b(`chatSlashSkillSpec`),slashSkillScopeLabel:b(`chatSlashSkillScope`),noSkillDescription:b(`chatSkillsPickerNoDescription`)}),[e]),recentModelsLabel:b(`chatPickerRecentModels`),allModelsLabel:b(`chatPickerAllModels`),favoriteModelsLabel:b(`chatPickerFavoriteModels`),modelSearchPlaceholder:b(`chatModelSearchPlaceholder`),modelSearchEmptyLabel:b(`chatModelSearchEmpty`),favoriteModelLabel:b(`chatFavoriteModel`),unfavoriteModelLabel:b(`chatUnfavoriteModel`),recentSkillsLabel:b(`chatPickerRecent`),allSkillsLabel:b(`chatPickerAllSkills`)}}function Vre(e){let{modelOptions:t,skillGroupLabels:n,skillRecords:r,skillScopeLabels:i}=e,a=(0,H.useMemo)(()=>zre(r,i,n),[n,i,r]),o=(0,H.useMemo)(()=>c5(t),[t]);return{skillRecords:a,modelRecords:o,recentModelValues:A6.resolveVisible({availableValues:o.map(e=>e.value),minAvailableCount:5}),recentSkillValues:x5.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:0}),recentSkillGroupValues:x5.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:4})}}var Hre=(0,H.memo)(function(e){let{contextWindow:t,controller:n,inputActions:r,inputQuery:i,inputSnapshot:a,onContextCompactingChange:o,placeholder:s,surface:c=`default`}=e,l=eI(),{language:u}=Wn(),f=t0(e=>e.layout),{isMobile:p}=k8(),m=(0,H.useRef)(null),h=(0,H.useRef)(null),g=Bre(u),{skillRecords:_,modelRecords:v,recentModelValues:y,recentSkillValues:x,recentSkillGroupValues:S}=Vre({modelOptions:i.modelOptions,skillRecords:i.skillRecords,skillGroupLabels:g.skillGroupLabels,skillScopeLabels:g.skillScopeLabels}),C=(0,H.useMemo)(()=>c5(i.discoveredModelOptions),[i.discoveredModelOptions]),w=jre({language:u,onContextCompactingChange:o,onSendPresetMessage:n.sendPresetMessage,selectedSessionKey:i.selectedSessionKey}),T=(0,H.useCallback)(e=>void l.chatUiManager.showContent({target:{type:`panel_app`,payload:{appId:e}}}),[l.chatUiManager]),E=i.selectedSessionKey?i.selectedSession?.projectRoot??i.defaultProjectRoot??``:a.pendingProjectRoot??i.defaultProjectRoot??``,D=Mre(m),{inputSurfaceState:O,setInputSurfaceTrigger:k}=wre({commands:w,isSkillsLoading:i.isSkillsLoading,itemTexts:{slashTexts:g.slashTexts},language:u,onSelectPanelApp:T,onSelectSkill:x5.remember,onSelectSystemObject:D,projectRoot:E,recentSkillValues:x,skillRecords:_}),{favoriteModelValues:A,setModelFavorite:j}=Ere((0,H.useMemo)(()=>v.map(e=>e.value),[v])),M=a.selectedModel??``,N=a.selectedThinkingLevel,P={isProviderStateResolved:i.isProviderStateResolved,modelOptions:i.modelOptions,sessionTypeUnavailable:i.sessionTypeState.sessionTypeUnavailable},ee=w3(P),te=T3(P),ne=E3(P),re=D3(P),ie=ne?b(`chatModelNoOptions`):s??b(p?`chatInputPlaceholderCompact`:`chatInputPlaceholder`),ae=v.find(e=>e.value===M),oe=ae?.thinkingCapability?.supported??[],{handleFilesAdd:se,handleFileInputChange:ce}=Dre({attachmentSupported:!0,inputBarRef:m,addAttachments:r.addAttachments}),le=Are({inputActions:r,selectedSessionKey:i.selectedSessionKey}),ue=kre(r);Ore({inputBarRef:m,intentManager:l.chatComposerIntentManager,selectedSessionKey:i.selectedSessionKey});let de=(0,H.useCallback)(e=>{let t=Ire(v.find(t=>t.value===e)??C.find(t=>t.value===e),N);r.update({selectedModel:e,selectedThinkingLevel:t,sendError:null}),A6.remember(e,{namespace:i.sessionTypeState.selectedSessionType}),d(e)||A6.remember(e),le({preferredModel:d(e)?null:e,preferredThinking:t},{selectedModel:e,selectedThinkingLevel:t},{selectedModel:M,selectedThinkingLevel:N})},[r,C,i.sessionTypeState.selectedSessionType,v,N,le,M]),fe=(0,H.useCallback)(async e=>{let t=await i.addDiscoveredModel(e);if(!t)throw L.error(b(`chatDiscoveredModelUnavailable`)),Error(`Discovered provider model is no longer available.`);L.success(b(`chatDiscoveredModelAdded`).replace(`{model}`,t.modelLabel))},[i]),pe=(0,H.useCallback)(e=>{r.setSelectedThinkingLevel(e),le({preferredThinking:e},{selectedThinkingLevel:e},{selectedThinkingLevel:N})},[r,le,N]),me=(0,H.useCallback)(e=>{let t=a.selectedSkills;e.filter(e=>!t.includes(e)).forEach(e=>x5.remember(e)),ue(F0([...a.nodes],e,i.skillRecords.map(e=>({ref:e.ref,name:e.name}))))},[ue,i.skillRecords,a.nodes,a.selectedSkills]);(0,H.useEffect)(()=>{a.composerFocusRequestId&&(m.current?.focusComposerAtEnd([...a.nodes]),r.consumeComposerFocusRequest())},[r,a.composerFocusRequestId,a.nodes]);let he=Pre({allModelsLabel:g.allModelsLabel,favoriteModelLabel:g.favoriteModelLabel,favoriteModelValues:A,favoriteModelsLabel:g.favoriteModelsLabel,hasModelOptions:ee,isModelOptionsLoading:te,discoveredModelRecords:C,modelRecords:v,modelSearchEmptyLabel:g.modelSearchEmptyLabel,modelSearchPlaceholder:g.modelSearchPlaceholder,onFavoriteModelToggle:j,onDiscoveredModelSelect:fe,onDiscoveredModelsDismiss:i.dismissDiscoveredModels,onModelSelectOpen:()=>{i.refreshProviderModelCatalog()},onModelChange:de,onThinkingChange:pe,recentModelValues:y,recentModelsLabel:g.recentModelsLabel,selectedModel:M,selectedThinkingLevel:N,thinkingSupportedLevels:oe,thinkingDefaultLevel:ae?.thinkingCapability?.default??null,unfavoriteModelLabel:g.unfavoriteModelLabel}),ge=Fre({allSkillsLabel:g.allSkillsLabel,onSelectedKeysChange:me,recentSkillGroupValues:S,recentSkillValues:x,recentSkillsLabel:g.recentSkillsLabel,isSkillsLoading:i.isSkillsLoading,skillRecords:_,selectedSkills:a.selectedSkills}),_e=(0,H.useMemo)(()=>[...a.nodes],[a.nodes]),ve=c===`default`&&f===`flat`,ye=(0,U.jsx)(Sx,{ref:m,surface:ve?`embedded`:c,topSlot:n.queuedInputs.length>0?(0,U.jsx)(Rre,{controller:n}):null,composer:{nodes:_e,placeholder:ie,excerptCharacterCountTemplate:b(`chatWorkspaceExcerptCharacterCount`),removeTokenLabel:b(`chatInputRemoveReference`),disabled:re,onNodesChange:ue,onFilesAdd:se,inputSurfaceTriggerSpecs:O.triggerSpecs,onInputSurfaceTriggerChange:k},inputSurface:O.panel??void 0,hint:ire({isModelOptionsEmpty:ne,onGoToProviders:l.chatUiManager.goToProviders,texts:{noModelOptionsLabel:b(`chatModelNoOptions`),configureProviderLabel:b(`chatGoConfigureProvider`)}}),toolbar:{addMenuLabel:b(`chatInputAdd`),selects:[],trailingSelects:he,accessories:[{key:`attach`,label:b(`chatInputAttach`),icon:`paperclip`,disabled:re,onClick:()=>h.current?.click()}],skillPicker:ge,actions:{isSending:n.isSending,canStopGeneration:n.canStopGeneration,sendDisabled:n.sendDisabled,stopDisabled:n.stopDisabled,stopHint:b(`chatStopUnavailable`),sendButtonLabel:n.primaryAction===`continue`?b(`chatContinueRun`):b(`chatSend`),sendIcon:n.primaryAction,stopButtonLabel:b(`chatStop`),contextWindow:t,onSend:n.send,onAlternateSend:n.sendSteering,onStop:n.stop}}});return(0,U.jsxs)(U.Fragment,{children:[ve?(0,U.jsx)(s2,{className:`pb-4 pt-2`,width:`composer`,children:ye}):ye,(0,U.jsx)(`input`,{ref:h,type:`file`,multiple:!0,className:`hidden`,onChange:ce})]})});function Ure(e){let{applyPromptSuggestion:t,applySystemObjectReference:n,consumeDraftIntent:r}=e,i=P9(),a=eI();(0,H.useEffect)(()=>{if(!r)return;let e=e=>{a.chatSessionListManager.createSession(),a.chatSessionListManager.setSelectedAgentId(`main`),e.kind===`prompt`?t(e.prompt):n(e.reference),i.chatDraftIntentManager.markConsumed(e.id)},o=i.chatDraftIntentManager.subscribe(e),s=i.chatDraftIntentManager.consumePending();return s&&e(s),o},[i,t,n,r,a])}function w5(e){if(!e||typeof e!=`object`)return null;let t=e.chatDraft;return!t||typeof t!=`object`?null:t}function Wre(e){let{applyPromptSuggestion:t,sessionKey:n,setPendingProjectRoot:r,setPendingSessionType:i}=e,a=_e(),o=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(n)return;let e=w5(a.state);if(!e)return;let s=[a.key,typeof e.sessionType==`string`?e.sessionType:``,typeof e.projectRoot==`string`?e.projectRoot:``,typeof e.prompt==`string`?e.prompt:``].join(`:`);o.current!==s&&(o.current=s,typeof e.sessionType==`string`&&e.sessionType.trim()&&i(e.sessionType),typeof e.prompt==`string`&&e.prompt.trim()&&t(e.prompt),r(typeof e.projectRoot==`string`&&e.projectRoot.trim()?e.projectRoot:null))},[t,a.key,a.state,n,r,i])}function Gre({inputQuery:e}){let t=eI(),n=e.isProviderStateResolved&&e.modelOptions.length===0,r=e.sessionTypeState.sessionTypeUnavailableMessage?.trim()||null;return(0,U.jsxs)(U.Fragment,{children:[n?(0,U.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-amber-200/70 bg-amber-50/70 flex items-center justify-between gap-3 shrink-0 sm:px-5`,children:[(0,U.jsx)(`span`,{className:`text-xs text-amber-800`,children:b(`chatModelNoOptions`)}),(0,U.jsx)(`button`,{type:`button`,onClick:t.chatUiManager.goToProviders,className:`text-xs font-semibold text-amber-900 underline-offset-2 hover:underline`,children:b(`chatGoConfigureProvider`)})]}):null,e.sessionTypeState.sessionTypeUnavailable&&r?(0,U.jsx)(`div`,{className:`px-4 py-2.5 border-b border-amber-200/70 bg-amber-50/70 shrink-0 sm:px-5`,children:(0,U.jsx)(`span`,{className:`text-xs text-amber-800`,children:r})}):null]})}function T5(e){let{consumeDraftIntent:t=!1,materializationContext:n=null,onSessionMaterialized:r,sessionKey:i,showWelcomeForDraft:a=!0}=e,o=_e(),s=i?null:w5(o.state),c=typeof s?.prompt==`string`?s.prompt:null,l=Ze(),u=aL(e=>e.snapshot.selectedAgentId),d=e3(i??void 0),f=O8(i),{inputActions:p,inputSnapshot:m}=E8(c,i),h=(0,H.useCallback)(e=>{p.update(t=>{let n=RU(t.nodes,e);return{nodes:n,text:M0(n),composerFocusRequestId:Date.now(),sendError:null}})},[p]),g=f8({sessionKey:i,inputSnapshot:m,setPendingSessionType:p.setPendingSessionType}),[_,v]=(0,H.useState)(()=>new Set),y=(0,H.useCallback)((e,t)=>{v(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,H.useEffect)(()=>{p.syncSessionPreferences({defaultModel:g.defaultModel,fallbackPreferredModel:g.fallbackPreferredModel,fallbackPreferredThinking:g.fallbackPreferredThinking,modelOptions:g.modelOptions,selectedSessionExists:!!g.selectedSession,selectedSessionKey:g.selectedSessionKey,selectedSessionType:g.sessionTypeState.selectedSessionType,selectedSessionPreferredModel:g.selectedSession?.preferredModel??void 0,selectedSessionPreferredThinking:g.selectedSession?.preferredThinking??null})},[p,g.defaultModel,g.fallbackPreferredModel,g.fallbackPreferredThinking,g.modelOptions,g.selectedSession,g.selectedSessionKey,g.sessionTypeState.selectedSessionType]),Wre({applyPromptSuggestion:p.applyPromptSuggestion,sessionKey:i,setPendingProjectRoot:p.setPendingProjectRoot,setPendingSessionType:p.setPendingSessionType});let x=t3(l),S=d.isRunning||g.selectedSession?.status===`running`,C=d.snapshot.error,w=d.hydrateError?.message??(C?.code===`run-interrupted`?null:C?.message)??null,T=l.phase===`ready`&&X4(w)?null:w,E=x?null:l.phase===`ready`?T:r3({message:T,status:l}),D=q3({agent:(0,H.useMemo)(()=>({...d,isRunning:S,isSending:d.isSending}),[d,S]),inputSnapshot:m,inputQuery:g,isRuntimeBlocked:x,materializationContext:n,runQueue:f,selectedAgentId:u,sessionKey:i,onSessionMaterialized:r,resetComposer:p.resetComposer,restoreComposer:p.restoreComposer,setSendError:p.setSendError}),O=(0,H.useMemo)(()=>{let e=new Set(d.visibleMessages.map(({id:e})=>e)),t=f.pendingInputs.flatMap(t=>t.placement===`steering`&&!e.has(t.message.id)?[{...t.message,status:`pending`}]:[]);return[...d.visibleMessages,...t]},[d.visibleMessages,f.pendingInputs]),k=(0,H.useRef)(D);(0,H.useEffect)(()=>{k.current=D},[D]);let A=(0,H.useMemo)(()=>({canEditQueuedInput:D.canEditQueuedInput,canStopGeneration:D.canStopGeneration,deleteQueuedInput:e=>k.current.deleteQueuedInput(e),editQueuedInput:e=>k.current.editQueuedInput(e),isSending:D.isSending,primaryAction:D.primaryAction,queuedInputs:D.queuedInputs,send:()=>k.current.send(),sendSteering:()=>k.current.sendSteering(),sendPresetMessage:e=>k.current.sendPresetMessage(e).catch(()=>void 0),sendDisabled:D.sendDisabled,stop:()=>k.current.stop(),stopDisabled:D.stopDisabled,steerQueuedInput:e=>k.current.steerQueuedInput(e)}),[D.canStopGeneration,D.canEditQueuedInput,D.isSending,D.primaryAction,D.queuedInputs,D.sendDisabled,D.stopDisabled]),j=(0,H.useMemo)(()=>a3(MK(d.snapshot.contextWindow)),[d.snapshot.contextWindow]),{selectedSession:M}=g,N=m.sendError?.trim()||E?.trim()||(M?.activityPreview?.state===`failed`&&M.activityPreview.statusKind!==`run-interrupted`?M.activityPreview.statusText?.trim():null)||null,P=N?(0,U.jsx)(`div`,{className:`rounded-lg border-l-2 border-destructive/40 bg-muted/45 px-3 py-2.5`,role:`status`,children:(0,U.jsx)(`pre`,{className:`max-h-32 select-text overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-muted-foreground`,children:N})}):null;Ure({consumeDraftIntent:t,applyPromptSuggestion:p.applyPromptSuggestion,applySystemObjectReference:h});let ee=(0,H.useCallback)((e,t)=>(0,U.jsx)(Hre,{contextWindow:j,controller:A,inputActions:p,inputQuery:g,inputSnapshot:m,onContextCompactingChange:y,placeholder:t,surface:e}),[j,A,p,g,m,y]),te=a&&!i&&O.length===0&&!d.isHydrating&&!D.isSending;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gre,{inputQuery:g}),(0,U.jsx)(l2,{hasPreviousMessages:d.hasPreviousMessages,historyError:d.historyError,isHistoryLoading:d.isHydrating,isLoadingPreviousMessages:d.isLoadingPreviousMessages,isSending:D.isSending,canContinue:D.canContinue,messageActionsDisabled:D.isSending||x,isContextCompacting:!!(i&&_.has(i)),bottomSlot:te?null:P,messages:O,messageDetailStates:d.messageDetailStates,sessionKey:i,showWelcome:te,onLoadPreviousMessages:d.loadPreviousMessages,onLoadMessageDetails:d.loadMessageDetails,onContinueRun:()=>k.current.continueRun(),onEditMessage:e=>k.current.editMessage(e),welcomeSlot:(0,U.jsx)(C3,{inputSlot:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[ee(`embedded`,b(`chatWelcomeInputPlaceholder`)),P]}),pendingProjectRoot:m.pendingProjectRoot,pendingSessionType:m.pendingSessionType,selectedSessionTypeValue:m.selectedSessionType,onSelectProjectRoot:p.setPendingProjectRoot,onSelectPrompt:p.applyPromptSuggestion,onSelectSessionType:p.setPendingSessionType})}),te?null:ee(`default`)]})}function E5(e){return M(e??void 0)}function D5(e){if(!e)return`-`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`-`;let n=Date.now(),r=t.getTime()-n,i=N(),a=Math.abs(r);if(a<6e4)return i===`zh`?`刚刚`:`just now`;if(a<36e5){let e=Math.round(a/6e4);return r>0?i===`zh`?`${e}分钟后`:`in ${e}m`:i===`zh`?`${e}分钟前`:`${e}m ago`}if(a<864e5){let e=Math.round(a/36e5);return r>0?i===`zh`?`${e}小时后`:`in ${e}h`:i===`zh`?`${e}小时前`:`${e}h ago`}let o=Math.round(a/864e5);return r>0?i===`zh`?`${o}天后`:`in ${o}d`:i===`zh`?`${o}天前`:`${o}d ago`}function Kre(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:M(new Date(e))}function qre(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}var Jre=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],Yre=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function O5(e){return e.padStart(2,`0`)}function Xre(e,t){let n=e.trim().split(/\s+/);if(n.length!==5)return null;let[r,i,a,o,s]=n,c=t===`zh`;if(r===`*`&&i===`*`&&a===`*`&&o===`*`&&s===`*`)return c?`每分钟`:`every minute`;if(r.startsWith(`*/`)&&i===`*`&&a===`*`&&o===`*`&&s===`*`){let e=parseInt(r.slice(2),10);if(Number.isFinite(e)&&e>0)return c?`每 ${e} 分钟`:`every ${e}m`}if(r===`0`&&i===`*`&&a===`*`&&o===`*`&&s===`*`)return c?`每小时`:`every hour`;let l=`${O5(i)}:${O5(r)}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&s===`*`)return c?`每天 ${l}`:`daily ${l}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&s===`1-5`)return c?`工作日 ${l}`:`weekdays ${l}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&(s===`0,6`||s===`6,0`))return c?`周末 ${l}`:`weekends ${l}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&/^\d$/.test(s)){let e=parseInt(s,10),t=c?Jre[e]:Yre[e];return t?`${t} ${l}`:null}return r!==`*`&&i!==`*`&&a!==`*`&&o===`*`&&s===`*`?c?`每月 ${a} 日 ${l}`:`monthly ${a} ${l}`:null}function k5(e){let t=N(),n=t===`zh`,{schedule:r}=e;if(r.kind===`cron`)return r.expr?Xre(r.expr,t)??`cron ${r.expr}`:`cron`;if(r.kind===`every`){let e=qre(r.everyMs);return n?`每 ${e}`:`every ${e}`}return r.kind===`at`?`${n?`定时`:`at`} ${Kre(r.atMs)}`:`-`}function A5(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function j5(e){return!!(e.payload.sessionId?.trim()||e.state.lastRunAt)}function Zre(e,t){let n=t?.trim();return!!(n&&e.payload.sessionId?.trim()===n)}function M5({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border/50 py-3 last:border-b-0`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,U.jsx)(`span`,{className:`max-w-[65%] break-words text-right text-xs font-medium text-foreground`,children:t})]})}function N5({job:e,open:t,onDelete:n,onOpenChange:r,onRun:i,onToggle:a}){if(!e)return null;let o=A5(e),s=!!e.payload.sessionId?.trim(),c=j5(e)?$7(o):null,l=e.state.lastStatus?b(`cronLastStatus${e.state.lastStatus[0].toUpperCase()}${e.state.lastStatus.slice(1)}`):b(`cronNeverRun`);return(0,U.jsx)(aee,{open:t,onOpenChange:r,children:(0,U.jsxs)(Rn,{side:`right`,closeLabel:b(`cronCloseDetails`),className:`flex w-full flex-col overflow-hidden p-0 sm:max-w-[510px]`,children:[(0,U.jsxs)(oee,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:k5(e)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`span`,{children:b(s?`cronBoundSession`:`cronDedicatedSession`)})]}),(0,U.jsx)(Nn,{children:e.name||e.id}),(0,U.jsx)(jn,{children:b(`cronDetailDescription`)})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:b(`cronTaskPrompt`)}),(0,U.jsx)(`div`,{className:`rounded-2xl bg-muted/55 px-4 py-3 text-sm leading-6 text-foreground`,children:e.payload.message})]}),(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:b(`cronTaskDetails`)}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(M5,{label:b(`cronScheduleLabel`),value:k5(e)}),(0,U.jsx)(M5,{label:b(`cronNextRun`),value:E5(e.state.nextRunAt)}),(0,U.jsx)(M5,{label:b(`cronAgentLabel`),value:e.payload.agentId?.trim()||`main`}),(0,U.jsx)(M5,{label:b(`cronSessionLabel`),value:c?(0,U.jsx)(ge,{href:c,size:`xs`,className:`text-[hsl(var(--link-foreground))] underline decoration-[1.2px] underline-offset-2 hover:text-[hsl(var(--link-foreground-hover))]`,children:o}):o}),(0,U.jsx)(M5,{label:b(`cronCreatedAt`),value:E5(e.createdAt)})]})]}),(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:b(`cronLatestRun`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:b(`cronLatestRunHint`)})]}),(0,U.jsx)(`span`,{className:u(`rounded-full px-2.5 py-1 text-xs font-medium`,e.state.lastStatus===`error`?`bg-red-50 text-red-700`:e.state.lastStatus===`ok`?`bg-emerald-50 text-emerald-700`:`bg-muted text-muted-foreground`),children:l})]}),(0,U.jsxs)(`div`,{className:`rounded-2xl border border-border/60 px-4 py-1`,children:[(0,U.jsx)(M5,{label:b(`cronLastRun`),value:E5(e.state.lastRunAt)}),e.state.lastError?(0,U.jsx)(M5,{label:b(`cronLastError`),value:e.state.lastError}):null]})]}),(0,U.jsxs)(`section`,{className:`flex items-center justify-between rounded-2xl border border-border/60 px-4 py-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.enabled?b(`cronEnabledState`):b(`cronPaused`)}),(0,U.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:b(`cronToggleHint`)})]}),(0,U.jsx)(Fe,{checked:e.enabled,onCheckedChange:t=>a(e,t),"aria-label":e.enabled?b(`cronDisable`):b(`cronEnable`)})]}),c?null:(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`cronSessionAvailableAfterRun`)})]}),(0,U.jsxs)(ree,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[(0,U.jsxs)(R,{variant:`ghost`,className:`text-red-600 hover:bg-red-50 hover:text-red-700`,onClick:()=>n(e),children:[(0,U.jsx)(fs,{className:`mr-2 h-4 w-4`}),b(`delete`)]}),c?(0,U.jsx)(ge,{href:c,className:u(Qt({variant:`outline`}),`hover:no-underline`),children:b(`cronOpenSession`)}):(0,U.jsx)(R,{variant:`outline`,disabled:!0,children:b(`cronOpenSession`)}),(0,U.jsxs)(R,{onClick:()=>i(e),children:[(0,U.jsx)(Uo,{className:`mr-2 h-4 w-4`}),b(`cronRunNow`)]})]})]})})}function Qre({job:e}){let t=e.state.lastStatus===`error`,n=t?b(`cronNeedsAttention`):e.enabled?b(`cronRunningNormally`):b(`cronPaused`);return(0,U.jsxs)(`span`,{className:u(`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium`,t?`bg-red-50 text-red-700`:e.enabled?`bg-emerald-50 text-emerald-700`:`bg-muted text-muted-foreground`),children:[(0,U.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,t?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-muted-foreground/50`)}),n]})}function $re({expanded:e,job:t,onDelete:n,onEdit:r,onRun:i,onToggleExpanded:a,onToggle:o}){let[s,c]=(0,H.useState)(!1),l=!!t.payload.sessionId?.trim(),d=t.state.lastStatus===`error`,f=d?ps:Ar,p=t.name||t.id,m=`cron-job-preview-${t.id}`,h=A5(t),g=j5(t)?$7(h):null;return(0,U.jsxs)(`div`,{className:u(`group relative rounded-xl border-b border-border/55 transition-colors duration-150 last:border-b-0 hover:bg-muted/35 focus-within:bg-muted/35`,e&&`bg-muted/35`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-1 py-3.5`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`grid min-w-0 flex-1 grid-cols-[36px_minmax(0,1fr)] items-center gap-3 rounded-lg pr-16 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-controls":m,"aria-expanded":e,"aria-label":`${b(e?`cronCollapseTask`:`cronExpandTask`)} ${p}`,onClick:()=>a(t),children:[(0,U.jsx)(`span`,{className:u(`flex h-9 w-9 items-center justify-center rounded-xl`,d?`bg-amber-50 text-amber-600`:`bg-emerald-50 text-emerald-600`),children:(0,U.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`strong`,{className:`truncate text-[13px] font-semibold text-foreground`,children:p}),(0,U.jsx)(Qre,{job:t}),(0,U.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:b(l?`cronBoundSession`:`cronDedicatedSession`)}),t.deleteAfterRun?(0,U.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:b(`cronOneShot`)}):null]}),(0,U.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(la,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),k5(t)]}),t.state.nextRunAt?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(ba,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),b(`cronNextRun`),` `,D5(t.state.nextRunAt)]}):null]})]})]}),(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(`div`,{className:`relative flex shrink-0 items-center`,children:[(0,U.jsxs)(`div`,{className:`absolute right-11 top-1/2 flex -translate-y-1/2 items-center gap-0.5 opacity-100 transition-opacity duration-150 [@media(hover:hover)]:pointer-events-none [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-focus-within:pointer-events-auto [@media(hover:hover)]:group-focus-within:opacity-100 [@media(hover:hover)]:group-hover:pointer-events-auto [@media(hover:hover)]:group-hover:opacity-100`,children:[(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(R,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t),"aria-label":`${b(`cronEditDetails`)} ${p}`,children:(0,U.jsx)(Ho,{className:`h-3.5 w-3.5`})})}),(0,U.jsx)(li,{children:b(`cronEditDetails`)})]}),(0,U.jsxs)(CF,{open:s,onOpenChange:c,children:[(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(R,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":`${b(`cronMoreActions`)} ${p}`,children:(0,U.jsx)(Qr,{className:`h-4 w-4`})})})}),(0,U.jsx)(li,{children:b(`cronMoreActions`)})]}),(0,U.jsxs)(EF,{align:`end`,sideOffset:4,className:`w-40 p-1`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{c(!1),i(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted`,children:[(0,U.jsx)(Uo,{className:`h-3.5 w-3.5 text-muted-foreground`}),b(`cronRunNow`)]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{c(!1),n(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 transition-colors hover:bg-red-50`,children:[(0,U.jsx)(fs,{className:`h-3.5 w-3.5`}),b(`delete`)]})]})]})]}),(0,U.jsx)(Fe,{checked:t.enabled,onCheckedChange:e=>o(t,e),"aria-label":t.enabled?b(`cronDisable`):b(`cronEnable`)})]})})]}),(0,U.jsx)(`div`,{id:m,"aria-hidden":!e,className:u(`grid transition-[grid-template-rows,opacity] duration-200 ease-out`,e?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`),children:(0,U.jsx)(`div`,{className:`overflow-hidden`,children:(0,U.jsxs)(`div`,{className:`mb-3 ml-12 mr-1 rounded-xl bg-background/70 px-4 py-3`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:b(`cronTaskPrompt`)}),(0,U.jsx)(`p`,{className:`mt-1.5 line-clamp-4 text-xs leading-5 text-foreground`,children:t.payload.message}),(0,U.jsxs)(`dl`,{className:`mt-3 grid gap-x-5 gap-y-2 border-t border-border/50 pt-3 text-[11px] sm:grid-cols-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`cronAgentLabel`)}),(0,U.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:t.payload.agentId?.trim()||`main`})]}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`cronSessionLabel`)}),(0,U.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:g?(0,U.jsx)(ge,{href:g,size:`xs`,className:`max-w-full truncate text-[11px] text-[hsl(var(--link-foreground))] underline decoration-[1.2px] underline-offset-2 hover:text-[hsl(var(--link-foreground-hover))]`,children:h}):h})]}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`cronLastRun`)}),(0,U.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:E5(t.state.lastRunAt)})]})]}),t.state.lastError?(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 border-t border-red-100 pt-3 text-[11px] leading-5 text-red-700`,children:t.state.lastError}):null]})})})]})}var P5=[{titleKey:`cronTemplateAiNewsTitle`,descriptionKey:`cronTemplateAiNewsDescription`,promptKey:`cronTemplateAiNewsPrompt`,icon:Ao},{titleKey:`cronTemplateWeeklyReviewTitle`,descriptionKey:`cronTemplateWeeklyReviewDescription`,promptKey:`cronTemplateWeeklyReviewPrompt`,icon:gee},{titleKey:`cronTemplateMeetingPrepTitle`,descriptionKey:`cronTemplateMeetingPrepDescription`,promptKey:`cronTemplateMeetingPrepPrompt`,icon:ua},{titleKey:`cronTemplateLearningTitle`,descriptionKey:`cronTemplateLearningDescription`,promptKey:`cronTemplateLearningPrompt`,icon:Ti},{titleKey:`cronTemplateCompetitorTitle`,descriptionKey:`cronTemplateCompetitorDescription`,promptKey:`cronTemplateCompetitorPrompt`,icon:fo},{titleKey:`cronTemplateFamilyTitle`,descriptionKey:`cronTemplateFamilyDescription`,promptKey:`cronTemplateFamilyPrompt`,icon:no}],F5=(0,H.forwardRef)(function({prominent:e=!1,value:t,onChange:n,onSubmit:r},i){return(0,U.jsxs)(`form`,{className:u(`relative w-full`,e&&`mx-auto max-w-3xl`),onSubmit:e=>{e.preventDefault(),r()},children:[(0,U.jsx)(Fr,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`,"aria-hidden":`true`}),(0,U.jsx)(St,{ref:i,value:t,onChange:e=>n(e.target.value),className:`pl-9 pr-11`,placeholder:b(`cronComposerPlaceholder`),"aria-label":b(`cronComposerLabel`)}),(0,U.jsx)(R,{type:`submit`,size:`icon`,className:`absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full shadow-none`,disabled:!t.trim(),"aria-label":b(`cronComposerSubmit`),children:(0,U.jsx)(aa,{className:`h-4 w-4`})})]})});function I5({compact:e=!1,onSelect:t}){return(0,U.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,17.5rem),1fr))] gap-3`,children:(e?P5.slice(0,4):P5).map(e=>{let n=e.icon;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(b(e.promptKey)),className:`group grid min-h-24 grid-cols-[38px_minmax(0,1fr)] items-center gap-3 rounded-2xl border border-border/60 bg-card px-4 py-4 text-left transition-all hover:-translate-y-0.5 hover:border-primary/20 hover:shadow-[0_12px_30px_rgba(30,45,52,0.08)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary`,children:(0,U.jsx)(n,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:b(e.titleKey)}),(0,U.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-muted-foreground`,children:b(e.descriptionKey)})]})]},e.titleKey)})})}function L5(e={all:!0}){return Sn({queryKey:[`cron`,e],queryFn:()=>Ct(e),placeholderData:e=>e,staleTime:1e4})}function R5(){let e=F();return{onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),L.success(b(`configSavedApplied`))},onError:e=>{L.error(b(`configSaveFailed`)+`: `+e.message)}}}function eie(){return z({mutationFn:({id:e})=>rn(e),...R5()})}function tie(){return z({mutationFn:({id:e,enabled:t})=>yt(e,{enabled:t}),...R5()})}function nie(){return z({mutationFn:({id:e,force:t})=>Cn(e,{force:t}),...R5()})}function z5(e){return e.name?`${e.name} (${e.id})`:e.id}function B5(){let e=eie(),t=nie(),n=tie(),{confirm:r,ConfirmDialog:i}=On(),[a,o]=(0,H.useState)(new Set),s=async(e,t,n)=>{o(t=>new Set(t).add(e.id));try{return await t(),n?.(),!0}catch{return!1}finally{o(t=>{let n=new Set(t);return n.delete(e.id),n})}};return{ConfirmDialog:i,deleteJob:async(t,n)=>await r({title:`${b(`cronDeleteConfirm`)}?`,description:z5(t),confirmLabel:b(`delete`),variant:`destructive`})?await s(t,()=>e.mutateAsync({id:t.id}),n):!1,isPending:e=>a.has(e.id),runJob:async(e,n)=>{let i=!e.enabled;return i&&!await r({title:`${b(`cronRunForceConfirm`)}?`,description:z5(e),confirmLabel:b(`cronRunNow`)})?!1:await s(e,()=>t.mutateAsync({id:e.id,force:i}),n)},toggleJob:async(e,t,r)=>await s(e,()=>n.mutateAsync({id:e.id,enabled:t}),r)}}var V5=10;function rie({summary:e}){let{attention:t,disabled:n,enabled:r,total:i}=e,a=[{label:b(`cronSummaryTotal`),value:i},{label:b(`cronSummaryEnabled`),value:r},{label:b(`cronSummaryPaused`),value:n}],o=t>0?Vr:ma;return(0,U.jsxs)(`section`,{"aria-label":b(`cronSummaryLabel`),className:`grid grid-cols-3 overflow-hidden rounded-2xl bg-border/60 sm:grid-cols-[minmax(220px,1.35fr)_repeat(3,minmax(100px,0.55fr))] sm:gap-px`,children:[(0,U.jsxs)(`div`,{className:`col-span-3 flex items-center gap-3 bg-muted/40 px-4 py-3.5 sm:col-span-1`,children:[(0,U.jsx)(`span`,{className:u(`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl`,t>0?`bg-amber-50 text-amber-600`:`bg-emerald-50 text-emerald-600`),children:(0,U.jsx)(o,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`strong`,{className:`block truncate text-xs font-semibold text-foreground`,children:t>0?`${t} ${b(`cronAttentionSummary`)}`:b(`cronAllHealthy`)}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:b(t>0?`cronAttentionSummaryHint`:`cronAllHealthyHint`)})]})]}),a.map(e=>(0,U.jsxs)(`div`,{className:`bg-muted/40 px-4 py-3.5 sm:px-5`,children:[(0,U.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:e.value}),(0,U.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.label})]},e.label))]})}function iie({page:e,total:t,disabled:n,onPageChange:r}){let i=Math.ceil(t/V5);if(i<=1)return null;let a=e*V5+1,o=Math.min(t,a+V5-1);return(0,U.jsxs)(`nav`,{"aria-label":b(`cronPaginationLabel`),className:`flex items-center justify-between gap-3 border-b border-border/60 py-3 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`tabular-nums`,children:[a,`–`,o,` / `,t]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e===0,onClick:()=>r(e-1),"aria-label":b(`cronPreviousPage`),children:(0,U.jsx)(da,{className:`h-4 w-4`})}),(0,U.jsxs)(`span`,{className:`min-w-14 text-center tabular-nums text-foreground`,children:[e+1,` / `,i]}),(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e>=i-1,onClick:()=>r(e+1),"aria-label":b(`cronNextPage`),children:(0,U.jsx)(fa,{className:`h-4 w-4`})})]})]})}function aie(){let[e,t]=(0,H.useState)(``),[n,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(`all`),[o,s]=(0,H.useState)(0),[c,l]=(0,H.useState)(null),[d,f]=(0,H.useState)(null),p=(0,H.useDeferredValue)(n.trim()),m=(0,H.useRef)(null),h=eI(),g=L5({all:!0,limit:V5,offset:o*V5,query:p,status:i}),_=B5(),v=g.data?.jobs??[],y=g.data?.total??0,x=g.data?.summary,S=v.find(e=>e.id===d)??null,C=()=>{let t=e.trim();if(!t){m.current?.focus();return}h.chatSessionListManager.createSession({prompt:t})},w=e=>{t(e),m.current?.focus()},T=e=>{_.deleteJob(e,()=>{l(null),f(null),v.length===1&&o>0&&s(o-1)})},E=(e,t)=>{_.toggleJob(e,t,()=>{(i===`enabled`&&!t||i===`disabled`&&t)&&v.length===1&&o>0&&s(o-1)})},D=e=>{_.runJob(e)},O=e=>{l(null),s(e)},k=e=>{l(t=>t===e.id?null:e.id)},A=(x?.total??0)>0;return(0,U.jsxs)(Bt,{className:`space-y-6`,children:[(0,U.jsx)(xt,{headingLevel:1,title:b(`cronPageTitle`),description:b(`cronPageDescription`),actions:(0,U.jsx)(V,{size:`lg`,label:b(`refresh`),icon:(0,U.jsx)(Oi,{className:u(`h-4 w-4`,g.isFetching&&`animate-spin`)}),onClick:()=>{o===0?(l(null),g.refetch()):O(0)}})}),A?(0,U.jsx)(F5,{ref:m,value:e,onChange:t,onSubmit:C}):null,g.isLoading?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 text-muted-foreground`,children:[(0,U.jsx)(Oi,{className:`mb-3 h-5 w-5 animate-spin`}),(0,U.jsx)(`span`,{className:`text-sm`,children:b(`cronLoading`)})]}):A?(0,U.jsxs)(U.Fragment,{children:[x?(0,U.jsx)(rie,{summary:x}):null,(0,U.jsxs)(`section`,{className:`pt-1`,children:[(0,U.jsx)(`div`,{className:`mb-3 flex items-end justify-between gap-4`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(`cronMyTasks`)}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[y,` `,b(`cronTaskCountUnit`)]})]})}),(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-[220px] flex-1`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,U.jsx)(St,{value:n,onChange:e=>{r(e.target.value),O(0)},placeholder:b(`cronSearchPlaceholder`),className:`pl-9`})]}),(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,"aria-label":b(`cronStatusLabel`),children:[[`all`,`cronStatusAll`],[`enabled`,`cronStatusEnabled`],[`disabled`,`cronStatusDisabled`],[`attention`,`cronStatusAttention`]].map(([e,t])=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>{a(e),O(0)},className:u(`rounded-lg px-2.5 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,i===e&&`bg-muted text-foreground`),children:b(t)},e))})]}),v.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"aria-busy":g.isFetching,className:u(`border-y border-border/60 transition-opacity`,g.isFetching&&`opacity-60`),children:v.map(e=>(0,U.jsx)($re,{expanded:c===e.id,job:e,onDelete:T,onEdit:e=>f(e.id),onRun:D,onToggleExpanded:k,onToggle:E},e.id))}),(0,U.jsx)(iie,{page:o,total:y,disabled:g.isFetching,onPageChange:O})]}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center text-muted-foreground`,children:[(0,U.jsx)(wi,{className:`mb-3 h-5 w-5`}),(0,U.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:b(`cronNoMatchingTasks`)}),(0,U.jsx)(`span`,{className:`mt-1 text-xs`,children:b(`cronNoMatchingTasksHint`)})]})]}),(0,U.jsxs)(`section`,{className:`pt-2`,children:[(0,U.jsxs)(`div`,{className:`mb-3`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(`cronNeedInspiration`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:b(`cronTemplateSelectionHint`)})]}),(0,U.jsx)(I5,{compact:!0,onSelect:w})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{className:`flex min-h-[270px] flex-col items-center justify-center rounded-3xl bg-muted/25 px-4 py-10 text-center sm:px-8`,children:[(0,U.jsx)(`span`,{className:`mb-4 flex h-11 w-11 items-center justify-center rounded-2xl bg-card shadow-sm`,children:(0,U.jsx)(ho,{className:`h-5 w-5 text-primary`})}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:b(`cronEmptyHeroTitle`)}),(0,U.jsx)(`p`,{className:`mb-6 mt-2 max-w-2xl text-sm leading-6 text-muted-foreground`,children:b(`cronEmptyHeroDescription`)}),(0,U.jsx)(F5,{ref:m,prominent:!0,value:e,onChange:t,onSubmit:C}),(0,U.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:b(`cronComposerHint`)})]}),(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-3`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(`cronStartFromResult`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:b(`cronTemplateSelectionHint`)})]}),(0,U.jsx)(I5,{onSelect:w})]})]}),(0,U.jsx)(N5,{job:S,open:!!S,onOpenChange:e=>{e||f(null)},onDelete:T,onRun:D,onToggle:E}),(0,U.jsx)(_.ConfirmDialog,{})]})}function oie({job:e}){let t=e.state.lastStatus===`error`,n=t?b(`cronNeedsAttention`):e.enabled?b(`cronRunningNormally`):b(`cronPaused`);return(0,U.jsxs)(`span`,{className:u(`inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium`,t?`bg-red-50 text-red-700`:e.enabled?`bg-emerald-50 text-emerald-700`:`bg-muted text-muted-foreground`),children:[(0,U.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,t?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-muted-foreground/50`)}),n]})}function sie({cronActions:e,job:t,onOpenDetails:n}){let[r,i]=(0,H.useState)(!1),a=e.isPending(t),o=t.state.lastStatus===`error`,s=o?ps:Ar,c=t.name||t.id;return(0,U.jsxs)(`article`,{className:`rounded-2xl border border-border/60 bg-background px-3.5 py-3 shadow-sm transition-colors hover:bg-muted/20 focus-within:bg-muted/20`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:u(`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl`,o?`bg-amber-50 text-amber-600`:t.enabled?`bg-emerald-50 text-emerald-600`:`bg-muted text-muted-foreground`),children:(0,U.jsx)(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:c}),(0,U.jsx)(oie,{job:t})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(la,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),k5(t)]}),t.enabled&&t.state.nextRunAt?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(ba,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),b(`cronNextRun`),` `,D5(t.state.nextRunAt)]}):null]})]}),(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`span`,{children:(0,U.jsx)(Fe,{checked:t.enabled,disabled:a,onCheckedChange:n=>{e.toggleJob(t,n)},"aria-label":t.enabled?b(`cronDisable`):b(`cronEnable`)})})}),(0,U.jsx)(li,{children:t.enabled?b(`cronDisable`):b(`cronEnable`)})]})})]}),(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-muted-foreground`,children:t.payload.message}),t.enabled?null:(0,U.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:b(`cronToggleHint`)}),t.state.lastError?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[11px] leading-5 text-red-700`,children:t.state.lastError}):null,(0,U.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-border/50 pt-2.5`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:()=>n(t),children:b(`cronEditDetails`)}),(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(CF,{open:r,onOpenChange:i,children:[(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,disabled:a,"aria-label":`${b(`cronMoreActions`)} ${c}`,children:(0,U.jsx)(Qr,{className:`h-4 w-4`})})})}),(0,U.jsx)(li,{children:b(`cronMoreActions`)})]}),(0,U.jsxs)(EF,{align:`end`,sideOffset:4,className:`w-40 p-1`,children:[(0,U.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{i(!1),e.runJob(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,U.jsx)(Uo,{className:`h-3.5 w-3.5 text-muted-foreground`}),b(`cronRunNow`)]}),(0,U.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>{i(!1),e.deleteJob(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 transition-colors hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-50`,children:b(`delete`)})]})]})})]})]})}function cie({jobs:e,isError:t=!1,isLoading:n=!1,onRetry:r}){let[i,a]=(0,H.useState)(null),o=B5(),s=e.find(e=>e.id===i)??null;return(0,U.jsxs)(`div`,{className:`h-full overflow-y-auto custom-scrollbar px-4 py-4`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:b(`chatWorkspaceSessionCronJobs`)}),(0,U.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[b(`cronTotalLabel`),`: `,e.length]})]}),n?(0,U.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:b(`cronLoading`)}):t?(0,U.jsxs)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:[(0,U.jsx)(`p`,{children:b(`cronLoadFailed`)}),r?(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-2`,onClick:r,children:b(`cronRetry`)}):null]}):e.length===0?(0,U.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:b(`chatWorkspaceCronJobEmpty`)}):(0,U.jsx)(`div`,{className:`space-y-2.5`,children:e.map(e=>(0,U.jsx)(sie,{cronActions:o,job:e,onOpenDetails:e=>a(e.id)},e.id))}),(0,U.jsx)(N5,{job:s,open:!!s,onOpenChange:e=>{e||a(null)},onDelete:e=>{o.deleteJob(e,()=>a(null))},onRun:e=>{o.runJob(e)},onToggle:(e,t)=>{o.toggleJob(e,t)}}),(0,U.jsx)(o.ConfirmDialog,{})]})}function lie({childSessionTabs:e,sessionKey:t}){let n=eI();return(0,U.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-gray-900`,children:b(`chatWorkspaceChildSessions`)}),(0,U.jsx)(`span`,{className:`rounded-full bg-gray-100 px-1.5 py-0.5 text-[10px] font-semibold tabular-nums text-gray-500`,children:e.length})]}),(0,U.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-2.5 py-1.5 text-xs font-semibold text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25 disabled:cursor-not-allowed disabled:opacity-50`,disabled:!t,onClick:()=>n.chatThreadManager.openSideChatDraft(t),children:[(0,U.jsx)(xo,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:b(`chatWorkspaceCreateChildSession`)})]})]}),e.length===0?(0,U.jsx)(`div`,{className:`py-10 text-center text-sm text-gray-500`,children:b(`chatWorkspaceChildSessionsEmpty`)}):(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`group relative flex w-full items-center rounded-lg border border-gray-200/80 bg-white transition-colors hover:border-gray-300 hover:bg-gray-50`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-3 px-3 py-3 pr-12 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/25`,onClick:()=>n.chatThreadManager.selectChildSessionDetail(e.sessionKey),children:[(0,U.jsx)(`span`,{className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-600`,children:(0,U.jsx)(Qa,{className:`h-4 w-4`})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-medium text-gray-900`,children:e.title}),e.projectName||e.sessionTypeLabel?(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-gray-500`,children:[e.sessionTypeLabel,e.projectName].filter(Boolean).join(` · `)}):null]}),(0,U.jsx)(fa,{className:`h-4 w-4 shrink-0 text-gray-300 transition-transform group-hover:translate-x-0.5 group-hover:text-gray-500`})]}),(0,U.jsx)(OF,{sessionKey:e.sessionKey,triggerSize:`sm`,triggerTone:`strong`,className:`absolute right-2 top-1/2 -translate-y-1/2 bg-white opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`})]},e.sessionKey))})]})})}function H5(e){return e===null?`—`:new Intl.NumberFormat().format(e)}function U5(e){return e===null?`—`:new Intl.NumberFormat().format(e)}function W5(e){return e===null?`—`:new Intl.NumberFormat(void 0,{style:`percent`,maximumFractionDigits:1}).format(e)}function G5({status:e}){return(0,U.jsx)(`span`,{className:u(`inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-semibold`,e===`reported`?`bg-emerald-50 text-emerald-700`:e===`partial`?`bg-amber-50 text-amber-700`:`bg-gray-100 text-gray-500`),children:b(e===`reported`?`chatWorkspaceTokenUsageReported`:e===`partial`?`chatWorkspaceTokenUsagePartial`:`chatWorkspaceTokenUsageUnavailable`)})}function K5({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`min-w-0 rounded-md bg-gray-50 px-2.5 py-2`,children:[(0,U.jsx)(`div`,{className:`truncate text-[10px] font-medium text-gray-500`,children:e}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-sm font-semibold tabular-nums text-gray-900`,children:t})]})}function uie({sessionKey:e}){let t=uL(e),n=t.data;return(0,U.jsxs)(`section`,{"aria-labelledby":`chat-workspace-token-usage-title`,className:`mt-4 rounded-lg border border-gray-200/80 bg-white p-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-600`,children:(0,U.jsx)(_ee,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`h3`,{id:`chat-workspace-token-usage-title`,className:`text-sm font-semibold text-gray-900`,children:b(`chatWorkspaceTokenUsage`)}),n?(0,U.jsx)(G5,{status:n.status}):null]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceTokenUsageDescription`)})]})]}),t.isLoading?(0,U.jsx)(`p`,{className:`py-5 text-center text-xs text-gray-500`,"aria-live":`polite`,children:b(`chatWorkspaceTokenUsageLoading`)}):t.isError?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-4 text-xs text-rose-600`,role:`alert`,children:[(0,U.jsx)(`span`,{children:b(`chatWorkspaceTokenUsageLoadFailed`)}),(0,U.jsx)(`button`,{type:`button`,className:`shrink-0 rounded px-1.5 py-1 font-semibold text-gray-700 hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25`,onClick:()=>void t.refetch(),children:b(`chatWorkspaceTokenUsageRetry`)})]}):n&&n.runCount>0?(0,U.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageTotal`),value:H5(n.totals.totalTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageInput`),value:H5(n.totals.inputTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageOutput`),value:H5(n.totals.outputTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageCachedInput`),value:H5(n.totals.cachedInputTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageCacheHitRate`),value:W5(n.totals.cacheHitRate)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageRuns`),value:String(n.runCount)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageModelCalls`),value:U5(n.modelCallCount)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageReportedModelCalls`),value:U5(n.reportedModelCallCount)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1.5 text-[11px] font-medium text-gray-700`,children:b(`chatWorkspaceTokenUsageByModel`)}),(0,U.jsx)(`div`,{className:`space-y-1.5`,children:n.models.map(e=>(0,U.jsxs)(`div`,{className:`rounded-md border border-gray-200/70 px-2.5 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-xs font-semibold text-gray-900`,title:e.model,children:e.model}),(0,U.jsx)(G5,{status:e.status})]}),(0,U.jsxs)(`div`,{className:`mt-1 text-[10px] text-gray-500`,children:[b(`chatWorkspaceTokenUsageModelRunCount`).replace(`{count}`,String(e.runCount)),` · `,b(`chatWorkspaceTokenUsageModelCallCount`).replace(`{count}`,U5(e.modelCallCount)),` · `,b(`chatWorkspaceTokenUsageModelCacheHitRate`).replace(`{rate}`,W5(e.cacheHitRate))]}),(0,U.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-1 text-[10px] sm:grid-cols-4`,children:[[b(`chatWorkspaceTokenUsageInput`),e.inputTokens],[b(`chatWorkspaceTokenUsageOutput`),e.outputTokens],[b(`chatWorkspaceTokenUsageCachedInput`),e.cachedInputTokens],[b(`chatWorkspaceTokenUsageTotal`),e.totalTokens]].map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-1 sm:block`,children:[(0,U.jsx)(`dt`,{className:`truncate text-gray-500`,children:e}),(0,U.jsx)(`dd`,{className:`shrink-0 font-semibold tabular-nums text-gray-800 sm:mt-0.5`,children:H5(t)})]},String(e)))})]},e.model))})]})]}):(0,U.jsx)(`p`,{className:`py-5 text-center text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceTokenUsageEmpty`)})]})}var die={active:`border-emerald-200 bg-emerald-50 text-emerald-700`,paused:`border-amber-200 bg-amber-50 text-amber-700`,degraded:`border-orange-200 bg-orange-50 text-orange-700`,expired:`border-gray-200 bg-gray-100 text-gray-600`,broken:`border-rose-200 bg-rose-50 text-rose-700`};function q5(e,t){return e.replace(`{count}`,String(t))}function fie(e){return b(`chatWorkspaceContinuousAttentionStatus${e[0].toUpperCase()}${e.slice(1)}`)}function J5(e){return b(e===`context`?`chatWorkspaceContinuousAttentionState`:`chatWorkspaceContinuousAttentionEvents`)}function pie({item:e,isPending:t,onAction:n}){let r=e.status===`active`||e.status===`paused`,i=e.status===`active`?`pause`:`resume`,a=b(i===`pause`?`chatWorkspaceContinuousAttentionPause`:`chatWorkspaceContinuousAttentionResume`);return(0,U.jsxs)(`article`,{className:`rounded-xl border border-gray-200/80 bg-white p-3 shadow-sm`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:e.kind===`context`?(0,U.jsx)(Ma,{className:`h-4 w-4`}):(0,U.jsx)(ao,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.title}),(0,U.jsx)(`span`,{className:u(`rounded-full border px-1.5 py-0.5 text-[10px] font-medium`,die[e.status]),children:fie(e.status)})]}),(0,U.jsxs)(`p`,{className:`mt-0.5 truncate text-[11px] text-gray-400`,children:[e.extensionId,` · `,J5(e.kind)]}),e.description?(0,U.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-gray-600`,children:e.description}):null,e.statusReason?(0,U.jsxs)(`p`,{className:`mt-2 flex gap-1.5 text-xs leading-5 text-orange-700`,children:[(0,U.jsx)(ps,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:e.statusReason})]}):null,e.safeConfigPreview?(0,U.jsx)(`p`,{className:`mt-2 rounded-md bg-gray-50 px-2 py-1.5 text-[11px] leading-5 text-gray-500`,children:e.safeConfigPreview}):null,(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-gray-400`,children:[(0,U.jsxs)(`span`,{children:[b(`chatWorkspaceContinuousAttentionCreated`),`: `,M(e.createdAt)]}),e.expiresAt?(0,U.jsxs)(`span`,{children:[b(`chatWorkspaceContinuousAttentionExpires`),`: `,M(e.expiresAt)]}):null,e.lastReadAt?(0,U.jsxs)(`span`,{children:[b(`chatWorkspaceContinuousAttentionLastRead`),`: `,M(e.lastReadAt)]}):null,e.kind===`events`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:q5(b(`chatWorkspaceContinuousAttentionPending`),e.pendingCount??0)}),e.suppressedCount?(0,U.jsx)(`span`,{children:q5(b(`chatWorkspaceContinuousAttentionSuppressed`),e.suppressedCount)}):null,e.deliveryFailureCount?(0,U.jsx)(`span`,{className:`text-rose-600`,children:q5(b(`chatWorkspaceContinuousAttentionFailures`),e.deliveryFailureCount)}):null]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-2 border-t border-gray-100 pt-2`,children:[r?(0,U.jsxs)(`button`,{type:`button`,"data-testid":`observation-${e.id}-${i}`,disabled:t,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>n(i),children:[i===`pause`?(0,U.jsx)(Bo,{className:`h-3.5 w-3.5`}):(0,U.jsx)(Uo,{className:`h-3.5 w-3.5`}),t?b(`chatWorkspaceContinuousAttentionUpdating`):a]}):null,(0,U.jsxs)(`button`,{type:`button`,"data-testid":`observation-${e.id}-remove`,disabled:t,className:`inline-flex items-center gap-1.5 rounded-md border border-rose-200 px-2.5 py-1.5 text-xs font-medium text-rose-700 transition-colors hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>n(`remove`),children:[(0,U.jsx)(fs,{className:`h-3.5 w-3.5`}),b(`chatWorkspaceContinuousAttentionRemove`)]})]})]})}function mie({sessionKey:e}){let[t,n]=(0,H.useState)(`context`),[r,i]=(0,H.useState)(!1),a=fL(e),o=pL(e),{confirm:s,ConfirmDialog:c}=On();if(!e)return null;let l=a.data,d=t===`context`?l?.bindings??[]:l?.subscriptions??[],f=async(e,t)=>{if(!(t===`remove`&&!await s({title:b(`chatWorkspaceContinuousAttentionRemoveTitle`),description:b(`chatWorkspaceContinuousAttentionRemoveDescription`),confirmLabel:b(`chatWorkspaceContinuousAttentionRemove`),variant:`destructive`}))){i(!1);try{await o.mutateAsync({kind:e.kind,id:e.id,action:t})}catch{i(!0)}}};return(0,U.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,U.jsx)(c,{}),(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,U.jsx)(Ma,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:b(`chatWorkspaceContinuousAttention`)}),(0,U.jsxs)(`p`,{className:`mt-1 break-all text-xs leading-5 text-gray-500`,children:[b(`chatWorkspaceContinuousAttentionDescription`),` · `,e]})]})]}),l?(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionTotal`),value:l.counts.total}),(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionState`),value:l.counts.context}),(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionEvents`),value:l.counts.events}),(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionNeedsAttention`),value:l.counts.needsAttention})]}):null,(0,U.jsx)(`div`,{className:`mt-4 flex rounded-lg border border-gray-200 bg-white p-1`,role:`tablist`,children:[`context`,`events`].map(e=>{let r=e===`context`?l?.counts.context??0:l?.counts.events??0;return(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e,className:u(`flex-1 rounded-md px-3 py-2 text-xs font-medium transition-colors`,t===e?`bg-gray-100 text-gray-900`:`text-gray-500 hover:text-gray-700`),onClick:()=>n(e),children:[J5(e),` `,(0,U.jsx)(`span`,{className:`ml-1 tabular-nums text-gray-400`,children:r})]},e)})}),r?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-rose-600`,children:b(`chatWorkspaceContinuousAttentionActionFailed`)}):null,a.isPending?(0,U.jsx)(`div`,{className:`mt-3 space-y-2`,"aria-label":b(`chatWorkspaceContinuousAttentionLoading`),children:[0,1].map(e=>(0,U.jsx)(`div`,{className:`h-28 animate-pulse rounded-xl border border-gray-200 bg-white`},e))}):a.isError?(0,U.jsxs)(`div`,{className:`mt-4 rounded-xl border border-rose-200 bg-rose-50 px-4 py-5 text-center`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-rose-800`,children:b(`chatWorkspaceContinuousAttentionLoadFailed`)}),(0,U.jsxs)(`button`,{type:`button`,className:`mt-3 inline-flex items-center gap-1.5 rounded-md border border-rose-200 bg-white px-3 py-1.5 text-xs font-medium text-rose-700`,onClick:()=>void a.refetch(),children:[(0,U.jsx)(Oi,{className:`h-3.5 w-3.5`}),b(`chatWorkspaceContinuousAttentionRetry`)]})]}):d.length===0?(0,U.jsxs)(`div`,{className:`mt-4 rounded-xl border border-dashed border-gray-300 bg-white px-4 py-8 text-center`,children:[(0,U.jsx)(ya,{className:`mx-auto h-5 w-5 text-gray-300`}),(0,U.jsx)(`p`,{className:`mt-2 text-sm font-medium text-gray-700`,children:b(`chatWorkspaceContinuousAttentionEmpty`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceContinuousAttentionEmptyDescription`)})]}):(0,U.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,U.jsx)(pie,{item:e,isPending:o.isPending&&o.variables?.id===e.id,onAction:t=>void f(e,t)},`${e.kind}:${e.id}`))})]})})}function Y5({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`rounded-lg border border-gray-200/80 bg-white px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-gray-400`,children:e}),(0,U.jsx)(`div`,{className:`mt-1 text-lg font-semibold tabular-nums text-gray-900`,children:t})]})}function hie({fileActive:e,projectFilesActive:t}){let n=eI(),r=(0,H.useRef)(null),i=(0,H.useRef)(null),a=$(e=>e.snapshot.workspaceExplorerOpen),o=$(e=>e.snapshot.workspaceExplorerWidth),s=$(e=>e.setSnapshot),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=u??o,p=(0,H.useCallback)(e=>s({workspaceExplorerOpen:e}),[s]);return(0,H.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>l(e.getBoundingClientRect().width<560);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,H.useEffect)(()=>{if(!e||!c||!a)return;let t=e=>{e.key===`Escape`&&p(!1)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[c,a,e,p]),{compact:c,containerRef:r,explorerOpen:a,explorerOverlay:e&&c&&a,explorerWidth:f,onResizeStart:t=>{if(c||!e)return;t.preventDefault(),t.currentTarget.setPointerCapture?.(t.pointerId),i.current={startX:t.clientX,startWidth:f,width:f};let r=e=>{let t=i.current;if(!t)return;let n=AR(t.startWidth+e.clientX-t.startX);t.width=n,d(n)},a=()=>{let e=i.current?.width;typeof e==`number`&&n.chatThreadManager.setWorkspaceExplorerWidth(e),d(null),i.current=null,window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)},setExplorerOpen:p,showExplorer:t||e&&a}}function X5({count:e,description:t,icon:n,onClick:r,title:i}){return(0,U.jsxs)(`button`,{type:`button`,className:`group flex w-full items-center gap-3 rounded-lg border border-gray-200/80 bg-white px-3 py-3 text-left transition-colors hover:border-gray-300 hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25`,onClick:r,children:[(0,U.jsx)(`span`,{className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-600`,children:n}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:i}),typeof e==`number`?(0,U.jsx)(`span`,{className:`rounded-full bg-gray-100 px-1.5 py-0.5 text-[10px] font-semibold tabular-nums text-gray-500`,children:e}):null]}),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-gray-500`,children:t})]}),(0,U.jsx)(fa,{className:`h-4 w-4 shrink-0 text-gray-300 transition-transform group-hover:translate-x-0.5 group-hover:text-gray-500`})]})}function gie({childSessionTabs:e,sessionCronJobs:t,sessionKey:n}){let r=eI(),i=fL(n);return(0,U.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:b(`chatWorkspaceOverview`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceOverviewDescription`)}),(0,U.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,U.jsx)(X5,{count:i.data?.counts.total??0,description:b(`chatWorkspaceContinuousAttentionDescription`),icon:(0,U.jsx)(Ma,{className:`h-4 w-4`}),title:b(`chatWorkspaceContinuousAttention`),onClick:()=>{n&&r.chatThreadManager.openContinuousAttention(n)}}),(0,U.jsx)(X5,{count:e.length,description:b(`chatWorkspaceChildSessionsDescription`),icon:(0,U.jsx)(Qa,{className:`h-4 w-4`}),title:b(`chatWorkspaceChildSessions`),onClick:()=>{n&&r.chatThreadManager.openChildSessions(n)}}),(0,U.jsx)(X5,{count:t.length,description:b(`chatWorkspaceSessionCronJobsDescription`),icon:(0,U.jsx)(ra,{className:`h-4 w-4`}),title:b(`chatWorkspaceSessionCronJobs`),onClick:()=>{n&&r.chatThreadManager.openSessionCronPanel(n)}}),(0,U.jsx)(X5,{description:b(`chatWorkspaceProjectFilesDescription`),icon:(0,U.jsx)(Ka,{className:`h-4 w-4`}),title:b(`chatWorkspaceProjectFiles`),onClick:()=>{n&&r.chatThreadManager.openProjectFiles(n)}})]}),(0,U.jsx)(uie,{sessionKey:n})]})})}function _ie({activePath:e,onFileOpen:t,projectRoot:n,sessionKey:r,workingDir:i}){let a=eI(),o=n??i,s=MF({path:o,includeFiles:!0,enabled:!!o});return o?(0,U.jsx)(AJ,{activeRelativePath:e?xI({path:e,sessionProjectRoot:o}):null,browseQuery:s,onFileOpen:t??a.chatThreadManager.openFilePreview,sessionKey:r,renderStatus:({text:e,tone:t=`muted`})=>(0,U.jsx)(`div`,{className:u(`flex h-full items-center justify-center px-6 text-center text-sm`,t===`error`?`text-rose-600`:`text-gray-500`),children:e}),showRoot:!0},o):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-gray-500`,children:b(`chatWorkspaceProjectFilesUnavailable`)})}function vie(){return(0,U.jsxs)(`div`,{className:`border-b border-gray-200/70 px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-gray-900`,children:[(0,U.jsx)(xo,{className:`h-4 w-4 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`chatWorkspaceSideChatDraftTitle`)})]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceSideChatDraftSubtitle`)})]})}function yie({activeSelection:e,childSessionTabs:t,filePreviewRefreshVersion:n,sessionKey:r,sessionCronJobs:i,sessionCronJobsError:a=!1,sessionCronJobsLoading:o=!1,sessionProjectRoot:s,sessionWorkingDir:c,onRetrySessionCronJobs:l,explorerControl:u}){let d=eI();return e.kind===`overview`?(0,U.jsx)(gie,{childSessionTabs:t,sessionCronJobs:i,sessionKey:r}):e.kind===`child-sessions`?(0,U.jsx)(lie,{childSessionTabs:t,sessionKey:r}):e.kind===`continuous-attention`?(0,U.jsx)(mie,{sessionKey:r}):e.kind===`side-chat-draft`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(vie,{}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,U.jsx)(T5,{materializationContext:{kind:`child`,parentSessionKey:e.draft.parentSessionKey,inheritContext:!0},sessionKey:null,showWelcomeForDraft:!1,onSessionMaterialized:t=>d.chatThreadManager.materializeSideChatDraft({draftKey:e.draft.draftKey,sessionKey:t})})})]}):e.kind===`child-session`?(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,U.jsx)(T5,{sessionKey:e.tab.sessionKey})}):e.kind===`file`?(0,U.jsx)(_Y,{breadcrumbLeading:(0,U.jsx)(V,{"data-testid":`workspace-explorer-toggle`,icon:u?.open?(0,U.jsx)(Po,{className:`h-4 w-4`}):(0,U.jsx)(Io,{className:`h-4 w-4`}),label:b(u?.open?`chatWorkspaceHideProjectFiles`:`chatWorkspaceShowProjectFiles`),size:`sm`,tooltipSide:`bottom`,onClick:u?.onToggle}),file:e.file,refreshVersion:n,sessionProjectRoot:s,sessionWorkingDir:c,onFileOpen:d.chatThreadManager.openFilePreview,onTextExcerptAdd:e=>{d.chatComposerIntentManager.requestExcerptReference({targetSessionKey:r,...e})}}):(0,U.jsx)(cie,{jobs:i,isError:a,isLoading:o,onRetry:l})}function bie({activeSelection:e,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,...i}){let a=e.kind===`project-files`,o=e.kind===`file`,s=eI(),{compact:c,containerRef:l,explorerOpen:d,explorerOverlay:f,explorerWidth:p,onResizeStart:m,setExplorerOpen:h,showExplorer:g}=hie({fileActive:o,projectFilesActive:a});return(0,U.jsxs)(`div`,{ref:l,"data-testid":`workspace-shared-explorer-layout`,className:`relative flex h-full min-h-0 flex-1 overflow-hidden`,children:[f?(0,U.jsx)(`button`,{"data-testid":`workspace-explorer-scrim`,type:`button`,"aria-label":b(`chatWorkspaceHideProjectFiles`),className:`absolute inset-0 z-10 bg-black/15`,onClick:()=>h(!1)}):null,(0,U.jsxs)(`div`,{"data-testid":`workspace-shared-explorer`,"data-theme-surface":`workspace-explorer`,"data-mode":a?`full`:f?`overlay`:`side`,className:u(`relative min-h-0 shrink-0 flex-col border-r border-gray-200/80 bg-white`,g?`flex`:`hidden`,a?`flex-1 border-r-0`:null,f?`absolute inset-y-0 left-0 z-20 w-[min(320px,86%)] shadow-xl`:null),style:!a&&!f?{width:p}:void 0,"aria-hidden":!g,children:[(0,U.jsx)(_ie,{activePath:o?e.file.path:null,onFileOpen:e=>{c&&h(!1),s.chatThreadManager.openFilePreview(e)},projectRoot:n,sessionKey:t,workingDir:r}),o&&!c?(0,U.jsx)(`div`,{"data-testid":`workspace-explorer-resize-handle`,"aria-label":b(`chatWorkspaceResizeProjectFiles`),"aria-orientation":`vertical`,"aria-valuemax":400,"aria-valuemin":192,"aria-valuenow":p,role:`separator`,className:`absolute inset-y-0 right-[-4px] z-20 w-2 cursor-ew-resize hover:bg-primary/10`,onPointerDown:m}):null]}),a?null:(0,U.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,U.jsx)(yie,{...i,activeSelection:e,explorerControl:o?{open:d,onToggle:()=>h(!d)}:void 0,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r})})]})}function xie({sessionKey:e,childSessionTabs:t,activeChildSessionKey:n,activeSideChatDraft:r,workspaceFileTabs:i,activeWorkspaceFileKey:a,closedWorkspaceTabEntries:o,workspaceNavigationHistory:s=[],workspaceNavigationHistoryIndex:c=0,activePanelKind:l,sessionCronJobs:d=[],sessionCronJobsError:f=!1,sessionCronJobsLoading:p=!1,onRetrySessionCronJobs:m,sessionProjectRoot:h,sessionWorkingDir:g,workspacePanelWidth:_=480,displayMode:v=`docked`}){let y=eI(),b=F(),[x,S]=(0,H.useState)(!1),[C,w]=(0,H.useState)(0),T=hz(t),E=aL(e=>e.optimisticReadAtBySessionKey),D=_z({activeChildSessionKey:n,activeSideChatDraft:r,activeWorkspaceFileKey:a,activePanelKind:l,childSessionTabs:T,workspaceFileTabs:i}),O={entries:s,index:c};(0,H.useEffect)(()=>{y.chatThreadManager.syncVisibleWorkspaceSelection(D)},[D,y]);let k=(0,H.useMemo)(()=>yz({hasSession:!!e,resolvedChildTabs:T,activeSideChatDraft:r,closedWorkspaceTabEntries:o,workspaceFileTabs:i,activeSelection:D,optimisticReadAtBySessionKey:E,sessionProjectRoot:h??g,onAddFileToChat:({label:t,tokenKey:n})=>{y.chatComposerIntentManager.requestFileReference({targetSessionKey:e,tokenKey:n,label:t})},onSelectSession:y.chatThreadManager.selectChildSessionDetail,onSelectFile:y.chatThreadManager.selectWorkspaceFile,onOpenFileViewer:y.chatThreadManager.openWorkspaceFileViewer,onCloseTab:y.chatThreadManager.closeWorkspaceTab,onSelectOverview:()=>{e&&y.chatThreadManager.openWorkspaceOverview(e)},onSelectChildSessions:()=>{e&&y.chatThreadManager.openChildSessions(e)},onSelectProjectFiles:()=>{y.chatThreadManager.openProjectFiles(e)},onSelectCronJobs:()=>{e&&y.chatThreadManager.openSessionCronPanel(e)},onSelectContinuousAttention:()=>{e&&y.chatThreadManager.openContinuousAttention(e)}}),[D,r,o,E,y.chatThreadManager,y.chatComposerIntentManager,T,e,h,g,i]);if(!D)return null;let A=v===`docked`&&x,j=v===`overlay`||A,M=D.kind===`file`&&D.file.viewMode===`preview`?D.file:null,N=M?()=>{b.invalidateQueries({queryKey:$J({path:M.path,basePath:g})}),b.invalidateQueries({queryKey:jF({path:M.path,basePath:g,includeFiles:!0})}),w(e=>e+1)}:void 0;return(0,U.jsxs)(mi,{"data-testid":`chat-session-workspace-panel`,"data-theme-surface":`workspace-panel`,className:u(j?`bg-white`:`hidden border-gray-200/70 bg-white/95 backdrop-blur-sm md:flex`,A?`shadow-xl`:null),defaultWidth:_,width:_,minWidth:360,maxWidth:860,onWidthCommit:y.chatThreadManager.setWorkspacePanelWidth,overlay:j,overlayScope:A?`container`:`viewport`,children:[(0,U.jsx)(TU,{tabs:k,canGoBack:ai(O),canGoForward:fi(O),isMaximized:A,onGoBack:y.chatThreadManager.goBackWorkspacePanel,onGoForward:y.chatThreadManager.goForwardWorkspacePanel,onRefreshFile:N,onToggleMaximize:v===`docked`?()=>S(e=>!e):void 0,onClose:y.chatThreadManager.closeWorkspacePanel}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-white`,children:(0,U.jsx)(bie,{activeSelection:D,childSessionTabs:T,filePreviewRefreshVersion:C,sessionKey:e,sessionCronJobs:d,sessionCronJobsError:f,sessionCronJobsLoading:p,onRetrySessionCronJobs:m,sessionProjectRoot:h,sessionWorkingDir:g})})]})}var Sie=[];function Cie(e,t){let n=eR(e=>e.snapshot.sessionsQuery?.data?.sessions??Sie),r=(0,H.useMemo)(()=>{let r=e.childSessionTabs.filter(e=>e.parentSessionKey===t),i=new Set(r.map(e=>e.sessionKey));return[...r,...qI(n).filter(e=>e.parentSessionId===t&&!i.has(e.key)).map(e=>({sessionKey:e.key,parentSessionKey:t}))]},[t,n,e.childSessionTabs]),i=(0,H.useMemo)(()=>e.workspaceFileTabs.filter(e=>e.parentSessionKey===t),[t,e.workspaceFileTabs]),a=e.activeSideChatDraft?.parentSessionKey===t?e.activeSideChatDraft:null,o=L5({all:!0});return{childSessionTabs:r,activeSideChatDraft:a,workspaceFileTabs:i,sessionCronJobs:(0,H.useMemo)(()=>(o.data?.jobs??[]).filter(e=>Zre(e,t)),[o.data?.jobs,t]),sessionCronJobsError:o.isError,sessionCronJobsLoading:o.isLoading,retrySessionCronJobs:()=>{o.refetch()},showWorkspacePanel:e.workspacePanelParentKey===t&&e.activeWorkspacePanelKind!=null}}function wie({layoutMode:e,sessionKey:t}){let n=$(e=>e.snapshot),r=eR(e=>pI(e.snapshot.configQuery?.data?.agents.defaults.workspace)),i=yR(t),a=t?null:n.draftProjectRoot??r,{childSessionTabs:o,activeSideChatDraft:s,workspaceFileTabs:c,sessionCronJobs:l,sessionCronJobsError:u,sessionCronJobsLoading:d,retrySessionCronJobs:f,showWorkspacePanel:p}=Cie(n,t);return p?(0,U.jsx)(xie,{sessionKey:t,childSessionTabs:t?o:[],activeChildSessionKey:n.activeChildSessionKey??null,activeSideChatDraft:s,workspaceFileTabs:c,activeWorkspaceFileKey:n.activeWorkspaceFileKey??null,closedWorkspaceTabEntries:n.closedWorkspaceTabEntries,workspaceNavigationHistory:n.workspaceNavigationHistory,workspaceNavigationHistoryIndex:n.workspaceNavigationHistoryIndex,activePanelKind:n.activeWorkspacePanelKind??null,sessionCronJobs:t?l:[],sessionCronJobsError:t?u:!1,sessionCronJobsLoading:t?d:!1,onRetrySessionCronJobs:f,sessionProjectRoot:i?.projectRoot??a,sessionWorkingDir:i?.workingDir??i?.projectRoot??a,workspacePanelWidth:n.workspacePanelWidth,displayMode:e===`mobile`?`overlay`:`docked`}):null}function Z5({layoutMode:e=`desktop`,onBackToList:t}){let n=eI(),r=aL(e=>e.snapshot.selectedSessionKey);return(0,U.jsxs)(`section`,{"data-theme-surface":`workspace`,className:`relative flex-1 min-h-0 flex overflow-hidden bg-background`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,U.jsx)(pz,{}),(0,U.jsx)(fz,{layoutMode:e,onBackToList:t}),(0,U.jsx)(T5,{consumeDraftIntent:!0,sessionKey:r,onSessionMaterialized:n.chatThreadManager.materializeRootDraftSession})]}),(0,U.jsx)(wie,{layoutMode:e,sessionKey:r})]})}function Tie(){let e=uc(),[t,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(``),[a,o]=(0,H.useState)(null),s=e=>{n(e.key),i(e.label?.trim()??``)},c=()=>{n(null),i(``),o(null)};return{editingSessionKey:t,draftLabel:r,savingSessionKey:a,setDraftLabel:i,startEditingSessionLabel:s,cancelEditingSessionLabel:c,saveSessionLabel:async t=>{let n=r.trim();if(n===(t.label?.trim()??``)){c();return}o(t.key);try{await e({sessionKey:t.key,label:n||null}),c()}catch{o(null)}}}}var Q5=`nextclaw.ui.theme`,$5=`work`,e7=[{value:`work`,labelKey:`themeWork`,appearance:`light`},{value:`night`,labelKey:`themeNight`,appearance:`dark`},{value:`charcoal`,labelKey:`themeCharcoal`,appearance:`dark`},{value:`island`,labelKey:`themeIsland`,appearance:`light`},{value:`natural`,labelKey:`themeNatural`,appearance:`light`},{value:`minimal`,labelKey:`themeMinimal`,appearance:`light`},{value:`warm`,labelKey:`themeWarm`,appearance:`light`},{value:`cool`,labelKey:`themeCool`,appearance:`light`},{value:`dawn`,labelKey:`themeDawn`,appearance:`light`},{value:`graphite`,labelKey:`themeGraphite`,appearance:`light`},{value:`probe`,labelKey:`themeProbe`,appearance:`light`}],Eie=e7.map(({value:e})=>e),t7=e7.map(({value:e,labelKey:t})=>({value:e,labelKey:t}));function n7(e){return typeof e==`string`?Eie.includes(e)?e:e===`leaf`?`warm`:null:null}function r7(e){return e7.find(t=>t.value===e)?.appearance??`light`}var i7=new class{constructor(){this.activeTheme=$5,this.initialized=!1,this.listeners=new Set,this.resolveInitialTheme=()=>{if(typeof window>`u`)return $5;try{let e=n7(window.localStorage.getItem(Q5));if(e)return e}catch{}return $5},this.initializeTheme=()=>(this.initialized||=(this.activeTheme=this.resolveInitialTheme(),this.applyThemeAttribute(this.activeTheme),!0),this.activeTheme),this.getTheme=()=>this.initialized?this.activeTheme:this.initializeTheme(),this.setTheme=e=>{this.initializeTheme(),e!==this.activeTheme&&(this.activeTheme=e,this.applyThemeAttribute(this.activeTheme),this.saveTheme(this.activeTheme),this.listeners.forEach(e=>e(this.activeTheme)))},this.subscribeThemeChange=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.applyThemeAttribute=e=>{if(typeof document>`u`)return;let t=r7(e);document.documentElement.setAttribute(`data-theme`,e),document.documentElement.setAttribute(`data-theme-appearance`,t),document.documentElement.style.colorScheme=t},this.saveTheme=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(Q5,e)}catch{}}}};function Die(){return i7.initializeTheme()}function Oie(){return i7.getTheme()}function kie(e){i7.setTheme(e)}function Aie(e){return i7.subscribeThemeChange(e)}var a7=`nextclaw-pwa-install-banner-dismissed`,o7=`nextclaw-pwa-install-banner-dismissed-until`;function s7(){let e=l7();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Mie(e):!1}function jie(){let e=l7();e?.setItem(a7,`1`),e?.removeItem(o7)}function c7(){let e=l7();e?.removeItem(a7),e?.removeItem(o7)}function l7(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Mie(e){let t=e.getItem(o7);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(o7),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(a7,`1`),!0)}function u7(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:s7()}}var d7=P(()=>u7()),f7=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),d7.setState(u7())},this.refreshState=()=>{let e=this.resolveInstallability();d7.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:s7()}))},this.dismissInstallPrompt=()=>{jie(),d7.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(c7(),this.refreshState(),L.success(b(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,c7(),d7.setState({dismissedInstallPrompt:!0}),L.success(b(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function Nie(){let e=d7(e=>e.installability);return(0,U.jsx)(`span`,{className:u(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:Pie(e)})}function Pie(e){return b(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function Fie(e,t,n){return b(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function Iie(){let e=d7(e=>e.installability),t=d7(e=>e.installMethod),n=d7(e=>e.blockedReason);return(0,U.jsx)(Yt,{title:b(`pwaInstallTitle`),description:b(`pwaInstallDescription`),actions:(0,U.jsx)(Nie,{}),children:(0,U.jsx)(gt,{children:(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:Fie(e,t,n)}),e===`available`&&t===`prompt`?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsxs)(R,{type:`button`,className:`gap-2`,onClick:()=>void f7.promptInstall(),children:[(0,U.jsx)(Oa,{className:`h-4 w-4`}),b(`pwaInstallAction`)]}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:b(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,U.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-background/65 p-4`,children:[(0,U.jsx)(ns,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,U.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:b(`pwaInstallManualHint`)})]}):null]})})})}function Lie(){let e=d7(e=>e.installability),t=d7(e=>e.installMethod),n=d7(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,U.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:b(`pwaInstallBannerTitle`)}),(0,U.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:b(`pwaInstallBannerDescription`)})]}),(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{f7.dismissInstallPrompt()},children:(0,U.jsx)(ki,{className:`h-4 w-4`})})]}),(0,U.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,U.jsxs)(R,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{f7.promptInstall()},children:[(0,U.jsx)(Oa,{className:`h-4 w-4`}),b(`pwaInstallAction`)]}),(0,U.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{f7.dismissInstallPrompt()},children:b(`pwaInstallDismiss`)})]})]})}var Rie=new class{constructor(){this.started=!1,this.registration=null,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{this.registration=await navigator.serviceWorker.register(`/sw.js`)}catch{return}}},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(this.started=!1,this.registration=null)},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));await Promise.all(e.map(async e=>await e.unregister())),e.length>0&&await this.clearNextClawCaches()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))}}},p7=!1;function zie(){p7||typeof window>`u`||(p7=!0,f7.start(),Rie.start())}var Bie={natural:`#FAF9F7`,work:`#FFFFFF`,minimal:`#FFFFFF`,warm:`#FAF8F4`,cool:`#F8FAFC`,dawn:`#FAF7F4`,graphite:`#F8F8F7`,night:`#101318`,charcoal:`#1C1C1C`,island:`#FBF8ED`,probe:`#FEFCF6`},Vie=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=Bie[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=r7(e)},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`);this.syncTheme(n7(e)??`work`)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},m7=(0,H.createContext)(null);function Hie({children:e}){let[t,n]=(0,H.useState)(()=>Die());(0,H.useEffect)(()=>{Vie.syncTheme(t)},[t]),(0,H.useEffect)(()=>Aie(e=>{n(e)}),[]);let r=(0,H.useCallback)(e=>{kie(e),n(Oie())},[]),i=(0,H.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,U.jsx)(m7.Provider,{value:i,children:e})}function h7(){let e=(0,H.useContext)(m7);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function g7({children:e,metrics:t,title:n}){return(0,U.jsx)(ci,{delayDuration:350,skipDelayDuration:100,children:(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:e}),(0,U.jsxs)(li,{side:`right`,align:`start`,sideOffset:10,collisionPadding:12,className:`pointer-events-none w-64 rounded-xl border-border/80 bg-popover p-3 text-popover-foreground shadow-[0_18px_48px_-24px_rgba(15,23,42,0.45)]`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold leading-5`,children:n}),(0,U.jsx)(`div`,{className:`mt-2 space-y-0.5`,children:t.map(e=>(0,U.jsxs)(`div`,{className:`flex h-5 min-w-0 items-center gap-2 text-xs leading-5`,children:[(0,U.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:e.icon}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:e.label}),(0,U.jsx)(`span`,{className:`min-w-0 max-w-40 truncate tabular-nums text-foreground/80`,children:e.value})]},e.label))})]})]})})}function Uie({sessionKey:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(St,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:b(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-border bg-background text-xs`,autoFocus:!0,disabled:n}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0 truncate text-[11px] text-muted-foreground/65`,children:e}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(V,{icon:(0,U.jsx)(Ar,{className:`h-3.5 w-3.5`}),label:b(`save`),tooltip:!1,onClick:()=>void i(),disabled:n}),(0,U.jsx)(V,{icon:(0,U.jsx)(ki,{className:`h-3.5 w-3.5`}),label:b(`cancel`),tooltip:!1,onClick:a,disabled:n})]})]})]})}function Wie({sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:c,agentId:l,agentLabel:d,agentAvatarUrl:f,childSessionCount:p=0,cronJobCount:m=0,projectName:h,onSelect:g,onStartEditing:_,onTogglePinned:v,onDelete:y}){return(0,U.jsxs)(`div`,{className:`group/session relative`,children:[(0,U.jsx)(g7,{title:o,metrics:[{icon:(0,U.jsx)(Ya,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextProject`),value:h},{icon:(0,U.jsx)(Qa,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextChildSessions`),value:p},{icon:(0,U.jsx)(ra,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextScheduledTasks`),value:m}],children:(0,U.jsxs)(`button`,{type:`button`,onClick:g,className:`w-full text-left`,children:[(0,U.jsx)(`div`,{className:u(`flex min-h-6 min-w-0 items-center`,r&&`pr-6`,`group-hover/session:pr-20 group-has-[[data-session-actions]:focus-within]/session:pr-20`),children:(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[l?.trim()&&l.trim().toLowerCase()!==`main`?(0,U.jsx)(az,{agentId:l,displayName:d,avatarUrl:f,className:`h-5 w-5 shrink-0`}):null,(0,U.jsx)(`span`,{className:`truncate leading-6 font-medium`,children:o}),i.label?(0,U.jsx)(`span`,{className:u(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,t?`border-border/70 bg-background/80 text-foreground/75`:`border-transparent bg-muted/70 text-muted-foreground`),children:i.label}):null,i.icon?(0,U.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,U.jsx)(KL,{icon:i.icon,className:u(`h-[13px] w-[13px]`,t?`text-foreground/75`:`text-muted-foreground`)})}):null]})}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground/65`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),n?(0,U.jsx)(`span`,{"aria-label":b(`chatSessionUnread`),className:`ml-auto h-2 w-2 shrink-0 rounded-full bg-primary`}):(0,U.jsx)(`span`,{className:`ml-auto shrink-0`,children:c})]})]})}),r?(0,U.jsx)(`span`,{className:`absolute right-0 top-0 inline-flex h-6 w-6 items-center justify-center transition-opacity group-hover/session:opacity-0`,children:(0,U.jsx)(JL,{status:r})}):null,(0,U.jsxs)(`div`,{"data-session-actions":!0,className:`pointer-events-none absolute right-0 top-0 flex h-6 items-center gap-0.5 opacity-0 transition-opacity group-hover/session:pointer-events-auto group-hover/session:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100`,children:[(0,U.jsx)(V,{size:`sm`,tone:`strong`,icon:(0,U.jsx)(Xr,{className:u(`h-3.5 w-3.5`,a&&`fill-current text-foreground`)}),label:b(a?`chatSidebarUnpinSession`:`chatSidebarPinSession`),tooltipSide:`right`,onClick:e=>{e.stopPropagation(),v()}}),(0,U.jsx)(V,{size:`sm`,tone:`strong`,icon:(0,U.jsx)(Ho,{className:`h-3.5 w-3.5`}),label:b(`edit`),tooltipSide:`right`,onClick:e=>{e.stopPropagation(),_()}}),(0,U.jsx)(OF,{sessionKey:e,triggerSize:`sm`,triggerTone:`strong`,children:(0,U.jsx)(fc,{icon:fs,label:b(`chatDeleteSession`),onClick:y,destructive:!0})})]})]})}function Gie({sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:c,agentId:l,agentLabel:d,agentAvatarUrl:f,childSessionCount:p,cronJobCount:m,projectName:h,isEditing:g,draftLabel:_,isSaving:v,onSelect:y,onStartEditing:b,onDraftLabelChange:x,onSave:S,onCancel:C,onTogglePinned:w,onDelete:T}){return(0,U.jsx)(`div`,{className:u(`w-full rounded-lg px-2.5 py-2 text-left text-[13px] transition-colors`,t?`bg-background/90 font-medium text-foreground`:`text-foreground/80 hover:bg-background/65 hover:text-foreground`),children:g?(0,U.jsx)(Uie,{sessionKey:e,draftLabel:_,isSaving:v,onDraftLabelChange:x,onSave:S,onCancel:C}):(0,U.jsx)(Wie,{sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:c,agentId:l,agentLabel:d,agentAvatarUrl:f,onSelect:y,childSessionCount:p,cronJobCount:m,projectName:h,onStartEditing:b,onTogglePinned:w,onDelete:T})})}function Kie(e){let{item:t,selectedSessionKey:n,optimisticReadAtBySessionKey:r,agentsById:i,childSessionsByParentKey:a,cronJobCount:o,editingSessionKey:s,draftLabel:c,savingSessionKey:l,sessionTypeOptions:u,isPinned:d,sessionTitle:f,onSelectSession:p,onStartEditingSessionLabel:m,onDraftLabelChange:h,onSaveSessionLabel:g,onCancelEditingSessionLabel:_,onTogglePinned:v,onDeleteSession:y}=e,{session:x,runStatus:S}=t,C=n===x.key,w=r[x.key],T=w&&x.readAt?w.localeCompare(x.readAt)>0?w:x.readAt:w??x.readAt,E=a.get(x.key)??[],D=x.agentId?i.get(x.agentId)?.displayName??x.agentId:null,O=iI(x)??`${D?.trim()?`${D} · `:``}${x.messageCount}`;return(0,U.jsx)(Gie,{sessionKey:x.key,active:C,showUnreadDot:tL({active:C,lastMessageAt:x.lastMessageAt,readAt:T,runStatus:S}),runStatus:S,context:VL(x,u),isPinned:d,title:f(x),previewText:O,trailingText:cI(x.lastMessageAt??x.createdAt),agentId:x.agentId??null,agentLabel:D,agentAvatarUrl:x.agentId?i.get(x.agentId)?.avatarUrl??null:null,childSessionCount:E.length,cronJobCount:o,projectName:x.projectName?.trim()||x.projectRoot?.trim().split(/[\\/]/).filter(Boolean).at(-1)||b(`chatSidebarContextNoProject`),isEditing:s===x.key,draftLabel:c,isSaving:l===x.key,onSelect:()=>p(x.key),onStartEditing:()=>m(x),onDraftLabelChange:h,onSave:()=>g(x),onCancel:_,onTogglePinned:v,onDelete:()=>y(x.key)})}var qie={maxHeight:xF(`18rem`)};function _7({className:e,onSelect:t,options:n,selectedSessionType:r,title:i=b(`chatSessionTypeLabel`),titleClassName:a}){return(0,U.jsxs)(`div`,{className:u(`space-y-1 overflow-y-auto overscroll-contain`,e),style:qie,children:[(0,U.jsx)(`div`,{className:u(`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,a),children:i}),n.map(e=>(0,U.jsx)(f3,{disabled:e.ready===!1,option:e,selected:e.value===r,onSelect:()=>t(e.value)},e.value))]})}function v7({option:e}){return e?.icon?.src?(0,U.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:e.icon.src,alt:e.icon.alt??null,name:e.label},className:`h-4 w-4`})}):(0,U.jsx)(oa,{className:`h-4 w-4 shrink-0`})}function Jie(e){let{query:t,selectedNewSessionType:n,selectedNewSessionTypeOption:r,sessionTypeOptions:i,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:s,onSelectNewSessionType:c,onQueryChange:l,collapsed:d=!1}=e,f=i.length>1;return d?(0,U.jsx)(`div`,{className:`px-2 pb-2`,children:(0,U.jsxs)(`div`,{className:u(`flex flex-col items-center`,aX),children:[(0,U.jsx)(V,{icon:(0,U.jsx)(Di,{className:rX}),label:b(`chatSidebarNewTask`),className:u(nX,oX),onClick:()=>{o(!1),s(n)}}),f?(0,U.jsxs)(CF,{open:a,onOpenChange:o,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(v7,{option:r}),label:b(`chatSessionTypeLabel`),className:u(nX,oX)})}),(0,U.jsx)(EF,{align:`start`,side:`right`,className:`w-56 rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:(0,U.jsx)(_7,{options:i,selectedSessionType:n,onSelect:e=>{c(e),o(!1)}})})]}):null]})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`px-4 pb-2`,children:(0,U.jsxs)(`div`,{className:`flex overflow-hidden rounded-lg bg-primary/10 text-primary ring-1 ring-primary/10`,children:[(0,U.jsxs)(R,{variant:`ghost`,className:u(`min-w-0 rounded-none bg-transparent px-3 text-primary shadow-none hover:bg-primary/10 hover:text-primary-700 active:bg-primary/15`,f?`flex-1`:`w-full`),onClick:()=>{o(!1),s(n)},children:[(0,U.jsx)(Di,{className:`mr-1.5 h-4 w-4`}),b(`chatSidebarNewTask`)]}),f?(0,U.jsxs)(CF,{open:a,onOpenChange:o,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(v7,{option:r}),(0,U.jsx)(ar,{className:`h-3 w-3 opacity-50`})]}),label:b(`chatSessionTypeLabel`),tooltip:b(`chatSessionTypeLabel`),className:`h-9 w-12 shrink-0 rounded-none border-l border-primary/10 bg-transparent text-primary shadow-none hover:bg-primary/10 hover:text-primary-700 active:bg-primary/15`})}),(0,U.jsx)(EF,{align:`end`,className:`w-56 rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:(0,U.jsx)(_7,{options:i,selectedSessionType:n,onSelect:e=>{c(e),o(!1)}})})]}):null]})}),(0,U.jsx)(`div`,{className:`px-4 pb-2`,children:(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,U.jsx)(St,{"data-theme-control":`chat-search`,value:t,onChange:e=>l(e.target.value),placeholder:b(`chatSidebarSearchPlaceholder`),className:`h-8 rounded-lg border-0 bg-background/55 pl-8 text-xs shadow-none hover:bg-background/75`})]})})]})}function Yie(e){let{query:t,defaultSessionType:n,sessionTypeOptions:r,isCreateMenuOpen:i,onCreateMenuOpenChange:a,onCreateSession:o,onQueryChange:s}=e,c=r.length>1;return(0,U.jsx)(`div`,{className:`px-4 pb-2 pt-1`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,U.jsx)(wi,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,U.jsx)(St,{"data-theme-control":`chat-search`,value:t,onChange:e=>s(e.target.value),placeholder:b(`chatSidebarSearchPlaceholder`),className:`h-9 rounded-full border-0 bg-muted pl-9 pr-3 text-[13px] shadow-none`})]}),c?(0,U.jsxs)(CF,{open:i,onOpenChange:a,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(Di,{className:`h-4 w-4`}),label:b(`chatSidebarNewTask`),tooltip:!1,className:`h-9 w-9 shrink-0 rounded-full bg-muted text-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`})}),(0,U.jsx)(EF,{align:`end`,className:`w-60 rounded-3xl border border-border bg-popover p-2 text-popover-foreground shadow-[0_24px_70px_-30px_rgba(15,23,42,0.45)]`,children:(0,U.jsx)(_7,{options:r,selectedSessionType:n,title:b(`chatSidebarNewTask`),titleClassName:`pb-1.5 text-[11px] font-medium normal-case tracking-normal`,onSelect:e=>{o(e),a(!1)}})})]}):(0,U.jsx)(V,{icon:(0,U.jsx)(Di,{className:`h-4 w-4`}),label:b(`chatSidebarNewTask`),className:`h-9 w-9 shrink-0 rounded-full bg-muted text-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,onClick:()=>o(n)})]})})}function Xie(){return Sn({queryKey:[`app-meta`],queryFn:sn,staleTime:1/0})}var Zie={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-muted-foreground/45 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function Qie(){let e=ft(),t=e.actionLabel===b(`runtimeStatusRestartAction`),n=()=>{e.tone!==`healthy`&&wt.requestRuntimeBootstrapProbeNow()},r=async()=>{if(t)try{let e=await wt.runRuntimeControlAction(`restart-service`);L.success(e.message)}catch(e){let t=e instanceof Error?e.message:b(`runtimeControlActionFailed`);L.error(`${b(`runtimeControlActionFailed`)}: ${t}`)}};return(0,U.jsxs)(CF,{children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,onClick:n,children:(0,U.jsx)(`span`,{className:u(`h-2.5 w-2.5 rounded-full`,Zie[e.tone])})})}),(0,U.jsxs)(EF,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-border bg-popover p-4 text-popover-foreground`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:e.description})]}),e.reasonLines.length>0?(0,U.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,U.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border/70 pt-1`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:b(`runtimeStatusActionHint`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:e.isBusy,className:`text-sm font-semibold text-primary transition-colors hover:text-primary-hover disabled:text-muted-foreground/45`,children:e.isBusy?b(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function y7({className:e,density:t=`sidebar`,suffix:n}){let{data:r}=Xie(),{supported:i,busyAction:a,snapshot:o}=ut(),s=r?.name??`NextClaw`,c=r?.productVersion?.trim(),l=c?`v${c}`:null,d=ot(c),f=n??(0,U.jsx)(Qie,{}),p=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,m=t===`chrome`;return(0,U.jsxs)(`div`,{className:u(e??`flex min-w-0 items-center gap-2`,p&&`pl-[58px]`),children:[(0,U.jsx)(`div`,{className:u(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,U.jsx)(`img`,{src:`/logo.svg`,alt:s,className:`h-full w-full object-contain`})}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,U.jsx)(`span`,{className:u(`shrink-0 font-semibold text-gray-800`,m?`text-[15px]`:`text-[14px]`),children:s}),l?(0,U.jsx)($ie,{versionLabel:l,density:t,releaseNotesLink:d}):null]}),(0,U.jsx)(eae,{supported:i,busyAction:a,snapshot:o}),f?(0,U.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:f}):null]})]})}function $ie({versionLabel:e,density:t,releaseNotesLink:n}){let r=u(`block min-w-0 flex-1 truncate font-medium text-gray-500 outline-none`,`text-[12px]`,n&&`cursor-pointer rounded-sm transition-colors hover:text-gray-700 hover:underline focus-visible:ring-2 focus-visible:ring-gray-300`),i=n?[b(`desktopUpdatesVersionTooltipCurrent`).replace(`{version}`,e),b(`desktopUpdatesVersionTooltipReleaseNotes`).replace(`{version}`,n.versionLabel)].join(`
|
|
106
106
|
`):e;return(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:n?(0,U.jsx)(ge,{href:n.url,external:!0,icon:null,"aria-label":b(`desktopUpdatesVersionReleaseNotesLabel`).replace(`{currentVersion}`,e).replace(`{releaseVersion}`,n.versionLabel),className:u(r,`p-0 text-left`),children:e}):(0,U.jsx)(`span`,{tabIndex:0,"aria-label":e,className:r,children:e})}),(0,U.jsx)(li,{side:`bottom`,className:`max-w-72 whitespace-pre-line text-xs leading-relaxed`,children:i})]})})}function eae({supported:e,busyAction:t,snapshot:n}){if(!e||!n)return null;let r=en(n);return n.status===`downloading`?(0,U.jsx)(x7,{snapshot:n,releaseNotesLink:r}):n.status===`blocked`||n.status===`failed`?(0,U.jsx)(x7,{snapshot:n}):n.status===`downloaded`?(0,U.jsx)(b7,{link:r,children:(0,U.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-emerald-50 px-2 text-[11px] font-semibold leading-none text-emerald-700 ring-1 ring-emerald-100 transition-colors hover:bg-emerald-100 disabled:opacity-70`,disabled:t===`applying`,onClick:()=>void Re.applyDownloadedUpdate(),children:b(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)})}):n.status===`update-available`?(0,U.jsx)(b7,{link:r,children:(0,U.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,disabled:t===`downloading`,onClick:()=>void Re.downloadUpdate(),children:b(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)})}):null}function b7({children:e,link:t}){if(!t)return e;let n=b(`desktopUpdatesUpdateReleaseNotesLabel`).replace(`{version}`,t.versionLabel);return(0,U.jsxs)(`span`,{className:`group/update-release-notes relative inline-flex shrink-0`,children:[e,(0,U.jsx)(`span`,{"data-update-release-notes-hover":`true`,className:`invisible pointer-events-none absolute left-1/2 top-full z-[var(--z-tooltip,10150)] -translate-x-1/2 pt-1 opacity-0 transition-opacity group-hover/update-release-notes:visible group-hover/update-release-notes:pointer-events-auto group-hover/update-release-notes:opacity-100 group-focus-within/update-release-notes:visible group-focus-within/update-release-notes:pointer-events-auto group-focus-within/update-release-notes:opacity-100`,children:(0,U.jsx)(ge,{href:t.url,external:!0,icon:null,"aria-label":n,className:`whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-left text-xs font-medium text-popover-foreground shadow-md outline-none transition-colors hover:bg-gray-100 focus-visible:ring-2 focus-visible:ring-gray-300`,children:n})})]})}function x7({snapshot:e,releaseNotesLink:t}){if(e.status===`blocked`||e.status===`failed`)return(0,U.jsx)(tae,{snapshot:e});let n=e.status===`downloading`?rae(e):null;return n?(0,U.jsx)(b7,{link:t??null,children:(0,U.jsx)(`span`,{tabIndex:t?0:void 0,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 outline-none transition-colors hover:bg-amber-100 focus-visible:ring-2 focus-visible:ring-amber-300`,children:n})}):null}function tae({snapshot:e}){let t=nae(e),n=e.recoveryCommand?.trim()||null,r=e.diagnosticCommand?.trim()?b(`desktopUpdatesDiagnosticCommand`).replace(`{command}`,e.diagnosticCommand.trim()):null,i=e.errorMessage?.trim()||e.blockReason?.trim()||null,a=[t,e.status===`blocked`&&e.blockReason?b(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,i,n,r].filter(Boolean).join(`
|
|
107
107
|
`);return(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`span`,{role:`img`,"aria-label":t,tabIndex:0,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-50 text-[13px] font-bold leading-none text-amber-700 ring-1 ring-amber-100 outline-none focus-visible:ring-2 focus-visible:ring-amber-300`,children:`!`})}),(0,U.jsx)(li,{side:`bottom`,className:`max-w-80 whitespace-pre-line break-words text-xs leading-relaxed`,children:a})]})})}function nae(e){return e.status===`blocked`?b(`desktopUpdatesStatusBlocked`):b(e.failureStage?`desktopUpdatesFailureStage.${e.failureStage}`:`desktopUpdatesStatusFailed`)}function rae(e){let t=e.progress?.percent;return t==null?b(`desktopUpdatesInlineDownloading`):b(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var iae={connected:{dotClass:`bg-emerald-500`},disconnected:{dotClass:`h-2.5 w-2.5 rounded-full border border-gray-400 bg-transparent`},connecting:{dotClass:`text-amber-600`}};function aae({status:e,className:t}){let n=iae[e],r=b(e===`connected`?`connected`:e===`disconnected`?`disconnected`:`connecting`);return(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`span`,{role:`status`,"aria-label":r,className:u(`inline-flex h-5 w-5 items-center justify-center`,t),children:e===`connecting`?(0,U.jsx)(Ei,{className:u(`h-3 w-3 animate-spin`,n.dotClass)}):(0,U.jsx)(`span`,{className:u(e===`connected`?`h-2 w-2 rounded-full`:``,n.dotClass)})})}),(0,U.jsx)(li,{side:`bottom`,className:`text-xs`,children:r})]})})}var oae=[`default-src 'none'`,`base-uri 'none'`,`connect-src 'none'`,`font-src data:`,`form-action 'none'`,`frame-src 'none'`,`img-src data: blob:`,`media-src data: blob:`,`object-src 'none'`,`script-src 'none'`,`style-src 'unsafe-inline'`].join(`; `);function sae(e){let t=new DOMParser().parseFromString(e,`text/html`);t.querySelectorAll(`base, script`).forEach(e=>e.remove()),t.querySelectorAll(`meta[http-equiv]`).forEach(e=>{let t=e.getAttribute(`http-equiv`)?.toLowerCase();(t===`content-security-policy`||t===`refresh`)&&e.remove()}),t.querySelectorAll(`*`).forEach(e=>{e.getAttributeNames().filter(e=>e.toLowerCase().startsWith(`on`)).forEach(t=>e.removeAttribute(t))}),t.querySelectorAll(`a[href]`).forEach(e=>{let t=e.getAttribute(`href`)?.trim()??``;if(t.toLowerCase().startsWith(`javascript:`)){e.removeAttribute(`href`);return}e.setAttribute(`target`,t.startsWith(`#`)?`_self`:`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)});let n=t.createElement(`meta`);n.setAttribute(`http-equiv`,`Content-Security-Policy`),n.setAttribute(`content`,oae),t.head.prepend(n);let r=t.createElement(`style`);return r.dataset.nextclawInboxDefaults=``,r.textContent=[`:root { color-scheme: light dark; }`,`*, *::before, *::after { box-sizing: border-box; }`,`body { margin: 0; padding: 24px; color: CanvasText; background: Canvas; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif; line-height: 1.6; overflow-wrap: anywhere; }`,`img, svg, video { max-width: 100%; height: auto; }`,`pre { max-width: 100%; overflow: auto; }`].join(`
|
|
108
|
-
`),n.after(r),`<!doctype html>${t.documentElement.outerHTML}`}function cae({content:e,fillHeight:t,title:n}){let r=(0,H.useMemo)(()=>sae(e),[e]);return(0,U.jsx)(`iframe`,{className:u(`w-full rounded-xl bg-background`,t?`h-full min-h-0 border-0`:`h-[min(60vh,680px)] min-h-[360px] border border-border/70`),sandbox:`allow-popups allow-popups-to-escape-sandbox`,srcDoc:r,title:n})}function S7({className:e,content:t,contentType:n,fillHeight:r=!1,title:i}){return(0,U.jsx)(`div`,{className:u(`inbox-delivery-content`,e),children:n===`html`?(0,U.jsx)(cae,{content:t,fillHeight:r,title:i}):(0,U.jsx)(Uj,{text:t,role:`assistant`,texts:{copyCodeLabel:b(`chatCodeCopy`),copiedCodeLabel:b(`chatCodeCopied`)}})})}var lae={readerOpen:!1,activeDeliveryId:null},C7=P(e=>({snapshot:lae,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))})),w7=[`inbox-deliveries`];function T7(e){return{deliveries:e,total:e.length,unreadCount:e.filter(e=>!e.readAt&&!e.archivedAt).length,unpresentedCount:e.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt).length}}var uae=class{constructor(e=jt){this.queryClient=e,this.cleanups=[],this.offerPromise=null,this.started=!1,this.start=()=>{this.started||(this.started=!0,this.cleanups.push(I.eventBus.on(c.inboxDeliveryChanged,this.handleDeliveryChanged)),typeof document<`u`&&(document.addEventListener(`visibilitychange`,this.handleVisibilityChange),this.cleanups.push(()=>document.removeEventListener(`visibilitychange`,this.handleVisibilityChange))),this.offerPendingDelivery())},this.stop=()=>{if(this.started)for(this.started=!1;this.cleanups.length>0;)this.cleanups.pop()?.()},this.closeReader=()=>{C7.getState().setSnapshot({readerOpen:!1})},this.selectInReader=async e=>{let t=await this.updateState(e,`present`);return C7.getState().setSnapshot({activeDeliveryId:t.id,readerOpen:!0}),t},this.markRead=async e=>await this.updateState(e,`read`),this.markUnread=async e=>await this.updateState(e,`mark_unread`),this.archive=async e=>await this.updateState(e,`archive`),this.restore=async e=>await this.updateState(e,`restore`),this.delete=async e=>{let t=await I.inboxDeliveries.delete(e);if(t){this.queryClient.setQueryData(w7,t=>t&&T7(t.deliveries.filter(({id:t})=>t!==e)));let{snapshot:t}=C7.getState();t.activeDeliveryId===e&&C7.getState().setSnapshot({activeDeliveryId:null,readerOpen:!1})}return t},this.prepareChatReference=async e=>{let t=await I.systemObjectReferences.resolve(y(w,e)),n=await this.updateState(e,`read`);return this.closeReader(),{delivery:n,reference:t}},this.updateState=async(e,t)=>{let n=await I.inboxDeliveries.updateState(e,t);return this.replaceCachedDelivery(n),n},this.replaceCachedDelivery=e=>{this.queryClient.setQueryData(w7,t=>t&&T7(t.deliveries.some(({id:t})=>t===e.id)?t.deliveries.map(t=>t.id===e.id?e:t):[e,...t.deliveries]))},this.handleDeliveryChanged=()=>{this.queryClient.invalidateQueries({queryKey:w7}),this.offerPendingDelivery()},this.handleVisibilityChange=()=>{document.visibilityState===`visible`&&this.offerPendingDelivery()},this.offerPendingDelivery=()=>{this.offerPromise||!this.isVisible()||C7.getState().snapshot.readerOpen||(this.offerPromise=this.openOldestPendingDelivery().catch(()=>void 0).finally(()=>{this.offerPromise=null}))},this.openOldestPendingDelivery=async()=>{let e=(await this.queryClient.fetchQuery({queryKey:w7,queryFn:()=>I.inboxDeliveries.list(),staleTime:0})).deliveries.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt),t=e[e.length-1];!t||!this.isVisible()||C7.getState().snapshot.readerOpen||await this.selectInReader(t.id)},this.isVisible=()=>typeof document>`u`||document.visibilityState===`visible`}};function E7(){return Sn({queryKey:w7,queryFn:()=>I.inboxDeliveries.list()})}function D7(){return E7().data?.unreadCount??0}function dae(e,t){return b(`inboxReaderPosition`).replace(`{current}`,String(e)).replace(`{total}`,String(t))}function fae(){let e=(0,H.useRef)(null),t=ce(),{chatDraftIntentManager:n,inboxManager:r}=P9(),{data:i}=E7(),{activeDeliveryId:a,readerOpen:o}=C7(e=>e.snapshot),[s,c]=(0,H.useState)(null),[l,d]=(0,H.useState)(null),f=(i?.deliveries??[]).filter(e=>!e.readAt&&!e.archivedAt),p=f.findIndex(({id:e})=>e===a),m=p>=0?f[p]:null,h=m?.contentType===`html`,g=async(e,t)=>{c(e),d(null);try{await t()}catch{d(b(`inboxActionError`))}finally{c(null)}},_=e=>{let t=f[e];t&&g(`select`,async()=>{await r.selectInReader(t.id)})},v=()=>{m&&g(`open`,async()=>{await r.markRead(m.id),r.closeReader(),t(`/inbox/${encodeURIComponent(m.id)}`)})},y=()=>{m&&g(`continue`,async()=>{let{reference:e}=await r.prepareChatReference(m.id);n.requestSystemObjectReference(e),t(Z7)})},x=()=>{m&&g(`read`,async()=>{await r.markRead(m.id),r.closeReader()})},S=f.length>1?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 pr-1`,children:[(0,U.jsx)(`span`,{className:`mr-1 text-[11px] tabular-nums text-muted-foreground`,children:dae(p+1,f.length)}),(0,U.jsx)(V,{icon:(0,U.jsx)(da,{className:`h-4 w-4`}),label:b(`inboxPrevious`),disabled:p<=0||s===`select`,onClick:()=>_(p-1)}),(0,U.jsx)(V,{icon:(0,U.jsx)(fa,{className:`h-4 w-4`}),label:b(`inboxNext`),disabled:p>=f.length-1||s===`select`,onClick:()=>_(p+1)})]}):null;return(0,U.jsx)(Ur,{open:o&&!!m,onOpenChange:e=>{e||r.closeReader()},children:(0,U.jsx)(Kr,{className:`flex h-[min(82vh,760px)] w-[calc(100vw-2rem)] max-w-[820px] flex-col gap-0 overflow-hidden rounded-[24px] border-border/70 bg-background p-0 shadow-[0_20px_55px_-22px_rgba(15,23,42,0.32)] max-sm:h-[100dvh] max-sm:max-h-none max-sm:w-screen max-sm:rounded-none max-sm:border-0`,onOpenAutoFocus:t=>{t.preventDefault(),e.current?.focus()},children:m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`header`,{className:`shrink-0 border-b border-border/50 px-5 py-3 pr-14 sm:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-muted/70 text-muted-foreground`,children:(0,U.jsx)(ao,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(qr,{ref:e,tabIndex:-1,title:m.title,className:`min-w-0 truncate text-sm font-medium text-foreground outline-none`,children:m.title}),(0,U.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:m.createdAt,children:M(m.createdAt)})]}),S]}),(0,U.jsx)(Br,{className:`sr-only`,children:m.summary??b(`inboxNoSummary`)})]}),(0,U.jsx)(`div`,{className:u(`min-h-0 flex-1`,h?`p-3 sm:p-4`:`custom-scrollbar overflow-y-auto px-6 py-5 sm:px-8 sm:py-6`),children:(0,U.jsx)(S7,{className:h?`h-full`:void 0,content:m.content,contentType:m.contentType,fillHeight:h,title:m.title})}),(0,U.jsxs)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background px-5 py-3 sm:px-6`,children:[l?(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:l}):null,(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-1 sm:flex-row sm:flex-wrap`,children:[(0,U.jsx)(R,{size:`sm`,variant:`ghost`,onClick:r.closeReader,children:b(`inboxReadLater`)}),(0,U.jsx)(R,{size:`sm`,variant:`outline`,disabled:s!==null,onClick:x,children:b(`inboxMarkRead`)}),(0,U.jsx)(R,{size:`sm`,variant:`ghost`,disabled:s!==null,onClick:v,children:b(`inboxOpenInbox`)})]}),(0,U.jsx)(R,{size:`sm`,disabled:s!==null,onClick:y,children:b(`inboxContinueChat`)})]})]})]}):null})})}function pae(){let{inboxManager:e}=P9();return(0,H.useEffect)(()=>(e.start(),()=>e.stop()),[e]),(0,U.jsx)(fae,{})}function mae(e,t){return t||(e.some(e=>!e.readAt&&!e.archivedAt)?`unread`:`all`)}function O7(e,t){return t===`unread`?e.filter(e=>!e.readAt&&!e.archivedAt):t===`archived`?e.filter(e=>!!e.archivedAt):e.filter(e=>!e.archivedAt)}function k7({selection:e=!1}){return(0,U.jsxs)(`div`,{className:`flex h-full min-h-56 flex-col items-center justify-center px-8 text-center`,children:[(0,U.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-muted text-muted-foreground`,children:(0,U.jsx)(ao,{className:`h-5 w-5`})}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(e?`inboxSelectTitle`:`inboxEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-2 max-w-sm text-sm leading-6 text-muted-foreground`,children:b(e?`inboxSelectDescription`:`inboxEmptyDescription`)})]})}function hae({activeDeliveryId:e,deliveries:t,filter:n,onFilterChange:r}){let{onScroll:i,scrollRef:a}=oY({restorationKey:`inbox:list`}),o=[{id:`unread`,label:b(`inboxUnread`),count:O7(t,`unread`).length},{id:`all`,label:b(`inboxAll`),count:O7(t,`all`).length},{id:`archived`,label:b(`inboxArchived`),count:O7(t,`archived`).length}],s=O7(t,n);return(0,U.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-border/60 bg-muted/20 md:border-r`,children:[(0,U.jsx)(`div`,{className:`flex shrink-0 gap-1 border-b border-border/50 px-3 py-2`,children:o.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:u(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,n===e.id?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[e.label,(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] font-normal tabular-nums opacity-60`,children:e.count})]},e.id))}),(0,U.jsx)(`div`,{ref:a,onScroll:i,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-2`,children:s.length>0?(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:s.map(t=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(ue,{to:`/inbox/${encodeURIComponent(t.id)}`,className:u(`block rounded-lg px-2.5 py-2 text-[13px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e===t.id?`bg-[var(--interaction-selection)] text-foreground`:`text-foreground/80 hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[(0,U.jsx)(`h2`,{className:u(`truncate font-medium leading-5`,!t.readAt&&`font-semibold text-foreground`),children:t.title}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] leading-4 text-muted-foreground/65`,children:[(0,U.jsx)(`p`,{className:`min-w-0 flex-1 truncate`,children:t.summary??b(`inboxNoSummary`)}),t.readAt?(0,U.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:t.createdAt,children:k(t.createdAt)}):(0,U.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-primary`,"aria-label":b(`inboxUnread`)})]})]})},t.id))}):(0,U.jsx)(k7,{})})]})}function gae({delivery:e,error:t,isMobile:n,pending:r,onArchiveToggle:i,onBack:a,onContinue:o,onDelete:s,onReadToggle:c}){let{onScroll:l,scrollRef:d}=oY({restorationKey:e?`inbox:delivery:${e.id}`:null});if(!e)return(0,U.jsx)(`main`,{className:`flex min-h-0 flex-col`,children:(0,U.jsx)(k7,{selection:!0})});let f=e.contentType===`html`;return(0,U.jsxs)(`main`,{className:`flex min-h-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`shrink-0 border-b border-border/50 px-5 py-3 sm:px-6`,children:[n?(0,U.jsxs)(`button`,{type:`button`,onClick:a,className:`mb-3 inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(Ci,{className:`h-4 w-4`}),b(`inboxTitle`)]}):null,(0,U.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h2`,{title:e.title,className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.title}),(0,U.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:e.createdAt,children:M(e.createdAt)})]})]}),(0,U.jsx)(`div`,{className:u(`min-h-0 flex-1`,f?`p-3 sm:p-4`:`custom-scrollbar overflow-y-auto px-5 py-5 sm:px-6 sm:py-6`),ref:d,onScroll:l,children:(0,U.jsx)(`div`,{className:u(`mx-auto max-w-5xl`,f&&`h-full`),children:(0,U.jsx)(S7,{className:f?`h-full`:void 0,content:e.content,contentType:e.contentType,fillHeight:f,title:e.title})})}),(0,U.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-5 py-3 sm:px-6`,children:[t?(0,U.jsx)(`p`,{role:`alert`,className:`mb-2 text-sm text-destructive`,children:t}):null,(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,U.jsx)(R,{size:`sm`,variant:`outline`,disabled:r,onClick:c,children:e.readAt?b(`inboxMarkUnread`):b(`inboxMarkRead`)}),(0,U.jsxs)(R,{size:`sm`,variant:`ghost`,disabled:r,onClick:i,children:[e.archivedAt?(0,U.jsx)(qo,{className:`mr-2 h-4 w-4`}):(0,U.jsx)(ia,{className:`mr-2 h-4 w-4`}),e.archivedAt?b(`inboxRestore`):b(`inboxArchive`)]}),(0,U.jsxs)(R,{size:`sm`,variant:`ghost`,disabled:r,onClick:s,children:[(0,U.jsx)(fs,{className:`mr-2 h-4 w-4`}),b(`inboxDelete`)]})]}),(0,U.jsxs)(R,{size:`sm`,disabled:r,onClick:o,children:[(0,U.jsx)(bo,{className:`mr-2 h-4 w-4`}),b(`inboxContinueChat`)]})]})]})]})}function _ae(){let e=ce(),{deliveryId:t}=le(),{isMobile:n}=k8(),{chatDraftIntentManager:r,inboxManager:i}=P9(),a=E7(),{confirm:o,ConfirmDialog:s}=On(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(null),m=(0,H.useMemo)(()=>a.data?.deliveries??[],[a.data?.deliveries]),h=(0,H.useMemo)(()=>t?m.find(({id:e})=>e===t)??null:null,[m,t]),g=mae(m,c);(0,H.useEffect)(()=>{h&&!h.readAt&&i.markRead(h.id).catch(()=>p(b(`inboxActionError`)))},[h,i]);let _=async(e,t)=>{d(e),p(null);try{await t()}catch{p(b(`inboxActionError`))}finally{d(null)}},v=()=>{h&&_(`continue`,async()=>{let{reference:t}=await i.prepareChatReference(h.id);r.requestSystemObjectReference(t),e(Z7)})},y=async()=>{!h||!await o({title:b(`inboxDeleteTitle`),description:b(`inboxDeleteDescription`),confirmLabel:b(`inboxDeleteConfirm`),variant:`destructive`})||_(`delete`,async()=>{await i.delete(h.id),e(`/inbox`,{replace:!0})})},x=()=>{h&&_(`read`,async()=>{if(h.readAt){await i.markUnread(h.id),e(`/inbox`,{replace:!0});return}await i.markRead(h.id)})},S=()=>{h&&_(`archive`,async()=>{if(h.archivedAt){await i.restore(h.id);return}await i.archive(h.id),e(`/inbox`,{replace:!0})})},C=!n||!h,w=!n||!!h;return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-6`,children:[(0,U.jsx)(xt,{headingLevel:1,title:b(`inboxTitle`),className:`px-4 sm:px-0`}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden border-y border-border/60 bg-background sm:rounded-2xl sm:border`,children:a.isError?(0,U.jsx)(`div`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:b(`inboxLoadError`)}):(0,U.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 md:grid-cols-[300px_minmax(0,1fr)]`,children:[C?(0,U.jsx)(hae,{activeDeliveryId:h?.id??null,deliveries:m,filter:g,onFilterChange:l}):null,w?(0,U.jsx)(gae,{delivery:h,error:f,isMobile:n,pending:u!==null,onArchiveToggle:S,onBack:()=>e(`/inbox`),onContinue:v,onDelete:()=>void y(),onReadToggle:x}):null]})}),(0,U.jsx)(s,{})]})}function vae(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function yae(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,projectCronJobCountByRoot:a}=e,o=eI(),s=aL(e=>e.snapshot.collapsedProjectRoots),[c,l]=(0,H.useState)(null),u=(0,H.useMemo)(()=>vae(n,r),[n,r]),d=r.length>1;return(0,U.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>{let t=`${b(`chatSidebarNewTask`)} · ${e.projectName}`,n=s.includes(e.projectRoot),f=b(e.isPinned?`chatSidebarUnpinProject`:`chatSidebarPinProject`);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`group/project relative h-8 rounded-lg px-2 text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(g7,{title:e.projectName,metrics:[{icon:(0,U.jsx)(Ya,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextPath`),value:e.projectRoot},{icon:(0,U.jsx)(Co,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextSessions`),value:e.items.length},{icon:(0,U.jsx)(ra,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextScheduledTasks`),value:a.get(e.projectRoot)??0}],children:(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":!n,"aria-label":b(n?`chatSidebarExpandProject`:`chatSidebarCollapseProject`),className:`flex h-full w-full min-w-0 items-center gap-1.5 pr-14 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>o.chatSessionListManager.toggleProjectCollapsed(e.projectRoot),children:[(0,U.jsx)(Ya,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wider`,title:e.projectRoot,children:e.projectName}),n?(0,U.jsx)(fa,{className:`h-3.5 w-3.5 shrink-0 opacity-0 transition-opacity group-hover/project:opacity-100 group-focus-within/project:opacity-100`,"aria-hidden":`true`}):(0,U.jsx)(ar,{className:`h-3.5 w-3.5 shrink-0 opacity-0 transition-opacity group-hover/project:opacity-100 group-focus-within/project:opacity-100`,"aria-hidden":`true`})]})}),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute right-2 top-1/2 flex -translate-y-1/2 items-center opacity-0 transition-opacity group-hover/project:pointer-events-auto group-hover/project:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100`,children:[d?(0,U.jsxs)(CF,{open:c===e.projectRoot,onOpenChange:t=>{l(t?e.projectRoot:null)},children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(Di,{className:`h-3.5 w-3.5`}),label:t})}),(0,U.jsx)(EF,{align:`end`,className:`w-56 rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:(0,U.jsx)(_7,{options:r,selectedSessionType:u,onSelect:t=>{o.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:t}),l(null)}})})]}):(0,U.jsx)(V,{icon:(0,U.jsx)(Di,{className:`h-3.5 w-3.5`}),label:t,onClick:()=>o.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:u})}),(0,U.jsx)(V,{icon:(0,U.jsx)(Xr,{className:e.isPinned?`h-3.5 w-3.5 fill-current text-foreground`:`h-3.5 w-3.5`}),label:f,tooltipSide:`right`,onClick:()=>o.chatSessionListManager.toggleProjectPinned(e.projectRoot)})]})]}),n?null:(0,U.jsx)(`div`,{className:`mt-0.5 space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}function A7({label:e}){return(0,U.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,U.jsx)(Co,{className:`mx-auto mb-2 h-6 w-6 text-muted-foreground/45`}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function bae({defaultSessionType:e,groups:t,isLoading:n,isProjectFirstView:r,projectGroups:i,projectCronJobCountByRoot:a,renderSessionItem:o,sessionTypeOptions:s}){return n?(0,U.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:b(`sessionsLoading`)}):r?i.length===0?(0,U.jsx)(A7,{label:b(`chatSidebarProjectViewEmpty`)}):(0,U.jsx)(yae,{groups:i,projectCronJobCountByRoot:a,defaultSessionType:e,sessionTypeOptions:s,renderSessionItem:o}):t.length===0?(0,U.jsx)(A7,{label:b(`sessionsEmpty`)}):(0,U.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wider text-muted-foreground/65`,children:e.label}),(0,U.jsx)(`div`,{className:`space-y-0.5`,children:e.items.map(o)})]},e.label))})}function xae({isOpen:e,onOpenChange:t,currentTheme:n,currentThemeLabel:r,themeOptions:i,onSelectTheme:a,currentLanguage:o,currentLanguageLabel:s,languageOptions:c,onSelectLanguage:l,onOpenDocs:d,onOpenApps:f,collapsed:p=!1}){return(0,U.jsxs)(CF,{open:e,onOpenChange:t,children:[p?(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`settingsMenu`),className:u(`flex items-center justify-center`,nX,oX),children:(0,U.jsx)(Zo,{className:u(rX,`shrink-0 text-muted-foreground`)})})})}),(0,U.jsx)(li,{side:`right`,className:`text-xs`,children:b(`settingsMenu`)})]})}):(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-label":b(`settingsMenu`),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] font-medium text-muted-foreground transition-colors duration-base hover:bg-background/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(Zo,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:b(`settings`)})]})}),(0,U.jsxs)(EF,{side:p?`right`:`top`,align:p?`end`:`start`,className:`w-64 p-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(pe,{to:`/settings`,onClick:()=>t(!1),className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(Zo,{className:`h-4 w-4 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:b(`settings`)})]}),[{key:`docs`,icon:Ti,label:b(`docBrowserHelp`),action:d},{key:`apps`,icon:Zr,label:b(`appsTitle`),action:f}].map(({key:e,icon:n,label:r,action:i})=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{i(),t(!1)},className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(n,{className:`h-4 w-4 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:r})]},e))]}),(0,U.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,U.jsx)(j7,{icon:No,label:b(`theme`),options:i,value:n,valueLabel:r,onSelect:a,onCloseMenu:()=>t(!1)}),(0,U.jsx)(j7,{icon:so,label:b(`language`),options:c,value:o,valueLabel:s,onSelect:l,onCloseMenu:()=>t(!1)})]})]})}function j7({icon:e,label:t,options:n,value:r,valueLabel:i,onSelect:a,onCloseMenu:o}){return(0,U.jsxs)(Dr,{value:r,onOpenChange:e=>{e||o()},onValueChange:e=>a(e),children:[(0,U.jsxs)(yr,{"aria-label":t,className:`h-auto w-full rounded-lg border-0 bg-transparent px-3 py-2 text-[13px] font-medium text-foreground shadow-none hover:bg-gray-200/60 hover:text-gray-900 focus:ring-0`,indicator:(0,U.jsx)(fa,{className:`h-4 w-4 text-muted-foreground/70`}),children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(e,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`text-left`,children:t})]}),(0,U.jsx)(`span`,{className:`ml-auto max-w-[96px] truncate text-[13px] text-muted-foreground`,children:i})]}),(0,U.jsx)(Sr,{side:`right`,align:`center`,sideOffset:6,className:`z-[var(--z-tooltip)] min-w-[7rem] rounded-lg`,viewportClassName:`h-auto min-w-[7rem] w-auto`,children:n.map(e=>(0,U.jsx)(Tr,{value:e.value,className:`text-[13px]`,children:e.label},e.value))})]})}var M7=P(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Sae=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}M7.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();M7.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){M7.setState({supported:!0,initialized:!0,busyAction:null}),L.error(`${b(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{M7.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(b(`runtimePresenceLaunchAtLoginUnavailable`));M7.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return M7.setState({supported:!0,initialized:!0,snapshot:n}),L.success(b(`runtimePresenceSaved`)),n}catch(e){throw L.error(`${b(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{M7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:b(`error`)}},N7=P(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null}));new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){N7.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{N7.setState({supported:!0,initialized:!0,snapshot:e})}),N7.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();N7.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){N7.setState({supported:!0,initialized:!0}),L.error(`${b(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,b(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){L.success(b(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){L.success(b(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??b(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){L.success(b(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&L.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,b(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&L.success(b(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,b(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updateChannel=async e=>{if(N7.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,b(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){L.success(b(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}L.success(b(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(b(`desktopUpdatesDesktopOnlyDescription`));N7.setState({busyAction:e});try{let e=await n(r);return N7.setState({snapshot:e}),e}catch(e){throw L.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{N7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:b(`error`),this.getChannelLabel=e=>b(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function P7(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function F7(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/inbox`||t.startsWith(`/inbox/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)||t.startsWith(`/apps/panel/`)}function I7(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function Cae(e){return[{target:`/chat`,label:e(`chat`),icon:bo},{target:`/inbox`,label:e(`inboxTitle`),icon:ao},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:sa},{target:`/agents`,label:e(`agentsPageTitle`),icon:oa},{target:`/settings`,label:e(`settings`),icon:Zo}]}function L7(e,t={}){let n=[{target:`/model`,label:e(`model`),icon:Da},{target:`/providers`,label:e(`providers`),icon:Fr},{target:`/channels`,label:e(`channels`),icon:wo},{target:`/extensions`,label:e(`extensions`),icon:Wo},{target:`/appearance`,label:e(`appearance`),icon:No},{target:`/security`,label:e(`security`),icon:ts},{target:`/privacy`,label:e(`privacy`),icon:na},{target:`/desktop-capabilities`,label:e(`desktopCapabilities`),icon:Oo},{target:`/search`,label:e(`searchChannels`),icon:wi},{target:`/updates`,label:e(`updates`),icon:Oa},{target:`/remote`,label:e(`remote`),icon:_s},{target:`/runtime`,label:e(`runtime`),icon:Da},{target:`/secrets`,label:e(`secrets`),icon:oo},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:ys}];return t.includeDesktopCapabilities===!1?n.filter(e=>e.target!==`/desktop-capabilities`):n}function wae(e,t={}){let n=L7(e,t);return[{label:e(`settingsGroupBasic`),items:n.slice(0,3)},{label:e(`settingsGroupAdvanced`),items:n.slice(3)}]}function Tae(e){let t=e.toLowerCase();return t===`/settings`?!0:L7(e=>e).some(e=>P7(t,e.target))}function Eae(e,t){let n=e.toLowerCase(),r=L7(t);if(I7(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/inbox`||n.startsWith(`/inbox/`))return{title:t(`inboxTitle`),backTarget:n===`/inbox`?null:`/inbox`,backLabel:t(`inboxTitle`)};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n.startsWith(`/apps/panel/`))return{title:t(`panelAppsTitle`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(P7(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var Dae=[`feature-controls`];function Oae(){return Sn({queryKey:Dae,queryFn:I.featureControls.get})}var R7=new class{constructor(){this.getStatus=async()=>await I.capabilityAccess.getDesktopStatus(),this.listGrants=async()=>await I.capabilityAccess.listDesktopGrants(),this.grantAccess=async e=>await I.capabilityAccess.grantDesktopAccess(e),this.requestSystemPermission=async()=>await I.capabilityAccess.requestDesktopPermissions(),this.openSystemSettings=async()=>await I.capabilityAccess.openDesktopPermissionSettings(),this.revokeGrant=async e=>await I.capabilityAccess.revokeDesktopAccess(e)}},z7=[`desktop-capability`,`status`],B7=[`desktop-capability`,`grants`];function kae(){return Sn({queryKey:z7,queryFn:R7.getStatus})}function V7(){return Aae(Oae().data)}function Aae(e){return e?.desktopAutomation.available===!0}function jae(){return Sn({queryKey:B7,queryFn:R7.listGrants})}function Mae(){let e=F();return z({mutationFn:R7.requestSystemPermission,onSuccess:async()=>{await e.invalidateQueries({queryKey:z7})}})}function Nae(){return z({mutationFn:R7.openSystemSettings})}function Pae(){let e=F();return z({mutationFn:async e=>await R7.revokeGrant(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:B7})}})}function H7({isCollapsed:e,onToggle:t}){let n=b(e?`sidebarExpand`:`sidebarCollapse`);return(0,U.jsx)(V,{icon:(0,U.jsx)(e?Io:Po,{className:rX}),label:n,className:u(oX,e&&`h-9 w-9 rounded-xl`),onClick:t})}function Fae({isCollapsed:e,onToggle:t}){return(0,U.jsx)(`div`,{className:u(`shrink-0`,e?`px-0 py-1.5`:`px-2 py-2`),children:(0,U.jsxs)(`div`,{className:u(`flex items-center py-1`,e?u(`flex-col px-0`,aX):`gap-2 px-1`),"data-testid":`settings-sidebar-header`,children:[e?(0,U.jsx)(H7,{isCollapsed:e,onToggle:t}):null,(0,U.jsxs)(pe,{to:`/chat`,"aria-label":b(`backToMain`),className:u(`group inline-flex min-w-0 items-center rounded-lg text-[12px] font-medium text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e?u(nX,oX,`justify-center p-0`):`gap-1.5 px-1 py-1`),children:[(0,U.jsx)(Ci,{className:u(e?rX:`h-3.5 w-3.5`,`shrink-0 text-muted-foreground/75 group-hover:text-gray-700`)}),(0,U.jsx)(`span`,{className:e?`sr-only`:`truncate`,children:b(`backToMain`)})]}),e?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-border`,"aria-hidden":`true`}),(0,U.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-foreground`,children:b(`settings`)}),(0,U.jsx)(`div`,{className:`ml-auto`,children:(0,U.jsx)(H7,{isCollapsed:e,onToggle:t})})]})]})})}function Iae({isCollapsed:e,sections:t}){let{onScroll:n,scrollRef:r}=oY({restorationKey:`settings-sidebar:navigation`});return(0,U.jsx)(`nav`,{ref:r,onScroll:n,className:u(`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,e?`pr-0`:`pr-1`,PF),children:e?(0,U.jsx)(hX,{isCollapsed:e,items:t.flatMap(e=>e.items),density:`compact`,className:u(iX,`pb-3`)}):(0,U.jsx)(`div`,{className:`space-y-3 pb-3`,children:t.map(t=>(0,U.jsxs)(`section`,{"aria-label":t.label,className:`space-y-1`,children:[(0,U.jsx)(`h2`,{className:`px-3 text-[11px] font-semibold text-muted-foreground/70`,children:t.label}),(0,U.jsx)(hX,{isCollapsed:e,items:t.items,density:`compact`})]},t.label))})})}function Lae(){let e=P9(),t=Hi(),n=Cs(),r=V7(),i=ac(e=>e.isSidebarCollapsed),a=oc.toggleSidebarCollapsed,o=n.data?.account.email?.trim(),s=!!n.data?.account.loggedIn,c=wae(b,{includeDesktopCapabilities:r}),l=i?iX:uX(`compact`);return(0,U.jsxs)(`aside`,{"data-theme-surface":`navigation`,className:u(`shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary pb-6 transition-[width] duration-200 ease-out`,i?u(eX,tX):`w-[240px] px-4`),"data-sidebar-collapsed":i?`true`:`false`,children:[(0,U.jsx)(Fae,{isCollapsed:i,onToggle:a}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(Iae,{isCollapsed:i,sections:c}),(0,U.jsxs)(`div`,{className:u(`shrink-0 bg-secondary`,i?`mt-2 flex flex-col items-center pt-2`:`mt-2 pt-3`,l),children:[(0,U.jsx)(gX,{onClick:()=>t.open(void 0,{kind:`docs`,title:b(`docBrowserHelp`)}),icon:Ti,label:b(`docBrowserHelp`),density:`compact`,collapsed:i}),(0,U.jsx)(gX,{onClick:()=>e.accountManager.openAccountPanel(),icon:oo,label:b(`remoteAccountEntryManage`),density:`compact`,trailing:s?o||b(`remoteAccountEntryConnected`):b(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`,collapsed:i})]})]})]})}var U7=[{action:`minimize`,label:`Minimize`,icon:Do},{action:`close`,label:`Close`,icon:ki,variant:`danger`}];function Rae({sidebarCollapsed:e=!1}){let t=Bae()?{action:`toggle-maximize`,label:`Restore`,icon:Ta}:{action:`toggle-maximize`,label:`Maximize`,icon:ss};return(0,U.jsxs)(`header`,{"data-theme-surface":`header`,className:`desktop-window-drag relative flex h-[var(--desktop-titlebar-height)] shrink-0 bg-secondary after:absolute after:bottom-0 after:left-[var(--desktop-sidebar-width)] after:right-0 after:border-b after:border-border/80`,"data-testid":`desktop-window-chrome`,children:[(0,U.jsx)(`div`,{className:`desktop-window-no-drag absolute left-0 right-0 top-0 h-1`,"data-testid":`desktop-window-chrome-resize-strip`}),(0,U.jsx)(`div`,{className:u(`desktop-window-drag relative z-10 flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary text-secondary-foreground`,e?`justify-center px-0`:`pl-4 pr-3`),"data-testid":`desktop-window-chrome-sidebar`,children:e?(0,U.jsx)(`img`,{src:`/logo.svg`,alt:`NextClaw`,className:`h-6 w-6 shrink-0 object-contain`}):(0,U.jsx)(y7,{className:`flex min-w-0 shrink-0 items-center gap-2.5`,density:`chrome`})}),(0,U.jsx)(`div`,{className:`desktop-window-no-drag absolute right-0 top-0 z-20 flex h-full w-[var(--desktop-caption-safe-right)] items-start justify-end`,"data-testid":`desktop-window-controls`,children:[U7[0],t,U7[1]].map(e=>(0,U.jsx)(zae,{control:e},e.action))})]})}function zae({control:e}){let t=e.icon;return(0,U.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,className:e.variant===`danger`?`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-red-500 hover:text-white`:`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-black/10`,onClick:()=>{window.nextclawDesktop?.controlWindow?.(e.action)},children:(0,U.jsx)(t,{className:`h-3.5 w-3.5`})})}function Bae(){let[e,t]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let e=!0,n=window.nextclawDesktop;n?.getWindowState?.().then(n=>{e&&t(n.isMaximized)});let r=n?.onWindowStateChanged?.(e=>{t(e.isMaximized)});return()=>{e=!1,r?.()}},[]),e}function W7(){return typeof window>`u`?null:Vae()??window.nextclawDesktop?.platform??null}function G7(){return W7()===`win32`}function Vae(){return null}function K7(){let{pathname:e}=_e(),t=Hi(),n=D7();return(0,U.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":b(`settings`),className:`shrink-0 border-t border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.25rem)`},children:(0,U.jsxs)(`ul`,{className:`grid grid-cols-6 gap-1 px-2 pt-1`,children:[Cae(b).map(t=>{let r=t.target===`/settings`?Tae(e):P7(e,t.target);return(0,U.jsx)(`li`,{children:(0,U.jsxs)(ue,{to:t.target,"aria-current":r?`page`:void 0,"data-testid":r?`mobile-nav-active-indicator`:void 0,className:u(`group flex min-h-[2.875rem] flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 text-[10px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,r?`bg-gray-100 text-gray-900`:`text-gray-500 hover:bg-gray-50 hover:text-gray-800`),children:[(0,U.jsxs)(`span`,{className:`relative`,children:[(0,U.jsx)(t.icon,{className:u(`h-3.5 w-3.5`,r?`text-gray-900`:`text-gray-400`)}),t.target===`/inbox`&&n>0?(0,U.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-1 ring-white`}):null]}),(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:t.label})]})},t.target)}),(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>L1(t),className:`group flex min-h-[2.875rem] w-full flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 text-[10px] font-medium text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-800 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(Zr,{className:`h-3.5 w-3.5 text-gray-400`}),(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:b(`appsTitle`)})]})})]})})}function q7({leadingInset:e}){let t=ce(),{pathname:n}=_e(),r=Eae(n,b);return(0,U.jsx)(`header`,{"data-testid":`mobile-topbar`,className:`shrink-0 border-b border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.25rem)`},children:(0,U.jsxs)(`div`,{className:`flex min-h-[2.75rem] items-center gap-2 py-1.5 pl-3 pr-3`,style:{paddingLeft:e?`calc(${e} + 0.75rem)`:void 0},children:[r.backTarget?(0,U.jsx)(`button`,{type:`button`,onClick:()=>t(r.backTarget),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900`,"aria-label":r.backLabel??b(`backToMain`),children:(0,U.jsx)(Ci,{className:`h-4 w-4`})}):null,(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(`h1`,{className:`truncate text-center text-[15px] font-semibold text-gray-900`,children:r.title})}),r.backTarget?(0,U.jsx)(`div`,{className:`h-8 w-8 shrink-0`,"aria-hidden":`true`}):null]})})}var Hae=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DocBrowser:e}=await import(`./doc-browser-BuDgpY2e.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,33,1,34,35,36,37,38,39]))).DocBrowser}));function Uae({pathname:e,isDocBrowserOpen:t,docBrowserDockControls:n,docBrowserRenderers:r={},docBrowserTabMenuGroups:i,topbarLeadingInset:a,children:o}){let s=F7(e),c=!I7(e),l=!I7(e);return(0,U.jsxs)(`div`,{className:`flex h-[100svh] flex-col bg-background font-sans text-foreground supports-[height:100dvh]:h-[100dvh]`,children:[c?(0,U.jsx)(q7,{leadingInset:a}):null,(0,U.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:s?(0,U.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:o}):(0,U.jsx)(`main`,{className:`h-full overflow-auto px-4 py-4 custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:o})})}),l?(0,U.jsx)(K7,{}):null,t?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(Hae,{customTabRenderers:r,displayMode:`fullscreen`,dockControls:n,getTabMenuGroups:i})}):null]})}function Wae(){let e=L7(b,{includeDesktopCapabilities:V7()});return(0,U.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,U.jsxs)(pe,{to:e.target,className:({isActive:e})=>u(`flex items-center gap-3 rounded-2xl border border-gray-200/80 bg-white px-4 py-4 shadow-card transition-colors`,e?`border-gray-300 bg-gray-50`:`hover:border-gray-300 hover:bg-gray-50/70`),children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,U.jsx)(e.icon,{className:`h-4 w-4`})}),(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.label})})]},e.target))})}function Gae(){let{pathname:e}=_e(),t=ce();return I7(e)?(0,U.jsx)(Z5,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,U.jsx)(Y7,{variant:`mobile`})}var J7=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DocBrowser:e}=await import(`./doc-browser-BuDgpY2e.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,33,1,34,35,36,37,38,39]))).DocBrowser}));function Kae({pathname:e,isMobileLayout:t=!1,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:i,docBrowserRenderers:a={},docBrowserTabMenuGroups:o,sideDock:s,children:c}){let l=F7(e),d=ac(e=>e.isSidebarCollapsed),f=t&&!I7(e),p=G7(),m=d?`56px`:l?`280px`:`240px`,{onScroll:h,scrollRef:g}=oY({restorationKey:l?null:`settings-page:${e}`});return(0,U.jsxs)(`div`,{"data-theme-surface":`app-shell`,className:u(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,p?`rounded-[10px]`:null),style:p?{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":m}:void 0,children:[(0,U.jsx)(`div`,{"aria-hidden":`true`,"data-theme-decoration":`island-paper`}),(0,U.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute h-0 w-0`,focusable:`false`,children:(0,U.jsx)(`defs`,{children:(0,U.jsxs)(`filter`,{id:`island-wind-filter`,x:`-8%`,y:`-8%`,width:`116%`,height:`116%`,colorInterpolationFilters:`sRGB`,children:[(0,U.jsx)(`feTurbulence`,{type:`turbulence`,baseFrequency:`0.0025 0.011`,numOctaves:`2`,seed:`7`,result:`island-wind-noise`,children:(0,U.jsx)(`animate`,{attributeName:`baseFrequency`,dur:`8.5s`,values:`0.0025 0.011;0.0038 0.015;0.0028 0.009;0.0025 0.011`,keyTimes:`0;0.38;0.72;1`,calcMode:`spline`,keySplines:`0.42 0 0.25 1;0.45 0 0.2 1;0.4 0 0.3 1`,repeatCount:`indefinite`})}),(0,U.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`island-wind-noise`,scale:`5`,xChannelSelector:`R`,yChannelSelector:`G`,children:(0,U.jsx)(`animate`,{attributeName:`scale`,dur:`8.5s`,values:`5;17;9;14;5`,keyTimes:`0;0.34;0.58;0.78;1`,calcMode:`spline`,keySplines:`0.42 0 0.25 1;0.45 0 0.2 1;0.4 0 0.3 1;0.42 0 0.3 1`,repeatCount:`indefinite`})})]})})}),(0,U.jsx)(`div`,{"aria-hidden":`true`,"data-theme-decoration":`island-palm`,children:(0,U.jsx)(`span`,{"data-island-palm-part":`frond-wind`})}),p?(0,U.jsx)(Rae,{sidebarCollapsed:d}):null,(0,U.jsxs)(`div`,{className:`relative z-[1] flex min-h-0 flex-1 overflow-hidden`,children:[!l&&(0,U.jsx)(Lae,{}),(0,U.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,U.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:l?(0,U.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:c}):(0,U.jsx)(`main`,{"data-theme-surface":`settings-workspace`,ref:g,onScroll:h,className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:c})})}),n&&r===`docked`?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(J7,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null,s]})]}),f?(0,U.jsx)(K7,{}):null,n&&r===`floating`?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(J7,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null]})}var qae=[{target:`/inbox`,label:()=>b(`inboxTitle`),icon:ao},{target:`/cron`,label:()=>b(`chatSidebarScheduledTasks`),icon:ra},{target:`/skills`,label:()=>b(`chatSidebarSkills`),icon:sa},{target:`/agents`,label:()=>b(`agentsPageTitle`),icon:oa}];function Jae({isCollapsed:e}){let t=b(e?`sidebarExpand`:`sidebarCollapse`);return(0,U.jsx)(V,{icon:(0,U.jsx)(e?Io:Po,{className:rX}),label:t,className:u(oX,e&&`h-9 w-9 rounded-xl`),onClick:oc.toggleSidebarCollapsed})}function Yae({connectionStatus:e,isCollapsed:t}){let n=G7(),r=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`;return(0,U.jsxs)(`div`,{className:u(`flex items-center`,t?`justify-center px-2 py-1.5`:n?`justify-end px-3 py-1.5`:`gap-2 px-4 py-2`,t&&r?`pt-8`:null),children:[t||n?null:(0,U.jsx)(y7,{className:`flex min-w-0 flex-1 items-center gap-2`,suffix:(0,U.jsx)(aae,{status:e})}),(0,U.jsx)(Jae,{isCollapsed:t})]})}function Xae({isCollapsed:e}){let t=D7();return(0,U.jsxs)(`div`,{className:`pb-1`,children:[(0,U.jsx)(`div`,{className:e?`px-0`:`px-3`,children:(0,U.jsx)(`ul`,{className:e?iX:`space-y-0.5`,children:qae.map(n=>(0,U.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,U.jsx)(mX,{to:n.target,label:n.label(),icon:n.icon,density:`compact`,collapsed:e,indicator:n.target===`/inbox`&&t>0,trailing:n.target===`/inbox`&&t>0?t>99?`99+`:t:void 0,className:e?void 0:`rounded-lg px-2.5 py-1.5`})},n.target))})}),(0,U.jsx)(yX,{isCollapsed:e})]})}function Zae({defaultSessionType:e,groups:t,isCollapsed:n,isLoading:r,isProjectFirstView:i,onAddProject:a,onScrollNearEnd:o=()=>void 0,onSelectMode:s,projectGroups:c,projectCronJobCountByRoot:l,renderSessionItem:d,sessionTypeOptions:f}){let{onScroll:p,scrollRef:m}=oY({restorationKey:`chat-sidebar:sessions`,isEnabled:!n});return n?(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,"aria-hidden":`true`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex h-8 items-center justify-end gap-1 px-3`,children:[i?(0,U.jsx)(V,{icon:(0,U.jsx)(Ga,{className:`h-3.5 w-3.5`}),label:b(`chatProjectAdd`),tone:`surface`,onClick:a}):null,(0,U.jsx)(wL,{isProjectFirstView:i,onSelectMode:s})]}),(0,U.jsx)(`div`,{ref:m,onScroll:e=>{p(e);let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<600&&o()},className:u(`custom-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-1`,PF),children:(0,U.jsx)(bae,{isLoading:r,isProjectFirstView:i,groups:t,projectGroups:c,projectCronJobCountByRoot:l,defaultSessionType:e,sessionTypeOptions:f,renderSessionItem:d})})]})}function Qae({currentLanguage:e,currentLanguageLabel:t,currentTheme:n,currentThemeLabel:r,isCollapsed:i,isOpen:a,languageOptions:o,onOpenApps:s,onOpenChange:c,onOpenDocs:l,onSelectLanguage:d,onSelectTheme:f,themeOptions:p}){return(0,U.jsx)(`div`,{className:u(`py-2`,i?u(`flex justify-center`,tX):`px-3`),children:(0,U.jsx)(xae,{isOpen:a,onOpenChange:c,currentTheme:n,currentThemeLabel:r,themeOptions:p,onSelectTheme:f,currentLanguage:e,currentLanguageLabel:t,languageOptions:o,onSelectLanguage:d,onOpenDocs:l,onOpenApps:s,collapsed:i})})}function $ae(e){return b(e===`knowledge-base`?`chatProjectTemplateKnowledgeBase`:`chatProjectTemplateEmpty`)}function eoe({open:e,defaultWorkspacePath:t,templates:n,isCreating:r,isAddingExisting:i,createErrorMessage:a,addExistingErrorMessage:o,onOpenChange:s,onCreate:c,onAddExisting:l}){let[u,d]=(0,H.useState)(`create`),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(!1),[x,S]=(0,H.useState)(`empty`),C=n.length>0?n.map(e=>e.id):[`empty`],w=f.trim(),T=m.trim(),E=g.trim(),D=r||i,O=D||(u===`create`?!w:!E),k=u===`create`?a:o,A=()=>{d(`create`),p(``),h(``),_(``),S(`empty`),y(!1)},j=()=>{D||(A(),s(!1))};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ur,{open:e,onOpenChange:e=>{if(e){s(!0);return}j()},children:(0,U.jsxs)(Kr,{className:`sm:max-w-lg`,children:[(0,U.jsxs)(Wr,{children:[(0,U.jsx)(qr,{children:b(`chatProjectAddTitle`)}),(0,U.jsx)(Br,{children:b(`chatProjectAddDescription`)})]}),(0,U.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),!O&&(u===`create`?c({name:w,template:x,rootPath:T||void 0}):l({rootPath:E})).then(A).catch(()=>void 0)},children:[(0,U.jsxs)(KY,{value:u,onValueChange:e=>{D||d(e===`existing`?`existing`:`create`)},children:[(0,U.jsxs)(qY,{className:`grid w-full grid-cols-2`,children:[(0,U.jsx)(JY,{value:`create`,children:b(`chatProjectCreateMode`)}),(0,U.jsx)(JY,{value:`existing`,children:b(`chatProjectExistingMode`)})]}),(0,U.jsxs)(YY,{value:`create`,className:`mt-4 space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:b(`chatProjectCreateModeDescription`)}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-name`,children:b(`chatProjectNameLabel`)}),(0,U.jsx)(St,{id:`chat-project-name`,value:f,onChange:e=>p(e.target.value),placeholder:b(`chatProjectNamePlaceholder`),autoFocus:!0,disabled:D})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-template`,children:b(`chatProjectTemplateLabel`)}),(0,U.jsxs)(Dr,{value:x,onValueChange:e=>S(e),disabled:D,children:[(0,U.jsx)(yr,{id:`chat-project-template`,children:(0,U.jsx)(fr,{})}),(0,U.jsx)(Sr,{children:C.map(e=>(0,U.jsx)(Tr,{value:e,children:$ae(e)},e))})]})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-create-root-path`,children:b(`chatProjectCreatePathLabel`)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(St,{id:`chat-project-create-root-path`,value:m,onChange:e=>h(e.target.value),placeholder:b(`chatProjectCreatePathPlaceholder`),disabled:D}),(0,U.jsxs)(R,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,U.jsx)(Wa,{className:`mr-2 h-4 w-4`}),b(`browse`)]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:b(`chatProjectCreatePathHint`)})]})]}),(0,U.jsxs)(YY,{value:`existing`,className:`mt-4 space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:b(`chatProjectExistingModeDescription`)}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-existing-root-path`,children:b(`chatProjectExistingPathLabel`)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(St,{id:`chat-project-existing-root-path`,value:g,onChange:e=>_(e.target.value),placeholder:b(`chatProjectExistingPathPlaceholder`),autoFocus:!0,disabled:D}),(0,U.jsxs)(R,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,U.jsx)(Wa,{className:`mr-2 h-4 w-4`}),b(`browse`)]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:b(`chatProjectExistingPathHint`)})]})]})]}),k?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:k}):null,(0,U.jsxs)(Pr,{children:[(0,U.jsx)(R,{type:`button`,variant:`outline`,onClick:j,disabled:D,children:b(`cancel`)}),(0,U.jsx)(R,{type:`submit`,disabled:O,children:b(D?`saving`:u===`create`?`chatProjectCreateAction`:`chatProjectExistingAction`)})]})]})]})}),(0,U.jsx)(GF,{open:v,allowCreateDirectory:u===`create`,currentPath:u===`create`?m:g,defaultWorkspacePath:t,isSaving:!1,onOpenChange:y,onConfirm:e=>{u===`create`?h(e):_(e),y(!1)},title:b(u===`create`?`chatProjectCreatePathPickerTitle`:`chatProjectExistingPathPickerTitle`),description:b(u===`create`?`chatProjectCreatePathPickerDescription`:`chatProjectExistingPathPickerDescription`),pathLabel:b(u===`create`?`chatProjectCreatePathLabel`:`chatProjectExistingPathLabel`),pathPlaceholder:b(u===`create`?`chatProjectCreatePathPlaceholder`:`chatProjectExistingPathPlaceholder`),confirmLabel:b(`selectCurrentDirectory`),hint:b(u===`create`?`chatProjectCreatePathHint`:`chatProjectExistingPathHint`)})]})}function toe(e){let t=L5({all:!0});return(0,H.useMemo)(()=>{let n=new Map(e.flatMap(({session:e})=>{let t=e.projectRoot?.trim();return t?[[e.key,t]]:[]})),r=new Map,i=new Map;for(let e of t.data?.jobs??[]){let t=e.payload.sessionId?.trim();if(!t)continue;r.set(t,(r.get(t)??0)+1);let a=n.get(t);a&&i.set(a,(i.get(a)??0)+1)}return{cronJobCountByProjectRoot:i,cronJobCountBySessionKey:r}},[e,t.data?.jobs])}function noe(e,t,n){let r=aL(e=>e.optimisticReadAtBySessionKey);return(0,H.useEffect)(()=>{(()=>{if(!t)return;let r=e.find(({session:e})=>e.key===t);if(!r||r.runStatus===`running`)return;let{session:i}=r;n(i.key,i.lastMessageAt,i.readAt)})()},[e,n,t]),r}function Y7({variant:e=`desktop`}){let t=e===`mobile`,n=eI(),r=Hi(),i=ac(e=>e.isSidebarCollapsed),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,d]=(0,H.useState)(!1),f=aL(e=>e.snapshot),p=eR(e=>e.snapshot.sessionTypesQuery?.data??null),m=eR(e=>e.snapshot.configQuery?.data??null),h=Ze(),g=oz(),_=nR(),v=rR(),y=iR(),{allItems:x,hasMore:S,isLoading:C,isLoadingMore:w,items:T,loadMore:E}=gL(),{cronJobCountByProjectRoot:D,cronJobCountBySessionKey:O}=toe(x),{language:k,setLanguage:j}=Wn(),{theme:M,setTheme:N}=h7(),P=b(t7.find(e=>e.value===M)?.labelKey??`themeWork`),ee=A.find(e=>e.value===k)?.label??k,te=(0,H.useMemo)(()=>t7.map(e=>({value:e.value,label:b(e.labelKey)})),[]),ne=(0,H.useMemo)(()=>A.map(e=>({value:e.value,label:e.label})),[]),re=(0,H.useMemo)(()=>new Map((g.data?.agents??[]).map(e=>[e.id,e])),[g.data?.agents]),ie=(0,H.useMemo)(()=>new Set(f.pinnedSessionKeys),[f.pinnedSessionKeys]),ae=(0,H.useMemo)(()=>new Set(f.pinnedProjectRoots),[f.pinnedProjectRoots]),oe=(0,H.useMemo)(()=>vL(T),[T]),se=(0,H.useMemo)(()=>SL(x),[x]),ce=(0,H.useMemo)(()=>bL(oe,ie),[ie,oe]),le=(0,H.useMemo)(()=>xL(oe,ie,ae,_.data?.projects??[]),[ae,ie,_.data?.projects,oe]),ue=(0,H.useMemo)(()=>kL(p?.options??[]),[p?.options]),de=(0,H.useMemo)(()=>EL(p?.defaultType??`native`),[p?.defaultType]),fe=gR({defaultSessionType:de,sessionTypeOptions:ue}),pe=f.listMode===`project-first`,me=!t&&i,he=noe(T,f.selectedSessionKey,n.chatSessionListManager.markSessionRead),{editingSessionKey:ge,draftLabel:_e,savingSessionKey:ve,setDraftLabel:ye,startEditingSessionLabel:be,cancelEditingSessionLabel:F,saveSessionLabel:xe}=Tie(),Se=e=>{k!==e&&(j(e),window.location.reload())},Ce=e=>(0,U.jsx)(Kie,{item:e,selectedSessionKey:f.selectedSessionKey,optimisticReadAtBySessionKey:he,agentsById:re,childSessionsByParentKey:se,cronJobCount:O.get(e.session.key)??0,editingSessionKey:ge,draftLabel:_e,savingSessionKey:ve,sessionTypeOptions:ue,isPinned:ie.has(e.session.key),sessionTitle:CL,onSelectSession:n.chatSessionListManager.selectSession,onStartEditingSessionLabel:be,onDraftLabelChange:ye,onSaveSessionLabel:xe,onCancelEditingSessionLabel:F,onTogglePinned:()=>n.chatSessionListManager.toggleSessionPinned(e.session.key),onDeleteSession:n.chatThreadManager.deleteSession},e.session.key),we=(e,t)=>{n.chatSessionListManager.createSession({projectRoot:typeof t==`string`?t:void 0,sessionType:e})},Te=()=>{v.reset(),y.reset(),c(!0)},Ee=async e=>{await v.mutateAsync(e),c(!1)},De=async e=>{await y.mutateAsync(e),c(!1)};return(0,U.jsxs)(`aside`,{"data-theme-surface":`navigation`,className:u(`flex h-full min-h-0 flex-col bg-secondary transition-[width] duration-200 ease-out`,t?`flex-1 overflow-hidden`:me?u(eX,`shrink-0`):`w-[280px] shrink-0`),"data-sidebar-collapsed":me?`true`:`false`,children:[t?null:(0,U.jsx)(Yae,{connectionStatus:h.connectionStatus,isCollapsed:me}),t?(0,U.jsx)(Yie,{query:f.query,defaultSessionType:fe.selectedSessionType,sessionTypeOptions:ue,selectedNewSessionType:fe.selectedSessionType,selectedNewSessionTypeOption:fe.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:we,onSelectNewSessionType:fe.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery}):(0,U.jsx)(Jie,{query:f.query,defaultSessionType:de,sessionTypeOptions:ue,selectedNewSessionType:fe.selectedSessionType,selectedNewSessionTypeOption:fe.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:we,onSelectNewSessionType:fe.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery,collapsed:me}),t?null:(0,U.jsx)(Xae,{isCollapsed:me}),(0,U.jsx)(Zae,{defaultSessionType:fe.selectedSessionType,groups:ce,isCollapsed:me,isLoading:C,isProjectFirstView:pe,onAddProject:Te,onScrollNearEnd:()=>{S&&!w&&E()},onSelectMode:n.chatSessionListManager.setListMode,projectGroups:le,projectCronJobCountByRoot:D,renderSessionItem:Ce,sessionTypeOptions:ue}),t?null:(0,U.jsx)(Qae,{currentLanguage:k,currentLanguageLabel:ee,currentTheme:M,currentThemeLabel:P,isCollapsed:me,isOpen:l,languageOptions:ne,onOpenApps:()=>L1(r),onOpenChange:d,onOpenDocs:()=>r.open(void 0,{kind:`docs`,title:b(`docBrowserHelp`)}),onSelectLanguage:Se,onSelectTheme:N,themeOptions:te}),(0,U.jsx)(eoe,{open:s,defaultWorkspacePath:pI(m?.agents.defaults.workspace),templates:_.data?.templates??[],isCreating:v.isPending,isAddingExisting:y.isPending,createErrorMessage:v.error?.message,addExistingErrorMessage:y.error?.message,onOpenChange:c,onCreate:Ee,onAddExisting:De})]})}var X7=`sid_`,Z7=`/chat/draft`,roe=Z7.slice(6);function ioe(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return`${X7}${btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}`}function aoe(e){if(!e.startsWith(X7))return null;let t=e.slice(4).replace(/-/g,`+`).replace(/_/g,`/`),n=`=`.repeat((4-t.length%4)%4);try{let e=atob(t+n),r=Uint8Array.from(e,e=>e.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function Q7(e){if(!e||e===roe)return null;let t=aoe(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function $7(e){return`/chat/${ioe(e)}`}function e9(e,t){let n=t.trim();return n?e.includes(n)?e.filter(e=>e!==n):[n,...e]:e}var ooe=class{constructor(e){this.uiManager=e,this.syncDraftThreadState=e=>{let t=$.getState().snapshot.workspaceFileTabs.filter(e=>e.parentSessionKey!==null);$.getState().setSnapshot({sessionKey:null,sessionDisplayName:void 0,draftProjectRoot:e,canDeleteSession:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null,workspaceFileTabs:t,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0})},this.resolveUpdateValue=(e,t)=>typeof t==`function`?t(e):t,this.shouldPersistReadAt=(e,t,n)=>{let r=aL.getState().optimisticReadAtBySessionKey[e],i=r&&n?r.localeCompare(n)>0?r:n:r??n??void 0;return i?t.localeCompare(i)>0:!0},this.setSelectedAgentId=e=>{let t=aL.getState().snapshot.selectedAgentId,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({selectedAgentId:n})},this.syncSelectedSessionAgent=()=>{let e=$.getState().snapshot.agentId?.trim();e&&this.setSelectedAgentId(e)},this.setSelectedSessionKey=e=>{e!==aL.getState().snapshot.selectedSessionKey&&aL.getState().setSnapshot({selectedSessionKey:e})},this.syncRouteSessionSelection=e=>{this.setSelectedSessionKey(e),e&&$.getState().setSnapshot({draftProjectRoot:null})},this.setListMode=e=>{let t=aL.getState().snapshot.listMode,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({listMode:n})},this.toggleSessionPinned=e=>{let{pinnedSessionKeys:t}=aL.getState().snapshot;aL.getState().setSnapshot({pinnedSessionKeys:e9(t,e)})},this.toggleProjectPinned=e=>{let{pinnedProjectRoots:t}=aL.getState().snapshot;aL.getState().setSnapshot({pinnedProjectRoots:e9(t,e)})},this.toggleProjectCollapsed=e=>{let{collapsedProjectRoots:t}=aL.getState().snapshot;aL.getState().setSnapshot({collapsedProjectRoots:e9(t,e)})},this.markSessionRead=(e,t,n)=>{let r=e?.trim(),i=t?.trim();!r||!i||this.shouldPersistReadAt(r,i,n)&&(aL.getState().markSessionRead(r,i),Qe(r,{uiReadAt:i}).catch(()=>void 0))},this.markVisibleWorkspaceChildRead=e=>{this.markSessionRead(e.sessionKey,e.runStatus===`running`?null:e.lastMessageAt,e.readAt)},this.createSession=(e={})=>{let{projectRoot:t,prompt:n,sessionType:r}=e,i=EL(r??`native`),a=pI(t),o=n?.trim()||null;this.syncDraftThreadState(a),this.uiManager.navigateTo(Z7,{replace:this.uiManager.isAtChatRoot(),state:{chatDraft:{sessionType:i,projectRoot:a,prompt:o}}})},this.startAgentDraftChat=(e,t,n)=>{let r=e.trim()||`main`;this.createSession({prompt:n,sessionType:t}),this.setSelectedAgentId(r)},this.selectSession=e=>{this.uiManager.goToSession(e)},this.setQuery=e=>{let t=aL.getState().snapshot.query,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({query:n})}}},soe=async()=>!1,coe=class{constructor(e){this.docBrowserManager=e,this.state={pathname:``},this.actions={navigate:null,confirm:soe},this.syncState=e=>{this.state={...this.state,...e}},this.bindActions=e=>{this.actions={...this.actions,...e}},this.confirm=async e=>this.actions.confirm(e),this.navigateTo=(e,t)=>{this.actions.navigate&&(this.state.pathname===e&&!t?.replace||(this.actions.navigate(e,t),this.state.pathname=e))},this.goToProviders=()=>{this.navigateTo(`/providers`)},this.isCompactViewport=()=>oc.getSnapshot().mode===`mobile`,this.resolvePanelAppEntry=async e=>{let t=e.trim();if(!t)return null;try{return U1((await I.panelApps.listPanelApps()).entries,t)}catch{return null}},this.showContent=async e=>{let{target:t,title:n}=e;if(t.type===`url`){this.docBrowserManager.open(t.payload.url,{dedupeKey:`browser:${t.payload.url}`,kind:`content`,title:n});return}let{appId:r,params:i,path:a}=t.payload;if(a){this.docBrowserManager.open(a1(r,a),{contentParams:i,title:n});return}let o=await this.resolvePanelAppEntry(r);if(o){this.docBrowserManager.openTarget({...f1(o),contentParams:i},{title:n});return}this.docBrowserManager.open(a1(r),{contentParams:i,title:n})},this.goToChatRoot=e=>{this.navigateTo(`/chat`,e)},this.isAtChatRoot=()=>this.state.pathname===`/chat`||this.state.pathname===`/chat/draft`,this.goToSession=(e,t)=>{this.navigateTo($7(e),t)}}};function t9(e){let t=e=>{if(!e||typeof e!=`object`)return e;let t=e,n=t.error instanceof Error?{name:t.error.name,message:t.error.message}:t.error;return{data:t.data,error:n,status:t.status,fetchStatus:t.fetchStatus,isLoading:t.isLoading,isFetching:t.isFetching,isFetched:t.isFetched,isSuccess:t.isSuccess}};return{configQuery:t(e.configQuery),providersQuery:t(e.providersQuery),providerTemplatesQuery:t(e.providerTemplatesQuery),sessionsQuery:t(e.sessionsQuery),sessionTypesQuery:t(e.sessionTypesQuery),sessionSkillsSessionId:e.sessionSkillsSessionId,sessionSkillsQuery:t(e.sessionSkillsQuery)}}function loe(e,t){return JSON.stringify(t9(e))!==JSON.stringify(t9({...e,...t}))}var uoe=class{constructor(){this.syncSnapshot=e=>{let t=eR.getState();loe(t.snapshot,e)&&t.setSnapshot(e)}}};function doe(){return{sessionKey:null,sessionTypeLabel:null,agentId:null,sessionDisplayName:void 0,draftProjectRoot:null,sessionProjectName:null,canDeleteSession:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,workspaceFileTabs:[],activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0}}function n9(e,t,n){return e===t?n:e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?`${n}${e.slice(t.length)}`:null}function foe(e,t){let n=t.previousPath.trim(),r=t.path.trim();if(!n||!r||n===r)return null;let i=new Map,a=e.workspaceFileTabs.map(e=>{let a=n9(e.path,n,r);if(!a)return e;let o=LR(e,a,e.path===n?t.label:e.label);return i.set(e.key,o.key),o});if(i.size===0)return null;let o=e=>e.kind===`file`&&i.has(e.key)?{kind:`file`,key:i.get(e.key)}:e;return{workspaceFileTabs:a,activeWorkspaceFileKey:e.activeWorkspaceFileKey?i.get(e.activeWorkspaceFileKey)??e.activeWorkspaceFileKey:null,closedWorkspaceTabEntries:e.closedWorkspaceTabEntries.map(o),workspaceNavigationHistory:e.workspaceNavigationHistory.map(o)}}function poe(e,t){let n=t.trim();if(!n)return null;let r=e,i=e.workspaceFileTabs.filter(e=>n9(e.path,n,n)!==null).map(e=>e.key);for(let e of i){let t=HR(r,{kind:`file`,key:e});t&&(r={...r,...t})}return i.length>0?r:null}var moe=class{constructor(e,t,n){this.uiManager=e,this.sessionListManager=t,this.onWorkspacePanelOpened=n,this.handledUiShowContentEventIds=new Set,this.hasSnapshotChanges=e=>{let t=$.getState().snapshot;for(let[n,r]of Object.entries(e))if(!Object.is(t[n],r))return!0;return!1},this.syncSnapshot=e=>{this.hasSnapshotChanges(e)&&$.getState().setSnapshot(e)},this.clearDeletedSessionState=()=>{$.getState().setSnapshot(doe())},this.resolveWorkspaceParentSessionKey=()=>aL.getState().snapshot.selectedSessionKey?.trim()||$.getState().snapshot.sessionKey?.trim()||(aL.getState().snapshot.selectedSessionKey??null),this.activateWorkspaceFileTab=(e,t)=>{let{parentSessionKey:n}=e,{workspaceFileTabs:r}=$.getState().snapshot;this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:`file`,workspaceFileTabs:IR(r,e,t),activeWorkspaceFileKey:e.key,activeChildSessionKey:null,activeSideChatDraft:null},{kind:`file`,key:e.key}),this.ensureWorkspaceParentRoute(n),this.onWorkspacePanelOpened?.()},this.ensureWorkspaceParentRoute=e=>{if(!e)return;let{snapshot:{selectedSessionKey:t}}=aL.getState();t!==e&&this.uiManager.goToSession(e)},this.setWorkspaceSelection=(e,t)=>{let{snapshot:n}=$.getState(),r=oi({entries:n.workspaceNavigationHistory,index:n.workspaceNavigationHistoryIndex},t,zR),i=e.workspacePanelParentKey&&e.workspacePanelParentKey!==n.workspacePanelParentKey?[]:n.closedWorkspaceTabEntries.filter(e=>!zR(e,t));$.getState().setSnapshot({...e,closedWorkspaceTabEntries:i,workspaceNavigationHistory:[...r.entries],workspaceNavigationHistoryIndex:r.index})},this.openWorkspacePage=(e,t)=>{let n=e?.trim()||null;!n&&t!==`project-files`||(this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:t,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null},{kind:t}),this.ensureWorkspaceParentRoute(n),this.onWorkspacePanelOpened?.())},this.openWorkspaceOverview=e=>{this.openWorkspacePage(e,`overview`)},this.toggleWorkspacePanel=e=>{let t=e?.trim()||null,{snapshot:n}=$.getState();if(n.workspacePanelParentKey===t&&n.activeWorkspacePanelKind){this.closeWorkspacePanel();return}if(t){this.openWorkspaceOverview(t);return}this.openProjectFiles(null)},this.setWorkspacePanelWidth=e=>{this.syncSnapshot({workspacePanelWidth:kR(e)})},this.setWorkspaceExplorerWidth=e=>{this.syncSnapshot({workspaceExplorerWidth:AR(e)})},this.renameWorkspacePath=e=>{let t=foe($.getState().snapshot,e);t&&this.syncSnapshot(t)},this.removeWorkspacePath=e=>{let t=poe($.getState().snapshot,e);t&&$.getState().setSnapshot(t)},this.openChildSessions=e=>this.openWorkspacePage(e,`child-sessions`),this.openContinuousAttention=e=>this.openWorkspacePage(e,`continuous-attention`),this.openProjectFiles=e=>this.openWorkspacePage(e,`project-files`),this.materializeRootDraftSession=e=>{let t=e.trim();if(!t||!this.uiManager.isAtChatRoot())return;let n=GR($.getState().snapshot,t);n&&(this.sessionListManager.syncRouteSessionSelection(t),$.getState().setSnapshot(n),this.uiManager.goToSession(t,{replace:!0}))},this.openChildSessionPanel=e=>{let{activeChildSessionKey:t,childSessionTab:n,parentSessionKey:r}=e,i=r.trim();if(!i)return;let a=t?.trim()||null,o={workspacePanelParentKey:i,activeWorkspacePanelKind:`child-session`,activeChildSessionKey:a,activeSideChatDraft:null,activeWorkspaceFileKey:null};a&&n&&(o.childSessionTabs=WR($.getState().snapshot.childSessionTabs,{sessionKey:a,parentSessionKey:i,label:n.label?.trim()||null,agentId:n.agentId?.trim()||null})),a?this.setWorkspaceSelection(o,{kind:`child-session`,key:a}):$.getState().setSnapshot(o),this.ensureWorkspaceParentRoute(i),this.onWorkspacePanelOpened?.()},this.openSideChatDraft=e=>{let t=e?.trim()||this.resolveWorkspaceParentSessionKey()?.trim();if(!t)return;let n=UR(t);this.setWorkspaceSelection({workspacePanelParentKey:t,activeWorkspacePanelKind:`side-chat-draft`,activeChildSessionKey:null,activeSideChatDraft:n,activeWorkspaceFileKey:null},{kind:`side-chat-draft`,key:n.draftKey}),this.ensureWorkspaceParentRoute(t),this.onWorkspacePanelOpened?.()},this.materializeSideChatDraft=e=>{let t=KR({snapshot:$.getState().snapshot,...e});t&&($.getState().setSnapshot(t.patch),this.ensureWorkspaceParentRoute(t.parentSessionKey))},this.openFilePreview=e=>{let t=FR(e,this.resolveWorkspaceParentSessionKey());t&&this.activateWorkspaceFileTab(t)},this.openWorkspaceFileViewer=(e,t)=>{let n=$.getState().snapshot.workspaceFileTabs.find(t=>t.key===e.trim());if(!n||n.viewMode!==`preview`)return;let r=t??PR(n.path,n.previewViewer);if(!r)return;let i=FR({path:n.path,label:n.label??void 0,viewMode:`preview`,previewViewer:r,line:n.line??void 0,column:n.column??void 0,params:n.params??void 0,rawText:n.rawText??void 0,contentUrl:n.contentUrl??void 0,mimeType:n.mimeType??void 0},n.parentSessionKey);i&&this.activateWorkspaceFileTab(i,n.key)},this.openSessionFromToolAction=e=>{if(e.kind!==`open-session`)return;let t=e.sessionId.trim();if(t){if(e.sessionKind===`child`&&!this.uiManager.isCompactViewport()){let n=e.parentSessionId?.trim()||aL.getState().snapshot.selectedSessionKey||null;if(n){this.openChildSessionPanel({parentSessionKey:n,activeChildSessionKey:t,childSessionTab:{label:e.label,agentId:e.agentId}});return}}this.closeWorkspacePanel(),this.uiManager.goToSession(t)}},this.handleToolAction=async e=>{if(e.kind===`show-content`){await this.showContent(e.request);return}this.openSessionFromToolAction(e)},this.handleUiShowContentEvent=async e=>{let t=e.id.trim();!t||this.handledUiShowContentEventIds.has(t)||(this.handledUiShowContentEventIds.add(t),await this.showContent({target:e.target,title:e.title,purpose:e.purpose,placement:e.placement}))},this.showContent=async e=>{if(e.placement!==`inline`){if(e.target.type===`file`){this.openFilePreview({path:e.target.payload.path,label:e.title,viewMode:`preview`,previewViewer:e.target.payload.viewer,line:e.target.payload.line,column:e.target.payload.column,params:e.target.payload.params});return}await this.uiManager.showContent({target:e.target,title:e.title})}},this.syncVisibleWorkspaceSelection=e=>{e?.kind===`child-session`&&this.sessionListManager.markVisibleWorkspaceChildRead(e.tab)},this.selectChildSessionDetail=e=>{let t=e.trim();t&&this.setWorkspaceSelection({activeChildSessionKey:t,activeWorkspaceFileKey:null,activeWorkspacePanelKind:`child-session`,activeSideChatDraft:null},{kind:`child-session`,key:t})},this.selectWorkspaceFile=e=>{let t=e.trim();if(!t)return;let{workspaceFileTabs:n}=$.getState().snapshot;n.some(e=>e.key===t)&&this.setWorkspaceSelection({activeWorkspaceFileKey:t,activeChildSessionKey:null,activeWorkspacePanelKind:`file`,activeSideChatDraft:null},{kind:`file`,key:t})},this.closeWorkspaceTab=e=>{let{snapshot:t}=$.getState(),n=HR(t,e);n&&$.getState().setSnapshot(n)},this.closeWorkspacePanel=()=>{$.getState().setSnapshot({workspacePanelParentKey:null,activeWorkspacePanelKind:null,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0})},this.openSessionCronPanel=e=>{this.openWorkspacePage(e,`cron`)},this.goBackWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`back`)},this.goForwardWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`forward`)},this.restoreWorkspaceNavigationStep=e=>{let{snapshot:t}=$.getState(),n=si({entries:t.workspaceNavigationHistory,index:t.workspaceNavigationHistoryIndex},e);if(!n)return;let r=VR(n.entry,t);r&&$.getState().setSnapshot({...r,workspaceNavigationHistory:[...n.history.entries],workspaceNavigationHistoryIndex:n.history.index})},this.goToParentSession=()=>{let{parentSessionKey:e,activeSideChatDraft:t,childSessionTabs:n,activeChildSessionKey:r}=$.getState().snapshot,i=n.find(e=>e.sessionKey===r)?.parentSessionKey??null,a=e??t?.parentSessionKey??i;a&&(this.closeWorkspacePanel(),this.uiManager.goToSession(a))},this.deleteSession=async e=>{let{snapshot:{selectedSessionKey:t}}=aL.getState(),n=e?.trim()||t;if(n&&await this.uiManager.confirm({title:b(`chatDeleteSessionConfirm`),variant:`destructive`,confirmLabel:b(`delete`)})){$.getState().setSnapshot({isDeletePending:!0});try{await Ft(n),et(jt,n),jt.removeQueries({queryKey:[`ncp-session-messages`,n]}),L.success(b(`chatDeleteSessionSucceeded`)),n===t&&(this.clearDeletedSessionState(),this.uiManager.goToChatRoot({replace:!0}))}catch(e){let t=e instanceof Error?e.message:String(e);L.error(`${b(`chatDeleteSessionFailed`)}: ${t}`)}finally{$.getState().setSnapshot({isDeletePending:!1})}}}}},hoe=class{constructor(e){this.chatUiManager=new coe(e.docBrowserManager),this.chatSessionListManager=new ooe(this.chatUiManager),this.chatQueryManager=new uoe,this.chatComposerIntentManager=e.chatComposerIntentManager,this.chatThreadManager=new moe(this.chatUiManager,this.chatSessionListManager,e.notifyRightPanelOpened)}},goe=class{constructor(){this.nextId=0,this.pendingIntent=null,this.listeners=new Set,this.requestDraft=e=>{let t=e.trim();if(!t)return;let n={id:this.nextId+1,kind:`prompt`,prompt:t};this.nextId=n.id,this.pendingIntent=n,this.listeners.forEach(e=>e(n))},this.requestSystemObjectReference=e=>{let t={id:this.nextId+1,kind:`system-object-reference`,reference:structuredClone(e)};this.nextId=t.id,this.pendingIntent=t,this.listeners.forEach(e=>e(t))},this.consumePending=()=>{let e=this.pendingIntent;return this.pendingIntent=null,e},this.markConsumed=e=>{this.pendingIntent?.id===e&&(this.pendingIntent=null)},this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})}};function r9(e,t){let n=2166136261;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return`${e}#excerpt-${(n>>>0).toString(36)}`}var _oe=class{constructor(){this.nextId=0,this.pendingIntent=null,this.subscriptions=new Set,this.publish=e=>{let t=this.nextId+1,n=e.targetSessionKey?.trim()||null,r={...e,id:t,targetSessionKey:n};this.nextId=r.id,this.pendingIntent=r,this.subscriptions.forEach(e=>{e.targetSessionKey===r.targetSessionKey&&e.listener(r)})},this.requestFileReference=e=>{let t=e.tokenKey.trim(),n=e.label.trim();!t||!n||this.publish({kind:r,targetSessionKey:e.targetSessionKey?.trim()||null,tokenKey:t,label:n})},this.requestDirectoryReference=e=>{let t=e.tokenKey.trim(),n=e.label.trim();!t||!n||this.publish({kind:p,targetSessionKey:e.targetSessionKey?.trim()||null,tokenKey:t,label:n})},this.requestExcerptReference=e=>{let{endLine:t,excerpt:n,label:r,path:i,startLine:a,targetSessionKey:o}=e,s=i.trim(),c=r.trim(),l=n.trim();!s||!c||!l||this.publish({kind:O,targetSessionKey:o,tokenKey:r9(s,`${s}:${a??`x`}:${t??`x`}:${l}`),path:s,label:c,excerpt:l,startLine:a,endLine:t})},this.requestConversationExcerptReference=e=>{let{targetSessionKey:t,messageId:n,role:r,label:i,excerpt:a}=e,o=n.trim(),s=i.trim(),c=a.trim();!o||!s||!c||this.publish({kind:te,targetSessionKey:t,tokenKey:r9(o,`${o}:${c}`),messageId:o,role:r,label:s,excerpt:c})},this.requestUiResourceReference=e=>{let t=x(e.reference);if(!t)return;let n=t.uri.trim(),r=t.title.trim();this.publish({kind:re,targetSessionKey:e.targetSessionKey,tokenKey:n,label:r,reference:t})},this.consumePending=e=>{if(this.pendingIntent?.targetSessionKey!==e)return null;let t=this.pendingIntent;return this.pendingIntent=null,t},this.markConsumed=e=>{this.pendingIntent?.id===e&&(this.pendingIntent=null)},this.subscribe=(e,t)=>{let n={targetSessionKey:e,listener:t};return this.subscriptions.add(n),()=>{this.subscriptions.delete(n)}}}},i9=120,voe=200;function yoe(e){return[e?.parent_session_id,e?.parentSessionId].some(e=>typeof e==`string`&&e.trim().length>0)}function boe(e){let t=e.replace(/\r\n?/gu,`
|
|
109
|
-
`).replace(/^[ \t]*\[[^\]]+\]:\s+\S+.*$/gmu,` `).replace(/^[ \t]*(?:`{3,}|~{3,})[^\n]*$/gmu,` `).replace(/^[ \t]*\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?[ \t]*$/gmu,` `).replace(/^[ \t]*(?:[-*_][ \t]*){3,}$/gmu,` `).replace(/!\[([^\]]*)\]\([^\n)]+\)/gu,`$1`).replace(/\[([^\]]+)\]\([^\n)]+\)/gu,`$1`).replace(/\[([^\]]+)\]\[[^\]]*\]/gu,`$1`).replace(/<(https?:\/\/[^>\s]+)>/gu,`$1`).replace(/<[^>]+>/gu,` `).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gmu,``).replace(/^[ \t]*>+[ \t]?/gmu,``).replace(/^[ \t]*(?:[-+*]|\d+[.)])[ \t]+/gmu,``).replace(/^[ \t]*\[(?: |x|X)\][ \t]*/gmu,``).replace(/(`+)([^`]*?)\1/gu,`$2`).replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/gu,`$2`).replace(/~~(?=\S)([\s\S]*?\S)~~/gu,`$1`).replace(/\*(?=\S)([^*\n]*?\S)\*/gu,`$1`).replace(/\\([\\`*{}[\]()#+.!_>-])/gu,`$1`).replace(/^[ \t]*\|(.+)\|[ \t]*$/gmu,(e,t)=>t.split(`|`).map(e=>e.trim()).filter(Boolean).join(` `)).replace(/\s+/gu,` `).trim(),n=Array.from(t);return n.length<=i9?t:`${n.slice(0,i9-1).join(``)}…`}function xoe(e){return boe(e.parts.filter(e=>e.type===`text`||e.type===`rich-text`).map(e=>e.text).join(` `))}var Soe=class{constructor(e){this.notificationManager=e,this.cleanups=[],this.handledMessageIds=new Set,this.visibleSessionIds=new Set,this.started=!1,this.start=()=>{this.started||(this.started=!0,this.cleanups.push(I.eventBus.on(c.ncpEvent,this.handleNcpEvent)))},this.stop=()=>{if(this.started)for(this.started=!1;this.cleanups.length>0;)this.cleanups.pop()?.()},this.syncVisibleSessions=e=>{this.visibleSessionIds=new Set(e.map(e=>e?.trim()).filter(e=>!!e))},this.handleNcpEvent=e=>{if(e.type!==gK.MessageCompleted)return;let{message:t}=e.payload,n=e.payload.sessionId.trim();if(!n||this.handledMessageIds.has(t.id)||t.role!==`assistant`||t.status!==`final`||lK(t)||(this.rememberHandledMessage(t.id),this.visibleSessionIds.has(n)))return;let r=this.resolveSessionSummary(n),i=CK(t.metadata);if(i&&i.actor!==`human`||!i&&r&&yoe(r.metadata))return;let a=r?nI(KI(r)):b(`chatBackgroundReplyFallbackTitle`),o=xoe(t);this.notificationManager.show({id:`chat-reply:${t.id}`,title:a,description:o||b(`chatBackgroundReplyFallbackPreview`),href:$7(n),ariaLabel:b(`chatBackgroundReplyOpenAriaLabel`).replace(`{title}`,a)})},this.resolveSessionSummary=e=>(eR.getState().snapshot.sessionsQuery?.data?.sessions??[]).find(t=>t.sessionId===e),this.rememberHandledMessage=e=>{if(this.handledMessageIds.add(e),this.handledMessageIds.size<=voe)return;let t=this.handledMessageIds.values().next().value;t&&this.handledMessageIds.delete(t)}}};function a9(){return Sn({queryKey:[`ncp-session-types`],queryFn:Et,staleTime:1e4,retry:!1})}var o9=`relative ml-auto flex min-h-[74px] w-[320px] max-w-[calc(100vw-2rem)] rounded-[20px] border border-border/80 bg-background text-left text-foreground shadow-[0_8px_18px_rgba(0,0,0,0.12),0_2px_5px_rgba(0,0,0,0.06)]`,s9=`flex min-h-[72px] min-w-0 flex-1 items-center gap-3 rounded-[inherit] py-3 pl-[18px] pr-[52px]`;function c9({title:e,description:t,iconSrc:n}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-border/80 bg-background p-[3px]`,children:(0,U.jsx)(`img`,{"aria-hidden":`true`,alt:``,src:n??`/logo.svg`,className:`h-full w-full object-contain`})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[15px] font-semibold leading-5 tracking-[-0.01em]`,children:e}),t?(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[14px] leading-5 text-muted-foreground`,children:t}):null]})]})}function l9({dismissLabel:e,onDismiss:t}){return(0,U.jsx)(V,{className:`absolute right-2.5 top-2.5 z-10`,icon:(0,U.jsx)(ki,{className:`h-4 w-4`,"aria-hidden":`true`}),label:e,onClick:t,size:`lg`,tooltipSide:`left`})}function Coe({title:e,description:t,href:n,iconSrc:r,ariaLabel:i,dismissLabel:a,onDismiss:o}){let s=i??[e,t].filter(Boolean).join(`: `);return n?(0,U.jsxs)(`div`,{className:o9,children:[(0,U.jsx)(ue,{to:n,"aria-label":s,className:`${s9} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50`,onClick:o,children:(0,U.jsx)(c9,{title:e,description:t,iconSrc:r})}),(0,U.jsx)(l9,{dismissLabel:a,onDismiss:o})]}):(0,U.jsxs)(`div`,{className:o9,children:[(0,U.jsx)(`div`,{role:`status`,"aria-label":s,className:s9,children:(0,U.jsx)(c9,{title:e,description:t,iconSrc:r})}),(0,U.jsx)(l9,{dismissLabel:a,onDismiss:o})]})}var woe=8e3,Toe=class{constructor(){this.show=e=>L.custom(t=>(0,H.createElement)(Coe,{title:e.title,description:e.description,href:e.href,iconSrc:e.iconSrc,ariaLabel:e.ariaLabel,dismissLabel:e.dismissLabel??b(`notificationDismiss`),onDismiss:()=>{L.dismiss(t)}}),{id:e.id,duration:e.durationMs??woe,unstyled:!0}),this.dismiss=e=>{L.dismiss(e)}}},Eoe=`nextclaw://docs`,u9=`github-project`,Doe=`https://github.com/Peiiii/nextclaw`;function d9(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:b(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:J$}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:b(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:Eoe}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:b(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:K$}},{builtIn:!0,icon:{type:`builtin`,name:`github`},id:u9,label:b(`sideDockGitHubProject`),removable:!1,target:{type:`external-url`,url:Doe}}]}var Ooe=[`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`];function f9(e){return!!e&&typeof e==`object`}function koe(e){return Ooe.includes(e)}function Aoe(e){return!f9(e)||typeof e.type!=`string`?null:e.type===`builtin`&&koe(e.name)?{type:`builtin`,name:e.name}:e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function joe(e){if(!f9(e)||typeof e.id!=`string`||e.id.trim().length===0||typeof e.label!=`string`||e.label.trim().length===0||typeof e.createdAt!=`string`||e.createdAt.trim().length===0||!f9(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=Aoe(e.icon);return t?{createdAt:e.createdAt,icon:t,id:e.id.trim(),label:e.label.trim(),target:{type:`right-panel-resource`,uri:e.target.uri.trim()}}:null}function p9(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=joe(e);n&&t.set(n.id,n)}),Array.from(t.values())}function Moe(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function Noe(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function Poe(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function m9(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(Noe).filter(e=>e!==null)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(Poe);return[...e,...i]}var Foe=`nextclaw.side-dock.state`,Ioe=1;function h9(e){return!!e&&typeof e==`object`}var g9=P()(ji(e=>({isVisible:!0,pinnedItems:[],setVisible:t=>e({isVisible:t}),setPinnedItems:t=>e({pinnedItems:p9(t)})}),{name:Foe,version:Ioe,storage:Mi(()=>window.localStorage),partialize:e=>({isVisible:e.isVisible,pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=h9(e)?p9(e.pinnedItems):[],r=h9(e)&&typeof e.isVisible==`boolean`?e.isVisible:!0;return{...t,isVisible:r,pinnedItems:n}}})),Loe={apps:Zr,docs:Ti,github:ti,"new-tab":Di,"panel-app":di,"service-apps":di},Roe=new Set([u9]),zoe=/^\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*$/u;function Boe(e){return zoe.test(e.trim())}function Voe({icon:e}){if(e.type===`url`)return(0,U.jsx)(`img`,{src:e.url,alt:``,className:`h-5 w-5 rounded object-cover`});if(e.type===`text`)return Boe(e.value)?(0,U.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center text-[20px] leading-none`,"aria-hidden":`true`,children:e.value}):(0,U.jsx)(`span`,{className:`max-w-7 truncate text-center text-[13px] font-semibold leading-none`,"aria-hidden":`true`,children:e.value});let t=Loe[e.name];return(0,U.jsx)(t,{className:`h-5 w-5`,"aria-hidden":`true`})}function _9({active:e,item:t,onOpen:n,onUnpin:r}){let{label:i}=t;return(0,U.jsxs)(pi,{children:[(0,U.jsxs)(`div`,{className:`group relative`,children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":i,title:i,"data-side-dock-item-id":t.id,onClick:()=>n(t),className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e?`bg-primary/10 text-primary`:`bg-transparent`),children:(0,U.jsx)(Voe,{icon:t.icon})})}),t.removable?(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`sideDockUnpinItem`),title:b(`sideDockUnpinItem`),onClick:e=>{e.stopPropagation(),r(t)},className:`absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-background text-muted-foreground shadow-sm ring-1 ring-border/70 transition-colors hover:bg-muted hover:text-foreground group-hover:flex focus-visible:flex focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:(0,U.jsx)(ki,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]}),(0,U.jsx)(li,{side:`left`,children:i})]})}function Hoe({icon:e,label:t,onClick:n}){return(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":t,title:t,"data-side-dock-action":`hide`,onClick:n,className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`),children:(0,U.jsx)(e,{className:`h-5 w-5`,"aria-hidden":`true`})})}),(0,U.jsx)(li,{side:`left`,children:t})]})}function v9(e){return e?.trim()??``}function y9(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function b9(e,t,n,r=!1){if(!t||!n)return!1;let i=v9(y9(e)??void 0);if(!i)return!1;let a=v9(n.resourceUri);return a&&a===i||v9(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function Uoe(e,t){if(!t)return!1;let n=v9(t.resourceUri),r=v9(t.currentUrl);return e.some(e=>{let t=v9(y9(e)??void 0);return t===n||t===r})}function x9(e){return Roe.has(e.id)}function Woe({manager:e}){let t=g9(e=>e.pinnedItems),n=g9(e=>e.setVisible),{currentTab:r,isOpen:i}=Hi(),{confirm:a,ConfirmDialog:o}=On(),s=m9(d9(),t),c=s.filter(e=>!x9(e)),l=s.filter(x9),u=Uoe(s,r),d=async()=>{await a({title:b(`sideDockHideConfirmTitle`),description:b(`sideDockHideConfirmDescription`),confirmLabel:b(`sideDockHideConfirmAction`),cancelLabel:b(`cancel`)})&&n(!1)};return(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(`aside`,{"data-testid":`side-dock`,"data-theme-surface":`utility-rail`,className:`z-30 flex h-full w-14 shrink-0 flex-col items-center gap-1 border-l border-border/60 bg-background/95 px-2 py-3`,children:[(0,U.jsx)(`div`,{className:`flex w-full flex-col items-center gap-1`,children:c.map(t=>(0,U.jsx)(_9,{active:b9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id))}),l.length>0?(0,U.jsxs)(`div`,{"data-testid":`side-dock-utility`,className:`mt-auto flex w-full flex-col items-center gap-1`,children:[l.map(t=>(0,U.jsx)(_9,{active:b9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id)),(0,U.jsx)(Hoe,{icon:Ro,label:b(`sideDockHide`),onClick:()=>{d()}})]}):null,(0,U.jsx)(o,{})]})})}var Goe=`pinned`,Koe=new Set([`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`]);function S9(e){return e.trim()}function qoe(e){let t=0;return Array.from(S9(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${Goe}-${S9(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function Joe(e){return e?.type===`builtin`&&Koe.has(e.name)?{type:`builtin`,name:e.name}:e?.type===`url`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e?.type===`text`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function Yoe(e){return e.kind===`docs`?`docs`:e.kind===`home`?`new-tab`:e.kind===`apps`?e.resourceUri?.includes(`service-apps`)?`service-apps`:`apps`:e.kind===`panel-app`?`panel-app`:`apps`}var Xoe=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>m9(d9(),g9.getState().pinnedItems),this.openItem=async e=>{if(e.target.type===`right-panel-resource`){this.docBrowserManager.open(e.target.uri,{dockIcon:e.icon,title:e.label});return}e.target.type===`external-url`&&await Ai.openExternalUrl(e.target.url)},this.getDockState=e=>{let t=this.getTabResourceUri(e);if(!t)return{canDock:!1,isDocked:!1,removable:!1};let n=this.findItemByUri(t);return{canDock:!0,isDocked:!!n,removable:n?.removable===!0}},this.pinTab=(e,t=new Date().toISOString())=>{let n=this.getTabResourceUri(e);!e||!n||this.findItemByUri(n)||this.pinItem({builtIn:!1,icon:Joe(e.dockIcon)??{type:`builtin`,name:Yoe(e)},id:qoe(n),label:e.title.trim()||n,removable:!0,target:{type:`right-panel-resource`,uri:n}},t)},this.unpinTab=e=>{let t=this.getTabResourceUri(e),n=t?this.findItemByUri(t):void 0;n?.removable&&this.unpinItem(n.id)},this.pinItem=(e,t=new Date().toISOString())=>{if(!e.removable||e.target.type!==`right-panel-resource`)return;let n=S9(e.target.uri),r={...e,target:{type:`right-panel-resource`,uri:n}};this.setPinnedItems(i=>i.some(t=>t.id===e.id||S9(t.target.uri)===n)?i:[...i,Moe(r,t)])},this.unpinItem=e=>{this.setPinnedItems(t=>t.filter(t=>t.id!==e))},this.reorderPinnedItems=e=>{this.setPinnedItems(t=>{let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>n.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.id)),a=t.filter(e=>!i.has(e.id));return[...r,...a]})},this.setPinnedItems=e=>{let{pinnedItems:t,setPinnedItems:n}=g9.getState();n(e(t))},this.getTabResourceUri=e=>{let t=e?.resourceUri??e?.currentUrl,n=t?S9(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=S9(e);return this.getItems().find(e=>e.target.type===`right-panel-resource`&&S9(e.target.uri)===t)}}},Zoe=new class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=n??(r?void 0:t?.kind)??(r&&Ri(r)?`docs`:`home`),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i===`home`?`nextclaw://new-tab`:i===`docs`?Wi():`about:blank`),o=i===`docs`?Yi(a,`docs`):a;return{historyPolicy:`managed`,kind:i,title:i===`home`?b(`docBrowserHomeTitle`):zi(o,i,i===`docs`?b(`docBrowserHelp`):`Detail`),url:o}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?Pi(e)===Pi(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==Ji}};function C9(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function w9(e,t){return C9(e,e.activeTabId,t)}function Qoe(e,t,n){let r=t.resourceUri??t.url,i=n.resourceUri??n.url;return t.tabId===n.tabId&&t.kind===n.kind&&e.areUrlsEquivalent(r,i,t.kind,n.kind)}function T9(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function E9(e,t,n){let r=oi({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>Qoe(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function $oe(e,t,n){for(let r=t.history.length-1;r>=0;--r)if(e.areUrlsEquivalent(t.history[r],n,t.kind,t.kind))return r;return-1}function D9(e,t,n){let r=t.tabs.find(e=>e.id===n.tabId);if(!r)return t;let i=n.resourceUri??n.url,a=e.resolveOpenTarget({activeTab:r,kind:n.kind,url:i}),o=$oe(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return C9({...t,activeTabId:r.id,isOpen:!0},r.id,e=>({...e,currentUrl:a.url,dedupeKey:a.dedupeKey,dockIcon:a.dockIcon??e.dockIcon,historyIndex:o>=0?o:e.historyIndex,kind:a.kind,resourceUri:a.resourceUri??a.url,title:s?e.title:a.title}))}function ese(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function O9(e,t,n,r){let{activate:i,dedupeKey:a,newTab:o,title:s}=r??{},c=a?.trim()||n.dedupeKey,l=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0],u=c?t.tabs.find(e=>e.dedupeKey===c):void 0;if(u){let a=C9(t,u.id,t=>Vi(e,t,n,r,c)),o=i!==!1,s=o?u.id:t.activeTabId,l={...a,activeTabId:s,isOpen:!0};return o||u.id===t.activeTabId?E9(e,l,T9(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=Ki(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon,n.contentParams);return ese(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[Ui(i)],activeHistoryIndex:0}:E9(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},Ui(i))}return E9(e,{...w9(t,t=>Vi(e,t,n,r,c)),isOpen:!0},T9(t.activeTabId,n))}function tse(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return O9(e,t,{...e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),contentParams:r?.contentParams},r)}var nse=class{constructor(e=Zoe,t){this.routeResolver=e,this.onRightPanelOpened=t,this.setSnapshot=e=>{Gi.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>tse(this.routeResolver,n,e,t)),this.onRightPanelOpened?.()},this.openTarget=(e,t)=>{this.setSnapshot(n=>O9(this.routeResolver,n,e,{...t,dedupeKey:t?.dedupeKey??e.dedupeKey,kind:t?.kind??e.kind,title:t?.title??e.title})),this.onRightPanelOpened?.()},this.reloadByDedupeKeys=e=>{let t=new Set(e);t.size!==0&&this.setSnapshot(e=>({...e,tabs:e.tabs.map(e=>t.has(e.dedupeKey??``)?{...e,navVersion:e.navVersion+1}:e)}))},this.openNewTab=()=>{this.open(void 0,{kind:Li,newTab:!0})},this.close=()=>{this.setSnapshot(e=>({...e,isOpen:!1}))},this.toggleMode=()=>{this.setSnapshot(e=>({...e,mode:e.mode===`floating`?`docked`:`floating`})),this.onRightPanelOpened?.()},this.setDockedWidth=e=>{this.setSnapshot(t=>({...t,dockedWidth:Ii(e)}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ki(Wi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=w9(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Bi(t,n.url),kind:n.kind,navVersion:t.navVersion+1,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?E9(this.routeResolver,n,Ui(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ki(Wi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=w9(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,kind:t.kind,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Bi(t,n.url),kind:n.kind,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?E9(this.routeResolver,n,Ui(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=si({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?D9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=si({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?D9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.closeTab=e=>{this.setSnapshot(t=>{if(t.tabs.length<=1)return{...Fi(),isOpen:!1};let n=t.tabs.findIndex(t=>t.id===e);if(n<0)return t;let r=t.tabs.filter(t=>t.id!==e),i=t.activeTabId===e?r[Math.max(0,n-1)]?.id??r[0].id:t.activeTabId,a={...t,tabs:r,activeTabId:i},o=r.find(e=>e.id===i)??r[0],s=vi({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,Ui(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?E9(this.routeResolver,c,Ui(o)):c})},this.setActiveTab=e=>{this.setSnapshot(t=>{if(!t.tabs.some(t=>t.id===e))return t;let n=t.tabs.find(t=>t.id===e);return n?E9(this.routeResolver,{...t,activeTabId:e,isOpen:!0},Ui(n)):t})}}};function rse(e){return e.activeWorkspacePanelKind!=null}var ise=class{constructor(){this.notificationManager=new Toe,this.inboxManager=new uae,this.chatCompletionNotificationManager=new Soe(this.notificationManager),this.accountManager=new $s,this.rightPanelResourceRouteResolver=new O1,this.notifyRightPanelOpened=()=>{let e=Gi.getState().snapshot,t=$.getState().snapshot;oc.collapseSidebarForDenseRightPanels({isDocBrowserDocked:e.mode===`docked`,isDocBrowserOpen:e.isOpen,isWorkspacePanelOpen:rse(t)})},this.docBrowserManager=new nse(this.rightPanelResourceRouteResolver,this.notifyRightPanelOpened),this.appPackageOperationSettlementManager=new B$(this.docBrowserManager),this.sideDockManager=new Xoe(this.docBrowserManager),this.chatComposerIntentManager=new _oe,this.chatDraftIntentManager=new goe,this.serviceActionAuthorizationManager=new h$,this.panelAppBridgeManager=new V1(this.serviceActionAuthorizationManager),this.remoteAccessManager=new Fs({accountManager:this.accountManager})}},k9=null;function A9(){return k9??=new ise,k9}function j9(){return A9()}var M9=globalThis,N9=M9.__NEXTCLAW_APP_PRESENTER_CONTEXT__??(0,H.createContext)(null);M9.__NEXTCLAW_APP_PRESENTER_CONTEXT__=N9;function ase({children:e}){let t=(0,H.useMemo)(()=>A9(),[]);return(0,U.jsx)(N9.Provider,{value:t,children:e})}function P9(){let e=(0,H.useContext)(N9);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}function ose(){let e=P9();return(0,H.useEffect)(()=>(e.chatCompletionNotificationManager.start(),()=>{e.chatCompletionNotificationManager.stop()}),[e.chatCompletionNotificationManager]),null}var sse=`NextClaw`,cse=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function lse(e,t){return e===t||e.startsWith(`${t}/`)}function use(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of cse)if(lse(t,e))return b(n);return b(`settings`)}function dse(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function fse(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:dse(n)?r||null:t}function pse(e,t){let n=fse(t);return`${sse}${n?` ${n}`:``} - ${use(e)}`}var F9={...R1,...see};function mse({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=Hi();iee();let{pathname:i}=_e(),a=ce(),o=j9(),{language:s}=Wn(),{isMobile:c}=k8(),l=W7(),u=g9(e=>e.isVisible);g9(e=>e.pinnedItems);let d={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab},f=(0,H.useCallback)(e=>{let t=$$(e);if(t)return[{key:`chat`,items:[{key:`add-to-chat`,icon:(0,U.jsx)(xo,{className:`h-4 w-4`}),label:b(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>{let e=i===`/chat`||i.startsWith(`/chat/`),n=i===`/chat`?null:Q7(i.slice(6));o.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:e?n:null,reference:t}),e||a(Z7)}}]}]},[a,i,o]);return(0,H.useEffect)(()=>{document.title=pse(i,window.location)},[i,s]),c&&l!==`win32`?(0,U.jsx)(Uae,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:d,docBrowserRenderers:F9,docBrowserTabMenuGroups:f,topbarLeadingInset:l===`darwin`?`4.75rem`:void 0,children:e}):(0,U.jsx)(Kae,{pathname:i,isMobileLayout:c,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:d,docBrowserRenderers:F9,docBrowserTabMenuGroups:f,sideDock:u?(0,U.jsx)(Woe,{manager:t}):null,children:e})}function hse({children:e}){let t=j9();return(0,U.jsx)(qi,{manager:t.docBrowserManager,children:(0,U.jsx)(mse,{sideDockManager:t.sideDockManager,children:e})})}function gse(){let{isMobile:e}=k8();return e?(0,U.jsx)(Wae,{}):(0,U.jsx)(he,{to:`/model`,replace:!0})}var I9=new Intl.NumberFormat;function _se({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i,onOpenChange:a,onEdit:o}){if(!e)return null;let s=L9(e.model,t?.model),c=vse({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i}),l=R9(e.contextTokens,t?.contextTokens??2e5),u=R9(e.reservedContextTokens,t?.reservedContextTokens),d=R9(e.maxToolIterations,t?.maxToolIterations??1e3),f=L9(e.thinkingDefault,t?.thinkingDefault??`off`),p=B9(e.runtimeConfig??e.engineConfig,t?.engineConfig),m=B9(e.models,t?.models);return(0,U.jsx)(Ur,{open:e!==null,onOpenChange:a,children:(0,U.jsxs)(Kr,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,U.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,U.jsx)(Wr,{className:`text-left`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(az,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(qr,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,U.jsxs)(Br,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,U.jsxs)(H9,{icon:oa,title:b(`agentsDetailsIdentitySection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldDescription`),value:e.description?.trim()||b(`agentsDetailsEmptyValue`),wide:!0}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldWorkspace`),value:e.workspace??b(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,U.jsxs)(H9,{icon:Fr,title:b(`agentsDetailsRuntimeSection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldModel`),value:s.value,source:s.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldRuntime`),value:c.value,source:c.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldRuntimeConfig`),value:p.value,source:p.source,mono:!0,prewrap:!0})]}),(0,U.jsxs)(H9,{icon:Za,title:b(`agentsDetailsContextSection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldContextTokens`),value:l.value,source:l.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldReservedContextTokens`),value:u.value,source:u.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldMaxToolIterations`),value:d.value,source:d.source})]}),(0,U.jsxs)(H9,{icon:ca,title:b(`agentsDetailsBehaviorSection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldThinkingDefault`),value:f.value,source:f.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldModelOverrides`),value:m.value,source:m.source,mono:!0,prewrap:!0}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldAvatar`),value:e.avatar??b(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,U.jsxs)(Pr,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,onClick:()=>a(!1),children:b(`cancel`)}),(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>o(e),children:[(0,U.jsx)(Ho,{className:`mr-2 h-4 w-4`}),b(`agentsDetailsEditAction`)]})]})]})})}function L9(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||b(`agentsDetailsUnsetValue`),source:`default`}}function R9(e,t){return typeof e==`number`?{value:I9.format(e),source:`override`}:{value:typeof t==`number`?I9.format(t):b(`agentsDetailsUnsetValue`),source:`default`}}function vse(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:z9(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?z9(s,r,a):a,source:`default`}}function z9(e,t,n){let r=EL(e);return r?t.find(e=>e.value===r)?.label??OL(r):n}function B9(e,t){return V9(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:V9(t)?JSON.stringify(t,null,2):b(`agentsDetailsUnsetValue`),source:`default`}}function V9(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function H9(e){let{icon:t,title:n,children:r}=e;return(0,U.jsxs)(`section`,{className:`space-y-2 border-t border-border/60 pt-3 first:border-t-0 first:pt-0`,children:[(0,U.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-foreground`,children:[(0,U.jsx)(t,{className:`h-3.5 w-3.5 text-muted-foreground`}),n]}),(0,U.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function U9(e){let{label:t,value:n,source:r,mono:i=!1,prewrap:a=!1,wide:o=!1}=e,s=a&&n.trim().startsWith(`{`),c=i&&(!a||s);return(0,U.jsxs)(`div`,{className:u(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(o||s)&&`sm:col-span-2`),children:[(0,U.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,U.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-muted-foreground`,children:t})}),(0,U.jsxs)(`dd`,{className:u(`min-w-0 break-words text-xs leading-5 text-foreground`,s?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-muted/50 px-2 py-1.5 text-left`:``),children:[(0,U.jsx)(`span`,{className:c?`font-mono`:void 0,children:n}),r?(0,U.jsx)(yse,{source:r}):null]})]})}function yse({source:e}){return(0,U.jsxs)(`span`,{className:u(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-muted-foreground`),children:[`(`,b(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function bse({form:e,disabled:t=!1,onChange:n}){return(0,U.jsxs)(`details`,{className:`group rounded-2xl border border-border bg-card`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(Xo,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`agentsAdvancedConfigToggle`)})]}),(0,U.jsx)(ar,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,U.jsxs)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-4`,children:[(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:b(`agentsAdvancedConfigDescription`)}),(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,U.jsx)(xse,{label:b(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function xse(e){let{label:t,value:n,min:r,step:i,disabled:a,onChange:o}=e;return(0,U.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-foreground`,children:[(0,U.jsx)(`span`,{children:t}),(0,U.jsx)(St,{type:`number`,min:r,step:i,value:n,disabled:a,placeholder:b(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>o(e.target.value)})]})}function Sse(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:Cse(e.contextTokens)}}function Cse(e){return typeof e==`number`?String(e):``}var wse=xF(`15rem`);function Tse(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function Ese({id:e,value:t,onChange:n,options:r,disabled:i=!1,placeholder:a,className:o,inputClassName:s,emptyText:c,createText:l,toggleLabel:d,maxItems:f=1/0,onEnter:p}){let[m,h]=(0,H.useState)(!1),g=(0,H.useRef)(null);(0,H.useEffect)(()=>{i&&m&&h(!1)},[i,m]);let _=(0,H.useMemo)(()=>Tse(r),[r]),v=t.trim().toLowerCase(),y=(0,H.useMemo)(()=>{let e=_.map((e,t)=>({option:e,index:t}));v.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===v?0:n.startsWith(v)?1:n.includes(v)?2:3,a=r===v?0:r.startsWith(v)?1:r.includes(v)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(f)?t.slice(0,Math.max(1,f)):t},[_,v,f]),b=t.trim().length>0&&_.some(e=>e===t.trim()),x=()=>h(!1);return(0,U.jsxs)(CF,{open:m&&!i,onOpenChange:e=>h(!i&&e),children:[(0,U.jsx)(TF,{asChild:!0,children:(0,U.jsxs)(`div`,{ref:g,className:u(`relative`,o),children:[(0,U.jsx)(St,{id:e,value:t,disabled:i,onFocus:()=>{i||h(!0)},onChange:e=>{n(e.target.value),!m&&!i&&h(!0)},onKeyDown:e=>{e.key===`Enter`&&(p&&(e.preventDefault(),p()),x())},placeholder:a,className:u(`pr-10`,s)}),(0,U.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>h(e=>!e),disabled:i,className:u(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,i?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":d,children:(0,U.jsx)(vee,{className:`h-4 w-4`})})]})}),(0,U.jsx)(EF,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&g.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:wse},children:(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!b&&t.trim().length>0&&(0,U.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(t.trim()),x()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,U.jsx)(Ar,{className:`h-4 w-4 text-transparent`}),(0,U.jsx)(`span`,{className:`truncate text-gray-700`,children:l.replace(`{value}`,t.trim())})]}),y.map(e=>(0,U.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(e),x()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,U.jsx)(Ar,{className:u(`h-4 w-4`,e===t.trim()?`text-primary`:`text-transparent`)}),(0,U.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),y.length===0&&t.trim().length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:c})]})})]})}var Dse=`provider/model`;function W9(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function G9({id:e,value:t,onChange:n,providerCatalog:r,disabled:i=!1,providerPlaceholder:a,modelPlaceholder:o,className:s}){let[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(``),f=r.length>0,p=o??Dse,m=(0,H.useMemo)(()=>new Map(r.map(e=>[e.name,e])),[r]),h=m.get(c),g=(0,H.useMemo)(()=>h?.aliases??[],[h]),_=(0,H.useMemo)(()=>W9(h?.models??[]),[h]);return(0,H.useEffect)(()=>{let e=t.trim();if(!f){l(``),d(e);return}if(!e){d(``),l(e=>m.has(e)?e:``);return}let n=o6(e,r)??``,i=m.get(n)?.aliases??[];l(n),d(n?Q3(e,i):e)},[f,r,m,t]),f?(0,U.jsxs)(`div`,{className:s,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,U.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,U.jsxs)(Dr,{value:c,onValueChange:e=>{let t=W9(m.get(e)?.models??[])[0]??``;if(l(e),d(t),!t){n(``);return}n($3(m.get(e)?.prefix??e,t))},disabled:i,children:[(0,U.jsx)(yr,{className:`h-10 w-full rounded-xl`,children:(0,U.jsx)(fr,{placeholder:a??b(`providersSelectPlaceholder`)})}),(0,U.jsx)(Sr,{children:r.map(e=>(0,U.jsx)(Tr,{value:e.name,children:e.displayName},e.name))})]})}),(0,U.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,U.jsx)(Ese,{id:e,value:u,onChange:e=>{if(!h){let t=e.trim();d(t),n(t);return}let t=Q3(e,g);d(t),n(t?$3(h.prefix,t):``)},options:_,disabled:i||!c,placeholder:p,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:b(`modelPickerNoOptions`),createText:b(`modelPickerUseCustom`),toggleLabel:b(`modelPickerToggleOptions`)},c)]}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:b(`modelInputCustomHint`)})]}):(0,U.jsxs)(`div`,{className:s,children:[(0,U.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:b(`providersEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:b(`providersEmptyDescription`)})]}),(0,U.jsx)(St,{id:e,value:t,disabled:i,onChange:e=>n(e.target.value),placeholder:p,className:`mt-3 h-10 rounded-xl`}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:b(`modelInputCustomHint`)})]})}function Ose(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=EL(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:OL(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function kse({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:r,onChange:i}){let a=e.trim()?EL(e):``,o=Ose({runtimeOptions:n,currentRuntime:e}),s=o.find(e=>e.value===a)??null,c=s?.reasonMessage?.trim()||(s?.ready===!1?b(`agentsRuntimeUnavailableHelp`):``);return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(Dr,{value:a||r,onValueChange:e=>i(e===r?``:e),disabled:t,children:[(0,U.jsx)(yr,{"aria-label":b(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,U.jsx)(fr,{placeholder:b(`agentsRuntimeSelectPlaceholder`)})}),(0,U.jsx)(Sr,{className:`rounded-xl`,children:o.map(e=>(0,U.jsx)(Tr,{value:e.value,disabled:e.ready===!1&&e.value!==a,className:`rounded-lg`,children:e.label},e.value))})]}),c?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null]})}function Ase({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,U.jsx)(Ur,{open:e!==null,onOpenChange:a,children:e?(0,U.jsx)(jse,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function jse(e){let{agent:t,pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:o,onSubmit:s}=e,[c,l]=(0,H.useState)(Sse(t));return(0,U.jsxs)(Kr,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,U.jsx)(`div`,{className:`shrink-0 border-b border-border px-6 py-6`,children:(0,U.jsxs)(Wr,{className:`text-left`,children:[(0,U.jsx)(qr,{children:b(`agentsEditDialogTitle`)}),(0,U.jsx)(Br,{children:b(`agentsEditDialogDescription`)})]})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`warning`,title:b(`agentsEditHomeReadonly`),description:b(`agentsEditHomeReadonlyHint`),children:(0,U.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,U.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,U.jsx)(St,{value:c.displayName,onChange:e=>l(t=>({...t,displayName:e.target.value})),placeholder:b(`agentsFormNamePlaceholder`)}),(0,U.jsx)(Vn,{value:c.description,onChange:e=>l(t=>({...t,description:e.target.value})),placeholder:b(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,U.jsx)(St,{value:c.avatar,onChange:e=>l(t=>({...t,avatar:e.target.value})),placeholder:b(`agentsFormAvatarPlaceholder`)}),(0,U.jsx)(G9,{value:c.model,onChange:e=>l(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,U.jsx)(kse,{value:c.runtime,onChange:e=>l(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,U.jsx)(bse,{form:c,disabled:n,onChange:e=>l(t=>({...t,...e}))})]})}),(0,U.jsxs)(Pr,{className:`shrink-0 border-t border-border px-6 py-5`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,onClick:()=>o(!1),disabled:n,children:b(`cancel`)}),(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>s(t.id,c),disabled:n,children:[(0,U.jsx)(Ho,{className:`mr-2 h-4 w-4`}),b(`agentsEditSaveAction`)]})]})]})}var Mse=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Nse(e){let t=e.trim();if(!t)return null;let n=Number(t);if(!Number.isFinite(n))throw Error(b(`agentsAdvancedInvalidNumberError`));return Math.trunc(n)}function Pse(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:Nse(e.contextTokens)}}function K9(e){let{icon:t,label:n,disabled:r=!1,destructive:i=!1,onClick:a}=e;return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-muted`),onClick:a,disabled:r,children:[(0,U.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:n})]})}function Fse(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:r,updatePending:i,deletePending:a,onStartChat:o,onView:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?n.find(e=>e.value===EL(u))?.label??OL(u):r;return(0,U.jsx)(Ks,{className:`group overflow-hidden border border-border bg-card shadow-none transition-colors duration-200 hover:border-border/80`,children:(0,U.jsxs)(Xs,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,U.jsx)(az,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,U.jsxs)(Xi,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,U.jsx)($o,{className:`h-3 w-3`}),b(`agentsCardBuiltInTag`)]}):null]}),(0,U.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[`@`,t.id]})]})]}),(0,U.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":b(`agentsCardStartChat`),title:b(`agentsCardStartChat`),onClick:o,children:(0,U.jsx)(bo,{className:`h-4 w-4`})}),(0,U.jsxs)(CF,{children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":b(`chatSessionMoreActions`),title:b(`chatSessionMoreActions`),children:(0,U.jsx)(Aa,{className:`h-4 w-4`})})}),(0,U.jsxs)(EF,{align:`end`,className:`w-44 p-1.5`,children:[(0,U.jsx)(K9,{icon:Ma,label:b(`agentsViewDetailsAction`),onClick:s}),(0,U.jsx)(K9,{icon:Ho,label:b(`agentsEditAction`),onClick:c,disabled:i}),t.builtIn?null:(0,U.jsx)(K9,{icon:fs,label:b(`agentsRemoveAction`),onClick:l,disabled:a,destructive:!0})]})]})]}),(0,U.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground`,children:t.description?.trim()||(t.builtIn?b(`agentsCardBuiltInSummary`):b(`agentsCardCustomSummary`))}),(0,U.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-border/60 pt-2 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(Fr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,U.jsx)(`span`,{className:`truncate`,children:d})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(ro,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,U.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Ise(){let e=eI(),t=oz(),n=j6(),r=P6(),i=F6(),a=a9(),o=sz(),s=cz(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),f=(0,H.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),p=(0,H.useMemo)(()=>[...f].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[f]),m=(0,H.useMemo)(()=>c6({config:n.data,providersView:r.data,templatesView:i.data,onlyConfigured:!0}),[n.data,r.data,i.data]),h=(0,H.useMemo)(()=>kL(a.data?.options??[]),[a.data?.options]),g=(0,H.useMemo)(()=>EL(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,H.useMemo)(()=>h.find(e=>e.value===g)?.label??OL(g),[g,h]),v=n.data?.agents.defaults,y=e=>{l(e)},x=e=>{d(e)},S=async(e,t)=>{let n;try{n=Pse(t)}catch(e){L.error(e instanceof Error?e.message:b(`agentsAdvancedParseFailed`));return}await o.mutateAsync({agentId:e,data:n}),d(null)},C=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,DL(t,g))},w=()=>{e.chatSessionListManager.startAgentDraftChat(`main`,g,Mse)};return(0,U.jsxs)(Bt,{className:`space-y-6`,children:[(0,U.jsx)(xt,{headingLevel:1,title:b(`agentsHeroEyebrow`),description:b(`agentsHeroDescription`),actions:(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:w,children:[(0,U.jsx)(Di,{className:`mr-2 h-4 w-4`}),b(`agentsCreateButton`)]})}),(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,U.jsx)(Ks,{className:`md:col-span-2 xl:col-span-3 border-dashed border-border bg-card/70`,children:(0,U.jsx)(Xs,{className:`py-14 text-center text-sm text-muted-foreground`,children:b(`agentsLoading`)})}):p.length===0?(0,U.jsx)(Ks,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-border bg-gradient-subtle`,children:(0,U.jsxs)(Xs,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,U.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-card/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,U.jsx)(oa,{className:`h-8 w-8 text-warning`})}),(0,U.jsx)(`div`,{className:`text-lg font-semibold text-foreground`,children:b(`agentsEmpty`)}),(0,U.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:b(`agentsEmptyDescription`)}),(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:w,children:[(0,U.jsx)(Di,{className:`mr-2 h-4 w-4`}),b(`agentsCreateButton`)]})]})}):p.map(e=>(0,U.jsx)(Fse,{agent:e,runtimeOptions:h,defaultRuntimeLabel:_,updatePending:o.isPending,deletePending:s.isPending,onStartChat:()=>C(e),onView:()=>y(e),onEdit:()=>x(e),onDelete:()=>s.mutate({agentId:e.id})},e.id))}),(0,U.jsx)(_se,{agent:c,defaults:v,runtimeOptions:h,defaultRuntime:g,defaultRuntimeLabel:_,onOpenChange:e=>{e||l(null)},onEdit:e=>{l(null),d(e)}}),(0,U.jsx)(Ase,{agent:u,pending:o.isPending,providerCatalog:m,runtimeOptions:h,defaultRuntime:g,onOpenChange:e=>{!e&&!o.isPending&&d(null)},onSubmit:S})]})}var q9=`max-w-[min(1180px,100%)]`;function Lse(e){let{routeSessionKey:t,syncRouteSessionSelection:n}=e;(0,H.useLayoutEffect)(()=>{n(t)},[t,n])}function Rse({view:e,confirmDialog:t}){let{isMobile:n}=k8(),r=oY({restorationKey:`main-page:cron`}),i=oY({restorationKey:`main-page:agents`}),{onScroll:a,scrollRef:o}=r,{onScroll:s,scrollRef:c}=i;return(0,U.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,U.jsx)(Y7,{}),e===`chat`?n?(0,U.jsx)(Gae,{}):(0,U.jsx)(Z5,{}):(0,U.jsx)(`section`,{"data-theme-surface":`workspace`,className:`flex-1 min-h-0 overflow-hidden bg-background`,children:e===`inbox`?(0,U.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(_ae,{})}):e===`panel-app`?(0,U.jsx)(z1,{}):e===`cron`?(0,U.jsx)(`div`,{ref:o,onScroll:a,className:`h-full overflow-auto custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(aie,{})})}):e===`agents`?(0,U.jsx)(`div`,{ref:c,onScroll:s,className:`h-full overflow-auto custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(Ise,{})})}):(0,U.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,U.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col px-4 py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(_Q,{forcedType:`skills`})})})}),t]})}function zse(e){let t=eI(),n=j6(),r=P6(),i=F6(),a=sL({limit:200}),o=a9(),s=e.sessionKey?.trim()||`draft-session`,c=lL({sessionId:s});(0,H.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function Bse(){let e=eI();(0,H.useEffect)(()=>I.eventBus.on(c.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function Vse(){let{sessionId:e}=le(),t=(0,H.useMemo)(()=>Q7(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function Hse(){let e=eI(),{confirm:t,ConfirmDialog:n}=On(),r=_e(),i=ce();return(0,H.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,U.jsx)(n,{})}function Use({view:e}){let t=P9();return(0,U.jsx)($F,{presenter:(0,H.useMemo)(()=>new hoe(t),[t]),children:(0,U.jsx)(Wse,{view:e})})}function Wse({view:e}){let t=P9(),n=eI(),r=Hse(),{routeSessionKey:i,sessionKey:a}=Vse(),o=$(e=>{let{snapshot:t}=e;return t.workspacePanelParentKey!==(a??null)||t.activeWorkspacePanelKind!==`child-session`?null:t.activeChildSessionKey?.trim()||null});return(0,H.useEffect)(()=>(t.chatCompletionNotificationManager.syncVisibleSessions([a,o]),()=>{t.chatCompletionNotificationManager.syncVisibleSessions([])}),[t.chatCompletionNotificationManager,a,o]),zse({sessionKey:a??null}),Lse({routeSessionKey:i,syncRouteSessionSelection:n.chatSessionListManager.syncRouteSessionSelection}),Bse(),(0,U.jsx)(Rse,{view:e,confirmDialog:r})}function J9({view:e}){return(0,U.jsx)(Use,{view:e})}var Y9=P(e=>({pending:null,present:t=>e({pending:t}),clear:()=>e({pending:null})})),Gse=`desktop.authorization.required`;function Kse(){let e=Y9(e=>e.pending),t=Y9(e=>e.present),n=Y9(e=>e.clear),[r,i]=(0,H.useState)(!1);(0,H.useEffect)(()=>I.eventBus.subscribeAll(e=>{if(e.type!==Gse)return;let n=qse(e.payload);n&&t(n)}),[t]);let a=async()=>{if(!(!e||r)){i(!0);try{await R7.grantAccess(e.request),await jt.invalidateQueries({queryKey:[`desktop-capability`,`grants`]}),n(),L.success(b(`desktopAuthorizationAllowed`))}catch(e){L.error(e instanceof Error?e.message:b(`desktopAuthorizationFailed`))}finally{i(!1)}}};return(0,U.jsx)(Ur,{open:!!e,onOpenChange:e=>{!e&&!r&&n()},children:(0,U.jsxs)(Kr,{className:`[&>:last-child]:hidden`,children:[(0,U.jsxs)(Wr,{children:[(0,U.jsxs)(qr,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Qo,{className:`h-4 w-4 text-amber-600`}),b(`desktopAuthorizationTitle`)]}),(0,U.jsx)(Br,{children:b(`desktopAuthorizationDescription`)})]}),e?(0,U.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-muted/55 p-4 text-sm`,children:[(0,U.jsx)(X9,{label:b(`desktopAuthorizationCaller`),value:Jse(e)}),(0,U.jsx)(X9,{label:b(`desktopAuthorizationApplication`),value:e.applicationId}),(0,U.jsx)(X9,{label:b(`desktopAuthorizationAccess`),value:e.request.access.map(Yse).join(`, `)}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:Xse(e.request.access)})]}):null,(0,U.jsxs)(Pr,{className:`gap-2 sm:gap-0`,children:[(0,U.jsx)(R,{type:`button`,variant:`outline`,disabled:r,onClick:n,children:b(`desktopAuthorizationReject`)}),(0,U.jsx)(R,{type:`button`,disabled:r,onClick:()=>void a(),children:b(r?`desktopAuthorizationAllowing`:`desktopAuthorizationAllow`)})]})]})})}function X9({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}function qse(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,{request:n}=t;if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=n;return typeof t.applicationId!=`string`||!r.subject||!r.resource||!Array.isArray(r.access)||typeof r.declarationFingerprint!=`string`?null:{applicationId:t.applicationId,request:r}}function Jse(e){let{subject:t}=e.request;return`${t.type===`agent`?b(`desktopCapabilitiesAgent`):b(`desktopCapabilitiesExtension`)} · ${t.id}`}function Yse(e){return e===`ui.read`?b(`desktopAuthorizationRead`):e===`ui.observe`?b(`desktopAuthorizationObserve`):e===`ui.write`?b(`desktopAuthorizationWrite`):e===`screen.capture-window`?b(`desktopAuthorizationScreenCapture`):e===`input.pointer`?b(`desktopAuthorizationPointerInput`):e}function Xse(e){return e.includes(`ui.write`)?b(`desktopAuthorizationWriteRisk`):e.includes(`screen.capture-window`)?b(`desktopAuthorizationScreenCaptureRisk`):e.includes(`input.pointer`)?b(`desktopAuthorizationPointerInputRisk`):b(`desktopAuthorizationReadRisk`)}function Zse(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function Qse(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function $se(e,t){e&&Zse(t)&&e.invalidateQueries({queryKey:[`config`]}),Qse(e,t)}function Z9(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return/^[a-z]:/i.test(t)?t.toLowerCase():t}function ece(e,t){if(!e)return;let n=Z9(t);e.invalidateQueries({predicate:e=>e.queryKey[0]===`server-path-browse`&&typeof e.queryKey[1]==`string`&&Z9(e.queryKey[1])===n})}function tce(e){let t=(0,H.useRef)(!1);(0,H.useEffect)(()=>{let n=I.eventBus.on(c.connectionOpen,()=>{wt.handleConnectionRestored(),Re.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=I.eventBus.on(c.connectionClose,()=>{wt.handleConnectionInterrupted(null),t.current=!0}),i=I.eventBus.on(c.connectionError,e=>{wt.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=I.eventBus.on(c.configUpdated,({path:t})=>{$se(e,t)}),o=I.eventBus.on(c.serverPathChanged,({directoryPath:t})=>ece(e,t)),s=I.eventBus.on(c.runtimeUpdateSnapshot,e=>{Re.reportSnapshot(e)}),l=I.eventBus.on(c.sessionRunStatus,t=>{vn(e,{type:`session.run-status`,payload:t})}),u=I.eventBus.on(c.sessionSummaryUpsert,t=>{vn(e,{type:`session.summary.upsert`,payload:t})}),d=I.eventBus.on(c.sessionSummaryDelete,t=>{vn(e,{type:`session.summary.delete`,payload:t})}),f=I.eventBus.on(c.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),l(),u(),d(),f()}},[e])}var nce={"--width":`320px`},rce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-CIevwqp4.js`);return{ModelConfigPage:e}},__vite__mapDeps([40,4,41,28,32,30,33,1,34,42,38,39,43,44,45]))).ModelConfigPage})),ice=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-x4Vjnfmz.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([46,4,47,27,28,30,41,48,49,29,37,26,31,32,33,1,34,35,36,38,39,42,50,44]))).AppearanceSettingsPage})),ace=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-BAIzd6gN.js`);return{SearchConfigPage:e}},__vite__mapDeps([51,4,47,27,28,30,41,31,33,1,34,52,43]))).SearchConfigPage})),oce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-DAah2NIS.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([53,4,47,27,28,30,49,29,41,37,31,42,35,36,52,43,45,34]))).ProvidersConfigPage})),sce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ExtensionsConfigPage:e}=await import(`./extensions-Bdclr3Wr.js`);return{ExtensionsConfigPage:e}},__vite__mapDeps([54,41,4,28,36,30]))).ExtensionsConfigPage})),cce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-DOxJZeXq.js`);return{ChannelsList:e}},__vite__mapDeps([55,4,47,27,28,30,41,31,32,33,1,34,42,37,52,50,43,45]))).ChannelsList})),lce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-Cl1RpmSC.js`);return{RuntimeConfig:e}},__vite__mapDeps([56,4,47,27,28,30,41,48,49,29,37,26,31,32,33,1,34,35,36,38,39,42,50,44,57,58,43]))).RuntimeConfig})),uce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-ChhfeOHj.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([59,47,4,27,28,30,41,33,1,34,36,57]))).DesktopUpdateConfig})),dce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SecurityConfig:e}=await import(`./security-config-C8MHnE1r.js`);return{SecurityConfig:e}},__vite__mapDeps([60,41,4,28]))).SecurityConfig})),fce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-Ddi-n43R.js`);return{SecretsConfigPage:e}},__vite__mapDeps([61,4,47,27,28,30,41,35,58,43]))).SecretsConfigPage})),pce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{PrivacySettingsPage:e}=await import(`./privacy-settings-page-CNKfZsYH.js`);return{PrivacySettingsPage:e}},__vite__mapDeps([62,47,4,27,28,30,41]))).PrivacySettingsPage})),mce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DesktopCapabilitiesPage:e}=await import(`./desktop-capabilities-page-DixayAe6.js`);return{DesktopCapabilitiesPage:e}},__vite__mapDeps([63,41,4,28]))).DesktopCapabilitiesPage})),hce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{RemoteAccessPage:e}=await import(`./remote-DuscgfvR.js`);return{RemoteAccessPage:e}},[])).RemoteAccessPage})),gce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-GPRV3fB0.js`);return{McpMarketplacePage:e}},__vite__mapDeps([64,48,4,47,27,28,30,49,29,41,37,26,31,32,33,1,34,35,36,38,39,42,50,44]))).McpMarketplacePage}));function _ce(){return(0,U.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function vce({children:e}){return(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(_ce,{}),children:e})}function Q9(e){return(0,U.jsx)(vce,{children:e})}var yce=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:Q9((0,U.jsx)(J9,{view:`chat`}))},{path:`/agents`,element:Q9((0,U.jsx)(J9,{view:`agents`}))},{path:`/skills`,element:Q9((0,U.jsx)(J9,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:Q9((0,U.jsx)(J9,{view:`skills`}))},{path:`/cron`,element:Q9((0,U.jsx)(J9,{view:`cron`}))},{path:`/inbox/:deliveryId?`,element:Q9((0,U.jsx)(J9,{view:`inbox`}))},{path:`/apps/panel/:appId`,element:Q9((0,U.jsx)(J9,{view:`panel-app`}))},{path:`/appearance`,element:Q9((0,U.jsx)(ice,{}))},{path:`/model`,element:Q9((0,U.jsx)(rce,{}))},{path:`/search`,element:Q9((0,U.jsx)(ace,{}))},{path:`/providers`,element:Q9((0,U.jsx)(oce,{}))},{path:`/extensions`,element:Q9((0,U.jsx)(sce,{}))},{path:`/channels`,element:Q9((0,U.jsx)(cce,{}))},{path:`/runtime`,element:Q9((0,U.jsx)(lce,{}))},{path:`/updates`,element:Q9((0,U.jsx)(uce,{}))},{path:`/remote`,element:Q9((0,U.jsx)(hce,{}))},{path:`/security`,element:Q9((0,U.jsx)(dce,{}))},{path:`/privacy`,element:Q9((0,U.jsx)(pce,{}))},{path:`/desktop-capabilities`,element:Q9((0,U.jsx)(mce,{}))},{path:`/secrets`,element:Q9((0,U.jsx)(fce,{}))},{path:`/settings`,element:(0,U.jsx)(gse,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:Q9((0,U.jsx)(gce,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function bce(e){return`redirectTo`in e?(0,U.jsx)(se,{path:e.path,element:(0,U.jsx)(he,{to:e.redirectTo,replace:!0})},e.path):(0,U.jsx)(se,{path:e.path,element:e.element},e.path)}function xce(){return(0,U.jsx)(de,{children:yce.map(bce)})}function $9(){return tce(jt),ye(),(0,H.useEffect)(()=>(Re.start(),()=>{Re.stop()}),[]),(0,U.jsxs)(ase,{children:[(0,U.jsx)(ose,{}),(0,U.jsx)(pae,{}),(0,U.jsx)(hse,{children:(0,U.jsx)(xce,{})}),(0,U.jsx)(Gs,{}),(0,U.jsx)(f$,{}),(0,U.jsx)(Kse,{})]})}function Sce(){let e=Se(),t=e.isError&&En(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,U.jsx)($9,{}):e.data?.enabled&&!e.data.authenticated?(0,U.jsx)(Qs,{username:e.data.username}):(0,U.jsx)($9,{})}function Cce(){return(0,H.useEffect)(()=>{zie()},[]),(0,U.jsxs)(Lt,{client:jt,children:[(0,U.jsx)(Sce,{}),(0,U.jsx)(Lie,{}),(0,U.jsx)(Ot,{position:`top-right`,richColors:!0,offset:{top:window.nextclawDesktop?.platform===`win32`?56:44,right:72},mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0,style:nce})]})}var wce=window.nextclawDesktop?.platform===`win32`?oe:me;(0,bs.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(H.StrictMode,{children:(0,U.jsx)(Hie,{children:(0,U.jsx)(Mn,{children:(0,U.jsx)(wce,{children:(0,U.jsx)(Cce,{})})})})}));export{Xs as $,R6 as A,t6 as B,N6 as C,ao as Ct,K6 as D,fa as Dt,P6 as E,Aa as Et,Z6 as F,qY as G,t0 as H,J3 as I,ML as J,JY as K,c6 as L,V6 as M,X6 as N,W6 as O,na as Ot,B6 as P,Ks as Q,s6 as R,q6 as S,oo as St,F6 as T,Ma as Tt,KY as U,e6 as V,YY as W,EF as X,CF as Y,wF as Z,H6 as _,Zo as _t,Nae as a,Fs as at,Q6 as b,Uo as bt,Sae as c,ks as ct,Iie as d,Ns as dt,Ys as et,t7 as f,Ts as ft,L6 as g,ss as gt,M6 as h,fs as ht,kae as i,zs as it,z6 as j,Y6 as k,M7 as l,As as lt,j6 as m,Ss as mt,g9 as n,Js as nt,Mae as o,Ps as ot,k8 as p,Cs as pt,GL as q,jae as r,Bs as rt,Pae as s,Es as st,G9 as t,qs as tt,h7 as u,js as ut,U6 as v,Xo as vt,I6 as w,$a as wt,J6 as x,wo as xt,G6 as y,Wo as yt,r6 as z};
|
|
108
|
+
`),n.after(r),`<!doctype html>${t.documentElement.outerHTML}`}function cae({content:e,fillHeight:t,title:n}){let r=(0,H.useMemo)(()=>sae(e),[e]);return(0,U.jsx)(`iframe`,{className:u(`w-full rounded-xl bg-background`,t?`h-full min-h-0 border-0`:`h-[min(60vh,680px)] min-h-[360px] border border-border/70`),sandbox:`allow-popups allow-popups-to-escape-sandbox`,srcDoc:r,title:n})}function S7({className:e,content:t,contentType:n,fillHeight:r=!1,title:i}){return(0,U.jsx)(`div`,{className:u(`inbox-delivery-content`,e),children:n===`html`?(0,U.jsx)(cae,{content:t,fillHeight:r,title:i}):(0,U.jsx)(Uj,{text:t,role:`assistant`,texts:{copyCodeLabel:b(`chatCodeCopy`),copiedCodeLabel:b(`chatCodeCopied`)}})})}var lae={readerOpen:!1,activeDeliveryId:null},C7=P(e=>({snapshot:lae,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))})),w7=[`inbox-deliveries`];function T7(e){return{deliveries:e,total:e.length,unreadCount:e.filter(e=>!e.readAt&&!e.archivedAt).length,unpresentedCount:e.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt).length}}var uae=class{constructor(e=jt){this.queryClient=e,this.cleanups=[],this.offerPromise=null,this.started=!1,this.start=()=>{this.started||(this.started=!0,this.cleanups.push(I.eventBus.on(c.inboxDeliveryChanged,this.handleDeliveryChanged)),typeof document<`u`&&(document.addEventListener(`visibilitychange`,this.handleVisibilityChange),this.cleanups.push(()=>document.removeEventListener(`visibilitychange`,this.handleVisibilityChange))),this.offerPendingDelivery())},this.stop=()=>{if(this.started)for(this.started=!1;this.cleanups.length>0;)this.cleanups.pop()?.()},this.closeReader=()=>{C7.getState().setSnapshot({readerOpen:!1})},this.selectInReader=async e=>{let t=await this.updateState(e,`present`);return C7.getState().setSnapshot({activeDeliveryId:t.id,readerOpen:!0}),t},this.markRead=async e=>await this.updateState(e,`read`),this.markUnread=async e=>await this.updateState(e,`mark_unread`),this.archive=async e=>await this.updateState(e,`archive`),this.restore=async e=>await this.updateState(e,`restore`),this.delete=async e=>{let t=await I.inboxDeliveries.delete(e);if(t){this.queryClient.setQueryData(w7,t=>t&&T7(t.deliveries.filter(({id:t})=>t!==e)));let{snapshot:t}=C7.getState();t.activeDeliveryId===e&&C7.getState().setSnapshot({activeDeliveryId:null,readerOpen:!1})}return t},this.prepareChatReference=async e=>{let t=await I.systemObjectReferences.resolve(y(w,e)),n=await this.updateState(e,`read`);return this.closeReader(),{delivery:n,reference:t}},this.updateState=async(e,t)=>{let n=await I.inboxDeliveries.updateState(e,t);return this.replaceCachedDelivery(n),n},this.replaceCachedDelivery=e=>{this.queryClient.setQueryData(w7,t=>t&&T7(t.deliveries.some(({id:t})=>t===e.id)?t.deliveries.map(t=>t.id===e.id?e:t):[e,...t.deliveries]))},this.handleDeliveryChanged=()=>{this.queryClient.invalidateQueries({queryKey:w7}),this.offerPendingDelivery()},this.handleVisibilityChange=()=>{document.visibilityState===`visible`&&this.offerPendingDelivery()},this.offerPendingDelivery=()=>{this.offerPromise||!this.isVisible()||C7.getState().snapshot.readerOpen||(this.offerPromise=this.openOldestPendingDelivery().catch(()=>void 0).finally(()=>{this.offerPromise=null}))},this.openOldestPendingDelivery=async()=>{let e=(await this.queryClient.fetchQuery({queryKey:w7,queryFn:()=>I.inboxDeliveries.list(),staleTime:0})).deliveries.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt),t=e[e.length-1];!t||!this.isVisible()||C7.getState().snapshot.readerOpen||await this.selectInReader(t.id)},this.isVisible=()=>typeof document>`u`||document.visibilityState===`visible`}};function E7(){return Sn({queryKey:w7,queryFn:()=>I.inboxDeliveries.list()})}function D7(){return E7().data?.unreadCount??0}function dae(e,t){return b(`inboxReaderPosition`).replace(`{current}`,String(e)).replace(`{total}`,String(t))}function fae(){let e=(0,H.useRef)(null),t=ce(),{chatDraftIntentManager:n,inboxManager:r}=P9(),{data:i}=E7(),{activeDeliveryId:a,readerOpen:o}=C7(e=>e.snapshot),[s,c]=(0,H.useState)(null),[l,d]=(0,H.useState)(null),f=(i?.deliveries??[]).filter(e=>!e.readAt&&!e.archivedAt),p=f.findIndex(({id:e})=>e===a),m=p>=0?f[p]:null,h=m?.contentType===`html`,g=async(e,t)=>{c(e),d(null);try{await t()}catch{d(b(`inboxActionError`))}finally{c(null)}},_=e=>{let t=f[e];t&&g(`select`,async()=>{await r.selectInReader(t.id)})},v=()=>{m&&g(`open`,async()=>{await r.markRead(m.id),r.closeReader(),t(`/inbox/${encodeURIComponent(m.id)}`)})},y=()=>{m&&g(`continue`,async()=>{let{reference:e}=await r.prepareChatReference(m.id);n.requestSystemObjectReference(e),t(Z7)})},x=()=>{m&&g(`read`,async()=>{await r.markRead(m.id),r.closeReader()})},S=f.length>1?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 pr-1`,children:[(0,U.jsx)(`span`,{className:`mr-1 text-[11px] tabular-nums text-muted-foreground`,children:dae(p+1,f.length)}),(0,U.jsx)(V,{icon:(0,U.jsx)(da,{className:`h-4 w-4`}),label:b(`inboxPrevious`),disabled:p<=0||s===`select`,onClick:()=>_(p-1)}),(0,U.jsx)(V,{icon:(0,U.jsx)(fa,{className:`h-4 w-4`}),label:b(`inboxNext`),disabled:p>=f.length-1||s===`select`,onClick:()=>_(p+1)})]}):null;return(0,U.jsx)(Ur,{open:o&&!!m,onOpenChange:e=>{e||r.closeReader()},children:(0,U.jsx)(Kr,{className:`flex h-[min(82vh,760px)] w-[calc(100vw-2rem)] max-w-[820px] flex-col gap-0 overflow-hidden rounded-[24px] border-border/70 bg-background p-0 shadow-[0_20px_55px_-22px_rgba(15,23,42,0.32)] max-sm:h-[100dvh] max-sm:max-h-none max-sm:w-screen max-sm:rounded-none max-sm:border-0`,onOpenAutoFocus:t=>{t.preventDefault(),e.current?.focus()},children:m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`header`,{className:`shrink-0 border-b border-border/50 px-5 py-3 pr-14 sm:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-muted/70 text-muted-foreground`,children:(0,U.jsx)(ao,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(qr,{ref:e,tabIndex:-1,title:m.title,className:`min-w-0 truncate text-sm font-medium text-foreground outline-none`,children:m.title}),(0,U.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:m.createdAt,children:M(m.createdAt)})]}),S]}),(0,U.jsx)(Br,{className:`sr-only`,children:m.summary??b(`inboxNoSummary`)})]}),(0,U.jsx)(`div`,{className:u(`min-h-0 flex-1`,h?`p-3 sm:p-4`:`custom-scrollbar overflow-y-auto px-6 py-5 sm:px-8 sm:py-6`),children:(0,U.jsx)(S7,{className:h?`h-full`:void 0,content:m.content,contentType:m.contentType,fillHeight:h,title:m.title})}),(0,U.jsxs)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background px-5 py-3 sm:px-6`,children:[l?(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:l}):null,(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-1 sm:flex-row sm:flex-wrap`,children:[(0,U.jsx)(R,{size:`sm`,variant:`ghost`,onClick:r.closeReader,children:b(`inboxReadLater`)}),(0,U.jsx)(R,{size:`sm`,variant:`outline`,disabled:s!==null,onClick:x,children:b(`inboxMarkRead`)}),(0,U.jsx)(R,{size:`sm`,variant:`ghost`,disabled:s!==null,onClick:v,children:b(`inboxOpenInbox`)})]}),(0,U.jsx)(R,{size:`sm`,disabled:s!==null,onClick:y,children:b(`inboxContinueChat`)})]})]})]}):null})})}function pae(){let{inboxManager:e}=P9();return(0,H.useEffect)(()=>(e.start(),()=>e.stop()),[e]),(0,U.jsx)(fae,{})}function mae(e,t){return t||(e.some(e=>!e.readAt&&!e.archivedAt)?`unread`:`all`)}function O7(e,t){return t===`unread`?e.filter(e=>!e.readAt&&!e.archivedAt):t===`archived`?e.filter(e=>!!e.archivedAt):e.filter(e=>!e.archivedAt)}function k7({selection:e=!1}){return(0,U.jsxs)(`div`,{className:`flex h-full min-h-56 flex-col items-center justify-center px-8 text-center`,children:[(0,U.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-muted text-muted-foreground`,children:(0,U.jsx)(ao,{className:`h-5 w-5`})}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(e?`inboxSelectTitle`:`inboxEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-2 max-w-sm text-sm leading-6 text-muted-foreground`,children:b(e?`inboxSelectDescription`:`inboxEmptyDescription`)})]})}function hae({activeDeliveryId:e,deliveries:t,filter:n,onFilterChange:r}){let{onScroll:i,scrollRef:a}=oY({restorationKey:`inbox:list`}),o=[{id:`unread`,label:b(`inboxUnread`),count:O7(t,`unread`).length},{id:`all`,label:b(`inboxAll`),count:O7(t,`all`).length},{id:`archived`,label:b(`inboxArchived`),count:O7(t,`archived`).length}],s=O7(t,n);return(0,U.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-border/60 bg-muted/20 md:border-r`,children:[(0,U.jsx)(`div`,{className:`flex shrink-0 gap-1 border-b border-border/50 px-3 py-2`,children:o.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:u(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,n===e.id?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[e.label,(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] font-normal tabular-nums opacity-60`,children:e.count})]},e.id))}),(0,U.jsx)(`div`,{ref:a,onScroll:i,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-2`,children:s.length>0?(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:s.map(t=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(ue,{to:`/inbox/${encodeURIComponent(t.id)}`,className:u(`block rounded-lg px-2.5 py-2 text-[13px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e===t.id?`bg-[var(--interaction-selection)] text-foreground`:`text-foreground/80 hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[(0,U.jsx)(`h2`,{className:u(`truncate font-medium leading-5`,!t.readAt&&`font-semibold text-foreground`),children:t.title}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] leading-4 text-muted-foreground/65`,children:[(0,U.jsx)(`p`,{className:`min-w-0 flex-1 truncate`,children:t.summary??b(`inboxNoSummary`)}),t.readAt?(0,U.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:t.createdAt,children:k(t.createdAt)}):(0,U.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-primary`,"aria-label":b(`inboxUnread`)})]})]})},t.id))}):(0,U.jsx)(k7,{})})]})}function gae({delivery:e,error:t,isMobile:n,pending:r,onArchiveToggle:i,onBack:a,onContinue:o,onDelete:s,onReadToggle:c}){let{onScroll:l,scrollRef:d}=oY({restorationKey:e?`inbox:delivery:${e.id}`:null});if(!e)return(0,U.jsx)(`main`,{className:`flex min-h-0 flex-col`,children:(0,U.jsx)(k7,{selection:!0})});let f=e.contentType===`html`;return(0,U.jsxs)(`main`,{className:`flex min-h-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`shrink-0 border-b border-border/50 px-5 py-3 sm:px-6`,children:[n?(0,U.jsxs)(`button`,{type:`button`,onClick:a,className:`mb-3 inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(Ci,{className:`h-4 w-4`}),b(`inboxTitle`)]}):null,(0,U.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h2`,{title:e.title,className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.title}),(0,U.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:e.createdAt,children:M(e.createdAt)})]})]}),(0,U.jsx)(`div`,{className:u(`min-h-0 flex-1`,f?`p-3 sm:p-4`:`custom-scrollbar overflow-y-auto px-5 py-5 sm:px-6 sm:py-6`),ref:d,onScroll:l,children:(0,U.jsx)(`div`,{className:u(`mx-auto max-w-5xl`,f&&`h-full`),children:(0,U.jsx)(S7,{className:f?`h-full`:void 0,content:e.content,contentType:e.contentType,fillHeight:f,title:e.title})})}),(0,U.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-5 py-3 sm:px-6`,children:[t?(0,U.jsx)(`p`,{role:`alert`,className:`mb-2 text-sm text-destructive`,children:t}):null,(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,U.jsx)(R,{size:`sm`,variant:`outline`,disabled:r,onClick:c,children:e.readAt?b(`inboxMarkUnread`):b(`inboxMarkRead`)}),(0,U.jsxs)(R,{size:`sm`,variant:`ghost`,disabled:r,onClick:i,children:[e.archivedAt?(0,U.jsx)(qo,{className:`mr-2 h-4 w-4`}):(0,U.jsx)(ia,{className:`mr-2 h-4 w-4`}),e.archivedAt?b(`inboxRestore`):b(`inboxArchive`)]}),(0,U.jsxs)(R,{size:`sm`,variant:`ghost`,disabled:r,onClick:s,children:[(0,U.jsx)(fs,{className:`mr-2 h-4 w-4`}),b(`inboxDelete`)]})]}),(0,U.jsxs)(R,{size:`sm`,disabled:r,onClick:o,children:[(0,U.jsx)(bo,{className:`mr-2 h-4 w-4`}),b(`inboxContinueChat`)]})]})]})]})}function _ae(){let e=ce(),{deliveryId:t}=le(),{isMobile:n}=k8(),{chatDraftIntentManager:r,inboxManager:i}=P9(),a=E7(),{confirm:o,ConfirmDialog:s}=On(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(null),m=(0,H.useMemo)(()=>a.data?.deliveries??[],[a.data?.deliveries]),h=(0,H.useMemo)(()=>t?m.find(({id:e})=>e===t)??null:null,[m,t]),g=mae(m,c);(0,H.useEffect)(()=>{h&&!h.readAt&&i.markRead(h.id).catch(()=>p(b(`inboxActionError`)))},[h,i]);let _=async(e,t)=>{d(e),p(null);try{await t()}catch{p(b(`inboxActionError`))}finally{d(null)}},v=()=>{h&&_(`continue`,async()=>{let{reference:t}=await i.prepareChatReference(h.id);r.requestSystemObjectReference(t),e(Z7)})},y=async()=>{!h||!await o({title:b(`inboxDeleteTitle`),description:b(`inboxDeleteDescription`),confirmLabel:b(`inboxDeleteConfirm`),variant:`destructive`})||_(`delete`,async()=>{await i.delete(h.id),e(`/inbox`,{replace:!0})})},x=()=>{h&&_(`read`,async()=>{if(h.readAt){await i.markUnread(h.id),e(`/inbox`,{replace:!0});return}await i.markRead(h.id)})},S=()=>{h&&_(`archive`,async()=>{if(h.archivedAt){await i.restore(h.id);return}await i.archive(h.id),e(`/inbox`,{replace:!0})})},C=!n||!h,w=!n||!!h;return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-6`,children:[(0,U.jsx)(xt,{headingLevel:1,title:b(`inboxTitle`),className:`px-4 sm:px-0`}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden border-y border-border/60 bg-background sm:rounded-2xl sm:border`,children:a.isError?(0,U.jsx)(`div`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:b(`inboxLoadError`)}):(0,U.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 md:grid-cols-[300px_minmax(0,1fr)]`,children:[C?(0,U.jsx)(hae,{activeDeliveryId:h?.id??null,deliveries:m,filter:g,onFilterChange:l}):null,w?(0,U.jsx)(gae,{delivery:h,error:f,isMobile:n,pending:u!==null,onArchiveToggle:S,onBack:()=>e(`/inbox`),onContinue:v,onDelete:()=>void y(),onReadToggle:x}):null]})}),(0,U.jsx)(s,{})]})}function vae(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function yae(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,projectCronJobCountByRoot:a}=e,o=eI(),s=aL(e=>e.snapshot.collapsedProjectRoots),[c,l]=(0,H.useState)(null),u=(0,H.useMemo)(()=>vae(n,r),[n,r]),d=r.length>1;return(0,U.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>{let t=`${b(`chatSidebarNewTask`)} · ${e.projectName}`,n=s.includes(e.projectRoot),f=b(e.isPinned?`chatSidebarUnpinProject`:`chatSidebarPinProject`);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`group/project relative h-8 rounded-lg px-2 text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(g7,{title:e.projectName,metrics:[{icon:(0,U.jsx)(Ya,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextPath`),value:e.projectRoot},{icon:(0,U.jsx)(Co,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextSessions`),value:e.items.length},{icon:(0,U.jsx)(ra,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextScheduledTasks`),value:a.get(e.projectRoot)??0}],children:(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":!n,"aria-label":b(n?`chatSidebarExpandProject`:`chatSidebarCollapseProject`),className:`flex h-full w-full min-w-0 items-center gap-1.5 pr-14 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>o.chatSessionListManager.toggleProjectCollapsed(e.projectRoot),children:[(0,U.jsx)(Ya,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wider`,title:e.projectRoot,children:e.projectName}),n?(0,U.jsx)(fa,{className:`h-3.5 w-3.5 shrink-0 opacity-0 transition-opacity group-hover/project:opacity-100 group-focus-within/project:opacity-100`,"aria-hidden":`true`}):(0,U.jsx)(ar,{className:`h-3.5 w-3.5 shrink-0 opacity-0 transition-opacity group-hover/project:opacity-100 group-focus-within/project:opacity-100`,"aria-hidden":`true`})]})}),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute right-2 top-1/2 flex -translate-y-1/2 items-center opacity-0 transition-opacity group-hover/project:pointer-events-auto group-hover/project:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100`,children:[d?(0,U.jsxs)(CF,{open:c===e.projectRoot,onOpenChange:t=>{l(t?e.projectRoot:null)},children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(Di,{className:`h-3.5 w-3.5`}),label:t})}),(0,U.jsx)(EF,{align:`end`,className:`w-56 rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:(0,U.jsx)(_7,{options:r,selectedSessionType:u,onSelect:t=>{o.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:t}),l(null)}})})]}):(0,U.jsx)(V,{icon:(0,U.jsx)(Di,{className:`h-3.5 w-3.5`}),label:t,onClick:()=>o.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:u})}),(0,U.jsx)(V,{icon:(0,U.jsx)(Xr,{className:e.isPinned?`h-3.5 w-3.5 fill-current text-foreground`:`h-3.5 w-3.5`}),label:f,tooltipSide:`right`,onClick:()=>o.chatSessionListManager.toggleProjectPinned(e.projectRoot)})]})]}),n?null:(0,U.jsx)(`div`,{className:`mt-0.5 space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}function A7({label:e}){return(0,U.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,U.jsx)(Co,{className:`mx-auto mb-2 h-6 w-6 text-muted-foreground/45`}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function bae({defaultSessionType:e,groups:t,isLoading:n,isProjectFirstView:r,projectGroups:i,projectCronJobCountByRoot:a,renderSessionItem:o,sessionTypeOptions:s}){return n?(0,U.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:b(`sessionsLoading`)}):r?i.length===0?(0,U.jsx)(A7,{label:b(`chatSidebarProjectViewEmpty`)}):(0,U.jsx)(yae,{groups:i,projectCronJobCountByRoot:a,defaultSessionType:e,sessionTypeOptions:s,renderSessionItem:o}):t.length===0?(0,U.jsx)(A7,{label:b(`sessionsEmpty`)}):(0,U.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wider text-muted-foreground/65`,children:e.label}),(0,U.jsx)(`div`,{className:`space-y-0.5`,children:e.items.map(o)})]},e.label))})}function xae({isOpen:e,onOpenChange:t,currentTheme:n,currentThemeLabel:r,themeOptions:i,onSelectTheme:a,currentLanguage:o,currentLanguageLabel:s,languageOptions:c,onSelectLanguage:l,onOpenDocs:d,onOpenApps:f,collapsed:p=!1}){return(0,U.jsxs)(CF,{open:e,onOpenChange:t,children:[p?(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`settingsMenu`),className:u(`flex items-center justify-center`,nX,oX),children:(0,U.jsx)(Zo,{className:u(rX,`shrink-0 text-muted-foreground`)})})})}),(0,U.jsx)(li,{side:`right`,className:`text-xs`,children:b(`settingsMenu`)})]})}):(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-label":b(`settingsMenu`),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] font-medium text-muted-foreground transition-colors duration-base hover:bg-background/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(Zo,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:b(`settings`)})]})}),(0,U.jsxs)(EF,{side:p?`right`:`top`,align:p?`end`:`start`,className:`w-64 p-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(pe,{to:`/settings`,onClick:()=>t(!1),className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(Zo,{className:`h-4 w-4 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:b(`settings`)})]}),[{key:`docs`,icon:Ti,label:b(`docBrowserHelp`),action:d},{key:`apps`,icon:Zr,label:b(`appsTitle`),action:f}].map(({key:e,icon:n,label:r,action:i})=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{i(),t(!1)},className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(n,{className:`h-4 w-4 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:r})]},e))]}),(0,U.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,U.jsx)(j7,{icon:No,label:b(`theme`),options:i,value:n,valueLabel:r,onSelect:a,onCloseMenu:()=>t(!1)}),(0,U.jsx)(j7,{icon:so,label:b(`language`),options:c,value:o,valueLabel:s,onSelect:l,onCloseMenu:()=>t(!1)})]})]})}function j7({icon:e,label:t,options:n,value:r,valueLabel:i,onSelect:a,onCloseMenu:o}){return(0,U.jsxs)(Dr,{value:r,onOpenChange:e=>{e||o()},onValueChange:e=>a(e),children:[(0,U.jsxs)(yr,{"aria-label":t,className:`h-auto w-full rounded-lg border-0 bg-transparent px-3 py-2 text-[13px] font-medium text-foreground shadow-none hover:bg-gray-200/60 hover:text-gray-900 focus:ring-0`,indicator:(0,U.jsx)(fa,{className:`h-4 w-4 text-muted-foreground/70`}),children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(e,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`text-left`,children:t})]}),(0,U.jsx)(`span`,{className:`ml-auto max-w-[96px] truncate text-[13px] text-muted-foreground`,children:i})]}),(0,U.jsx)(Sr,{side:`right`,align:`center`,sideOffset:6,className:`z-[var(--z-tooltip)] min-w-[7rem] rounded-lg`,viewportClassName:`h-auto min-w-[7rem] w-auto`,children:n.map(e=>(0,U.jsx)(Tr,{value:e.value,className:`text-[13px]`,children:e.label},e.value))})]})}var M7=P(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Sae=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}M7.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();M7.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){M7.setState({supported:!0,initialized:!0,busyAction:null}),L.error(`${b(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{M7.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(b(`runtimePresenceLaunchAtLoginUnavailable`));M7.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return M7.setState({supported:!0,initialized:!0,snapshot:n}),L.success(b(`runtimePresenceSaved`)),n}catch(e){throw L.error(`${b(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{M7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:b(`error`)}},N7=P(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null}));new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){N7.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{N7.setState({supported:!0,initialized:!0,snapshot:e})}),N7.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();N7.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){N7.setState({supported:!0,initialized:!0}),L.error(`${b(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,b(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){L.success(b(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){L.success(b(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??b(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){L.success(b(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&L.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,b(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&L.success(b(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,b(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updateChannel=async e=>{if(N7.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,b(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){L.success(b(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}L.success(b(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(b(`desktopUpdatesDesktopOnlyDescription`));N7.setState({busyAction:e});try{let e=await n(r);return N7.setState({snapshot:e}),e}catch(e){throw L.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{N7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:b(`error`),this.getChannelLabel=e=>b(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function P7(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function F7(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/inbox`||t.startsWith(`/inbox/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)||t.startsWith(`/apps/panel/`)}function I7(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function Cae(e){return[{target:`/chat`,label:e(`chat`),icon:bo},{target:`/inbox`,label:e(`inboxTitle`),icon:ao},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:sa},{target:`/agents`,label:e(`agentsPageTitle`),icon:oa},{target:`/settings`,label:e(`settings`),icon:Zo}]}function L7(e,t={}){let n=[{target:`/model`,label:e(`model`),icon:Da},{target:`/providers`,label:e(`providers`),icon:Fr},{target:`/channels`,label:e(`channels`),icon:wo},{target:`/extensions`,label:e(`extensions`),icon:Wo},{target:`/appearance`,label:e(`appearance`),icon:No},{target:`/security`,label:e(`security`),icon:ts},{target:`/privacy`,label:e(`privacy`),icon:na},{target:`/desktop-capabilities`,label:e(`desktopCapabilities`),icon:Oo},{target:`/search`,label:e(`searchChannels`),icon:wi},{target:`/updates`,label:e(`updates`),icon:Oa},{target:`/remote`,label:e(`remote`),icon:_s},{target:`/runtime`,label:e(`runtime`),icon:Da},{target:`/secrets`,label:e(`secrets`),icon:oo},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:ys}];return t.includeDesktopCapabilities===!1?n.filter(e=>e.target!==`/desktop-capabilities`):n}function wae(e,t={}){let n=L7(e,t);return[{label:e(`settingsGroupBasic`),items:n.slice(0,3)},{label:e(`settingsGroupAdvanced`),items:n.slice(3)}]}function Tae(e){let t=e.toLowerCase();return t===`/settings`?!0:L7(e=>e).some(e=>P7(t,e.target))}function Eae(e,t){let n=e.toLowerCase(),r=L7(t);if(I7(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/inbox`||n.startsWith(`/inbox/`))return{title:t(`inboxTitle`),backTarget:n===`/inbox`?null:`/inbox`,backLabel:t(`inboxTitle`)};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n.startsWith(`/apps/panel/`))return{title:t(`panelAppsTitle`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(P7(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var Dae=[`feature-controls`];function Oae(){return Sn({queryKey:Dae,queryFn:I.featureControls.get})}var R7=new class{constructor(){this.getStatus=async()=>await I.capabilityAccess.getDesktopStatus(),this.listGrants=async()=>await I.capabilityAccess.listDesktopGrants(),this.grantAccess=async e=>await I.capabilityAccess.grantDesktopAccess(e),this.requestSystemPermission=async()=>await I.capabilityAccess.requestDesktopPermissions(),this.openSystemSettings=async()=>await I.capabilityAccess.openDesktopPermissionSettings(),this.revokeGrant=async e=>await I.capabilityAccess.revokeDesktopAccess(e)}},z7=[`desktop-capability`,`status`],B7=[`desktop-capability`,`grants`];function kae(){return Sn({queryKey:z7,queryFn:R7.getStatus})}function V7(){return Aae(Oae().data)}function Aae(e){return e?.desktopAutomation.available===!0}function jae(){return Sn({queryKey:B7,queryFn:R7.listGrants})}function Mae(){let e=F();return z({mutationFn:R7.requestSystemPermission,onSuccess:async()=>{await e.invalidateQueries({queryKey:z7})}})}function Nae(){return z({mutationFn:R7.openSystemSettings})}function Pae(){let e=F();return z({mutationFn:async e=>await R7.revokeGrant(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:B7})}})}function H7({isCollapsed:e,onToggle:t}){let n=b(e?`sidebarExpand`:`sidebarCollapse`);return(0,U.jsx)(V,{icon:(0,U.jsx)(e?Io:Po,{className:rX}),label:n,className:u(oX,e&&`h-9 w-9 rounded-xl`),onClick:t})}function Fae({isCollapsed:e,onToggle:t}){return(0,U.jsx)(`div`,{className:u(`shrink-0`,e?`px-0 py-1.5`:`px-2 py-2`),children:(0,U.jsxs)(`div`,{className:u(`flex items-center py-1`,e?u(`flex-col px-0`,aX):`gap-2 px-1`),"data-testid":`settings-sidebar-header`,children:[e?(0,U.jsx)(H7,{isCollapsed:e,onToggle:t}):null,(0,U.jsxs)(pe,{to:`/chat`,"aria-label":b(`backToMain`),className:u(`group inline-flex min-w-0 items-center rounded-lg text-[12px] font-medium text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e?u(nX,oX,`justify-center p-0`):`gap-1.5 px-1 py-1`),children:[(0,U.jsx)(Ci,{className:u(e?rX:`h-3.5 w-3.5`,`shrink-0 text-muted-foreground/75 group-hover:text-gray-700`)}),(0,U.jsx)(`span`,{className:e?`sr-only`:`truncate`,children:b(`backToMain`)})]}),e?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-border`,"aria-hidden":`true`}),(0,U.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-foreground`,children:b(`settings`)}),(0,U.jsx)(`div`,{className:`ml-auto`,children:(0,U.jsx)(H7,{isCollapsed:e,onToggle:t})})]})]})})}function Iae({isCollapsed:e,sections:t}){let{onScroll:n,scrollRef:r}=oY({restorationKey:`settings-sidebar:navigation`});return(0,U.jsx)(`nav`,{ref:r,onScroll:n,className:u(`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,e?`pr-0`:`pr-1`,PF),children:e?(0,U.jsx)(hX,{isCollapsed:e,items:t.flatMap(e=>e.items),density:`compact`,className:u(iX,`pb-3`)}):(0,U.jsx)(`div`,{className:`space-y-3 pb-3`,children:t.map(t=>(0,U.jsxs)(`section`,{"aria-label":t.label,className:`space-y-1`,children:[(0,U.jsx)(`h2`,{className:`px-3 text-[11px] font-semibold text-muted-foreground/70`,children:t.label}),(0,U.jsx)(hX,{isCollapsed:e,items:t.items,density:`compact`})]},t.label))})})}function Lae(){let e=P9(),t=Hi(),n=Cs(),r=V7(),i=ac(e=>e.isSidebarCollapsed),a=oc.toggleSidebarCollapsed,o=n.data?.account.email?.trim(),s=!!n.data?.account.loggedIn,c=wae(b,{includeDesktopCapabilities:r}),l=i?iX:uX(`compact`);return(0,U.jsxs)(`aside`,{"data-theme-surface":`navigation`,className:u(`shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary pb-6 transition-[width] duration-200 ease-out`,i?u(eX,tX):`w-[240px] px-4`),"data-sidebar-collapsed":i?`true`:`false`,children:[(0,U.jsx)(Fae,{isCollapsed:i,onToggle:a}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(Iae,{isCollapsed:i,sections:c}),(0,U.jsxs)(`div`,{className:u(`shrink-0 bg-secondary`,i?`mt-2 flex flex-col items-center pt-2`:`mt-2 pt-3`,l),children:[(0,U.jsx)(gX,{onClick:()=>t.open(void 0,{kind:`docs`,title:b(`docBrowserHelp`)}),icon:Ti,label:b(`docBrowserHelp`),density:`compact`,collapsed:i}),(0,U.jsx)(gX,{onClick:()=>e.accountManager.openAccountPanel(),icon:oo,label:b(`remoteAccountEntryManage`),density:`compact`,trailing:s?o||b(`remoteAccountEntryConnected`):b(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`,collapsed:i})]})]})]})}var U7=[{action:`minimize`,label:`Minimize`,icon:Do},{action:`close`,label:`Close`,icon:ki,variant:`danger`}];function Rae({sidebarCollapsed:e=!1}){let t=Bae()?{action:`toggle-maximize`,label:`Restore`,icon:Ta}:{action:`toggle-maximize`,label:`Maximize`,icon:ss};return(0,U.jsxs)(`header`,{"data-theme-surface":`header`,className:`desktop-window-drag relative flex h-[var(--desktop-titlebar-height)] shrink-0 bg-secondary after:absolute after:bottom-0 after:left-[var(--desktop-sidebar-width)] after:right-0 after:border-b after:border-border/80`,"data-testid":`desktop-window-chrome`,children:[(0,U.jsx)(`div`,{className:`desktop-window-no-drag absolute left-0 right-0 top-0 h-1`,"data-testid":`desktop-window-chrome-resize-strip`}),(0,U.jsx)(`div`,{className:u(`desktop-window-drag relative z-10 flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary text-secondary-foreground`,e?`justify-center px-0`:`pl-4 pr-3`),"data-testid":`desktop-window-chrome-sidebar`,children:e?(0,U.jsx)(`img`,{src:`/logo.svg`,alt:`NextClaw`,className:`h-6 w-6 shrink-0 object-contain`}):(0,U.jsx)(y7,{className:`flex min-w-0 shrink-0 items-center gap-2.5`,density:`chrome`})}),(0,U.jsx)(`div`,{className:`desktop-window-no-drag absolute right-0 top-0 z-20 flex h-full w-[var(--desktop-caption-safe-right)] items-start justify-end`,"data-testid":`desktop-window-controls`,children:[U7[0],t,U7[1]].map(e=>(0,U.jsx)(zae,{control:e},e.action))})]})}function zae({control:e}){let t=e.icon;return(0,U.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,className:e.variant===`danger`?`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-red-500 hover:text-white`:`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-black/10`,onClick:()=>{window.nextclawDesktop?.controlWindow?.(e.action)},children:(0,U.jsx)(t,{className:`h-3.5 w-3.5`})})}function Bae(){let[e,t]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let e=!0,n=window.nextclawDesktop;n?.getWindowState?.().then(n=>{e&&t(n.isMaximized)});let r=n?.onWindowStateChanged?.(e=>{t(e.isMaximized)});return()=>{e=!1,r?.()}},[]),e}function W7(){return typeof window>`u`?null:Vae()??window.nextclawDesktop?.platform??null}function G7(){return W7()===`win32`}function Vae(){return null}function K7(){let{pathname:e}=_e(),t=Hi(),n=D7();return(0,U.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":b(`settings`),className:`shrink-0 border-t border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.25rem)`},children:(0,U.jsxs)(`ul`,{className:`grid grid-cols-6 gap-1 px-2 pt-1`,children:[Cae(b).map(t=>{let r=t.target===`/settings`?Tae(e):P7(e,t.target);return(0,U.jsx)(`li`,{children:(0,U.jsxs)(ue,{to:t.target,"aria-current":r?`page`:void 0,"data-testid":r?`mobile-nav-active-indicator`:void 0,className:u(`group flex min-h-[2.875rem] flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 text-[10px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,r?`bg-gray-100 text-gray-900`:`text-gray-500 hover:bg-gray-50 hover:text-gray-800`),children:[(0,U.jsxs)(`span`,{className:`relative`,children:[(0,U.jsx)(t.icon,{className:u(`h-3.5 w-3.5`,r?`text-gray-900`:`text-gray-400`)}),t.target===`/inbox`&&n>0?(0,U.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-1 ring-white`}):null]}),(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:t.label})]})},t.target)}),(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>L1(t),className:`group flex min-h-[2.875rem] w-full flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 text-[10px] font-medium text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-800 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(Zr,{className:`h-3.5 w-3.5 text-gray-400`}),(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:b(`appsTitle`)})]})})]})})}function q7({leadingInset:e}){let t=ce(),{pathname:n}=_e(),r=Eae(n,b);return(0,U.jsx)(`header`,{"data-testid":`mobile-topbar`,className:`shrink-0 border-b border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.25rem)`},children:(0,U.jsxs)(`div`,{className:`flex min-h-[2.75rem] items-center gap-2 py-1.5 pl-3 pr-3`,style:{paddingLeft:e?`calc(${e} + 0.75rem)`:void 0},children:[r.backTarget?(0,U.jsx)(`button`,{type:`button`,onClick:()=>t(r.backTarget),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900`,"aria-label":r.backLabel??b(`backToMain`),children:(0,U.jsx)(Ci,{className:`h-4 w-4`})}):null,(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(`h1`,{className:`truncate text-center text-[15px] font-semibold text-gray-900`,children:r.title})}),r.backTarget?(0,U.jsx)(`div`,{className:`h-8 w-8 shrink-0`,"aria-hidden":`true`}):null]})})}var Hae=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DocBrowser:e}=await import(`./doc-browser-y3e2_MXe.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,33,1,34,35,36,37,38,39]))).DocBrowser}));function Uae({pathname:e,isDocBrowserOpen:t,docBrowserDockControls:n,docBrowserRenderers:r={},docBrowserTabMenuGroups:i,topbarLeadingInset:a,children:o}){let s=F7(e),c=!I7(e),l=!I7(e);return(0,U.jsxs)(`div`,{className:`flex h-[100svh] flex-col bg-background font-sans text-foreground supports-[height:100dvh]:h-[100dvh]`,children:[c?(0,U.jsx)(q7,{leadingInset:a}):null,(0,U.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:s?(0,U.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:o}):(0,U.jsx)(`main`,{className:`h-full overflow-auto px-4 py-4 custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:o})})}),l?(0,U.jsx)(K7,{}):null,t?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(Hae,{customTabRenderers:r,displayMode:`fullscreen`,dockControls:n,getTabMenuGroups:i})}):null]})}function Wae(){let e=L7(b,{includeDesktopCapabilities:V7()});return(0,U.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,U.jsxs)(pe,{to:e.target,className:({isActive:e})=>u(`flex items-center gap-3 rounded-2xl border border-gray-200/80 bg-white px-4 py-4 shadow-card transition-colors`,e?`border-gray-300 bg-gray-50`:`hover:border-gray-300 hover:bg-gray-50/70`),children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,U.jsx)(e.icon,{className:`h-4 w-4`})}),(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.label})})]},e.target))})}function Gae(){let{pathname:e}=_e(),t=ce();return I7(e)?(0,U.jsx)(Z5,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,U.jsx)(Y7,{variant:`mobile`})}var J7=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DocBrowser:e}=await import(`./doc-browser-y3e2_MXe.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,33,1,34,35,36,37,38,39]))).DocBrowser}));function Kae({pathname:e,isMobileLayout:t=!1,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:i,docBrowserRenderers:a={},docBrowserTabMenuGroups:o,sideDock:s,children:c}){let l=F7(e),d=ac(e=>e.isSidebarCollapsed),f=t&&!I7(e),p=G7(),m=d?`56px`:l?`280px`:`240px`,{onScroll:h,scrollRef:g}=oY({restorationKey:l?null:`settings-page:${e}`});return(0,U.jsxs)(`div`,{"data-theme-surface":`app-shell`,className:u(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,p?`rounded-[10px]`:null),style:p?{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":m}:void 0,children:[(0,U.jsx)(`div`,{"aria-hidden":`true`,"data-theme-decoration":`island-paper`}),(0,U.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute h-0 w-0`,focusable:`false`,children:(0,U.jsx)(`defs`,{children:(0,U.jsxs)(`filter`,{id:`island-wind-filter`,x:`-8%`,y:`-8%`,width:`116%`,height:`116%`,colorInterpolationFilters:`sRGB`,children:[(0,U.jsx)(`feTurbulence`,{type:`turbulence`,baseFrequency:`0.0025 0.011`,numOctaves:`2`,seed:`7`,result:`island-wind-noise`,children:(0,U.jsx)(`animate`,{attributeName:`baseFrequency`,dur:`8.5s`,values:`0.0025 0.011;0.0038 0.015;0.0028 0.009;0.0025 0.011`,keyTimes:`0;0.38;0.72;1`,calcMode:`spline`,keySplines:`0.42 0 0.25 1;0.45 0 0.2 1;0.4 0 0.3 1`,repeatCount:`indefinite`})}),(0,U.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`island-wind-noise`,scale:`5`,xChannelSelector:`R`,yChannelSelector:`G`,children:(0,U.jsx)(`animate`,{attributeName:`scale`,dur:`8.5s`,values:`5;17;9;14;5`,keyTimes:`0;0.34;0.58;0.78;1`,calcMode:`spline`,keySplines:`0.42 0 0.25 1;0.45 0 0.2 1;0.4 0 0.3 1;0.42 0 0.3 1`,repeatCount:`indefinite`})})]})})}),(0,U.jsx)(`div`,{"aria-hidden":`true`,"data-theme-decoration":`island-palm`,children:(0,U.jsx)(`span`,{"data-island-palm-part":`frond-wind`})}),p?(0,U.jsx)(Rae,{sidebarCollapsed:d}):null,(0,U.jsxs)(`div`,{className:`relative z-[1] flex min-h-0 flex-1 overflow-hidden`,children:[!l&&(0,U.jsx)(Lae,{}),(0,U.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,U.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:l?(0,U.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:c}):(0,U.jsx)(`main`,{"data-theme-surface":`settings-workspace`,ref:g,onScroll:h,className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:c})})}),n&&r===`docked`?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(J7,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null,s]})]}),f?(0,U.jsx)(K7,{}):null,n&&r===`floating`?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(J7,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null]})}var qae=[{target:`/inbox`,label:()=>b(`inboxTitle`),icon:ao},{target:`/cron`,label:()=>b(`chatSidebarScheduledTasks`),icon:ra},{target:`/skills`,label:()=>b(`chatSidebarSkills`),icon:sa},{target:`/agents`,label:()=>b(`agentsPageTitle`),icon:oa}];function Jae({isCollapsed:e}){let t=b(e?`sidebarExpand`:`sidebarCollapse`);return(0,U.jsx)(V,{icon:(0,U.jsx)(e?Io:Po,{className:rX}),label:t,className:u(oX,e&&`h-9 w-9 rounded-xl`),onClick:oc.toggleSidebarCollapsed})}function Yae({connectionStatus:e,isCollapsed:t}){let n=G7(),r=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`;return(0,U.jsxs)(`div`,{className:u(`flex items-center`,t?`justify-center px-2 py-1.5`:n?`justify-end px-3 py-1.5`:`gap-2 px-4 py-2`,t&&r?`pt-8`:null),children:[t||n?null:(0,U.jsx)(y7,{className:`flex min-w-0 flex-1 items-center gap-2`,suffix:(0,U.jsx)(aae,{status:e})}),(0,U.jsx)(Jae,{isCollapsed:t})]})}function Xae({isCollapsed:e}){let t=D7();return(0,U.jsxs)(`div`,{className:`pb-1`,children:[(0,U.jsx)(`div`,{className:e?`px-0`:`px-3`,children:(0,U.jsx)(`ul`,{className:e?iX:`space-y-0.5`,children:qae.map(n=>(0,U.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,U.jsx)(mX,{to:n.target,label:n.label(),icon:n.icon,density:`compact`,collapsed:e,indicator:n.target===`/inbox`&&t>0,trailing:n.target===`/inbox`&&t>0?t>99?`99+`:t:void 0,className:e?void 0:`rounded-lg px-2.5 py-1.5`})},n.target))})}),(0,U.jsx)(yX,{isCollapsed:e})]})}function Zae({defaultSessionType:e,groups:t,isCollapsed:n,isLoading:r,isProjectFirstView:i,onAddProject:a,onScrollNearEnd:o=()=>void 0,onSelectMode:s,projectGroups:c,projectCronJobCountByRoot:l,renderSessionItem:d,sessionTypeOptions:f}){let{onScroll:p,scrollRef:m}=oY({restorationKey:`chat-sidebar:sessions`,isEnabled:!n});return n?(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,"aria-hidden":`true`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex h-8 items-center justify-end gap-1 px-3`,children:[i?(0,U.jsx)(V,{icon:(0,U.jsx)(Ga,{className:`h-3.5 w-3.5`}),label:b(`chatProjectAdd`),tone:`surface`,onClick:a}):null,(0,U.jsx)(wL,{isProjectFirstView:i,onSelectMode:s})]}),(0,U.jsx)(`div`,{ref:m,onScroll:e=>{p(e);let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<600&&o()},className:u(`custom-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-1`,PF),children:(0,U.jsx)(bae,{isLoading:r,isProjectFirstView:i,groups:t,projectGroups:c,projectCronJobCountByRoot:l,defaultSessionType:e,sessionTypeOptions:f,renderSessionItem:d})})]})}function Qae({currentLanguage:e,currentLanguageLabel:t,currentTheme:n,currentThemeLabel:r,isCollapsed:i,isOpen:a,languageOptions:o,onOpenApps:s,onOpenChange:c,onOpenDocs:l,onSelectLanguage:d,onSelectTheme:f,themeOptions:p}){return(0,U.jsx)(`div`,{className:u(`py-2`,i?u(`flex justify-center`,tX):`px-3`),children:(0,U.jsx)(xae,{isOpen:a,onOpenChange:c,currentTheme:n,currentThemeLabel:r,themeOptions:p,onSelectTheme:f,currentLanguage:e,currentLanguageLabel:t,languageOptions:o,onSelectLanguage:d,onOpenDocs:l,onOpenApps:s,collapsed:i})})}function $ae(e){return b(e===`knowledge-base`?`chatProjectTemplateKnowledgeBase`:`chatProjectTemplateEmpty`)}function eoe({open:e,defaultWorkspacePath:t,templates:n,isCreating:r,isAddingExisting:i,createErrorMessage:a,addExistingErrorMessage:o,onOpenChange:s,onCreate:c,onAddExisting:l}){let[u,d]=(0,H.useState)(`create`),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(!1),[x,S]=(0,H.useState)(`empty`),C=n.length>0?n.map(e=>e.id):[`empty`],w=f.trim(),T=m.trim(),E=g.trim(),D=r||i,O=D||(u===`create`?!w:!E),k=u===`create`?a:o,A=()=>{d(`create`),p(``),h(``),_(``),S(`empty`),y(!1)},j=()=>{D||(A(),s(!1))};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ur,{open:e,onOpenChange:e=>{if(e){s(!0);return}j()},children:(0,U.jsxs)(Kr,{className:`sm:max-w-lg`,children:[(0,U.jsxs)(Wr,{children:[(0,U.jsx)(qr,{children:b(`chatProjectAddTitle`)}),(0,U.jsx)(Br,{children:b(`chatProjectAddDescription`)})]}),(0,U.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),!O&&(u===`create`?c({name:w,template:x,rootPath:T||void 0}):l({rootPath:E})).then(A).catch(()=>void 0)},children:[(0,U.jsxs)(KY,{value:u,onValueChange:e=>{D||d(e===`existing`?`existing`:`create`)},children:[(0,U.jsxs)(qY,{className:`grid w-full grid-cols-2`,children:[(0,U.jsx)(JY,{value:`create`,children:b(`chatProjectCreateMode`)}),(0,U.jsx)(JY,{value:`existing`,children:b(`chatProjectExistingMode`)})]}),(0,U.jsxs)(YY,{value:`create`,className:`mt-4 space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:b(`chatProjectCreateModeDescription`)}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-name`,children:b(`chatProjectNameLabel`)}),(0,U.jsx)(St,{id:`chat-project-name`,value:f,onChange:e=>p(e.target.value),placeholder:b(`chatProjectNamePlaceholder`),autoFocus:!0,disabled:D})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-template`,children:b(`chatProjectTemplateLabel`)}),(0,U.jsxs)(Dr,{value:x,onValueChange:e=>S(e),disabled:D,children:[(0,U.jsx)(yr,{id:`chat-project-template`,children:(0,U.jsx)(fr,{})}),(0,U.jsx)(Sr,{children:C.map(e=>(0,U.jsx)(Tr,{value:e,children:$ae(e)},e))})]})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-create-root-path`,children:b(`chatProjectCreatePathLabel`)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(St,{id:`chat-project-create-root-path`,value:m,onChange:e=>h(e.target.value),placeholder:b(`chatProjectCreatePathPlaceholder`),disabled:D}),(0,U.jsxs)(R,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,U.jsx)(Wa,{className:`mr-2 h-4 w-4`}),b(`browse`)]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:b(`chatProjectCreatePathHint`)})]})]}),(0,U.jsxs)(YY,{value:`existing`,className:`mt-4 space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:b(`chatProjectExistingModeDescription`)}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(dn,{htmlFor:`chat-project-existing-root-path`,children:b(`chatProjectExistingPathLabel`)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(St,{id:`chat-project-existing-root-path`,value:g,onChange:e=>_(e.target.value),placeholder:b(`chatProjectExistingPathPlaceholder`),autoFocus:!0,disabled:D}),(0,U.jsxs)(R,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,U.jsx)(Wa,{className:`mr-2 h-4 w-4`}),b(`browse`)]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:b(`chatProjectExistingPathHint`)})]})]})]}),k?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:k}):null,(0,U.jsxs)(Pr,{children:[(0,U.jsx)(R,{type:`button`,variant:`outline`,onClick:j,disabled:D,children:b(`cancel`)}),(0,U.jsx)(R,{type:`submit`,disabled:O,children:b(D?`saving`:u===`create`?`chatProjectCreateAction`:`chatProjectExistingAction`)})]})]})]})}),(0,U.jsx)(GF,{open:v,allowCreateDirectory:u===`create`,currentPath:u===`create`?m:g,defaultWorkspacePath:t,isSaving:!1,onOpenChange:y,onConfirm:e=>{u===`create`?h(e):_(e),y(!1)},title:b(u===`create`?`chatProjectCreatePathPickerTitle`:`chatProjectExistingPathPickerTitle`),description:b(u===`create`?`chatProjectCreatePathPickerDescription`:`chatProjectExistingPathPickerDescription`),pathLabel:b(u===`create`?`chatProjectCreatePathLabel`:`chatProjectExistingPathLabel`),pathPlaceholder:b(u===`create`?`chatProjectCreatePathPlaceholder`:`chatProjectExistingPathPlaceholder`),confirmLabel:b(`selectCurrentDirectory`),hint:b(u===`create`?`chatProjectCreatePathHint`:`chatProjectExistingPathHint`)})]})}function toe(e){let t=L5({all:!0});return(0,H.useMemo)(()=>{let n=new Map(e.flatMap(({session:e})=>{let t=e.projectRoot?.trim();return t?[[e.key,t]]:[]})),r=new Map,i=new Map;for(let e of t.data?.jobs??[]){let t=e.payload.sessionId?.trim();if(!t)continue;r.set(t,(r.get(t)??0)+1);let a=n.get(t);a&&i.set(a,(i.get(a)??0)+1)}return{cronJobCountByProjectRoot:i,cronJobCountBySessionKey:r}},[e,t.data?.jobs])}function noe(e,t,n){let r=aL(e=>e.optimisticReadAtBySessionKey);return(0,H.useEffect)(()=>{(()=>{if(!t)return;let r=e.find(({session:e})=>e.key===t);if(!r||r.runStatus===`running`)return;let{session:i}=r;n(i.key,i.lastMessageAt,i.readAt)})()},[e,n,t]),r}function Y7({variant:e=`desktop`}){let t=e===`mobile`,n=eI(),r=Hi(),i=ac(e=>e.isSidebarCollapsed),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,d]=(0,H.useState)(!1),f=aL(e=>e.snapshot),p=eR(e=>e.snapshot.sessionTypesQuery?.data??null),m=eR(e=>e.snapshot.configQuery?.data??null),h=Ze(),g=oz(),_=nR(),v=rR(),y=iR(),{allItems:x,hasMore:S,isLoading:C,isLoadingMore:w,items:T,loadMore:E}=gL(),{cronJobCountByProjectRoot:D,cronJobCountBySessionKey:O}=toe(x),{language:k,setLanguage:j}=Wn(),{theme:M,setTheme:N}=h7(),P=b(t7.find(e=>e.value===M)?.labelKey??`themeWork`),ee=A.find(e=>e.value===k)?.label??k,te=(0,H.useMemo)(()=>t7.map(e=>({value:e.value,label:b(e.labelKey)})),[]),ne=(0,H.useMemo)(()=>A.map(e=>({value:e.value,label:e.label})),[]),re=(0,H.useMemo)(()=>new Map((g.data?.agents??[]).map(e=>[e.id,e])),[g.data?.agents]),ie=(0,H.useMemo)(()=>new Set(f.pinnedSessionKeys),[f.pinnedSessionKeys]),ae=(0,H.useMemo)(()=>new Set(f.pinnedProjectRoots),[f.pinnedProjectRoots]),oe=(0,H.useMemo)(()=>vL(T),[T]),se=(0,H.useMemo)(()=>SL(x),[x]),ce=(0,H.useMemo)(()=>bL(oe,ie),[ie,oe]),le=(0,H.useMemo)(()=>xL(oe,ie,ae,_.data?.projects??[]),[ae,ie,_.data?.projects,oe]),ue=(0,H.useMemo)(()=>kL(p?.options??[]),[p?.options]),de=(0,H.useMemo)(()=>EL(p?.defaultType??`native`),[p?.defaultType]),fe=gR({defaultSessionType:de,sessionTypeOptions:ue}),pe=f.listMode===`project-first`,me=!t&&i,he=noe(T,f.selectedSessionKey,n.chatSessionListManager.markSessionRead),{editingSessionKey:ge,draftLabel:_e,savingSessionKey:ve,setDraftLabel:ye,startEditingSessionLabel:be,cancelEditingSessionLabel:F,saveSessionLabel:xe}=Tie(),Se=e=>{k!==e&&(j(e),window.location.reload())},Ce=e=>(0,U.jsx)(Kie,{item:e,selectedSessionKey:f.selectedSessionKey,optimisticReadAtBySessionKey:he,agentsById:re,childSessionsByParentKey:se,cronJobCount:O.get(e.session.key)??0,editingSessionKey:ge,draftLabel:_e,savingSessionKey:ve,sessionTypeOptions:ue,isPinned:ie.has(e.session.key),sessionTitle:CL,onSelectSession:n.chatSessionListManager.selectSession,onStartEditingSessionLabel:be,onDraftLabelChange:ye,onSaveSessionLabel:xe,onCancelEditingSessionLabel:F,onTogglePinned:()=>n.chatSessionListManager.toggleSessionPinned(e.session.key),onDeleteSession:n.chatThreadManager.deleteSession},e.session.key),we=(e,t)=>{n.chatSessionListManager.createSession({projectRoot:typeof t==`string`?t:void 0,sessionType:e})},Te=()=>{v.reset(),y.reset(),c(!0)},Ee=async e=>{await v.mutateAsync(e),c(!1)},De=async e=>{await y.mutateAsync(e),c(!1)};return(0,U.jsxs)(`aside`,{"data-theme-surface":`navigation`,className:u(`flex h-full min-h-0 flex-col bg-secondary transition-[width] duration-200 ease-out`,t?`flex-1 overflow-hidden`:me?u(eX,`shrink-0`):`w-[280px] shrink-0`),"data-sidebar-collapsed":me?`true`:`false`,children:[t?null:(0,U.jsx)(Yae,{connectionStatus:h.connectionStatus,isCollapsed:me}),t?(0,U.jsx)(Yie,{query:f.query,defaultSessionType:fe.selectedSessionType,sessionTypeOptions:ue,selectedNewSessionType:fe.selectedSessionType,selectedNewSessionTypeOption:fe.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:we,onSelectNewSessionType:fe.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery}):(0,U.jsx)(Jie,{query:f.query,defaultSessionType:de,sessionTypeOptions:ue,selectedNewSessionType:fe.selectedSessionType,selectedNewSessionTypeOption:fe.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:we,onSelectNewSessionType:fe.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery,collapsed:me}),t?null:(0,U.jsx)(Xae,{isCollapsed:me}),(0,U.jsx)(Zae,{defaultSessionType:fe.selectedSessionType,groups:ce,isCollapsed:me,isLoading:C,isProjectFirstView:pe,onAddProject:Te,onScrollNearEnd:()=>{S&&!w&&E()},onSelectMode:n.chatSessionListManager.setListMode,projectGroups:le,projectCronJobCountByRoot:D,renderSessionItem:Ce,sessionTypeOptions:ue}),t?null:(0,U.jsx)(Qae,{currentLanguage:k,currentLanguageLabel:ee,currentTheme:M,currentThemeLabel:P,isCollapsed:me,isOpen:l,languageOptions:ne,onOpenApps:()=>L1(r),onOpenChange:d,onOpenDocs:()=>r.open(void 0,{kind:`docs`,title:b(`docBrowserHelp`)}),onSelectLanguage:Se,onSelectTheme:N,themeOptions:te}),(0,U.jsx)(eoe,{open:s,defaultWorkspacePath:pI(m?.agents.defaults.workspace),templates:_.data?.templates??[],isCreating:v.isPending,isAddingExisting:y.isPending,createErrorMessage:v.error?.message,addExistingErrorMessage:y.error?.message,onOpenChange:c,onCreate:Ee,onAddExisting:De})]})}var X7=`sid_`,Z7=`/chat/draft`,roe=Z7.slice(6);function ioe(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return`${X7}${btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}`}function aoe(e){if(!e.startsWith(X7))return null;let t=e.slice(4).replace(/-/g,`+`).replace(/_/g,`/`),n=`=`.repeat((4-t.length%4)%4);try{let e=atob(t+n),r=Uint8Array.from(e,e=>e.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function Q7(e){if(!e||e===roe)return null;let t=aoe(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function $7(e){return`/chat/${ioe(e)}`}function e9(e,t){let n=t.trim();return n?e.includes(n)?e.filter(e=>e!==n):[n,...e]:e}var ooe=class{constructor(e){this.uiManager=e,this.syncDraftThreadState=e=>{let t=$.getState().snapshot.workspaceFileTabs.filter(e=>e.parentSessionKey!==null);$.getState().setSnapshot({sessionKey:null,sessionDisplayName:void 0,draftProjectRoot:e,canDeleteSession:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null,workspaceFileTabs:t,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0})},this.resolveUpdateValue=(e,t)=>typeof t==`function`?t(e):t,this.shouldPersistReadAt=(e,t,n)=>{let r=aL.getState().optimisticReadAtBySessionKey[e],i=r&&n?r.localeCompare(n)>0?r:n:r??n??void 0;return i?t.localeCompare(i)>0:!0},this.setSelectedAgentId=e=>{let t=aL.getState().snapshot.selectedAgentId,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({selectedAgentId:n})},this.syncSelectedSessionAgent=()=>{let e=$.getState().snapshot.agentId?.trim();e&&this.setSelectedAgentId(e)},this.setSelectedSessionKey=e=>{e!==aL.getState().snapshot.selectedSessionKey&&aL.getState().setSnapshot({selectedSessionKey:e})},this.syncRouteSessionSelection=e=>{this.setSelectedSessionKey(e),e&&$.getState().setSnapshot({draftProjectRoot:null})},this.setListMode=e=>{let t=aL.getState().snapshot.listMode,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({listMode:n})},this.toggleSessionPinned=e=>{let{pinnedSessionKeys:t}=aL.getState().snapshot;aL.getState().setSnapshot({pinnedSessionKeys:e9(t,e)})},this.toggleProjectPinned=e=>{let{pinnedProjectRoots:t}=aL.getState().snapshot;aL.getState().setSnapshot({pinnedProjectRoots:e9(t,e)})},this.toggleProjectCollapsed=e=>{let{collapsedProjectRoots:t}=aL.getState().snapshot;aL.getState().setSnapshot({collapsedProjectRoots:e9(t,e)})},this.markSessionRead=(e,t,n)=>{let r=e?.trim(),i=t?.trim();!r||!i||this.shouldPersistReadAt(r,i,n)&&(aL.getState().markSessionRead(r,i),Qe(r,{uiReadAt:i}).catch(()=>void 0))},this.markVisibleWorkspaceChildRead=e=>{this.markSessionRead(e.sessionKey,e.runStatus===`running`?null:e.lastMessageAt,e.readAt)},this.createSession=(e={})=>{let{projectRoot:t,prompt:n,sessionType:r}=e,i=EL(r??`native`),a=pI(t),o=n?.trim()||null;this.syncDraftThreadState(a),this.uiManager.navigateTo(Z7,{replace:this.uiManager.isAtChatRoot(),state:{chatDraft:{sessionType:i,projectRoot:a,prompt:o}}})},this.startAgentDraftChat=(e,t,n)=>{let r=e.trim()||`main`;this.createSession({prompt:n,sessionType:t}),this.setSelectedAgentId(r)},this.selectSession=e=>{this.uiManager.goToSession(e)},this.setQuery=e=>{let t=aL.getState().snapshot.query,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({query:n})}}},soe=async()=>!1,coe=class{constructor(e){this.docBrowserManager=e,this.state={pathname:``},this.actions={navigate:null,confirm:soe},this.syncState=e=>{this.state={...this.state,...e}},this.bindActions=e=>{this.actions={...this.actions,...e}},this.confirm=async e=>this.actions.confirm(e),this.navigateTo=(e,t)=>{this.actions.navigate&&(this.state.pathname===e&&!t?.replace||(this.actions.navigate(e,t),this.state.pathname=e))},this.goToProviders=()=>{this.navigateTo(`/providers`)},this.isCompactViewport=()=>oc.getSnapshot().mode===`mobile`,this.resolvePanelAppEntry=async e=>{let t=e.trim();if(!t)return null;try{return U1((await I.panelApps.listPanelApps()).entries,t)}catch{return null}},this.showContent=async e=>{let{target:t,title:n}=e;if(t.type===`url`){this.docBrowserManager.open(t.payload.url,{dedupeKey:`browser:${t.payload.url}`,kind:`content`,title:n});return}let{appId:r,params:i,path:a}=t.payload;if(a){this.docBrowserManager.open(a1(r,a),{contentParams:i,title:n});return}let o=await this.resolvePanelAppEntry(r);if(o){this.docBrowserManager.openTarget({...f1(o),contentParams:i},{title:n});return}this.docBrowserManager.open(a1(r),{contentParams:i,title:n})},this.goToChatRoot=e=>{this.navigateTo(`/chat`,e)},this.isAtChatRoot=()=>this.state.pathname===`/chat`||this.state.pathname===`/chat/draft`,this.goToSession=(e,t)=>{this.navigateTo($7(e),t)}}};function t9(e){let t=e=>{if(!e||typeof e!=`object`)return e;let t=e,n=t.error instanceof Error?{name:t.error.name,message:t.error.message}:t.error;return{data:t.data,error:n,status:t.status,fetchStatus:t.fetchStatus,isLoading:t.isLoading,isFetching:t.isFetching,isFetched:t.isFetched,isSuccess:t.isSuccess}};return{configQuery:t(e.configQuery),providersQuery:t(e.providersQuery),providerTemplatesQuery:t(e.providerTemplatesQuery),sessionsQuery:t(e.sessionsQuery),sessionTypesQuery:t(e.sessionTypesQuery),sessionSkillsSessionId:e.sessionSkillsSessionId,sessionSkillsQuery:t(e.sessionSkillsQuery)}}function loe(e,t){return JSON.stringify(t9(e))!==JSON.stringify(t9({...e,...t}))}var uoe=class{constructor(){this.syncSnapshot=e=>{let t=eR.getState();loe(t.snapshot,e)&&t.setSnapshot(e)}}};function doe(){return{sessionKey:null,sessionTypeLabel:null,agentId:null,sessionDisplayName:void 0,draftProjectRoot:null,sessionProjectName:null,canDeleteSession:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,workspaceFileTabs:[],activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0}}function n9(e,t,n){return e===t?n:e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?`${n}${e.slice(t.length)}`:null}function foe(e,t){let n=t.previousPath.trim(),r=t.path.trim();if(!n||!r||n===r)return null;let i=new Map,a=e.workspaceFileTabs.map(e=>{let a=n9(e.path,n,r);if(!a)return e;let o=LR(e,a,e.path===n?t.label:e.label);return i.set(e.key,o.key),o});if(i.size===0)return null;let o=e=>e.kind===`file`&&i.has(e.key)?{kind:`file`,key:i.get(e.key)}:e;return{workspaceFileTabs:a,activeWorkspaceFileKey:e.activeWorkspaceFileKey?i.get(e.activeWorkspaceFileKey)??e.activeWorkspaceFileKey:null,closedWorkspaceTabEntries:e.closedWorkspaceTabEntries.map(o),workspaceNavigationHistory:e.workspaceNavigationHistory.map(o)}}function poe(e,t){let n=t.trim();if(!n)return null;let r=e,i=e.workspaceFileTabs.filter(e=>n9(e.path,n,n)!==null).map(e=>e.key);for(let e of i){let t=HR(r,{kind:`file`,key:e});t&&(r={...r,...t})}return i.length>0?r:null}var moe=class{constructor(e,t,n){this.uiManager=e,this.sessionListManager=t,this.onWorkspacePanelOpened=n,this.handledUiShowContentEventIds=new Set,this.hasSnapshotChanges=e=>{let t=$.getState().snapshot;for(let[n,r]of Object.entries(e))if(!Object.is(t[n],r))return!0;return!1},this.syncSnapshot=e=>{this.hasSnapshotChanges(e)&&$.getState().setSnapshot(e)},this.clearDeletedSessionState=()=>{$.getState().setSnapshot(doe())},this.resolveWorkspaceParentSessionKey=()=>aL.getState().snapshot.selectedSessionKey?.trim()||$.getState().snapshot.sessionKey?.trim()||(aL.getState().snapshot.selectedSessionKey??null),this.activateWorkspaceFileTab=(e,t)=>{let{parentSessionKey:n}=e,{workspaceFileTabs:r}=$.getState().snapshot;this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:`file`,workspaceFileTabs:IR(r,e,t),activeWorkspaceFileKey:e.key,activeChildSessionKey:null,activeSideChatDraft:null},{kind:`file`,key:e.key}),this.ensureWorkspaceParentRoute(n),this.onWorkspacePanelOpened?.()},this.ensureWorkspaceParentRoute=e=>{if(!e)return;let{snapshot:{selectedSessionKey:t}}=aL.getState();t!==e&&this.uiManager.goToSession(e)},this.setWorkspaceSelection=(e,t)=>{let{snapshot:n}=$.getState(),r=oi({entries:n.workspaceNavigationHistory,index:n.workspaceNavigationHistoryIndex},t,zR),i=e.workspacePanelParentKey&&e.workspacePanelParentKey!==n.workspacePanelParentKey?[]:n.closedWorkspaceTabEntries.filter(e=>!zR(e,t));$.getState().setSnapshot({...e,closedWorkspaceTabEntries:i,workspaceNavigationHistory:[...r.entries],workspaceNavigationHistoryIndex:r.index})},this.openWorkspacePage=(e,t)=>{let n=e?.trim()||null;!n&&t!==`project-files`||(this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:t,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null},{kind:t}),this.ensureWorkspaceParentRoute(n),this.onWorkspacePanelOpened?.())},this.openWorkspaceOverview=e=>{this.openWorkspacePage(e,`overview`)},this.toggleWorkspacePanel=e=>{let t=e?.trim()||null,{snapshot:n}=$.getState();if(n.workspacePanelParentKey===t&&n.activeWorkspacePanelKind){this.closeWorkspacePanel();return}if(t){this.openWorkspaceOverview(t);return}this.openProjectFiles(null)},this.setWorkspacePanelWidth=e=>{this.syncSnapshot({workspacePanelWidth:kR(e)})},this.setWorkspaceExplorerWidth=e=>{this.syncSnapshot({workspaceExplorerWidth:AR(e)})},this.renameWorkspacePath=e=>{let t=foe($.getState().snapshot,e);t&&this.syncSnapshot(t)},this.removeWorkspacePath=e=>{let t=poe($.getState().snapshot,e);t&&$.getState().setSnapshot(t)},this.openChildSessions=e=>this.openWorkspacePage(e,`child-sessions`),this.openContinuousAttention=e=>this.openWorkspacePage(e,`continuous-attention`),this.openProjectFiles=e=>this.openWorkspacePage(e,`project-files`),this.materializeRootDraftSession=e=>{let t=e.trim();if(!t||!this.uiManager.isAtChatRoot())return;let n=GR($.getState().snapshot,t);n&&(this.sessionListManager.syncRouteSessionSelection(t),$.getState().setSnapshot(n),this.uiManager.goToSession(t,{replace:!0}))},this.openChildSessionPanel=e=>{let{activeChildSessionKey:t,childSessionTab:n,parentSessionKey:r}=e,i=r.trim();if(!i)return;let a=t?.trim()||null,o={workspacePanelParentKey:i,activeWorkspacePanelKind:`child-session`,activeChildSessionKey:a,activeSideChatDraft:null,activeWorkspaceFileKey:null};a&&n&&(o.childSessionTabs=WR($.getState().snapshot.childSessionTabs,{sessionKey:a,parentSessionKey:i,label:n.label?.trim()||null,agentId:n.agentId?.trim()||null})),a?this.setWorkspaceSelection(o,{kind:`child-session`,key:a}):$.getState().setSnapshot(o),this.ensureWorkspaceParentRoute(i),this.onWorkspacePanelOpened?.()},this.openSideChatDraft=e=>{let t=e?.trim()||this.resolveWorkspaceParentSessionKey()?.trim();if(!t)return;let n=UR(t);this.setWorkspaceSelection({workspacePanelParentKey:t,activeWorkspacePanelKind:`side-chat-draft`,activeChildSessionKey:null,activeSideChatDraft:n,activeWorkspaceFileKey:null},{kind:`side-chat-draft`,key:n.draftKey}),this.ensureWorkspaceParentRoute(t),this.onWorkspacePanelOpened?.()},this.materializeSideChatDraft=e=>{let t=KR({snapshot:$.getState().snapshot,...e});t&&($.getState().setSnapshot(t.patch),this.ensureWorkspaceParentRoute(t.parentSessionKey))},this.openFilePreview=e=>{let t=FR(e,this.resolveWorkspaceParentSessionKey());t&&this.activateWorkspaceFileTab(t)},this.openWorkspaceFileViewer=(e,t)=>{let n=$.getState().snapshot.workspaceFileTabs.find(t=>t.key===e.trim());if(!n||n.viewMode!==`preview`)return;let r=t??PR(n.path,n.previewViewer);if(!r)return;let i=FR({path:n.path,label:n.label??void 0,viewMode:`preview`,previewViewer:r,line:n.line??void 0,column:n.column??void 0,params:n.params??void 0,rawText:n.rawText??void 0,contentUrl:n.contentUrl??void 0,mimeType:n.mimeType??void 0},n.parentSessionKey);i&&this.activateWorkspaceFileTab(i,n.key)},this.openSessionFromToolAction=e=>{if(e.kind!==`open-session`)return;let t=e.sessionId.trim();if(t){if(e.sessionKind===`child`&&!this.uiManager.isCompactViewport()){let n=e.parentSessionId?.trim()||aL.getState().snapshot.selectedSessionKey||null;if(n){this.openChildSessionPanel({parentSessionKey:n,activeChildSessionKey:t,childSessionTab:{label:e.label,agentId:e.agentId}});return}}this.closeWorkspacePanel(),this.uiManager.goToSession(t)}},this.handleToolAction=async e=>{if(e.kind===`show-content`){await this.showContent(e.request);return}this.openSessionFromToolAction(e)},this.handleUiShowContentEvent=async e=>{let t=e.id.trim();!t||this.handledUiShowContentEventIds.has(t)||(this.handledUiShowContentEventIds.add(t),await this.showContent({target:e.target,title:e.title,purpose:e.purpose,placement:e.placement}))},this.showContent=async e=>{if(e.placement!==`inline`){if(e.target.type===`file`){this.openFilePreview({path:e.target.payload.path,label:e.title,viewMode:`preview`,previewViewer:e.target.payload.viewer,line:e.target.payload.line,column:e.target.payload.column,params:e.target.payload.params});return}await this.uiManager.showContent({target:e.target,title:e.title})}},this.syncVisibleWorkspaceSelection=e=>{e?.kind===`child-session`&&this.sessionListManager.markVisibleWorkspaceChildRead(e.tab)},this.selectChildSessionDetail=e=>{let t=e.trim();t&&this.setWorkspaceSelection({activeChildSessionKey:t,activeWorkspaceFileKey:null,activeWorkspacePanelKind:`child-session`,activeSideChatDraft:null},{kind:`child-session`,key:t})},this.selectWorkspaceFile=e=>{let t=e.trim();if(!t)return;let{workspaceFileTabs:n}=$.getState().snapshot;n.some(e=>e.key===t)&&this.setWorkspaceSelection({activeWorkspaceFileKey:t,activeChildSessionKey:null,activeWorkspacePanelKind:`file`,activeSideChatDraft:null},{kind:`file`,key:t})},this.closeWorkspaceTab=e=>{let{snapshot:t}=$.getState(),n=HR(t,e);n&&$.getState().setSnapshot(n)},this.closeWorkspacePanel=()=>{$.getState().setSnapshot({workspacePanelParentKey:null,activeWorkspacePanelKind:null,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0})},this.openSessionCronPanel=e=>{this.openWorkspacePage(e,`cron`)},this.goBackWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`back`)},this.goForwardWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`forward`)},this.restoreWorkspaceNavigationStep=e=>{let{snapshot:t}=$.getState(),n=si({entries:t.workspaceNavigationHistory,index:t.workspaceNavigationHistoryIndex},e);if(!n)return;let r=VR(n.entry,t);r&&$.getState().setSnapshot({...r,workspaceNavigationHistory:[...n.history.entries],workspaceNavigationHistoryIndex:n.history.index})},this.goToParentSession=()=>{let{parentSessionKey:e,activeSideChatDraft:t,childSessionTabs:n,activeChildSessionKey:r}=$.getState().snapshot,i=n.find(e=>e.sessionKey===r)?.parentSessionKey??null,a=e??t?.parentSessionKey??i;a&&(this.closeWorkspacePanel(),this.uiManager.goToSession(a))},this.deleteSession=async e=>{let{snapshot:{selectedSessionKey:t}}=aL.getState(),n=e?.trim()||t;if(n&&await this.uiManager.confirm({title:b(`chatDeleteSessionConfirm`),variant:`destructive`,confirmLabel:b(`delete`)})){$.getState().setSnapshot({isDeletePending:!0});try{await Ft(n),et(jt,n),jt.removeQueries({queryKey:[`ncp-session-messages`,n]}),L.success(b(`chatDeleteSessionSucceeded`)),n===t&&(this.clearDeletedSessionState(),this.uiManager.goToChatRoot({replace:!0}))}catch(e){let t=e instanceof Error?e.message:String(e);L.error(`${b(`chatDeleteSessionFailed`)}: ${t}`)}finally{$.getState().setSnapshot({isDeletePending:!1})}}}}},hoe=class{constructor(e){this.chatUiManager=new coe(e.docBrowserManager),this.chatSessionListManager=new ooe(this.chatUiManager),this.chatQueryManager=new uoe,this.chatComposerIntentManager=e.chatComposerIntentManager,this.chatThreadManager=new moe(this.chatUiManager,this.chatSessionListManager,e.notifyRightPanelOpened)}},goe=class{constructor(){this.nextId=0,this.pendingIntent=null,this.listeners=new Set,this.requestDraft=e=>{let t=e.trim();if(!t)return;let n={id:this.nextId+1,kind:`prompt`,prompt:t};this.nextId=n.id,this.pendingIntent=n,this.listeners.forEach(e=>e(n))},this.requestSystemObjectReference=e=>{let t={id:this.nextId+1,kind:`system-object-reference`,reference:structuredClone(e)};this.nextId=t.id,this.pendingIntent=t,this.listeners.forEach(e=>e(t))},this.consumePending=()=>{let e=this.pendingIntent;return this.pendingIntent=null,e},this.markConsumed=e=>{this.pendingIntent?.id===e&&(this.pendingIntent=null)},this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})}};function r9(e,t){let n=2166136261;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return`${e}#excerpt-${(n>>>0).toString(36)}`}var _oe=class{constructor(){this.nextId=0,this.pendingIntent=null,this.subscriptions=new Set,this.publish=e=>{let t=this.nextId+1,n=e.targetSessionKey?.trim()||null,r={...e,id:t,targetSessionKey:n};this.nextId=r.id,this.pendingIntent=r,this.subscriptions.forEach(e=>{e.targetSessionKey===r.targetSessionKey&&e.listener(r)})},this.requestFileReference=e=>{let t=e.tokenKey.trim(),n=e.label.trim();!t||!n||this.publish({kind:r,targetSessionKey:e.targetSessionKey?.trim()||null,tokenKey:t,label:n})},this.requestDirectoryReference=e=>{let t=e.tokenKey.trim(),n=e.label.trim();!t||!n||this.publish({kind:p,targetSessionKey:e.targetSessionKey?.trim()||null,tokenKey:t,label:n})},this.requestExcerptReference=e=>{let{endLine:t,excerpt:n,label:r,path:i,startLine:a,targetSessionKey:o}=e,s=i.trim(),c=r.trim(),l=n.trim();!s||!c||!l||this.publish({kind:O,targetSessionKey:o,tokenKey:r9(s,`${s}:${a??`x`}:${t??`x`}:${l}`),path:s,label:c,excerpt:l,startLine:a,endLine:t})},this.requestConversationExcerptReference=e=>{let{targetSessionKey:t,messageId:n,role:r,label:i,excerpt:a}=e,o=n.trim(),s=i.trim(),c=a.trim();!o||!s||!c||this.publish({kind:te,targetSessionKey:t,tokenKey:r9(o,`${o}:${c}`),messageId:o,role:r,label:s,excerpt:c})},this.requestUiResourceReference=e=>{let t=x(e.reference);if(!t)return;let n=t.uri.trim(),r=t.title.trim();this.publish({kind:re,targetSessionKey:e.targetSessionKey,tokenKey:n,label:r,reference:t})},this.consumePending=e=>{if(this.pendingIntent?.targetSessionKey!==e)return null;let t=this.pendingIntent;return this.pendingIntent=null,t},this.markConsumed=e=>{this.pendingIntent?.id===e&&(this.pendingIntent=null)},this.subscribe=(e,t)=>{let n={targetSessionKey:e,listener:t};return this.subscriptions.add(n),()=>{this.subscriptions.delete(n)}}}},i9=120,voe=200;function yoe(e){return[e?.parent_session_id,e?.parentSessionId].some(e=>typeof e==`string`&&e.trim().length>0)}function boe(e){let t=e.replace(/\r\n?/gu,`
|
|
109
|
+
`).replace(/^[ \t]*\[[^\]]+\]:\s+\S+.*$/gmu,` `).replace(/^[ \t]*(?:`{3,}|~{3,})[^\n]*$/gmu,` `).replace(/^[ \t]*\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?[ \t]*$/gmu,` `).replace(/^[ \t]*(?:[-*_][ \t]*){3,}$/gmu,` `).replace(/!\[([^\]]*)\]\([^\n)]+\)/gu,`$1`).replace(/\[([^\]]+)\]\([^\n)]+\)/gu,`$1`).replace(/\[([^\]]+)\]\[[^\]]*\]/gu,`$1`).replace(/<(https?:\/\/[^>\s]+)>/gu,`$1`).replace(/<[^>]+>/gu,` `).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gmu,``).replace(/^[ \t]*>+[ \t]?/gmu,``).replace(/^[ \t]*(?:[-+*]|\d+[.)])[ \t]+/gmu,``).replace(/^[ \t]*\[(?: |x|X)\][ \t]*/gmu,``).replace(/(`+)([^`]*?)\1/gu,`$2`).replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/gu,`$2`).replace(/~~(?=\S)([\s\S]*?\S)~~/gu,`$1`).replace(/\*(?=\S)([^*\n]*?\S)\*/gu,`$1`).replace(/\\([\\`*{}[\]()#+.!_>-])/gu,`$1`).replace(/^[ \t]*\|(.+)\|[ \t]*$/gmu,(e,t)=>t.split(`|`).map(e=>e.trim()).filter(Boolean).join(` `)).replace(/\s+/gu,` `).trim(),n=Array.from(t);return n.length<=i9?t:`${n.slice(0,i9-1).join(``)}…`}function xoe(e){return boe(e.parts.filter(e=>e.type===`text`||e.type===`rich-text`).map(e=>e.text).join(` `))}var Soe=class{constructor(e){this.notificationManager=e,this.cleanups=[],this.handledMessageIds=new Set,this.visibleSessionIds=new Set,this.started=!1,this.start=()=>{this.started||(this.started=!0,this.cleanups.push(I.eventBus.on(c.ncpEvent,this.handleNcpEvent)))},this.stop=()=>{if(this.started)for(this.started=!1;this.cleanups.length>0;)this.cleanups.pop()?.()},this.syncVisibleSessions=e=>{this.visibleSessionIds=new Set(e.map(e=>e?.trim()).filter(e=>!!e))},this.handleNcpEvent=e=>{if(e.type!==gK.MessageCompleted)return;let{message:t}=e.payload,n=e.payload.sessionId.trim();if(!n||this.handledMessageIds.has(t.id)||t.role!==`assistant`||t.status!==`final`||lK(t)||(this.rememberHandledMessage(t.id),this.visibleSessionIds.has(n)))return;let r=this.resolveSessionSummary(n),i=CK(t.metadata);if(i&&i.actor!==`human`||!i&&r&&yoe(r.metadata))return;let a=r?nI(KI(r)):b(`chatBackgroundReplyFallbackTitle`),o=xoe(t);this.notificationManager.show({id:`chat-reply:${t.id}`,title:a,description:o||b(`chatBackgroundReplyFallbackPreview`),href:$7(n),ariaLabel:b(`chatBackgroundReplyOpenAriaLabel`).replace(`{title}`,a)})},this.resolveSessionSummary=e=>(eR.getState().snapshot.sessionsQuery?.data?.sessions??[]).find(t=>t.sessionId===e),this.rememberHandledMessage=e=>{if(this.handledMessageIds.add(e),this.handledMessageIds.size<=voe)return;let t=this.handledMessageIds.values().next().value;t&&this.handledMessageIds.delete(t)}}};function a9(){return Sn({queryKey:[`ncp-session-types`],queryFn:Et,staleTime:1e4,retry:!1})}var o9=`relative ml-auto flex min-h-[74px] w-[320px] max-w-[calc(100vw-2rem)] rounded-[20px] border border-border/80 bg-background text-left text-foreground shadow-[0_8px_18px_rgba(0,0,0,0.12),0_2px_5px_rgba(0,0,0,0.06)]`,s9=`flex min-h-[72px] min-w-0 flex-1 items-center gap-3 rounded-[inherit] py-3 pl-[18px] pr-[52px]`;function c9({title:e,description:t,iconSrc:n}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-border/80 bg-background p-[3px]`,children:(0,U.jsx)(`img`,{"aria-hidden":`true`,alt:``,src:n??`/logo.svg`,className:`h-full w-full object-contain`})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[15px] font-semibold leading-5 tracking-[-0.01em]`,children:e}),t?(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[14px] leading-5 text-muted-foreground`,children:t}):null]})]})}function l9({dismissLabel:e,onDismiss:t}){return(0,U.jsx)(V,{className:`absolute right-2.5 top-2.5 z-10`,icon:(0,U.jsx)(ki,{className:`h-4 w-4`,"aria-hidden":`true`}),label:e,onClick:t,size:`lg`,tooltipSide:`left`})}function Coe({title:e,description:t,href:n,iconSrc:r,ariaLabel:i,dismissLabel:a,onDismiss:o}){let s=i??[e,t].filter(Boolean).join(`: `);return n?(0,U.jsxs)(`div`,{className:o9,children:[(0,U.jsx)(ue,{to:n,"aria-label":s,className:`${s9} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50`,onClick:o,children:(0,U.jsx)(c9,{title:e,description:t,iconSrc:r})}),(0,U.jsx)(l9,{dismissLabel:a,onDismiss:o})]}):(0,U.jsxs)(`div`,{className:o9,children:[(0,U.jsx)(`div`,{role:`status`,"aria-label":s,className:s9,children:(0,U.jsx)(c9,{title:e,description:t,iconSrc:r})}),(0,U.jsx)(l9,{dismissLabel:a,onDismiss:o})]})}var woe=8e3,Toe=class{constructor(){this.show=e=>L.custom(t=>(0,H.createElement)(Coe,{title:e.title,description:e.description,href:e.href,iconSrc:e.iconSrc,ariaLabel:e.ariaLabel,dismissLabel:e.dismissLabel??b(`notificationDismiss`),onDismiss:()=>{L.dismiss(t)}}),{id:e.id,duration:e.durationMs??woe,unstyled:!0}),this.dismiss=e=>{L.dismiss(e)}}},Eoe=`nextclaw://docs`,u9=`github-project`,Doe=`https://github.com/Peiiii/nextclaw`;function d9(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:b(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:J$}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:b(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:Eoe}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:b(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:K$}},{builtIn:!0,icon:{type:`builtin`,name:`github`},id:u9,label:b(`sideDockGitHubProject`),removable:!1,target:{type:`external-url`,url:Doe}}]}var Ooe=[`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`];function f9(e){return!!e&&typeof e==`object`}function koe(e){return Ooe.includes(e)}function Aoe(e){return!f9(e)||typeof e.type!=`string`?null:e.type===`builtin`&&koe(e.name)?{type:`builtin`,name:e.name}:e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function joe(e){if(!f9(e)||typeof e.id!=`string`||e.id.trim().length===0||typeof e.label!=`string`||e.label.trim().length===0||typeof e.createdAt!=`string`||e.createdAt.trim().length===0||!f9(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=Aoe(e.icon);return t?{createdAt:e.createdAt,icon:t,id:e.id.trim(),label:e.label.trim(),target:{type:`right-panel-resource`,uri:e.target.uri.trim()}}:null}function p9(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=joe(e);n&&t.set(n.id,n)}),Array.from(t.values())}function Moe(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function Noe(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function Poe(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function m9(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(Noe).filter(e=>e!==null)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(Poe);return[...e,...i]}var Foe=`nextclaw.side-dock.state`,Ioe=1;function h9(e){return!!e&&typeof e==`object`}var g9=P()(ji(e=>({isVisible:!0,pinnedItems:[],setVisible:t=>e({isVisible:t}),setPinnedItems:t=>e({pinnedItems:p9(t)})}),{name:Foe,version:Ioe,storage:Mi(()=>window.localStorage),partialize:e=>({isVisible:e.isVisible,pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=h9(e)?p9(e.pinnedItems):[],r=h9(e)&&typeof e.isVisible==`boolean`?e.isVisible:!0;return{...t,isVisible:r,pinnedItems:n}}})),Loe={apps:Zr,docs:Ti,github:ti,"new-tab":Di,"panel-app":di,"service-apps":di},Roe=new Set([u9]),zoe=/^\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*$/u;function Boe(e){return zoe.test(e.trim())}function Voe({icon:e}){if(e.type===`url`)return(0,U.jsx)(`img`,{src:e.url,alt:``,className:`h-5 w-5 rounded object-cover`});if(e.type===`text`)return Boe(e.value)?(0,U.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center text-[20px] leading-none`,"aria-hidden":`true`,children:e.value}):(0,U.jsx)(`span`,{className:`max-w-7 truncate text-center text-[13px] font-semibold leading-none`,"aria-hidden":`true`,children:e.value});let t=Loe[e.name];return(0,U.jsx)(t,{className:`h-5 w-5`,"aria-hidden":`true`})}function _9({active:e,item:t,onOpen:n,onUnpin:r}){let{label:i}=t;return(0,U.jsxs)(pi,{children:[(0,U.jsxs)(`div`,{className:`group relative`,children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":i,title:i,"data-side-dock-item-id":t.id,onClick:()=>n(t),className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e?`bg-primary/10 text-primary`:`bg-transparent`),children:(0,U.jsx)(Voe,{icon:t.icon})})}),t.removable?(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`sideDockUnpinItem`),title:b(`sideDockUnpinItem`),onClick:e=>{e.stopPropagation(),r(t)},className:`absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-background text-muted-foreground shadow-sm ring-1 ring-border/70 transition-colors hover:bg-muted hover:text-foreground group-hover:flex focus-visible:flex focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:(0,U.jsx)(ki,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]}),(0,U.jsx)(li,{side:`left`,children:i})]})}function Hoe({icon:e,label:t,onClick:n}){return(0,U.jsxs)(pi,{children:[(0,U.jsx)(ni,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":t,title:t,"data-side-dock-action":`hide`,onClick:n,className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`),children:(0,U.jsx)(e,{className:`h-5 w-5`,"aria-hidden":`true`})})}),(0,U.jsx)(li,{side:`left`,children:t})]})}function v9(e){return e?.trim()??``}function y9(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function b9(e,t,n,r=!1){if(!t||!n)return!1;let i=v9(y9(e)??void 0);if(!i)return!1;let a=v9(n.resourceUri);return a&&a===i||v9(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function Uoe(e,t){if(!t)return!1;let n=v9(t.resourceUri),r=v9(t.currentUrl);return e.some(e=>{let t=v9(y9(e)??void 0);return t===n||t===r})}function x9(e){return Roe.has(e.id)}function Woe({manager:e}){let t=g9(e=>e.pinnedItems),n=g9(e=>e.setVisible),{currentTab:r,isOpen:i}=Hi(),{confirm:a,ConfirmDialog:o}=On(),s=m9(d9(),t),c=s.filter(e=>!x9(e)),l=s.filter(x9),u=Uoe(s,r),d=async()=>{await a({title:b(`sideDockHideConfirmTitle`),description:b(`sideDockHideConfirmDescription`),confirmLabel:b(`sideDockHideConfirmAction`),cancelLabel:b(`cancel`)})&&n(!1)};return(0,U.jsx)(ci,{delayDuration:250,children:(0,U.jsxs)(`aside`,{"data-testid":`side-dock`,"data-theme-surface":`utility-rail`,className:`z-30 flex h-full w-14 shrink-0 flex-col items-center gap-1 border-l border-border/60 bg-background/95 px-2 py-3`,children:[(0,U.jsx)(`div`,{className:`flex w-full flex-col items-center gap-1`,children:c.map(t=>(0,U.jsx)(_9,{active:b9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id))}),l.length>0?(0,U.jsxs)(`div`,{"data-testid":`side-dock-utility`,className:`mt-auto flex w-full flex-col items-center gap-1`,children:[l.map(t=>(0,U.jsx)(_9,{active:b9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id)),(0,U.jsx)(Hoe,{icon:Ro,label:b(`sideDockHide`),onClick:()=>{d()}})]}):null,(0,U.jsx)(o,{})]})})}var Goe=`pinned`,Koe=new Set([`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`]);function S9(e){return e.trim()}function qoe(e){let t=0;return Array.from(S9(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${Goe}-${S9(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function Joe(e){return e?.type===`builtin`&&Koe.has(e.name)?{type:`builtin`,name:e.name}:e?.type===`url`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e?.type===`text`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function Yoe(e){return e.kind===`docs`?`docs`:e.kind===`home`?`new-tab`:e.kind===`apps`?e.resourceUri?.includes(`service-apps`)?`service-apps`:`apps`:e.kind===`panel-app`?`panel-app`:`apps`}var Xoe=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>m9(d9(),g9.getState().pinnedItems),this.openItem=async e=>{if(e.target.type===`right-panel-resource`){this.docBrowserManager.open(e.target.uri,{dockIcon:e.icon,title:e.label});return}e.target.type===`external-url`&&await Ai.openExternalUrl(e.target.url)},this.getDockState=e=>{let t=this.getTabResourceUri(e);if(!t)return{canDock:!1,isDocked:!1,removable:!1};let n=this.findItemByUri(t);return{canDock:!0,isDocked:!!n,removable:n?.removable===!0}},this.pinTab=(e,t=new Date().toISOString())=>{let n=this.getTabResourceUri(e);!e||!n||this.findItemByUri(n)||this.pinItem({builtIn:!1,icon:Joe(e.dockIcon)??{type:`builtin`,name:Yoe(e)},id:qoe(n),label:e.title.trim()||n,removable:!0,target:{type:`right-panel-resource`,uri:n}},t)},this.unpinTab=e=>{let t=this.getTabResourceUri(e),n=t?this.findItemByUri(t):void 0;n?.removable&&this.unpinItem(n.id)},this.pinItem=(e,t=new Date().toISOString())=>{if(!e.removable||e.target.type!==`right-panel-resource`)return;let n=S9(e.target.uri),r={...e,target:{type:`right-panel-resource`,uri:n}};this.setPinnedItems(i=>i.some(t=>t.id===e.id||S9(t.target.uri)===n)?i:[...i,Moe(r,t)])},this.unpinItem=e=>{this.setPinnedItems(t=>t.filter(t=>t.id!==e))},this.reorderPinnedItems=e=>{this.setPinnedItems(t=>{let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>n.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.id)),a=t.filter(e=>!i.has(e.id));return[...r,...a]})},this.setPinnedItems=e=>{let{pinnedItems:t,setPinnedItems:n}=g9.getState();n(e(t))},this.getTabResourceUri=e=>{let t=e?.resourceUri??e?.currentUrl,n=t?S9(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=S9(e);return this.getItems().find(e=>e.target.type===`right-panel-resource`&&S9(e.target.uri)===t)}}},Zoe=new class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=n??(r?void 0:t?.kind)??(r&&Ri(r)?`docs`:`home`),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i===`home`?`nextclaw://new-tab`:i===`docs`?Wi():`about:blank`),o=i===`docs`?Yi(a,`docs`):a;return{historyPolicy:`managed`,kind:i,title:i===`home`?b(`docBrowserHomeTitle`):zi(o,i,i===`docs`?b(`docBrowserHelp`):`Detail`),url:o}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?Pi(e)===Pi(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==Ji}};function C9(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function w9(e,t){return C9(e,e.activeTabId,t)}function Qoe(e,t,n){let r=t.resourceUri??t.url,i=n.resourceUri??n.url;return t.tabId===n.tabId&&t.kind===n.kind&&e.areUrlsEquivalent(r,i,t.kind,n.kind)}function T9(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function E9(e,t,n){let r=oi({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>Qoe(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function $oe(e,t,n){for(let r=t.history.length-1;r>=0;--r)if(e.areUrlsEquivalent(t.history[r],n,t.kind,t.kind))return r;return-1}function D9(e,t,n){let r=t.tabs.find(e=>e.id===n.tabId);if(!r)return t;let i=n.resourceUri??n.url,a=e.resolveOpenTarget({activeTab:r,kind:n.kind,url:i}),o=$oe(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return C9({...t,activeTabId:r.id,isOpen:!0},r.id,e=>({...e,currentUrl:a.url,dedupeKey:a.dedupeKey,dockIcon:a.dockIcon??e.dockIcon,historyIndex:o>=0?o:e.historyIndex,kind:a.kind,resourceUri:a.resourceUri??a.url,title:s?e.title:a.title}))}function ese(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function O9(e,t,n,r){let{activate:i,dedupeKey:a,newTab:o,title:s}=r??{},c=a?.trim()||n.dedupeKey,l=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0],u=c?t.tabs.find(e=>e.dedupeKey===c):void 0;if(u){let a=C9(t,u.id,t=>Vi(e,t,n,r,c)),o=i!==!1,s=o?u.id:t.activeTabId,l={...a,activeTabId:s,isOpen:!0};return o||u.id===t.activeTabId?E9(e,l,T9(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=Ki(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon,n.contentParams);return ese(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[Ui(i)],activeHistoryIndex:0}:E9(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},Ui(i))}return E9(e,{...w9(t,t=>Vi(e,t,n,r,c)),isOpen:!0},T9(t.activeTabId,n))}function tse(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return O9(e,t,{...e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),contentParams:r?.contentParams},r)}var nse=class{constructor(e=Zoe,t){this.routeResolver=e,this.onRightPanelOpened=t,this.setSnapshot=e=>{Gi.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>tse(this.routeResolver,n,e,t)),this.onRightPanelOpened?.()},this.openTarget=(e,t)=>{this.setSnapshot(n=>O9(this.routeResolver,n,e,{...t,dedupeKey:t?.dedupeKey??e.dedupeKey,kind:t?.kind??e.kind,title:t?.title??e.title})),this.onRightPanelOpened?.()},this.reloadByDedupeKeys=e=>{let t=new Set(e);t.size!==0&&this.setSnapshot(e=>({...e,tabs:e.tabs.map(e=>t.has(e.dedupeKey??``)?{...e,navVersion:e.navVersion+1}:e)}))},this.openNewTab=()=>{this.open(void 0,{kind:Li,newTab:!0})},this.close=()=>{this.setSnapshot(e=>({...e,isOpen:!1}))},this.toggleMode=()=>{this.setSnapshot(e=>({...e,mode:e.mode===`floating`?`docked`:`floating`})),this.onRightPanelOpened?.()},this.setDockedWidth=e=>{this.setSnapshot(t=>({...t,dockedWidth:Ii(e)}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ki(Wi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=w9(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Bi(t,n.url),kind:n.kind,navVersion:t.navVersion+1,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?E9(this.routeResolver,n,Ui(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=Ki(Wi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=w9(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,kind:t.kind,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Bi(t,n.url),kind:n.kind,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?E9(this.routeResolver,n,Ui(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=si({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?D9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=si({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?D9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.closeTab=e=>{this.setSnapshot(t=>{if(t.tabs.length<=1)return{...Fi(),isOpen:!1};let n=t.tabs.findIndex(t=>t.id===e);if(n<0)return t;let r=t.tabs.filter(t=>t.id!==e),i=t.activeTabId===e?r[Math.max(0,n-1)]?.id??r[0].id:t.activeTabId,a={...t,tabs:r,activeTabId:i},o=r.find(e=>e.id===i)??r[0],s=vi({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,Ui(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?E9(this.routeResolver,c,Ui(o)):c})},this.setActiveTab=e=>{this.setSnapshot(t=>{if(!t.tabs.some(t=>t.id===e))return t;let n=t.tabs.find(t=>t.id===e);return n?E9(this.routeResolver,{...t,activeTabId:e,isOpen:!0},Ui(n)):t})}}};function rse(e){return e.activeWorkspacePanelKind!=null}var ise=class{constructor(){this.notificationManager=new Toe,this.inboxManager=new uae,this.chatCompletionNotificationManager=new Soe(this.notificationManager),this.accountManager=new $s,this.rightPanelResourceRouteResolver=new O1,this.notifyRightPanelOpened=()=>{let e=Gi.getState().snapshot,t=$.getState().snapshot;oc.collapseSidebarForDenseRightPanels({isDocBrowserDocked:e.mode===`docked`,isDocBrowserOpen:e.isOpen,isWorkspacePanelOpen:rse(t)})},this.docBrowserManager=new nse(this.rightPanelResourceRouteResolver,this.notifyRightPanelOpened),this.appPackageOperationSettlementManager=new B$(this.docBrowserManager),this.sideDockManager=new Xoe(this.docBrowserManager),this.chatComposerIntentManager=new _oe,this.chatDraftIntentManager=new goe,this.serviceActionAuthorizationManager=new h$,this.panelAppBridgeManager=new V1(this.serviceActionAuthorizationManager),this.remoteAccessManager=new Fs({accountManager:this.accountManager})}},k9=null;function A9(){return k9??=new ise,k9}function j9(){return A9()}var M9=globalThis,N9=M9.__NEXTCLAW_APP_PRESENTER_CONTEXT__??(0,H.createContext)(null);M9.__NEXTCLAW_APP_PRESENTER_CONTEXT__=N9;function ase({children:e}){let t=(0,H.useMemo)(()=>A9(),[]);return(0,U.jsx)(N9.Provider,{value:t,children:e})}function P9(){let e=(0,H.useContext)(N9);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}function ose(){let e=P9();return(0,H.useEffect)(()=>(e.chatCompletionNotificationManager.start(),()=>{e.chatCompletionNotificationManager.stop()}),[e.chatCompletionNotificationManager]),null}var sse=`NextClaw`,cse=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function lse(e,t){return e===t||e.startsWith(`${t}/`)}function use(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of cse)if(lse(t,e))return b(n);return b(`settings`)}function dse(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function fse(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:dse(n)?r||null:t}function pse(e,t){let n=fse(t);return`${sse}${n?` ${n}`:``} - ${use(e)}`}var F9={...R1,...see};function mse({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=Hi();iee();let{pathname:i}=_e(),a=ce(),o=j9(),{language:s}=Wn(),{isMobile:c}=k8(),l=W7(),u=g9(e=>e.isVisible);g9(e=>e.pinnedItems);let d={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab},f=(0,H.useCallback)(e=>{let t=$$(e);if(t)return[{key:`chat`,items:[{key:`add-to-chat`,icon:(0,U.jsx)(xo,{className:`h-4 w-4`}),label:b(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>{let e=i===`/chat`||i.startsWith(`/chat/`),n=i===`/chat`?null:Q7(i.slice(6));o.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:e?n:null,reference:t}),e||a(Z7)}}]}]},[a,i,o]);return(0,H.useEffect)(()=>{document.title=pse(i,window.location)},[i,s]),c&&l!==`win32`?(0,U.jsx)(Uae,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:d,docBrowserRenderers:F9,docBrowserTabMenuGroups:f,topbarLeadingInset:l===`darwin`?`4.75rem`:void 0,children:e}):(0,U.jsx)(Kae,{pathname:i,isMobileLayout:c,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:d,docBrowserRenderers:F9,docBrowserTabMenuGroups:f,sideDock:u?(0,U.jsx)(Woe,{manager:t}):null,children:e})}function hse({children:e}){let t=j9();return(0,U.jsx)(qi,{manager:t.docBrowserManager,children:(0,U.jsx)(mse,{sideDockManager:t.sideDockManager,children:e})})}function gse(){let{isMobile:e}=k8();return e?(0,U.jsx)(Wae,{}):(0,U.jsx)(he,{to:`/model`,replace:!0})}var I9=new Intl.NumberFormat;function _se({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i,onOpenChange:a,onEdit:o}){if(!e)return null;let s=L9(e.model,t?.model),c=vse({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i}),l=R9(e.contextTokens,t?.contextTokens??2e5),u=R9(e.reservedContextTokens,t?.reservedContextTokens),d=L9(e.thinkingDefault,t?.thinkingDefault??`off`),f=B9(e.runtimeConfig??e.engineConfig,t?.engineConfig),p=B9(e.models,t?.models);return(0,U.jsx)(Ur,{open:e!==null,onOpenChange:a,children:(0,U.jsxs)(Kr,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,U.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,U.jsx)(Wr,{className:`text-left`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(az,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(qr,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,U.jsxs)(Br,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,U.jsxs)(H9,{icon:oa,title:b(`agentsDetailsIdentitySection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldDescription`),value:e.description?.trim()||b(`agentsDetailsEmptyValue`),wide:!0}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldWorkspace`),value:e.workspace??b(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,U.jsxs)(H9,{icon:Fr,title:b(`agentsDetailsRuntimeSection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldModel`),value:s.value,source:s.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldRuntime`),value:c.value,source:c.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldRuntimeConfig`),value:f.value,source:f.source,mono:!0,prewrap:!0})]}),(0,U.jsxs)(H9,{icon:Za,title:b(`agentsDetailsContextSection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldContextTokens`),value:l.value,source:l.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldReservedContextTokens`),value:u.value,source:u.source})]}),(0,U.jsxs)(H9,{icon:ca,title:b(`agentsDetailsBehaviorSection`),children:[(0,U.jsx)(U9,{label:b(`agentsDetailsFieldThinkingDefault`),value:d.value,source:d.source}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldModelOverrides`),value:p.value,source:p.source,mono:!0,prewrap:!0}),(0,U.jsx)(U9,{label:b(`agentsDetailsFieldAvatar`),value:e.avatar??b(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,U.jsxs)(Pr,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,onClick:()=>a(!1),children:b(`cancel`)}),(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>o(e),children:[(0,U.jsx)(Ho,{className:`mr-2 h-4 w-4`}),b(`agentsDetailsEditAction`)]})]})]})})}function L9(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||b(`agentsDetailsUnsetValue`),source:`default`}}function R9(e,t){return typeof e==`number`?{value:I9.format(e),source:`override`}:{value:typeof t==`number`?I9.format(t):b(`agentsDetailsUnsetValue`),source:`default`}}function vse(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:z9(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?z9(s,r,a):a,source:`default`}}function z9(e,t,n){let r=EL(e);return r?t.find(e=>e.value===r)?.label??OL(r):n}function B9(e,t){return V9(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:V9(t)?JSON.stringify(t,null,2):b(`agentsDetailsUnsetValue`),source:`default`}}function V9(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function H9(e){let{icon:t,title:n,children:r}=e;return(0,U.jsxs)(`section`,{className:`space-y-2 border-t border-border/60 pt-3 first:border-t-0 first:pt-0`,children:[(0,U.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-foreground`,children:[(0,U.jsx)(t,{className:`h-3.5 w-3.5 text-muted-foreground`}),n]}),(0,U.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function U9(e){let{label:t,value:n,source:r,mono:i=!1,prewrap:a=!1,wide:o=!1}=e,s=a&&n.trim().startsWith(`{`),c=i&&(!a||s);return(0,U.jsxs)(`div`,{className:u(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(o||s)&&`sm:col-span-2`),children:[(0,U.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,U.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-muted-foreground`,children:t})}),(0,U.jsxs)(`dd`,{className:u(`min-w-0 break-words text-xs leading-5 text-foreground`,s?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-muted/50 px-2 py-1.5 text-left`:``),children:[(0,U.jsx)(`span`,{className:c?`font-mono`:void 0,children:n}),r?(0,U.jsx)(yse,{source:r}):null]})]})}function yse({source:e}){return(0,U.jsxs)(`span`,{className:u(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-muted-foreground`),children:[`(`,b(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function bse({form:e,disabled:t=!1,onChange:n}){return(0,U.jsxs)(`details`,{className:`group rounded-2xl border border-border bg-card`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(Xo,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`agentsAdvancedConfigToggle`)})]}),(0,U.jsx)(ar,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,U.jsxs)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-4`,children:[(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:b(`agentsAdvancedConfigDescription`)}),(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,U.jsx)(xse,{label:b(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function xse(e){let{label:t,value:n,min:r,step:i,disabled:a,onChange:o}=e;return(0,U.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-foreground`,children:[(0,U.jsx)(`span`,{children:t}),(0,U.jsx)(St,{type:`number`,min:r,step:i,value:n,disabled:a,placeholder:b(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>o(e.target.value)})]})}function Sse(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:Cse(e.contextTokens)}}function Cse(e){return typeof e==`number`?String(e):``}var wse=xF(`15rem`);function Tse(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function Ese({id:e,value:t,onChange:n,options:r,disabled:i=!1,placeholder:a,className:o,inputClassName:s,emptyText:c,createText:l,toggleLabel:d,maxItems:f=1/0,onEnter:p}){let[m,h]=(0,H.useState)(!1),g=(0,H.useRef)(null);(0,H.useEffect)(()=>{i&&m&&h(!1)},[i,m]);let _=(0,H.useMemo)(()=>Tse(r),[r]),v=t.trim().toLowerCase(),y=(0,H.useMemo)(()=>{let e=_.map((e,t)=>({option:e,index:t}));v.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===v?0:n.startsWith(v)?1:n.includes(v)?2:3,a=r===v?0:r.startsWith(v)?1:r.includes(v)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(f)?t.slice(0,Math.max(1,f)):t},[_,v,f]),b=t.trim().length>0&&_.some(e=>e===t.trim()),x=()=>h(!1);return(0,U.jsxs)(CF,{open:m&&!i,onOpenChange:e=>h(!i&&e),children:[(0,U.jsx)(TF,{asChild:!0,children:(0,U.jsxs)(`div`,{ref:g,className:u(`relative`,o),children:[(0,U.jsx)(St,{id:e,value:t,disabled:i,onFocus:()=>{i||h(!0)},onChange:e=>{n(e.target.value),!m&&!i&&h(!0)},onKeyDown:e=>{e.key===`Enter`&&(p&&(e.preventDefault(),p()),x())},placeholder:a,className:u(`pr-10`,s)}),(0,U.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>h(e=>!e),disabled:i,className:u(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,i?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":d,children:(0,U.jsx)(vee,{className:`h-4 w-4`})})]})}),(0,U.jsx)(EF,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&g.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:wse},children:(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!b&&t.trim().length>0&&(0,U.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(t.trim()),x()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,U.jsx)(Ar,{className:`h-4 w-4 text-transparent`}),(0,U.jsx)(`span`,{className:`truncate text-gray-700`,children:l.replace(`{value}`,t.trim())})]}),y.map(e=>(0,U.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(e),x()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,U.jsx)(Ar,{className:u(`h-4 w-4`,e===t.trim()?`text-primary`:`text-transparent`)}),(0,U.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),y.length===0&&t.trim().length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:c})]})})]})}var Dse=`provider/model`;function W9(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function G9({id:e,value:t,onChange:n,providerCatalog:r,disabled:i=!1,providerPlaceholder:a,modelPlaceholder:o,className:s}){let[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(``),f=r.length>0,p=o??Dse,m=(0,H.useMemo)(()=>new Map(r.map(e=>[e.name,e])),[r]),h=m.get(c),g=(0,H.useMemo)(()=>h?.aliases??[],[h]),_=(0,H.useMemo)(()=>W9(h?.models??[]),[h]);return(0,H.useEffect)(()=>{let e=t.trim();if(!f){l(``),d(e);return}if(!e){d(``),l(e=>m.has(e)?e:``);return}let n=o6(e,r)??``,i=m.get(n)?.aliases??[];l(n),d(n?Q3(e,i):e)},[f,r,m,t]),f?(0,U.jsxs)(`div`,{className:s,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,U.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,U.jsxs)(Dr,{value:c,onValueChange:e=>{let t=W9(m.get(e)?.models??[])[0]??``;if(l(e),d(t),!t){n(``);return}n($3(m.get(e)?.prefix??e,t))},disabled:i,children:[(0,U.jsx)(yr,{className:`h-10 w-full rounded-xl`,children:(0,U.jsx)(fr,{placeholder:a??b(`providersSelectPlaceholder`)})}),(0,U.jsx)(Sr,{children:r.map(e=>(0,U.jsx)(Tr,{value:e.name,children:e.displayName},e.name))})]})}),(0,U.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,U.jsx)(Ese,{id:e,value:u,onChange:e=>{if(!h){let t=e.trim();d(t),n(t);return}let t=Q3(e,g);d(t),n(t?$3(h.prefix,t):``)},options:_,disabled:i||!c,placeholder:p,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:b(`modelPickerNoOptions`),createText:b(`modelPickerUseCustom`),toggleLabel:b(`modelPickerToggleOptions`)},c)]}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:b(`modelInputCustomHint`)})]}):(0,U.jsxs)(`div`,{className:s,children:[(0,U.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:b(`providersEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:b(`providersEmptyDescription`)})]}),(0,U.jsx)(St,{id:e,value:t,disabled:i,onChange:e=>n(e.target.value),placeholder:p,className:`mt-3 h-10 rounded-xl`}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:b(`modelInputCustomHint`)})]})}function Ose(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=EL(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:OL(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function kse({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:r,onChange:i}){let a=e.trim()?EL(e):``,o=Ose({runtimeOptions:n,currentRuntime:e}),s=o.find(e=>e.value===a)??null,c=s?.reasonMessage?.trim()||(s?.ready===!1?b(`agentsRuntimeUnavailableHelp`):``);return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(Dr,{value:a||r,onValueChange:e=>i(e===r?``:e),disabled:t,children:[(0,U.jsx)(yr,{"aria-label":b(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,U.jsx)(fr,{placeholder:b(`agentsRuntimeSelectPlaceholder`)})}),(0,U.jsx)(Sr,{className:`rounded-xl`,children:o.map(e=>(0,U.jsx)(Tr,{value:e.value,disabled:e.ready===!1&&e.value!==a,className:`rounded-lg`,children:e.label},e.value))})]}),c?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null]})}function Ase({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,U.jsx)(Ur,{open:e!==null,onOpenChange:a,children:e?(0,U.jsx)(jse,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function jse(e){let{agent:t,pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:o,onSubmit:s}=e,[c,l]=(0,H.useState)(Sse(t));return(0,U.jsxs)(Kr,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,U.jsx)(`div`,{className:`shrink-0 border-b border-border px-6 py-6`,children:(0,U.jsxs)(Wr,{className:`text-left`,children:[(0,U.jsx)(qr,{children:b(`agentsEditDialogTitle`)}),(0,U.jsx)(Br,{children:b(`agentsEditDialogDescription`)})]})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`warning`,title:b(`agentsEditHomeReadonly`),description:b(`agentsEditHomeReadonlyHint`),children:(0,U.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,U.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,U.jsx)(St,{value:c.displayName,onChange:e=>l(t=>({...t,displayName:e.target.value})),placeholder:b(`agentsFormNamePlaceholder`)}),(0,U.jsx)(Vn,{value:c.description,onChange:e=>l(t=>({...t,description:e.target.value})),placeholder:b(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,U.jsx)(St,{value:c.avatar,onChange:e=>l(t=>({...t,avatar:e.target.value})),placeholder:b(`agentsFormAvatarPlaceholder`)}),(0,U.jsx)(G9,{value:c.model,onChange:e=>l(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,U.jsx)(kse,{value:c.runtime,onChange:e=>l(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,U.jsx)(bse,{form:c,disabled:n,onChange:e=>l(t=>({...t,...e}))})]})}),(0,U.jsxs)(Pr,{className:`shrink-0 border-t border-border px-6 py-5`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,onClick:()=>o(!1),disabled:n,children:b(`cancel`)}),(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>s(t.id,c),disabled:n,children:[(0,U.jsx)(Ho,{className:`mr-2 h-4 w-4`}),b(`agentsEditSaveAction`)]})]})]})}var Mse=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Nse(e){let t=e.trim();if(!t)return null;let n=Number(t);if(!Number.isFinite(n))throw Error(b(`agentsAdvancedInvalidNumberError`));return Math.trunc(n)}function Pse(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:Nse(e.contextTokens)}}function K9(e){let{icon:t,label:n,disabled:r=!1,destructive:i=!1,onClick:a}=e;return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-muted`),onClick:a,disabled:r,children:[(0,U.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:n})]})}function Fse(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:r,updatePending:i,deletePending:a,onStartChat:o,onView:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?n.find(e=>e.value===EL(u))?.label??OL(u):r;return(0,U.jsx)(Ks,{className:`group overflow-hidden border border-border bg-card shadow-none transition-colors duration-200 hover:border-border/80`,children:(0,U.jsxs)(Xs,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,U.jsx)(az,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,U.jsxs)(Xi,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,U.jsx)($o,{className:`h-3 w-3`}),b(`agentsCardBuiltInTag`)]}):null]}),(0,U.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[`@`,t.id]})]})]}),(0,U.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":b(`agentsCardStartChat`),title:b(`agentsCardStartChat`),onClick:o,children:(0,U.jsx)(bo,{className:`h-4 w-4`})}),(0,U.jsxs)(CF,{children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(R,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":b(`chatSessionMoreActions`),title:b(`chatSessionMoreActions`),children:(0,U.jsx)(Aa,{className:`h-4 w-4`})})}),(0,U.jsxs)(EF,{align:`end`,className:`w-44 p-1.5`,children:[(0,U.jsx)(K9,{icon:Ma,label:b(`agentsViewDetailsAction`),onClick:s}),(0,U.jsx)(K9,{icon:Ho,label:b(`agentsEditAction`),onClick:c,disabled:i}),t.builtIn?null:(0,U.jsx)(K9,{icon:fs,label:b(`agentsRemoveAction`),onClick:l,disabled:a,destructive:!0})]})]})]}),(0,U.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground`,children:t.description?.trim()||(t.builtIn?b(`agentsCardBuiltInSummary`):b(`agentsCardCustomSummary`))}),(0,U.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-border/60 pt-2 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(Fr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,U.jsx)(`span`,{className:`truncate`,children:d})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(ro,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,U.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Ise(){let e=eI(),t=oz(),n=j6(),r=P6(),i=F6(),a=a9(),o=sz(),s=cz(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),f=(0,H.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),p=(0,H.useMemo)(()=>[...f].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[f]),m=(0,H.useMemo)(()=>c6({config:n.data,providersView:r.data,templatesView:i.data,onlyConfigured:!0}),[n.data,r.data,i.data]),h=(0,H.useMemo)(()=>kL(a.data?.options??[]),[a.data?.options]),g=(0,H.useMemo)(()=>EL(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,H.useMemo)(()=>h.find(e=>e.value===g)?.label??OL(g),[g,h]),v=n.data?.agents.defaults,y=e=>{l(e)},x=e=>{d(e)},S=async(e,t)=>{let n;try{n=Pse(t)}catch(e){L.error(e instanceof Error?e.message:b(`agentsAdvancedParseFailed`));return}await o.mutateAsync({agentId:e,data:n}),d(null)},C=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,DL(t,g))},w=()=>{e.chatSessionListManager.startAgentDraftChat(`main`,g,Mse)};return(0,U.jsxs)(Bt,{className:`space-y-6`,children:[(0,U.jsx)(xt,{headingLevel:1,title:b(`agentsHeroEyebrow`),description:b(`agentsHeroDescription`),actions:(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:w,children:[(0,U.jsx)(Di,{className:`mr-2 h-4 w-4`}),b(`agentsCreateButton`)]})}),(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,U.jsx)(Ks,{className:`md:col-span-2 xl:col-span-3 border-dashed border-border bg-card/70`,children:(0,U.jsx)(Xs,{className:`py-14 text-center text-sm text-muted-foreground`,children:b(`agentsLoading`)})}):p.length===0?(0,U.jsx)(Ks,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-border bg-gradient-subtle`,children:(0,U.jsxs)(Xs,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,U.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-card/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,U.jsx)(oa,{className:`h-8 w-8 text-warning`})}),(0,U.jsx)(`div`,{className:`text-lg font-semibold text-foreground`,children:b(`agentsEmpty`)}),(0,U.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:b(`agentsEmptyDescription`)}),(0,U.jsxs)(R,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:w,children:[(0,U.jsx)(Di,{className:`mr-2 h-4 w-4`}),b(`agentsCreateButton`)]})]})}):p.map(e=>(0,U.jsx)(Fse,{agent:e,runtimeOptions:h,defaultRuntimeLabel:_,updatePending:o.isPending,deletePending:s.isPending,onStartChat:()=>C(e),onView:()=>y(e),onEdit:()=>x(e),onDelete:()=>s.mutate({agentId:e.id})},e.id))}),(0,U.jsx)(_se,{agent:c,defaults:v,runtimeOptions:h,defaultRuntime:g,defaultRuntimeLabel:_,onOpenChange:e=>{e||l(null)},onEdit:e=>{l(null),d(e)}}),(0,U.jsx)(Ase,{agent:u,pending:o.isPending,providerCatalog:m,runtimeOptions:h,defaultRuntime:g,onOpenChange:e=>{!e&&!o.isPending&&d(null)},onSubmit:S})]})}var q9=`max-w-[min(1180px,100%)]`;function Lse(e){let{routeSessionKey:t,syncRouteSessionSelection:n}=e;(0,H.useLayoutEffect)(()=>{n(t)},[t,n])}function Rse({view:e,confirmDialog:t}){let{isMobile:n}=k8(),r=oY({restorationKey:`main-page:cron`}),i=oY({restorationKey:`main-page:agents`}),{onScroll:a,scrollRef:o}=r,{onScroll:s,scrollRef:c}=i;return(0,U.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,U.jsx)(Y7,{}),e===`chat`?n?(0,U.jsx)(Gae,{}):(0,U.jsx)(Z5,{}):(0,U.jsx)(`section`,{"data-theme-surface":`workspace`,className:`flex-1 min-h-0 overflow-hidden bg-background`,children:e===`inbox`?(0,U.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(_ae,{})}):e===`panel-app`?(0,U.jsx)(z1,{}):e===`cron`?(0,U.jsx)(`div`,{ref:o,onScroll:a,className:`h-full overflow-auto custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(aie,{})})}):e===`agents`?(0,U.jsx)(`div`,{ref:c,onScroll:s,className:`h-full overflow-auto custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(Ise,{})})}):(0,U.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,U.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col px-4 py-4 sm:px-6 sm:py-5 ${q9}`,children:(0,U.jsx)(_Q,{forcedType:`skills`})})})}),t]})}function zse(e){let t=eI(),n=j6(),r=P6(),i=F6(),a=sL({limit:200}),o=a9(),s=e.sessionKey?.trim()||`draft-session`,c=lL({sessionId:s});(0,H.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function Bse(){let e=eI();(0,H.useEffect)(()=>I.eventBus.on(c.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function Vse(){let{sessionId:e}=le(),t=(0,H.useMemo)(()=>Q7(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function Hse(){let e=eI(),{confirm:t,ConfirmDialog:n}=On(),r=_e(),i=ce();return(0,H.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,U.jsx)(n,{})}function Use({view:e}){let t=P9();return(0,U.jsx)($F,{presenter:(0,H.useMemo)(()=>new hoe(t),[t]),children:(0,U.jsx)(Wse,{view:e})})}function Wse({view:e}){let t=P9(),n=eI(),r=Hse(),{routeSessionKey:i,sessionKey:a}=Vse(),o=$(e=>{let{snapshot:t}=e;return t.workspacePanelParentKey!==(a??null)||t.activeWorkspacePanelKind!==`child-session`?null:t.activeChildSessionKey?.trim()||null});return(0,H.useEffect)(()=>(t.chatCompletionNotificationManager.syncVisibleSessions([a,o]),()=>{t.chatCompletionNotificationManager.syncVisibleSessions([])}),[t.chatCompletionNotificationManager,a,o]),zse({sessionKey:a??null}),Lse({routeSessionKey:i,syncRouteSessionSelection:n.chatSessionListManager.syncRouteSessionSelection}),Bse(),(0,U.jsx)(Rse,{view:e,confirmDialog:r})}function J9({view:e}){return(0,U.jsx)(Use,{view:e})}var Y9=P(e=>({pending:null,present:t=>e({pending:t}),clear:()=>e({pending:null})})),Gse=`desktop.authorization.required`;function Kse(){let e=Y9(e=>e.pending),t=Y9(e=>e.present),n=Y9(e=>e.clear),[r,i]=(0,H.useState)(!1);(0,H.useEffect)(()=>I.eventBus.subscribeAll(e=>{if(e.type!==Gse)return;let n=qse(e.payload);n&&t(n)}),[t]);let a=async()=>{if(!(!e||r)){i(!0);try{await R7.grantAccess(e.request),await jt.invalidateQueries({queryKey:[`desktop-capability`,`grants`]}),n(),L.success(b(`desktopAuthorizationAllowed`))}catch(e){L.error(e instanceof Error?e.message:b(`desktopAuthorizationFailed`))}finally{i(!1)}}};return(0,U.jsx)(Ur,{open:!!e,onOpenChange:e=>{!e&&!r&&n()},children:(0,U.jsxs)(Kr,{className:`[&>:last-child]:hidden`,children:[(0,U.jsxs)(Wr,{children:[(0,U.jsxs)(qr,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Qo,{className:`h-4 w-4 text-amber-600`}),b(`desktopAuthorizationTitle`)]}),(0,U.jsx)(Br,{children:b(`desktopAuthorizationDescription`)})]}),e?(0,U.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-muted/55 p-4 text-sm`,children:[(0,U.jsx)(X9,{label:b(`desktopAuthorizationCaller`),value:Jse(e)}),(0,U.jsx)(X9,{label:b(`desktopAuthorizationApplication`),value:e.applicationId}),(0,U.jsx)(X9,{label:b(`desktopAuthorizationAccess`),value:e.request.access.map(Yse).join(`, `)}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:Xse(e.request.access)})]}):null,(0,U.jsxs)(Pr,{className:`gap-2 sm:gap-0`,children:[(0,U.jsx)(R,{type:`button`,variant:`outline`,disabled:r,onClick:n,children:b(`desktopAuthorizationReject`)}),(0,U.jsx)(R,{type:`button`,disabled:r,onClick:()=>void a(),children:b(r?`desktopAuthorizationAllowing`:`desktopAuthorizationAllow`)})]})]})})}function X9({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}function qse(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,{request:n}=t;if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=n;return typeof t.applicationId!=`string`||!r.subject||!r.resource||!Array.isArray(r.access)||typeof r.declarationFingerprint!=`string`?null:{applicationId:t.applicationId,request:r}}function Jse(e){let{subject:t}=e.request;return`${t.type===`agent`?b(`desktopCapabilitiesAgent`):b(`desktopCapabilitiesExtension`)} · ${t.id}`}function Yse(e){return e===`ui.read`?b(`desktopAuthorizationRead`):e===`ui.observe`?b(`desktopAuthorizationObserve`):e===`ui.write`?b(`desktopAuthorizationWrite`):e===`screen.capture-window`?b(`desktopAuthorizationScreenCapture`):e===`input.pointer`?b(`desktopAuthorizationPointerInput`):e}function Xse(e){return e.includes(`ui.write`)?b(`desktopAuthorizationWriteRisk`):e.includes(`screen.capture-window`)?b(`desktopAuthorizationScreenCaptureRisk`):e.includes(`input.pointer`)?b(`desktopAuthorizationPointerInputRisk`):b(`desktopAuthorizationReadRisk`)}function Zse(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function Qse(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function $se(e,t){e&&Zse(t)&&e.invalidateQueries({queryKey:[`config`]}),Qse(e,t)}function Z9(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return/^[a-z]:/i.test(t)?t.toLowerCase():t}function ece(e,t){if(!e)return;let n=Z9(t);e.invalidateQueries({predicate:e=>e.queryKey[0]===`server-path-browse`&&typeof e.queryKey[1]==`string`&&Z9(e.queryKey[1])===n})}function tce(e){let t=(0,H.useRef)(!1);(0,H.useEffect)(()=>{let n=I.eventBus.on(c.connectionOpen,()=>{wt.handleConnectionRestored(),Re.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=I.eventBus.on(c.connectionClose,()=>{wt.handleConnectionInterrupted(null),t.current=!0}),i=I.eventBus.on(c.connectionError,e=>{wt.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=I.eventBus.on(c.configUpdated,({path:t})=>{$se(e,t)}),o=I.eventBus.on(c.serverPathChanged,({directoryPath:t})=>ece(e,t)),s=I.eventBus.on(c.runtimeUpdateSnapshot,e=>{Re.reportSnapshot(e)}),l=I.eventBus.on(c.sessionRunStatus,t=>{vn(e,{type:`session.run-status`,payload:t})}),u=I.eventBus.on(c.sessionSummaryUpsert,t=>{vn(e,{type:`session.summary.upsert`,payload:t})}),d=I.eventBus.on(c.sessionSummaryDelete,t=>{vn(e,{type:`session.summary.delete`,payload:t})}),f=I.eventBus.on(c.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),l(),u(),d(),f()}},[e])}var nce={"--width":`320px`},rce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-DAseq1vr.js`);return{ModelConfigPage:e}},__vite__mapDeps([40,4,41,28,32,30,33,1,34,42,38,39,43,44,45]))).ModelConfigPage})),ice=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-BLaxNij2.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([46,4,47,27,28,30,41,48,49,29,37,26,31,32,33,1,34,35,36,38,39,42,50,44]))).AppearanceSettingsPage})),ace=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-Bi9J2kYR.js`);return{SearchConfigPage:e}},__vite__mapDeps([51,4,47,27,28,30,41,31,33,1,34,52,43]))).SearchConfigPage})),oce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-zP-J1Asx.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([53,4,47,27,28,30,49,29,41,37,31,42,35,36,52,43,45,34]))).ProvidersConfigPage})),sce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ExtensionsConfigPage:e}=await import(`./extensions-Mc3juAVp.js`);return{ExtensionsConfigPage:e}},__vite__mapDeps([54,41,4,28,36,30]))).ExtensionsConfigPage})),cce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-eUVEhukh.js`);return{ChannelsList:e}},__vite__mapDeps([55,4,47,27,28,30,41,31,32,33,1,34,42,37,52,50,43,45]))).ChannelsList})),lce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-D5KbQ3ue.js`);return{RuntimeConfig:e}},__vite__mapDeps([56,4,47,27,28,30,41,48,49,29,37,26,31,32,33,1,34,35,36,38,39,42,50,44,57,58,43]))).RuntimeConfig})),uce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-BWP2Pr4u.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([59,47,4,27,28,30,41,33,1,34,36,57]))).DesktopUpdateConfig})),dce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SecurityConfig:e}=await import(`./security-config-CNdun2s-.js`);return{SecurityConfig:e}},__vite__mapDeps([60,41,4,28]))).SecurityConfig})),fce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-0MP2MSvq.js`);return{SecretsConfigPage:e}},__vite__mapDeps([61,4,47,27,28,30,41,35,58,43]))).SecretsConfigPage})),pce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{PrivacySettingsPage:e}=await import(`./privacy-settings-page-COFa7LrK.js`);return{PrivacySettingsPage:e}},__vite__mapDeps([62,47,4,27,28,30,41]))).PrivacySettingsPage})),mce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DesktopCapabilitiesPage:e}=await import(`./desktop-capabilities-page-FV7xowDx.js`);return{DesktopCapabilitiesPage:e}},__vite__mapDeps([63,41,4,28]))).DesktopCapabilitiesPage})),hce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{RemoteAccessPage:e}=await import(`./remote-EeKMCoyb.js`);return{RemoteAccessPage:e}},[])).RemoteAccessPage})),gce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-Dj0xiFAV.js`);return{McpMarketplacePage:e}},__vite__mapDeps([64,48,4,47,27,28,30,49,29,41,37,26,31,32,33,1,34,35,36,38,39,42,50,44]))).McpMarketplacePage}));function _ce(){return(0,U.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function vce({children:e}){return(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(_ce,{}),children:e})}function Q9(e){return(0,U.jsx)(vce,{children:e})}var yce=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:Q9((0,U.jsx)(J9,{view:`chat`}))},{path:`/agents`,element:Q9((0,U.jsx)(J9,{view:`agents`}))},{path:`/skills`,element:Q9((0,U.jsx)(J9,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:Q9((0,U.jsx)(J9,{view:`skills`}))},{path:`/cron`,element:Q9((0,U.jsx)(J9,{view:`cron`}))},{path:`/inbox/:deliveryId?`,element:Q9((0,U.jsx)(J9,{view:`inbox`}))},{path:`/apps/panel/:appId`,element:Q9((0,U.jsx)(J9,{view:`panel-app`}))},{path:`/appearance`,element:Q9((0,U.jsx)(ice,{}))},{path:`/model`,element:Q9((0,U.jsx)(rce,{}))},{path:`/search`,element:Q9((0,U.jsx)(ace,{}))},{path:`/providers`,element:Q9((0,U.jsx)(oce,{}))},{path:`/extensions`,element:Q9((0,U.jsx)(sce,{}))},{path:`/channels`,element:Q9((0,U.jsx)(cce,{}))},{path:`/runtime`,element:Q9((0,U.jsx)(lce,{}))},{path:`/updates`,element:Q9((0,U.jsx)(uce,{}))},{path:`/remote`,element:Q9((0,U.jsx)(hce,{}))},{path:`/security`,element:Q9((0,U.jsx)(dce,{}))},{path:`/privacy`,element:Q9((0,U.jsx)(pce,{}))},{path:`/desktop-capabilities`,element:Q9((0,U.jsx)(mce,{}))},{path:`/secrets`,element:Q9((0,U.jsx)(fce,{}))},{path:`/settings`,element:(0,U.jsx)(gse,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:Q9((0,U.jsx)(gce,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function bce(e){return`redirectTo`in e?(0,U.jsx)(se,{path:e.path,element:(0,U.jsx)(he,{to:e.redirectTo,replace:!0})},e.path):(0,U.jsx)(se,{path:e.path,element:e.element},e.path)}function xce(){return(0,U.jsx)(de,{children:yce.map(bce)})}function $9(){return tce(jt),ye(),(0,H.useEffect)(()=>(Re.start(),()=>{Re.stop()}),[]),(0,U.jsxs)(ase,{children:[(0,U.jsx)(ose,{}),(0,U.jsx)(pae,{}),(0,U.jsx)(hse,{children:(0,U.jsx)(xce,{})}),(0,U.jsx)(Gs,{}),(0,U.jsx)(f$,{}),(0,U.jsx)(Kse,{})]})}function Sce(){let e=Se(),t=e.isError&&En(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,U.jsx)($9,{}):e.data?.enabled&&!e.data.authenticated?(0,U.jsx)(Qs,{username:e.data.username}):(0,U.jsx)($9,{})}function Cce(){return(0,H.useEffect)(()=>{zie()},[]),(0,U.jsxs)(Lt,{client:jt,children:[(0,U.jsx)(Sce,{}),(0,U.jsx)(Lie,{}),(0,U.jsx)(Ot,{position:`top-right`,richColors:!0,offset:{top:window.nextclawDesktop?.platform===`win32`?56:44,right:72},mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0,style:nce})]})}var wce=window.nextclawDesktop?.platform===`win32`?oe:me;(0,bs.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(H.StrictMode,{children:(0,U.jsx)(Hie,{children:(0,U.jsx)(Mn,{children:(0,U.jsx)(wce,{children:(0,U.jsx)(Cce,{})})})})}));export{Xs as $,R6 as A,t6 as B,N6 as C,ao as Ct,K6 as D,fa as Dt,P6 as E,Aa as Et,Z6 as F,qY as G,t0 as H,J3 as I,ML as J,JY as K,c6 as L,V6 as M,X6 as N,W6 as O,na as Ot,B6 as P,Ks as Q,s6 as R,q6 as S,oo as St,F6 as T,Ma as Tt,KY as U,e6 as V,YY as W,EF as X,CF as Y,wF as Z,H6 as _,Zo as _t,Nae as a,Fs as at,Q6 as b,Uo as bt,Sae as c,ks as ct,Iie as d,Ns as dt,Ys as et,t7 as f,Ts as ft,L6 as g,ss as gt,M6 as h,fs as ht,kae as i,zs as it,z6 as j,Y6 as k,M7 as l,As as lt,j6 as m,Ss as mt,g9 as n,Js as nt,Mae as o,Ps as ot,k8 as p,Cs as pt,GL as q,jae as r,Bs as rt,Pae as s,Es as st,G9 as t,qs as tt,h7 as u,js as ut,U6 as v,Xo as vt,I6 as w,$a as wt,J6 as x,wo as xt,G6 as y,Wo as yt,r6 as z};
|